@fluidframework/routerlicious-driver 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191258

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 (180) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +4 -3
  3. package/dist/contracts.d.ts +28 -1
  4. package/dist/contracts.d.ts.map +1 -1
  5. package/dist/contracts.js.map +1 -1
  6. package/dist/createNewUtils.d.ts +1 -1
  7. package/dist/createNewUtils.js +3 -3
  8. package/dist/createNewUtils.js.map +1 -1
  9. package/dist/deltaStorageService.d.ts.map +1 -1
  10. package/dist/deltaStorageService.js +17 -6
  11. package/dist/deltaStorageService.js.map +1 -1
  12. package/dist/documentDeltaConnection.js +1 -1
  13. package/dist/documentDeltaConnection.js.map +1 -1
  14. package/dist/documentService.d.ts +3 -3
  15. package/dist/documentService.d.ts.map +1 -1
  16. package/dist/documentService.js +4 -4
  17. package/dist/documentService.js.map +1 -1
  18. package/dist/documentServiceFactory.d.ts.map +1 -1
  19. package/dist/documentServiceFactory.js +32 -10
  20. package/dist/documentServiceFactory.js.map +1 -1
  21. package/dist/documentStorageService.d.ts +2 -2
  22. package/dist/documentStorageService.d.ts.map +1 -1
  23. package/dist/documentStorageService.js +2 -2
  24. package/dist/documentStorageService.js.map +1 -1
  25. package/dist/errorUtils.d.ts +38 -6
  26. package/dist/errorUtils.d.ts.map +1 -1
  27. package/dist/errorUtils.js +32 -16
  28. package/dist/errorUtils.js.map +1 -1
  29. package/dist/gitManager.d.ts +3 -2
  30. package/dist/gitManager.d.ts.map +1 -1
  31. package/dist/gitManager.js +2 -2
  32. package/dist/gitManager.js.map +1 -1
  33. package/dist/historian.d.ts +3 -2
  34. package/dist/historian.d.ts.map +1 -1
  35. package/dist/historian.js +13 -6
  36. package/dist/historian.js.map +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +2 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/mapWithExpiration.js +2 -2
  42. package/dist/mapWithExpiration.js.map +1 -1
  43. package/dist/packageVersion.d.ts +1 -1
  44. package/dist/packageVersion.js +1 -1
  45. package/dist/packageVersion.js.map +1 -1
  46. package/dist/policies.d.ts +7 -1
  47. package/dist/policies.d.ts.map +1 -1
  48. package/dist/policies.js.map +1 -1
  49. package/dist/r11sSnapshotParser.d.ts +4 -5
  50. package/dist/r11sSnapshotParser.d.ts.map +1 -1
  51. package/dist/r11sSnapshotParser.js +13 -15
  52. package/dist/r11sSnapshotParser.js.map +1 -1
  53. package/dist/restWrapper.d.ts +3 -3
  54. package/dist/restWrapper.d.ts.map +1 -1
  55. package/dist/restWrapper.js +53 -36
  56. package/dist/restWrapper.js.map +1 -1
  57. package/dist/restWrapperBase.js +39 -5
  58. package/dist/restWrapperBase.js.map +1 -1
  59. package/dist/retriableGitManager.d.ts +3 -2
  60. package/dist/retriableGitManager.d.ts.map +1 -1
  61. package/dist/retriableGitManager.js +2 -2
  62. package/dist/retriableGitManager.js.map +1 -1
  63. package/dist/shreddedSummaryDocumentStorageService.js +13 -16
  64. package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
  65. package/dist/storageContracts.d.ts +4 -3
  66. package/dist/storageContracts.d.ts.map +1 -1
  67. package/dist/storageContracts.js.map +1 -1
  68. package/dist/summaryTreeUploadManager.d.ts.map +1 -1
  69. package/dist/summaryTreeUploadManager.js +11 -11
  70. package/dist/summaryTreeUploadManager.js.map +1 -1
  71. package/dist/treeUtils.d.ts +2 -2
  72. package/dist/treeUtils.d.ts.map +1 -1
  73. package/dist/treeUtils.js +8 -8
  74. package/dist/treeUtils.js.map +1 -1
  75. package/dist/wholeSummaryDocumentStorageService.d.ts +2 -2
  76. package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  77. package/dist/wholeSummaryDocumentStorageService.js +27 -22
  78. package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
  79. package/dist/wholeSummaryUploadManager.js +1 -2
  80. package/dist/wholeSummaryUploadManager.js.map +1 -1
  81. package/lib/contracts.d.ts +28 -1
  82. package/lib/contracts.d.ts.map +1 -1
  83. package/lib/contracts.js.map +1 -1
  84. package/lib/createNewUtils.d.ts +1 -1
  85. package/lib/createNewUtils.js +2 -2
  86. package/lib/createNewUtils.js.map +1 -1
  87. package/lib/deltaStorageService.d.ts.map +1 -1
  88. package/lib/deltaStorageService.js +17 -6
  89. package/lib/deltaStorageService.js.map +1 -1
  90. package/lib/documentDeltaConnection.js +1 -1
  91. package/lib/documentDeltaConnection.js.map +1 -1
  92. package/lib/documentService.d.ts +3 -3
  93. package/lib/documentService.d.ts.map +1 -1
  94. package/lib/documentService.js +4 -4
  95. package/lib/documentService.js.map +1 -1
  96. package/lib/documentServiceFactory.d.ts.map +1 -1
  97. package/lib/documentServiceFactory.js +32 -10
  98. package/lib/documentServiceFactory.js.map +1 -1
  99. package/lib/documentStorageService.d.ts +2 -2
  100. package/lib/documentStorageService.d.ts.map +1 -1
  101. package/lib/documentStorageService.js +2 -2
  102. package/lib/documentStorageService.js.map +1 -1
  103. package/lib/errorUtils.d.ts +38 -6
  104. package/lib/errorUtils.d.ts.map +1 -1
  105. package/lib/errorUtils.js +31 -15
  106. package/lib/errorUtils.js.map +1 -1
  107. package/lib/gitManager.d.ts +3 -2
  108. package/lib/gitManager.d.ts.map +1 -1
  109. package/lib/gitManager.js +2 -2
  110. package/lib/gitManager.js.map +1 -1
  111. package/lib/historian.d.ts +3 -2
  112. package/lib/historian.d.ts.map +1 -1
  113. package/lib/historian.js +12 -5
  114. package/lib/historian.js.map +1 -1
  115. package/lib/index.d.ts +1 -1
  116. package/lib/index.d.ts.map +1 -1
  117. package/lib/index.js +1 -1
  118. package/lib/index.js.map +1 -1
  119. package/lib/mapWithExpiration.js +1 -1
  120. package/lib/mapWithExpiration.js.map +1 -1
  121. package/lib/packageVersion.d.ts +1 -1
  122. package/lib/packageVersion.js +1 -1
  123. package/lib/packageVersion.js.map +1 -1
  124. package/lib/policies.d.ts +7 -1
  125. package/lib/policies.d.ts.map +1 -1
  126. package/lib/policies.js.map +1 -1
  127. package/lib/r11sSnapshotParser.d.ts +4 -5
  128. package/lib/r11sSnapshotParser.d.ts.map +1 -1
  129. package/lib/r11sSnapshotParser.js +11 -13
  130. package/lib/r11sSnapshotParser.js.map +1 -1
  131. package/lib/restWrapper.d.ts +3 -3
  132. package/lib/restWrapper.d.ts.map +1 -1
  133. package/lib/restWrapper.js +48 -31
  134. package/lib/restWrapper.js.map +1 -1
  135. package/lib/restWrapperBase.js +39 -5
  136. package/lib/restWrapperBase.js.map +1 -1
  137. package/lib/retriableGitManager.d.ts +3 -2
  138. package/lib/retriableGitManager.d.ts.map +1 -1
  139. package/lib/retriableGitManager.js +2 -2
  140. package/lib/retriableGitManager.js.map +1 -1
  141. package/lib/shreddedSummaryDocumentStorageService.js +12 -15
  142. package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
  143. package/lib/storageContracts.d.ts +4 -3
  144. package/lib/storageContracts.d.ts.map +1 -1
  145. package/lib/storageContracts.js.map +1 -1
  146. package/lib/summaryTreeUploadManager.d.ts.map +1 -1
  147. package/lib/summaryTreeUploadManager.js +4 -4
  148. package/lib/summaryTreeUploadManager.js.map +1 -1
  149. package/lib/treeUtils.d.ts +2 -2
  150. package/lib/treeUtils.d.ts.map +1 -1
  151. package/lib/treeUtils.js +4 -4
  152. package/lib/treeUtils.js.map +1 -1
  153. package/lib/wholeSummaryDocumentStorageService.d.ts +2 -2
  154. package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  155. package/lib/wholeSummaryDocumentStorageService.js +23 -18
  156. package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
  157. package/lib/wholeSummaryUploadManager.js +1 -2
  158. package/lib/wholeSummaryUploadManager.js.map +1 -1
  159. package/package.json +26 -28
  160. package/src/contracts.ts +45 -1
  161. package/src/createNewUtils.ts +2 -2
  162. package/src/deltaStorageService.ts +8 -1
  163. package/src/documentService.ts +5 -5
  164. package/src/documentServiceFactory.ts +21 -11
  165. package/src/documentStorageService.ts +3 -3
  166. package/src/errorUtils.ts +48 -30
  167. package/src/gitManager.ts +3 -3
  168. package/src/historian.ts +5 -5
  169. package/src/index.ts +1 -1
  170. package/src/mapWithExpiration.ts +1 -1
  171. package/src/packageVersion.ts +1 -1
  172. package/src/policies.ts +7 -1
  173. package/src/r11sSnapshotParser.ts +14 -15
  174. package/src/restWrapper.ts +34 -21
  175. package/src/retriableGitManager.ts +3 -3
  176. package/src/shreddedSummaryDocumentStorageService.ts +3 -3
  177. package/src/storageContracts.ts +3 -3
  178. package/src/summaryTreeUploadManager.ts +2 -7
  179. package/src/treeUtils.ts +4 -3
  180. package/src/wholeSummaryDocumentStorageService.ts +14 -19
