@fluidframework/driver-utils 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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 +17 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/fluidResolvedUrl.d.ts +8 -0
- package/dist/fluidResolvedUrl.d.ts.map +1 -1
- package/dist/fluidResolvedUrl.js +8 -0
- package/dist/fluidResolvedUrl.js.map +1 -1
- package/dist/index.d.ts +4 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -19
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +2 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +0 -20
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +1 -37
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +0 -15
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +4 -3
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +0 -10
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +3 -35
- package/dist/networkUtils.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/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +52 -23
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +10 -0
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +21 -1
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js +26 -1
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +6 -10
- package/dist/treeConversions.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/fluidResolvedUrl.d.ts +8 -0
- package/lib/fluidResolvedUrl.d.ts.map +1 -1
- package/lib/fluidResolvedUrl.js +8 -0
- package/lib/fluidResolvedUrl.js.map +1 -1
- package/lib/index.d.ts +4 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -9
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +2 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +0 -20
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +1 -36
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +0 -15
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +4 -3
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +0 -10
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +2 -33
- package/lib/networkUtils.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/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +53 -24
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts.map +1 -1
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +10 -0
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +21 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +24 -0
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +9 -13
- package/lib/treeConversions.js.map +1 -1
- package/package.json +54 -52
- package/prettier.config.cjs +1 -1
- package/src/buildSnapshotTree.ts +54 -51
- package/src/documentStorageServiceProxy.ts +49 -43
- package/src/error.ts +5 -7
- package/src/fluidResolvedUrl.ts +17 -6
- package/src/index.ts +4 -14
- package/src/insecureUrlResolver.ts +127 -116
- package/src/messageRecognition.ts +14 -44
- package/src/network.ts +112 -126
- package/src/networkUtils.ts +19 -48
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +591 -510
- package/src/prefetchDocumentStorageService.ts +76 -74
- package/src/rateLimiter.ts +29 -29
- package/src/readAndParse.ts +7 -4
- package/src/runWithRetry.ts +106 -84
- package/src/summaryForCreateNew.ts +74 -25
- package/src/treeConversions.ts +47 -70
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
- package/dist/blobAggregationStorage.d.ts +0 -43
- package/dist/blobAggregationStorage.d.ts.map +0 -1
- package/dist/blobAggregationStorage.js +0 -318
- package/dist/blobAggregationStorage.js.map +0 -1
- package/dist/blobCacheStorageService.d.ts +0 -16
- package/dist/blobCacheStorageService.d.ts.map +0 -1
- package/dist/blobCacheStorageService.js +0 -29
- package/dist/blobCacheStorageService.js.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +0 -13
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.js +0 -20
- package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
- package/dist/multiDocumentServiceFactory.d.ts +0 -16
- package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
- package/dist/multiDocumentServiceFactory.js +0 -63
- package/dist/multiDocumentServiceFactory.js.map +0 -1
- package/dist/multiUrlResolver.d.ts +0 -20
- package/dist/multiUrlResolver.d.ts.map +0 -1
- package/dist/multiUrlResolver.js +0 -45
- package/dist/multiUrlResolver.js.map +0 -1
- package/dist/treeUtils.d.ts +0 -51
- package/dist/treeUtils.d.ts.map +0 -1
- package/dist/treeUtils.js +0 -85
- package/dist/treeUtils.js.map +0 -1
- package/lib/blobAggregationStorage.d.ts +0 -43
- package/lib/blobAggregationStorage.d.ts.map +0 -1
- package/lib/blobAggregationStorage.js +0 -313
- package/lib/blobAggregationStorage.js.map +0 -1
- package/lib/blobCacheStorageService.d.ts +0 -16
- package/lib/blobCacheStorageService.d.ts.map +0 -1
- package/lib/blobCacheStorageService.js +0 -25
- package/lib/blobCacheStorageService.js.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +0 -13
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.js +0 -16
- package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
- package/lib/multiDocumentServiceFactory.d.ts +0 -16
- package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
- package/lib/multiDocumentServiceFactory.js +0 -59
- package/lib/multiDocumentServiceFactory.js.map +0 -1
- package/lib/multiUrlResolver.d.ts +0 -20
- package/lib/multiUrlResolver.d.ts.map +0 -1
- package/lib/multiUrlResolver.js +0 -40
- package/lib/multiUrlResolver.js.map +0 -1
- package/lib/treeUtils.d.ts +0 -51
- package/lib/treeUtils.d.ts.map +0 -1
- package/lib/treeUtils.js +0 -80
- package/lib/treeUtils.js.map +0 -1
- package/src/blobAggregationStorage.ts +0 -374
- package/src/blobCacheStorageService.ts +0 -32
- package/src/emptyDocumentDeltaStorageService.ts +0 -24
- package/src/multiDocumentServiceFactory.ts +0 -80
- package/src/multiUrlResolver.ts +0 -51
- package/src/treeUtils.ts +0 -111
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.4.1.0.148229",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -14,33 +14,6 @@
|
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
19
|
-
"build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
|
|
20
|
-
"build:compile": "concurrently npm:build:commonjs npm:build:esnext",
|
|
21
|
-
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
22
|
-
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
23
|
-
"build:full": "npm run build",
|
|
24
|
-
"build:full:compile": "npm run build:compile",
|
|
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
|
-
"format": "npm run prettier:fix",
|
|
32
|
-
"lint": "npm run eslint",
|
|
33
|
-
"lint:fix": "npm run eslint:fix",
|
|
34
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
35
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
36
|
-
"test": "npm run test:mocha",
|
|
37
|
-
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
38
|
-
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
39
|
-
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
40
|
-
"tsc": "tsc",
|
|
41
|
-
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
42
|
-
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
43
|
-
},
|
|
44
17
|
"nyc": {
|
|
45
18
|
"all": true,
|
|
46
19
|
"cache-dir": "nyc/.cache",
|
|
@@ -63,43 +36,72 @@
|
|
|
63
36
|
},
|
|
64
37
|
"dependencies": {
|
|
65
38
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
66
|
-
"@fluidframework/common-utils": "^1.
|
|
67
|
-
"@fluidframework/core-interfaces": "
|
|
68
|
-
"@fluidframework/driver-definitions": "
|
|
69
|
-
"@fluidframework/gitresources": "^0.
|
|
70
|
-
"@fluidframework/protocol-base": "^0.
|
|
39
|
+
"@fluidframework/common-utils": "^1.1.1",
|
|
40
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.4.1.0.148229",
|
|
41
|
+
"@fluidframework/driver-definitions": "2.0.0-dev.4.1.0.148229",
|
|
42
|
+
"@fluidframework/gitresources": "^0.1039.1000",
|
|
43
|
+
"@fluidframework/protocol-base": "^0.1039.1000",
|
|
71
44
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
72
|
-
"@fluidframework/telemetry-utils": "
|
|
45
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.4.1.0.148229",
|
|
73
46
|
"axios": "^0.26.0",
|
|
74
47
|
"url": "^0.11.0",
|
|
75
48
|
"uuid": "^8.3.1"
|
|
76
49
|
},
|
|
77
50
|
"devDependencies": {
|
|
78
|
-
"@fluid-tools/build-cli": "^0.
|
|
51
|
+
"@fluid-tools/build-cli": "^0.13.1",
|
|
79
52
|
"@fluidframework/build-common": "^1.1.0",
|
|
80
|
-
"@fluidframework/build-tools": "^0.
|
|
81
|
-
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.
|
|
82
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
83
|
-
"@fluidframework/mocha-test-setup": "
|
|
84
|
-
"@fluidframework/runtime-utils": "
|
|
85
|
-
"@microsoft/api-extractor": "^7.
|
|
86
|
-
"@rushstack/eslint-config": "^2.5.1",
|
|
53
|
+
"@fluidframework/build-tools": "^0.13.1",
|
|
54
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.4.0.0",
|
|
55
|
+
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
56
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.4.1.0.148229",
|
|
57
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.4.1.0.148229",
|
|
58
|
+
"@microsoft/api-extractor": "^7.34.4",
|
|
87
59
|
"@types/mocha": "^9.1.1",
|
|
88
|
-
"@types/node": "^14.18.
|
|
89
|
-
"
|
|
60
|
+
"@types/node": "^14.18.38",
|
|
61
|
+
"@types/sinon": "^7.0.13",
|
|
62
|
+
"concurrently": "^7.6.0",
|
|
90
63
|
"copyfiles": "^2.4.1",
|
|
91
|
-
"cross-env": "^7.0.
|
|
64
|
+
"cross-env": "^7.0.3",
|
|
92
65
|
"eslint": "~8.6.0",
|
|
93
|
-
"mocha": "^10.
|
|
94
|
-
"
|
|
66
|
+
"mocha": "^10.2.0",
|
|
67
|
+
"mocha-json-output-reporter": "^2.0.1",
|
|
68
|
+
"mocha-multi-reporters": "^1.5.1",
|
|
69
|
+
"moment": "^2.21.0",
|
|
70
|
+
"nyc": "^15.1.0",
|
|
95
71
|
"prettier": "~2.6.2",
|
|
96
|
-
"rimraf": "^
|
|
72
|
+
"rimraf": "^4.4.0",
|
|
73
|
+
"sinon": "^7.4.2",
|
|
97
74
|
"typescript": "~4.5.5"
|
|
98
75
|
},
|
|
99
76
|
"typeValidation": {
|
|
100
|
-
"version": "2.0.0-internal.2.3.0",
|
|
101
|
-
"baselineRange": ">=2.0.0-internal.2.2.0 <2.0.0-internal.2.3.0",
|
|
102
|
-
"baselineVersion": "2.0.0-internal.2.2.0",
|
|
103
77
|
"broken": {}
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
81
|
+
"build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
|
|
82
|
+
"build:compile": "concurrently npm:build:commonjs npm:build:esnext",
|
|
83
|
+
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
84
|
+
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
85
|
+
"build:full": "npm run build",
|
|
86
|
+
"build:full:compile": "npm run build:compile",
|
|
87
|
+
"build:genver": "gen-version",
|
|
88
|
+
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
89
|
+
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
90
|
+
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
91
|
+
"eslint": "eslint --format stylish src",
|
|
92
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
93
|
+
"format": "npm run prettier:fix",
|
|
94
|
+
"lint": "npm run prettier && npm run eslint",
|
|
95
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
96
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
97
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
98
|
+
"test": "npm run test:mocha",
|
|
99
|
+
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
100
|
+
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
101
|
+
"test:mocha:multireport": "cross-env FLUID_TEST_MULTIREPORT=1 npm run test:mocha",
|
|
102
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
103
|
+
"tsc": "tsc",
|
|
104
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
105
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
104
106
|
}
|
|
105
|
-
}
|
|
107
|
+
}
|
package/prettier.config.cjs
CHANGED
package/src/buildSnapshotTree.ts
CHANGED
|
@@ -6,57 +6,60 @@
|
|
|
6
6
|
import { assert, stringToBuffer } from "@fluidframework/common-utils";
|
|
7
7
|
import * as git from "@fluidframework/gitresources";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
FileMode,
|
|
10
|
+
ISnapshotTree,
|
|
11
|
+
ITreeEntry,
|
|
12
|
+
TreeEntry,
|
|
13
13
|
} from "@fluidframework/protocol-definitions";
|
|
14
14
|
import { buildHierarchy } from "@fluidframework/protocol-base";
|
|
15
15
|
import { v4 as uuid } from "uuid";
|
|
16
16
|
|
|
17
17
|
function flattenCore(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
path: string,
|
|
19
|
+
treeEntries: ITreeEntry[],
|
|
20
|
+
blobMap: Map<string, ArrayBufferLike>,
|
|
21
21
|
): git.ITreeEntry[] {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const entries: git.ITreeEntry[] = [];
|
|
23
|
+
for (const treeEntry of treeEntries) {
|
|
24
|
+
const subPath = `${path}${treeEntry.path}`;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (treeEntry.type === TreeEntry.Blob) {
|
|
27
|
+
const blob = treeEntry.value;
|
|
28
|
+
const buffer = stringToBuffer(blob.contents, blob.encoding);
|
|
29
|
+
const id = uuid();
|
|
30
|
+
blobMap.set(id, buffer);
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
const entry: git.ITreeEntry = {
|
|
33
|
+
mode: FileMode[treeEntry.mode],
|
|
34
|
+
path: subPath,
|
|
35
|
+
sha: id,
|
|
36
|
+
size: 0,
|
|
37
|
+
type: "blob",
|
|
38
|
+
url: "",
|
|
39
|
+
};
|
|
40
|
+
entries.push(entry);
|
|
41
|
+
} else if (treeEntry.type === TreeEntry.Tree) {
|
|
42
|
+
assert(
|
|
43
|
+
treeEntry.type === TreeEntry.Tree,
|
|
44
|
+
0x101 /* "Unexpected tree entry type on flatten!" */,
|
|
45
|
+
);
|
|
46
|
+
const t = treeEntry.value;
|
|
47
|
+
const entry: git.ITreeEntry = {
|
|
48
|
+
mode: FileMode[treeEntry.mode],
|
|
49
|
+
path: subPath,
|
|
50
|
+
sha: "",
|
|
51
|
+
size: -1,
|
|
52
|
+
type: "tree",
|
|
53
|
+
url: "",
|
|
54
|
+
};
|
|
55
|
+
entries.push(entry);
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
const subTreeEntries = flattenCore(`${subPath}/`, t.entries, blobMap);
|
|
58
|
+
entries.push(...subTreeEntries);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
return entries;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
/**
|
|
@@ -67,12 +70,12 @@ function flattenCore(
|
|
|
67
70
|
* @returns A flatten with of the ITreeEntry
|
|
68
71
|
*/
|
|
69
72
|
function flatten(tree: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): git.ITree {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const entries = flattenCore("", tree, blobMap);
|
|
74
|
+
return {
|
|
75
|
+
sha: "",
|
|
76
|
+
tree: entries,
|
|
77
|
+
url: "",
|
|
78
|
+
};
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
/**
|
|
@@ -84,9 +87,9 @@ function flatten(tree: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): git
|
|
|
84
87
|
* @returns the hierarchical tree
|
|
85
88
|
*/
|
|
86
89
|
export function buildSnapshotTree(
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
entries: ITreeEntry[],
|
|
91
|
+
blobMap: Map<string, ArrayBufferLike>,
|
|
89
92
|
): ISnapshotTree {
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
const flattened = flatten(entries, blobMap);
|
|
94
|
+
return buildHierarchy(flattened);
|
|
92
95
|
}
|
|
@@ -4,62 +4,68 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
FetchSource,
|
|
8
|
+
IDocumentStorageService,
|
|
9
|
+
IDocumentStorageServicePolicies,
|
|
10
|
+
ISummaryContext,
|
|
11
11
|
} from "@fluidframework/driver-definitions";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
ICreateBlobResponse,
|
|
14
|
+
ISnapshotTree,
|
|
15
|
+
ISummaryHandle,
|
|
16
|
+
ISummaryTree,
|
|
17
|
+
IVersion,
|
|
18
18
|
} from "@fluidframework/protocol-definitions";
|
|
19
19
|
|
|
20
20
|
export class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
21
|
-
|
|
21
|
+
private _policies: IDocumentStorageServicePolicies | undefined;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
public set policies(policies: IDocumentStorageServicePolicies | undefined) {
|
|
24
|
+
this._policies = policies;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
public get policies() {
|
|
28
|
+
return this._policies ?? this.internalStorageService.policies;
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
public get repositoryUrl(): string {
|
|
32
|
+
return this.internalStorageService.repositoryUrl;
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
constructor(protected readonly internalStorageService: IDocumentStorageService) {}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
public async getSnapshotTree(
|
|
38
|
+
version?: IVersion,
|
|
39
|
+
scenarioName?: string,
|
|
40
|
+
): Promise<ISnapshotTree | null> {
|
|
41
|
+
return this.internalStorageService.getSnapshotTree(version, scenarioName);
|
|
42
|
+
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
public async getVersions(
|
|
45
|
+
versionId: string | null,
|
|
46
|
+
count: number,
|
|
47
|
+
scenarioName?: string,
|
|
48
|
+
fetchSource?: FetchSource,
|
|
49
|
+
): Promise<IVersion[]> {
|
|
50
|
+
return this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);
|
|
51
|
+
}
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
public async uploadSummaryWithContext(
|
|
54
|
+
summary: ISummaryTree,
|
|
55
|
+
context: ISummaryContext,
|
|
56
|
+
): Promise<string> {
|
|
57
|
+
return this.internalStorageService.uploadSummaryWithContext(summary, context);
|
|
58
|
+
}
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
|
|
61
|
+
return this.internalStorageService.downloadSummary(handle);
|
|
62
|
+
}
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
65
|
+
return this.internalStorageService.createBlob(file);
|
|
66
|
+
}
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
public async readBlob(blobId: string): Promise<ArrayBufferLike> {
|
|
69
|
+
return this.internalStorageService.readBlob(blobId);
|
|
70
|
+
}
|
|
65
71
|
}
|
package/src/error.ts
CHANGED
|
@@ -8,12 +8,10 @@ import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
|
8
8
|
|
|
9
9
|
/** Error indicating an API is being used improperly resulting in an invalid operation. */
|
|
10
10
|
export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
readonly errorType = DriverErrorType.usageError;
|
|
12
|
+
readonly canRetry = false;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
super(message, { usageError: true });
|
|
18
|
-
}
|
|
14
|
+
constructor(message: string) {
|
|
15
|
+
super(message, { usageError: true });
|
|
16
|
+
}
|
|
19
17
|
}
|
package/src/fluidResolvedUrl.ts
CHANGED
|
@@ -5,11 +5,22 @@
|
|
|
5
5
|
|
|
6
6
|
import { IResolvedUrl, IFluidResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
|
|
10
|
+
* so this method is no longer necessary.
|
|
11
|
+
*/
|
|
12
|
+
export const isFluidResolvedUrl = (
|
|
13
|
+
resolved: IResolvedUrl | undefined,
|
|
14
|
+
): resolved is IFluidResolvedUrl => resolved?.type === "fluid";
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated In the next major release all IResolvedUrl will be IFluidResolvedUrl,
|
|
18
|
+
* so this method is no longer necessary.
|
|
19
|
+
*/
|
|
20
|
+
export function ensureFluidResolvedUrl(
|
|
21
|
+
resolved: IResolvedUrl | undefined,
|
|
22
|
+
): asserts resolved is IFluidResolvedUrl {
|
|
23
|
+
if (!isFluidResolvedUrl(resolved)) {
|
|
24
|
+
throw new Error(`resolved is not a Fluid url. Type: ${resolved?.type}`);
|
|
25
|
+
}
|
|
15
26
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,22 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { BlobAggregationStorage, SnapshotExtractor } from "./blobAggregationStorage";
|
|
7
|
-
export { BlobCacheStorageService } from "./blobCacheStorageService";
|
|
8
6
|
export { buildSnapshotTree } from "./buildSnapshotTree";
|
|
9
7
|
export { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
10
|
-
export { EmptyDocumentDeltaStorageService } from "./emptyDocumentDeltaStorageService";
|
|
11
8
|
export { UsageError } from "./error";
|
|
12
9
|
export { ensureFluidResolvedUrl, isFluidResolvedUrl } from "./fluidResolvedUrl";
|
|
13
10
|
export { InsecureUrlResolver } from "./insecureUrlResolver";
|
|
14
|
-
export {
|
|
15
|
-
canBeCoalescedByService,
|
|
16
|
-
isRuntimeMessage,
|
|
17
|
-
isUnpackedRuntimeMessage,
|
|
18
|
-
MessageType2,
|
|
19
|
-
} from "./messageRecognition";
|
|
20
|
-
export { MultiDocumentServiceFactory } from "./multiDocumentServiceFactory";
|
|
21
|
-
export { configurableUrlResolver, MultiUrlResolver } from "./multiUrlResolver";
|
|
11
|
+
export { canBeCoalescedByService, isRuntimeMessage, MessageType2 } from "./messageRecognition";
|
|
22
12
|
export {
|
|
23
13
|
AuthorizationError,
|
|
24
14
|
canRetryOnError,
|
|
@@ -30,7 +20,6 @@ export {
|
|
|
30
20
|
GenericNetworkError,
|
|
31
21
|
getRetryDelayFromError,
|
|
32
22
|
getRetryDelaySecondsFromError,
|
|
33
|
-
IAnyDriverError,
|
|
34
23
|
isOnline,
|
|
35
24
|
LocationRedirectionError,
|
|
36
25
|
NetworkErrorBasic,
|
|
@@ -39,7 +28,7 @@ export {
|
|
|
39
28
|
RetryableError,
|
|
40
29
|
ThrottlingError,
|
|
41
30
|
} from "./network";
|
|
42
|
-
export { logNetworkFailure
|
|
31
|
+
export { logNetworkFailure } from "./networkUtils";
|
|
43
32
|
export {
|
|
44
33
|
emptyMessageStream,
|
|
45
34
|
ParallelRequests,
|
|
@@ -54,8 +43,9 @@ export { readAndParse } from "./readAndParse";
|
|
|
54
43
|
export { IProgress, runWithRetry } from "./runWithRetry";
|
|
55
44
|
export {
|
|
56
45
|
combineAppAndProtocolSummary,
|
|
46
|
+
CombinedAppAndProtocolSummary,
|
|
57
47
|
getDocAttributesFromProtocolSummary,
|
|
58
48
|
getQuorumValuesFromProtocolSummary,
|
|
49
|
+
isCombinedAppAndProtocolSummary,
|
|
59
50
|
} from "./summaryForCreateNew";
|
|
60
51
|
export { convertSummaryTreeToSnapshotITree } from "./treeConversions";
|
|
61
|
-
export { convertSnapshotAndBlobsToSummaryTree, ISummaryTreeAssemblerProps, SummaryTreeAssembler } from "./treeUtils";
|