@fluidframework/runtime-utils 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 +5 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +191 -0
- package/README.md +68 -1
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/runtime-utils.api.md +201 -0
- package/dist/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.cjs} +5 -2
- package/dist/dataStoreHandleContextUtils.cjs.map +1 -0
- package/dist/dataStoreHandleContextUtils.d.ts +1 -0
- package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/dist/{dataStoreHelpers.js → dataStoreHelpers.cjs} +44 -25
- package/dist/dataStoreHelpers.cjs.map +1 -0
- package/dist/dataStoreHelpers.d.ts +23 -4
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/index.cjs +44 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/{objectstoragepartition.js → objectstoragepartition.cjs} +4 -3
- package/dist/objectstoragepartition.cjs.map +1 -0
- package/dist/objectstoragepartition.d.ts +1 -0
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/{objectstorageutils.js → objectstorageutils.cjs} +11 -15
- package/dist/objectstorageutils.cjs.map +1 -0
- package/dist/objectstorageutils.d.ts +6 -0
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/{requestParser.js → requestParser.cjs} +7 -11
- package/dist/requestParser.cjs.map +1 -0
- package/dist/requestParser.d.ts +1 -0
- package/dist/requestParser.d.ts.map +1 -1
- package/dist/runtime-utils-alpha.d.ts +155 -0
- package/dist/runtime-utils-beta.d.ts +103 -0
- package/dist/runtime-utils-public.d.ts +103 -0
- package/dist/runtime-utils-untrimmed.d.ts +306 -0
- package/dist/{runtimeFactoryHelper.js → runtimeFactoryHelper.cjs} +11 -12
- package/dist/runtimeFactoryHelper.cjs.map +1 -0
- package/dist/runtimeFactoryHelper.d.ts +4 -1
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/{summaryUtils.js → summaryUtils.cjs} +138 -34
- package/dist/summaryUtils.cjs.map +1 -0
- package/dist/summaryUtils.d.ts +66 -4
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/unpackUsedRoutes.cjs +34 -0
- package/dist/unpackUsedRoutes.cjs.map +1 -0
- package/dist/unpackUsedRoutes.d.ts +12 -0
- package/dist/unpackUsedRoutes.d.ts.map +1 -0
- package/dist/{utils.js → utils.cjs} +2 -1
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +7 -2
- package/dist/utils.d.ts.map +1 -1
- package/lib/{dataStoreHandleContextUtils.d.ts → dataStoreHandleContextUtils.d.mts} +1 -0
- package/lib/dataStoreHandleContextUtils.d.mts.map +1 -0
- package/lib/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.mjs} +5 -2
- package/lib/dataStoreHandleContextUtils.mjs.map +1 -0
- package/lib/{dataStoreHelpers.d.ts → dataStoreHelpers.d.mts} +23 -4
- package/lib/dataStoreHelpers.d.mts.map +1 -0
- package/lib/{dataStoreHelpers.js → dataStoreHelpers.mjs} +42 -22
- package/lib/dataStoreHelpers.mjs.map +1 -0
- package/lib/index.d.mts +14 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +14 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{objectstoragepartition.d.ts → objectstoragepartition.d.mts} +1 -0
- package/lib/objectstoragepartition.d.mts.map +1 -0
- package/lib/{objectstoragepartition.js → objectstoragepartition.mjs} +3 -2
- package/lib/objectstoragepartition.mjs.map +1 -0
- package/lib/{objectstorageutils.d.ts → objectstorageutils.d.mts} +6 -0
- package/lib/objectstorageutils.d.mts.map +1 -0
- package/lib/{objectstorageutils.js → objectstorageutils.mjs} +11 -15
- package/lib/objectstorageutils.mjs.map +1 -0
- package/lib/{requestParser.d.ts → requestParser.d.mts} +1 -4
- package/lib/requestParser.d.mts.map +1 -0
- package/lib/{requestParser.js → requestParser.mjs} +7 -11
- package/lib/requestParser.mjs.map +1 -0
- package/lib/runtime-utils-alpha.d.mts +155 -0
- package/lib/runtime-utils-beta.d.mts +103 -0
- package/lib/runtime-utils-public.d.mts +103 -0
- package/lib/runtime-utils-untrimmed.d.mts +306 -0
- package/lib/{runtimeFactoryHelper.d.ts → runtimeFactoryHelper.d.mts} +4 -1
- package/lib/runtimeFactoryHelper.d.mts.map +1 -0
- package/lib/runtimeFactoryHelper.mjs +24 -0
- package/lib/runtimeFactoryHelper.mjs.map +1 -0
- package/lib/{summaryUtils.d.ts → summaryUtils.d.mts} +66 -4
- package/lib/summaryUtils.d.mts.map +1 -0
- package/lib/{summaryUtils.js → summaryUtils.mjs} +129 -26
- package/lib/summaryUtils.mjs.map +1 -0
- package/lib/unpackUsedRoutes.d.mts +12 -0
- package/lib/unpackUsedRoutes.d.mts.map +1 -0
- package/lib/unpackUsedRoutes.mjs +30 -0
- package/lib/unpackUsedRoutes.mjs.map +1 -0
- package/lib/{utils.d.ts → utils.d.mts} +7 -2
- package/lib/utils.d.mts.map +1 -0
- package/lib/{utils.js → utils.mjs} +2 -1
- package/lib/utils.mjs.map +1 -0
- package/package.json +102 -66
- package/prettier.config.cjs +8 -0
- package/src/dataStoreHandleContextUtils.ts +24 -16
- package/src/dataStoreHelpers.ts +106 -83
- package/src/index.ts +31 -9
- package/src/objectstoragepartition.ts +18 -14
- package/src/objectstorageutils.ts +37 -36
- package/src/requestParser.ts +81 -86
- package/src/runtimeFactoryHelper.ts +27 -26
- package/src/summaryUtils.ts +425 -299
- package/src/unpackUsedRoutes.ts +31 -0
- package/src/utils.ts +12 -7
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -12
- package/dist/dataStoreHandleContextUtils.js.map +0 -1
- package/dist/dataStoreHelpers.js.map +0 -1
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/objectstoragepartition.js.map +0 -1
- package/dist/objectstorageutils.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/requestParser.js.map +0 -1
- package/dist/runtimeFactoryHelper.js.map +0 -1
- package/dist/summarizerNode/index.d.ts +0 -8
- package/dist/summarizerNode/index.d.ts.map +0 -1
- package/dist/summarizerNode/index.js +0 -12
- package/dist/summarizerNode/index.js.map +0 -1
- package/dist/summarizerNode/summarizerNode.d.ts +0 -139
- package/dist/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNode.js +0 -480
- package/dist/summarizerNode/summarizerNode.js.map +0 -1
- package/dist/summarizerNode/summarizerNodeUtils.d.ts +0 -161
- package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNodeUtils.js +0 -225
- package/dist/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js +0 -294
- package/dist/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/dist/summaryUtils.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/lib/dataStoreHandleContextUtils.d.ts.map +0 -1
- package/lib/dataStoreHandleContextUtils.js.map +0 -1
- package/lib/dataStoreHelpers.d.ts.map +0 -1
- package/lib/dataStoreHelpers.js.map +0 -1
- package/lib/index.d.ts +0 -14
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
- package/lib/objectstoragepartition.d.ts.map +0 -1
- package/lib/objectstoragepartition.js.map +0 -1
- package/lib/objectstorageutils.d.ts.map +0 -1
- package/lib/objectstorageutils.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/requestParser.d.ts.map +0 -1
- package/lib/requestParser.js.map +0 -1
- package/lib/runtimeFactoryHelper.d.ts.map +0 -1
- package/lib/runtimeFactoryHelper.js +0 -25
- package/lib/runtimeFactoryHelper.js.map +0 -1
- package/lib/summarizerNode/index.d.ts +0 -8
- package/lib/summarizerNode/index.d.ts.map +0 -1
- package/lib/summarizerNode/index.js +0 -7
- package/lib/summarizerNode/index.js.map +0 -1
- package/lib/summarizerNode/summarizerNode.d.ts +0 -139
- package/lib/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNode.js +0 -475
- package/lib/summarizerNode/summarizerNode.js.map +0 -1
- package/lib/summarizerNode/summarizerNodeUtils.d.ts +0 -161
- package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNodeUtils.js +0 -216
- package/lib/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js +0 -289
- package/lib/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/lib/summaryUtils.d.ts.map +0 -1
- package/lib/summaryUtils.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/src/packageVersion.ts +0 -9
- package/src/summarizerNode/index.ts +0 -8
- package/src/summarizerNode/summarizerNode.ts +0 -662
- package/src/summarizerNode/summarizerNodeUtils.ts +0 -339
- package/src/summarizerNode/summarizerNodeWithGc.ts +0 -459
- package/tsconfig.esnext.json +0 -7
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TelemetryContext = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.convertToSummaryTree = exports.convertToSummaryTreeWithStats = exports.SummaryTreeBuilder = exports.addSummarizeResultToSummary = exports.addTreeToSummary = exports.addBlobToSummary = exports.calculateStats = exports.getBlobSize = exports.utf8ByteLength = exports.mergeStats = void 0;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
exports.GCDataBuilder = exports.TelemetryContext = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.convertToSummaryTree = exports.convertToSummaryTreeWithStats = exports.SummaryTreeBuilder = exports.addSummarizeResultToSummary = exports.addTreeToSummary = exports.addBlobToSummary = exports.calculateStats = exports.getBlobSize = exports.utf8ByteLength = exports.mergeStats = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
+
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
10
11
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
11
12
|
/**
|
|
12
13
|
* Combines summary stats by adding their totals together.
|
|
13
14
|
* Returns empty stats if called without args.
|
|
14
15
|
* @param stats - stats to merge
|
|
16
|
+
* @internal
|
|
15
17
|
*/
|
|
16
18
|
function mergeStats(...stats) {
|
|
17
19
|
const results = {
|
|
@@ -31,6 +33,9 @@ function mergeStats(...stats) {
|
|
|
31
33
|
return results;
|
|
32
34
|
}
|
|
33
35
|
exports.mergeStats = mergeStats;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
34
39
|
function utf8ByteLength(str) {
|
|
35
40
|
// returns the byte length of an utf8 string
|
|
36
41
|
let s = str.length;
|
|
@@ -42,20 +47,18 @@ function utf8ByteLength(str) {
|
|
|
42
47
|
else if (code > 0x7ff && code <= 0xffff) {
|
|
43
48
|
s += 2;
|
|
44
49
|
}
|
|
45
|
-
if (code >=
|
|
50
|
+
if (code >= 0xdc00 && code <= 0xdfff) {
|
|
46
51
|
i--; // trail surrogate
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
return s;
|
|
50
55
|
}
|
|
51
56
|
exports.utf8ByteLength = utf8ByteLength;
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
52
60
|
function getBlobSize(content) {
|
|
53
|
-
|
|
54
|
-
return utf8ByteLength(content);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return content.byteLength;
|
|
58
|
-
}
|
|
61
|
+
return typeof content === "string" ? utf8ByteLength(content) : content.byteLength;
|
|
59
62
|
}
|
|
60
63
|
exports.getBlobSize = getBlobSize;
|
|
61
64
|
function calculateStatsCore(summaryObject, stats) {
|
|
@@ -76,15 +79,22 @@ function calculateStatsCore(summaryObject, stats) {
|
|
|
76
79
|
stats.totalBlobSize += getBlobSize(summaryObject.content);
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
|
-
default:
|
|
82
|
+
default:
|
|
83
|
+
return;
|
|
80
84
|
}
|
|
81
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
82
89
|
function calculateStats(summary) {
|
|
83
90
|
const stats = mergeStats();
|
|
84
91
|
calculateStatsCore(summary, stats);
|
|
85
92
|
return stats;
|
|
86
93
|
}
|
|
87
94
|
exports.calculateStats = calculateStats;
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
88
98
|
function addBlobToSummary(summary, key, content) {
|
|
89
99
|
const blob = {
|
|
90
100
|
type: protocol_definitions_1.SummaryType.Blob,
|
|
@@ -95,31 +105,40 @@ function addBlobToSummary(summary, key, content) {
|
|
|
95
105
|
summary.stats.totalBlobSize += getBlobSize(content);
|
|
96
106
|
}
|
|
97
107
|
exports.addBlobToSummary = addBlobToSummary;
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
98
111
|
function addTreeToSummary(summary, key, summarizeResult) {
|
|
99
112
|
summary.summary.tree[key] = summarizeResult.summary;
|
|
100
113
|
summary.stats = mergeStats(summary.stats, summarizeResult.stats);
|
|
101
114
|
}
|
|
102
115
|
exports.addTreeToSummary = addTreeToSummary;
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
103
119
|
function addSummarizeResultToSummary(summary, key, summarizeResult) {
|
|
104
120
|
summary.summary.tree[key] = summarizeResult.summary;
|
|
105
121
|
summary.stats = mergeStats(summary.stats, summarizeResult.stats);
|
|
106
122
|
}
|
|
107
123
|
exports.addSummarizeResultToSummary = addSummarizeResultToSummary;
|
|
124
|
+
/**
|
|
125
|
+
* @alpha
|
|
126
|
+
*/
|
|
108
127
|
class SummaryTreeBuilder {
|
|
109
|
-
constructor() {
|
|
110
|
-
this.attachmentCounter = 0;
|
|
111
|
-
this.summaryTree = {};
|
|
112
|
-
this.summaryStats = mergeStats();
|
|
113
|
-
this.summaryStats.treeNodeCount++;
|
|
114
|
-
}
|
|
115
128
|
get summary() {
|
|
116
129
|
return {
|
|
117
130
|
type: protocol_definitions_1.SummaryType.Tree,
|
|
118
|
-
tree:
|
|
131
|
+
tree: { ...this.summaryTree },
|
|
119
132
|
};
|
|
120
133
|
}
|
|
121
134
|
get stats() {
|
|
122
|
-
return
|
|
135
|
+
return { ...this.summaryStats };
|
|
136
|
+
}
|
|
137
|
+
constructor() {
|
|
138
|
+
this.attachmentCounter = 0;
|
|
139
|
+
this.summaryTree = {};
|
|
140
|
+
this.summaryStats = mergeStats();
|
|
141
|
+
this.summaryStats.treeNodeCount++;
|
|
123
142
|
}
|
|
124
143
|
addBlob(key, content) {
|
|
125
144
|
// Prevent cloning by directly referencing underlying private properties
|
|
@@ -155,6 +174,7 @@ exports.SummaryTreeBuilder = SummaryTreeBuilder;
|
|
|
155
174
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
156
175
|
* @param snapshot - snapshot in ITree format
|
|
157
176
|
* @param fullTree - true to never use handles, even if id is specified
|
|
177
|
+
* @alpha
|
|
158
178
|
*/
|
|
159
179
|
function convertToSummaryTreeWithStats(snapshot, fullTree = false) {
|
|
160
180
|
const builder = new SummaryTreeBuilder();
|
|
@@ -162,13 +182,9 @@ function convertToSummaryTreeWithStats(snapshot, fullTree = false) {
|
|
|
162
182
|
switch (entry.type) {
|
|
163
183
|
case protocol_definitions_1.TreeEntry.Blob: {
|
|
164
184
|
const blob = entry.value;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
content = blob.contents;
|
|
171
|
-
}
|
|
185
|
+
const content = blob.encoding === "base64"
|
|
186
|
+
? client_utils_1.IsoBuffer.from(blob.contents, "base64")
|
|
187
|
+
: blob.contents;
|
|
172
188
|
builder.addBlob(entry.path, content);
|
|
173
189
|
break;
|
|
174
190
|
}
|
|
@@ -195,6 +211,7 @@ exports.convertToSummaryTreeWithStats = convertToSummaryTreeWithStats;
|
|
|
195
211
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
196
212
|
* @param snapshot - snapshot in ITree format
|
|
197
213
|
* @param fullTree - true to never use handles, even if id is specified
|
|
214
|
+
* @internal
|
|
198
215
|
*/
|
|
199
216
|
function convertToSummaryTree(snapshot, fullTree = false) {
|
|
200
217
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
@@ -219,6 +236,7 @@ exports.convertToSummaryTree = convertToSummaryTree;
|
|
|
219
236
|
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
220
237
|
* was taken by serialize api in detached container.
|
|
221
238
|
* @param snapshot - snapshot in ISnapshotTree format
|
|
239
|
+
* @internal
|
|
222
240
|
*/
|
|
223
241
|
function convertSnapshotTreeToSummaryTree(snapshot) {
|
|
224
242
|
const builder = new SummaryTreeBuilder();
|
|
@@ -227,13 +245,13 @@ function convertSnapshotTreeToSummaryTree(snapshot) {
|
|
|
227
245
|
if (snapshot.blobsContents !== undefined) {
|
|
228
246
|
const content = snapshot.blobsContents[id];
|
|
229
247
|
if (content !== undefined) {
|
|
230
|
-
decoded = (0,
|
|
248
|
+
decoded = (0, client_utils_1.bufferToString)(content, "utf-8");
|
|
231
249
|
}
|
|
232
250
|
// 0.44 back-compat We still put contents in same blob for back-compat so need to add blob
|
|
233
251
|
// only for blobPath -> blobId mapping and not for blobId -> blob value contents.
|
|
234
252
|
}
|
|
235
253
|
else if (snapshot.blobs[id] !== undefined) {
|
|
236
|
-
decoded = (0,
|
|
254
|
+
decoded = (0, client_utils_1.fromBase64ToUtf8)(snapshot.blobs[id]);
|
|
237
255
|
}
|
|
238
256
|
if (decoded !== undefined) {
|
|
239
257
|
builder.addBlob(path, decoded);
|
|
@@ -251,6 +269,7 @@ exports.convertSnapshotTreeToSummaryTree = convertSnapshotTreeToSummaryTree;
|
|
|
251
269
|
/**
|
|
252
270
|
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
253
271
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
272
|
+
* @internal
|
|
254
273
|
*/
|
|
255
274
|
function convertSummaryTreeToITree(summaryTree) {
|
|
256
275
|
const entries = [];
|
|
@@ -263,25 +282,25 @@ function convertSummaryTreeToITree(summaryTree) {
|
|
|
263
282
|
parsedContent = value.content;
|
|
264
283
|
}
|
|
265
284
|
else {
|
|
266
|
-
parsedContent = (0,
|
|
285
|
+
parsedContent = (0, client_utils_1.Uint8ArrayToString)(value.content, "base64");
|
|
267
286
|
encoding = "base64";
|
|
268
287
|
}
|
|
269
|
-
entries.push(new
|
|
288
|
+
entries.push(new driver_utils_1.BlobTreeEntry(key, parsedContent, encoding));
|
|
270
289
|
break;
|
|
271
290
|
}
|
|
272
291
|
case protocol_definitions_1.SummaryType.Tree: {
|
|
273
|
-
entries.push(new
|
|
292
|
+
entries.push(new driver_utils_1.TreeTreeEntry(key, convertSummaryTreeToITree(value)));
|
|
274
293
|
break;
|
|
275
294
|
}
|
|
276
295
|
case protocol_definitions_1.SummaryType.Attachment: {
|
|
277
|
-
entries.push(new
|
|
296
|
+
entries.push(new driver_utils_1.AttachmentTreeEntry(key, value.id));
|
|
278
297
|
break;
|
|
279
298
|
}
|
|
280
299
|
case protocol_definitions_1.SummaryType.Handle: {
|
|
281
300
|
throw new Error("Should not have Handle type in summary tree");
|
|
282
301
|
}
|
|
283
302
|
default:
|
|
284
|
-
(0,
|
|
303
|
+
(0, core_utils_1.unreachableCase)(value, "Unexpected summary tree type");
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
306
|
return {
|
|
@@ -290,6 +309,9 @@ function convertSummaryTreeToITree(summaryTree) {
|
|
|
290
309
|
};
|
|
291
310
|
}
|
|
292
311
|
exports.convertSummaryTreeToITree = convertSummaryTreeToITree;
|
|
312
|
+
/**
|
|
313
|
+
* @internal
|
|
314
|
+
*/
|
|
293
315
|
class TelemetryContext {
|
|
294
316
|
constructor() {
|
|
295
317
|
this.telemetry = new Map();
|
|
@@ -300,6 +322,15 @@ class TelemetryContext {
|
|
|
300
322
|
set(prefix, property, value) {
|
|
301
323
|
this.telemetry.set(`${prefix}${property}`, value);
|
|
302
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
327
|
+
*/
|
|
328
|
+
setMultiple(prefix, property, values) {
|
|
329
|
+
// Set the values individually so that they are logged as a flat list along with other properties.
|
|
330
|
+
for (const key of Object.keys(values)) {
|
|
331
|
+
this.set(prefix, `${property}_${key}`, values[key]);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
303
334
|
/**
|
|
304
335
|
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
305
336
|
*/
|
|
@@ -318,4 +349,77 @@ class TelemetryContext {
|
|
|
318
349
|
}
|
|
319
350
|
}
|
|
320
351
|
exports.TelemetryContext = TelemetryContext;
|
|
321
|
-
|
|
352
|
+
/**
|
|
353
|
+
* Trims the leading slashes from the given string.
|
|
354
|
+
* @param str - A string that may contain leading slashes.
|
|
355
|
+
* @returns A new string without leading slashes.
|
|
356
|
+
*/
|
|
357
|
+
function trimLeadingSlashes(str) {
|
|
358
|
+
return str.replace(/^\/+/g, "");
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Trims the trailing slashes from the given string.
|
|
362
|
+
* @param str - A string that may contain trailing slashes.
|
|
363
|
+
* @returns A new string without trailing slashes.
|
|
364
|
+
*/
|
|
365
|
+
function trimTrailingSlashes(str) {
|
|
366
|
+
return str.replace(/\/+$/g, "");
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Helper class to build the garbage collection data of a node by combining the data from multiple nodes.
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
class GCDataBuilder {
|
|
373
|
+
constructor() {
|
|
374
|
+
this.gcNodesSet = {};
|
|
375
|
+
}
|
|
376
|
+
get gcNodes() {
|
|
377
|
+
const gcNodes = {};
|
|
378
|
+
for (const [nodeId, outboundRoutes] of Object.entries(this.gcNodesSet)) {
|
|
379
|
+
gcNodes[nodeId] = [...outboundRoutes];
|
|
380
|
+
}
|
|
381
|
+
return gcNodes;
|
|
382
|
+
}
|
|
383
|
+
addNode(id, outboundRoutes) {
|
|
384
|
+
this.gcNodesSet[id] = new Set(outboundRoutes);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Adds the given GC nodes. It does the following:
|
|
388
|
+
* - Normalizes the ids of the given nodes.
|
|
389
|
+
* - Prefixes the given `prefixId` to the given nodes' ids.
|
|
390
|
+
* - Adds the outbound routes of the nodes against the normalized and prefixed id.
|
|
391
|
+
*/
|
|
392
|
+
prefixAndAddNodes(prefixId, gcNodes) {
|
|
393
|
+
for (const [id, outboundRoutes] of Object.entries(gcNodes)) {
|
|
394
|
+
// Remove any leading slashes from the id.
|
|
395
|
+
let normalizedId = trimLeadingSlashes(id);
|
|
396
|
+
// Prefix the given id to the normalized id.
|
|
397
|
+
normalizedId = `/${prefixId}/${normalizedId}`;
|
|
398
|
+
// Remove any trailing slashes from the normalized id. Note that the trailing slashes are removed after
|
|
399
|
+
// adding the prefix for handling the special case where id is "/".
|
|
400
|
+
normalizedId = trimTrailingSlashes(normalizedId);
|
|
401
|
+
// Add the outbound routes against the normalized and prefixed id without duplicates.
|
|
402
|
+
this.gcNodesSet[normalizedId] = new Set(outboundRoutes);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
addNodes(gcNodes) {
|
|
406
|
+
for (const [id, outboundRoutes] of Object.entries(gcNodes)) {
|
|
407
|
+
this.gcNodesSet[id] = new Set(outboundRoutes);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Adds the given outbound route to the outbound routes of all GC nodes.
|
|
412
|
+
*/
|
|
413
|
+
addRouteToAllNodes(outboundRoute) {
|
|
414
|
+
for (const outboundRoutes of Object.values(this.gcNodesSet)) {
|
|
415
|
+
outboundRoutes.add(outboundRoute);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
getGCData() {
|
|
419
|
+
return {
|
|
420
|
+
gcNodes: this.gcNodes,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
exports.GCDataBuilder = GCDataBuilder;
|
|
425
|
+
//# sourceMappingURL=summaryUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryUtils.cjs","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAKsC;AACtC,2DAA6D;AAC7D,+DAAiG;AACjG,+EAQ8C;AAU9C;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,GAAG,KAAsB;IACnD,MAAM,OAAO,GAAG;QACf,aAAa,EAAE,CAAC;QAChB,aAAa,EAAE,CAAC;QAChB,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,oBAAoB,EAAE,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M,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC5D,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;SAClC;IACF,CAAC;IAEM,SAAS;QACf,OAAO;YACN,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AAvDD,sCAuDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TelemetryEventPropertyType } from \"@fluidframework/core-interfaces\";\nimport {\n\tbufferToString,\n\tfromBase64ToUtf8,\n\tIsoBuffer,\n\tUint8ArrayToString,\n} from \"@fluid-internal/client-utils\";\nimport { unreachableCase } from \"@fluidframework/core-utils\";\nimport { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from \"@fluidframework/driver-utils\";\nimport {\n\tITree,\n\tSummaryType,\n\tISummaryTree,\n\tSummaryObject,\n\tISummaryBlob,\n\tTreeEntry,\n\tITreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tISummaryStats,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n} from \"@fluidframework/runtime-definitions\";\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions\";\n\n/**\n * Combines summary stats by adding their totals together.\n * Returns empty stats if called without args.\n * @param stats - stats to merge\n * @internal\n */\nexport function mergeStats(...stats: ISummaryStats[]): ISummaryStats {\n\tconst results = {\n\t\ttreeNodeCount: 0,\n\t\tblobNodeCount: 0,\n\t\thandleNodeCount: 0,\n\t\ttotalBlobSize: 0,\n\t\tunreferencedBlobSize: 0,\n\t};\n\tfor (const stat of stats) {\n\t\tresults.treeNodeCount += stat.treeNodeCount;\n\t\tresults.blobNodeCount += stat.blobNodeCount;\n\t\tresults.handleNodeCount += stat.handleNodeCount;\n\t\tresults.totalBlobSize += stat.totalBlobSize;\n\t\tresults.unreferencedBlobSize += stat.unreferencedBlobSize;\n\t}\n\treturn results;\n}\n\n/**\n * @internal\n */\nexport function utf8ByteLength(str: string): number {\n\t// returns the byte length of an utf8 string\n\tlet s = str.length;\n\tfor (let i = str.length - 1; i >= 0; i--) {\n\t\tconst code = str.charCodeAt(i);\n\t\tif (code > 0x7f && code <= 0x7ff) {\n\t\t\ts++;\n\t\t} else if (code > 0x7ff && code <= 0xffff) {\n\t\t\ts += 2;\n\t\t}\n\t\tif (code >= 0xdc00 && code <= 0xdfff) {\n\t\t\ti--; // trail surrogate\n\t\t}\n\t}\n\treturn s;\n}\n\n/**\n * @internal\n */\nexport function getBlobSize(content: ISummaryBlob[\"content\"]): number {\n\treturn typeof content === \"string\" ? utf8ByteLength(content) : content.byteLength;\n}\n\nfunction calculateStatsCore(summaryObject: SummaryObject, stats: ISummaryStats): void {\n\tswitch (summaryObject.type) {\n\t\tcase SummaryType.Tree: {\n\t\t\tstats.treeNodeCount++;\n\t\t\tfor (const value of Object.values(summaryObject.tree)) {\n\t\t\t\tcalculateStatsCore(value, stats);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tcase SummaryType.Handle: {\n\t\t\tstats.handleNodeCount++;\n\t\t\treturn;\n\t\t}\n\t\tcase SummaryType.Blob: {\n\t\t\tstats.blobNodeCount++;\n\t\t\tstats.totalBlobSize += getBlobSize(summaryObject.content);\n\t\t\treturn;\n\t\t}\n\t\tdefault:\n\t\t\treturn;\n\t}\n}\n\n/**\n * @internal\n */\nexport function calculateStats(summary: SummaryObject): ISummaryStats {\n\tconst stats = mergeStats();\n\tcalculateStatsCore(summary, stats);\n\treturn stats;\n}\n\n/**\n * @internal\n */\nexport function addBlobToSummary(\n\tsummary: ISummaryTreeWithStats,\n\tkey: string,\n\tcontent: string | Uint8Array,\n): void {\n\tconst blob: ISummaryBlob = {\n\t\ttype: SummaryType.Blob,\n\t\tcontent,\n\t};\n\tsummary.summary.tree[key] = blob;\n\tsummary.stats.blobNodeCount++;\n\tsummary.stats.totalBlobSize += getBlobSize(content);\n}\n\n/**\n * @internal\n */\nexport function addTreeToSummary(\n\tsummary: ISummaryTreeWithStats,\n\tkey: string,\n\tsummarizeResult: ISummarizeResult,\n): void {\n\tsummary.summary.tree[key] = summarizeResult.summary;\n\tsummary.stats = mergeStats(summary.stats, summarizeResult.stats);\n}\n\n/**\n * @internal\n */\nexport function addSummarizeResultToSummary(\n\tsummary: ISummaryTreeWithStats,\n\tkey: string,\n\tsummarizeResult: ISummarizeResult,\n): void {\n\tsummary.summary.tree[key] = summarizeResult.summary;\n\tsummary.stats = mergeStats(summary.stats, summarizeResult.stats);\n}\n\n/**\n * @alpha\n */\nexport class SummaryTreeBuilder implements ISummaryTreeWithStats {\n\tprivate attachmentCounter: number = 0;\n\n\tpublic get summary(): ISummaryTree {\n\t\treturn {\n\t\t\ttype: SummaryType.Tree,\n\t\t\ttree: { ...this.summaryTree },\n\t\t};\n\t}\n\n\tpublic get stats(): Readonly<ISummaryStats> {\n\t\treturn { ...this.summaryStats };\n\t}\n\n\tconstructor() {\n\t\tthis.summaryStats = mergeStats();\n\t\tthis.summaryStats.treeNodeCount++;\n\t}\n\n\tprivate readonly summaryTree: { [path: string]: SummaryObject } = {};\n\tprivate summaryStats: ISummaryStats;\n\n\tpublic addBlob(key: string, content: string | Uint8Array): void {\n\t\t// Prevent cloning by directly referencing underlying private properties\n\t\taddBlobToSummary(\n\t\t\t{\n\t\t\t\tsummary: {\n\t\t\t\t\ttype: SummaryType.Tree,\n\t\t\t\t\ttree: this.summaryTree,\n\t\t\t\t},\n\t\t\t\tstats: this.summaryStats,\n\t\t\t},\n\t\t\tkey,\n\t\t\tcontent,\n\t\t);\n\t}\n\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\tthis.summaryStats.handleNodeCount++;\n\t}\n\n\tpublic addWithStats(key: string, summarizeResult: ISummarizeResult): void {\n\t\tthis.summaryTree[key] = summarizeResult.summary;\n\t\tthis.summaryStats = mergeStats(this.summaryStats, summarizeResult.stats);\n\t}\n\n\tpublic addAttachment(id: string) {\n\t\tthis.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };\n\t}\n\n\tpublic getSummaryTree(): ISummaryTreeWithStats {\n\t\treturn { summary: this.summary, stats: this.stats };\n\t}\n}\n\n/**\n * Converts snapshot ITree to ISummaryTree format and tracks stats.\n * @param snapshot - snapshot in ITree format\n * @param fullTree - true to never use handles, even if id is specified\n * @alpha\n */\nexport function convertToSummaryTreeWithStats(\n\tsnapshot: ITree,\n\tfullTree: boolean = false,\n): ISummaryTreeWithStats {\n\tconst builder = new SummaryTreeBuilder();\n\tfor (const entry of snapshot.entries) {\n\t\tswitch (entry.type) {\n\t\t\tcase TreeEntry.Blob: {\n\t\t\t\tconst blob = entry.value;\n\t\t\t\tconst content =\n\t\t\t\t\tblob.encoding === \"base64\"\n\t\t\t\t\t\t? IsoBuffer.from(blob.contents, \"base64\")\n\t\t\t\t\t\t: blob.contents;\n\t\t\t\tbuilder.addBlob(entry.path, content);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase TreeEntry.Tree: {\n\t\t\t\tconst subtree = convertToSummaryTree(entry.value, fullTree);\n\t\t\t\tbuilder.addWithStats(entry.path, subtree);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase TreeEntry.Attachment: {\n\t\t\t\tconst id = entry.value.id;\n\t\t\t\tbuilder.addAttachment(id);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"Unexpected TreeEntry type\");\n\t\t}\n\t}\n\n\tconst summaryTree = builder.getSummaryTree();\n\tsummaryTree.summary.unreferenced = snapshot.unreferenced;\n\treturn summaryTree;\n}\n\n/**\n * Converts snapshot ITree to ISummaryTree format and tracks stats.\n * @param snapshot - snapshot in ITree format\n * @param fullTree - true to never use handles, even if id is specified\n * @internal\n */\nexport function convertToSummaryTree(snapshot: ITree, fullTree: boolean = false): ISummarizeResult {\n\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\tif (snapshot.id && !fullTree) {\n\t\tconst stats = mergeStats();\n\t\tstats.handleNodeCount++;\n\t\treturn {\n\t\t\tsummary: {\n\t\t\t\thandle: snapshot.id,\n\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\ttype: SummaryType.Handle,\n\t\t\t},\n\t\t\tstats,\n\t\t};\n\t} else {\n\t\treturn convertToSummaryTreeWithStats(snapshot, fullTree);\n\t}\n}\n\n/**\n * Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was\n * was taken by serialize api in detached container.\n * @param snapshot - snapshot in ISnapshotTree format\n * @internal\n */\nexport function convertSnapshotTreeToSummaryTree(\n\tsnapshot: ISnapshotTreeWithBlobContents,\n): ISummaryTreeWithStats {\n\tconst builder = new SummaryTreeBuilder();\n\tfor (const [path, id] of Object.entries(snapshot.blobs)) {\n\t\tlet decoded: string | undefined;\n\t\tif (snapshot.blobsContents !== undefined) {\n\t\t\tconst content: ArrayBufferLike = snapshot.blobsContents[id];\n\t\t\tif (content !== undefined) {\n\t\t\t\tdecoded = bufferToString(content, \"utf-8\");\n\t\t\t}\n\t\t\t// 0.44 back-compat We still put contents in same blob for back-compat so need to add blob\n\t\t\t// only for blobPath -> blobId mapping and not for blobId -> blob value contents.\n\t\t} else if (snapshot.blobs[id] !== undefined) {\n\t\t\tdecoded = fromBase64ToUtf8(snapshot.blobs[id]);\n\t\t}\n\t\tif (decoded !== undefined) {\n\t\t\tbuilder.addBlob(path, decoded);\n\t\t}\n\t}\n\n\tfor (const [key, tree] of Object.entries(snapshot.trees)) {\n\t\tconst subtree = convertSnapshotTreeToSummaryTree(tree);\n\t\tbuilder.addWithStats(key, subtree);\n\t}\n\n\tconst summaryTree = builder.getSummaryTree();\n\tsummaryTree.summary.unreferenced = snapshot.unreferenced;\n\treturn summaryTree;\n}\n\n/**\n * Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.\n * @param summaryTree - summary tree in ISummaryTree format\n * @internal\n */\nexport function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree {\n\tconst entries: ITreeEntry[] = [];\n\tfor (const [key, value] of Object.entries(summaryTree.tree)) {\n\t\tswitch (value.type) {\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tlet parsedContent: string;\n\t\t\t\tlet encoding: \"utf-8\" | \"base64\" = \"utf-8\";\n\t\t\t\tif (typeof value.content === \"string\") {\n\t\t\t\t\tparsedContent = value.content;\n\t\t\t\t} else {\n\t\t\t\t\tparsedContent = Uint8ArrayToString(value.content, \"base64\");\n\t\t\t\t\tencoding = \"base64\";\n\t\t\t\t}\n\t\t\t\tentries.push(new BlobTreeEntry(key, parsedContent, encoding));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tentries.push(new TreeTreeEntry(key, convertSummaryTreeToITree(value)));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tentries.push(new AttachmentTreeEntry(key, value.id));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"Should not have Handle type in summary tree\");\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(value, \"Unexpected summary tree type\");\n\t\t}\n\t}\n\treturn {\n\t\tentries,\n\t\tunreferenced: summaryTree.unreferenced,\n\t};\n}\n\n/**\n * @internal\n */\nexport class TelemetryContext implements ITelemetryContext {\n\tprivate readonly telemetry = new Map<string, TelemetryEventPropertyType>();\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}\n\t */\n\tset(prefix: string, property: string, value: TelemetryEventPropertyType): void {\n\t\tthis.telemetry.set(`${prefix}${property}`, value);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}\n\t */\n\tsetMultiple(\n\t\tprefix: string,\n\t\tproperty: string,\n\t\tvalues: Record<string, TelemetryEventPropertyType>,\n\t): void {\n\t\t// Set the values individually so that they are logged as a flat list along with other properties.\n\t\tfor (const key of Object.keys(values)) {\n\t\t\tthis.set(prefix, `${property}_${key}`, values[key]);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}\n\t */\n\tget(prefix: string, property: string): TelemetryEventPropertyType {\n\t\treturn this.telemetry.get(`${prefix}${property}`);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}\n\t */\n\tserialize(): string {\n\t\tconst jsonObject = {};\n\t\tthis.telemetry.forEach((value, key) => {\n\t\t\tjsonObject[key] = value;\n\t\t});\n\t\treturn JSON.stringify(jsonObject);\n\t}\n}\n\n/**\n * Trims the leading slashes from the given string.\n * @param str - A string that may contain leading slashes.\n * @returns A new string without leading slashes.\n */\nfunction trimLeadingSlashes(str: string) {\n\treturn str.replace(/^\\/+/g, \"\");\n}\n\n/**\n * Trims the trailing slashes from the given string.\n * @param str - A string that may contain trailing slashes.\n * @returns A new string without trailing slashes.\n */\nfunction trimTrailingSlashes(str: string) {\n\treturn str.replace(/\\/+$/g, \"\");\n}\n\n/**\n * Helper class to build the garbage collection data of a node by combining the data from multiple nodes.\n * @internal\n */\nexport class GCDataBuilder implements IGarbageCollectionData {\n\tprivate readonly gcNodesSet: { [id: string]: Set<string> } = {};\n\tpublic get gcNodes(): { [id: string]: string[] } {\n\t\tconst gcNodes = {};\n\t\tfor (const [nodeId, outboundRoutes] of Object.entries(this.gcNodesSet)) {\n\t\t\tgcNodes[nodeId] = [...outboundRoutes];\n\t\t}\n\t\treturn gcNodes;\n\t}\n\n\tpublic addNode(id: string, outboundRoutes: string[]) {\n\t\tthis.gcNodesSet[id] = new Set(outboundRoutes);\n\t}\n\n\t/**\n\t * Adds the given GC nodes. It does the following:\n\t * - Normalizes the ids of the given nodes.\n\t * - Prefixes the given `prefixId` to the given nodes' ids.\n\t * - Adds the outbound routes of the nodes against the normalized and prefixed id.\n\t */\n\tpublic prefixAndAddNodes(prefixId: string, gcNodes: { [id: string]: string[] }) {\n\t\tfor (const [id, outboundRoutes] of Object.entries(gcNodes)) {\n\t\t\t// Remove any leading slashes from the id.\n\t\t\tlet normalizedId = trimLeadingSlashes(id);\n\t\t\t// Prefix the given id to the normalized id.\n\t\t\tnormalizedId = `/${prefixId}/${normalizedId}`;\n\t\t\t// Remove any trailing slashes from the normalized id. Note that the trailing slashes are removed after\n\t\t\t// adding the prefix for handling the special case where id is \"/\".\n\t\t\tnormalizedId = trimTrailingSlashes(normalizedId);\n\n\t\t\t// Add the outbound routes against the normalized and prefixed id without duplicates.\n\t\t\tthis.gcNodesSet[normalizedId] = new Set(outboundRoutes);\n\t\t}\n\t}\n\n\tpublic addNodes(gcNodes: { [id: string]: string[] }) {\n\t\tfor (const [id, outboundRoutes] of Object.entries(gcNodes)) {\n\t\t\tthis.gcNodesSet[id] = new Set(outboundRoutes);\n\t\t}\n\t}\n\n\t/**\n\t * Adds the given outbound route to the outbound routes of all GC nodes.\n\t */\n\tpublic addRouteToAllNodes(outboundRoute: string) {\n\t\tfor (const outboundRoutes of Object.values(this.gcNodesSet)) {\n\t\t\toutboundRoutes.add(outboundRoute);\n\t\t}\n\t}\n\n\tpublic getGCData(): IGarbageCollectionData {\n\t\treturn {\n\t\t\tgcNodes: this.gcNodes,\n\t\t};\n\t}\n}\n"]}
|
package/dist/summaryUtils.d.ts
CHANGED
|
@@ -2,21 +2,44 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { TelemetryEventPropertyType } from "@fluidframework/
|
|
6
|
-
import { ITree, SummaryType, ISummaryTree, SummaryObject, ISummaryBlob
|
|
7
|
-
import { ISummaryStats, ISummarizeResult, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
5
|
+
import { TelemetryEventPropertyType } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { ITree, SummaryType, ISummaryTree, SummaryObject, ISummaryBlob } from "@fluidframework/protocol-definitions";
|
|
7
|
+
import { ISummaryStats, ISummarizeResult, ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData } from "@fluidframework/runtime-definitions";
|
|
8
|
+
import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
|
|
8
9
|
/**
|
|
9
10
|
* Combines summary stats by adding their totals together.
|
|
10
11
|
* Returns empty stats if called without args.
|
|
11
12
|
* @param stats - stats to merge
|
|
13
|
+
* @internal
|
|
12
14
|
*/
|
|
13
15
|
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
14
19
|
export declare function utf8ByteLength(str: string): number;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
15
23
|
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
16
27
|
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
17
31
|
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
18
35
|
export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
19
39
|
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
40
|
+
/**
|
|
41
|
+
* @alpha
|
|
42
|
+
*/
|
|
20
43
|
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
21
44
|
private attachmentCounter;
|
|
22
45
|
get summary(): ISummaryTree;
|
|
@@ -34,31 +57,42 @@ export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
|
34
57
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
35
58
|
* @param snapshot - snapshot in ITree format
|
|
36
59
|
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
+
* @alpha
|
|
37
61
|
*/
|
|
38
62
|
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
39
63
|
/**
|
|
40
64
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
41
65
|
* @param snapshot - snapshot in ITree format
|
|
42
66
|
* @param fullTree - true to never use handles, even if id is specified
|
|
67
|
+
* @internal
|
|
43
68
|
*/
|
|
44
69
|
export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
45
70
|
/**
|
|
46
71
|
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
47
72
|
* was taken by serialize api in detached container.
|
|
48
73
|
* @param snapshot - snapshot in ISnapshotTree format
|
|
74
|
+
* @internal
|
|
49
75
|
*/
|
|
50
|
-
export declare function convertSnapshotTreeToSummaryTree(snapshot:
|
|
76
|
+
export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTreeWithBlobContents): ISummaryTreeWithStats;
|
|
51
77
|
/**
|
|
52
78
|
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
53
79
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
80
|
+
* @internal
|
|
54
81
|
*/
|
|
55
82
|
export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
56
86
|
export declare class TelemetryContext implements ITelemetryContext {
|
|
57
87
|
private readonly telemetry;
|
|
58
88
|
/**
|
|
59
89
|
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
60
90
|
*/
|
|
61
91
|
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
94
|
+
*/
|
|
95
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
62
96
|
/**
|
|
63
97
|
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
64
98
|
*/
|
|
@@ -68,4 +102,32 @@ export declare class TelemetryContext implements ITelemetryContext {
|
|
|
68
102
|
*/
|
|
69
103
|
serialize(): string;
|
|
70
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Helper class to build the garbage collection data of a node by combining the data from multiple nodes.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
export declare class GCDataBuilder implements IGarbageCollectionData {
|
|
110
|
+
private readonly gcNodesSet;
|
|
111
|
+
get gcNodes(): {
|
|
112
|
+
[id: string]: string[];
|
|
113
|
+
};
|
|
114
|
+
addNode(id: string, outboundRoutes: string[]): void;
|
|
115
|
+
/**
|
|
116
|
+
* Adds the given GC nodes. It does the following:
|
|
117
|
+
* - Normalizes the ids of the given nodes.
|
|
118
|
+
* - Prefixes the given `prefixId` to the given nodes' ids.
|
|
119
|
+
* - Adds the outbound routes of the nodes against the normalized and prefixed id.
|
|
120
|
+
*/
|
|
121
|
+
prefixAndAddNodes(prefixId: string, gcNodes: {
|
|
122
|
+
[id: string]: string[];
|
|
123
|
+
}): void;
|
|
124
|
+
addNodes(gcNodes: {
|
|
125
|
+
[id: string]: string[];
|
|
126
|
+
}): void;
|
|
127
|
+
/**
|
|
128
|
+
* Adds the given outbound route to the outbound routes of all GC nodes.
|
|
129
|
+
*/
|
|
130
|
+
addRouteToAllNodes(outboundRoute: string): void;
|
|
131
|
+
getGCData(): IGarbageCollectionData;
|
|
132
|
+
}
|
|
71
133
|
//# sourceMappingURL=summaryUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryUtils.d.ts","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"summaryUtils.d.ts","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAS7E,OAAO,EACN,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EAGZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,CAgBnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAelD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAEpE;AAyBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAIpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,qBAAqB,EAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GAAG,UAAU,GAC1B,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAA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AuC1E;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiD;IAE3E;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B,GAAG,IAAI;IAI9E;;OAEG;IACH,WAAW,CACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAChD,IAAI;IAOP;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,0BAA0B;IAIjE;;OAEG;IACH,SAAS,IAAI,MAAM;CAOnB;AAoBD;;;GAGG;AACH,qBAAa,aAAc,YAAW,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqC;IAChE,IAAW,OAAO,IAAI;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAM/C;IAEM,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE;IAInD;;;;;OAKG;IACI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE;IAevE,QAAQ,CAAC,OAAO,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE;IAMnD;;OAEG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM;IAMxC,SAAS,IAAI,sBAAsB;CAK1C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.38.3"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.unpackChildNodesUsedRoutes = void 0;
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
+
/**
|
|
10
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
11
|
+
* @param usedRoutes - The used routes of a node.
|
|
12
|
+
* @returns A map of used routes of each children of the the given node.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function unpackChildNodesUsedRoutes(usedRoutes) {
|
|
16
|
+
// Remove the node's self used route, if any, and generate the children used routes.
|
|
17
|
+
const filteredUsedRoutes = usedRoutes.filter((route) => route !== "" && route !== "/");
|
|
18
|
+
const childUsedRoutesMap = new Map();
|
|
19
|
+
for (const route of filteredUsedRoutes) {
|
|
20
|
+
(0, core_utils_1.assert)(route.startsWith("/"), 0x5e0 /* Used route should always be an absolute route */);
|
|
21
|
+
const childId = route.split("/")[1];
|
|
22
|
+
const childUsedRoute = route.slice(childId.length + 1);
|
|
23
|
+
const childUsedRoutes = childUsedRoutesMap.get(childId);
|
|
24
|
+
if (childUsedRoutes !== undefined) {
|
|
25
|
+
childUsedRoutes.push(childUsedRoute);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
childUsedRoutesMap.set(childId, [childUsedRoute]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return childUsedRoutesMap;
|
|
32
|
+
}
|
|
33
|
+
exports.unpackChildNodesUsedRoutes = unpackChildNodesUsedRoutes;
|
|
34
|
+
//# sourceMappingURL=unpackUsedRoutes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpackUsedRoutes.cjs","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,UAA6B;IACvE,oFAAoF;IACpF,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC;IACvF,MAAM,kBAAkB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,kBAAkB,EAAE;QACvC,IAAA,mBAAM,EAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,eAAe,KAAK,SAAS,EAAE;YAClC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;aAAM;YACN,kBAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;SAClD;KACD;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAjBD,gEAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * Helper function that unpacks the used routes of children from a given node's used routes.\n * @param usedRoutes - The used routes of a node.\n * @returns A map of used routes of each children of the the given node.\n * @internal\n */\nexport function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]) {\n\t// Remove the node's self used route, if any, and generate the children used routes.\n\tconst filteredUsedRoutes = usedRoutes.filter((route) => route !== \"\" && route !== \"/\");\n\tconst childUsedRoutesMap: Map<string, string[]> = new Map();\n\tfor (const route of filteredUsedRoutes) {\n\t\tassert(route.startsWith(\"/\"), 0x5e0 /* Used route should always be an absolute route */);\n\t\tconst childId = route.split(\"/\")[1];\n\t\tconst childUsedRoute = route.slice(childId.length + 1);\n\n\t\tconst childUsedRoutes = childUsedRoutesMap.get(childId);\n\t\tif (childUsedRoutes !== undefined) {\n\t\t\tchildUsedRoutes.push(childUsedRoute);\n\t\t} else {\n\t\t\tchildUsedRoutesMap.set(childId, [childUsedRoute]);\n\t\t}\n\t}\n\treturn childUsedRoutesMap;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
7
|
+
* @param usedRoutes - The used routes of a node.
|
|
8
|
+
* @returns A map of used routes of each children of the the given node.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]): Map<string, string[]>;
|
|
12
|
+
//# sourceMappingURL=unpackUsedRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpackUsedRoutes.d.ts","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,yBAiBvE"}
|
|
@@ -10,6 +10,7 @@ exports.seqFromTree = void 0;
|
|
|
10
10
|
* @param tree - snapshot tree to examine
|
|
11
11
|
* @param readAndParseBlob - function to read blob contents from storage
|
|
12
12
|
* and parse the result from JSON.
|
|
13
|
+
* @internal
|
|
13
14
|
*/
|
|
14
15
|
async function seqFromTree(tree, readAndParseBlob) {
|
|
15
16
|
const attributesHash = tree.trees[".protocol"].blobs.attributes;
|
|
@@ -17,4 +18,4 @@ async function seqFromTree(tree, readAndParseBlob) {
|
|
|
17
18
|
return attrib.sequenceNumber;
|
|
18
19
|
}
|
|
19
20
|
exports.seqFromTree = seqFromTree;
|
|
20
|
-
//# sourceMappingURL=utils.
|
|
21
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAChC,IAAmB,EACnB,gBAAkC;IAElC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAsB,cAAc,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,cAAc,CAAC;AAC9B,CAAC;AAPD,kCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentAttributes, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Reads a blob from storage and parses it from JSON.\n *\n * @internal\n */\nexport type ReadAndParseBlob = <T>(id: string) => Promise<T>;\n\n/**\n * Fetches the sequence number of the snapshot tree by examining the protocol.\n * @param tree - snapshot tree to examine\n * @param readAndParseBlob - function to read blob contents from storage\n * and parse the result from JSON.\n * @internal\n */\nexport async function seqFromTree(\n\ttree: ISnapshotTree,\n\treadAndParseBlob: ReadAndParseBlob,\n): Promise<number> {\n\tconst attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n\tconst attrib = await readAndParseBlob<IDocumentAttributes>(attributesHash);\n\treturn attrib.sequenceNumber;\n}\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Reads a blob from storage and parses it from JSON.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
8
12
|
/**
|
|
9
13
|
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
10
14
|
* @param tree - snapshot tree to examine
|
|
11
15
|
* @param readAndParseBlob - function to read blob contents from storage
|
|
12
16
|
* and parse the result from JSON.
|
|
17
|
+
* @internal
|
|
13
18
|
*/
|
|
14
19
|
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
15
20
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1F
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,IAAI,EAAE,aAAa,EACnB,gBAAgB,EAAE,gBAAgB,GAChC,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -8,6 +8,7 @@ import { IFluidHandleContext } from "@fluidframework/core-interfaces";
|
|
|
8
8
|
* @param path - The path to the Fluid object relative to the route context.
|
|
9
9
|
* @param routeContext - The route context that contains the Fluid object.
|
|
10
10
|
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
13
14
|
//# sourceMappingURL=dataStoreHandleContextUtils.d.ts.map
|