@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.
Files changed (39) hide show
  1. package/dist/compactSnapshotParser.d.ts.map +1 -1
  2. package/dist/compactSnapshotParser.js +4 -1
  3. package/dist/compactSnapshotParser.js.map +1 -1
  4. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  5. package/dist/compactSnapshotWriter.js +6 -3
  6. package/dist/compactSnapshotWriter.js.map +1 -1
  7. package/dist/fetchSnapshot.js +2 -2
  8. package/dist/fetchSnapshot.js.map +1 -1
  9. package/dist/getFileLink.js +6 -6
  10. package/dist/getFileLink.js.map +1 -1
  11. package/dist/odspSnapshotParser.d.ts +1 -1
  12. package/dist/odspSnapshotParser.js +3 -3
  13. package/dist/odspSnapshotParser.js.map +1 -1
  14. package/dist/packageVersion.d.ts +1 -1
  15. package/dist/packageVersion.js +1 -1
  16. package/dist/packageVersion.js.map +1 -1
  17. package/lib/compactSnapshotParser.d.ts.map +1 -1
  18. package/lib/compactSnapshotParser.js +4 -1
  19. package/lib/compactSnapshotParser.js.map +1 -1
  20. package/lib/compactSnapshotWriter.d.ts.map +1 -1
  21. package/lib/compactSnapshotWriter.js +6 -3
  22. package/lib/compactSnapshotWriter.js.map +1 -1
  23. package/lib/fetchSnapshot.js +3 -3
  24. package/lib/fetchSnapshot.js.map +1 -1
  25. package/lib/getFileLink.js +6 -6
  26. package/lib/getFileLink.js.map +1 -1
  27. package/lib/odspSnapshotParser.d.ts +1 -1
  28. package/lib/odspSnapshotParser.js +1 -1
  29. package/lib/odspSnapshotParser.js.map +1 -1
  30. package/lib/packageVersion.d.ts +1 -1
  31. package/lib/packageVersion.js +1 -1
  32. package/lib/packageVersion.js.map +1 -1
  33. package/package.json +9 -9
  34. package/src/compactSnapshotParser.ts +3 -1
  35. package/src/compactSnapshotWriter.ts +6 -3
  36. package/src/fetchSnapshot.ts +3 -3
  37. package/src/getFileLink.ts +7 -7
  38. package/src/odspSnapshotParser.ts +1 -1
  39. 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
- treeNode.addString("children", true);
64
- const childNode = treeNode.addNode("list");
65
- writeTreeSectionCore(childNode, value);
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) {
@@ -28,7 +28,7 @@ import {
28
28
  IOdspResponse,
29
29
  ISnapshotContents,
30
30
  } from "./odspUtils";
31
- import { convertOdspSnapshotToSnapsohtTreeAndBlobs } from "./odspSnapshotParser";
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 convertOdspSnapshotToSnapsohtTreeAndBlobs(response.content);
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 = convertOdspSnapshotToSnapsohtTreeAndBlobs(content);
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" */);
@@ -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: "getSharingLink" },
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/GetFileByServerRelativeUrl(@a1)/Linkingurl?@a1=${
115
- encodeURIComponent(`'${new URL(fileItem.webDavUrl).pathname}'`)
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 linkingUrl = sharingInfo?.d?.LinkingUrl;
133
- if (typeof linkingUrl !== "string") {
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 GetSharingLink response",
136
+ "Malformed GetSharingInformation response",
137
137
  DriverErrorType.incorrectServerResponse,
138
138
  { driverVersion });
139
139
  }
140
- return linkingUrl;
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 convertOdspSnapshotToSnapsohtTreeAndBlobs(
54
+ export function convertOdspSnapshotToSnapshotTreeAndBlobs(
55
55
  odspSnapshot: IOdspSnapshot,
56
56
  ): ISnapshotContents {
57
57
  const blobsWithBufferContent = new Map<string, ArrayBuffer>();
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/odsp-driver";
9
- export const pkgVersion = "1.0.1";
9
+ export const pkgVersion = "1.0.2";