@fluidframework/runtime-utils 2.0.0-internal.8.0.0 → 2.0.0-rc.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +1 -7
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/runtime-utils.api.md +13 -2
- package/dist/handles.d.ts +18 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/handles.js +14 -0
- package/dist/handles.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-utils-alpha.d.ts +27 -2
- package/dist/runtime-utils-beta.d.ts +4 -18
- package/dist/runtime-utils-public.d.ts +4 -18
- package/dist/runtime-utils-untrimmed.d.ts +17 -2
- package/dist/summaryUtils.d.ts +2 -2
- package/dist/summaryUtils.js +2 -2
- package/dist/summaryUtils.js.map +1 -1
- package/lib/{dataStoreHandleContextUtils.d.ts → dataStoreHandleContextUtils.d.mts} +1 -1
- package/lib/dataStoreHandleContextUtils.d.mts.map +1 -0
- package/lib/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.mjs} +1 -1
- package/lib/dataStoreHandleContextUtils.mjs.map +1 -0
- package/lib/{dataStoreHelpers.d.ts → dataStoreHelpers.d.mts} +1 -1
- package/lib/dataStoreHelpers.d.mts.map +1 -0
- package/lib/{dataStoreHelpers.js → dataStoreHelpers.mjs} +1 -1
- package/lib/dataStoreHelpers.mjs.map +1 -0
- package/lib/handles.d.mts +18 -0
- package/lib/handles.d.mts.map +1 -0
- package/lib/handles.mjs +10 -0
- package/lib/handles.mjs.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +11 -10
- package/lib/index.d.mts.map +1 -0
- package/lib/{index.js → index.mjs} +11 -10
- package/lib/index.mjs.map +1 -0
- package/lib/{objectstoragepartition.d.ts → objectstoragepartition.d.mts} +1 -1
- package/lib/objectstoragepartition.d.mts.map +1 -0
- package/lib/{objectstoragepartition.js → objectstoragepartition.mjs} +1 -1
- package/lib/objectstoragepartition.mjs.map +1 -0
- package/lib/{objectstorageutils.d.ts → objectstorageutils.d.mts} +1 -1
- package/lib/objectstorageutils.d.mts.map +1 -0
- package/lib/{objectstorageutils.js → objectstorageutils.mjs} +1 -1
- package/lib/objectstorageutils.mjs.map +1 -0
- package/lib/{requestParser.d.ts → requestParser.d.mts} +1 -5
- package/lib/requestParser.d.mts.map +1 -0
- package/lib/{requestParser.js → requestParser.mjs} +1 -1
- package/lib/requestParser.mjs.map +1 -0
- package/lib/{runtime-utils-alpha.d.ts → runtime-utils-alpha.d.mts} +27 -2
- package/lib/{runtime-utils-beta.d.ts → runtime-utils-beta.d.mts} +4 -18
- package/lib/{runtime-utils-public.d.ts → runtime-utils-public.d.mts} +4 -18
- package/lib/{runtime-utils-untrimmed.d.ts → runtime-utils-untrimmed.d.mts} +17 -2
- package/lib/{runtimeFactoryHelper.d.ts → runtimeFactoryHelper.d.mts} +1 -1
- package/lib/runtimeFactoryHelper.d.mts.map +1 -0
- package/lib/{runtimeFactoryHelper.js → runtimeFactoryHelper.mjs} +1 -1
- package/lib/runtimeFactoryHelper.mjs.map +1 -0
- package/lib/{summaryUtils.d.ts → summaryUtils.d.mts} +3 -3
- package/lib/summaryUtils.d.mts.map +1 -0
- package/lib/{summaryUtils.js → summaryUtils.mjs} +3 -3
- package/lib/summaryUtils.mjs.map +1 -0
- package/lib/{unpackUsedRoutes.d.ts → unpackUsedRoutes.d.mts} +1 -1
- package/lib/unpackUsedRoutes.d.mts.map +1 -0
- package/lib/{unpackUsedRoutes.js → unpackUsedRoutes.mjs} +1 -1
- package/lib/unpackUsedRoutes.mjs.map +1 -0
- package/lib/{utils.d.ts → utils.d.mts} +1 -1
- package/lib/utils.d.mts.map +1 -0
- package/lib/{utils.js → utils.mjs} +1 -1
- package/lib/utils.mjs.map +1 -0
- package/package.json +79 -31
- package/src/handles.ts +23 -0
- package/src/index.ts +1 -0
- package/src/summaryUtils.ts +2 -2
- package/tsconfig.json +5 -3
- 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.map +0 -1
- 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/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.map +0 -1
- package/lib/summaryUtils.d.ts.map +0 -1
- package/lib/summaryUtils.js.map +0 -1
- package/lib/unpackUsedRoutes.d.ts.map +0 -1
- package/lib/unpackUsedRoutes.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @fluidframework/runtime-utils
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
8
|
+
|
|
9
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
10
|
+
|
|
11
|
+
- @fluidframework/gitresources
|
|
12
|
+
- @fluidframework/server-kafka-orderer
|
|
13
|
+
- @fluidframework/server-lambdas
|
|
14
|
+
- @fluidframework/server-lambdas-driver
|
|
15
|
+
- @fluidframework/server-local-server
|
|
16
|
+
- @fluidframework/server-memory-orderer
|
|
17
|
+
- @fluidframework/protocol-base
|
|
18
|
+
- @fluidframework/server-routerlicious
|
|
19
|
+
- @fluidframework/server-routerlicious-base
|
|
20
|
+
- @fluidframework/server-services
|
|
21
|
+
- @fluidframework/server-services-client
|
|
22
|
+
- @fluidframework/server-services-core
|
|
23
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
24
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
25
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
26
|
+
- @fluidframework/server-services-shared
|
|
27
|
+
- @fluidframework/server-services-telemetry
|
|
28
|
+
- @fluidframework/server-services-utils
|
|
29
|
+
- @fluidframework/server-test-utils
|
|
30
|
+
- tinylicious
|
|
31
|
+
|
|
32
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
33
|
+
|
|
34
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
35
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
36
|
+
|
|
3
37
|
## 2.0.0-internal.8.0.0
|
|
4
38
|
|
|
5
39
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -13,12 +13,6 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
13
13
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
14
|
library consumers should always prefer `^`.
|
|
15
15
|
|
|
16
|
-
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
-
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
-
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
-
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
20
|
-
package for more information including tools to convert between version schemes.
|
|
21
|
-
|
|
22
16
|
## Installation
|
|
23
17
|
|
|
24
18
|
To get started, install the package by running the following command:
|
|
@@ -29,7 +23,7 @@ npm i @fluidframework/runtime-utils
|
|
|
29
23
|
|
|
30
24
|
## API Documentation
|
|
31
25
|
|
|
32
|
-
API documentation for **@fluidframework/runtime-utils** is available at <https://fluidframework.com/docs/
|
|
26
|
+
API documentation for **@fluidframework/runtime-utils** is available at <https://fluidframework.com/docs/api/v1/runtime-utils>.
|
|
33
27
|
|
|
34
28
|
## Contribution Guidelines
|
|
35
29
|
|
package/api-extractor-lint.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: remove once base config has this enabled as an error
|
|
7
|
-
"ae-incompatible-release-tags": {
|
|
8
|
-
"logLevel": "error",
|
|
9
|
-
"addToApiReportFile": false
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
13
4
|
}
|
package/api-extractor.json
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: Add missing documentation and remove this rule override
|
|
7
|
-
"ae-undocumented": {
|
|
8
|
-
"logLevel": "none"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
12
4
|
}
|
|
@@ -51,7 +51,7 @@ export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
|
51
51
|
// @internal
|
|
52
52
|
export function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
53
53
|
|
|
54
|
-
// @
|
|
54
|
+
// @alpha
|
|
55
55
|
export function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
56
56
|
|
|
57
57
|
// @internal (undocumented)
|
|
@@ -100,6 +100,17 @@ export function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
|
100
100
|
// @internal (undocumented)
|
|
101
101
|
export function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
102
102
|
|
|
103
|
+
// @internal
|
|
104
|
+
export interface ISerializedHandle {
|
|
105
|
+
// (undocumented)
|
|
106
|
+
type: "__fluid_handle__";
|
|
107
|
+
// (undocumented)
|
|
108
|
+
url: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// @internal
|
|
112
|
+
export const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
113
|
+
|
|
103
114
|
// @internal (undocumented)
|
|
104
115
|
export function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
105
116
|
|
|
@@ -159,7 +170,7 @@ export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRu
|
|
|
159
170
|
// @internal
|
|
160
171
|
export function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
161
172
|
|
|
162
|
-
// @
|
|
173
|
+
// @alpha (undocumented)
|
|
163
174
|
export class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
164
175
|
constructor();
|
|
165
176
|
// (undocumented)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* JSON serialized form of an IFluidHandle
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface ISerializedHandle {
|
|
10
|
+
type: "__fluid_handle__";
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Is the input object a @see ISerializedHandle?
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
18
|
+
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,kBAAkB,CAAC;IAGzB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,GAAG,+BACV,CAAC"}
|
package/dist/handles.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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.isSerializedHandle = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Is the input object a @see ISerializedHandle?
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
|
|
13
|
+
exports.isSerializedHandle = isSerializedHandle;
|
|
14
|
+
//# sourceMappingURL=handles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA8B,EAAE,CAC5E,KAAK,EAAE,IAAI,KAAK,kBAAkB,CAAC;AADvB,QAAA,kBAAkB,sBACK","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n}\n\n/**\n * Is the input object a @see ISerializedHandle?\n * @internal\n */\nexport const isSerializedHandle = (value: any): value is ISerializedHandle =>\n\tvalue?.type === \"__fluid_handle__\";\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { generateHandleContextPath } from "./dataStoreHandleContextUtils";
|
|
6
6
|
export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, Factory, responseToException, } from "./dataStoreHelpers";
|
|
7
|
+
export { ISerializedHandle, isSerializedHandle } from "./handles";
|
|
7
8
|
export { ObjectStoragePartition } from "./objectstoragepartition";
|
|
8
9
|
export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils";
|
|
9
10
|
export { RequestParser } from "./requestParser";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MA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EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.seqFromTree = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addTreeToSummary = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.createDataStoreFactory = exports.create404Response = exports.generateHandleContextPath = void 0;
|
|
7
|
+
exports.seqFromTree = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addTreeToSummary = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.isSerializedHandle = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.createDataStoreFactory = exports.create404Response = exports.generateHandleContextPath = void 0;
|
|
8
8
|
var dataStoreHandleContextUtils_1 = require("./dataStoreHandleContextUtils");
|
|
9
9
|
Object.defineProperty(exports, "generateHandleContextPath", { enumerable: true, get: function () { return dataStoreHandleContextUtils_1.generateHandleContextPath; } });
|
|
10
10
|
var dataStoreHelpers_1 = require("./dataStoreHelpers");
|
|
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "createDataStoreFactory", { enumerable: true, get
|
|
|
13
13
|
Object.defineProperty(exports, "createResponseError", { enumerable: true, get: function () { return dataStoreHelpers_1.createResponseError; } });
|
|
14
14
|
Object.defineProperty(exports, "exceptionToResponse", { enumerable: true, get: function () { return dataStoreHelpers_1.exceptionToResponse; } });
|
|
15
15
|
Object.defineProperty(exports, "responseToException", { enumerable: true, get: function () { return dataStoreHelpers_1.responseToException; } });
|
|
16
|
+
var handles_1 = require("./handles");
|
|
17
|
+
Object.defineProperty(exports, "isSerializedHandle", { enumerable: true, get: function () { return handles_1.isSerializedHandle; } });
|
|
16
18
|
var objectstoragepartition_1 = require("./objectstoragepartition");
|
|
17
19
|
Object.defineProperty(exports, "ObjectStoragePartition", { enumerable: true, get: function () { return objectstoragepartition_1.ObjectStoragePartition; } });
|
|
18
20
|
var objectstorageutils_1 = require("./objectstorageutils");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAO4B;AAN3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEnB,uHAAA,mBAAmB,OAAA;AAEpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,+CAewB;AAdvB,gHAAA,gBAAgB,OAAA;AAChB,2HAAA,2BAA2B,OAAA;AAC3B,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,gIAAA,gCAAgC,OAAA;AAChC,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,6HAAA,6BAA6B,OAAA;AAC7B,6GAAA,aAAa,OAAA;AACb,2GAAA,WAAW,OAAA;AACX,0GAAA,UAAU,OAAA;AACV,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AAEf,uDAAgE;AAAvD,8HAAA,0BAA0B,OAAA;AACnC,iCAAwD;AAA7B,oGAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils\";\nexport {\n\tcreate404Response,\n\tcreateDataStoreFactory,\n\tcreateResponseError,\n\texceptionToResponse,\n\tFactory,\n\tresponseToException,\n} from \"./dataStoreHelpers\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition\";\nexport { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from \"./objectstorageutils\";\nexport { RequestParser } from \"./requestParser\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\taddTreeToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes\";\nexport { ReadAndParseBlob, seqFromTree } from \"./utils\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAO4B;AAN3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEnB,uHAAA,mBAAmB,OAAA;AAEpB,qCAAkE;AAAtC,6GAAA,kBAAkB,OAAA;AAC9C,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,+CAewB;AAdvB,gHAAA,gBAAgB,OAAA;AAChB,2HAAA,2BAA2B,OAAA;AAC3B,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,gIAAA,gCAAgC,OAAA;AAChC,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,6HAAA,6BAA6B,OAAA;AAC7B,6GAAA,aAAa,OAAA;AACb,2GAAA,WAAW,OAAA;AACX,0GAAA,UAAU,OAAA;AACV,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AAEf,uDAAgE;AAAvD,8HAAA,0BAA0B,OAAA;AACnC,iCAAwD;AAA7B,oGAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils\";\nexport {\n\tcreate404Response,\n\tcreateDataStoreFactory,\n\tcreateResponseError,\n\texceptionToResponse,\n\tFactory,\n\tresponseToException,\n} from \"./dataStoreHelpers\";\nexport { ISerializedHandle, isSerializedHandle } from \"./handles\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition\";\nexport { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from \"./objectstorageutils\";\nexport { RequestParser } from \"./requestParser\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\taddTreeToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes\";\nexport { ReadAndParseBlob, seqFromTree } from \"./utils\";\n"]}
|
|
@@ -38,7 +38,13 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
38
38
|
|
|
39
39
|
/* Excluded from this release type: convertToSummaryTree */
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
43
|
+
* @param snapshot - snapshot in ITree format
|
|
44
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
45
|
+
* @alpha
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
42
48
|
|
|
43
49
|
/* Excluded from this release type: create404Response */
|
|
44
50
|
|
|
@@ -58,6 +64,10 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
58
64
|
|
|
59
65
|
/* Excluded from this release type: getNormalizedObjectStoragePathParts */
|
|
60
66
|
|
|
67
|
+
/* Excluded from this release type: ISerializedHandle */
|
|
68
|
+
|
|
69
|
+
/* Excluded from this release type: isSerializedHandle */
|
|
70
|
+
|
|
61
71
|
/* Excluded from this release type: listBlobsAtTreePath */
|
|
62
72
|
|
|
63
73
|
/* Excluded from this release type: mergeStats */
|
|
@@ -123,7 +133,22 @@ export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implem
|
|
|
123
133
|
|
|
124
134
|
/* Excluded from this release type: seqFromTree */
|
|
125
135
|
|
|
126
|
-
|
|
136
|
+
/**
|
|
137
|
+
* @alpha
|
|
138
|
+
*/
|
|
139
|
+
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
140
|
+
private attachmentCounter;
|
|
141
|
+
get summary(): ISummaryTree;
|
|
142
|
+
get stats(): Readonly<ISummaryStats>;
|
|
143
|
+
constructor();
|
|
144
|
+
private readonly summaryTree;
|
|
145
|
+
private summaryStats;
|
|
146
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
147
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
148
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
149
|
+
addAttachment(id: string): void;
|
|
150
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
151
|
+
}
|
|
127
152
|
|
|
128
153
|
/* Excluded from this release type: TelemetryContext */
|
|
129
154
|
|
|
@@ -58,8 +58,6 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
58
58
|
|
|
59
59
|
/* Excluded from this release type: getNormalizedObjectStoragePathParts */
|
|
60
60
|
|
|
61
|
-
/* Excluded from this release type: IChannelStorageService */
|
|
62
|
-
|
|
63
61
|
/* Excluded from this release type: IContainerContext */
|
|
64
62
|
|
|
65
63
|
/* Excluded from this release type: IContainerRuntime */
|
|
@@ -68,29 +66,19 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
68
66
|
|
|
69
67
|
/* Excluded from this release type: IFluidDataStoreRegistry */
|
|
70
68
|
|
|
71
|
-
/* Excluded from this release type: IFluidHandleContext */
|
|
72
|
-
|
|
73
|
-
/* Excluded from this release type: IGarbageCollectionData */
|
|
74
|
-
|
|
75
69
|
/* Excluded from this release type: IProvideFluidDataStoreRegistry */
|
|
76
70
|
|
|
77
|
-
/* Excluded from this release type: IRequest */
|
|
78
|
-
|
|
79
|
-
/* Excluded from this release type: IResponse */
|
|
80
|
-
|
|
81
71
|
/* Excluded from this release type: IRuntime */
|
|
82
72
|
|
|
83
73
|
/* Excluded from this release type: IRuntimeFactory */
|
|
84
74
|
|
|
85
|
-
/* Excluded from this release type:
|
|
75
|
+
/* Excluded from this release type: ISerializedHandle */
|
|
86
76
|
|
|
87
|
-
/* Excluded from this release type:
|
|
88
|
-
|
|
89
|
-
/* Excluded from this release type: ISummaryStats */
|
|
77
|
+
/* Excluded from this release type: ISnapshotTreeWithBlobContents */
|
|
90
78
|
|
|
91
|
-
/* Excluded from this release type:
|
|
79
|
+
/* Excluded from this release type: isSerializedHandle */
|
|
92
80
|
|
|
93
|
-
/* Excluded from this release type:
|
|
81
|
+
/* Excluded from this release type: ISummarizeResult */
|
|
94
82
|
|
|
95
83
|
/* Excluded from this release type: listBlobsAtTreePath */
|
|
96
84
|
|
|
@@ -112,8 +100,6 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
112
100
|
|
|
113
101
|
/* Excluded from this release type: TelemetryContext */
|
|
114
102
|
|
|
115
|
-
/* Excluded from this release type: TelemetryEventPropertyType */
|
|
116
|
-
|
|
117
103
|
/* Excluded from this release type: unpackChildNodesUsedRoutes */
|
|
118
104
|
|
|
119
105
|
/* Excluded from this release type: utf8ByteLength */
|
|
@@ -58,8 +58,6 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
58
58
|
|
|
59
59
|
/* Excluded from this release type: getNormalizedObjectStoragePathParts */
|
|
60
60
|
|
|
61
|
-
/* Excluded from this release type: IChannelStorageService */
|
|
62
|
-
|
|
63
61
|
/* Excluded from this release type: IContainerContext */
|
|
64
62
|
|
|
65
63
|
/* Excluded from this release type: IContainerRuntime */
|
|
@@ -68,29 +66,19 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
68
66
|
|
|
69
67
|
/* Excluded from this release type: IFluidDataStoreRegistry */
|
|
70
68
|
|
|
71
|
-
/* Excluded from this release type: IFluidHandleContext */
|
|
72
|
-
|
|
73
|
-
/* Excluded from this release type: IGarbageCollectionData */
|
|
74
|
-
|
|
75
69
|
/* Excluded from this release type: IProvideFluidDataStoreRegistry */
|
|
76
70
|
|
|
77
|
-
/* Excluded from this release type: IRequest */
|
|
78
|
-
|
|
79
|
-
/* Excluded from this release type: IResponse */
|
|
80
|
-
|
|
81
71
|
/* Excluded from this release type: IRuntime */
|
|
82
72
|
|
|
83
73
|
/* Excluded from this release type: IRuntimeFactory */
|
|
84
74
|
|
|
85
|
-
/* Excluded from this release type:
|
|
75
|
+
/* Excluded from this release type: ISerializedHandle */
|
|
86
76
|
|
|
87
|
-
/* Excluded from this release type:
|
|
88
|
-
|
|
89
|
-
/* Excluded from this release type: ISummaryStats */
|
|
77
|
+
/* Excluded from this release type: ISnapshotTreeWithBlobContents */
|
|
90
78
|
|
|
91
|
-
/* Excluded from this release type:
|
|
79
|
+
/* Excluded from this release type: isSerializedHandle */
|
|
92
80
|
|
|
93
|
-
/* Excluded from this release type:
|
|
81
|
+
/* Excluded from this release type: ISummarizeResult */
|
|
94
82
|
|
|
95
83
|
/* Excluded from this release type: listBlobsAtTreePath */
|
|
96
84
|
|
|
@@ -112,8 +100,6 @@ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
|
112
100
|
|
|
113
101
|
/* Excluded from this release type: TelemetryContext */
|
|
114
102
|
|
|
115
|
-
/* Excluded from this release type: TelemetryEventPropertyType */
|
|
116
|
-
|
|
117
103
|
/* Excluded from this release type: unpackChildNodesUsedRoutes */
|
|
118
104
|
|
|
119
105
|
/* Excluded from this release type: utf8ByteLength */
|
|
@@ -71,7 +71,7 @@ export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean
|
|
|
71
71
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
72
72
|
* @param snapshot - snapshot in ITree format
|
|
73
73
|
* @param fullTree - true to never use handles, even if id is specified
|
|
74
|
-
* @
|
|
74
|
+
* @alpha
|
|
75
75
|
*/
|
|
76
76
|
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
77
77
|
|
|
@@ -150,6 +150,21 @@ export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
|
150
150
|
*/
|
|
151
151
|
export declare function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
152
152
|
|
|
153
|
+
/**
|
|
154
|
+
* JSON serialized form of an IFluidHandle
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
export declare interface ISerializedHandle {
|
|
158
|
+
type: "__fluid_handle__";
|
|
159
|
+
url: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Is the input object a @see ISerializedHandle?
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
167
|
+
|
|
153
168
|
/**
|
|
154
169
|
* @internal
|
|
155
170
|
*/
|
|
@@ -251,7 +266,7 @@ export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implem
|
|
|
251
266
|
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
252
267
|
|
|
253
268
|
/**
|
|
254
|
-
* @
|
|
269
|
+
* @alpha
|
|
255
270
|
*/
|
|
256
271
|
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
257
272
|
private attachmentCounter;
|
package/dist/summaryUtils.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: st
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
40
40
|
/**
|
|
41
|
-
* @
|
|
41
|
+
* @alpha
|
|
42
42
|
*/
|
|
43
43
|
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
44
44
|
private attachmentCounter;
|
|
@@ -57,7 +57,7 @@ export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
|
57
57
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
58
58
|
* @param snapshot - snapshot in ITree format
|
|
59
59
|
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
-
* @
|
|
60
|
+
* @alpha
|
|
61
61
|
*/
|
|
62
62
|
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
63
63
|
/**
|
package/dist/summaryUtils.js
CHANGED
|
@@ -122,7 +122,7 @@ function addSummarizeResultToSummary(summary, key, summarizeResult) {
|
|
|
122
122
|
}
|
|
123
123
|
exports.addSummarizeResultToSummary = addSummarizeResultToSummary;
|
|
124
124
|
/**
|
|
125
|
-
* @
|
|
125
|
+
* @alpha
|
|
126
126
|
*/
|
|
127
127
|
class SummaryTreeBuilder {
|
|
128
128
|
get summary() {
|
|
@@ -174,7 +174,7 @@ exports.SummaryTreeBuilder = SummaryTreeBuilder;
|
|
|
174
174
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
175
175
|
* @param snapshot - snapshot in ITree format
|
|
176
176
|
* @param fullTree - true to never use handles, even if id is specified
|
|
177
|
-
* @
|
|
177
|
+
* @alpha
|
|
178
178
|
*/
|
|
179
179
|
function convertToSummaryTreeWithStats(snapshot, fullTree = false) {
|
|
180
180
|
const builder = new SummaryTreeBuilder();
|
package/dist/summaryUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryUtils.js","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":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IAEM,QAAQ,CAAC,OAAmC;QAClD,KAAK,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3D,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;SAC9C;IACF,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,aAAqB;QAC9C,KAAK,MAAM,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 * @internal\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 * @internal\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"]}
|
|
1
|
+
{"version":3,"file":"summaryUtils.js","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,CAAC;KACvB,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACzB,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC;QAC5C,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC;QAC5C,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC;QAChD,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC;QAC5C,OAAO,CAAC,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,CAAC;KAC1D;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAhBD,gCAgBC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAW;IACzC,4CAA4C;IAC5C,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,KAAK,EAAE;YACjC,CAAC,EAAE,CAAC;SACJ;aAAM,IAAI,IAAI,GAAG,KAAK,IAAI,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AAmB,CAAC,YAAY,CAAC,CAAC;YAEjD,qFAAqF;YACrF,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;SACxD;IACF,CAAC;IAEM,QAAQ,CAAC,OAAmC;QAClD,KAAK,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3D,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;SAC9C;IACF,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,aAAqB;QAC9C,KAAK,MAAM,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"]}
|
|
@@ -11,4 +11,4 @@ import { IFluidHandleContext } from "@fluidframework/core-interfaces";
|
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
14
|
-
//# sourceMappingURL=dataStoreHandleContextUtils.d.
|
|
14
|
+
//# sourceMappingURL=dataStoreHandleContextUtils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataStoreHandleContextUtils.d.mts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;AAErE;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
|
|
@@ -29,4 +29,4 @@ export function generateHandleContextPath(path, routeContext) {
|
|
|
29
29
|
: `${routeContext.absolutePath === "/" ? "" : routeContext.absolutePath}/${normalizedPath}`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=dataStoreHandleContextUtils.
|
|
32
|
+
//# sourceMappingURL=dataStoreHandleContextUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataStoreHandleContextUtils.mjs","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE;QAChB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;KACnE;SAAM;QACN,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACtD,IAAI,cAAc,EAAE,CAAC;KACxB;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t }/${normalizedPath}`;\n\t}\n}\n"]}
|
|
@@ -30,4 +30,4 @@ export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreReg
|
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
32
|
export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
33
|
-
//# sourceMappingURL=dataStoreHelpers.d.
|
|
33
|
+
//# sourceMappingURL=dataStoreHelpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataStoreHelpers.d.mts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;OAC9D,EACN,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,MAAM,qCAAqC;AAW5C;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CA0BvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAejF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,cACJ,CAAC;AAEhD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC9B,SAAS,CAiBX;AAED;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAEvF;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GACjC,sBAAsB,GAAG,uBAAuB,CAalD"}
|