@fluidframework/driver-utils 2.0.0-dev.5.2.0.169897 → 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 (198) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +4 -3
  3. package/dist/adapters/compression/compressionTypes.d.ts +17 -0
  4. package/dist/adapters/compression/compressionTypes.d.ts.map +1 -0
  5. package/dist/adapters/compression/compressionTypes.js +17 -0
  6. package/dist/adapters/compression/compressionTypes.js.map +1 -0
  7. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +13 -0
  8. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
  9. package/dist/adapters/compression/documentServiceCompressionAdapter.js +23 -0
  10. package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -0
  11. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +16 -0
  12. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
  13. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +39 -0
  14. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -0
  15. package/dist/adapters/compression/index.d.ts +8 -0
  16. package/dist/adapters/compression/index.d.ts.map +1 -0
  17. package/dist/adapters/compression/index.js +15 -0
  18. package/dist/adapters/compression/index.js.map +1 -0
  19. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +161 -0
  20. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
  21. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +366 -0
  22. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -0
  23. package/dist/adapters/compression/summaryblob/index.d.ts +6 -0
  24. package/dist/adapters/compression/summaryblob/index.d.ts.map +1 -0
  25. package/dist/adapters/compression/summaryblob/index.js +11 -0
  26. package/dist/adapters/compression/summaryblob/index.js.map +1 -0
  27. package/dist/adapters/index.d.ts +7 -0
  28. package/dist/adapters/index.d.ts.map +1 -0
  29. package/dist/adapters/index.js +14 -0
  30. package/dist/adapters/index.js.map +1 -0
  31. package/dist/adapters/predefinedAdapters.d.ts +20 -0
  32. package/dist/adapters/predefinedAdapters.d.ts.map +1 -0
  33. package/dist/adapters/predefinedAdapters.js +51 -0
  34. package/dist/adapters/predefinedAdapters.js.map +1 -0
  35. package/dist/buildSnapshotTree.d.ts.map +1 -1
  36. package/dist/buildSnapshotTree.js +5 -4
  37. package/dist/buildSnapshotTree.js.map +1 -1
  38. package/dist/documentServiceFactoryProxy.d.ts +19 -0
  39. package/dist/documentServiceFactoryProxy.d.ts.map +1 -0
  40. package/dist/documentServiceFactoryProxy.js +27 -0
  41. package/dist/documentServiceFactoryProxy.js.map +1 -0
  42. package/dist/documentServiceProxy.d.ts +21 -0
  43. package/dist/documentServiceProxy.d.ts.map +1 -0
  44. package/dist/documentServiceProxy.js +36 -0
  45. package/dist/documentServiceProxy.js.map +1 -0
  46. package/dist/documentStorageServiceProxy.js +1 -2
  47. package/dist/documentStorageServiceProxy.js.map +1 -1
  48. package/dist/error.d.ts.map +1 -1
  49. package/dist/error.js +2 -0
  50. package/dist/error.js.map +1 -1
  51. package/dist/index.d.ts +3 -2
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +5 -2
  54. package/dist/index.js.map +1 -1
  55. package/dist/insecureUrlResolver.js +4 -6
  56. package/dist/insecureUrlResolver.js.map +1 -1
  57. package/dist/network.d.ts +2 -2
  58. package/dist/network.d.ts.map +1 -1
  59. package/dist/network.js +11 -5
  60. package/dist/network.js.map +1 -1
  61. package/dist/networkUtils.d.ts +1 -1
  62. package/dist/networkUtils.d.ts.map +1 -1
  63. package/dist/networkUtils.js +3 -4
  64. package/dist/networkUtils.js.map +1 -1
  65. package/dist/packageVersion.d.ts +1 -1
  66. package/dist/packageVersion.js +1 -1
  67. package/dist/packageVersion.js.map +1 -1
  68. package/dist/parallelRequests.d.ts +3 -3
  69. package/dist/parallelRequests.d.ts.map +1 -1
  70. package/dist/parallelRequests.js +67 -48
  71. package/dist/parallelRequests.js.map +1 -1
  72. package/dist/prefetchDocumentStorageService.js +1 -1
  73. package/dist/prefetchDocumentStorageService.js.map +1 -1
  74. package/dist/rateLimiter.js +2 -2
  75. package/dist/rateLimiter.js.map +1 -1
  76. package/dist/readAndParse.js +2 -2
  77. package/dist/readAndParse.js.map +1 -1
  78. package/dist/runWithRetry.d.ts +8 -0
  79. package/dist/runWithRetry.d.ts.map +1 -1
  80. package/dist/runWithRetry.js +37 -13
  81. package/dist/runWithRetry.js.map +1 -1
  82. package/dist/summaryForCreateNew.d.ts +0 -9
  83. package/dist/summaryForCreateNew.d.ts.map +1 -1
  84. package/dist/summaryForCreateNew.js +4 -27
  85. package/dist/summaryForCreateNew.js.map +1 -1
  86. package/dist/treeConversions.d.ts.map +1 -1
  87. package/dist/treeConversions.js +4 -3
  88. package/dist/treeConversions.js.map +1 -1
  89. package/lib/adapters/compression/compressionTypes.d.ts +17 -0
  90. package/lib/adapters/compression/compressionTypes.d.ts.map +1 -0
  91. package/lib/adapters/compression/compressionTypes.js +14 -0
  92. package/lib/adapters/compression/compressionTypes.js.map +1 -0
  93. package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts +13 -0
  94. package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
  95. package/lib/adapters/compression/documentServiceCompressionAdapter.js +19 -0
  96. package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -0
  97. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +16 -0
  98. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
  99. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +35 -0
  100. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -0
  101. package/lib/adapters/compression/index.d.ts +8 -0
  102. package/lib/adapters/compression/index.d.ts.map +1 -0
  103. package/lib/adapters/compression/index.js +8 -0
  104. package/lib/adapters/compression/index.js.map +1 -0
  105. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +161 -0
  106. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
  107. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +362 -0
  108. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -0
  109. package/lib/adapters/compression/summaryblob/index.d.ts +6 -0
  110. package/lib/adapters/compression/summaryblob/index.d.ts.map +1 -0
  111. package/lib/adapters/compression/summaryblob/index.js +6 -0
  112. package/lib/adapters/compression/summaryblob/index.js.map +1 -0
  113. package/lib/adapters/index.d.ts +7 -0
  114. package/lib/adapters/index.d.ts.map +1 -0
  115. package/lib/adapters/index.js +7 -0
  116. package/lib/adapters/index.js.map +1 -0
  117. package/lib/adapters/predefinedAdapters.d.ts +20 -0
  118. package/lib/adapters/predefinedAdapters.d.ts.map +1 -0
  119. package/lib/adapters/predefinedAdapters.js +46 -0
  120. package/lib/adapters/predefinedAdapters.js.map +1 -0
  121. package/lib/buildSnapshotTree.d.ts.map +1 -1
  122. package/lib/buildSnapshotTree.js +4 -3
  123. package/lib/buildSnapshotTree.js.map +1 -1
  124. package/lib/documentServiceFactoryProxy.d.ts +19 -0
  125. package/lib/documentServiceFactoryProxy.d.ts.map +1 -0
  126. package/lib/documentServiceFactoryProxy.js +23 -0
  127. package/lib/documentServiceFactoryProxy.js.map +1 -0
  128. package/lib/documentServiceProxy.d.ts +21 -0
  129. package/lib/documentServiceProxy.d.ts.map +1 -0
  130. package/lib/documentServiceProxy.js +32 -0
  131. package/lib/documentServiceProxy.js.map +1 -0
  132. package/lib/documentStorageServiceProxy.js +1 -2
  133. package/lib/documentStorageServiceProxy.js.map +1 -1
  134. package/lib/error.d.ts.map +1 -1
  135. package/lib/error.js +2 -0
  136. package/lib/error.js.map +1 -1
  137. package/lib/index.d.ts +3 -2
  138. package/lib/index.d.ts.map +1 -1
  139. package/lib/index.js +3 -2
  140. package/lib/index.js.map +1 -1
  141. package/lib/insecureUrlResolver.js +3 -5
  142. package/lib/insecureUrlResolver.js.map +1 -1
  143. package/lib/network.d.ts +2 -2
  144. package/lib/network.d.ts.map +1 -1
  145. package/lib/network.js +14 -6
  146. package/lib/network.js.map +1 -1
  147. package/lib/networkUtils.d.ts +1 -1
  148. package/lib/networkUtils.d.ts.map +1 -1
  149. package/lib/networkUtils.js +3 -4
  150. package/lib/networkUtils.js.map +1 -1
  151. package/lib/packageVersion.d.ts +1 -1
  152. package/lib/packageVersion.js +1 -1
  153. package/lib/packageVersion.js.map +1 -1
  154. package/lib/parallelRequests.d.ts +3 -3
  155. package/lib/parallelRequests.d.ts.map +1 -1
  156. package/lib/parallelRequests.js +37 -18
  157. package/lib/parallelRequests.js.map +1 -1
  158. package/lib/prefetchDocumentStorageService.js +1 -1
  159. package/lib/prefetchDocumentStorageService.js.map +1 -1
  160. package/lib/rateLimiter.js +1 -1
  161. package/lib/rateLimiter.js.map +1 -1
  162. package/lib/readAndParse.js +1 -1
  163. package/lib/readAndParse.js.map +1 -1
  164. package/lib/runWithRetry.d.ts +8 -0
  165. package/lib/runWithRetry.d.ts.map +1 -1
  166. package/lib/runWithRetry.js +30 -7
  167. package/lib/runWithRetry.js.map +1 -1
  168. package/lib/summaryForCreateNew.d.ts +0 -9
  169. package/lib/summaryForCreateNew.d.ts.map +1 -1
  170. package/lib/summaryForCreateNew.js +3 -25
  171. package/lib/summaryForCreateNew.js.map +1 -1
  172. package/lib/treeConversions.d.ts.map +1 -1
  173. package/lib/treeConversions.js +2 -1
  174. package/lib/treeConversions.js.map +1 -1
  175. package/package.json +24 -29
  176. package/src/adapters/compression/compressionTypes.ts +19 -0
  177. package/src/adapters/compression/documentServiceCompressionAdapter.ts +25 -0
  178. package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +62 -0
  179. package/src/adapters/compression/index.ts +12 -0
  180. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +447 -0
  181. package/src/adapters/compression/summaryblob/index.ts +9 -0
  182. package/src/adapters/index.ts +13 -0
  183. package/src/adapters/predefinedAdapters.ts +73 -0
  184. package/src/buildSnapshotTree.ts +4 -3
  185. package/src/documentServiceFactoryProxy.ts +47 -0
  186. package/src/documentServiceProxy.ts +46 -0
  187. package/src/error.ts +2 -0
  188. package/src/index.ts +6 -2
  189. package/src/insecureUrlResolver.ts +1 -1
  190. package/src/network.ts +10 -2
  191. package/src/networkUtils.ts +1 -1
  192. package/src/packageVersion.ts +1 -1
  193. package/src/parallelRequests.ts +10 -8
  194. package/src/rateLimiter.ts +1 -1
  195. package/src/readAndParse.ts +1 -1
  196. package/src/runWithRetry.ts +32 -7
  197. package/src/summaryForCreateNew.ts +0 -31
  198. package/src/treeConversions.ts +2 -1
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { parse } from "url";
7
- import { assert } from "@fluidframework/common-utils";
7
+ import { assert } from "@fluidframework/core-utils";
8
8
  import { IRequest } from "@fluidframework/core-interfaces";
