@fluidframework/routerlicious-driver 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -12
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +156 -0
- package/README.md +39 -1
- package/api-extractor-esm.json +4 -0
- 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} +8 -1
- 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} +2 -2
- package/lib/createNewUtils.d.mts.map +1 -0
- package/lib/{createNewUtils.js → createNewUtils.mjs} +7 -5
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{defaultTokenProvider.d.ts → defaultTokenProvider.d.mts} +3 -2
- 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.ts → definitions.d.mts} +1 -1
- 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} +9 -8
- 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} +4 -5
- 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} +17 -9
- 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} +8 -6
- 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} +8 -7
- 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.ts → nullBlobStorageService.d.mts} +1 -1
- 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} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{policies.d.ts → policies.d.mts} +23 -10
- 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} +10 -9
- 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} +35 -6
- 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} +3 -3
- 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} +13 -11
- 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 +142 -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.d.ts.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.d.ts.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
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { IDocumentService } from '@fluidframework/driver-definitions';
|
|
2
|
+
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { ISession } from '@fluidframework/server-services-client';
|
|
5
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: DefaultTokenProvider */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: DocumentPostCreateError */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IDocumentService */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IDocumentServiceFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IRouterliciousDriverPolicies */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Abstracts the token fetching mechanism for a hosting application.
|
|
23
|
+
* The hosting application is responsible for providing an implementation.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare interface ITokenProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Fetches the orderer token from host.
|
|
29
|
+
*
|
|
30
|
+
* @param tenantId - Tenant ID.
|
|
31
|
+
* @param documentId - Optional. Document ID is only required for document-scoped requests.
|
|
32
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
33
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
34
|
+
* and so a fresh token is required.
|
|
35
|
+
*
|
|
36
|
+
* Default: `false`.
|
|
37
|
+
*
|
|
38
|
+
* NOTE: This parameter will be made required in the future.
|
|
39
|
+
*/
|
|
40
|
+
fetchOrdererToken(tenantId: string, documentId?: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Fetches the storage token from host.
|
|
43
|
+
*
|
|
44
|
+
* @param tenantId - Tenant ID.
|
|
45
|
+
* @param documentId - Document ID.
|
|
46
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
47
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
48
|
+
* and so a fresh token is required.
|
|
49
|
+
*
|
|
50
|
+
* Default: `false`.
|
|
51
|
+
*
|
|
52
|
+
* NOTE: This parameter will be made required in the future.
|
|
53
|
+
*/
|
|
54
|
+
fetchStorageToken(tenantId: string, documentId: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* A callback triggered directly after creating the document. In this callback the client has the opportunity, to
|
|
57
|
+
* verify against an authorization service, if the user who claims to create the document is the same user who
|
|
58
|
+
* created it.
|
|
59
|
+
*
|
|
60
|
+
* @remarks Notes:
|
|
61
|
+
*
|
|
62
|
+
* * Using the callback may have performance impact on the document creation process.
|
|
63
|
+
*
|
|
64
|
+
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
65
|
+
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
66
|
+
*
|
|
67
|
+
* @param documentId - Document ID.
|
|
68
|
+
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
69
|
+
* and document id. It can be used to validate the identity of the document creator.
|
|
70
|
+
*/
|
|
71
|
+
documentPostCreateCallback?(documentId: string, creationToken: string): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export declare interface ITokenResponse {
|
|
78
|
+
/**
|
|
79
|
+
* {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} value.
|
|
80
|
+
*/
|
|
81
|
+
jwt: string;
|
|
82
|
+
/**
|
|
83
|
+
* A flag indicating whether token was obtained from local cache.
|
|
84
|
+
*
|
|
85
|
+
* @remarks `undefined` indicates that the source of the token could not be determined.
|
|
86
|
+
*/
|
|
87
|
+
fromCache?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Excluded from this release type: ITokenService */
|
|
91
|
+
|
|
92
|
+
/* Excluded from this release type: RouterliciousDocumentServiceFactory */
|
|
93
|
+
|
|
94
|
+
/* Excluded from this release type: RouterliciousErrorType */
|
|
95
|
+
|
|
96
|
+
/* Excluded from this release type: RouterliciousErrorTypes */
|
|
97
|
+
|
|
98
|
+
export { }
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { IDocumentService } from '@fluidframework/driver-definitions';
|
|
2
|
+
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { ISession } from '@fluidframework/server-services-client';
|
|
5
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: DefaultTokenProvider */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: DocumentPostCreateError */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IDocumentService */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IDocumentServiceFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IRouterliciousDriverPolicies */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Abstracts the token fetching mechanism for a hosting application.
|
|
23
|
+
* The hosting application is responsible for providing an implementation.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare interface ITokenProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Fetches the orderer token from host.
|
|
29
|
+
*
|
|
30
|
+
* @param tenantId - Tenant ID.
|
|
31
|
+
* @param documentId - Optional. Document ID is only required for document-scoped requests.
|
|
32
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
33
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
34
|
+
* and so a fresh token is required.
|
|
35
|
+
*
|
|
36
|
+
* Default: `false`.
|
|
37
|
+
*
|
|
38
|
+
* NOTE: This parameter will be made required in the future.
|
|
39
|
+
*/
|
|
40
|
+
fetchOrdererToken(tenantId: string, documentId?: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Fetches the storage token from host.
|
|
43
|
+
*
|
|
44
|
+
* @param tenantId - Tenant ID.
|
|
45
|
+
* @param documentId - Document ID.
|
|
46
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
47
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
48
|
+
* and so a fresh token is required.
|
|
49
|
+
*
|
|
50
|
+
* Default: `false`.
|
|
51
|
+
*
|
|
52
|
+
* NOTE: This parameter will be made required in the future.
|
|
53
|
+
*/
|
|
54
|
+
fetchStorageToken(tenantId: string, documentId: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* A callback triggered directly after creating the document. In this callback the client has the opportunity, to
|
|
57
|
+
* verify against an authorization service, if the user who claims to create the document is the same user who
|
|
58
|
+
* created it.
|
|
59
|
+
*
|
|
60
|
+
* @remarks Notes:
|
|
61
|
+
*
|
|
62
|
+
* * Using the callback may have performance impact on the document creation process.
|
|
63
|
+
*
|
|
64
|
+
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
65
|
+
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
66
|
+
*
|
|
67
|
+
* @param documentId - Document ID.
|
|
68
|
+
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
69
|
+
* and document id. It can be used to validate the identity of the document creator.
|
|
70
|
+
*/
|
|
71
|
+
documentPostCreateCallback?(documentId: string, creationToken: string): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export declare interface ITokenResponse {
|
|
78
|
+
/**
|
|
79
|
+
* {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} value.
|
|
80
|
+
*/
|
|
81
|
+
jwt: string;
|
|
82
|
+
/**
|
|
83
|
+
* A flag indicating whether token was obtained from local cache.
|
|
84
|
+
*
|
|
85
|
+
* @remarks `undefined` indicates that the source of the token could not be determined.
|
|
86
|
+
*/
|
|
87
|
+
fromCache?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Excluded from this release type: ITokenService */
|
|
91
|
+
|
|
92
|
+
/* Excluded from this release type: RouterliciousDocumentServiceFactory */
|
|
93
|
+
|
|
94
|
+
/* Excluded from this release type: RouterliciousErrorType */
|
|
95
|
+
|
|
96
|
+
/* Excluded from this release type: RouterliciousErrorTypes */
|
|
97
|
+
|
|
98
|
+
export { }
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { IDocumentService } from '@fluidframework/driver-definitions';
|
|
2
|
+
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
4
|
+
import { ISession } from '@fluidframework/server-services-client';
|
|
5
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare class DefaultTokenProvider implements ITokenProvider {
|
|
14
|
+
private readonly jwt;
|
|
15
|
+
constructor(jwt: string);
|
|
16
|
+
fetchOrdererToken(): Promise<ITokenResponse>;
|
|
17
|
+
fetchStorageToken(): Promise<ITokenResponse>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Error returned by {@link RouterliciousDocumentServiceFactory.createContainer} when an error is thrown
|
|
22
|
+
* in {@link ITokenProvider.documentPostCreateCallback}.
|
|
23
|
+
* It is the consumer's responsibility to ensure that any state related to container creation is appropriately
|
|
24
|
+
* cleaned up in the event of failure.
|
|
25
|
+
* This includes the document itself, which will have been created by the time this error was thrown.
|
|
26
|
+
*
|
|
27
|
+
* @remarks TODO: examples of suggested actions for recovery.
|
|
28
|
+
* - How would a user delete the created document?
|
|
29
|
+
* - What would a retry pattern look like here?
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare class DocumentPostCreateError extends Error {
|
|
33
|
+
/**
|
|
34
|
+
* Inner error being wrapped.
|
|
35
|
+
*/
|
|
36
|
+
private readonly innerError;
|
|
37
|
+
constructor(
|
|
38
|
+
/**
|
|
39
|
+
* Inner error being wrapped.
|
|
40
|
+
*/
|
|
41
|
+
innerError: Error);
|
|
42
|
+
readonly name = "DocumentPostCreateError";
|
|
43
|
+
get stack(): string | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare interface IRouterliciousDriverPolicies {
|
|
50
|
+
/**
|
|
51
|
+
* Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.
|
|
52
|
+
* Default: true
|
|
53
|
+
*/
|
|
54
|
+
enablePrefetch: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Rate limit concurrent storage requests.
|
|
57
|
+
* Default: 100
|
|
58
|
+
*/
|
|
59
|
+
maxConcurrentStorageRequests: number;
|
|
60
|
+
/**
|
|
61
|
+
* Rate limit concurrent orderer requests.
|
|
62
|
+
* Default: 100
|
|
63
|
+
*/
|
|
64
|
+
maxConcurrentOrdererRequests: number;
|
|
65
|
+
/**
|
|
66
|
+
* Enable uploading entire summary tree as a IWholeSummaryPayload to storage.
|
|
67
|
+
* Default: false
|
|
68
|
+
*/
|
|
69
|
+
enableWholeSummaryUpload: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Enable service endpoint discovery when creating or joining a session.
|
|
72
|
+
* Default: false
|
|
73
|
+
*/
|
|
74
|
+
enableDiscovery: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Enable using RestLess which avoids CORS preflight requests.
|
|
77
|
+
* Default: true
|
|
78
|
+
*/
|
|
79
|
+
enableRestLess: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Enable internal cache of summaries/snapshots.
|
|
82
|
+
* Reduces Summarizer boot time and reduces server load in E2E tests.
|
|
83
|
+
* Default: true
|
|
84
|
+
*/
|
|
85
|
+
enableInternalSummaryCaching: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Enable downgrading socket connection to long-polling
|
|
88
|
+
* when websocket connection cannot be established.
|
|
89
|
+
* Default: true
|
|
90
|
+
*/
|
|
91
|
+
enableLongPollingDowngrade: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Indicates that the container is ephemeral.
|
|
94
|
+
* Artifacts relates to the container are limited to container lifetime.
|
|
95
|
+
* Default: false
|
|
96
|
+
*/
|
|
97
|
+
isEphemeralContainer: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Abstracts the token fetching mechanism for a hosting application.
|
|
102
|
+
* The hosting application is responsible for providing an implementation.
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export declare interface ITokenProvider {
|
|
106
|
+
/**
|
|
107
|
+
* Fetches the orderer token from host.
|
|
108
|
+
*
|
|
109
|
+
* @param tenantId - Tenant ID.
|
|
110
|
+
* @param documentId - Optional. Document ID is only required for document-scoped requests.
|
|
111
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
112
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
113
|
+
* and so a fresh token is required.
|
|
114
|
+
*
|
|
115
|
+
* Default: `false`.
|
|
116
|
+
*
|
|
117
|
+
* NOTE: This parameter will be made required in the future.
|
|
118
|
+
*/
|
|
119
|
+
fetchOrdererToken(tenantId: string, documentId?: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Fetches the storage token from host.
|
|
122
|
+
*
|
|
123
|
+
* @param tenantId - Tenant ID.
|
|
124
|
+
* @param documentId - Document ID.
|
|
125
|
+
* @param refresh - Optional flag indicating whether token fetch must bypass local cache.
|
|
126
|
+
* This likely indicates that some previous request failed authorization due to an expired token,
|
|
127
|
+
* and so a fresh token is required.
|
|
128
|
+
*
|
|
129
|
+
* Default: `false`.
|
|
130
|
+
*
|
|
131
|
+
* NOTE: This parameter will be made required in the future.
|
|
132
|
+
*/
|
|
133
|
+
fetchStorageToken(tenantId: string, documentId: string, refresh?: boolean): Promise<ITokenResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* A callback triggered directly after creating the document. In this callback the client has the opportunity, to
|
|
136
|
+
* verify against an authorization service, if the user who claims to create the document is the same user who
|
|
137
|
+
* created it.
|
|
138
|
+
*
|
|
139
|
+
* @remarks Notes:
|
|
140
|
+
*
|
|
141
|
+
* * Using the callback may have performance impact on the document creation process.
|
|
142
|
+
*
|
|
143
|
+
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
144
|
+
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
145
|
+
*
|
|
146
|
+
* @param documentId - Document ID.
|
|
147
|
+
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
148
|
+
* and document id. It can be used to validate the identity of the document creator.
|
|
149
|
+
*/
|
|
150
|
+
documentPostCreateCallback?(documentId: string, creationToken: string): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
export declare interface ITokenResponse {
|
|
157
|
+
/**
|
|
158
|
+
* {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} value.
|
|
159
|
+
*/
|
|
160
|
+
jwt: string;
|
|
161
|
+
/**
|
|
162
|
+
* A flag indicating whether token was obtained from local cache.
|
|
163
|
+
*
|
|
164
|
+
* @remarks `undefined` indicates that the source of the token could not be determined.
|
|
165
|
+
*/
|
|
166
|
+
fromCache?: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Abstracts the discovery of claims contained within a token.
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
export declare interface ITokenService {
|
|
174
|
+
/**
|
|
175
|
+
* Extracts the {@link @fluidframework/protocol-definitions#ITokenClaims | token claims} from the provided
|
|
176
|
+
* {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} string representation.
|
|
177
|
+
*/
|
|
178
|
+
extractClaims(token: string): ITokenClaims;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Factory for creating the routerlicious document service. Use this if you want to
|
|
183
|
+
* use the routerlicious implementation.
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
export declare class RouterliciousDocumentServiceFactory implements IDocumentServiceFactory {
|
|
187
|
+
private readonly tokenProvider;
|
|
188
|
+
private readonly driverPolicies;
|
|
189
|
+
private readonly blobCache;
|
|
190
|
+
private readonly wholeSnapshotTreeCache;
|
|
191
|
+
private readonly shreddedSummaryTreeCache;
|
|
192
|
+
constructor(tokenProvider: ITokenProvider, driverPolicies?: Partial<IRouterliciousDriverPolicies>);
|
|
193
|
+
/**
|
|
194
|
+
* {@inheritDoc @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer}
|
|
195
|
+
*
|
|
196
|
+
* @throws {@link DocumentPostCreateError}
|
|
197
|
+
* If an exception is thrown while invoking the provided {@link ITokenProvider.documentPostCreateCallback}.
|
|
198
|
+
*/
|
|
199
|
+
createContainer(createNewSummary: ISummaryTree | undefined, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
200
|
+
/**
|
|
201
|
+
* {@inheritDoc @fluidframework/driver-definitions#IDocumentServiceFactory.createDocumentService}
|
|
202
|
+
*
|
|
203
|
+
* @returns Routerlicious document service.
|
|
204
|
+
*/
|
|
205
|
+
createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean, session?: ISession): Promise<IDocumentService>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Routerlicious Error types
|
|
210
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
211
|
+
*
|
|
212
|
+
* @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
215
|
+
export declare enum RouterliciousErrorType {
|
|
216
|
+
/**
|
|
217
|
+
* File not found, or file deleted during session
|
|
218
|
+
*/
|
|
219
|
+
fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
|
|
220
|
+
/**
|
|
221
|
+
* SSL Certificate Error.
|
|
222
|
+
*/
|
|
223
|
+
sslCertError = "sslCertError"
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Routerlicious Error types
|
|
228
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
export declare const RouterliciousErrorTypes: {
|
|
232
|
+
/**
|
|
233
|
+
* SSL Certificate Error.
|
|
234
|
+
*/
|
|
235
|
+
readonly sslCertError: "sslCertError";
|
|
236
|
+
readonly genericNetworkError: "genericNetworkError";
|
|
237
|
+
readonly authorizationError: "authorizationError";
|
|
238
|
+
readonly fileNotFoundOrAccessDeniedError: "fileNotFoundOrAccessDeniedError";
|
|
239
|
+
readonly offlineError: "offlineError";
|
|
240
|
+
readonly unsupportedClientProtocolVersion: "unsupportedClientProtocolVersion";
|
|
241
|
+
readonly writeError: "writeError";
|
|
242
|
+
readonly fetchFailure: "fetchFailure";
|
|
243
|
+
readonly fetchTokenError: "fetchTokenError";
|
|
244
|
+
readonly incorrectServerResponse: "incorrectServerResponse";
|
|
245
|
+
readonly fileOverwrittenInStorage: "fileOverwrittenInStorage";
|
|
246
|
+
readonly deltaStreamConnectionForbidden: "deltaStreamConnectionForbidden";
|
|
247
|
+
readonly locationRedirection: "locationRedirection";
|
|
248
|
+
readonly fluidInvalidSchema: "fluidInvalidSchema";
|
|
249
|
+
readonly fileIsLocked: "fileIsLocked";
|
|
250
|
+
readonly outOfStorageError: "outOfStorageError";
|
|
251
|
+
readonly genericError: "genericError";
|
|
252
|
+
readonly throttlingError: "throttlingError";
|
|
253
|
+
readonly usageError: "usageError";
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @internal
|
|
258
|
+
*/
|
|
259
|
+
export declare type RouterliciousErrorTypes = (typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];
|
|
260
|
+
|
|
261
|
+
export { }
|
|
@@ -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
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { IDocumentStorageService, ISummaryContext, IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { ICreateBlobResponse, ISnapshotTreeEx, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { IRouterliciousDriverPolicies } from "./policies.mjs";
|
|
9
|
+
import { ICache } from "./cache.mjs";
|
|
10
|
+
import { ISnapshotTreeVersion } from "./definitions.mjs";
|
|
11
|
+
import { GitManager } from "./gitManager.mjs";
|
|
12
12
|
/**
|
|
13
13
|
* Document access to underlying storage for routerlicious driver.
|
|
14
14
|
* Uploads summaries piece-by-piece traversing the tree recursively.
|
|
@@ -17,15 +17,16 @@ import { ISnapshotTreeVersion } from "./definitions";
|
|
|
17
17
|
export declare class ShreddedSummaryDocumentStorageService implements IDocumentStorageService {
|
|
18
18
|
protected readonly id: string;
|
|
19
19
|
protected readonly manager: GitManager;
|
|
20
|
-
protected readonly logger:
|
|
20
|
+
protected readonly logger: ITelemetryLoggerExt;
|
|
21
21
|
readonly policies: IDocumentStorageServicePolicies;
|
|
22
22
|
private readonly getStorageManager;
|
|
23
|
+
private readonly mc;
|
|
23
24
|
protected readonly blobsShaCache: Map<string, string>;
|
|
24
25
|
private readonly blobCache;
|
|
25
26
|
private readonly snapshotTreeCache;
|
|
26
|
-
|
|
27
|
+
readonly repositoryUrl = "";
|
|
27
28
|
private getSummaryUploadManager;
|
|
28
|
-
constructor(id: string, manager: GitManager, logger:
|
|
29
|
+
constructor(id: string, manager: GitManager, logger: ITelemetryLoggerExt, policies: IDocumentStorageServicePolicies, driverPolicies?: IRouterliciousDriverPolicies, blobCache?: ICache<ArrayBufferLike>, snapshotTreeCache?: ICache<ISnapshotTreeVersion>, getStorageManager?: (disableCache?: boolean) => Promise<GitManager>);
|
|
29
30
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
30
31
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
|
|
31
32
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
@@ -35,4 +36,4 @@ export declare class ShreddedSummaryDocumentStorageService implements IDocumentS
|
|
|
35
36
|
private getPreviousFullSnapshot;
|
|
36
37
|
private getCacheKey;
|
|
37
38
|
}
|
|
38
|
-
//# sourceMappingURL=shreddedSummaryDocumentStorageService.d.
|
|
39
|
+
//# sourceMappingURL=shreddedSummaryDocumentStorageService.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shreddedSummaryDocumentStorageService.d.mts","sourceRoot":"","sources":["../src/shreddedSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,mBAAmB,EAInB,MAAM,iCAAiC;OAEjC,EACN,uBAAuB,EACvB,eAAe,EACf,+BAA+B,EAC/B,MAAM,oCAAoC;OAEpC,EACN,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC;OACtC,EAAE,4BAA4B,EAAE;OAChC,EAAE,MAAM,EAAiB;OAEzB,EAAE,oBAAoB,EAAE;OACxB,EAAE,UAAU,EAAE;AAMrB;;;;GAIG;AACH,qBAAa,qCAAsC,YAAW,uBAAuB;IAoBnF,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;IA1BnC,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;IAE7E,SAAgB,aAAa,MAAM;YAErB,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.js → shreddedSummaryDocumentStorageService.mjs}
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { PerformanceEvent, createChildMonitoringContext, } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
7
|
+
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
8
|
+
import { InMemoryCache } from "./cache.mjs";
|
|
9
|
+
import { RetriableGitManager } from "./retriableGitManager.mjs";
|
|
10
|
+
import { SummaryTreeUploadManager } from "./summaryTreeUploadManager.mjs";
|
|
11
11
|
const isNode = typeof window === "undefined";
|
|
12
12
|
/**
|
|
13
13
|
* Document access to underlying storage for routerlicious driver.
|
|
@@ -15,7 +15,11 @@ const isNode = typeof window === "undefined";
|
|
|
15
15
|
* Downloads summaries piece-by-piece on-demand, or up-front when prefetch is enabled.
|
|
16
16
|
*/
|
|
17
17
|
export class ShreddedSummaryDocumentStorageService {
|
|
18
|
-
|
|
18
|
+
async getSummaryUploadManager() {
|
|
19
|
+
const manager = await this.getStorageManager();
|
|
20
|
+
return new SummaryTreeUploadManager(new RetriableGitManager(manager, this.logger), this.blobsShaCache, this.getPreviousFullSnapshot.bind(this));
|
|
21
|
+
}
|
|
22
|
+
constructor(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, getStorageManager = async () => this.manager) {
|
|
19
23
|
this.id = id;
|
|
20
24
|
this.manager = manager;
|
|
21
25
|
this.logger = logger;
|
|
@@ -24,17 +28,14 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
24
28
|
// The values of this cache is useless. We only need the keys. So we are always putting
|
|
25
29
|
// empty strings as values.
|
|
26
30
|
this.blobsShaCache = new Map();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
31
|
+
this.repositoryUrl = "";
|
|
32
|
+
if (driverPolicies?.enableRestLess === true || isNode) {
|
|
33
|
+
this.blobCache = blobCache ?? new InMemoryCache();
|
|
34
|
+
this.snapshotTreeCache = snapshotTreeCache ?? new InMemoryCache();
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
async getSummaryUploadManager() {
|
|
36
|
-
const manager = await this.getStorageManager();
|
|
37
|
-
return new SummaryTreeUploadManager(new RetriableGitManager(manager, this.logger), this.blobsShaCache, this.getPreviousFullSnapshot.bind(this));
|
|
36
|
+
this.mc = createChildMonitoringContext({
|
|
37
|
+
logger,
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
async getVersions(versionId, count) {
|
|
40
41
|
const id = versionId ? versionId : this.id;
|
|
@@ -44,7 +45,7 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
44
45
|
count,
|
|
45
46
|
}, async () => {
|
|
46
47
|
const manager = await this.getStorageManager();
|
|
47
|
-
return manager.getCommits(id, count);
|
|
48
|
+
return (await manager.getCommits(id, count)).content;
|
|
48
49
|
});
|
|
49
50
|
return commits.map((commit) => ({
|
|
50
51
|
date: commit.commit.author.date,
|
|
@@ -53,7 +54,6 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
53
54
|
}));
|
|
54
55
|
}
|
|
55
56
|
async getSnapshotTree(version) {
|
|
56
|
-
var _a, _b;
|
|
57
57
|
let requestVersion = version;
|
|
58
58
|
if (!requestVersion) {
|
|
59
59
|
const versions = await this.getVersions(this.id, 1);
|
|
@@ -62,7 +62,7 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
62
62
|
}
|
|
63
63
|
requestVersion = versions[0];
|
|
64
64
|
}
|
|
65
|
-
const cachedSnapshotTree = await
|
|
65
|
+
const cachedSnapshotTree = await this.snapshotTreeCache?.get(this.getCacheKey(requestVersion.treeId));
|
|
66
66
|
if (cachedSnapshotTree) {
|
|
67
67
|
return cachedSnapshotTree.snapshotTree;
|
|
68
68
|
}
|
|
@@ -71,19 +71,21 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
71
71
|
treeId: requestVersion.treeId,
|
|
72
72
|
}, async (event) => {
|
|
73
73
|
const manager = await this.getStorageManager();
|
|
74
|
-
const response = await manager.getTree(requestVersion.treeId);
|
|
74
|
+
const response = (await manager.getTree(requestVersion.treeId)).content;
|
|
75
75
|
event.end({
|
|
76
76
|
size: response.tree.length,
|
|
77
77
|
});
|
|
78
78
|
return response;
|
|
79
79
|
});
|
|
80
|
-
const tree =
|
|
81
|
-
await
|
|
80
|
+
const tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
|
|
81
|
+
await this.snapshotTreeCache?.put(this.getCacheKey(tree.id), {
|
|
82
|
+
id: requestVersion.id,
|
|
83
|
+
snapshotTree: tree,
|
|
84
|
+
});
|
|
82
85
|
return tree;
|
|
83
86
|
}
|
|
84
87
|
async readBlob(blobId) {
|
|
85
|
-
|
|
86
|
-
const cachedBlob = await ((_a = this.blobCache) === null || _a === void 0 ? void 0 : _a.get(this.getCacheKey(blobId)));
|
|
88
|
+
const cachedBlob = await this.blobCache?.get(this.getCacheKey(blobId));
|
|
87
89
|
if (cachedBlob) {
|
|
88
90
|
return cachedBlob;
|
|
89
91
|
}
|
|
@@ -92,24 +94,28 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
92
94
|
blobId,
|
|
93
95
|
}, async (event) => {
|
|
94
96
|
const manager = await this.getStorageManager();
|
|
95
|
-
const response = await manager.getBlob(blobId);
|
|
97
|
+
const response = (await manager.getBlob(blobId)).content;
|
|
96
98
|
event.end({
|
|
97
99
|
size: response.size,
|
|
98
100
|
});
|
|
99
101
|
return response;
|
|
100
|
-
}
|
|
102
|
+
}, undefined, // workers
|
|
103
|
+
undefined, // recordHeapSize
|
|
104
|
+
this.mc.config.getNumber("Fluid.Driver.ReadBlobTelemetrySampling"));
|
|
101
105
|
this.blobsShaCache.set(value.sha, "");
|
|
102
106
|
const bufferContent = stringToBuffer(value.content, value.encoding);
|
|
103
|
-
await
|
|
107
|
+
await this.blobCache?.put(this.getCacheKey(value.sha), bufferContent);
|
|
104
108
|
return bufferContent;
|
|
105
109
|
}
|
|
106
110
|
async uploadSummaryWithContext(summary, context) {
|
|
107
111
|
const summaryHandle = await PerformanceEvent.timedExecAsync(this.logger, {
|
|
108
112
|
eventName: "uploadSummaryWithContext",
|
|
113
|
+
proposalHandle: context.proposalHandle,
|
|
114
|
+
ackHandle: context.ackHandle,
|
|
115
|
+
referenceSequenceNumber: context.referenceSequenceNumber,
|
|
109
116
|
}, async () => {
|
|
110
|
-
var _a;
|
|
111
117
|
const summaryUploadManager = await this.getSummaryUploadManager();
|
|
112
|
-
return summaryUploadManager.writeSummaryTree(summary,
|
|
118
|
+
return summaryUploadManager.writeSummaryTree(summary, context.ackHandle ?? "", "channel");
|
|
113
119
|
});
|
|
114
120
|
return summaryHandle;
|
|
115
121
|
}
|
|
@@ -123,7 +129,9 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
123
129
|
size: uint8ArrayFile.length,
|
|
124
130
|
}, async (event) => {
|
|
125
131
|
const manager = await this.getStorageManager();
|
|
126
|
-
const response = await manager
|
|
132
|
+
const response = await manager
|
|
133
|
+
.createBlob(Uint8ArrayToString(uint8ArrayFile, "base64"), "base64")
|
|
134
|
+
.then((r) => ({ id: r.content.sha, url: r.content.url }));
|
|
127
135
|
event.end({
|
|
128
136
|
blobId: response.id,
|
|
129
137
|
});
|
|
@@ -132,8 +140,7 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
132
140
|
}
|
|
133
141
|
async getPreviousFullSnapshot(parentHandle) {
|
|
134
142
|
return parentHandle
|
|
135
|
-
? this.getVersions(parentHandle, 1)
|
|
136
|
-
.then(async (versions) => {
|
|
143
|
+
? this.getVersions(parentHandle, 1).then(async (versions) => {
|
|
137
144
|
// Clear the cache as the getSnapshotTree call will fill the cache.
|
|
138
145
|
this.blobsShaCache.clear();
|
|
139
146
|
return this.getSnapshotTree(versions[0]);
|
|
@@ -144,4 +151,4 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
144
151
|
return `${this.id}:${blobId}`;
|
|
145
152
|
}
|
|
146
153
|
}
|
|
147
|
-
//# sourceMappingURL=shreddedSummaryDocumentStorageService.
|
|
154
|
+
//# sourceMappingURL=shreddedSummaryDocumentStorageService.mjs.map
|