@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
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert } from "@fluidframework/core-utils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
10
|
+
* The policy is based on the last time a key was written to.
|
|
11
|
+
*/
|
|
12
|
+
export class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {
|
|
13
|
+
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
14
|
+
private readonly lastRefreshedTimes = new Map<TKey, number>();
|
|
15
|
+
|
|
16
|
+
constructor(private readonly expiryMs: number) {
|
|
17
|
+
super();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private refresh(key: TKey): void {
|
|
21
|
+
this.lastRefreshedTimes.set(key, new Date().valueOf());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found
|
|
26
|
+
* If cleanUp is passed as true, then delete any expired entry before returning.
|
|
27
|
+
*/
|
|
28
|
+
private checkExpiry(key: TKey, cleanUp: boolean = false): boolean | undefined {
|
|
29
|
+
const refreshTime = this.lastRefreshedTimes.get(key);
|
|
30
|
+
assert(
|
|
31
|
+
(refreshTime !== undefined) === super.has(key),
|
|
32
|
+
0x50c /* freshness map out of sync */,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (refreshTime === undefined) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const expired = new Date().valueOf() - refreshTime >= this.expiryMs;
|
|
39
|
+
if (expired && cleanUp) {
|
|
40
|
+
this.delete(key);
|
|
41
|
+
}
|
|
42
|
+
return expired;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private clearExpiredEntries() {
|
|
46
|
+
// forEach clears out any expired entries
|
|
47
|
+
this.forEach(() => {});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get size(): number {
|
|
51
|
+
this.clearExpiredEntries();
|
|
52
|
+
return super.size;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
has(key: TKey): boolean {
|
|
56
|
+
this.checkExpiry(key, true /* cleanUp */);
|
|
57
|
+
return super.has(key);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get(key: TKey): TValue | undefined {
|
|
61
|
+
this.checkExpiry(key, true /* cleanUp */);
|
|
62
|
+
return super.get(key);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
set(key: TKey, value: TValue): this {
|
|
66
|
+
// Sliding window expiration policy (on write)
|
|
67
|
+
this.refresh(key);
|
|
68
|
+
return super.set(key, value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
delete(key: TKey): boolean {
|
|
72
|
+
this.lastRefreshedTimes.delete(key);
|
|
73
|
+
return super.delete(key);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
clear(): void {
|
|
77
|
+
this.lastRefreshedTimes.clear();
|
|
78
|
+
super.clear();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
forEach(
|
|
82
|
+
callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void,
|
|
83
|
+
thisArg?: any,
|
|
84
|
+
): void {
|
|
85
|
+
const expiredKeys: TKey[] = [];
|
|
86
|
+
super.forEach(
|
|
87
|
+
(v, k, m) => {
|
|
88
|
+
if (this.checkExpiry(k) === true) {
|
|
89
|
+
expiredKeys.push(k);
|
|
90
|
+
} else {
|
|
91
|
+
callbackfn.bind(thisArg)(v, k, m);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// Note we don't pass thisArg here, since we bind it directly to callbackFn and don't need it otherwise
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Clean up keys we know are expired now that we're done iterating
|
|
98
|
+
expiredKeys.forEach((key: TKey) => {
|
|
99
|
+
this.delete(key);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
entries(): IterableIterator<[TKey, TValue]> {
|
|
104
|
+
this.clearExpiredEntries();
|
|
105
|
+
return super.entries();
|
|
106
|
+
}
|
|
107
|
+
keys(): IterableIterator<TKey> {
|
|
108
|
+
this.clearExpiredEntries();
|
|
109
|
+
return super.keys();
|
|
110
|
+
}
|
|
111
|
+
values(): IterableIterator<TValue> {
|
|
112
|
+
this.clearExpiredEntries();
|
|
113
|
+
return super.values();
|
|
114
|
+
}
|
|
115
|
+
[Symbol.iterator](): IterableIterator<[TKey, TValue]> {
|
|
116
|
+
this.clearExpiredEntries();
|
|
117
|
+
return super[Symbol.iterator]();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
valueOf() {
|
|
121
|
+
this.clearExpiredEntries();
|
|
122
|
+
return super.valueOf();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -11,30 +11,33 @@ import * as api from "@fluidframework/protocol-definitions";
|
|
|
11
11
|
* Does not read/write anything.
|
|
12
12
|
*/
|
|
13
13
|
export class NullBlobStorageService implements IDocumentStorageService {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
public get repositoryUrl(): string {
|
|
15
|
+
throw new Error("Invalid operation");
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
public async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {
|
|
19
|
+
return version ? Promise.reject(new Error("Invalid operation")) : null;
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
public async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
public async uploadSummaryWithContext(
|
|
27
|
+
summary: api.ISummaryTree,
|
|
28
|
+
context: ISummaryContext,
|
|
29
|
+
): Promise<string> {
|
|
30
|
+
throw new Error("Invalid operation");
|
|
31
|
+
}
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {
|
|
34
|
+
throw new Error("Invalid operation");
|
|
35
|
+
}
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
|
|
38
|
+
throw new Error("Null blob storage can not create blob");
|
|
39
|
+
}
|
|
40
|
+
public async readBlob(blobId: string): Promise<ArrayBufferLike> {
|
|
41
|
+
throw new Error("Null blob storage can not read blob");
|
|
42
|
+
}
|
|
40
43
|
}
|
package/src/packageVersion.ts
CHANGED
package/src/policies.ts
CHANGED
|
@@ -3,43 +3,56 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
export interface IRouterliciousDriverPolicies {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.
|
|
12
|
+
* Default: true
|
|
13
|
+
*/
|
|
14
|
+
enablePrefetch: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Rate limit concurrent storage requests.
|
|
17
|
+
* Default: 100
|
|
18
|
+
*/
|
|
19
|
+
maxConcurrentStorageRequests: number;
|
|
20
|
+
/**
|
|
21
|
+
* Rate limit concurrent orderer requests.
|
|
22
|
+
* Default: 100
|
|
23
|
+
*/
|
|
24
|
+
maxConcurrentOrdererRequests: number;
|
|
25
|
+
/**
|
|
26
|
+
* Enable uploading entire summary tree as a IWholeSummaryPayload to storage.
|
|
27
|
+
* Default: false
|
|
28
|
+
*/
|
|
29
|
+
enableWholeSummaryUpload: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Enable service endpoint discovery when creating or joining a session.
|
|
32
|
+
* Default: false
|
|
33
|
+
*/
|
|
34
|
+
enableDiscovery: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Enable using RestLess which avoids CORS preflight requests.
|
|
37
|
+
* Default: true
|
|
38
|
+
*/
|
|
39
|
+
enableRestLess: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Enable internal cache of summaries/snapshots.
|
|
42
|
+
* Reduces Summarizer boot time and reduces server load in E2E tests.
|
|
43
|
+
* Default: true
|
|
44
|
+
*/
|
|
45
|
+
enableInternalSummaryCaching: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Enable downgrading socket connection to long-polling
|
|
48
|
+
* when websocket connection cannot be established.
|
|
49
|
+
* Default: true
|
|
50
|
+
*/
|
|
51
|
+
enableLongPollingDowngrade: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Indicates that the container is ephemeral.
|
|
54
|
+
* Artifacts relates to the container are limited to container lifetime.
|
|
55
|
+
* Default: false
|
|
56
|
+
*/
|
|
57
|
+
isEphemeralContainer: boolean;
|
|
45
58
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
8
|
+
import { INormalizedWholeSnapshot, IWholeFlatSnapshot, IWholeFlatSnapshotTree } from "./contracts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Build a tree hierarchy from a flat tree.
|
|
12
|
+
*
|
|
13
|
+
* @param flatTree - a flat tree
|
|
14
|
+
* @param treePrefixToRemove - tree prefix to strip
|
|
15
|
+
* @returns the heirarchical tree
|
|
16
|
+
*/
|
|
17
|
+
function buildHierarchy(
|
|
18
|
+
flatTree: IWholeFlatSnapshotTree,
|
|
19
|
+
treePrefixToRemove: string,
|
|
20
|
+
): ISnapshotTree {
|
|
21
|
+
const lookup: { [path: string]: ISnapshotTree } = {};
|
|
22
|
+
// Root tree id will be used to determine which version was downloaded.
|
|
23
|
+
const root: ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };
|
|
24
|
+
lookup[""] = root;
|
|
25
|
+
|
|
26
|
+
for (const entry of flatTree.entries) {
|
|
27
|
+
// Strip the `treePrefixToRemove` path from tree entries such that they are stored under root.
|
|
28
|
+
const entryPath = entry.path.replace(new RegExp(`^${treePrefixToRemove}/`), "");
|
|
29
|
+
const lastIndex = entryPath.lastIndexOf("/");
|
|
30
|
+
const entryPathDir = entryPath.slice(0, Math.max(0, lastIndex));
|
|
31
|
+
const entryPathBase = entryPath.slice(lastIndex + 1);
|
|
32
|
+
|
|
33
|
+
// The flat output is breadth-first so we can assume we see tree nodes prior to their contents
|
|
34
|
+
const node = lookup[entryPathDir];
|
|
35
|
+
|
|
36
|
+
// Add in either the blob or tree
|
|
37
|
+
if (entry.type === "tree") {
|
|
38
|
+
const newTree: ISnapshotTree = {
|
|
39
|
+
blobs: {},
|
|
40
|
+
trees: {},
|
|
41
|
+
unreferenced: entry.unreferenced,
|
|
42
|
+
};
|
|
43
|
+
node.trees[decodeURIComponent(entryPathBase)] = newTree;
|
|
44
|
+
lookup[entryPath] = newTree;
|
|
45
|
+
} else if (entry.type === "blob") {
|
|
46
|
+
node.blobs[decodeURIComponent(entryPathBase)] = entry.id;
|
|
47
|
+
} else {
|
|
48
|
+
throw new Error(`Unknown entry type!!`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return root;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.
|
|
57
|
+
*
|
|
58
|
+
* @param flatSnapshot - flat snapshot
|
|
59
|
+
* @param treePrefixToRemove - tree prefix to strip. By default we are stripping ".app" prefix
|
|
60
|
+
* @returns snapshot tree, blob array, and sequence number
|
|
61
|
+
*/
|
|
62
|
+
export function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(
|
|
63
|
+
flatSnapshot: IWholeFlatSnapshot,
|
|
64
|
+
treePrefixToRemove: string = ".app",
|
|
65
|
+
): INormalizedWholeSnapshot {
|
|
66
|
+
const blobs = new Map<string, ArrayBuffer>();
|
|
67
|
+
if (flatSnapshot.blobs) {
|
|
68
|
+
flatSnapshot.blobs.forEach((blob) => {
|
|
69
|
+
blobs.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? "utf-8"));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const flatSnapshotTree = flatSnapshot.trees?.[0];
|
|
73
|
+
const sequenceNumber = flatSnapshotTree?.sequenceNumber;
|
|
74
|
+
const snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
blobs,
|
|
78
|
+
snapshotTree,
|
|
79
|
+
sequenceNumber,
|
|
80
|
+
id: flatSnapshot.id,
|
|
81
|
+
};
|
|
82
|
+
}
|