9
9
  import { IResolvedUrl, IUrlResolver, DriverHeader } from "@fluidframework/driver-definitions";
10
10
  import Axios from "axios";
package/src/network.ts CHANGED
@@ -7,11 +7,13 @@ import {
7
7
  IThrottlingWarning,
8
8
  IDriverErrorBase,
9
9
  IAuthorizationError,
10
+ // eslint-disable-next-line import/no-deprecated
10
11
  DriverErrorType,
11
12
  ILocationRedirectionError,
12
13
  IResolvedUrl,
14
+ DriverErrorTypes,
13
15
  } from "@fluidframework/driver-definitions";
14
- import { ITelemetryProperties } from "@fluidframework/common-definitions";
16
+ import { ITelemetryProperties } from "@fluidframework/core-interfaces";
15
17
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
16
18
 
17
19
  export enum OnlineStatus {
@@ -43,6 +45,7 @@ export type DriverErrorTelemetryProps = ITelemetryProperties & {
43
45
  * Generic network error class.
44
46
  */
45
47
  export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
48
+ // eslint-disable-next-line import/no-deprecated
46
49
  readonly errorType = DriverErrorType.genericNetworkError;
47
50
 
48
51
  constructor(message: string, readonly canRetry: boolean, props: DriverErrorTelemetryProps) {
@@ -57,6 +60,7 @@ export class FluidInvalidSchemaError
57
60
  extends LoggingError
58
61
  implements IDriverErrorBase, IFluidErrorBase
59
62
  {
63
+ // eslint-disable-next-line import/no-deprecated
60
64
  readonly errorType = DriverErrorType.fluidInvalidSchema;
61
65
  readonly canRetry = false;
62
66
 
@@ -69,6 +73,7 @@ export class DeltaStreamConnectionForbiddenError
69
73
  extends LoggingError
70
74
  implements IDriverErrorBase, IFluidErrorBase
71
75
  {
76
+ // eslint-disable-next-line import/no-deprecated
72
77
  static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
73
78
  readonly errorType = DeltaStreamConnectionForbiddenError.errorType;
74
79
  readonly canRetry = false;
@@ -84,6 +89,7 @@ export class AuthorizationError
84
89
  extends LoggingError
85
90
  implements IAuthorizationError, IFluidErrorBase
86
91
  {
92
+ // eslint-disable-next-line import/no-deprecated
87
93
  readonly errorType = DriverErrorType.authorizationError;
88
94
  readonly canRetry = false;
89
95
 
@@ -102,6 +108,7 @@ export class LocationRedirectionError
102
108
  extends LoggingError
103
109
  implements ILocationRedirectionError, IFluidErrorBase
104
110
  {
111
+ // eslint-disable-next-line import/no-deprecated
105
112
  readonly errorType = DriverErrorType.locationRedirection;
106
113
  readonly canRetry = false;
107
114
 
@@ -142,6 +149,7 @@ export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
142
149
  * Throttling error class - used to communicate all throttling errors
143
150
  */
144
151
  export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
152
+ // eslint-disable-next-line import/no-deprecated
145
153
  readonly errorType = DriverErrorType.throttlingError;
146
154
  readonly canRetry = true;
147
155
 
@@ -155,7 +163,7 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
155
163
  }
156
164
 
157
165
  export const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>
158
- new NonRetryableError(message, DriverErrorType.writeError, props);
166
+ new NonRetryableError(message, DriverErrorTypes.writeError, props);
159
167
 
160
168
  export function createGenericNetworkError(
161
169
  message: string,
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryErrorEvent } from "@fluidframework/common-definitions";
6
+ import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
7
7
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
8
8
  import { isOnline, OnlineStatus, canRetryOnError } from "./network";
9
9
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-utils";
9
- export const pkgVersion = "2.0.0-dev.5.2.0.169897";
9
+ export const pkgVersion = "2.0.0-dev.6.4.0.191258";
@@ -2,8 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert, Deferred, performance } from "@fluidframework/common-utils";
6
- import { ITelemetryProperties } from "@fluidframework/common-definitions";
5
+ import { performance } from "@fluid-internal/client-utils";
6
+ import { ITelemetryProperties } from "@fluidframework/core-interfaces";
7
+ import { assert, Deferred } from "@fluidframework/core-utils";
7
8
  import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
8
9
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
9
10
  import { IDeltasFetchResult, IStream, IStreamResult } from "@fluidframework/driver-definitions";
@@ -27,7 +28,7 @@ type WorkingState = "working" | "done" | "canceled";
27
28
  * @param payloadSize - batch size
28
29
  * @param logger - logger to use
29
30
  * @param requestCallback - callback to request batches
30
- * @returns - Queue that can be used to retrieve data
31
+ * @returns Queue that can be used to retrieve data
31
32
  */
32
33
  export class ParallelRequests<T> {
33
34
  private latestRequested: number;
@@ -309,9 +310,10 @@ export class ParallelRequests<T> {
309
310
  if (to === this.latestRequested) {
310
311
  // we can go after full chunk at the end if we received partial chunk, or more than asked
311
312
  // Also if we got more than we asked to, we can actually use those ops!
312
- if (payload.length !== 0) {
313
- this.results.set(from, payload);
314
- from += payload.length;
313
+ while (payload.length !== 0) {
314
+ const data = payload.splice(0, requestedLength);
315
+ this.results.set(from, data);
316
+ from += data.length;
315
317
  }
316
318
 
317
319
  this.latestRequested = from;
@@ -403,7 +405,7 @@ const waitForOnline = async (): Promise<void> => {
403
405
  * @param logger - logger object to use to log progress & errors
404
406
  * @param signal - cancelation signal
405
407
  * @param scenarioName - reason for fetching ops
406
- * @returns - an object with resulting ops and cancellation / partial result flags
408
+ * @returns An object with resulting ops and cancellation / partial result flags
407
409
  */
408
410
  async function getSingleOpBatch(
409
411
  get: (telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,
@@ -528,7 +530,7 @@ async function getSingleOpBatch(
528
530
  * @param logger - Logger to log progress and errors
529
531
  * @param signal - Cancelation signal
530
532
  * @param scenarioName - Reason for fetching ops
531
- * @returns - Messages fetched
533
+ * @returns Messages fetched
532
534
  */
533
535
  export function requestOps(
534
536
  get: (
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/common-utils";
6
+ import { assert } from "@fluidframework/core-utils";
7
7
 
8
8
  export class RateLimiter {
9
9
  private readonly tasks: (() => void)[] = [];
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { bufferToString } from "@fluidframework/common-utils";
6
+ import { bufferToString } from "@fluid-internal/client-utils";
7
7
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
8
8
 
9
9
  /**
@@ -3,9 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
- import { delay, performance } from "@fluidframework/common-utils";
8
- import { DriverErrorType } from "@fluidframework/driver-definitions";
6
+ import { ITelemetryLoggerExt, isFluidError } from "@fluidframework/telemetry-utils";
7
+ import { performance } from "@fluid-internal/client-utils";
8
+ import { delay } from "@fluidframework/core-utils";
9
+ import { DriverErrorTypes } from "@fluidframework/driver-definitions";
9
10
  import { canRetryOnError, getRetryDelayFromError } from "./network";
10
11
  import { pkgVersion } from "./packageVersion";
11
12
  import { NonRetryableError } from ".";
@@ -80,13 +81,20 @@ export async function runWithRetry<T>(
80
81
  retry: numRetries,
81
82
  duration: performance.now() - startTime,
82
83
  fetchCallName,
84
+ // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
85
+ reason: (progress.cancel as AbortSignal & { reason: any }).reason,
83
86
  },
84
87
  err,
85
88
  );
86
89
  throw new NonRetryableError(
87
90
  "runWithRetry was Aborted",
88
- DriverErrorType.genericError,
89
- { driverVersion: pkgVersion, fetchCallName },
91
+ DriverErrorTypes.genericError,
92
+ {
93
+ driverVersion: pkgVersion,
94
+ fetchCallName,
95
+ // TODO: Remove when typescript version of the repo contains the AbortSignal.reason property (AB#5045)
96
+ reason: (progress.cancel as AbortSignal & { reason: any }).reason,
97
+ },
90
98
  );
91
99
  }
92
100
 
@@ -107,8 +115,9 @@ export async function runWithRetry<T>(
107
115
  numRetries++;
108
116
  lastError = err;
109
117
  // If the error is throttling error, then wait for the specified time before retrying.
110
- // If the waitTime is not specified, then we start with retrying immediately to max of 8s.
111
- retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);
118
+ retryAfterMs =
119
+ getRetryDelayFromError(err) ??
120
+ Math.min(retryAfterMs * 2, calculateMaxWaitTime(err));
112
121
  if (progress.onRetry) {
113
122
  progress.onRetry(retryAfterMs, err);
114
123
  }
@@ -129,3 +138,19 @@ export async function runWithRetry<T>(
129
138
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
130
139
  return result!;
131
140
  }
141
+
142
+ const MaxReconnectDelayInMsWhenEndpointIsReachable = 30000;
143
+ const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
144
+
145
+ /**
146
+ * In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some transient error
147
+ * not related to endpoint, in that case we want to try at faster pace and hence the max wait is lesser 8s as compared
148
+ * to when endpoint is reachable in which case it is 30s.
149
+ * @param error - error based on which we decide max wait time.
150
+ * @returns Max wait time.
151
+ */
152
+ export function calculateMaxWaitTime(error: unknown): number {
153
+ return isFluidError(error) && error.getTelemetryProperties().endpointReached === true
154
+ ? MaxReconnectDelayInMsWhenEndpointIsReachable
155
+ : MaxReconnectDelayInMsWhenEndpointIsNotReachable;
156
+ }
@@ -3,7 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/common-utils";
7
6
  import {
8
7
  ISummaryTree,
9
8
  SummaryType,
@@ -46,36 +45,6 @@ export function isCombinedAppAndProtocolSummary(
46
45
  return true;
47
46
  }
48
47
 
49
- /**
50
- * Combine the app summary and protocol summary in 1 tree.
51
- * @param appSummary - Summary of the app.
52
- * @param protocolSummary - Summary of the protocol.
53
- * @internal
54
- *
55
- * @deprecated 2.0.0-internal.3.4.0 - Not intended for public use. Will be moved to container-loader and no longer exported in an upcoming release.
56
- */
57
- export function combineAppAndProtocolSummary(
58
- appSummary: ISummaryTree,
59
- protocolSummary: ISummaryTree,
60
- ): CombinedAppAndProtocolSummary {
61
- assert(
62
- !isCombinedAppAndProtocolSummary(appSummary),
63
- 0x5a8 /* app summary is already a combined tree! */,
64
- );
65
- assert(
66
- !isCombinedAppAndProtocolSummary(protocolSummary),
67
- 0x5a9 /* protocol summary is already a combined tree! */,
68
- );
69
- const createNewSummary: CombinedAppAndProtocolSummary = {
70
- type: SummaryType.Tree,
71
- tree: {
72
- ".protocol": protocolSummary,
73
- ".app": appSummary,
74
- },
75
- };
76
- return createNewSummary;
77
- }
78
-
79
48
  /**
80
49
  * Extract the attributes from the protocol summary.
81
50
  * @param protocolSummary - protocol summary from which the values are to be extracted.
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { Uint8ArrayToString, unreachableCase } from "@fluidframework/common-utils";
6
+ import { Uint8ArrayToString } from "@fluid-internal/client-utils";
7
+ import { unreachableCase } from "@fluidframework/core-utils";
7
8
  import { ISummaryTree, ITree, ITreeEntry, SummaryType } from "@fluidframework/protocol-definitions";
8
9
  import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "./blob";
9
10
  import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";