@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
package/src/contracts.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
*
|
|
10
|
+
* Whole Snapshot Download Data Structures
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface IWholeFlatSnapshotTreeEntryTree {
|
|
15
|
+
path: string;
|
|
16
|
+
type: "tree";
|
|
17
|
+
// Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.
|
|
18
|
+
unreferenced?: true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IWholeFlatSnapshotTreeEntryBlob {
|
|
22
|
+
id: string;
|
|
23
|
+
path: string;
|
|
24
|
+
type: "blob";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type IWholeFlatSnapshotTreeEntry =
|
|
28
|
+
| IWholeFlatSnapshotTreeEntryTree
|
|
29
|
+
| IWholeFlatSnapshotTreeEntryBlob;
|
|
30
|
+
|
|
31
|
+
export interface IWholeFlatSnapshotTree {
|
|
32
|
+
entries: IWholeFlatSnapshotTreeEntry[];
|
|
33
|
+
id: string;
|
|
34
|
+
sequenceNumber: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IWholeFlatSnapshotBlob {
|
|
38
|
+
content: string;
|
|
39
|
+
encoding: "base64" | "utf-8";
|
|
40
|
+
id: string;
|
|
41
|
+
size: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface IWholeFlatSnapshot {
|
|
45
|
+
// The same as the id of the first snapshot tree in the trees array.
|
|
46
|
+
id: string;
|
|
47
|
+
// Receive an array of snapshot trees for future-proofing, however, always length 1 for now.
|
|
48
|
+
trees: IWholeFlatSnapshotTree[];
|
|
49
|
+
blobs?: IWholeFlatSnapshotBlob[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Normalized Whole Summary with decoded blobs and unflattened snapshot tree.
|
|
54
|
+
*/
|
|
55
|
+
export interface INormalizedWholeSnapshot {
|
|
56
|
+
blobs: Map<string, ArrayBuffer>;
|
|
57
|
+
snapshotTree: ISnapshotTree;
|
|
58
|
+
sequenceNumber: number | undefined;
|
|
59
|
+
id: string;
|
|
60
|
+
}
|
package/src/createNewUtils.ts
CHANGED
|
@@ -3,37 +3,39 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Uint8ArrayToString } from "@
|
|
6
|
+
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
7
7
|
import { ISummaryTree, SummaryType } from "@fluidframework/protocol-definitions";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.
|
|
11
11
|
* @param summary - Summary supplied by the runtime to upload.
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns Modified summary tree where the blob contents could be utf8 string only.
|
|
13
13
|
*/
|
|
14
14
|
export function convertSummaryToCreateNewSummary(summary: ISummaryTree): ISummaryTree {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const keys = Object.keys(summary.tree);
|
|
16
|
+
for (const key of keys) {
|
|
17
|
+
const summaryObject = summary.tree[key];
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
switch (summaryObject.type) {
|
|
20
|
+
case SummaryType.Tree: {
|
|
21
|
+
summary.tree[key] = convertSummaryToCreateNewSummary(summaryObject);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case SummaryType.Blob: {
|
|
25
|
+
summaryObject.content =
|
|
26
|
+
typeof summaryObject.content === "string"
|
|
27
|
+
? summaryObject.content
|
|
28
|
+
: Uint8ArrayToString(summaryObject.content, "utf8");
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case SummaryType.Handle: {
|
|
32
|
+
throw new Error("No handle should be present for first summary!!");
|
|
33
|
+
}
|
|
34
|
+
default: {
|
|
35
|
+
throw new Error(`Unknown tree type ${summaryObject.type}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
return summary;
|
|
39
41
|
}
|
|
@@ -7,24 +7,23 @@ import { ITokenProvider, ITokenResponse } from "./tokens";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.
|
|
10
|
+
* @internal
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
export class DefaultTokenProvider implements ITokenProvider {
|
|
13
|
-
|
|
14
|
+
constructor(private readonly jwt: string) {}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
public async fetchOrdererToken(): Promise<ITokenResponse> {
|
|
17
|
+
return {
|
|
18
|
+
fromCache: true,
|
|
19
|
+
jwt: this.jwt,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
public async fetchStorageToken(): Promise<ITokenResponse> {
|
|
25
|
-
return {
|
|
26
|
-
fromCache: true,
|
|
27
|
-
jwt: this.jwt,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
23
|
+
public async fetchStorageToken(): Promise<ITokenResponse> {
|
|
24
|
+
return {
|
|
25
|
+
fromCache: true,
|
|
26
|
+
jwt: this.jwt,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
30
29
|
}
|
package/src/definitions.ts
CHANGED
|
@@ -3,118 +3,172 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { getW3CData, validateMessages } from "@fluidframework/driver-base";
|
|
6
8
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
IDeltaStorageService,
|
|
10
|
+
IDocumentDeltaStorageService,
|
|
11
|
+
IDeltasFetchResult,
|
|
12
|
+
IStream,
|
|
11
13
|
} from "@fluidframework/driver-definitions";
|
|
12
14
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import {
|
|
16
|
+
readAndParse,
|
|
17
|
+
requestOps,
|
|
18
|
+
emptyMessageStream,
|
|
19
|
+
streamObserver,
|
|
20
|
+
} from "@fluidframework/driver-utils";
|
|
21
|
+
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
18
22
|
import { DocumentStorageService } from "./documentStorageService";
|
|
23
|
+
import { RestWrapper } from "./restWrapperBase";
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Maximum number of ops we can fetch at a time. This should be kept at 2k, as
|
|
27
|
+
* server determines whether to try to fallback to long-term storage if the ops range requested is larger than
|
|
28
|
+
* what they have locally available in short-term storage. So if we request 2k ops, they know it is not a
|
|
29
|
+
* specific request and they don't fall to long term storage which takes time.
|
|
30
|
+
* Please coordinate to AFR team if this value need to be changed.
|
|
31
|
+
*/
|
|
32
|
+
const MaxBatchDeltas = 2000;
|
|
21
33
|
|
|
22
34
|
/**
|
|
23
35
|
* Storage service limited to only being able to fetch documents for a specific document
|
|
24
36
|
*/
|
|
25
37
|
export class DocumentDeltaStorageService implements IDocumentDeltaStorageService {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
constructor(
|
|
39
|
+
private readonly tenantId: string,
|
|
40
|
+
private readonly id: string,
|
|
41
|
+
private readonly deltaStorageService: IDeltaStorageService,
|
|
42
|
+
private readonly documentStorageService: DocumentStorageService,
|
|
43
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
44
|
+
) {}
|
|
45
|
+
|
|
46
|
+
private logtailSha: string | undefined = this.documentStorageService.logTailSha;
|
|
47
|
+
private snapshotOps: ISequencedDocumentMessage[] | undefined;
|
|
48
|
+
|
|
49
|
+
fetchMessages(
|
|
50
|
+
fromTotal: number,
|
|
51
|
+
toTotal: number | undefined,
|
|
52
|
+
abortSignal?: AbortSignal,
|
|
53
|
+
cachedOnly?: boolean,
|
|
54
|
+
fetchReason?: string,
|
|
55
|
+
): IStream<ISequencedDocumentMessage[]> {
|
|
56
|
+
if (cachedOnly) {
|
|
57
|
+
return emptyMessageStream;
|
|
58
|
+
}
|
|
32
59
|
|
|
33
|
-
|
|
60
|
+
let opsFromSnapshot = 0;
|
|
61
|
+
let opsFromStorage = 0;
|
|
62
|
+
const requestCallback = async (
|
|
63
|
+
from: number,
|
|
64
|
+
to: number,
|
|
65
|
+
telemetryProps: ITelemetryProperties,
|
|
66
|
+
) => {
|
|
67
|
+
this.snapshotOps = this.logtailSha
|
|
68
|
+
? await readAndParse<ISequencedDocumentMessage[]>(
|
|
69
|
+
this.documentStorageService,
|
|
70
|
+
this.logtailSha,
|
|
71
|
+
)
|
|
72
|
+
: [];
|
|
73
|
+
this.logtailSha = undefined;
|
|
34
74
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// In future releases we will switch to actual concurrency
|
|
48
|
-
1, // concurrency
|
|
49
|
-
from, // inclusive
|
|
50
|
-
to, // exclusive
|
|
51
|
-
MaxBatchDeltas,
|
|
52
|
-
new TelemetryNullLogger(),
|
|
53
|
-
abortSignal,
|
|
54
|
-
fetchReason,
|
|
55
|
-
);
|
|
56
|
-
}
|
|
75
|
+
if (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {
|
|
76
|
+
const messages = this.snapshotOps.filter(
|
|
77
|
+
(op) => op.sequenceNumber >= from && op.sequenceNumber < to,
|
|
78
|
+
);
|
|
79
|
+
validateMessages("snapshotOps", messages, from, this.logger, false /* strict */);
|
|
80
|
+
if (messages.length > 0 && messages[0].sequenceNumber === from) {
|
|
81
|
+
this.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);
|
|
82
|
+
opsFromSnapshot += messages.length;
|
|
83
|
+
return { messages, partialResult: true };
|
|
84
|
+
}
|
|
85
|
+
this.snapshotOps = undefined;
|
|
86
|
+
}
|
|
57
87
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
88
|
+
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);
|
|
89
|
+
validateMessages("storage", ops.messages, from, this.logger, false /* strict */);
|
|
90
|
+
opsFromStorage += ops.messages.length;
|
|
91
|
+
return ops;
|
|
92
|
+
};
|
|
62
93
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
const stream = requestOps(
|
|
95
|
+
async (from: number, to: number, telemetryProps: ITelemetryProperties) => {
|
|
96
|
+
const result = await requestCallback(from, to, telemetryProps);
|
|
97
|
+
// Catch all case, just in case
|
|
98
|
+
validateMessages("catch all", result.messages, from, this.logger);
|
|
99
|
+
return result;
|
|
100
|
+
},
|
|
101
|
+
// Staging: starting with no concurrency, listening for feedback first.
|
|
102
|
+
// In future releases we will switch to actual concurrency
|
|
103
|
+
1, // concurrency
|
|
104
|
+
fromTotal, // inclusive
|
|
105
|
+
toTotal, // exclusive
|
|
106
|
+
MaxBatchDeltas,
|
|
107
|
+
this.logger,
|
|
108
|
+
abortSignal,
|
|
109
|
+
fetchReason,
|
|
110
|
+
);
|
|
72
111
|
|
|
73
|
-
|
|
74
|
-
|
|
112
|
+
return streamObserver(stream, (result) => {
|
|
113
|
+
if (result.done && opsFromSnapshot + opsFromStorage !== 0) {
|
|
114
|
+
this.logger.sendPerformanceEvent({
|
|
115
|
+
eventName: "CacheOpsRetrieved",
|
|
116
|
+
opsFromSnapshot,
|
|
117
|
+
opsFromStorage,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
75
122
|
}
|
|
76
123
|
|
|
77
124
|
/**
|
|
78
125
|
* Provides access to the underlying delta storage on the server for routerlicious driver.
|
|
79
126
|
*/
|
|
80
127
|
export class DeltaStorageService implements IDeltaStorageService {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
128
|
+
constructor(
|
|
129
|
+
private readonly url: string,
|
|
130
|
+
private readonly restWrapper: RestWrapper,
|
|
131
|
+
private readonly logger: ITelemetryLoggerExt,
|
|
132
|
+
private readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,
|
|
133
|
+
private readonly getDeltaStorageUrl: () => string = () => this.url,
|
|
134
|
+
) {}
|
|
89
135
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
136
|
+
public async get(
|
|
137
|
+
tenantId: string,
|
|
138
|
+
id: string,
|
|
139
|
+
from: number, // inclusive
|
|
140
|
+
to: number, // exclusive
|
|
141
|
+
): Promise<IDeltasFetchResult> {
|
|
142
|
+
const ops = await PerformanceEvent.timedExecAsync(
|
|
143
|
+
this.logger,
|
|
144
|
+
{
|
|
145
|
+
eventName: "OpsFetch",
|
|
146
|
+
from,
|
|
147
|
+
to,
|
|
148
|
+
},
|
|
149
|
+
async (event) => {
|
|
150
|
+
const restWrapper = await this.getRestWrapper();
|
|
151
|
+
const url = this.getDeltaStorageUrl();
|
|
152
|
+
const response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {
|
|
153
|
+
from: from - 1,
|
|
154
|
+
to,
|
|
155
|
+
});
|
|
156
|
+
event.end({
|
|
157
|
+
length: response.content.length,
|
|
158
|
+
details: JSON.stringify({
|
|
159
|
+
firstOpSeqNumber: response.content[0]?.sequenceNumber,
|
|
160
|
+
lastOpSeqNumber:
|
|
161
|
+
response.content[response.content.length - 1]?.sequenceNumber,
|
|
162
|
+
}),
|
|
163
|
+
...response.propsToLog,
|
|
164
|
+
...getW3CData(response.requestUrl, "xmlhttprequest"),
|
|
165
|
+
});
|
|
166
|
+
return response.content;
|
|
167
|
+
},
|
|
168
|
+
);
|
|
115
169
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
170
|
+
// It is assumed that server always returns all the ops that it has in the range that was requested.
|
|
171
|
+
// This may change in the future, if so, we need to adjust and receive "end" value from server in such case.
|
|
172
|
+
return { messages: ops, partialResult: false };
|
|
173
|
+
}
|
|
120
174
|
}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { DocumentDeltaConnection } from "@fluidframework/driver-base";
|
|
8
|
-
import { IDocumentDeltaConnection } from "@fluidframework/driver-definitions";
|
|
9
|
-
import { IAnyDriverError } from "@fluidframework/driver-utils";
|
|
8
|
+
import { IAnyDriverError, IDocumentDeltaConnection } from "@fluidframework/driver-definitions";
|
|
10
9
|
import { IClient, IConnect } from "@fluidframework/protocol-definitions";
|
|
11
10
|
import type { io as SocketIOClientStatic } from "socket.io-client";
|
|
12
11
|
import { errorObjectFromSocketError, IR11sSocketError } from "./errorUtils";
|
|
@@ -18,57 +17,60 @@ const protocolVersions = ["^0.4.0", "^0.3.0", "^0.2.0", "^0.1.0"];
|
|
|
18
17
|
* Wrapper over the shared one for driver specific translation.
|
|
19
18
|
*/
|
|
20
19
|
export class R11sDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
public static async create(
|
|
21
|
+
tenantId: string,
|
|
22
|
+
id: string,
|
|
23
|
+
token: string | null,
|
|
24
|
+
io: typeof SocketIOClientStatic,
|
|
25
|
+
client: IClient,
|
|
26
|
+
url: string,
|
|
27
|
+
logger: ITelemetryLoggerExt,
|
|
28
|
+
timeoutMs = 20000,
|
|
29
|
+
enableLongPollingDowngrade = true,
|
|
30
|
+
): Promise<IDocumentDeltaConnection> {
|
|
31
|
+
const socket = io(url, {
|
|
32
|
+
query: {
|
|
33
|
+
documentId: id,
|
|
34
|
+
tenantId,
|
|
35
|
+
},
|
|
36
|
+
reconnection: false,
|
|
37
|
+
// Default to websocket connection, with long-polling disabled
|
|
38
|
+
transports: ["websocket"],
|
|
39
|
+
timeout: timeoutMs,
|
|
40
|
+
});
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
const connectMessage: IConnect = {
|
|
43
|
+
client,
|
|
44
|
+
id,
|
|
45
|
+
mode: client.mode,
|
|
46
|
+
tenantId,
|
|
47
|
+
token, // Token is going to indicate tenant level information, etc...
|
|
48
|
+
versions: protocolVersions,
|
|
49
|
+
relayUserAgent: [client.details.environment, ` driverVersion:${driverVersion}`].join(
|
|
50
|
+
";",
|
|
51
|
+
),
|
|
52
|
+
};
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const deltaConnection = new R11sDocumentDeltaConnection(
|
|
55
|
+
socket,
|
|
56
|
+
id,
|
|
57
|
+
logger,
|
|
58
|
+
enableLongPollingDowngrade,
|
|
59
|
+
);
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
await deltaConnection.initialize(connectMessage, timeoutMs);
|
|
62
|
+
return deltaConnection;
|
|
63
|
+
}
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
65
|
+
/**
|
|
66
|
+
* Error raising for socket.io issues
|
|
67
|
+
*/
|
|
68
|
+
protected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {
|
|
69
|
+
// Note: we suspect the incoming error object is either:
|
|
70
|
+
// - a socketError: add it to the R11sError object for driver to be able to parse it and reason over it.
|
|
71
|
+
// - anything else: let base class handle it
|
|
72
|
+
return canRetry && Number.isInteger(error?.code) && typeof error?.message === "string"
|
|
73
|
+
? errorObjectFromSocketError(error as IR11sSocketError, handler)
|
|
74
|
+
: super.createErrorObject(handler, error, canRetry);
|
|
75
|
+
}
|
|
74
76
|
}
|