@fluidframework/odsp-driver 1.0.1 → 1.0.2
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 +4 -1
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +6 -3
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/fetchSnapshot.js +2 -2
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.js +6 -6
- package/dist/getFileLink.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +1 -1
- package/dist/odspSnapshotParser.js +3 -3
- 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 +4 -1
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js +6 -3
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/fetchSnapshot.js +3 -3
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.js +6 -6
- package/lib/getFileLink.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts +1 -1
- package/lib/odspSnapshotParser.js +1 -1
- 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 +9 -9
- package/src/compactSnapshotParser.ts +3 -1
- package/src/compactSnapshotWriter.ts +6 -3
- package/src/fetchSnapshot.ts +3 -3
- package/src/getFileLink.ts +7 -7
- package/src/odspSnapshotParser.ts +1 -1
- package/src/packageVersion.ts +1 -1
|
@@ -60,9 +60,12 @@ function writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree)
|
|
|
60
60
|
if (snapshotTree.unreferenced) {
|
|
61
61
|
addBoolProperty(treeNode, "unreferenced", snapshotTree.unreferenced);
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
// Only write children prop if either blobs or trees are present.
|
|
64
|
+
if (Object.keys(value.blobs).length > 0 || Object.keys(value.trees).length > 0) {
|
|
65
|
+
treeNode.addString("children", true);
|
|
66
|
+
const childNode = treeNode.addNode("list");
|
|
67
|
+
writeTreeSectionCore(childNode, value);
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
if (snapshotTree.blobs) {
|
package/src/fetchSnapshot.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
IOdspResponse,
|
|
29
29
|
ISnapshotContents,
|
|
30
30
|
} from "./odspUtils";
|
|
31
|
-
import {
|
|
31
|
+
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser";
|
|
32
32
|
import { currentReadVersion, parseCompactSnapshotResponse } from "./compactSnapshotParser";
|
|
33
33
|
import { ReadBuffer } from "./ReadBufferUtils";
|
|
34
34
|
import { EpochTracker } from "./epochTracker";
|
|
@@ -83,7 +83,7 @@ export async function fetchSnapshot(
|
|
|
83
83
|
},
|
|
84
84
|
async () => snapshotDownloader(url, { headers }),
|
|
85
85
|
) as IOdspResponse<IOdspSnapshot>;
|
|
86
|
-
return
|
|
86
|
+
return convertOdspSnapshotToSnapshotTreeAndBlobs(response.content);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export async function fetchSnapshotWithRedeem(
|
|
@@ -491,7 +491,7 @@ export async function downloadSnapshot(
|
|
|
491
491
|
const text = await response.content.text();
|
|
492
492
|
const content: IOdspSnapshot = JSON.parse(text);
|
|
493
493
|
response.propsToLog.bodySize = text.length;
|
|
494
|
-
const snapshotContents: ISnapshotContents =
|
|
494
|
+
const snapshotContents: ISnapshotContents = convertOdspSnapshotToSnapshotTreeAndBlobs(content);
|
|
495
495
|
finalSnapshotContents = { ...response, content: snapshotContents };
|
|
496
496
|
} else {
|
|
497
497
|
assert(contentType === "application/ms-fluid", 0x2c3 /* "Content type should be application/ms-fluid" */);
|
package/src/getFileLink.ts
CHANGED
|
@@ -94,7 +94,7 @@ async function getFileLinkCore(
|
|
|
94
94
|
// ODSP link requires extra call to return link that is resistant to file being renamed or moved to different folder
|
|
95
95
|
return PerformanceEvent.timedExecAsync(
|
|
96
96
|
logger,
|
|
97
|
-
{ eventName: "odspFileLink", requestName: "
|
|
97
|
+
{ eventName: "odspFileLink", requestName: "getSharingInformation" },
|
|
98
98
|
async (event) => {
|
|
99
99
|
let attempts = 0;
|
|
100
100
|
let additionalProps;
|
|
@@ -111,8 +111,8 @@ async function getFileLinkCore(
|
|
|
111
111
|
0x2bb /* "Instrumented token fetcher with throwOnNullToken = true should never return null" */);
|
|
112
112
|
|
|
113
113
|
const { url, headers } = getUrlAndHeadersWithAuth(
|
|
114
|
-
`${odspUrlParts.siteUrl}/_api/web/
|
|
115
|
-
encodeURIComponent(`'${
|
|
114
|
+
`${odspUrlParts.siteUrl}/_api/web/GetFileByUrl(@a1)/ListItemAllFields/GetSharingInformation?@a1=${
|
|
115
|
+
encodeURIComponent(`'${fileItem.webDavUrl}'`)
|
|
116
116
|
}`,
|
|
117
117
|
storageToken,
|
|
118
118
|
false,
|
|
@@ -129,15 +129,15 @@ async function getFileLinkCore(
|
|
|
129
129
|
additionalProps = response.propsToLog;
|
|
130
130
|
|
|
131
131
|
const sharingInfo = await response.content.json();
|
|
132
|
-
const
|
|
133
|
-
if (typeof
|
|
132
|
+
const directUrl = sharingInfo?.d?.directUrl;
|
|
133
|
+
if (typeof directUrl !== "string") {
|
|
134
134
|
// This will retry once in getWithRetryForTokenRefresh
|
|
135
135
|
throw new NonRetryableError(
|
|
136
|
-
"Malformed
|
|
136
|
+
"Malformed GetSharingInformation response",
|
|
137
137
|
DriverErrorType.incorrectServerResponse,
|
|
138
138
|
{ driverVersion });
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return directUrl;
|
|
141
141
|
});
|
|
142
142
|
event.end({ ...additionalProps, attempts });
|
|
143
143
|
return fileLink;
|
|
@@ -51,7 +51,7 @@ function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
|
51
51
|
* Converts existing IOdspSnapshot to snapshot tree, blob array and ops
|
|
52
52
|
* @param odspSnapshot - snapshot
|
|
53
53
|
*/
|
|
54
|
-
export function
|
|
54
|
+
export function convertOdspSnapshotToSnapshotTreeAndBlobs(
|
|
55
55
|
odspSnapshot: IOdspSnapshot,
|
|
56
56
|
): ISnapshotContents {
|
|
57
57
|
const blobsWithBufferContent = new Map<string, ArrayBuffer>();
|
package/src/packageVersion.ts
CHANGED