@fluidframework/runtime-utils 2.53.1 → 2.60.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/.eslintrc.cjs +1 -4
- package/CHANGELOG.md +4 -0
- package/api-report/{runtime-utils.legacy.alpha.api.md → runtime-utils.legacy.beta.api.md} +12 -12
- package/dist/compatibilityBase.d.ts +1 -3
- package/dist/compatibilityBase.d.ts.map +1 -1
- package/dist/compatibilityBase.js +3 -0
- package/dist/compatibilityBase.js.map +1 -1
- package/dist/dataStoreHandleContextUtils.d.ts +1 -1
- package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/dist/dataStoreHandleContextUtils.js.map +1 -1
- package/dist/dataStoreHelpers.d.ts +18 -6
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/dataStoreHelpers.js +39 -11
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/deltaManager.d.ts +1 -2
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +3 -2
- package/dist/deltaManager.js.map +1 -1
- package/dist/handles.d.ts +8 -12
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js +14 -12
- package/dist/handles.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/objectstoragepartition.d.ts +1 -1
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/objectstoragepartition.js.map +1 -1
- package/dist/objectstorageutils.d.ts +9 -1
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/objectstorageutils.js +15 -6
- package/dist/objectstorageutils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteFluidObjectHandle.d.ts +2 -2
- package/dist/remoteFluidObjectHandle.d.ts.map +1 -1
- package/dist/remoteFluidObjectHandle.js +1 -0
- package/dist/remoteFluidObjectHandle.js.map +1 -1
- package/dist/requestParser.d.ts +2 -3
- package/dist/requestParser.d.ts.map +1 -1
- package/dist/requestParser.js +9 -11
- package/dist/requestParser.js.map +1 -1
- package/dist/runtimeFactoryHelper.d.ts +3 -4
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/runtimeFactoryHelper.js +1 -2
- package/dist/runtimeFactoryHelper.js.map +1 -1
- package/dist/summaryUtils.d.ts +29 -20
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +49 -21
- package/dist/summaryUtils.js.map +1 -1
- package/dist/unpackUsedRoutes.d.ts.map +1 -1
- package/dist/unpackUsedRoutes.js +3 -3
- package/dist/unpackUsedRoutes.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/compatibilityBase.d.ts +1 -3
- package/lib/compatibilityBase.d.ts.map +1 -1
- package/lib/compatibilityBase.js +3 -0
- package/lib/compatibilityBase.js.map +1 -1
- package/lib/dataStoreHandleContextUtils.d.ts +1 -1
- package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/lib/dataStoreHandleContextUtils.js.map +1 -1
- package/lib/dataStoreHelpers.d.ts +18 -6
- package/lib/dataStoreHelpers.d.ts.map +1 -1
- package/lib/dataStoreHelpers.js +39 -11
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/deltaManager.d.ts +1 -2
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +3 -2
- package/lib/deltaManager.js.map +1 -1
- package/lib/handles.d.ts +8 -12
- package/lib/handles.d.ts.map +1 -1
- package/lib/handles.js +14 -12
- package/lib/handles.js.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/objectstoragepartition.d.ts +1 -1
- package/lib/objectstoragepartition.d.ts.map +1 -1
- package/lib/objectstoragepartition.js.map +1 -1
- package/lib/objectstorageutils.d.ts +9 -1
- package/lib/objectstorageutils.d.ts.map +1 -1
- package/lib/objectstorageutils.js +15 -6
- package/lib/objectstorageutils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/remoteFluidObjectHandle.d.ts +2 -2
- package/lib/remoteFluidObjectHandle.d.ts.map +1 -1
- package/lib/remoteFluidObjectHandle.js +1 -0
- package/lib/remoteFluidObjectHandle.js.map +1 -1
- package/lib/requestParser.d.ts +2 -3
- package/lib/requestParser.d.ts.map +1 -1
- package/lib/requestParser.js +9 -11
- package/lib/requestParser.js.map +1 -1
- package/lib/runtimeFactoryHelper.d.ts +3 -4
- package/lib/runtimeFactoryHelper.d.ts.map +1 -1
- package/lib/runtimeFactoryHelper.js +1 -2
- package/lib/runtimeFactoryHelper.js.map +1 -1
- package/lib/summaryUtils.d.ts +29 -20
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +51 -23
- package/lib/summaryUtils.js.map +1 -1
- package/lib/unpackUsedRoutes.d.ts.map +1 -1
- package/lib/unpackUsedRoutes.js +3 -3
- package/lib/unpackUsedRoutes.js.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +13 -13
- package/src/compatibilityBase.ts +4 -3
- package/src/dataStoreHandleContextUtils.ts +1 -1
- package/src/dataStoreHelpers.ts +49 -16
- package/src/deltaManager.ts +3 -2
- package/src/handles.ts +14 -13
- package/src/index.ts +6 -4
- package/src/objectstoragepartition.ts +2 -2
- package/src/objectstorageutils.ts +17 -8
- package/src/packageVersion.ts +1 -1
- package/src/remoteFluidObjectHandle.ts +4 -3
- package/src/requestParser.ts +15 -15
- package/src/runtimeFactoryHelper.ts +4 -5
- package/src/summaryUtils.ts +70 -43
- package/src/unpackUsedRoutes.ts +7 -5
- package/src/utils.ts +2 -2
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/runtime-utils";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.60.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.60.0\";\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
|
|
5
|
+
import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
|
|
7
7
|
import { FluidHandleBase } from "./handles.js";
|
|
8
8
|
/**
|
|
9
9
|
* This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteFluidObjectHandle.d.ts","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAY,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"remoteFluidObjectHandle.d.ts","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAIpF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,SAAQ,eAAe,CAAC,WAAW,CAAC;aAWvD,YAAY,EAAE,MAAM;aACpB,YAAY,EAAE,mBAAmB;aACjC,cAAc,EAAE,OAAO;IAZxC,SAAgB,UAAU,QAAQ;IAClC,OAAO,CAAC,OAAO,CAAmC;IAElD;;;;;OAKG;gBAEc,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,mBAAmB,EACjC,cAAc,EAAE,OAAO;IAS3B,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IAsBjC,WAAW,IAAI,IAAI;CAG1B"}
|
|
@@ -42,6 +42,7 @@ export class RemoteFluidObjectHandle extends FluidHandleBase {
|
|
|
42
42
|
};
|
|
43
43
|
this.objectP = this.routeContext.resolveHandle(request).then((response) => {
|
|
44
44
|
if (response.mimeType === "fluid/object") {
|
|
45
|
+
// Responses with mimeType == "fluid/object" are produced by Fluid, and thus they can reasonably be expected to always be a FluidObject
|
|
45
46
|
const fluidObject = response.value;
|
|
46
47
|
return fluidObject;
|
|
47
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteFluidObjectHandle.js","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAA4B;IAIxE;;;;;OAKG;IACH,YACiB,YAAoB,EACpB,YAAiC,EACjC,cAAuB;QAEvC,KAAK,EAAE,CAAC;QAJQ,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QACjC,mBAAc,GAAd,cAAc,CAAS;QAZxB,eAAU,GAAG,IAAI,CAAC;QAejC,MAAM,CACL,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAC5B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChC,6EAA6E;YAC7E,MAAM,OAAO,GAAa;gBACzB,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,OAAO,EAAE;oBACR,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI;oBAChC,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,cAAc;iBACpD;aACD,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBACtF,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;oBAC1C,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAoB,CAAC;oBAC/D,OAAO,WAAW,CAAC;gBACpB,CAAC;gBACD,MAAM,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { responseToException } from \"./dataStoreHelpers.js\";\nimport { FluidHandleBase } from \"./handles.js\";\nimport { RuntimeHeaders } from \"./utils.js\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n *\n * @internal\n */\nexport class RemoteFluidObjectHandle extends FluidHandleBase<FluidObject> {\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t * @param payloadPending - Whether the handle may have a pending payload that is not yet available.\n\t */\n\
|
|
1
|
+
{"version":3,"file":"remoteFluidObjectHandle.js","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":"A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O,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { responseToException } from \"./dataStoreHelpers.js\";\nimport { FluidHandleBase } from \"./handles.js\";\nimport { RuntimeHeaders } from \"./utils.js\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n *\n * @internal\n */\nexport class RemoteFluidObjectHandle extends FluidHandleBase<FluidObject> {\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t * @param payloadPending - Whether the handle may have a pending payload that is not yet available.\n\t */\n\tpublic constructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic readonly payloadPending: boolean,\n\t) {\n\t\tsuper();\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<FluidObject> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: {\n\t\t\t\t\t[RuntimeHeaders.viaHandle]: true,\n\t\t\t\t\t[RuntimeHeaders.payloadPending]: this.payloadPending,\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext.resolveHandle(request).then<FluidObject>((response) => {\n\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t// Responses with mimeType == \"fluid/object\" are produced by Fluid, and thus they can reasonably be expected to always be a FluidObject\n\t\t\t\t\tconst fluidObject: FluidObject = response.value as FluidObject;\n\t\t\t\t\treturn fluidObject;\n\t\t\t\t}\n\t\t\t\tthrow responseToException(response, request);\n\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n}\n"]}
|
package/lib/requestParser.d.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
|
|
5
|
+
import type { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
|
|
6
6
|
/**
|
|
7
7
|
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
8
|
-
* @legacy
|
|
9
|
-
* @alpha
|
|
8
|
+
* @legacy @beta
|
|
10
9
|
*/
|
|
11
10
|
export declare class RequestParser implements IRequest {
|
|
12
11
|
private readonly request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;;GAGG;AACH,qBAAa,aAAc,YAAW,QAAQ;IA8BvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IA7B9C;;;OAGG;WACW,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAc1D,OAAO,CAAC,gBAAgB,CAAgC;IACxD,SAAgB,KAAK,EAAE,MAAM,CAAC;WAEhB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,aAAa;IAQhE,SAAS,aAA8B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAQlE,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,SAAgB,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzC;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,MAAM,EAAE,CAKxC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ;CAiB5D"}
|
package/lib/requestParser.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
7
|
-
* @legacy
|
|
8
|
-
* @alpha
|
|
7
|
+
* @legacy @beta
|
|
9
8
|
*/
|
|
10
9
|
export class RequestParser {
|
|
11
10
|
/**
|
|
@@ -14,15 +13,14 @@ export class RequestParser {
|
|
|
14
13
|
*/
|
|
15
14
|
static getPathParts(url) {
|
|
16
15
|
const queryStartIndex = url.indexOf("?");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
pv.push(decodeURIComponent(cv));
|
|
16
|
+
const pathParts = [];
|
|
17
|
+
const urlPath = url.slice(0, queryStartIndex < 0 ? url.length : queryStartIndex);
|
|
18
|
+
for (const part of urlPath.split("/")) {
|
|
19
|
+
if (part !== undefined && part.length > 0) {
|
|
20
|
+
pathParts.push(decodeURIComponent(part));
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
}
|
|
23
|
+
return pathParts;
|
|
26
24
|
}
|
|
27
25
|
static create(request) {
|
|
28
26
|
// Perf optimizations.
|
|
@@ -34,7 +32,7 @@ export class RequestParser {
|
|
|
34
32
|
constructor(request) {
|
|
35
33
|
this.request = request;
|
|
36
34
|
const queryStartIndex = this.request.url.indexOf("?");
|
|
37
|
-
this.query = queryStartIndex >= 0 ? this.request.url.
|
|
35
|
+
this.query = queryStartIndex >= 0 ? this.request.url.slice(queryStartIndex) : "";
|
|
38
36
|
if (request.headers !== undefined) {
|
|
39
37
|
this.headers = request.headers;
|
|
40
38
|
}
|
package/lib/requestParser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH
|
|
1
|
+
{"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,OAAO,aAAa;IACzB;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,GAAW;QACrC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAEjF,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACvC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC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;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAyB;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QACtC,IAAI,iBAAiB,GAAG,CAAC,IAAI,iBAAiB,GAAG,OAAO,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,iBAAiB,KAAK,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7D,OAAO;gBACN,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO;YACN,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n * @legacy @beta\n */\nexport class RequestParser implements IRequest {\n\t/**\n\t * Splits the path of the url and decodes each path part\n\t * @param url - the url to get path parts of\n\t */\n\tpublic static getPathParts(url: string): readonly string[] {\n\t\tconst queryStartIndex = url.indexOf(\"?\");\n\t\tconst pathParts: string[] = [];\n\t\tconst urlPath = url.slice(0, queryStartIndex < 0 ? url.length : queryStartIndex);\n\n\t\tfor (const part of urlPath.split(\"/\")) {\n\t\t\tif (part !== undefined && part.length > 0) {\n\t\t\t\tpathParts.push(decodeURIComponent(part));\n\t\t\t}\n\t\t}\n\n\t\treturn pathParts;\n\t}\n\n\tprivate requestPathParts: readonly string[] | undefined;\n\tpublic readonly query: string;\n\n\tpublic static create(request: Readonly<IRequest>): RequestParser {\n\t\t// Perf optimizations.\n\t\tif (request instanceof RequestParser) {\n\t\t\treturn request;\n\t\t}\n\t\treturn new RequestParser(request);\n\t}\n\n\tprotected constructor(private readonly request: Readonly<IRequest>) {\n\t\tconst queryStartIndex = this.request.url.indexOf(\"?\");\n\t\tthis.query = queryStartIndex >= 0 ? this.request.url.slice(queryStartIndex) : \"\";\n\t\tif (request.headers !== undefined) {\n\t\t\tthis.headers = request.headers;\n\t\t}\n\t}\n\n\tpublic get url(): string {\n\t\treturn this.request.url;\n\t}\n\n\tpublic readonly headers?: IRequestHeader;\n\n\t/**\n\t * Returns the decoded path parts of the request's url\n\t */\n\tpublic get pathParts(): readonly string[] {\n\t\tif (this.requestPathParts === undefined) {\n\t\t\tthis.requestPathParts = RequestParser.getPathParts(this.url);\n\t\t}\n\t\treturn this.requestPathParts;\n\t}\n\n\t/**\n\t * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n\t * @param elements - number of elements in path\n\t */\n\tpublic isLeaf(elements: number): boolean {\n\t\treturn this.query === \"\" && this.pathParts.length === elements;\n\t}\n\n\t/**\n\t * Creates a sub request starting at a specific path part of this request's url\n\t * The sub request url always has a leading slash, and always include query params if original url has any\n\t * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n\t * createSubRequest(1) is /b/?queryParams\n\t * createSubRequest(2) is /?queryParams\n\t * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n\t *\n\t * note: query params are not counted towards path parts.\n\t *\n\t * @param startingPathIndex - The index of the first path part of the sub request\n\t */\n\tpublic createSubRequest(startingPathIndex: number): IRequest {\n\t\tconst pathLen = this.pathParts.length;\n\t\tif (startingPathIndex < 0 || startingPathIndex > pathLen) {\n\t\t\tthrow new Error(\"incorrect sub-request\");\n\t\t}\n\t\tif (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n\t\t\treturn {\n\t\t\t\turl: `/${this.query}`,\n\t\t\t\theaders: this.headers,\n\t\t\t};\n\t\t}\n\t\tconst path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n\t\treturn {\n\t\t\turl: this.query === \"\" ? path : `${path}/${this.query}`,\n\t\t\theaders: this.headers,\n\t\t};\n\t}\n}\n"]}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IContainerContext, IRuntime, IRuntimeFactory } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
5
|
+
import type { IContainerContext, IRuntime, IRuntimeFactory } from "@fluidframework/container-definitions/internal";
|
|
6
|
+
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
7
7
|
/**
|
|
8
|
-
* @legacy
|
|
9
|
-
* @alpha
|
|
8
|
+
* @legacy @beta
|
|
10
9
|
*/
|
|
11
10
|
export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
12
11
|
get IRuntimeFactory(): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeFactoryHelper.d.ts","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"runtimeFactoryHelper.d.ts","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAEhG;;GAEG;AACH,8BAAsB,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,CAAE,YAAW,eAAe;IAC3F,IAAW,eAAe,IAAI,IAAI,CAEjC;IAEY,kBAAkB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC;IASpB;;;;OAIG;aACa,aAAa,CAC5B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACxB;;;;OAIG;IACU,oBAAoB,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAC7D;;;;OAIG;IACU,uBAAuB,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAChE;;;OAGG;IACU,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeFactoryHelper.js","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH
|
|
1
|
+
{"version":3,"file":"runtimeFactoryHelper.js","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IACzC,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAC9B,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC5D,MAAM,CAAC,QAAQ;YACd,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,OAAO,CAAC;IAChB,CAAC;IAWD;;;;OAIG;IACI,KAAK,CAAC,oBAAoB,CAAC,QAAW,IAAkB,CAAC;IAChE;;;;OAIG;IACI,KAAK,CAAC,uBAAuB,CAAC,QAAW,IAAkB,CAAC;IACnE;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,QAAW,IAAkB,CAAC;CAC1D","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainerContext,\n\tIRuntime,\n\tIRuntimeFactory,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\n\n/**\n * @legacy @beta\n */\nexport abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {\n\tpublic get IRuntimeFactory(): this {\n\t\treturn this;\n\t}\n\n\tpublic async instantiateRuntime(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<IRuntime> {\n\t\tconst runtime = await this.preInitialize(context, existing);\n\t\tawait (existing\n\t\t\t? this.instantiateFromExisting(runtime)\n\t\t\t: this.instantiateFirstTime(runtime));\n\t\tawait this.hasInitialized(runtime);\n\t\treturn runtime;\n\t}\n\n\t/**\n\t * Called at the start of initializing a container, to create the container runtime instance.\n\t * @param context - The context for the container being initialized\n\t * @param existing - Whether the container already exists and is being loaded (else it's being created new just now)\n\t */\n\tpublic abstract preInitialize(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<IRuntime & T>;\n\t/**\n\t * Called the one time the container is created, and not on any subsequent load.\n\t * i.e. only when it's initialized on the client that first created it\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFirstTime(_runtime: T): Promise<void> {}\n\t/**\n\t * Called every time the container runtime is loaded for an existing container.\n\t * i.e. every time it's initialized _except_ for when it is first created\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async instantiateFromExisting(_runtime: T): Promise<void> {}\n\t/**\n\t * Called at the end of initializing a container, after the runtime has been created or loaded.\n\t * @param runtime - The runtime for the container being initialized\n\t */\n\tpublic async hasInitialized(_runtime: T): Promise<void> {}\n}\n"]}
|
package/lib/summaryUtils.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import { ISummaryBlob, ISummaryTree, SummaryObject
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import type { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions/internal";
|
|
6
|
+
import type { ISummaryBlob, ISummaryTree, SummaryObject } from "@fluidframework/driver-definitions";
|
|
7
|
+
import { SummaryType } from "@fluidframework/driver-definitions";
|
|
8
|
+
import type { ITree } from "@fluidframework/driver-definitions/internal";
|
|
9
|
+
import type { ISummaryStats, ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, ISummarizeResult, ITelemetryContextExt } from "@fluidframework/runtime-definitions/internal";
|
|
9
10
|
import type { TelemetryEventPropertyTypeExt } from "@fluidframework/telemetry-utils/internal";
|
|
10
11
|
/**
|
|
11
12
|
* Combines summary stats by adding their totals together.
|
|
@@ -15,29 +16,45 @@ import type { TelemetryEventPropertyTypeExt } from "@fluidframework/telemetry-ut
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
17
18
|
/**
|
|
19
|
+
* Calculates the byte length of an UTF-8 encoded string
|
|
20
|
+
* @param str - The string to calculate the byte length of
|
|
21
|
+
* @returns The byte length of the string
|
|
18
22
|
* @internal
|
|
19
23
|
*/
|
|
20
24
|
export declare function utf8ByteLength(str: string): number;
|
|
21
25
|
/**
|
|
26
|
+
* Gets the size of a blob
|
|
27
|
+
* @param content - The content of the blob
|
|
28
|
+
* @returns The size of the blob in bytes
|
|
22
29
|
* @internal
|
|
23
30
|
*/
|
|
24
31
|
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
25
32
|
/**
|
|
33
|
+
* Calculates the stats for a summary object
|
|
34
|
+
* @param summary - The summary object to calculate stats for
|
|
35
|
+
* @returns The calculated stats
|
|
26
36
|
* @internal
|
|
27
37
|
*/
|
|
28
38
|
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
29
39
|
/**
|
|
40
|
+
* Adds a blob to the summary tree
|
|
41
|
+
* @param summary - The summary tree to add the blob to
|
|
42
|
+
* @param key - The key to store the blob at
|
|
43
|
+
* @param content - The content of the blob to be added
|
|
30
44
|
* @internal
|
|
31
45
|
*/
|
|
32
46
|
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
33
47
|
/**
|
|
48
|
+
* Adds a summarize result to the summary tree
|
|
49
|
+
* @param summary - The summary tree to add the summarize result to
|
|
50
|
+
* @param key - The key to store the summarize result at
|
|
51
|
+
* @param summarizeResult - The summarize result to be added
|
|
34
52
|
* @internal
|
|
35
53
|
*/
|
|
36
54
|
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
37
55
|
/**
|
|
38
56
|
* An object who's properties are used to initialize a {@link SummaryTreeBuilder}
|
|
39
|
-
* @legacy
|
|
40
|
-
* @alpha
|
|
57
|
+
* @legacy @beta
|
|
41
58
|
*/
|
|
42
59
|
export interface SummaryTreeBuilderParams {
|
|
43
60
|
/**
|
|
@@ -49,8 +66,7 @@ export interface SummaryTreeBuilderParams {
|
|
|
49
66
|
/**
|
|
50
67
|
* A helper class for building summary trees.
|
|
51
68
|
* @remarks Uses the builder pattern.
|
|
52
|
-
* @legacy
|
|
53
|
-
* @alpha
|
|
69
|
+
* @legacy @beta
|
|
54
70
|
*/
|
|
55
71
|
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
56
72
|
private attachmentCounter;
|
|
@@ -101,8 +117,7 @@ export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
|
101
117
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
102
118
|
* @param snapshot - snapshot in ITree format
|
|
103
119
|
* @param fullTree - true to never use handles, even if id is specified
|
|
104
|
-
* @legacy
|
|
105
|
-
* @alpha
|
|
120
|
+
* @legacy @beta
|
|
106
121
|
*/
|
|
107
122
|
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
108
123
|
/**
|
|
@@ -138,7 +153,7 @@ export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): IT
|
|
|
138
153
|
*
|
|
139
154
|
* @internal
|
|
140
155
|
*/
|
|
141
|
-
export declare function processAttachMessageGCData(snapshot: ITree |
|
|
156
|
+
export declare function processAttachMessageGCData(snapshot: ITree | undefined, addedGCOutboundRoute: (fromNodeId: string, toPath: string) => void): boolean;
|
|
142
157
|
/**
|
|
143
158
|
* @internal
|
|
144
159
|
*/
|
|
@@ -167,9 +182,7 @@ export declare class TelemetryContext implements ITelemetryContext, ITelemetryCo
|
|
|
167
182
|
*/
|
|
168
183
|
export declare class GCDataBuilder implements IGarbageCollectionData {
|
|
169
184
|
private readonly gcNodesSet;
|
|
170
|
-
get gcNodes():
|
|
171
|
-
[id: string]: string[];
|
|
172
|
-
};
|
|
185
|
+
get gcNodes(): Record<string, string[]>;
|
|
173
186
|
addNode(id: string, outboundRoutes: string[]): void;
|
|
174
187
|
/**
|
|
175
188
|
* Adds the given GC nodes. It does the following:
|
|
@@ -177,12 +190,8 @@ export declare class GCDataBuilder implements IGarbageCollectionData {
|
|
|
177
190
|
* - Prefixes the given `prefixId` to the given nodes' ids.
|
|
178
191
|
* - Adds the outbound routes of the nodes against the normalized and prefixed id.
|
|
179
192
|
*/
|
|
180
|
-
prefixAndAddNodes(prefixId: string, gcNodes:
|
|
181
|
-
|
|
182
|
-
}): void;
|
|
183
|
-
addNodes(gcNodes: {
|
|
184
|
-
[id: string]: string[];
|
|
185
|
-
}): void;
|
|
193
|
+
prefixAndAddNodes(prefixId: string, gcNodes: Record<string, string[]>): void;
|
|
194
|
+
addNodes(gcNodes: Record<string, string[]>): void;
|
|
186
195
|
/**
|
|
187
196
|
* Adds the given outbound route to the outbound routes of all GC nodes.
|
|
188
197
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryUtils.d.ts","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"summaryUtils.d.ts","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAEpG,OAAO,KAAK,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,6CAA6C,CAAC;AAOrF,OAAO,KAAK,EACX,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAE9F;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,CAgBnE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBlD;AAED;;;;;G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AGG;AACH,qBAAa,aAAc,YAAW,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAM7C;IAEM,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI;IAI1D;;;;;OAKG;IACI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAe5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAMxD;;OAEG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAM/C,SAAS,IAAI,sBAAsB;CAK1C"}
|
package/lib/summaryUtils.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IsoBuffer, Uint8ArrayToString, bufferToString, fromBase64ToUtf8, } from "@fluid-internal/client-utils";
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import { SummaryType
|
|
7
|
+
import { SummaryType } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { TreeEntry } from "@fluidframework/driver-definitions/internal";
|
|
9
9
|
import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry, } from "@fluidframework/driver-utils/internal";
|
|
10
|
-
import { gcDataBlobKey
|
|
10
|
+
import { gcDataBlobKey } from "@fluidframework/runtime-definitions/internal";
|
|
11
11
|
/**
|
|
12
12
|
* Combines summary stats by adding their totals together.
|
|
13
13
|
* Returns empty stats if called without args.
|
|
@@ -32,26 +32,34 @@ export function mergeStats(...stats) {
|
|
|
32
32
|
return results;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
+
* Calculates the byte length of an UTF-8 encoded string
|
|
36
|
+
* @param str - The string to calculate the byte length of
|
|
37
|
+
* @returns The byte length of the string
|
|
35
38
|
* @internal
|
|
36
39
|
*/
|
|
37
40
|
export function utf8ByteLength(str) {
|
|
38
41
|
// returns the byte length of an utf8 string
|
|
39
42
|
let s = str.length;
|
|
40
43
|
for (let i = str.length - 1; i >= 0; i--) {
|
|
41
|
-
const code = str.
|
|
42
|
-
if (code
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
const code = str.codePointAt(i);
|
|
45
|
+
if (code !== undefined) {
|
|
46
|
+
if (code > 0x7f && code <= 0x7ff) {
|
|
47
|
+
s++;
|
|
48
|
+
}
|
|
49
|
+
else if (code > 0x7ff && code <= 0xffff) {
|
|
50
|
+
s += 2;
|
|
51
|
+
}
|
|
52
|
+
if (code >= 0xdc00 && code <= 0xdfff) {
|
|
53
|
+
i--; // trail surrogate
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
return s;
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
60
|
+
* Gets the size of a blob
|
|
61
|
+
* @param content - The content of the blob
|
|
62
|
+
* @returns The size of the blob in bytes
|
|
55
63
|
* @internal
|
|
56
64
|
*/
|
|
57
65
|
export function getBlobSize(content) {
|
|
@@ -75,11 +83,15 @@ function calculateStatsCore(summaryObject, stats) {
|
|
|
75
83
|
stats.totalBlobSize += getBlobSize(summaryObject.content);
|
|
76
84
|
return;
|
|
77
85
|
}
|
|
78
|
-
default:
|
|
86
|
+
default: {
|
|
79
87
|
return;
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
/**
|
|
92
|
+
* Calculates the stats for a summary object
|
|
93
|
+
* @param summary - The summary object to calculate stats for
|
|
94
|
+
* @returns The calculated stats
|
|
83
95
|
* @internal
|
|
84
96
|
*/
|
|
85
97
|
export function calculateStats(summary) {
|
|
@@ -88,6 +100,10 @@ export function calculateStats(summary) {
|
|
|
88
100
|
return stats;
|
|
89
101
|
}
|
|
90
102
|
/**
|
|
103
|
+
* Adds a blob to the summary tree
|
|
104
|
+
* @param summary - The summary tree to add the blob to
|
|
105
|
+
* @param key - The key to store the blob at
|
|
106
|
+
* @param content - The content of the blob to be added
|
|
91
107
|
* @internal
|
|
92
108
|
*/
|
|
93
109
|
export function addBlobToSummary(summary, key, content) {
|
|
@@ -100,6 +116,10 @@ export function addBlobToSummary(summary, key, content) {
|
|
|
100
116
|
summary.stats.totalBlobSize += getBlobSize(content);
|
|
101
117
|
}
|
|
102
118
|
/**
|
|
119
|
+
* Adds a summarize result to the summary tree
|
|
120
|
+
* @param summary - The summary tree to add the summarize result to
|
|
121
|
+
* @param key - The key to store the summarize result at
|
|
122
|
+
* @param summarizeResult - The summarize result to be added
|
|
103
123
|
* @internal
|
|
104
124
|
*/
|
|
105
125
|
export function addSummarizeResultToSummary(summary, key, summarizeResult) {
|
|
@@ -109,8 +129,7 @@ export function addSummarizeResultToSummary(summary, key, summarizeResult) {
|
|
|
109
129
|
/**
|
|
110
130
|
* A helper class for building summary trees.
|
|
111
131
|
* @remarks Uses the builder pattern.
|
|
112
|
-
* @legacy
|
|
113
|
-
* @alpha
|
|
132
|
+
* @legacy @beta
|
|
114
133
|
*/
|
|
115
134
|
export class SummaryTreeBuilder {
|
|
116
135
|
get summary() {
|
|
@@ -195,8 +214,7 @@ export class SummaryTreeBuilder {
|
|
|
195
214
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
196
215
|
* @param snapshot - snapshot in ITree format
|
|
197
216
|
* @param fullTree - true to never use handles, even if id is specified
|
|
198
|
-
* @legacy
|
|
199
|
-
* @alpha
|
|
217
|
+
* @legacy @beta
|
|
200
218
|
*/
|
|
201
219
|
export function convertToSummaryTreeWithStats(snapshot, fullTree = false) {
|
|
202
220
|
const builder = new SummaryTreeBuilder();
|
|
@@ -218,8 +236,9 @@ export function convertToSummaryTreeWithStats(snapshot, fullTree = false) {
|
|
|
218
236
|
builder.addAttachment(id);
|
|
219
237
|
break;
|
|
220
238
|
}
|
|
221
|
-
default:
|
|
239
|
+
default: {
|
|
222
240
|
throw new Error("Unexpected TreeEntry type");
|
|
241
|
+
}
|
|
223
242
|
}
|
|
224
243
|
}
|
|
225
244
|
const summaryTree = builder.getSummaryTree();
|
|
@@ -266,6 +285,8 @@ export function convertSnapshotTreeToSummaryTree(snapshot) {
|
|
|
266
285
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
267
286
|
const content = snapshot.blobsContents[id];
|
|
268
287
|
if (content !== undefined) {
|
|
288
|
+
// Cannot change "utf-8" to "utf8" as this encoding value is stored in summaries and would be a breaking change which needs to be done first before changing to utf8.
|
|
289
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- External on-disk format is 'utf-8'.
|
|
269
290
|
decoded = bufferToString(content, "utf-8");
|
|
270
291
|
}
|
|
271
292
|
// 0.44 back-compat We still put contents in same blob for back-compat so need to add blob
|
|
@@ -300,6 +321,8 @@ export function convertSummaryTreeToITree(summaryTree) {
|
|
|
300
321
|
switch (value.type) {
|
|
301
322
|
case SummaryType.Blob: {
|
|
302
323
|
let parsedContent;
|
|
324
|
+
// Cannot change "utf-8" to "utf8" as this encoding value is stored in summaries and would be a breaking change which needs to be done first before changing to utf8.
|
|
325
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- external contract uses 'utf-8'.
|
|
303
326
|
let encoding = "utf-8";
|
|
304
327
|
if (typeof value.content === "string") {
|
|
305
328
|
parsedContent = value.content;
|
|
@@ -322,8 +345,9 @@ export function convertSummaryTreeToITree(summaryTree) {
|
|
|
322
345
|
case SummaryType.Handle: {
|
|
323
346
|
throw new Error("Should not have Handle type in summary tree");
|
|
324
347
|
}
|
|
325
|
-
default:
|
|
348
|
+
default: {
|
|
326
349
|
unreachableCase(value, "Unexpected summary tree type");
|
|
350
|
+
}
|
|
327
351
|
}
|
|
328
352
|
}
|
|
329
353
|
return {
|
|
@@ -352,12 +376,16 @@ export function processAttachMessageGCData(snapshot, addedGCOutboundRoute) {
|
|
|
352
376
|
if (gcDataEntry === undefined) {
|
|
353
377
|
return false;
|
|
354
378
|
}
|
|
355
|
-
assert(
|
|
379
|
+
assert(
|
|
380
|
+
// Cannot change "utf-8" to "utf8" as this encoding value is stored in summaries and would be a breaking change which needs to be done first before changing to utf8.
|
|
381
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- external contract uses 'utf-8'.
|
|
382
|
+
gcDataEntry.type === TreeEntry.Blob && gcDataEntry.value.encoding === "utf-8", 0x8ff /* GC data should be a utf-8-encoded blob */);
|
|
383
|
+
// Type assertion is safe as we expect the GC data to conform to IGarbageCollectionData schema
|
|
356
384
|
const gcData = JSON.parse(gcDataEntry.value.contents);
|
|
357
385
|
for (const [nodeId, outboundRoutes] of Object.entries(gcData.gcNodes)) {
|
|
358
|
-
|
|
386
|
+
for (const toPath of outboundRoutes) {
|
|
359
387
|
addedGCOutboundRoute(nodeId, toPath);
|
|
360
|
-
}
|
|
388
|
+
}
|
|
361
389
|
}
|
|
362
390
|
return true;
|
|
363
391
|
}
|
|
@@ -394,9 +422,9 @@ export class TelemetryContext {
|
|
|
394
422
|
*/
|
|
395
423
|
serialize() {
|
|
396
424
|
const jsonObject = {};
|
|
397
|
-
this.telemetry.
|
|
425
|
+
for (const [key, value] of this.telemetry.entries()) {
|
|
398
426
|
jsonObject[key] = value;
|
|
399
|
-
}
|
|
427
|
+
}
|
|
400
428
|
return JSON.stringify(jsonObject);
|
|
401
429
|
}
|
|
402
430
|
}
|