@fluidframework/driver-utils 2.0.0-internal.3.2.2 → 2.0.0-internal.3.3.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/dist/blobCacheStorageService.d.ts +11 -0
- package/dist/blobCacheStorageService.d.ts.map +1 -1
- package/dist/blobCacheStorageService.js +11 -0
- package/dist/blobCacheStorageService.js.map +1 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +5 -0
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +1 -1
- package/dist/emptyDocumentDeltaStorageService.js +5 -0
- package/dist/emptyDocumentDeltaStorageService.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/mapWithExpiration.d.ts +41 -0
- package/dist/mapWithExpiration.d.ts.map +1 -1
- package/dist/mapWithExpiration.js +41 -0
- package/dist/mapWithExpiration.js.map +1 -1
- package/dist/multiDocumentServiceFactory.d.ts +18 -0
- package/dist/multiDocumentServiceFactory.d.ts.map +1 -1
- package/dist/multiDocumentServiceFactory.js +18 -0
- package/dist/multiDocumentServiceFactory.js.map +1 -1
- package/dist/multiUrlResolver.d.ts +14 -0
- package/dist/multiUrlResolver.d.ts.map +1 -1
- package/dist/multiUrlResolver.js +14 -0
- package/dist/multiUrlResolver.js.map +1 -1
- package/dist/networkUtils.d.ts +2 -0
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +2 -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.map +1 -1
- package/dist/parallelRequests.js +33 -14
- package/dist/parallelRequests.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +19 -1
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js +24 -1
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +6 -7
- package/dist/treeConversions.js.map +1 -1
- package/dist/treeUtils.d.ts +21 -0
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +17 -0
- package/dist/treeUtils.js.map +1 -1
- package/lib/blobCacheStorageService.d.ts +11 -0
- package/lib/blobCacheStorageService.d.ts.map +1 -1
- package/lib/blobCacheStorageService.js +11 -0
- package/lib/blobCacheStorageService.js.map +1 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +5 -0
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +1 -1
- package/lib/emptyDocumentDeltaStorageService.js +5 -0
- package/lib/emptyDocumentDeltaStorageService.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/mapWithExpiration.d.ts +41 -0
- package/lib/mapWithExpiration.d.ts.map +1 -1
- package/lib/mapWithExpiration.js +41 -0
- package/lib/mapWithExpiration.js.map +1 -1
- package/lib/multiDocumentServiceFactory.d.ts +18 -0
- package/lib/multiDocumentServiceFactory.d.ts.map +1 -1
- package/lib/multiDocumentServiceFactory.js +18 -0
- package/lib/multiDocumentServiceFactory.js.map +1 -1
- package/lib/multiUrlResolver.d.ts +14 -0
- package/lib/multiUrlResolver.d.ts.map +1 -1
- package/lib/multiUrlResolver.js +14 -0
- package/lib/multiUrlResolver.js.map +1 -1
- package/lib/networkUtils.d.ts +2 -0
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +2 -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.map +1 -1
- package/lib/parallelRequests.js +34 -15
- package/lib/parallelRequests.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +19 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +22 -0
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +6 -7
- package/lib/treeConversions.js.map +1 -1
- package/lib/treeUtils.d.ts +21 -0
- package/lib/treeUtils.d.ts.map +1 -1
- package/lib/treeUtils.js +17 -0
- package/lib/treeUtils.js.map +1 -1
- package/package.json +12 -16
- package/src/blobCacheStorageService.ts +11 -0
- package/src/emptyDocumentDeltaStorageService.ts +5 -0
- package/src/index.ts +2 -0
- package/src/mapWithExpiration.ts +41 -0
- package/src/multiDocumentServiceFactory.ts +18 -0
- package/src/multiUrlResolver.ts +14 -0
- package/src/networkUtils.ts +2 -0
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +37 -18
- package/src/summaryForCreateNew.ts +46 -2
- package/src/treeConversions.ts +6 -7
- package/src/treeUtils.ts +21 -0
package/lib/treeUtils.d.ts
CHANGED
|
@@ -5,39 +5,58 @@
|
|
|
5
5
|
import { SummaryType, ISnapshotTree, ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Summary tree assembler props
|
|
8
|
+
*
|
|
9
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
8
10
|
*/
|
|
9
11
|
export interface ISummaryTreeAssemblerProps {
|
|
10
12
|
/**
|
|
11
13
|
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
12
16
|
*/
|
|
13
17
|
unreferenced?: true;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Summary tree assembler (without stats collection).
|
|
21
|
+
*
|
|
22
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
23
|
*/
|
|
18
24
|
export declare class SummaryTreeAssembler {
|
|
19
25
|
private readonly props?;
|
|
20
26
|
private attachmentCounter;
|
|
21
27
|
private readonly summaryTree;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
30
|
+
*/
|
|
22
31
|
constructor(props?: ISummaryTreeAssemblerProps | undefined);
|
|
23
32
|
/**
|
|
24
33
|
* Get final summary
|
|
34
|
+
*
|
|
35
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
25
36
|
*/
|
|
26
37
|
get summary(): ISummaryTree;
|
|
27
38
|
/**
|
|
28
39
|
* Add blob to summary
|
|
40
|
+
*
|
|
41
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
29
42
|
*/
|
|
30
43
|
addBlob(key: string, content: string | Uint8Array): void;
|
|
31
44
|
/**
|
|
32
45
|
* Add handle to summary
|
|
46
|
+
*
|
|
47
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
33
48
|
*/
|
|
34
49
|
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
35
50
|
/**
|
|
36
51
|
* Add tree to summary
|
|
52
|
+
*
|
|
53
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
37
54
|
*/
|
|
38
55
|
addTree(key: string, summary: ISummaryTree): void;
|
|
39
56
|
/**
|
|
40
57
|
* Add attachment to summary
|
|
58
|
+
*
|
|
59
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
41
60
|
*/
|
|
42
61
|
addAttachment(id: string): void;
|
|
43
62
|
}
|
|
@@ -46,6 +65,8 @@ export declare class SummaryTreeAssembler {
|
|
|
46
65
|
* @param snapshot - Source snapshot tree
|
|
47
66
|
* @param blobs - Blobs cache
|
|
48
67
|
* @returns Converted snapshot in ISummaryTree format
|
|
68
|
+
*
|
|
69
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
49
70
|
*/
|
|
50
71
|
export declare function convertSnapshotAndBlobsToSummaryTree(snapshot: ISnapshotTree, blobs: Map<string, ArrayBuffer>): ISummaryTree;
|
|
51
72
|
//# sourceMappingURL=treeUtils.d.ts.map
|
package/lib/treeUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EACb,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EACb,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,oBAAoB;IAOpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IANnC,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IAErE;;OAEG;gBAC0B,KAAK,CAAC,wCAA4B;IAE/D;;;;OAIG;IACH,IAAW,OAAO,IAAI,YAAY,CAMjC;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAO/D;;;;OAIG;IACI,SAAS,CACf,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,UAAU,EACxE,MAAM,EAAE,MAAM,GACZ,IAAI;IAQP;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIxD;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM;CAG/B;AAED;;;;;;;GAOG;AACH,wBAAgB,oCAAoC,CACnD,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAC7B,YAAY,CAcd"}
|
package/lib/treeUtils.js
CHANGED
|
@@ -6,8 +6,13 @@ import { assert, IsoBuffer } from "@fluidframework/common-utils";
|
|
|
6
6
|
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Summary tree assembler (without stats collection).
|
|
9
|
+
*
|
|
10
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
9
11
|
*/
|
|
10
12
|
export class SummaryTreeAssembler {
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
15
|
+
*/
|
|
11
16
|
constructor(props) {
|
|
12
17
|
this.props = props;
|
|
13
18
|
this.attachmentCounter = 0;
|
|
@@ -15,6 +20,8 @@ export class SummaryTreeAssembler {
|
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* Get final summary
|
|
23
|
+
*
|
|
24
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
18
25
|
*/
|
|
19
26
|
get summary() {
|
|
20
27
|
var _a;
|
|
@@ -26,6 +33,8 @@ export class SummaryTreeAssembler {
|
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
28
35
|
* Add blob to summary
|
|
36
|
+
*
|
|
37
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
29
38
|
*/
|
|
30
39
|
addBlob(key, content) {
|
|
31
40
|
this.summaryTree[key] = {
|
|
@@ -35,6 +44,8 @@ export class SummaryTreeAssembler {
|
|
|
35
44
|
}
|
|
36
45
|
/**
|
|
37
46
|
* Add handle to summary
|
|
47
|
+
*
|
|
48
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
38
49
|
*/
|
|
39
50
|
addHandle(key, handleType, handle) {
|
|
40
51
|
this.summaryTree[key] = {
|
|
@@ -45,12 +56,16 @@ export class SummaryTreeAssembler {
|
|
|
45
56
|
}
|
|
46
57
|
/**
|
|
47
58
|
* Add tree to summary
|
|
59
|
+
*
|
|
60
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
61
|
*/
|
|
49
62
|
addTree(key, summary) {
|
|
50
63
|
this.summaryTree[key] = summary;
|
|
51
64
|
}
|
|
52
65
|
/**
|
|
53
66
|
* Add attachment to summary
|
|
67
|
+
*
|
|
68
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
54
69
|
*/
|
|
55
70
|
addAttachment(id) {
|
|
56
71
|
this.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };
|
|
@@ -61,6 +76,8 @@ export class SummaryTreeAssembler {
|
|
|
61
76
|
* @param snapshot - Source snapshot tree
|
|
62
77
|
* @param blobs - Blobs cache
|
|
63
78
|
* @returns Converted snapshot in ISummaryTree format
|
|
79
|
+
*
|
|
80
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
64
81
|
*/
|
|
65
82
|
export function convertSnapshotAndBlobsToSummaryTree(snapshot, blobs) {
|
|
66
83
|
const assembler = new SummaryTreeAssembler({
|
package/lib/treeUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeUtils.js","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,WAAW,GAIX,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"treeUtils.js","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,WAAW,GAIX,MAAM,sCAAsC,CAAC;AAgB9C;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAIhC;;OAEG;IACH,YAA6B,KAAkC;QAAlC,UAAK,GAAL,KAAK,CAA6B;QANvD,sBAAiB,GAAW,CAAC,CAAC;QACrB,gBAAW,GAAsC,EAAE,CAAC;IAKH,CAAC;IAEnE;;;;OAIG;IACH,IAAW,OAAO;;QACjB,OAAO;YACN,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,oBAAO,IAAI,CAAC,WAAW,CAAE;YAC7B,YAAY,EAAE,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;SACtC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAW,EAAE,OAA4B;QACvD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG;YACvB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,OAAO;SACP,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,SAAS,CACf,GAAW,EACX,UAAwE,EACxE,MAAc;QAEd,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG;YACvB,IAAI,EAAE,WAAW,CAAC,MAAM;YACxB,UAAU;YACV,MAAM;SACN,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAW,EAAE,OAAqB;QAChD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAU;QAC9B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC;IACnF,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CACnD,QAAuB,EACvB,KAA+B;IAE/B,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC;QAC1C,YAAY,EAAE,QAAQ,CAAC,YAAY;KACnC,CAAC,CAAC;IACH,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACxD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1E,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAChE;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACzD,MAAM,OAAO,GAAG,oCAAoC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClE,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, IsoBuffer } from \"@fluidframework/common-utils\";\nimport {\n\tSummaryType,\n\tISnapshotTree,\n\tISummaryTree,\n\tSummaryObject,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Summary tree assembler props\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport interface ISummaryTreeAssemblerProps {\n\t/**\n\t * Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tunreferenced?: true;\n}\n\n/**\n * Summary tree assembler (without stats collection).\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class SummaryTreeAssembler {\n\tprivate attachmentCounter: number = 0;\n\tprivate readonly summaryTree: { [path: string]: SummaryObject } = {};\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tconstructor(private readonly props?: ISummaryTreeAssemblerProps) {}\n\n\t/**\n\t * Get final summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic get summary(): ISummaryTree {\n\t\treturn {\n\t\t\ttype: SummaryType.Tree,\n\t\t\ttree: { ...this.summaryTree },\n\t\t\tunreferenced: this.props?.unreferenced,\n\t\t};\n\t}\n\n\t/**\n\t * Add blob to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addBlob(key: string, content: string | Uint8Array): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Blob,\n\t\t\tcontent,\n\t\t};\n\t}\n\n\t/**\n\t * Add handle to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addHandle(\n\t\tkey: string,\n\t\thandleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment,\n\t\thandle: string,\n\t): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType,\n\t\t\thandle,\n\t\t};\n\t}\n\n\t/**\n\t * Add tree to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addTree(key: string, summary: ISummaryTree): void {\n\t\tthis.summaryTree[key] = summary;\n\t}\n\n\t/**\n\t * Add attachment to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addAttachment(id: string) {\n\t\tthis.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };\n\t}\n}\n\n/**\n * Helper function that converts ISnapshotTree and blobs to ISummaryTree\n * @param snapshot - Source snapshot tree\n * @param blobs - Blobs cache\n * @returns Converted snapshot in ISummaryTree format\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport function convertSnapshotAndBlobsToSummaryTree(\n\tsnapshot: ISnapshotTree,\n\tblobs: Map<string, ArrayBuffer>,\n): ISummaryTree {\n\tconst assembler = new SummaryTreeAssembler({\n\t\tunreferenced: snapshot.unreferenced,\n\t});\n\tfor (const [path, id] of Object.entries(snapshot.blobs)) {\n\t\tconst blob = blobs.get(id);\n\t\tassert(blob !== undefined, 0x2dd /* \"Cannot find blob for a given id\" */);\n\t\tassembler.addBlob(path, IsoBuffer.from(blob).toString(\"utf-8\"));\n\t}\n\tfor (const [key, tree] of Object.entries(snapshot.trees)) {\n\t\tconst subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);\n\t\tassembler.addTree(key, subtree);\n\t}\n\treturn assembler.summary;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-internal.3.
|
|
3
|
+
"version": "2.0.0-internal.3.3.1",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
39
39
|
"@fluidframework/common-utils": "^1.1.1",
|
|
40
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.
|
|
41
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.3.
|
|
42
|
-
"@fluidframework/gitresources": "^0.1038.
|
|
43
|
-
"@fluidframework/protocol-base": "^0.1038.
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.3.1 <2.0.0-internal.4.0.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.3.3.1 <2.0.0-internal.4.0.0",
|
|
42
|
+
"@fluidframework/gitresources": "^0.1038.3000",
|
|
43
|
+
"@fluidframework/protocol-base": "^0.1038.3000",
|
|
44
44
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
45
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.3.
|
|
45
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.3.3.1 <2.0.0-internal.4.0.0",
|
|
46
46
|
"axios": "^0.26.0",
|
|
47
47
|
"url": "^0.11.0",
|
|
48
48
|
"uuid": "^8.3.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@fluid-tools/build-cli": "^0.
|
|
51
|
+
"@fluid-tools/build-cli": "^0.12.0",
|
|
52
52
|
"@fluidframework/build-common": "^1.1.0",
|
|
53
|
-
"@fluidframework/build-tools": "^0.
|
|
54
|
-
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.3.
|
|
53
|
+
"@fluidframework/build-tools": "^0.12.0",
|
|
54
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.3.2.0",
|
|
55
55
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
56
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.
|
|
57
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.3.
|
|
56
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.3.1 <2.0.0-internal.4.0.0",
|
|
57
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.3.3.1 <2.0.0-internal.4.0.0",
|
|
58
58
|
"@microsoft/api-extractor": "^7.22.2",
|
|
59
59
|
"@rushstack/eslint-config": "^2.5.1",
|
|
60
60
|
"@types/mocha": "^9.1.1",
|
|
@@ -72,10 +72,6 @@
|
|
|
72
72
|
"typescript": "~4.5.5"
|
|
73
73
|
},
|
|
74
74
|
"typeValidation": {
|
|
75
|
-
"version": "2.0.0-internal.3.2.0",
|
|
76
|
-
"previousVersionStyle": "~previousMinor",
|
|
77
|
-
"baselineRange": ">=2.0.0-internal.3.1.0 <2.0.0-internal.3.2.0",
|
|
78
|
-
"baselineVersion": "2.0.0-internal.3.1.0",
|
|
79
75
|
"broken": {}
|
|
80
76
|
},
|
|
81
77
|
"scripts": {
|
|
@@ -102,7 +98,7 @@
|
|
|
102
98
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
103
99
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
104
100
|
"tsc": "tsc",
|
|
105
|
-
"typetests:gen": "
|
|
101
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
106
102
|
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
107
103
|
}
|
|
108
104
|
}
|
|
@@ -11,8 +11,13 @@ import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* IDocumentStorageService adapter with pre-cached blobs.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
14
16
|
*/
|
|
15
17
|
export class BlobCacheStorageService extends DocumentStorageServiceProxy {
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
20
|
+
*/
|
|
16
21
|
constructor(
|
|
17
22
|
internalStorageService: IDocumentStorageService,
|
|
18
23
|
private readonly blobs: Map<string, ArrayBufferLike>,
|
|
@@ -20,10 +25,16 @@ export class BlobCacheStorageService extends DocumentStorageServiceProxy {
|
|
|
20
25
|
super(internalStorageService);
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
30
|
+
*/
|
|
23
31
|
public get policies(): IDocumentStorageServicePolicies | undefined {
|
|
24
32
|
return this.internalStorageService.policies;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
37
|
+
*/
|
|
27
38
|
public async readBlob(id: string): Promise<ArrayBufferLike> {
|
|
28
39
|
const blob = this.blobs.get(id);
|
|
29
40
|
if (blob !== undefined) {
|
|
@@ -9,8 +9,13 @@ import { Queue } from "./parallelRequests";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages
|
|
12
|
+
*
|
|
13
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
12
14
|
*/
|
|
13
15
|
export class EmptyDocumentDeltaStorageService implements IDocumentDeltaStorageService {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
18
|
+
*/
|
|
14
19
|
public fetchMessages(
|
|
15
20
|
from: number,
|
|
16
21
|
_to: number | undefined,
|
package/src/index.ts
CHANGED
|
@@ -55,8 +55,10 @@ export { readAndParse } from "./readAndParse";
|
|
|
55
55
|
export { IProgress, runWithRetry } from "./runWithRetry";
|
|
56
56
|
export {
|
|
57
57
|
combineAppAndProtocolSummary,
|
|
58
|
+
CombinedAppAndProtocolSummary,
|
|
58
59
|
getDocAttributesFromProtocolSummary,
|
|
59
60
|
getQuorumValuesFromProtocolSummary,
|
|
61
|
+
isCombinedAppAndProtocolSummary,
|
|
60
62
|
} from "./summaryForCreateNew";
|
|
61
63
|
export { convertSummaryTreeToSnapshotITree } from "./treeConversions";
|
|
62
64
|
export {
|
package/src/mapWithExpiration.ts
CHANGED
|
@@ -8,11 +8,16 @@ import { assert } from "@fluidframework/common-utils";
|
|
|
8
8
|
/**
|
|
9
9
|
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
10
10
|
* The policy is based on the last time a key was written to.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
13
|
*/
|
|
12
14
|
export class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {
|
|
13
15
|
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
14
16
|
private readonly lastRefreshedTimes = new Map<TKey, number>();
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
20
|
+
*/
|
|
16
21
|
constructor(private readonly expiryMs: number) {
|
|
17
22
|
super();
|
|
18
23
|
}
|
|
@@ -47,37 +52,58 @@ export class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValu
|
|
|
47
52
|
this.forEach(() => {});
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
57
|
+
*/
|
|
50
58
|
get size(): number {
|
|
51
59
|
this.clearExpiredEntries();
|
|
52
60
|
return super.size;
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
65
|
+
*/
|
|
55
66
|
has(key: TKey): boolean {
|
|
56
67
|
this.checkExpiry(key, true /* cleanUp */);
|
|
57
68
|
return super.has(key);
|
|
58
69
|
}
|
|
59
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
73
|
+
*/
|
|
60
74
|
get(key: TKey): TValue | undefined {
|
|
61
75
|
this.checkExpiry(key, true /* cleanUp */);
|
|
62
76
|
return super.get(key);
|
|
63
77
|
}
|
|
64
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
81
|
+
*/
|
|
65
82
|
set(key: TKey, value: TValue): this {
|
|
66
83
|
// Sliding window expiration policy (on write)
|
|
67
84
|
this.refresh(key);
|
|
68
85
|
return super.set(key, value);
|
|
69
86
|
}
|
|
70
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
90
|
+
*/
|
|
71
91
|
delete(key: TKey): boolean {
|
|
72
92
|
this.lastRefreshedTimes.delete(key);
|
|
73
93
|
return super.delete(key);
|
|
74
94
|
}
|
|
75
95
|
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
98
|
+
*/
|
|
76
99
|
clear(): void {
|
|
77
100
|
this.lastRefreshedTimes.clear();
|
|
78
101
|
super.clear();
|
|
79
102
|
}
|
|
80
103
|
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
106
|
+
*/
|
|
81
107
|
forEach(
|
|
82
108
|
callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void,
|
|
83
109
|
thisArg?: any,
|
|
@@ -100,23 +126,38 @@ export class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValu
|
|
|
100
126
|
});
|
|
101
127
|
}
|
|
102
128
|
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
131
|
+
*/
|
|
103
132
|
entries(): IterableIterator<[TKey, TValue]> {
|
|
104
133
|
this.clearExpiredEntries();
|
|
105
134
|
return super.entries();
|
|
106
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
138
|
+
*/
|
|
107
139
|
keys(): IterableIterator<TKey> {
|
|
108
140
|
this.clearExpiredEntries();
|
|
109
141
|
return super.keys();
|
|
110
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
145
|
+
*/
|
|
111
146
|
values(): IterableIterator<TValue> {
|
|
112
147
|
this.clearExpiredEntries();
|
|
113
148
|
return super.values();
|
|
114
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
152
|
+
*/
|
|
115
153
|
[Symbol.iterator](): IterableIterator<[TKey, TValue]> {
|
|
116
154
|
this.clearExpiredEntries();
|
|
117
155
|
return super[Symbol.iterator]();
|
|
118
156
|
}
|
|
119
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
160
|
+
*/
|
|
120
161
|
valueOf() {
|
|
121
162
|
this.clearExpiredEntries();
|
|
122
163
|
return super.valueOf();
|
|
@@ -13,7 +13,13 @@ import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
|
13
13
|
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
14
14
|
import { ensureFluidResolvedUrl } from "./fluidResolvedUrl";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
18
|
+
*/
|
|
16
19
|
export class MultiDocumentServiceFactory implements IDocumentServiceFactory {
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
22
|
+
*/
|
|
17
23
|
public static create(
|
|
18
24
|
documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[],
|
|
19
25
|
) {
|
|
@@ -37,13 +43,22 @@ export class MultiDocumentServiceFactory implements IDocumentServiceFactory {
|
|
|
37
43
|
|
|
38
44
|
private readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;
|
|
39
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
|
+
*/
|
|
40
49
|
constructor(documentServiceFactories: IDocumentServiceFactory[]) {
|
|
41
50
|
this.protocolToDocumentFactoryMap = new Map();
|
|
42
51
|
documentServiceFactories.forEach((factory: IDocumentServiceFactory) => {
|
|
43
52
|
this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);
|
|
44
53
|
});
|
|
45
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
57
|
+
*/
|
|
46
58
|
public readonly protocolName = "none:";
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
61
|
+
*/
|
|
47
62
|
async createDocumentService(
|
|
48
63
|
resolvedUrl: IResolvedUrl,
|
|
49
64
|
logger?: ITelemetryBaseLogger,
|
|
@@ -64,6 +79,9 @@ export class MultiDocumentServiceFactory implements IDocumentServiceFactory {
|
|
|
64
79
|
return factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
|
|
65
80
|
}
|
|
66
81
|
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
84
|
+
*/
|
|
67
85
|
public async createContainer(
|
|
68
86
|
createNewSummary: ISummaryTree,
|
|
69
87
|
createNewResolvedUrl: IResolvedUrl,
|
package/src/multiUrlResolver.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
|
10
10
|
* Resolver that takes a list of url resolvers and then try each of them to resolve the url.
|
|
11
11
|
* @param resolversList - List of url resolvers to be used to resolve the request.
|
|
12
12
|
* @param request - Request to be resolved.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
13
15
|
*/
|
|
14
16
|
export async function configurableUrlResolver(
|
|
15
17
|
resolversList: IUrlResolver[],
|
|
@@ -25,7 +27,13 @@ export async function configurableUrlResolver(
|
|
|
25
27
|
return undefined;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
32
|
+
*/
|
|
28
33
|
export class MultiUrlResolver implements IUrlResolver {
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
36
|
+
*/
|
|
29
37
|
public static create(urlResolver: IUrlResolver | IUrlResolver[]) {
|
|
30
38
|
if (Array.isArray(urlResolver)) {
|
|
31
39
|
if (urlResolver.length === 1) {
|
|
@@ -38,10 +46,16 @@ export class MultiUrlResolver implements IUrlResolver {
|
|
|
38
46
|
|
|
39
47
|
private constructor(private readonly urlResolvers: IUrlResolver[]) {}
|
|
40
48
|
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
51
|
+
*/
|
|
41
52
|
async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {
|
|
42
53
|
return configurableUrlResolver(this.urlResolvers, request);
|
|
43
54
|
}
|
|
44
55
|
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
58
|
+
*/
|
|
45
59
|
public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {
|
|
46
60
|
throw new Error("Not implmented");
|
|
47
61
|
}
|
package/src/networkUtils.ts
CHANGED
|
@@ -38,6 +38,8 @@ export function logNetworkFailure(
|
|
|
38
38
|
* or machine connected to router that is not connected to internet)
|
|
39
39
|
* But there should be no false negatives.
|
|
40
40
|
* The only exception - Opera returns false when user enters "Work Offline" mode, regardless of actual connectivity.
|
|
41
|
+
*
|
|
42
|
+
* @deprecated - 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
41
43
|
*/
|
|
42
44
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
43
45
|
export function waitForConnectedState(minDelay: number): Promise<void> {
|
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
|
8
8
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
9
9
|
import { IDeltasFetchResult, IStream, IStreamResult } from "@fluidframework/driver-definitions";
|
|
10
10
|
import { getRetryDelayFromError, canRetryOnError, createGenericNetworkError } from "./network";
|
|
11
|
-
import {
|
|
11
|
+
import { logNetworkFailure } from "./networkUtils";
|
|
12
12
|
// For now, this package is versioned and released in unison with the specific drivers
|
|
13
13
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
14
14
|
|
|
@@ -379,6 +379,19 @@ export class Queue<T> implements IStream<T> {
|
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
const waitForOnline = async (): Promise<void> => {
|
|
383
|
+
// Only wait if we have a strong signal that we're offline - otherwise assume we're online.
|
|
384
|
+
if (globalThis.navigator?.onLine === false && globalThis.addEventListener !== undefined) {
|
|
385
|
+
return new Promise<void>((resolve) => {
|
|
386
|
+
const resolveAndRemoveListener = () => {
|
|
387
|
+
resolve();
|
|
388
|
+
globalThis.removeEventListener("online", resolveAndRemoveListener);
|
|
389
|
+
};
|
|
390
|
+
globalThis.addEventListener("online", resolveAndRemoveListener);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
382
395
|
/**
|
|
383
396
|
* Retrieve single batch of ops
|
|
384
397
|
* @param request - request index
|
|
@@ -403,7 +416,6 @@ async function getSingleOpBatch(
|
|
|
403
416
|
let lastSuccessTime: number | undefined;
|
|
404
417
|
|
|
405
418
|
let retry: number = 0;
|
|
406
|
-
const deltas: ISequencedDocumentMessage[] = [];
|
|
407
419
|
const nothing = { partial: false, cancel: true, payload: [] };
|
|
408
420
|
|
|
409
421
|
while (signal?.aborted !== true) {
|
|
@@ -412,23 +424,22 @@ async function getSingleOpBatch(
|
|
|
412
424
|
const startTime = performance.now();
|
|
413
425
|
|
|
414
426
|
try {
|
|
415
|
-
// Issue async request for deltas
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
deltas.push(...messages);
|
|
420
|
-
|
|
421
|
-
const deltasRetrievedLast = messages.length;
|
|
427
|
+
// Issue async request for deltas
|
|
428
|
+
const { messages, partialResult } = await get(
|
|
429
|
+
{ ...props, retry } /* telemetry props */,
|
|
430
|
+
);
|
|
422
431
|
|
|
423
|
-
|
|
424
|
-
|
|
432
|
+
// If we got messages back, return them. Return regardless of whether we got messages back if we didn't
|
|
433
|
+
// specify a "to", since we don't have an expectation of how many to receive.
|
|
434
|
+
if (messages.length !== 0 || !strongTo) {
|
|
435
|
+
return { payload: messages, cancel: false, partial: partialResult };
|
|
425
436
|
}
|
|
426
437
|
|
|
427
|
-
//
|
|
428
|
-
// Attempt to fetch more deltas. If we didn't receive any in the previous call we up our retry
|
|
429
|
-
// count since something prevented us from seeing those deltas
|
|
438
|
+
// Otherwise, the storage gave us back an empty set of ops but we were expecting a non-empty set.
|
|
430
439
|
|
|
431
440
|
if (lastSuccessTime === undefined) {
|
|
441
|
+
// Take timestamp of the first time server responded successfully, even though it wasn't with the ops we asked for.
|
|
442
|
+
// If we keep getting empty responses we'll eventually fail out below.
|
|
432
443
|
lastSuccessTime = performance.now();
|
|
433
444
|
} else if (performance.now() - lastSuccessTime > 30000) {
|
|
434
445
|
// If we are connected and receiving proper responses from server, but can't get any ops back,
|
|
@@ -449,8 +460,6 @@ async function getSingleOpBatch(
|
|
|
449
460
|
} catch (error) {
|
|
450
461
|
const canRetry = canRetryOnError(error);
|
|
451
462
|
|
|
452
|
-
lastSuccessTime = undefined;
|
|
453
|
-
|
|
454
463
|
const retryAfter = getRetryDelayFromError(error);
|
|
455
464
|
|
|
456
465
|
// This will log to error table only if the error is non-retryable
|
|
@@ -472,12 +481,22 @@ async function getSingleOpBatch(
|
|
|
472
481
|
throw error;
|
|
473
482
|
}
|
|
474
483
|
|
|
475
|
-
if (retryAfter !== undefined
|
|
484
|
+
if (retryAfter !== undefined) {
|
|
485
|
+
// If the error told us to wait, then we will wait for that specific amount rather than the default.
|
|
476
486
|
delay = retryAfter;
|
|
477
487
|
}
|
|
478
488
|
}
|
|
479
489
|
|
|
480
|
-
|
|
490
|
+
// If we get here something has gone wrong - either got an unexpected empty set of messages back or a real error.
|
|
491
|
+
// Either way we will wait a little bit before retrying.
|
|
492
|
+
await new Promise<void>((resolve) => {
|
|
493
|
+
setTimeout(resolve, delay);
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
// If we believe we're offline, we assume there's no point in trying until we at least think we're online.
|
|
497
|
+
// NOTE: This isn't strictly true for drivers that don't require network (e.g. local driver). Really this logic
|
|
498
|
+
// should probably live in the driver.
|
|
499
|
+
await waitForOnline();
|
|
481
500
|
}
|
|
482
501
|
|
|
483
502
|
return nothing;
|