@fluidframework/runtime-utils 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +191 -0
- package/README.md +68 -1
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/runtime-utils.api.md +201 -0
- package/dist/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.cjs} +5 -2
- package/dist/dataStoreHandleContextUtils.cjs.map +1 -0
- package/dist/dataStoreHandleContextUtils.d.ts +1 -0
- package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/dist/{dataStoreHelpers.js → dataStoreHelpers.cjs} +44 -25
- package/dist/dataStoreHelpers.cjs.map +1 -0
- package/dist/dataStoreHelpers.d.ts +23 -4
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/index.cjs +44 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/{objectstoragepartition.js → objectstoragepartition.cjs} +4 -3
- package/dist/objectstoragepartition.cjs.map +1 -0
- package/dist/objectstoragepartition.d.ts +1 -0
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/{objectstorageutils.js → objectstorageutils.cjs} +11 -15
- package/dist/objectstorageutils.cjs.map +1 -0
- package/dist/objectstorageutils.d.ts +6 -0
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/{requestParser.js → requestParser.cjs} +7 -11
- package/dist/requestParser.cjs.map +1 -0
- package/dist/requestParser.d.ts +1 -0
- package/dist/requestParser.d.ts.map +1 -1
- package/dist/runtime-utils-alpha.d.ts +155 -0
- package/dist/runtime-utils-beta.d.ts +103 -0
- package/dist/runtime-utils-public.d.ts +103 -0
- package/dist/runtime-utils-untrimmed.d.ts +306 -0
- package/dist/{runtimeFactoryHelper.js → runtimeFactoryHelper.cjs} +11 -12
- package/dist/runtimeFactoryHelper.cjs.map +1 -0
- package/dist/runtimeFactoryHelper.d.ts +4 -1
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/{summaryUtils.js → summaryUtils.cjs} +138 -34
- package/dist/summaryUtils.cjs.map +1 -0
- package/dist/summaryUtils.d.ts +66 -4
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/unpackUsedRoutes.cjs +34 -0
- package/dist/unpackUsedRoutes.cjs.map +1 -0
- package/dist/unpackUsedRoutes.d.ts +12 -0
- package/dist/unpackUsedRoutes.d.ts.map +1 -0
- package/dist/{utils.js → utils.cjs} +2 -1
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +7 -2
- package/dist/utils.d.ts.map +1 -1
- package/lib/{dataStoreHandleContextUtils.d.ts → dataStoreHandleContextUtils.d.mts} +1 -0
- package/lib/dataStoreHandleContextUtils.d.mts.map +1 -0
- package/lib/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.mjs} +5 -2
- package/lib/dataStoreHandleContextUtils.mjs.map +1 -0
- package/lib/{dataStoreHelpers.d.ts → dataStoreHelpers.d.mts} +23 -4
- package/lib/dataStoreHelpers.d.mts.map +1 -0
- package/lib/{dataStoreHelpers.js → dataStoreHelpers.mjs} +42 -22
- package/lib/dataStoreHelpers.mjs.map +1 -0
- package/lib/index.d.mts +14 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +14 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{objectstoragepartition.d.ts → objectstoragepartition.d.mts} +1 -0
- package/lib/objectstoragepartition.d.mts.map +1 -0
- package/lib/{objectstoragepartition.js → objectstoragepartition.mjs} +3 -2
- package/lib/objectstoragepartition.mjs.map +1 -0
- package/lib/{objectstorageutils.d.ts → objectstorageutils.d.mts} +6 -0
- package/lib/objectstorageutils.d.mts.map +1 -0
- package/lib/{objectstorageutils.js → objectstorageutils.mjs} +11 -15
- package/lib/objectstorageutils.mjs.map +1 -0
- package/lib/{requestParser.d.ts → requestParser.d.mts} +1 -4
- package/lib/requestParser.d.mts.map +1 -0
- package/lib/{requestParser.js → requestParser.mjs} +7 -11
- package/lib/requestParser.mjs.map +1 -0
- package/lib/runtime-utils-alpha.d.mts +155 -0
- package/lib/runtime-utils-beta.d.mts +103 -0
- package/lib/runtime-utils-public.d.mts +103 -0
- package/lib/runtime-utils-untrimmed.d.mts +306 -0
- package/lib/{runtimeFactoryHelper.d.ts → runtimeFactoryHelper.d.mts} +4 -1
- package/lib/runtimeFactoryHelper.d.mts.map +1 -0
- package/lib/runtimeFactoryHelper.mjs +24 -0
- package/lib/runtimeFactoryHelper.mjs.map +1 -0
- package/lib/{summaryUtils.d.ts → summaryUtils.d.mts} +66 -4
- package/lib/summaryUtils.d.mts.map +1 -0
- package/lib/{summaryUtils.js → summaryUtils.mjs} +129 -26
- package/lib/summaryUtils.mjs.map +1 -0
- package/lib/unpackUsedRoutes.d.mts +12 -0
- package/lib/unpackUsedRoutes.d.mts.map +1 -0
- package/lib/unpackUsedRoutes.mjs +30 -0
- package/lib/unpackUsedRoutes.mjs.map +1 -0
- package/lib/{utils.d.ts → utils.d.mts} +7 -2
- package/lib/utils.d.mts.map +1 -0
- package/lib/{utils.js → utils.mjs} +2 -1
- package/lib/utils.mjs.map +1 -0
- package/package.json +102 -66
- package/prettier.config.cjs +8 -0
- package/src/dataStoreHandleContextUtils.ts +24 -16
- package/src/dataStoreHelpers.ts +106 -83
- package/src/index.ts +31 -9
- package/src/objectstoragepartition.ts +18 -14
- package/src/objectstorageutils.ts +37 -36
- package/src/requestParser.ts +81 -86
- package/src/runtimeFactoryHelper.ts +27 -26
- package/src/summaryUtils.ts +425 -299
- package/src/unpackUsedRoutes.ts +31 -0
- package/src/utils.ts +12 -7
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -12
- package/dist/dataStoreHandleContextUtils.js.map +0 -1
- package/dist/dataStoreHelpers.js.map +0 -1
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/objectstoragepartition.js.map +0 -1
- package/dist/objectstorageutils.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/requestParser.js.map +0 -1
- package/dist/runtimeFactoryHelper.js.map +0 -1
- package/dist/summarizerNode/index.d.ts +0 -8
- package/dist/summarizerNode/index.d.ts.map +0 -1
- package/dist/summarizerNode/index.js +0 -12
- package/dist/summarizerNode/index.js.map +0 -1
- package/dist/summarizerNode/summarizerNode.d.ts +0 -139
- package/dist/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNode.js +0 -480
- package/dist/summarizerNode/summarizerNode.js.map +0 -1
- package/dist/summarizerNode/summarizerNodeUtils.d.ts +0 -161
- package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNodeUtils.js +0 -225
- package/dist/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js +0 -294
- package/dist/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/dist/summaryUtils.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/lib/dataStoreHandleContextUtils.d.ts.map +0 -1
- package/lib/dataStoreHandleContextUtils.js.map +0 -1
- package/lib/dataStoreHelpers.d.ts.map +0 -1
- package/lib/dataStoreHelpers.js.map +0 -1
- package/lib/index.d.ts +0 -14
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
- package/lib/objectstoragepartition.d.ts.map +0 -1
- package/lib/objectstoragepartition.js.map +0 -1
- package/lib/objectstorageutils.d.ts.map +0 -1
- package/lib/objectstorageutils.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/requestParser.d.ts.map +0 -1
- package/lib/requestParser.js.map +0 -1
- package/lib/runtimeFactoryHelper.d.ts.map +0 -1
- package/lib/runtimeFactoryHelper.js +0 -25
- package/lib/runtimeFactoryHelper.js.map +0 -1
- package/lib/summarizerNode/index.d.ts +0 -8
- package/lib/summarizerNode/index.d.ts.map +0 -1
- package/lib/summarizerNode/index.js +0 -7
- package/lib/summarizerNode/index.js.map +0 -1
- package/lib/summarizerNode/summarizerNode.d.ts +0 -139
- package/lib/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNode.js +0 -475
- package/lib/summarizerNode/summarizerNode.js.map +0 -1
- package/lib/summarizerNode/summarizerNodeUtils.d.ts +0 -161
- package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNodeUtils.js +0 -216
- package/lib/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js +0 -289
- package/lib/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/lib/summaryUtils.d.ts.map +0 -1
- package/lib/summaryUtils.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/src/packageVersion.ts +0 -9
- package/src/summarizerNode/index.ts +0 -8
- package/src/summarizerNode/summarizerNode.ts +0 -662
- package/src/summarizerNode/summarizerNodeUtils.ts +0 -339
- package/src/summarizerNode/summarizerNodeWithGc.ts +0 -459
- package/tsconfig.esnext.json +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-dev-rc.1.0.0.224419",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -11,44 +11,32 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
13
|
"sideEffects": false,
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"build:genver": "gen-version",
|
|
26
|
-
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
27
|
-
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
28
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
|
-
"eslint": "eslint --format stylish src",
|
|
30
|
-
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
-
"lint": "npm run eslint",
|
|
32
|
-
"lint:fix": "npm run eslint:fix",
|
|
33
|
-
"test": "npm run test:mocha",
|
|
34
|
-
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
|
-
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
36
|
-
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
|
-
"tsc": "tsc",
|
|
38
|
-
"typetests:gen": "flub generate typetests --generate --dir . --no-generateInName",
|
|
39
|
-
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./lib/index.d.mts",
|
|
18
|
+
"default": "./lib/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
40
25
|
},
|
|
41
|
-
"
|
|
26
|
+
"main": "dist/index.cjs",
|
|
27
|
+
"module": "lib/index.mjs",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"c8": {
|
|
42
30
|
"all": true,
|
|
43
31
|
"cache-dir": "nyc/.cache",
|
|
44
32
|
"exclude": [
|
|
45
|
-
"src/test
|
|
46
|
-
"dist/test
|
|
33
|
+
"src/test/**/*.*ts",
|
|
34
|
+
"dist/test/**/*.*js"
|
|
47
35
|
],
|
|
48
36
|
"exclude-after-remap": false,
|
|
49
37
|
"include": [
|
|
50
|
-
"src
|
|
51
|
-
"dist
|
|
38
|
+
"src/**/*.*ts",
|
|
39
|
+
"dist/**/*.*js"
|
|
52
40
|
],
|
|
53
41
|
"report-dir": "nyc/report",
|
|
54
42
|
"reporter": [
|
|
@@ -59,44 +47,92 @@
|
|
|
59
47
|
"temp-directory": "nyc/.nyc_output"
|
|
60
48
|
},
|
|
61
49
|
"dependencies": {
|
|
62
|
-
"@
|
|
63
|
-
"@fluidframework/
|
|
64
|
-
"@fluidframework/container-definitions": "1.
|
|
65
|
-
"@fluidframework/
|
|
66
|
-
"@fluidframework/core-
|
|
67
|
-
"@fluidframework/datastore-definitions": "1.
|
|
68
|
-
"@fluidframework/
|
|
69
|
-
"@fluidframework/protocol-
|
|
70
|
-
"@fluidframework/
|
|
71
|
-
"@fluidframework/
|
|
72
|
-
"@fluidframework/telemetry-utils": "1.4.0-115997"
|
|
50
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
51
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
52
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
53
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.224419",
|
|
54
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
55
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
56
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
57
|
+
"@fluidframework/protocol-definitions": "^3.1.0-223007",
|
|
58
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
59
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.1.0.0.224419"
|
|
73
60
|
},
|
|
74
61
|
"devDependencies": {
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@fluidframework/
|
|
78
|
-
"@fluidframework/
|
|
79
|
-
"@fluidframework/
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
62
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
63
|
+
"@fluid-tools/build-cli": "0.29.0-222379",
|
|
64
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
65
|
+
"@fluidframework/build-tools": "0.29.0-222379",
|
|
66
|
+
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
67
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.224419",
|
|
68
|
+
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.7.2.0",
|
|
69
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
82
70
|
"@types/mocha": "^9.1.1",
|
|
83
|
-
"@types/node": "^
|
|
84
|
-
"
|
|
85
|
-
"copyfiles": "^2.1
|
|
86
|
-
"cross-env": "^7.0.
|
|
87
|
-
"eslint": "~8.
|
|
88
|
-
"mocha": "^10.
|
|
89
|
-
"
|
|
90
|
-
"
|
|
71
|
+
"@types/node": "^18.19.0",
|
|
72
|
+
"c8": "^7.7.1",
|
|
73
|
+
"copyfiles": "^2.4.1",
|
|
74
|
+
"cross-env": "^7.0.3",
|
|
75
|
+
"eslint": "~8.50.0",
|
|
76
|
+
"mocha": "^10.2.0",
|
|
77
|
+
"mocha-json-output-reporter": "^2.0.1",
|
|
78
|
+
"mocha-multi-reporters": "^1.5.1",
|
|
79
|
+
"moment": "^2.21.0",
|
|
80
|
+
"prettier": "~3.0.3",
|
|
81
|
+
"renamer": "^4.0.0",
|
|
82
|
+
"rimraf": "^4.4.0",
|
|
91
83
|
"sinon": "^7.4.2",
|
|
92
|
-
"ts-node": "^
|
|
93
|
-
"
|
|
94
|
-
"typescript
|
|
84
|
+
"ts-node": "^10.9.1",
|
|
85
|
+
"tsc-multi": "^1.1.0",
|
|
86
|
+
"typescript": "~5.1.6"
|
|
87
|
+
},
|
|
88
|
+
"fluidBuild": {
|
|
89
|
+
"tasks": {
|
|
90
|
+
"build:docs": {
|
|
91
|
+
"dependsOn": [
|
|
92
|
+
"...",
|
|
93
|
+
"api-extractor:commonjs",
|
|
94
|
+
"api-extractor:esnext"
|
|
95
|
+
],
|
|
96
|
+
"script": false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
95
99
|
},
|
|
96
100
|
"typeValidation": {
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
"broken": {
|
|
102
|
+
"RemovedFunctionDeclaration_requestFluidObject": {
|
|
103
|
+
"forwardCompat": false,
|
|
104
|
+
"backCompat": false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"scripts": {
|
|
109
|
+
"api": "fluid-build . --task api",
|
|
110
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
111
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
112
|
+
"build": "fluid-build . --task build",
|
|
113
|
+
"build:commonjs": "fluid-build . --task commonjs",
|
|
114
|
+
"build:compile": "fluid-build . --task compile",
|
|
115
|
+
"build:docs": "fluid-build . --task api",
|
|
116
|
+
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
117
|
+
"build:rename-types": "renamer \"lib/**\" -f .d.ts -r .d.mts --force",
|
|
118
|
+
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
119
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
120
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
121
|
+
"ci:build:docs": "api-extractor run",
|
|
122
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
123
|
+
"eslint": "eslint --format stylish src",
|
|
124
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
125
|
+
"format": "npm run prettier:fix",
|
|
126
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
127
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
128
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
129
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
130
|
+
"test": "npm run test:mocha",
|
|
131
|
+
"test:coverage": "c8 npm test",
|
|
132
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
133
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
134
|
+
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
|
|
135
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
136
|
+
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
101
137
|
}
|
|
102
|
-
}
|
|
138
|
+
}
|
|
@@ -10,22 +10,30 @@ 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
|
-
export function generateHandleContextPath(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
export function generateHandleContextPath(
|
|
16
|
+
path: string,
|
|
17
|
+
routeContext?: IFluidHandleContext,
|
|
18
|
+
): string {
|
|
19
|
+
if (path === "") {
|
|
20
|
+
// The `path` is empty.
|
|
21
|
+
// If the routeContext does not exist, this is the root.
|
|
22
|
+
// If the routeContext exists, the absolute path is the same as that of the routeContext.
|
|
23
|
+
return routeContext === undefined ? "" : routeContext.absolutePath;
|
|
24
|
+
} else {
|
|
25
|
+
// Remove beginning and trailing slashes, if any, from the path.
|
|
26
|
+
let normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
27
|
+
normalizedPath = normalizedPath.endsWith("/")
|
|
28
|
+
? normalizedPath.slice(0, -1)
|
|
29
|
+
: normalizedPath;
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
// If the routeContext does not exist, path is the absolute path.
|
|
32
|
+
// If the routeContext exists, absolute path is routeContext's absolute path plus the path.
|
|
33
|
+
return routeContext === undefined
|
|
34
|
+
? `/${normalizedPath}`
|
|
35
|
+
: `${
|
|
36
|
+
routeContext.absolutePath === "/" ? "" : routeContext.absolutePath
|
|
37
|
+
}/${normalizedPath}`;
|
|
38
|
+
}
|
|
31
39
|
}
|
package/src/dataStoreHelpers.ts
CHANGED
|
@@ -3,106 +3,129 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/
|
|
6
|
+
import { assert } from "@fluidframework/core-utils";
|
|
7
|
+
import { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
IResponse,
|
|
12
|
-
} from "@fluidframework/core-interfaces";
|
|
13
|
-
import {
|
|
14
|
-
IFluidDataStoreFactory,
|
|
15
|
-
IFluidDataStoreRegistry,
|
|
16
|
-
IProvideFluidDataStoreRegistry,
|
|
9
|
+
IFluidDataStoreFactory,
|
|
10
|
+
IFluidDataStoreRegistry,
|
|
11
|
+
IProvideFluidDataStoreRegistry,
|
|
17
12
|
} from "@fluidframework/runtime-definitions";
|
|
18
13
|
import { generateErrorWithStack } from "@fluidframework/telemetry-utils";
|
|
19
14
|
|
|
20
15
|
interface IResponseException extends Error {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
errorFromRequestFluidObject: true;
|
|
17
|
+
message: string;
|
|
18
|
+
code: number;
|
|
19
|
+
stack?: string;
|
|
20
|
+
underlyingResponseHeaders?: { [key: string]: any };
|
|
25
21
|
}
|
|
26
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
27
26
|
export function exceptionToResponse(err: any): IResponse {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
const status = 500;
|
|
28
|
+
if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
|
|
29
|
+
const responseErr: IResponseException = err;
|
|
30
|
+
return {
|
|
31
|
+
mimeType: "text/plain",
|
|
32
|
+
status: responseErr.code,
|
|
33
|
+
value: responseErr.message,
|
|
34
|
+
get stack() {
|
|
35
|
+
return responseErr.stack;
|
|
36
|
+
},
|
|
37
|
+
headers: responseErr.underlyingResponseHeaders,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
|
|
42
|
+
const errWithStack = generateErrorWithStack();
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
mimeType: "text/plain",
|
|
46
|
+
status,
|
|
47
|
+
value: `${err}`,
|
|
48
|
+
get stack() {
|
|
49
|
+
return (err?.stack as string | undefined) ?? errWithStack.stack;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
50
57
|
export function responseToException(response: IResponse, request: IRequest): Error {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
router: IFluidRouter, url: string | IRequest): Promise<T> {
|
|
66
|
-
const request = typeof url === "string" ? { url } : url;
|
|
67
|
-
const response = await router.request(request);
|
|
68
|
-
|
|
69
|
-
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
70
|
-
throw responseToException(response, request);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
assert(response.value, 0x19a /* "Invalid response value for Fluid object request" */);
|
|
74
|
-
return response.value as T;
|
|
58
|
+
const message = response.value;
|
|
59
|
+
const errWithStack = generateErrorWithStack();
|
|
60
|
+
const responseErr: Error & IResponseException = {
|
|
61
|
+
errorFromRequestFluidObject: true,
|
|
62
|
+
message,
|
|
63
|
+
name: "Error",
|
|
64
|
+
code: response.status,
|
|
65
|
+
get stack() {
|
|
66
|
+
return response.stack ?? errWithStack.stack;
|
|
67
|
+
},
|
|
68
|
+
underlyingResponseHeaders: response.headers,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return responseErr;
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const urlNoQuery = request.url?.split("?")[0];
|
|
83
|
-
|
|
84
|
-
// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
|
|
85
|
-
const errWithStack = generateErrorWithStack();
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export const create404Response = (request: IRequest) =>
|
|
78
|
+
createResponseError(404, "not found", request);
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export function createResponseError(
|
|
84
|
+
status: number,
|
|
85
|
+
value: string,
|
|
86
|
+
request: IRequest,
|
|
87
|
+
headers?: { [key: string]: any },
|
|
88
|
+
): IResponse {
|
|
89
|
+
assert(status !== 200, 0x19b /* "Cannot not create response error on 200 status" */);
|
|
90
|
+
// Omit query string which could contain personal data unfit for logging
|
|
91
|
+
const urlNoQuery = request.url?.split("?")[0];
|
|
92
|
+
|
|
93
|
+
// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
|
|
94
|
+
const errWithStack = generateErrorWithStack();
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
mimeType: "text/plain",
|
|
98
|
+
status,
|
|
99
|
+
value: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,
|
|
100
|
+
get stack() {
|
|
101
|
+
return errWithStack.stack;
|
|
102
|
+
},
|
|
103
|
+
headers,
|
|
104
|
+
};
|
|
93
105
|
}
|
|
94
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
95
110
|
export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
96
111
|
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
97
115
|
export function createDataStoreFactory(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
type: string,
|
|
117
|
+
factory: Factory | Promise<Factory>,
|
|
118
|
+
): IFluidDataStoreFactory & IFluidDataStoreRegistry {
|
|
119
|
+
return {
|
|
120
|
+
type,
|
|
121
|
+
get IFluidDataStoreFactory() {
|
|
122
|
+
return this;
|
|
123
|
+
},
|
|
124
|
+
get IFluidDataStoreRegistry() {
|
|
125
|
+
return this;
|
|
126
|
+
},
|
|
127
|
+
instantiateDataStore: async (context, existing) =>
|
|
128
|
+
(await factory).instantiateDataStore(context, existing),
|
|
129
|
+
get: async (name: string) => (await factory).IFluidDataStoreRegistry?.get(name),
|
|
130
|
+
};
|
|
108
131
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,12 +3,34 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export { generateHandleContextPath } from "./dataStoreHandleContextUtils";
|
|
7
|
+
export {
|
|
8
|
+
create404Response,
|
|
9
|
+
createDataStoreFactory,
|
|
10
|
+
createResponseError,
|
|
11
|
+
exceptionToResponse,
|
|
12
|
+
Factory,
|
|
13
|
+
responseToException,
|
|
14
|
+
} from "./dataStoreHelpers";
|
|
15
|
+
export { ObjectStoragePartition } from "./objectstoragepartition";
|
|
16
|
+
export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils";
|
|
17
|
+
export { RequestParser } from "./requestParser";
|
|
18
|
+
export { RuntimeFactoryHelper } from "./runtimeFactoryHelper";
|
|
19
|
+
export {
|
|
20
|
+
addBlobToSummary,
|
|
21
|
+
addSummarizeResultToSummary,
|
|
22
|
+
addTreeToSummary,
|
|
23
|
+
calculateStats,
|
|
24
|
+
convertSnapshotTreeToSummaryTree,
|
|
25
|
+
convertSummaryTreeToITree,
|
|
26
|
+
convertToSummaryTree,
|
|
27
|
+
convertToSummaryTreeWithStats,
|
|
28
|
+
GCDataBuilder,
|
|
29
|
+
getBlobSize,
|
|
30
|
+
mergeStats,
|
|
31
|
+
SummaryTreeBuilder,
|
|
32
|
+
TelemetryContext,
|
|
33
|
+
utf8ByteLength,
|
|
34
|
+
} from "./summaryUtils";
|
|
35
|
+
export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes";
|
|
36
|
+
export { ReadAndParseBlob, seqFromTree } from "./utils";
|
|
@@ -3,27 +3,31 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/
|
|
6
|
+
import { assert } from "@fluidframework/core-utils";
|
|
7
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly storage: IChannelStorageService,
|
|
16
|
+
private readonly path: string,
|
|
17
|
+
) {
|
|
18
|
+
// `path` must not include the trailing separator.
|
|
19
|
+
assert(!path.endsWith("/"), 0x19c /* "storage service path has trailing separator" */);
|
|
20
|
+
}
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
public async readBlob(path: string): Promise<ArrayBufferLike> {
|
|
23
|
+
return this.storage.readBlob(`${this.path}/${path}`);
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
public async contains(path: string): Promise<boolean> {
|
|
27
|
+
return this.storage.contains(`${this.path}/${path}`);
|
|
28
|
+
}
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
public async list(path: string): Promise<string[]> {
|
|
31
|
+
return this.storage.list(`${this.path}/${path}`);
|
|
32
|
+
}
|
|
29
33
|
}
|
|
@@ -5,44 +5,45 @@
|
|
|
5
5
|
|
|
6
6
|
import { ITree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export function getNormalizedObjectStoragePathParts(path: string) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
let normalizePath = path;
|
|
13
|
+
if (normalizePath.startsWith("/")) {
|
|
14
|
+
normalizePath = normalizePath.substr(1);
|
|
15
|
+
}
|
|
16
|
+
if (normalizePath.endsWith("/")) {
|
|
17
|
+
normalizePath = normalizePath.substr(0, normalizePath.length - 1);
|
|
18
|
+
}
|
|
19
|
+
if (normalizePath.length > 0) {
|
|
20
|
+
return normalizePath.split("/");
|
|
21
|
+
}
|
|
22
|
+
return [];
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export async function listBlobsAtTreePath(
|
|
29
|
+
inputTree: ITree | undefined,
|
|
30
|
+
path: string,
|
|
31
|
+
): Promise<string[]> {
|
|
32
|
+
const pathParts = getNormalizedObjectStoragePathParts(path);
|
|
33
|
+
let tree: ITree | undefined = inputTree;
|
|
34
|
+
while (tree?.entries !== undefined && pathParts.length > 0) {
|
|
35
|
+
const part = pathParts.shift();
|
|
36
|
+
const treeEntry = tree.entries.find((value) => {
|
|
37
|
+
return value.type === "Tree" && value.path === part ? true : false;
|
|
38
|
+
});
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (tree?.entries === undefined || pathParts.length !== 0) {
|
|
45
|
-
throw new Error("path does not exist");
|
|
46
|
-
}
|
|
47
|
-
return tree.entries.filter((e) => e.type === "Blob").map((e) => e.path);
|
|
40
|
+
// this check is largely superfluous due to the same check being done
|
|
41
|
+
// immediately above. the type system, however, is not aware of this.
|
|
42
|
+
// so we must redundantly determine that the entry's type is "Tree"
|
|
43
|
+
tree = treeEntry?.type === "Tree" ? treeEntry.value : undefined;
|
|
44
|
+
}
|
|
45
|
+
if (tree?.entries === undefined || pathParts.length !== 0) {
|
|
46
|
+
throw new Error("path does not exist");
|
|
47
|
+
}
|
|
48
|
+
return tree.entries.filter((e) => e.type === "Blob").map((e) => e.path);
|
|
48
49
|
}
|