@@ -4,9 +4,8 @@
4
4
  */
5
5
 
6
6
  import { ISnapshotTree } from "@fluidframework/protocol-definitions";
7
- import { IWholeFlatSummary, IWholeFlatSummaryTree } from "@fluidframework/server-services-client";
8
- import { stringToBuffer } from "@fluidframework/common-utils";
9
- import { INormalizedWholeSummary } from "./contracts";
7
+ import { stringToBuffer } from "@fluid-internal/client-utils";
8
+ import { INormalizedWholeSnapshot, IWholeFlatSnapshot, IWholeFlatSnapshotTree } from "./contracts";
10
9
 
11
10
  /**
12
11
  * Build a tree hierarchy from a flat tree.
@@ -16,7 +15,7 @@ import { INormalizedWholeSummary } from "./contracts";
16
15
  * @returns the heirarchical tree
17
16
  */
18
17
  function buildHierarchy(
19
- flatTree: IWholeFlatSummaryTree,
18
+ flatTree: IWholeFlatSnapshotTree,
20
19
  treePrefixToRemove: string,
21
20
  ): ISnapshotTree {
22
21
  const lookup: { [path: string]: ISnapshotTree } = {};
@@ -54,30 +53,30 @@ function buildHierarchy(
54
53
  }
55
54
 
56
55
  /**
57
- * Converts existing IWholeFlatSummary to snapshot tree, blob array, and sequence number.
56
+ * Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.
58
57
  *
59
- * @param flatSummary - flat summary
58
+ * @param flatSnapshot - flat snapshot
60
59
  * @param treePrefixToRemove - tree prefix to strip. By default we are stripping ".app" prefix
61
60
  * @returns snapshot tree, blob array, and sequence number
62
61
  */
63
- export function convertWholeFlatSummaryToSnapshotTreeAndBlobs(
64
- flatSummary: IWholeFlatSummary,
62
+ export function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(
63
+ flatSnapshot: IWholeFlatSnapshot,
65
64
  treePrefixToRemove: string = ".app",
66
- ): INormalizedWholeSummary {
65
+ ): INormalizedWholeSnapshot {
67
66
  const blobs = new Map<string, ArrayBuffer>();
68
- if (flatSummary.blobs) {
69
- flatSummary.blobs.forEach((blob) => {
67
+ if (flatSnapshot.blobs) {
68
+ flatSnapshot.blobs.forEach((blob) => {
70
69
  blobs.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? "utf-8"));
71
70
  });
72
71
  }
73
- const flatSummaryTree = flatSummary.trees?.[0];
74
- const sequenceNumber = flatSummaryTree?.sequenceNumber;
75
- const snapshotTree = buildHierarchy(flatSummaryTree, treePrefixToRemove);
72
+ const flatSnapshotTree = flatSnapshot.trees?.[0];
73
+ const sequenceNumber = flatSnapshotTree?.sequenceNumber;
74
+ const snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);
76
75
 
77
76
  return {
78
77
  blobs,
79
78
  snapshotTree,
80
79
  sequenceNumber,
81
- id: flatSummary.id,
80
+ id: flatSnapshot.id,
82
81
  };
83
82
  }
@@ -7,19 +7,21 @@ import { ITelemetryProperties } from "@fluidframework/core-interfaces";
7
7
  import {
8
8
  ITelemetryLoggerExt,
9
9
  PerformanceEvent,
10
- TelemetryLogger,
10
+ numberFromString,
11
11
  } from "@fluidframework/telemetry-utils";
12
- import { assert, fromUtf8ToBase64, performance } from "@fluidframework/common-utils";
13
- import { RateLimiter } from "@fluidframework/driver-utils";
12
+ import { assert } from "@fluidframework/core-utils";
13
+ import { fromUtf8ToBase64, performance } from "@fluid-internal/client-utils";
14
+ import { GenericNetworkError, NonRetryableError, RateLimiter } from "@fluidframework/driver-utils";
14
15
  import {
16
+ CorrelationIdHeaderName,
17
+ DriverVersionHeaderName,
15
18
  getAuthorizationTokenFromCredentials,
16
19
  RestLessClient,
17
20
  } from "@fluidframework/server-services-client";
18
21
  import fetch from "cross-fetch";
19
22
  import type { AxiosRequestConfig, AxiosRequestHeaders } from "axios";
20
23
  import safeStringify from "json-stringify-safe";
21
- import { v4 as uuid } from "uuid";
22
- import { throwR11sNetworkError } from "./errorUtils";
24
+ import { RouterliciousErrorTypes, throwR11sNetworkError } from "./errorUtils";
23
25
  import { ITokenProvider, ITokenResponse } from "./tokens";
24
26
  import { pkgVersion as driverVersion } from "./packageVersion";
25
27
  import { QueryStringType, RestWrapper } from "./restWrapperBase";
@@ -52,9 +54,9 @@ export interface IR11sResponse<T> {
52
54
  }
53
55
 
54
56
  /**
55
- * A utility function to create a r11s response without any additional props as we might not have them always.
56
- * @param content - response which is equivalent to content.
57
- * @returns - a r11s response without any extra props.
57
+ * A utility function to create a Routerlicious response without any additional props as we might not have them always.
58
+ * @param content - Response which is equivalent to content.
59
+ * @returns A Routerlicious response without any extra props.
58
60
  */
59
61
  export function createR11sResponseFromContent<T>(content: T): IR11sResponse<T> {
60
62
  return {
@@ -84,12 +86,12 @@ export function getPropsToLogFromResponse(headers: {
84
86
  // We rename headers so that otel doesn't scrub them away. Otel doesn't allow
85
87
  // certain characters in headers including '-'
86
88
  const headersToLog: LoggingHeader[] = [
87
- { headerName: "x-correlation-id", logName: "requestCorrelationId" },
89
+ { headerName: CorrelationIdHeaderName, logName: "requestCorrelationId" },
88
90
  { headerName: "content-encoding", logName: "contentEncoding" },
89
91
  { headerName: "content-type", logName: "contentType" },
90
92
  ];
91
93
  const additionalProps: ITelemetryProperties = {
92
- contentsize: TelemetryLogger.numberFromString(headers.get("content-length")),
94
+ contentsize: numberFromString(headers.get("content-length")),
93
95
  };
94
96
  headersToLog.forEach((header) => {
95
97
  const headerValue = headers.get(header.headerName);
@@ -136,9 +138,24 @@ export class RouterliciousRestWrapper extends RestWrapper {
136
138
  const result = await fetch(...fetchRequestConfig).catch(async (error) => {
137
139
  // Browser Fetch throws a TypeError on network error, `node-fetch` throws a FetchError
138
140
  const isNetworkError = ["TypeError", "FetchError"].includes(error?.name);
139
- throwR11sNetworkError(
140
- isNetworkError ? `NetworkError: ${error.message}` : safeStringify(error),
141
- );
141
+ const errorMessage = isNetworkError
142
+ ? `NetworkError: ${error.message}`
143
+ : safeStringify(error);
144
+ // If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw
145
+ // a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and
146
+ // the error message will start with NetworkError as defined in restWrapper.ts
147
+ // If there exists a self-signed SSL certificates error, throw a NonRetryableError
148
+ // TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections
149
+ const err = errorMessage.includes("failed, reason: self signed certificate")
150
+ ? new NonRetryableError(errorMessage, RouterliciousErrorTypes.sslCertError, {
151
+ driverVersion,
152
+ })
153
+ : new GenericNetworkError(
154
+ errorMessage,
155
+ errorMessage.startsWith("NetworkError"),
156
+ { driverVersion },
157
+ );
158
+ throw err;
142
159
  });
143
160
  return {
144
161
  response: result,
@@ -209,17 +226,13 @@ export class RouterliciousRestWrapper extends RestWrapper {
209
226
  ): Promise<Record<string, string>> {
210
227
  const token = await this.getToken();
211
228
  assert(token !== undefined, 0x679 /* token should be present */);
212
- const correlationId = requestHeaders?.["x-correlation-id"] ?? uuid();
213
-
214
- return {
229
+ const headers: Record<string, string> = {
215
230
  ...requestHeaders,
216
- // TODO: replace header names with CorrelationIdHeaderName and DriverVersionHeaderName from services-client
217
- // NOTE: Can correlationId actually be number | true?
218
- "x-correlation-id": correlationId as string,
219
- "x-driver-version": driverVersion,
231
+ [DriverVersionHeaderName]: driverVersion,
220
232
  // NOTE: If this.authorizationHeader is undefined, should "Authorization" be removed entirely?
221
- "Authorization": this.getAuthorizationHeader(token),
233
+ Authorization: this.getAuthorizationHeader(token),
222
234
  };
235
+ return headers;
223
236
  }
224
237
 
225
238
  public async getToken(): Promise<ITokenResponse> {
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type * as git from "@fluidframework/gitresources";
7
7
  import {
8
- IWholeFlatSummary,
9
8
  IWholeSummaryPayload,
10
9
  IWriteSummaryResponse,
11
10
  } from "@fluidframework/server-services-client";
@@ -13,6 +12,7 @@ import { runWithRetry } from "@fluidframework/driver-utils";
13
12
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
14
13
  import { IGitManager } from "./storageContracts";
15
14
  import { IR11sResponse } from "./restWrapper";
15
+ import { IWholeFlatSnapshot } from "./contracts";
16
16
 
17
17
  export class RetriableGitManager implements IGitManager {
18
18
  constructor(
@@ -70,9 +70,9 @@ export class RetriableGitManager implements IGitManager {
70
70
  );
71
71
  }
72
72
 
73
- public async getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>> {
73
+ public async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {
74
74
  return this.runWithRetry(
75
- async () => this.internalGitManager.getSummary(sha),
75
+ async () => this.internalGitManager.getSnapshot(sha),
76
76
  "gitManager_getSummary",
77
77
  );
78
78
  }
@@ -4,13 +4,13 @@
4
4
  */
5
5
 
6
6
  import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
7
- import { stringToBuffer, Uint8ArrayToString } from "@fluidframework/common-utils";
7
+ import { stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
8
8
  import {
9
9
  IDocumentStorageService,
10
10
  ISummaryContext,
11
11
  IDocumentStorageServicePolicies,
12
12
  } from "@fluidframework/driver-definitions";
13
- import { buildHierarchy } from "@fluidframework/protocol-base";
13
+ import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
14
14
  import {
15
15
  ICreateBlobResponse,
16
16
  ISnapshotTreeEx,
@@ -125,7 +125,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
125
125
  return response;
126
126
  },
127
127
  );
128
- const tree = buildHierarchy(rawTree, this.blobsShaCache, true);
128
+ const tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
129
129
  await this.snapshotTreeCache?.put(this.getCacheKey(tree.id), {
130
130
  id: requestVersion.id,
131
131
  snapshotTree: tree,
@@ -6,12 +6,12 @@
6
6
  import * as git from "@fluidframework/gitresources";
7
7
  import * as api from "@fluidframework/protocol-definitions";
8
8
  import {
9
- IWholeFlatSummary,
10
9
  IWholeSummaryPayload,
11
10
  IWholeSummaryPayloadType,
12
11
  IWriteSummaryResponse,
13
12
  } from "@fluidframework/server-services-client";
14
13
  import { IR11sResponse } from "./restWrapper";
14
+ import { IWholeFlatSnapshot } from "./contracts";
15
15
 
16
16
  /**
17
17
  * Interface to a generic Git provider
@@ -26,7 +26,7 @@ export interface IHistorian {
26
26
  summary: IWholeSummaryPayload,
27
27
  initial?: boolean,
28
28
  ): Promise<IR11sResponse<IWriteSummaryResponse>>;
29
- getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>>;
29
+ getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
30
30
  }
31
31
 
32
32
  export interface IGitManager {
@@ -39,7 +39,7 @@ export interface IGitManager {
39
39
  summary: IWholeSummaryPayload,
40
40
  initial?: boolean,
41
41
  ): Promise<IR11sResponse<IWriteSummaryResponse>>;
42
- getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>>;
42
+ getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
43
43
  }
44
44
 
45
45
  /**
@@ -3,13 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- assert,
8
- gitHashFile,
9
- IsoBuffer,
10
- Uint8ArrayToString,
11
- unreachableCase,
12
- } from "@fluidframework/common-utils";
6
+ import { gitHashFile, IsoBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
7
+ import { assert, unreachableCase } from "@fluidframework/core-utils";
13
8
  import { ICreateTreeEntry } from "@fluidframework/gitresources";
14
9
  import { getGitMode, getGitType } from "@fluidframework/protocol-base";
15
10
  import {
package/src/treeUtils.ts CHANGED
@@ -3,14 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert, IsoBuffer } from "@fluidframework/common-utils";
6
+ import { IsoBuffer } from "@fluid-internal/client-utils";
7
+ import { assert } from "@fluidframework/core-utils";
7
8
  import {
8
9
  SummaryType,
9
10
  ISnapshotTree,
10
11
  ISummaryTree,
11
12
  SummaryObject,
12
13
  } from "@fluidframework/protocol-definitions";
13
- import { INormalizedWholeSummary } from "./contracts";
14
+ import { INormalizedWholeSnapshot } from "./contracts";
14
15
 
15
16
  /**
16
17
  * Summary tree assembler props
@@ -107,7 +108,7 @@ export function convertSnapshotAndBlobsToSummaryTree(
107
108
  return assembler.summary;
108
109
  }
109
110
 
110
- export function evalBlobsAndTrees(snapshot: INormalizedWholeSummary) {
111
+ export function evalBlobsAndTrees(snapshot: INormalizedWholeSnapshot) {
111
112
  const trees = countTreesInSnapshotTree(snapshot.snapshotTree);
112
113
  const numBlobs = snapshot.blobs.size;
113
114
  let encodedBlobsSize = 0;
@@ -4,12 +4,8 @@
4
4
  */
5
5
 
6
6
  import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
7
- import {
8
- assert,
9
- performance,
10
- stringToBuffer,
11
- Uint8ArrayToString,
12
- } from "@fluidframework/common-utils";
7
+ import { performance, stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
8
+ import { assert } from "@fluidframework/core-utils";
13
9
  import { getW3CData, promiseRaceWithWinner } from "@fluidframework/driver-base";
14
10
  import {
15
11
  IDocumentStorageService,
@@ -23,7 +19,6 @@ import {
23
19
  ISummaryTree,
24
20
  IVersion,
25
21
  } from "@fluidframework/protocol-definitions";
26
- import { IWholeFlatSummary } from "@fluidframework/server-services-client";
27
22
  import { ICache, InMemoryCache } from "./cache";
28
23
  import { IRouterliciousDriverPolicies } from "./policies";
29
24
  import {
@@ -35,8 +30,8 @@ import { GitManager } from "./gitManager";
35
30
  import { WholeSummaryUploadManager } from "./wholeSummaryUploadManager";
36
31
  import { ISummaryUploadManager } from "./storageContracts";
37
32
  import { IR11sResponse } from "./restWrapper";
38
- import { INormalizedWholeSummary } from "./contracts";
39
- import { convertWholeFlatSummaryToSnapshotTreeAndBlobs } from "./r11sSnapshotParser";
33
+ import { INormalizedWholeSnapshot, IWholeFlatSnapshot } from "./contracts";
34
+ import { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from "./r11sSnapshotParser";
40
35
 
41
36
  const latestSnapshotId: string = "latest";
42
37
 
@@ -59,7 +54,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
59
54
  public readonly policies: IDocumentStorageServicePolicies,
60
55
  private readonly driverPolicies?: IRouterliciousDriverPolicies,
61
56
  private readonly blobCache: ICache<ArrayBufferLike> = new InMemoryCache(),
62
- private readonly snapshotTreeCache: ICache<INormalizedWholeSummary> = new InMemoryCache(),
57
+ private readonly snapshotTreeCache: ICache<INormalizedWholeSnapshot> = new InMemoryCache(),
63
58
  private readonly noCacheGitManager?: GitManager,
64
59
  private readonly getStorageManager: (
65
60
  disableCache?: boolean,
@@ -243,7 +238,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
243
238
  }
244
239
 
245
240
  public async downloadSummary(summaryHandle: ISummaryHandle): Promise<ISummaryTree> {
246
- const wholeFlatSummary = await PerformanceEvent.timedExecAsync(
241
+ const wholeFlatSnapshot = await PerformanceEvent.timedExecAsync(
247
242
  this.logger,
248
243
  {
249
244
  eventName: "getWholeFlatSummary",
@@ -251,7 +246,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
251
246
  },
252
247
  async (event) => {
253
248
  const manager = await this.getStorageManager();
254
- const response = await manager.getSummary(summaryHandle.handle);
249
+ const response = await manager.getSnapshot(summaryHandle.handle);
255
250
  event.end({
256
251
  size: response.content.trees[0]?.entries.length,
257
252
  });
@@ -259,8 +254,8 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
259
254
  },
260
255
  );
261
256
 
262
- const { blobs, snapshotTree } = convertWholeFlatSummaryToSnapshotTreeAndBlobs(
263
- wholeFlatSummary,
257
+ const { blobs, snapshotTree } = convertWholeFlatSnapshotToSnapshotTreeAndBlobs(
258
+ wholeFlatSnapshot,
264
259
  "",
265
260
  );
266
261
  return convertSnapshotAndBlobsToSummaryTree(snapshotTree, blobs);
@@ -291,7 +286,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
291
286
  versionId: string,
292
287
  disableCache?: boolean,
293
288
  scenarioName?: string,
294
- ): Promise<INormalizedWholeSummary> {
289
+ ): Promise<INormalizedWholeSnapshot> {
295
290
  const normalizedWholeSummary = await PerformanceEvent.timedExecAsync(
296
291
  this.logger,
297
292
  {
@@ -301,12 +296,12 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
301
296
  },
302
297
  async (event) => {
303
298
  const manager = await this.getStorageManager(disableCache);
304
- const response: IR11sResponse<IWholeFlatSummary> = await manager.getSummary(
299
+ const response: IR11sResponse<IWholeFlatSnapshot> = await manager.getSnapshot(
305
300
  versionId,
306
301
  );
307
302
  const start = performance.now();
308
- const snapshot: INormalizedWholeSummary =
309
- convertWholeFlatSummaryToSnapshotTreeAndBlobs(response.content);
303
+ const snapshot: INormalizedWholeSnapshot =
304
+ convertWholeFlatSnapshotToSnapshotTreeAndBlobs(response.content);
310
305
  const snapshotConversionTime = performance.now() - start;
311
306
  validateBlobsAndTrees(snapshot.snapshotTree);
312
307
  const { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);
@@ -333,7 +328,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
333
328
  }
334
329
 
335
330
  private async initializeFromSnapshot(
336
- normalizedWholeSummary: INormalizedWholeSummary,
331
+ normalizedWholeSummary: INormalizedWholeSnapshot,
337
332
  ): Promise<string> {
338
333
  const snapshotId = normalizedWholeSummary.id;
339
334
  assert(snapshotId !== undefined, 0x275 /* "Root tree should contain the id" */);