@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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { assert } from "@fluidframework/common-utils";
|
|
6
7
|
import {
|
|
7
8
|
ISummaryTree,
|
|
8
9
|
SummaryType,
|
|
@@ -11,16 +12,59 @@ import {
|
|
|
11
12
|
IDocumentAttributes,
|
|
12
13
|
} from "@fluidframework/protocol-definitions";
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Defines the current layout of an .app + .protocol summary tree
|
|
17
|
+
* this is used internally for create new, and single commit summary
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export interface CombinedAppAndProtocolSummary extends ISummaryTree {
|
|
21
|
+
tree: {
|
|
22
|
+
[".app"]: ISummaryTree;
|
|
23
|
+
[".protocol"]: ISummaryTree;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Validates the current layout of an .app + .protocol summary tree
|
|
29
|
+
* this is used internally for create new, and single commit summary
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export function isCombinedAppAndProtocolSummary(
|
|
33
|
+
summary: ISummaryTree | undefined,
|
|
34
|
+
): summary is CombinedAppAndProtocolSummary {
|
|
35
|
+
if (
|
|
36
|
+
summary?.tree === undefined ||
|
|
37
|
+
summary.tree?.[".app"]?.type !== SummaryType.Tree ||
|
|
38
|
+
summary.tree?.[".protocol"]?.type !== SummaryType.Tree
|
|
39
|
+
) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const treeKeys = Object.keys(summary.tree);
|
|
43
|
+
if (treeKeys.length !== 2) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
14
49
|
/**
|
|
15
50
|
* Combine the app summary and protocol summary in 1 tree.
|
|
16
51
|
* @param appSummary - Summary of the app.
|
|
17
52
|
* @param protocolSummary - Summary of the protocol.
|
|
53
|
+
* @internal
|
|
18
54
|
*/
|
|
19
55
|
export function combineAppAndProtocolSummary(
|
|
20
56
|
appSummary: ISummaryTree,
|
|
21
57
|
protocolSummary: ISummaryTree,
|
|
22
|
-
):
|
|
23
|
-
|
|
58
|
+
): CombinedAppAndProtocolSummary {
|
|
59
|
+
assert(
|
|
60
|
+
!isCombinedAppAndProtocolSummary(appSummary),
|
|
61
|
+
0x5a8 /* app summary is already a combined tree! */,
|
|
62
|
+
);
|
|
63
|
+
assert(
|
|
64
|
+
!isCombinedAppAndProtocolSummary(protocolSummary),
|
|
65
|
+
0x5a9 /* protocol summary is already a combined tree! */,
|
|
66
|
+
);
|
|
67
|
+
const createNewSummary: CombinedAppAndProtocolSummary = {
|
|
24
68
|
type: SummaryType.Tree,
|
|
25
69
|
tree: {
|
|
26
70
|
".protocol": protocolSummary,
|
package/src/treeConversions.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Uint8ArrayToString, unreachableCase } from "@fluidframework/common-utils";
|
|
7
7
|
import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "@fluidframework/protocol-base";
|
|
8
8
|
import { ISummaryTree, ITree, ITreeEntry, SummaryType } from "@fluidframework/protocol-definitions";
|
|
9
|
+
import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Converts ISummaryTree to ITree format.
|
|
@@ -13,17 +14,15 @@ import { ISummaryTree, ITree, ITreeEntry, SummaryType } from "@fluidframework/pr
|
|
|
13
14
|
*/
|
|
14
15
|
export function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree {
|
|
15
16
|
const entries: ITreeEntry[] = [];
|
|
16
|
-
const
|
|
17
|
-
const appSummary = summaryTree.tree[".app"] as ISummaryTree;
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
19
|
-
const adaptSumaryTree = protocolSummary && appSummary;
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17
|
+
const adaptSumaryTree = isCombinedAppAndProtocolSummary(summaryTree);
|
|
21
18
|
const allSummaryEntries = adaptSumaryTree
|
|
22
|
-
? [
|
|
19
|
+
? [
|
|
20
|
+
...Object.entries(summaryTree.tree[".protocol"].tree),
|
|
21
|
+
...Object.entries(summaryTree.tree[".app"].tree),
|
|
22
|
+
]
|
|
23
23
|
: Object.entries(summaryTree.tree);
|
|
24
24
|
|
|
25
25
|
for (const [key, value] of allSummaryEntries) {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
27
26
|
const k = adaptSumaryTree && ["attributes"].includes(key) ? `.${key}` : key;
|
|
28
27
|
switch (value.type) {
|
|
29
28
|
case SummaryType.Blob: {
|
package/src/treeUtils.ts
CHANGED
|
@@ -13,25 +13,36 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Summary tree assembler props
|
|
16
|
+
*
|
|
17
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
16
18
|
*/
|
|
17
19
|
export interface ISummaryTreeAssemblerProps {
|
|
18
20
|
/**
|
|
19
21
|
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
20
24
|
*/
|
|
21
25
|
unreferenced?: true;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
/**
|
|
25
29
|
* Summary tree assembler (without stats collection).
|
|
30
|
+
*
|
|
31
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
26
32
|
*/
|
|
27
33
|
export class SummaryTreeAssembler {
|
|
28
34
|
private attachmentCounter: number = 0;
|
|
29
35
|
private readonly summaryTree: { [path: string]: SummaryObject } = {};
|
|
30
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
39
|
+
*/
|
|
31
40
|
constructor(private readonly props?: ISummaryTreeAssemblerProps) {}
|
|
32
41
|
|
|
33
42
|
/**
|
|
34
43
|
* Get final summary
|
|
44
|
+
*
|
|
45
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
35
46
|
*/
|
|
36
47
|
public get summary(): ISummaryTree {
|
|
37
48
|
return {
|
|
@@ -43,6 +54,8 @@ export class SummaryTreeAssembler {
|
|
|
43
54
|
|
|
44
55
|
/**
|
|
45
56
|
* Add blob to summary
|
|
57
|
+
*
|
|
58
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
46
59
|
*/
|
|
47
60
|
public addBlob(key: string, content: string | Uint8Array): void {
|
|
48
61
|
this.summaryTree[key] = {
|
|
@@ -53,6 +66,8 @@ export class SummaryTreeAssembler {
|
|
|
53
66
|
|
|
54
67
|
/**
|
|
55
68
|
* Add handle to summary
|
|
69
|
+
*
|
|
70
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
56
71
|
*/
|
|
57
72
|
public addHandle(
|
|
58
73
|
key: string,
|
|
@@ -68,6 +83,8 @@ export class SummaryTreeAssembler {
|
|
|
68
83
|
|
|
69
84
|
/**
|
|
70
85
|
* Add tree to summary
|
|
86
|
+
*
|
|
87
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
71
88
|
*/
|
|
72
89
|
public addTree(key: string, summary: ISummaryTree): void {
|
|
73
90
|
this.summaryTree[key] = summary;
|
|
@@ -75,6 +92,8 @@ export class SummaryTreeAssembler {
|
|
|
75
92
|
|
|
76
93
|
/**
|
|
77
94
|
* Add attachment to summary
|
|
95
|
+
*
|
|
96
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
78
97
|
*/
|
|
79
98
|
public addAttachment(id: string) {
|
|
80
99
|
this.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };
|
|
@@ -86,6 +105,8 @@ export class SummaryTreeAssembler {
|
|
|
86
105
|
* @param snapshot - Source snapshot tree
|
|
87
106
|
* @param blobs - Blobs cache
|
|
88
107
|
* @returns Converted snapshot in ISummaryTree format
|
|
108
|
+
*
|
|
109
|
+
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
89
110
|
*/
|
|
90
111
|
export function convertSnapshotAndBlobsToSummaryTree(
|
|
91
112
|
snapshot: ISnapshotTree,
|