@fluidframework/runtime-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/runtime-utils.api.md +30 -30
- package/dist/dataStoreHandleContextUtils.d.ts +1 -0
- package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/dist/dataStoreHandleContextUtils.js +1 -0
- package/dist/dataStoreHandleContextUtils.js.map +1 -1
- package/dist/dataStoreHelpers.d.ts +19 -0
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/dataStoreHelpers.js +16 -0
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/objectstoragepartition.d.ts +1 -0
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/objectstoragepartition.js +1 -0
- package/dist/objectstoragepartition.js.map +1 -1
- package/dist/objectstorageutils.d.ts +6 -0
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/objectstorageutils.js +6 -0
- package/dist/objectstorageutils.js.map +1 -1
- package/dist/requestParser.d.ts +1 -0
- package/dist/requestParser.d.ts.map +1 -1
- package/dist/requestParser.js +1 -0
- package/dist/requestParser.js.map +1 -1
- package/dist/runtime-utils-alpha.d.ts +137 -0
- package/dist/runtime-utils-beta.d.ts +126 -0
- package/dist/runtime-utils-public.d.ts +126 -0
- package/dist/runtime-utils-untrimmed.d.ts +313 -0
- package/dist/runtimeFactoryHelper.d.ts +3 -0
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/runtimeFactoryHelper.js +3 -0
- package/dist/runtimeFactoryHelper.js.map +1 -1
- package/dist/summaryUtils.d.ts +29 -0
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +29 -0
- package/dist/summaryUtils.js.map +1 -1
- package/dist/unpackUsedRoutes.d.ts +2 -1
- package/dist/unpackUsedRoutes.d.ts.map +1 -1
- package/dist/unpackUsedRoutes.js +1 -0
- package/dist/unpackUsedRoutes.js.map +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -1
- package/lib/dataStoreHandleContextUtils.d.ts +1 -0
- package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/lib/dataStoreHandleContextUtils.js +1 -0
- package/lib/dataStoreHandleContextUtils.js.map +1 -1
- package/lib/dataStoreHelpers.d.ts +19 -0
- package/lib/dataStoreHelpers.d.ts.map +1 -1
- package/lib/dataStoreHelpers.js +16 -0
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/objectstoragepartition.d.ts +1 -0
- package/lib/objectstoragepartition.d.ts.map +1 -1
- package/lib/objectstoragepartition.js +1 -0
- package/lib/objectstoragepartition.js.map +1 -1
- package/lib/objectstorageutils.d.ts +6 -0
- package/lib/objectstorageutils.d.ts.map +1 -1
- package/lib/objectstorageutils.js +6 -0
- package/lib/objectstorageutils.js.map +1 -1
- package/lib/requestParser.d.ts +1 -0
- package/lib/requestParser.d.ts.map +1 -1
- package/lib/requestParser.js +1 -0
- package/lib/requestParser.js.map +1 -1
- package/lib/runtime-utils-alpha.d.ts +137 -0
- package/lib/runtime-utils-beta.d.ts +126 -0
- package/lib/runtime-utils-public.d.ts +126 -0
- package/lib/runtime-utils-untrimmed.d.ts +313 -0
- package/lib/runtimeFactoryHelper.d.ts +3 -0
- package/lib/runtimeFactoryHelper.d.ts.map +1 -1
- package/lib/runtimeFactoryHelper.js +3 -0
- package/lib/runtimeFactoryHelper.js.map +1 -1
- package/lib/summaryUtils.d.ts +29 -0
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +29 -0
- package/lib/summaryUtils.js.map +1 -1
- package/lib/unpackUsedRoutes.d.ts +2 -1
- package/lib/unpackUsedRoutes.d.ts.map +1 -1
- package/lib/unpackUsedRoutes.js +1 -0
- package/lib/unpackUsedRoutes.js.map +1 -1
- package/lib/utils.d.ts +6 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -0
- package/lib/utils.js.map +1 -1
- package/package.json +35 -16
- package/src/dataStoreHandleContextUtils.ts +1 -0
- package/src/dataStoreHelpers.ts +19 -0
- package/src/objectstoragepartition.ts +1 -0
- package/src/objectstorageutils.ts +6 -0
- package/src/requestParser.ts +1 -0
- package/src/runtimeFactoryHelper.ts +3 -0
- package/src/summaryUtils.ts +29 -0
- package/src/unpackUsedRoutes.ts +2 -1
- package/src/utils.ts +6 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
7
7
|
* @param usedRoutes - The used routes of a node.
|
|
8
8
|
* @returns A map of used routes of each children of the the given node.
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
|
-
export declare function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
11
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]): Map<string, string[]>;
|
|
11
12
|
//# sourceMappingURL=unpackUsedRoutes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpackUsedRoutes.d.ts","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH
|
|
1
|
+
{"version":3,"file":"unpackUsedRoutes.d.ts","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,yBAiBvE"}
|
package/lib/unpackUsedRoutes.js
CHANGED
|
@@ -7,6 +7,7 @@ import { assert } from "@fluidframework/core-utils";
|
|
|
7
7
|
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
8
8
|
* @param usedRoutes - The used routes of a node.
|
|
9
9
|
* @returns A map of used routes of each children of the the given node.
|
|
10
|
+
* @internal
|
|
10
11
|
*/
|
|
11
12
|
export function unpackChildNodesUsedRoutes(usedRoutes) {
|
|
12
13
|
// Remove the node's self used route, if any, and generate the children used routes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpackUsedRoutes.js","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"unpackUsedRoutes.js","sourceRoot":"","sources":["../src/unpackUsedRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAA6B;IACvE,oFAAoF;IACpF,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC;IACvF,MAAM,kBAAkB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,kBAAkB,EAAE;QACvC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,eAAe,KAAK,SAAS,EAAE;YAClC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;aAAM;YACN,kBAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;SAClD;KACD;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * Helper function that unpacks the used routes of children from a given node's used routes.\n * @param usedRoutes - The used routes of a node.\n * @returns A map of used routes of each children of the the given node.\n * @internal\n */\nexport function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]) {\n\t// Remove the node's self used route, if any, and generate the children used routes.\n\tconst filteredUsedRoutes = usedRoutes.filter((route) => route !== \"\" && route !== \"/\");\n\tconst childUsedRoutesMap: Map<string, string[]> = new Map();\n\tfor (const route of filteredUsedRoutes) {\n\t\tassert(route.startsWith(\"/\"), 0x5e0 /* Used route should always be an absolute route */);\n\t\tconst childId = route.split(\"/\")[1];\n\t\tconst childUsedRoute = route.slice(childId.length + 1);\n\n\t\tconst childUsedRoutes = childUsedRoutesMap.get(childId);\n\t\tif (childUsedRoutes !== undefined) {\n\t\t\tchildUsedRoutes.push(childUsedRoute);\n\t\t} else {\n\t\t\tchildUsedRoutesMap.set(childId, [childUsedRoute]);\n\t\t}\n\t}\n\treturn childUsedRoutesMap;\n}\n"]}
|
package/lib/utils.d.ts
CHANGED
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Reads a blob from storage and parses it from JSON.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
7
11
|
export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
8
12
|
/**
|
|
9
13
|
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
10
14
|
* @param tree - snapshot tree to examine
|
|
11
15
|
* @param readAndParseBlob - function to read blob contents from storage
|
|
12
16
|
* and parse the result from JSON.
|
|
17
|
+
* @internal
|
|
13
18
|
*/
|
|
14
19
|
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
15
20
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1F
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAsB,WAAW,CAChC,IAAI,EAAE,aAAa,EACnB,gBAAgB,EAAE,gBAAgB,GAChC,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
package/lib/utils.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @param tree - snapshot tree to examine
|
|
8
8
|
* @param readAndParseBlob - function to read blob contents from storage
|
|
9
9
|
* and parse the result from JSON.
|
|
10
|
+
* @internal
|
|
10
11
|
*/
|
|
11
12
|
export async function seqFromTree(tree, readAndParseBlob) {
|
|
12
13
|
const attributesHash = tree.trees[".protocol"].blobs.attributes;
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,IAAmB,EACnB,gBAAkC;IAElC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAsB,cAAc,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,cAAc,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentAttributes, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Reads a blob from storage and parses it from JSON.\n *\n * @internal\n */\nexport type ReadAndParseBlob = <T>(id: string) => Promise<T>;\n\n/**\n * Fetches the sequence number of the snapshot tree by examining the protocol.\n * @param tree - snapshot tree to examine\n * @param readAndParseBlob - function to read blob contents from storage\n * and parse the result from JSON.\n * @internal\n */\nexport async function seqFromTree(\n\ttree: ISnapshotTree,\n\treadAndParseBlob: ReadAndParseBlob,\n): Promise<number> {\n\tconst attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n\tconst attrib = await readAndParseBlob<IDocumentAttributes>(attributesHash);\n\treturn attrib.sequenceNumber;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.4.1",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,28 +35,30 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
43
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.
|
|
44
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
40
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
41
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
42
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
43
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
44
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
45
45
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
46
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.
|
|
47
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
46
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
47
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
50
51
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
51
52
|
"@fluidframework/build-common": "^2.0.3",
|
|
52
53
|
"@fluidframework/build-tools": "^0.28.0",
|
|
53
54
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
54
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
55
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
|
|
55
56
|
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.7.2.0",
|
|
56
57
|
"@microsoft/api-extractor": "^7.38.3",
|
|
57
58
|
"@types/mocha": "^9.1.1",
|
|
58
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^18.19.0",
|
|
59
60
|
"c8": "^7.7.1",
|
|
61
|
+
"copyfiles": "^2.4.1",
|
|
60
62
|
"cross-env": "^7.0.3",
|
|
61
63
|
"eslint": "~8.50.0",
|
|
62
64
|
"mocha": "^10.2.0",
|
|
@@ -69,25 +71,42 @@
|
|
|
69
71
|
"ts-node": "^10.9.1",
|
|
70
72
|
"typescript": "~5.1.6"
|
|
71
73
|
},
|
|
74
|
+
"fluidBuild": {
|
|
75
|
+
"tasks": {
|
|
76
|
+
"build:docs": {
|
|
77
|
+
"dependsOn": [
|
|
78
|
+
"...",
|
|
79
|
+
"api-extractor:commonjs",
|
|
80
|
+
"api-extractor:esnext"
|
|
81
|
+
],
|
|
82
|
+
"script": false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
72
86
|
"typeValidation": {
|
|
73
87
|
"broken": {}
|
|
74
88
|
},
|
|
75
89
|
"scripts": {
|
|
90
|
+
"api": "fluid-build . --task api",
|
|
91
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
92
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
76
93
|
"build": "fluid-build . --task build",
|
|
77
94
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
78
95
|
"build:compile": "fluid-build . --task compile",
|
|
79
|
-
"build:docs": "
|
|
96
|
+
"build:docs": "fluid-build . --task api",
|
|
80
97
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
81
98
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
99
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
100
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
82
101
|
"ci:build:docs": "api-extractor run",
|
|
83
102
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
84
103
|
"eslint": "eslint --format stylish src",
|
|
85
104
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
86
105
|
"format": "npm run prettier:fix",
|
|
87
|
-
"lint": "npm run prettier && npm run eslint",
|
|
106
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
88
107
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
89
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
90
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
108
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
109
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
91
110
|
"test": "npm run test:mocha",
|
|
92
111
|
"test:coverage": "c8 npm test",
|
|
93
112
|
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
@@ -10,6 +10,7 @@ import { IFluidHandleContext } from "@fluidframework/core-interfaces";
|
|
|
10
10
|
* @param path - The path to the Fluid object relative to the route context.
|
|
11
11
|
* @param routeContext - The route context that contains the Fluid object.
|
|
12
12
|
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
13
|
+
* @internal
|
|
13
14
|
*/
|
|
14
15
|
export function generateHandleContextPath(
|
|
15
16
|
path: string,
|
package/src/dataStoreHelpers.ts
CHANGED
|
@@ -21,6 +21,9 @@ interface IResponseException extends Error {
|
|
|
21
21
|
underlyingResponseHeaders?: { [key: string]: any };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
24
27
|
export function exceptionToResponse(err: any): IResponse {
|
|
25
28
|
const status = 500;
|
|
26
29
|
if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
|
|
@@ -49,6 +52,9 @@ export function exceptionToResponse(err: any): IResponse {
|
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
52
58
|
export function responseToException(response: IResponse, request: IRequest): Error {
|
|
53
59
|
const message = response.value;
|
|
54
60
|
const errWithStack = generateErrorWithStack();
|
|
@@ -68,6 +74,7 @@ export function responseToException(response: IResponse, request: IRequest): Err
|
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
77
|
+
* @internal
|
|
71
78
|
*/
|
|
72
79
|
export async function requestFluidObject<T = FluidObject>(
|
|
73
80
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -85,9 +92,15 @@ export async function requestFluidObject<T = FluidObject>(
|
|
|
85
92
|
return response.value as T;
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
88
98
|
export const create404Response = (request: IRequest) =>
|
|
89
99
|
createResponseError(404, "not found", request);
|
|
90
100
|
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
91
104
|
export function createResponseError(
|
|
92
105
|
status: number,
|
|
93
106
|
value: string,
|
|
@@ -112,8 +125,14 @@ export function createResponseError(
|
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
115
131
|
export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
116
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
117
136
|
export function createDataStoreFactory(
|
|
118
137
|
type: string,
|
|
119
138
|
factory: Factory | Promise<Factory>,
|
|
@@ -8,6 +8,7 @@ import { IChannelStorageService } from "@fluidframework/datastore-definitions";
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export class ObjectStoragePartition implements IChannelStorageService {
|
|
13
14
|
constructor(
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
import { ITree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export function getNormalizedObjectStoragePathParts(path: string) {
|
|
9
12
|
let normalizePath = path;
|
|
10
13
|
if (normalizePath.startsWith("/")) {
|
|
@@ -19,6 +22,9 @@ export function getNormalizedObjectStoragePathParts(path: string) {
|
|
|
19
22
|
return [];
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
22
28
|
export async function listBlobsAtTreePath(
|
|
23
29
|
inputTree: ITree | undefined,
|
|
24
30
|
path: string,
|
package/src/requestParser.ts
CHANGED
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
} from "@fluidframework/container-definitions";
|
|
11
11
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
13
16
|
export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
14
17
|
public get IRuntimeFactory() {
|
|
15
18
|
return this;
|
package/src/summaryUtils.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
* Combines summary stats by adding their totals together.
|
|
35
35
|
* Returns empty stats if called without args.
|
|
36
36
|
* @param stats - stats to merge
|
|
37
|
+
* @internal
|
|
37
38
|
*/
|
|
38
39
|
export function mergeStats(...stats: ISummaryStats[]): ISummaryStats {
|
|
39
40
|
const results = {
|
|
@@ -53,6 +54,9 @@ export function mergeStats(...stats: ISummaryStats[]): ISummaryStats {
|
|
|
53
54
|
return results;
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
56
60
|
export function utf8ByteLength(str: string): number {
|
|
57
61
|
// returns the byte length of an utf8 string
|
|
58
62
|
let s = str.length;
|
|
@@ -70,6 +74,9 @@ export function utf8ByteLength(str: string): number {
|
|
|
70
74
|
return s;
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
73
80
|
export function getBlobSize(content: ISummaryBlob["content"]): number {
|
|
74
81
|
return typeof content === "string" ? utf8ByteLength(content) : content.byteLength;
|
|
75
82
|
}
|
|
@@ -97,12 +104,18 @@ function calculateStatsCore(summaryObject: SummaryObject, stats: ISummaryStats):
|
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
100
110
|
export function calculateStats(summary: SummaryObject): ISummaryStats {
|
|
101
111
|
const stats = mergeStats();
|
|
102
112
|
calculateStatsCore(summary, stats);
|
|
103
113
|
return stats;
|
|
104
114
|
}
|
|
105
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
106
119
|
export function addBlobToSummary(
|
|
107
120
|
summary: ISummaryTreeWithStats,
|
|
108
121
|
key: string,
|
|
@@ -117,6 +130,9 @@ export function addBlobToSummary(
|
|
|
117
130
|
summary.stats.totalBlobSize += getBlobSize(content);
|
|
118
131
|
}
|
|
119
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
120
136
|
export function addTreeToSummary(
|
|
121
137
|
summary: ISummaryTreeWithStats,
|
|
122
138
|
key: string,
|
|
@@ -126,6 +142,9 @@ export function addTreeToSummary(
|
|
|
126
142
|
summary.stats = mergeStats(summary.stats, summarizeResult.stats);
|
|
127
143
|
}
|
|
128
144
|
|
|
145
|
+
/**
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
129
148
|
export function addSummarizeResultToSummary(
|
|
130
149
|
summary: ISummaryTreeWithStats,
|
|
131
150
|
key: string,
|
|
@@ -135,6 +154,9 @@ export function addSummarizeResultToSummary(
|
|
|
135
154
|
summary.stats = mergeStats(summary.stats, summarizeResult.stats);
|
|
136
155
|
}
|
|
137
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
138
160
|
export class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
139
161
|
private attachmentCounter: number = 0;
|
|
140
162
|
|
|
@@ -203,6 +225,7 @@ export class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
|
203
225
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
204
226
|
* @param snapshot - snapshot in ITree format
|
|
205
227
|
* @param fullTree - true to never use handles, even if id is specified
|
|
228
|
+
* @internal
|
|
206
229
|
*/
|
|
207
230
|
export function convertToSummaryTreeWithStats(
|
|
208
231
|
snapshot: ITree,
|
|
@@ -249,6 +272,7 @@ export function convertToSummaryTreeWithStats(
|
|
|
249
272
|
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
250
273
|
* @param snapshot - snapshot in ITree format
|
|
251
274
|
* @param fullTree - true to never use handles, even if id is specified
|
|
275
|
+
* @internal
|
|
252
276
|
*/
|
|
253
277
|
export function convertToSummaryTree(snapshot: ITree, fullTree: boolean = false): ISummarizeResult {
|
|
254
278
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
@@ -272,6 +296,7 @@ export function convertToSummaryTree(snapshot: ITree, fullTree: boolean = false)
|
|
|
272
296
|
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
273
297
|
* was taken by serialize api in detached container.
|
|
274
298
|
* @param snapshot - snapshot in ISnapshotTree format
|
|
299
|
+
* @internal
|
|
275
300
|
*/
|
|
276
301
|
export function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats {
|
|
277
302
|
const builder = new SummaryTreeBuilder();
|
|
@@ -305,6 +330,7 @@ export function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISumm
|
|
|
305
330
|
/**
|
|
306
331
|
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
307
332
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
333
|
+
* @internal
|
|
308
334
|
*/
|
|
309
335
|
export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree {
|
|
310
336
|
const entries: ITreeEntry[] = [];
|
|
@@ -347,6 +373,9 @@ export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree {
|
|
|
347
373
|
};
|
|
348
374
|
}
|
|
349
375
|
|
|
376
|
+
/**
|
|
377
|
+
* @internal
|
|
378
|
+
*/
|
|
350
379
|
export class TelemetryContext implements ITelemetryContext {
|
|
351
380
|
private readonly telemetry = new Map<string, TelemetryEventPropertyType>();
|
|
352
381
|
|
package/src/unpackUsedRoutes.ts
CHANGED
|
@@ -9,8 +9,9 @@ import { assert } from "@fluidframework/core-utils";
|
|
|
9
9
|
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
10
10
|
* @param usedRoutes - The used routes of a node.
|
|
11
11
|
* @returns A map of used routes of each children of the the given node.
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
|
-
export function unpackChildNodesUsedRoutes(usedRoutes: string[]) {
|
|
14
|
+
export function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]) {
|
|
14
15
|
// Remove the node's self used route, if any, and generate the children used routes.
|
|
15
16
|
const filteredUsedRoutes = usedRoutes.filter((route) => route !== "" && route !== "/");
|
|
16
17
|
const childUsedRoutesMap: Map<string, string[]> = new Map();
|
package/src/utils.ts
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import { IDocumentAttributes, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Reads a blob from storage and parses it from JSON.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
9
13
|
export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
10
14
|
|
|
11
15
|
/**
|
|
@@ -13,6 +17,7 @@ export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
|
13
17
|
* @param tree - snapshot tree to examine
|
|
14
18
|
* @param readAndParseBlob - function to read blob contents from storage
|
|
15
19
|
* and parse the result from JSON.
|
|
20
|
+
* @internal
|
|
16
21
|
*/
|
|
17
22
|
export async function seqFromTree(
|
|
18
23
|
tree: ISnapshotTree,
|