@fluidframework/driver-utils 2.0.0-internal.7.1.1 → 2.0.0-internal.7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/api-extractor.json +1 -12
- package/api-report/driver-utils.api.md +10 -2
- package/dist/adapters/compression/compressionTypes.d.ts +6 -0
- package/dist/adapters/compression/compressionTypes.d.ts.map +1 -1
- package/dist/adapters/compression/compressionTypes.js +3 -0
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -0
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +1 -0
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +3 -0
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js +3 -0
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -0
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js +1 -0
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +3 -0
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +3 -0
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/error.d.ts +4 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +4 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +1 -0
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +1 -0
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +10 -0
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +10 -3
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +49 -3
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +45 -5
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +3 -0
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +3 -0
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +12 -0
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +12 -0
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +3 -0
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +3 -0
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts +3 -0
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js +3 -0
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -0
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js +1 -0
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +5 -0
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +4 -2
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +3 -1
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js +4 -2
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +1 -0
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +1 -0
- package/dist/treeConversions.js.map +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts +6 -0
- package/lib/adapters/compression/compressionTypes.d.ts.map +1 -1
- package/lib/adapters/compression/compressionTypes.js +3 -0
- package/lib/adapters/compression/compressionTypes.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -0
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
- package/lib/adapters/predefinedAdapters.js +1 -0
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +3 -0
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +3 -0
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -0
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js +1 -0
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +3 -0
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +3 -0
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts +4 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +4 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +1 -0
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +1 -0
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +10 -0
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +10 -3
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +49 -3
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +45 -5
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +3 -0
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +3 -0
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +12 -0
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +12 -0
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +3 -0
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js +3 -0
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts +3 -0
- package/lib/rateLimiter.d.ts.map +1 -1
- package/lib/rateLimiter.js +3 -0
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -0
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js +1 -0
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +5 -0
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +4 -2
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +3 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +4 -2
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +1 -0
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +1 -0
- package/lib/treeConversions.js.map +1 -1
- package/package.json +11 -12
- package/src/adapters/compression/compressionTypes.ts +6 -0
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +4 -0
- package/src/adapters/predefinedAdapters.ts +1 -0
- package/src/blob.ts +3 -0
- package/src/buildSnapshotTree.ts +1 -0
- package/src/documentStorageServiceProxy.ts +3 -0
- package/src/error.ts +4 -1
- package/src/index.ts +1 -0
- package/src/insecureUrlResolver.ts +1 -0
- package/src/messageRecognition.ts +10 -3
- package/src/network.ts +49 -6
- package/src/networkUtils.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +12 -0
- package/src/prefetchDocumentStorageService.ts +3 -0
- package/src/rateLimiter.ts +3 -0
- package/src/readAndParse.ts +1 -0
- package/src/runWithRetry.ts +7 -4
- package/src/summaryForCreateNew.ts +4 -1
- package/src/treeConversions.ts +1 -0
- package/dist/driver-utils-alpha.d.ts +0 -467
- package/dist/driver-utils-beta.d.ts +0 -467
- package/dist/driver-utils-public.d.ts +0 -467
- package/dist/driver-utils.d.ts +0 -481
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.2.1",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,32 +35,31 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
42
42
|
"@fluidframework/gitresources": "^2.0.1",
|
|
43
43
|
"@fluidframework/protocol-base": "^2.0.1",
|
|
44
44
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
45
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
45
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
46
46
|
"axios": "^0.26.0",
|
|
47
47
|
"lz4js": "^0.2.0",
|
|
48
48
|
"url": "^0.11.0",
|
|
49
49
|
"uuid": "^9.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@fluid-tools/build-cli": "^0.
|
|
53
|
-
"@fluidframework/build-common": "^2.0.
|
|
54
|
-
"@fluidframework/build-tools": "^0.
|
|
52
|
+
"@fluid-tools/build-cli": "^0.26.1",
|
|
53
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
54
|
+
"@fluidframework/build-tools": "^0.26.1",
|
|
55
55
|
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.1.0",
|
|
56
56
|
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
57
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
57
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.2.1 <2.0.0-internal.7.3.0",
|
|
58
58
|
"@microsoft/api-extractor": "^7.37.0",
|
|
59
59
|
"@types/mocha": "^9.1.1",
|
|
60
60
|
"@types/node": "^16.18.38",
|
|
61
61
|
"@types/sinon": "^7.0.13",
|
|
62
62
|
"c8": "^7.7.1",
|
|
63
|
-
"copyfiles": "^2.4.1",
|
|
64
63
|
"cross-env": "^7.0.3",
|
|
65
64
|
"eslint": "~8.50.0",
|
|
66
65
|
"mocha": "^10.2.0",
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
"build:genver": "gen-version",
|
|
85
84
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
86
85
|
"ci:build:docs": "api-extractor run",
|
|
87
|
-
"clean": "rimraf --glob
|
|
86
|
+
"clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
|
|
88
87
|
"eslint": "eslint --format stylish src",
|
|
89
88
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
90
89
|
"format": "npm run prettier:fix",
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
export enum SummaryCompressionAlgorithm {
|
|
7
10
|
None = 0,
|
|
8
11
|
LZ4 = 1,
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
11
17
|
export interface ICompressionStorageConfig {
|
|
12
18
|
algorithm: SummaryCompressionAlgorithm;
|
|
13
19
|
minSizeToCompress: number;
|
package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts
CHANGED
|
@@ -19,6 +19,9 @@ import { compress, decompress } from "lz4js";
|
|
|
19
19
|
import { DocumentStorageServiceProxy } from "../../../documentStorageServiceProxy";
|
|
20
20
|
import { ICompressionStorageConfig, SummaryCompressionAlgorithm } from "../";
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
22
25
|
export const blobHeadersBlobName = ".metadata.blobHeaders";
|
|
23
26
|
const metadataBlobName = ".metadata";
|
|
24
27
|
|
|
@@ -32,6 +35,7 @@ const metadataBlobName = ".metadata";
|
|
|
32
35
|
* In case, the markup blob is present, it is expected that the first byte of the markup blob
|
|
33
36
|
* will contain the info about the compression. If the first byte is not present, it is assumed
|
|
34
37
|
* that the compression is not enabled and no first prefix byte is present in the blobs.
|
|
38
|
+
* @public
|
|
35
39
|
*/
|
|
36
40
|
export class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {
|
|
37
41
|
private _isCompressionEnabled: boolean = false;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
18
18
|
* @param config - The compression configuration.
|
|
19
19
|
* @returns The document service factory possibly with compression applied.
|
|
20
|
+
* @public
|
|
20
21
|
*/
|
|
21
22
|
export function applyStorageCompression(
|
|
22
23
|
documentServiceFactory: IDocumentServiceFactory,
|
package/src/blob.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Basic implementation of a blob ITreeEntry
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
export class BlobTreeEntry {
|
|
18
19
|
public readonly mode = FileMode.File;
|
|
@@ -36,6 +37,7 @@ export class BlobTreeEntry {
|
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Basic implementation of a tree ITreeEntry
|
|
40
|
+
* @public
|
|
39
41
|
*/
|
|
40
42
|
export class TreeTreeEntry {
|
|
41
43
|
public readonly mode = FileMode.Directory;
|
|
@@ -54,6 +56,7 @@ export class TreeTreeEntry {
|
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
58
|
* Basic implementation of an attachment ITreeEntry
|
|
59
|
+
* @public
|
|
57
60
|
*/
|
|
58
61
|
export class AttachmentTreeEntry {
|
|
59
62
|
public readonly mode = FileMode.File;
|
package/src/buildSnapshotTree.ts
CHANGED
|
@@ -86,6 +86,7 @@ function flatten(tree: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): git
|
|
|
86
86
|
* @param blobMap - a map of blob's sha1 to content that gets filled with content from entries
|
|
87
87
|
* NOTE: blobMap's validity is contingent on the returned promise's resolution
|
|
88
88
|
* @returns the hierarchical tree
|
|
89
|
+
* @public
|
|
89
90
|
*/
|
|
90
91
|
export function buildSnapshotTree(
|
|
91
92
|
entries: ITreeEntry[],
|
package/src/error.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
11
14
|
export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
12
15
|
// eslint-disable-next-line import/no-deprecated
|
|
13
16
|
readonly errorType = DriverErrorType.usageError;
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import Axios from "axios";
|
|
|
22
22
|
* The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
|
|
23
23
|
* part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
|
|
24
24
|
* works or a router inside of a single page app framework.
|
|
25
|
+
* @public
|
|
25
26
|
*/
|
|
26
27
|
export class InsecureUrlResolver implements IUrlResolver {
|
|
27
28
|
private readonly cache = new Map<string, Promise<IResolvedUrl>>();
|
|
@@ -12,18 +12,25 @@ import {
|
|
|
12
12
|
* Tells if message was sent by container runtime
|
|
13
13
|
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
14
14
|
* @returns whether the message is a runtime message
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export function isRuntimeMessage(message: { type: string }): boolean {
|
|
17
18
|
return message.type === MessageType.Operation;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
23
|
+
* Eventually to be replaced by MessageType.accept
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
22
26
|
export enum MessageType2 {
|
|
23
27
|
Accept = "accept",
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
27
34
|
export function canBeCoalescedByService(
|
|
28
35
|
message: ISequencedDocumentMessage | IDocumentMessage,
|
|
29
36
|
): boolean {
|
package/src/network.ts
CHANGED
|
@@ -16,15 +16,21 @@ import {
|
|
|
16
16
|
import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
17
17
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
19
22
|
export enum OnlineStatus {
|
|
20
23
|
Offline,
|
|
21
24
|
Online,
|
|
22
25
|
Unknown,
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* It tells if we have local connection only - we might not have connection to web.
|
|
30
|
+
* No solution for node.js (other than resolve dns names / ping specific sites)
|
|
31
|
+
* Can also use window.addEventListener("online" / "offline")
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
28
34
|
export function isOnline(): OnlineStatus {
|
|
29
35
|
if (
|
|
30
36
|
typeof navigator === "object" &&
|
|
@@ -36,13 +42,17 @@ export function isOnline(): OnlineStatus {
|
|
|
36
42
|
return OnlineStatus.Unknown;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Telemetry props with driver-specific required properties
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
40
49
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
41
50
|
driverVersion: string | undefined;
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
54
|
* Generic network error class.
|
|
55
|
+
* @public
|
|
46
56
|
*/
|
|
47
57
|
export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
48
58
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -59,6 +69,7 @@ export class GenericNetworkError extends LoggingError implements IDriverErrorBas
|
|
|
59
69
|
|
|
60
70
|
/**
|
|
61
71
|
* FluidInvalidSchema error class.
|
|
72
|
+
* @public
|
|
62
73
|
*/
|
|
63
74
|
export class FluidInvalidSchemaError
|
|
64
75
|
extends LoggingError
|
|
@@ -73,6 +84,9 @@ export class FluidInvalidSchemaError
|
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
76
90
|
export class DeltaStreamConnectionForbiddenError
|
|
77
91
|
extends LoggingError
|
|
78
92
|
implements IDriverErrorBase, IFluidErrorBase
|
|
@@ -89,6 +103,9 @@ export class DeltaStreamConnectionForbiddenError
|
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
92
109
|
export class AuthorizationError
|
|
93
110
|
extends LoggingError
|
|
94
111
|
implements IAuthorizationError, IFluidErrorBase
|
|
@@ -108,6 +125,9 @@ export class AuthorizationError
|
|
|
108
125
|
}
|
|
109
126
|
}
|
|
110
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
111
131
|
export class LocationRedirectionError
|
|
112
132
|
extends LoggingError
|
|
113
133
|
implements ILocationRedirectionError, IFluidErrorBase
|
|
@@ -126,6 +146,9 @@ export class LocationRedirectionError
|
|
|
126
146
|
}
|
|
127
147
|
}
|
|
128
148
|
|
|
149
|
+
/**
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
129
152
|
export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
130
153
|
constructor(
|
|
131
154
|
message: string,
|
|
@@ -137,6 +160,9 @@ export class NetworkErrorBasic<T extends string> extends LoggingError implements
|
|
|
137
160
|
}
|
|
138
161
|
}
|
|
139
162
|
|
|
163
|
+
/**
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
140
166
|
export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
141
167
|
constructor(
|
|
142
168
|
message: string,
|
|
@@ -147,6 +173,9 @@ export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
|
147
173
|
}
|
|
148
174
|
}
|
|
149
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
150
179
|
export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
151
180
|
constructor(
|
|
152
181
|
message: string,
|
|
@@ -159,6 +188,7 @@ export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
|
159
188
|
|
|
160
189
|
/**
|
|
161
190
|
* Throttling error class - used to communicate all throttling errors
|
|
191
|
+
* @public
|
|
162
192
|
*/
|
|
163
193
|
export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
164
194
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -174,9 +204,15 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
|
|
|
174
204
|
}
|
|
175
205
|
}
|
|
176
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
177
210
|
export const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>
|
|
178
211
|
new NonRetryableError(message, DriverErrorTypes.writeError, props);
|
|
179
212
|
|
|
213
|
+
/**
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
180
216
|
export function createGenericNetworkError(
|
|
181
217
|
message: string,
|
|
182
218
|
retryInfo: { canRetry: boolean; retryAfterMs?: number },
|
|
@@ -192,13 +228,20 @@ export function createGenericNetworkError(
|
|
|
192
228
|
* Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
|
|
193
229
|
* I.e. asserts or unexpected exceptions in our code result in container failure.
|
|
194
230
|
* @param error - The error to inspect for ability to retry
|
|
231
|
+
* @public
|
|
195
232
|
*/
|
|
196
233
|
export const canRetryOnError = (error: any): boolean => error?.canRetry === true;
|
|
197
234
|
|
|
198
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* Check retryAfterSeconds property on error
|
|
237
|
+
* @public
|
|
238
|
+
* */
|
|
199
239
|
export const getRetryDelaySecondsFromError = (error: any): number | undefined =>
|
|
200
240
|
error?.retryAfterSeconds as number | undefined;
|
|
201
241
|
|
|
202
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Check retryAfterSeconds property on error and convert to ms
|
|
244
|
+
* @public
|
|
245
|
+
* */
|
|
203
246
|
export const getRetryDelayFromError = (error: any): number | undefined =>
|
|
204
247
|
error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
|
package/src/networkUtils.ts
CHANGED
|
@@ -7,6 +7,9 @@ import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { isOnline, OnlineStatus, canRetryOnError } from "./network";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
export function logNetworkFailure(
|
|
11
14
|
logger: ITelemetryLoggerExt,
|
|
12
15
|
event: ITelemetryErrorEvent,
|
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -29,6 +29,7 @@ type WorkingState = "working" | "done" | "canceled";
|
|
|
29
29
|
* @param logger - logger to use
|
|
30
30
|
* @param requestCallback - callback to request batches
|
|
31
31
|
* @returns Queue that can be used to retrieve data
|
|
32
|
+
* @public
|
|
32
33
|
*/
|
|
33
34
|
export class ParallelRequests<T> {
|
|
34
35
|
private latestRequested: number;
|
|
@@ -338,6 +339,7 @@ export class ParallelRequests<T> {
|
|
|
338
339
|
/**
|
|
339
340
|
* Helper queue class to allow async push / pull
|
|
340
341
|
* It's essentially a pipe allowing multiple writers, and single reader
|
|
342
|
+
* @public
|
|
341
343
|
*/
|
|
342
344
|
export class Queue<T> implements IStream<T> {
|
|
343
345
|
private readonly queue: Promise<IStreamResult<T>>[] = [];
|
|
@@ -531,6 +533,7 @@ async function getSingleOpBatch(
|
|
|
531
533
|
* @param signal - Cancelation signal
|
|
532
534
|
* @param scenarioName - Reason for fetching ops
|
|
533
535
|
* @returns Messages fetched
|
|
536
|
+
* @public
|
|
534
537
|
*/
|
|
535
538
|
export function requestOps(
|
|
536
539
|
get: (
|
|
@@ -651,12 +654,18 @@ export function requestOps(
|
|
|
651
654
|
return queue;
|
|
652
655
|
}
|
|
653
656
|
|
|
657
|
+
/**
|
|
658
|
+
* @public
|
|
659
|
+
*/
|
|
654
660
|
export const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {
|
|
655
661
|
read: async () => {
|
|
656
662
|
return { done: true };
|
|
657
663
|
},
|
|
658
664
|
};
|
|
659
665
|
|
|
666
|
+
/**
|
|
667
|
+
* @public
|
|
668
|
+
*/
|
|
660
669
|
export function streamFromMessages(
|
|
661
670
|
messagesArg: Promise<ISequencedDocumentMessage[]>,
|
|
662
671
|
): IStream<ISequencedDocumentMessage[]> {
|
|
@@ -673,6 +682,9 @@ export function streamFromMessages(
|
|
|
673
682
|
};
|
|
674
683
|
}
|
|
675
684
|
|
|
685
|
+
/**
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
676
688
|
export function streamObserver<T>(
|
|
677
689
|
stream: IStream<T>,
|
|
678
690
|
handler: (value: IStreamResult<T>) => void,
|
|
@@ -7,6 +7,9 @@ import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
|
7
7
|
import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
8
8
|
import { canRetryOnError } from "./network";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
|
|
11
14
|
// BlobId -> blob prefetchCache cache
|
|
12
15
|
private readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();
|
package/src/rateLimiter.ts
CHANGED
package/src/readAndParse.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
|
17
17
|
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
18
18
|
*
|
|
19
19
|
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
20
|
+
* @public
|
|
20
21
|
*/
|
|
21
22
|
export async function readAndParse<T>(
|
|
22
23
|
storage: Pick<IDocumentStorageService, "readBlob">,
|
package/src/runWithRetry.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { NonRetryableError } from ".";
|
|
|
14
14
|
/**
|
|
15
15
|
* Interface describing an object passed to various network APIs.
|
|
16
16
|
* It allows caller to control cancellation, as well as learn about any delays.
|
|
17
|
+
* @public
|
|
17
18
|
*/
|
|
18
19
|
export interface IProgress {
|
|
19
20
|
/**
|
|
@@ -43,6 +44,9 @@ export interface IProgress {
|
|
|
43
44
|
onRetry?(delayInMs: number, error: any): void;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
46
50
|
export async function runWithRetry<T>(
|
|
47
51
|
api: (cancel?: AbortSignal) => Promise<T>,
|
|
48
52
|
fetchCallName: string,
|
|
@@ -81,8 +85,7 @@ export async function runWithRetry<T>(
|
|
|
81
85
|
retry: numRetries,
|
|
82
86
|
duration: performance.now() - startTime,
|
|
83
87
|
fetchCallName,
|
|
84
|
-
|
|
85
|
-
reason: (progress.cancel as AbortSignal & { reason: any }).reason,
|
|
88
|
+
reason: progress.cancel.reason,
|
|
86
89
|
},
|
|
87
90
|
err,
|
|
88
91
|
);
|
|
@@ -92,8 +95,7 @@ export async function runWithRetry<T>(
|
|
|
92
95
|
{
|
|
93
96
|
driverVersion: pkgVersion,
|
|
94
97
|
fetchCallName,
|
|
95
|
-
|
|
96
|
-
reason: (progress.cancel as AbortSignal & { reason: any }).reason,
|
|
98
|
+
reason: progress.cancel.reason,
|
|
97
99
|
},
|
|
98
100
|
);
|
|
99
101
|
}
|
|
@@ -148,6 +150,7 @@ const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
|
|
|
148
150
|
* to when endpoint is reachable in which case it is 30s.
|
|
149
151
|
* @param error - error based on which we decide max wait time.
|
|
150
152
|
* @returns Max wait time.
|
|
153
|
+
* @public
|
|
151
154
|
*/
|
|
152
155
|
export function calculateMaxWaitTime(error: unknown): number {
|
|
153
156
|
return isFluidError(error) && error.getTelemetryProperties().endpointReached === true
|
|
@@ -30,6 +30,7 @@ export interface CombinedAppAndProtocolSummary extends ISummaryTree {
|
|
|
30
30
|
*/
|
|
31
31
|
export function isCombinedAppAndProtocolSummary(
|
|
32
32
|
summary: ISummaryTree | undefined,
|
|
33
|
+
...optionalRootTrees: string[]
|
|
33
34
|
): summary is CombinedAppAndProtocolSummary {
|
|
34
35
|
if (
|
|
35
36
|
summary?.tree === undefined ||
|
|
@@ -38,7 +39,7 @@ export function isCombinedAppAndProtocolSummary(
|
|
|
38
39
|
) {
|
|
39
40
|
return false;
|
|
40
41
|
}
|
|
41
|
-
const treeKeys = Object.keys(summary.tree);
|
|
42
|
+
const treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));
|
|
42
43
|
if (treeKeys.length !== 2) {
|
|
43
44
|
return false;
|
|
44
45
|
}
|
|
@@ -48,6 +49,7 @@ export function isCombinedAppAndProtocolSummary(
|
|
|
48
49
|
/**
|
|
49
50
|
* Extract the attributes from the protocol summary.
|
|
50
51
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
52
|
+
* @public
|
|
51
53
|
*/
|
|
52
54
|
export function getDocAttributesFromProtocolSummary(
|
|
53
55
|
protocolSummary: ISummaryTree,
|
|
@@ -59,6 +61,7 @@ export function getDocAttributesFromProtocolSummary(
|
|
|
59
61
|
/**
|
|
60
62
|
* Extract quorum values from the protocol summary.
|
|
61
63
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
64
|
+
* @public
|
|
62
65
|
*/
|
|
63
66
|
export function getQuorumValuesFromProtocolSummary(
|
|
64
67
|
protocolSummary: ISummaryTree,
|
package/src/treeConversions.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";
|
|
|
12
12
|
/**
|
|
13
13
|
* Converts ISummaryTree to ITree format.
|
|
14
14
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree {
|
|
17
18
|
const entries: ITreeEntry[] = [];
|