@fluidframework/odsp-driver 0.58.3000-61081 → 0.59.2000-61729
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/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +1 -2
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/createNewUtils.js +0 -1
- package/dist/createNewUtils.js.map +1 -1
- package/dist/fetchSnapshot.js +1 -1
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +0 -6
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +9 -58
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +2 -6
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +12 -9
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +2 -6
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +12 -9
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +1 -5
- package/dist/odspSnapshotParser.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/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js +1 -2
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/createNewUtils.js +0 -1
- package/lib/createNewUtils.js.map +1 -1
- package/lib/fetchSnapshot.js +1 -1
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +0 -6
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +9 -58
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts +2 -6
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +10 -7
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +2 -6
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js +10 -7
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts.map +1 -1
- package/lib/odspSnapshotParser.js +1 -5
- package/lib/odspSnapshotParser.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/package.json +15 -15
- package/src/compactSnapshotParser.ts +4 -3
- package/src/createNewUtils.ts +0 -1
- package/src/fetchSnapshot.ts +1 -1
- package/src/odspDocumentStorageManager.ts +10 -64
- package/src/odspDriverUrlResolver.ts +11 -8
- package/src/odspDriverUrlResolverForShareLink.ts +11 -8
- package/src/odspSnapshotParser.ts +1 -4
- package/src/packageVersion.ts +1 -1
|
@@ -13,7 +13,7 @@ import { assert, stringToBuffer } from "@fluidframework/common-utils";
|
|
|
13
13
|
function buildHierarchy(flatTree) {
|
|
14
14
|
const lookup = {};
|
|
15
15
|
// id is required for root tree as it will be used to determine the version we loaded from.
|
|
16
|
-
const root = { id: flatTree.id, blobs: {},
|
|
16
|
+
const root = { id: flatTree.id, blobs: {}, trees: {} };
|
|
17
17
|
lookup[""] = root;
|
|
18
18
|
for (const entry of flatTree.entries) {
|
|
19
19
|
const lastIndex = entry.path.lastIndexOf("/");
|
|
@@ -25,7 +25,6 @@ function buildHierarchy(flatTree) {
|
|
|
25
25
|
if (entry.type === "tree") {
|
|
26
26
|
const newTree = {
|
|
27
27
|
blobs: {},
|
|
28
|
-
commits: {},
|
|
29
28
|
trees: {},
|
|
30
29
|
unreferenced: entry.unreferenced,
|
|
31
30
|
};
|
|
@@ -35,9 +34,6 @@ function buildHierarchy(flatTree) {
|
|
|
35
34
|
else if (entry.type === "blob") {
|
|
36
35
|
node.blobs[decodeURIComponent(entryPathBase)] = entry.id;
|
|
37
36
|
}
|
|
38
|
-
else if (entry.type === "commit") {
|
|
39
|
-
node.commits[decodeURIComponent(entryPathBase)] = entry.id;
|
|
40
|
-
}
|
|
41
37
|
}
|
|
42
38
|
return root;
|
|
43
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspSnapshotParser.js","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKtE;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACjD,MAAM,MAAM,GAA0C,EAAE,CAAC;IACzD,2FAA2F;IAC3F,MAAM,IAAI,GAAsB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"odspSnapshotParser.js","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKtE;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACjD,MAAM,MAAM,GAA0C,EAAE,CAAC;IACzD,2FAA2F;IAC3F,MAAM,IAAI,GAAsB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC1E,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE;QAClC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAEtD,sGAAsG;QACtG,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAElC,iCAAiC;QACjC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;YACvB,MAAM,OAAO,GAAsB;gBAC/B,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,EAAE;gBACT,YAAY,EAAE,KAAK,CAAC,YAAY;aACnC,CAAC;YACF,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,GAAG,OAAO,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;SAChC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;YAC9B,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;SAC5D;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yCAAyC,CACrD,YAA2B;;IAE3B,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9D,IAAI,YAAY,CAAC,KAAK,EAAE;QACpB,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;YAChC,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAC5D,KAAK,CAAC,yDAAyD,CAAC,CAAC;YACrE,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,QAAE,IAAI,CAAC,QAAQ,mCAAI,MAAM,CAAC,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;KACN;IACD,MAAM,GAAG,GAAsB;QAC3B,KAAK,EAAE,sBAAsB;QAC7B,GAAG,cAAE,YAAY,CAAC,GAAG,0CAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,oCAAK,EAAE;QAC/C,cAAc,EAAE,YAAY,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc;QAC5E,YAAY,EAAE,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtD,CAAC;IACF,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, stringToBuffer } from \"@fluidframework/common-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { IOdspSnapshot, IOdspSnapshotCommit } from \"./contracts\";\nimport { ISnapshotContents } from \"./odspUtils\";\n\n/**\n * Build a tree hierarchy base on a flat tree\n *\n * @param flatTree - a flat tree\n * @param blobsShaToPathCache - Map with blobs sha as keys and values as path of the blob.\n * @returns the hierarchical tree\n */\nfunction buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {\n const lookup: { [path: string]: api.ISnapshotTree } = {};\n // id is required for root tree as it will be used to determine the version we loaded from.\n const root: api.ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n lookup[\"\"] = root;\n\n for (const entry of flatTree.entries) {\n const lastIndex = entry.path.lastIndexOf(\"/\");\n const entryPathDir = entry.path.slice(0, Math.max(0, lastIndex));\n const entryPathBase = entry.path.slice(lastIndex + 1);\n\n // ODSP snapshots are created breadth-first so we can assume we see tree nodes prior to their contents\n const node = lookup[entryPathDir];\n\n // Add in either the blob or tree\n if (entry.type === \"tree\") {\n const newTree: api.ISnapshotTree = {\n blobs: {},\n trees: {},\n unreferenced: entry.unreferenced,\n };\n node.trees[decodeURIComponent(entryPathBase)] = newTree;\n lookup[entry.path] = newTree;\n } else if (entry.type === \"blob\") {\n node.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n }\n }\n\n return root;\n}\n\n/**\n * Converts existing IOdspSnapshot to snapshot tree, blob array and ops\n * @param odspSnapshot - snapshot\n */\nexport function convertOdspSnapshotToSnapsohtTreeAndBlobs(\n odspSnapshot: IOdspSnapshot,\n): ISnapshotContents {\n const blobsWithBufferContent = new Map<string, ArrayBuffer>();\n if (odspSnapshot.blobs) {\n odspSnapshot.blobs.forEach((blob) => {\n assert(blob.encoding === \"base64\" || blob.encoding === undefined,\n 0x0a4 /* `Unexpected blob encoding type: '${blob.encoding}'` */);\n blobsWithBufferContent.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? \"utf8\"));\n });\n }\n const val: ISnapshotContents = {\n blobs: blobsWithBufferContent,\n ops: odspSnapshot.ops?.map((op) => op.op) ?? [],\n sequenceNumber: odspSnapshot.trees && (odspSnapshot.trees[0]).sequenceNumber,\n snapshotTree: buildHierarchy(odspSnapshot.trees[0]),\n };\n return val;\n}\n"]}
|
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/odsp-driver";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.59.2000-61729";
|
|
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,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,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/odsp-driver\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,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/odsp-driver\";\nexport const pkgVersion = \"0.59.2000-61729\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.2000-61729",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
63
63
|
"@fluidframework/common-utils": "^0.32.1",
|
|
64
|
-
"@fluidframework/core-interfaces": "^0.
|
|
65
|
-
"@fluidframework/driver-base": "0.
|
|
66
|
-
"@fluidframework/driver-definitions": "^0.
|
|
67
|
-
"@fluidframework/driver-utils": "0.
|
|
68
|
-
"@fluidframework/gitresources": "^0.
|
|
69
|
-
"@fluidframework/odsp-doclib-utils": "0.
|
|
70
|
-
"@fluidframework/odsp-driver-definitions": "0.
|
|
71
|
-
"@fluidframework/protocol-base": "^0.
|
|
72
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
73
|
-
"@fluidframework/telemetry-utils": "0.
|
|
64
|
+
"@fluidframework/core-interfaces": "^0.43.1000-0",
|
|
65
|
+
"@fluidframework/driver-base": "0.59.2000-61729",
|
|
66
|
+
"@fluidframework/driver-definitions": "^0.46.1000-0",
|
|
67
|
+
"@fluidframework/driver-utils": "0.59.2000-61729",
|
|
68
|
+
"@fluidframework/gitresources": "^0.1036.1000-0",
|
|
69
|
+
"@fluidframework/odsp-doclib-utils": "0.59.2000-61729",
|
|
70
|
+
"@fluidframework/odsp-driver-definitions": "0.59.2000-61729",
|
|
71
|
+
"@fluidframework/protocol-base": "^0.1036.1000-0",
|
|
72
|
+
"@fluidframework/protocol-definitions": "^0.1028.1000-0",
|
|
73
|
+
"@fluidframework/telemetry-utils": "0.59.2000-61729",
|
|
74
74
|
"abort-controller": "^3.0.0",
|
|
75
75
|
"node-fetch": "^2.6.1",
|
|
76
76
|
"socket.io-client": "^4.4.1",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@fluidframework/build-common": "^0.23.0",
|
|
81
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
82
|
-
"@fluidframework/mocha-test-setup": "0.
|
|
83
|
-
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver
|
|
81
|
+
"@fluidframework/eslint-config-fluid": "^0.28.1000-61189",
|
|
82
|
+
"@fluidframework/mocha-test-setup": "0.59.2000-61729",
|
|
83
|
+
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@^0.58.0",
|
|
84
84
|
"@microsoft/api-extractor": "^7.16.1",
|
|
85
85
|
"@rushstack/eslint-config": "^2.5.1",
|
|
86
86
|
"@types/mocha": "^8.2.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"typescript-formatter": "7.1.0"
|
|
107
107
|
},
|
|
108
108
|
"typeValidation": {
|
|
109
|
-
"version": "0.
|
|
109
|
+
"version": "0.59.1000",
|
|
110
110
|
"broken": {}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -56,7 +56,8 @@ function readOpsSection(node: NodeTypes) {
|
|
|
56
56
|
for (let i = 0; i < records.deltas.length; ++i) {
|
|
57
57
|
ops.push(JSON.parse(records.deltas.getString(i)));
|
|
58
58
|
}
|
|
59
|
-
assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,
|
|
59
|
+
assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,
|
|
60
|
+
0x280 /* "Validate first op seq number" */);
|
|
60
61
|
return ops;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -67,7 +68,6 @@ function readOpsSection(node: NodeTypes) {
|
|
|
67
68
|
function readTreeSection(node: NodeCore) {
|
|
68
69
|
const snapshotTree: ISnapshotTree = {
|
|
69
70
|
blobs: {},
|
|
70
|
-
commits: {},
|
|
71
71
|
trees: {},
|
|
72
72
|
};
|
|
73
73
|
for (let count = 0; count < node.length; count++) {
|
|
@@ -133,7 +133,8 @@ export function parseCompactSnapshotResponse(buffer: ReadBuffer): ISnapshotConte
|
|
|
133
133
|
0x20f /* "Driver min read version should >= to server minReadVersion" */);
|
|
134
134
|
assert(records.cv.toString() >= snapshotMinReadVersion,
|
|
135
135
|
0x210 /* "Snapshot should be created with minReadVersion or above" */);
|
|
136
|
-
assert(currentReadVersion === records.cv.toString(),
|
|
136
|
+
assert(currentReadVersion === records.cv.toString(),
|
|
137
|
+
0x2c2 /* "Create Version should be equal to currentReadVersion" */);
|
|
137
138
|
return {
|
|
138
139
|
...readSnapshotSection(records.snapshot),
|
|
139
140
|
blobs: readBlobSection(records.blobs),
|
package/src/createNewUtils.ts
CHANGED
package/src/fetchSnapshot.ts
CHANGED
|
@@ -482,7 +482,7 @@ export async function downloadSnapshot(
|
|
|
482
482
|
const snapshotContents: ISnapshotContents = convertOdspSnapshotToSnapsohtTreeAndBlobs(content);
|
|
483
483
|
finalSnapshotContents = { ...response, content: snapshotContents };
|
|
484
484
|
} else {
|
|
485
|
-
assert(contentType === "application/ms-fluid", "Content type should be application/ms-fluid");
|
|
485
|
+
assert(contentType === "application/ms-fluid", 0x2c3 /* "Content type should be application/ms-fluid" */);
|
|
486
486
|
const content = await response.content.arrayBuffer();
|
|
487
487
|
response.propsToLog.bodySize = content.byteLength;
|
|
488
488
|
const snapshotContents: ISnapshotContents = parseCompactSnapshotResponse(
|
|
@@ -356,38 +356,20 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
|
|
|
356
356
|
if (!snapshotTree) {
|
|
357
357
|
return null;
|
|
358
358
|
}
|
|
359
|
-
// Decode commit paths
|
|
360
|
-
const commits = {};
|
|
361
359
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
let finalTree: api.ISnapshotTree;
|
|
367
|
-
// For container loaded from detach new summary, we will not have a commit for ".app" in downloaded summary as the client uploaded both
|
|
368
|
-
// ".app" and ".protocol" trees by itself. For other summaries, we will have ".app" as commit because client previously only uploaded the
|
|
369
|
-
// app summary.
|
|
370
|
-
if (commits && commits[".app"]) {
|
|
371
|
-
// The latest snapshot is a summary
|
|
372
|
-
// attempt to read .protocol from commits for backwards compat
|
|
373
|
-
finalTree = await this.readSummaryTree(commits[".protocol"] || snapshotTree.trees[".protocol"], commits[".app"] as string);
|
|
374
|
-
} else {
|
|
375
|
-
if (snapshotTree.blobs) {
|
|
376
|
-
const attributesBlob = snapshotTree.blobs.attributes;
|
|
377
|
-
if (attributesBlob) {
|
|
378
|
-
this.attributesBlobHandles.add(attributesBlob);
|
|
379
|
-
}
|
|
360
|
+
if (snapshotTree.blobs) {
|
|
361
|
+
const attributesBlob = snapshotTree.blobs.attributes;
|
|
362
|
+
if (attributesBlob) {
|
|
363
|
+
this.attributesBlobHandles.add(attributesBlob);
|
|
380
364
|
}
|
|
365
|
+
}
|
|
381
366
|
|
|
382
|
-
|
|
367
|
+
// When we upload the container snapshot, we upload appTree in ".app" and protocol tree in ".protocol"
|
|
368
|
+
// So when we request the snapshot we get ".app" as tree and not as commit node as in the case just above.
|
|
369
|
+
const appTree = snapshotTree.trees[".app"];
|
|
370
|
+
const protocolTree = snapshotTree.trees[".protocol"];
|
|
383
371
|
|
|
384
|
-
|
|
385
|
-
// So when we request the snapshot we get ".app" as tree and not as commit node as in the case just above.
|
|
386
|
-
const appTree = snapshotTree.trees[".app"];
|
|
387
|
-
const protocolTree = snapshotTree.trees[".protocol"];
|
|
388
|
-
finalTree = this.combineProtocolAndAppSnapshotTree(appTree, protocolTree);
|
|
389
|
-
}
|
|
390
|
-
return finalTree;
|
|
372
|
+
return this.combineProtocolAndAppSnapshotTree(appTree, protocolTree);
|
|
391
373
|
}
|
|
392
374
|
|
|
393
375
|
public async getVersions(blobid: string | null, count: number): Promise<api.IVersion[]> {
|
|
@@ -782,39 +764,6 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
|
|
|
782
764
|
return tree;
|
|
783
765
|
}
|
|
784
766
|
|
|
785
|
-
/**
|
|
786
|
-
* Reads a summary tree
|
|
787
|
-
* @param protocolTreeOrId - Protocol snapshot tree or id of the protocol tree
|
|
788
|
-
* @param appTreeId - Id of the app tree
|
|
789
|
-
*/
|
|
790
|
-
private async readSummaryTree(protocolTreeOrId: api.ISnapshotTree | string, appTreeId: string): Promise<api.ISnapshotTree> {
|
|
791
|
-
// Load the app and protocol trees and return them
|
|
792
|
-
let hierarchicalProtocolTree: api.ISnapshotTree | null;
|
|
793
|
-
if (typeof (protocolTreeOrId) === "string") {
|
|
794
|
-
// Backwards compat for older summaries
|
|
795
|
-
hierarchicalProtocolTree = await this.readTree(protocolTreeOrId);
|
|
796
|
-
} else {
|
|
797
|
-
hierarchicalProtocolTree = protocolTreeOrId;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
const hierarchicalAppTree = await this.readTree(appTreeId);
|
|
801
|
-
if (!hierarchicalProtocolTree) {
|
|
802
|
-
throw new Error("Invalid protocol tree");
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
if (!hierarchicalAppTree) {
|
|
806
|
-
throw new Error("Invalid app tree");
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
if (hierarchicalProtocolTree.blobs) {
|
|
810
|
-
const attributesBlob = hierarchicalProtocolTree.blobs.attributes;
|
|
811
|
-
if (attributesBlob) {
|
|
812
|
-
this.attributesBlobHandles.add(attributesBlob);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
return this.combineProtocolAndAppSnapshotTree(hierarchicalAppTree, hierarchicalProtocolTree);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
767
|
private combineProtocolAndAppSnapshotTree(
|
|
819
768
|
hierarchicalAppTree: api.ISnapshotTree,
|
|
820
769
|
hierarchicalProtocolTree: api.ISnapshotTree,
|
|
@@ -823,9 +772,6 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
|
|
|
823
772
|
blobs: {
|
|
824
773
|
...hierarchicalAppTree.blobs,
|
|
825
774
|
},
|
|
826
|
-
commits: {
|
|
827
|
-
...hierarchicalAppTree.commits,
|
|
828
|
-
},
|
|
829
775
|
trees: {
|
|
830
776
|
...hierarchicalAppTree.trees,
|
|
831
777
|
// the app tree could have a .protocol
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
import { assert } from "@fluidframework/common-utils";
|
|
7
|
-
import {
|
|
6
|
+
import { IRequest } from "@fluidframework/core-interfaces";
|
|
8
7
|
import {
|
|
9
8
|
DriverErrorType,
|
|
10
9
|
DriverHeader,
|
|
@@ -162,22 +161,26 @@ export class OdspDriverUrlResolver implements IUrlResolver {
|
|
|
162
161
|
public async getAbsoluteUrl(
|
|
163
162
|
resolvedUrl: IResolvedUrl,
|
|
164
163
|
relativeUrl: string,
|
|
165
|
-
packageInfoSource?: IContainerPackageInfo
|
|
164
|
+
packageInfoSource?: IContainerPackageInfo,
|
|
166
165
|
): Promise<string> {
|
|
167
166
|
let dataStorePath = relativeUrl;
|
|
168
167
|
if (dataStorePath.startsWith("/")) {
|
|
169
168
|
dataStorePath = dataStorePath.substr(1);
|
|
170
169
|
}
|
|
171
170
|
const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
// back-compat: GitHub #9653
|
|
172
|
+
const isFluidPackage = (pkg: any) =>
|
|
173
|
+
typeof pkg === "object"
|
|
174
|
+
&& typeof pkg?.name === "string"
|
|
175
|
+
&& typeof pkg?.fluid === "object";
|
|
174
176
|
let containerPackageName;
|
|
175
177
|
if (packageInfoSource && "name" in packageInfoSource) {
|
|
176
178
|
containerPackageName = packageInfoSource.name;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
// packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails
|
|
180
|
+
} else if (isFluidPackage((packageInfoSource as any)?.package)) {
|
|
181
|
+
containerPackageName = (packageInfoSource as any)?.package.name;
|
|
179
182
|
} else {
|
|
180
|
-
containerPackageName = packageInfoSource?.package;
|
|
183
|
+
containerPackageName = (packageInfoSource as any)?.package;
|
|
181
184
|
}
|
|
182
185
|
containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;
|
|
183
186
|
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
import { PromiseCache } from "@fluidframework/common-utils";
|
|
7
|
-
import {
|
|
6
|
+
import { IRequest } from "@fluidframework/core-interfaces";
|
|
8
7
|
import {
|
|
9
8
|
IContainerPackageInfo,
|
|
10
9
|
IResolvedUrl,
|
|
@@ -191,20 +190,24 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
|
|
|
191
190
|
public async getAbsoluteUrl(
|
|
192
191
|
resolvedUrl: IResolvedUrl,
|
|
193
192
|
dataStorePath: string,
|
|
194
|
-
packageInfoSource?: IContainerPackageInfo
|
|
193
|
+
packageInfoSource?: IContainerPackageInfo,
|
|
195
194
|
): Promise<string> {
|
|
196
195
|
const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
|
|
197
196
|
const shareLink = await this.getShareLinkPromise(odspResolvedUrl);
|
|
198
197
|
const shareLinkUrl = new URL(shareLink);
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
// back-compat: GitHub #9653
|
|
199
|
+
const isFluidPackage = (pkg: any) =>
|
|
200
|
+
typeof pkg === "object"
|
|
201
|
+
&& typeof pkg?.name === "string"
|
|
202
|
+
&& typeof pkg?.fluid === "object";
|
|
201
203
|
let containerPackageName;
|
|
202
204
|
if (packageInfoSource && "name" in packageInfoSource) {
|
|
203
205
|
containerPackageName = packageInfoSource.name;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
// packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails
|
|
207
|
+
} else if (isFluidPackage((packageInfoSource as any)?.package)) {
|
|
208
|
+
containerPackageName = (packageInfoSource as any)?.package.name;
|
|
206
209
|
} else {
|
|
207
|
-
containerPackageName = packageInfoSource?.package;
|
|
210
|
+
containerPackageName = (packageInfoSource as any)?.package;
|
|
208
211
|
}
|
|
209
212
|
containerPackageName = containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;
|
|
210
213
|
|
|
@@ -18,7 +18,7 @@ import { ISnapshotContents } from "./odspUtils";
|
|
|
18
18
|
function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
19
19
|
const lookup: { [path: string]: api.ISnapshotTree } = {};
|
|
20
20
|
// id is required for root tree as it will be used to determine the version we loaded from.
|
|
21
|
-
const root: api.ISnapshotTree = { id: flatTree.id, blobs: {},
|
|
21
|
+
const root: api.ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };
|
|
22
22
|
lookup[""] = root;
|
|
23
23
|
|
|
24
24
|
for (const entry of flatTree.entries) {
|
|
@@ -33,7 +33,6 @@ function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
|
33
33
|
if (entry.type === "tree") {
|
|
34
34
|
const newTree: api.ISnapshotTree = {
|
|
35
35
|
blobs: {},
|
|
36
|
-
commits: {},
|
|
37
36
|
trees: {},
|
|
38
37
|
unreferenced: entry.unreferenced,
|
|
39
38
|
};
|
|
@@ -41,8 +40,6 @@ function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
|
41
40
|
lookup[entry.path] = newTree;
|
|
42
41
|
} else if (entry.type === "blob") {
|
|
43
42
|
node.blobs[decodeURIComponent(entryPathBase)] = entry.id;
|
|
44
|
-
} else if (entry.type === "commit") {
|
|
45
|
-
node.commits[decodeURIComponent(entryPathBase)] = entry.id;
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
|
package/src/packageVersion.ts
CHANGED