@fluidframework/driver-utils 2.0.0-internal.7.1.0 → 2.0.0-internal.7.2.0

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 (186) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor.json +1 -12
  3. package/api-report/driver-utils.api.md +10 -2
  4. package/dist/adapters/compression/compressionTypes.d.ts +6 -0
  5. package/dist/adapters/compression/compressionTypes.d.ts.map +1 -1
  6. package/dist/adapters/compression/compressionTypes.js +3 -0
  7. package/dist/adapters/compression/compressionTypes.js.map +1 -1
  8. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  9. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  10. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  11. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  12. package/dist/adapters/predefinedAdapters.d.ts +1 -0
  13. package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
  14. package/dist/adapters/predefinedAdapters.js +1 -0
  15. package/dist/adapters/predefinedAdapters.js.map +1 -1
  16. package/dist/blob.d.ts +3 -0
  17. package/dist/blob.d.ts.map +1 -1
  18. package/dist/blob.js +3 -0
  19. package/dist/blob.js.map +1 -1
  20. package/dist/buildSnapshotTree.d.ts +1 -0
  21. package/dist/buildSnapshotTree.d.ts.map +1 -1
  22. package/dist/buildSnapshotTree.js +1 -0
  23. package/dist/buildSnapshotTree.js.map +1 -1
  24. package/dist/documentStorageServiceProxy.d.ts +3 -0
  25. package/dist/documentStorageServiceProxy.d.ts.map +1 -1
  26. package/dist/documentStorageServiceProxy.js +3 -0
  27. package/dist/documentStorageServiceProxy.js.map +1 -1
  28. package/dist/error.d.ts +4 -1
  29. package/dist/error.d.ts.map +1 -1
  30. package/dist/error.js +4 -1
  31. package/dist/error.js.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +2 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/insecureUrlResolver.d.ts +1 -0
  37. package/dist/insecureUrlResolver.d.ts.map +1 -1
  38. package/dist/insecureUrlResolver.js +1 -0
  39. package/dist/insecureUrlResolver.js.map +1 -1
  40. package/dist/messageRecognition.d.ts +10 -0
  41. package/dist/messageRecognition.d.ts.map +1 -1
  42. package/dist/messageRecognition.js +10 -3
  43. package/dist/messageRecognition.js.map +1 -1
  44. package/dist/network.d.ts +49 -3
  45. package/dist/network.d.ts.map +1 -1
  46. package/dist/network.js +45 -5
  47. package/dist/network.js.map +1 -1
  48. package/dist/networkUtils.d.ts +3 -0
  49. package/dist/networkUtils.d.ts.map +1 -1
  50. package/dist/networkUtils.js +3 -0
  51. package/dist/networkUtils.js.map +1 -1
  52. package/dist/packageVersion.d.ts +1 -1
  53. package/dist/packageVersion.js +1 -1
  54. package/dist/packageVersion.js.map +1 -1
  55. package/dist/parallelRequests.d.ts +12 -0
  56. package/dist/parallelRequests.d.ts.map +1 -1
  57. package/dist/parallelRequests.js +12 -0
  58. package/dist/parallelRequests.js.map +1 -1
  59. package/dist/prefetchDocumentStorageService.d.ts +3 -0
  60. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  61. package/dist/prefetchDocumentStorageService.js +3 -0
  62. package/dist/prefetchDocumentStorageService.js.map +1 -1
  63. package/dist/rateLimiter.d.ts +3 -0
  64. package/dist/rateLimiter.d.ts.map +1 -1
  65. package/dist/rateLimiter.js +3 -0
  66. package/dist/rateLimiter.js.map +1 -1
  67. package/dist/readAndParse.d.ts +1 -0
  68. package/dist/readAndParse.d.ts.map +1 -1
  69. package/dist/readAndParse.js +1 -0
  70. package/dist/readAndParse.js.map +1 -1
  71. package/dist/runWithRetry.d.ts +5 -0
  72. package/dist/runWithRetry.d.ts.map +1 -1
  73. package/dist/runWithRetry.js +4 -2
  74. package/dist/runWithRetry.js.map +1 -1
  75. package/dist/summaryForCreateNew.d.ts +3 -1
  76. package/dist/summaryForCreateNew.d.ts.map +1 -1
  77. package/dist/summaryForCreateNew.js +4 -2
  78. package/dist/summaryForCreateNew.js.map +1 -1
  79. package/dist/treeConversions.d.ts +1 -0
  80. package/dist/treeConversions.d.ts.map +1 -1
  81. package/dist/treeConversions.js +1 -0
  82. package/dist/treeConversions.js.map +1 -1
  83. package/lib/adapters/compression/compressionTypes.d.ts +6 -0
  84. package/lib/adapters/compression/compressionTypes.d.ts.map +1 -1
  85. package/lib/adapters/compression/compressionTypes.js +3 -0
  86. package/lib/adapters/compression/compressionTypes.js.map +1 -1
  87. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  88. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  89. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  90. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  91. package/lib/adapters/predefinedAdapters.d.ts +1 -0
  92. package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
  93. package/lib/adapters/predefinedAdapters.js +1 -0
  94. package/lib/adapters/predefinedAdapters.js.map +1 -1
  95. package/lib/blob.d.ts +3 -0
  96. package/lib/blob.d.ts.map +1 -1
  97. package/lib/blob.js +3 -0
  98. package/lib/blob.js.map +1 -1
  99. package/lib/buildSnapshotTree.d.ts +1 -0
  100. package/lib/buildSnapshotTree.d.ts.map +1 -1
  101. package/lib/buildSnapshotTree.js +1 -0
  102. package/lib/buildSnapshotTree.js.map +1 -1
  103. package/lib/documentStorageServiceProxy.d.ts +3 -0
  104. package/lib/documentStorageServiceProxy.d.ts.map +1 -1
  105. package/lib/documentStorageServiceProxy.js +3 -0
  106. package/lib/documentStorageServiceProxy.js.map +1 -1
  107. package/lib/error.d.ts +4 -1
  108. package/lib/error.d.ts.map +1 -1
  109. package/lib/error.js +4 -1
  110. package/lib/error.js.map +1 -1
  111. package/lib/index.d.ts +1 -1
  112. package/lib/index.d.ts.map +1 -1
  113. package/lib/index.js +1 -1
  114. package/lib/index.js.map +1 -1
  115. package/lib/insecureUrlResolver.d.ts +1 -0
  116. package/lib/insecureUrlResolver.d.ts.map +1 -1
  117. package/lib/insecureUrlResolver.js +1 -0
  118. package/lib/insecureUrlResolver.js.map +1 -1
  119. package/lib/messageRecognition.d.ts +10 -0
  120. package/lib/messageRecognition.d.ts.map +1 -1
  121. package/lib/messageRecognition.js +10 -3
  122. package/lib/messageRecognition.js.map +1 -1
  123. package/lib/network.d.ts +49 -3
  124. package/lib/network.d.ts.map +1 -1
  125. package/lib/network.js +45 -5
  126. package/lib/network.js.map +1 -1
  127. package/lib/networkUtils.d.ts +3 -0
  128. package/lib/networkUtils.d.ts.map +1 -1
  129. package/lib/networkUtils.js +3 -0
  130. package/lib/networkUtils.js.map +1 -1
  131. package/lib/packageVersion.d.ts +1 -1
  132. package/lib/packageVersion.js +1 -1
  133. package/lib/packageVersion.js.map +1 -1
  134. package/lib/parallelRequests.d.ts +12 -0
  135. package/lib/parallelRequests.d.ts.map +1 -1
  136. package/lib/parallelRequests.js +12 -0
  137. package/lib/parallelRequests.js.map +1 -1
  138. package/lib/prefetchDocumentStorageService.d.ts +3 -0
  139. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  140. package/lib/prefetchDocumentStorageService.js +3 -0
  141. package/lib/prefetchDocumentStorageService.js.map +1 -1
  142. package/lib/rateLimiter.d.ts +3 -0
  143. package/lib/rateLimiter.d.ts.map +1 -1
  144. package/lib/rateLimiter.js +3 -0
  145. package/lib/rateLimiter.js.map +1 -1
  146. package/lib/readAndParse.d.ts +1 -0
  147. package/lib/readAndParse.d.ts.map +1 -1
  148. package/lib/readAndParse.js +1 -0
  149. package/lib/readAndParse.js.map +1 -1
  150. package/lib/runWithRetry.d.ts +5 -0
  151. package/lib/runWithRetry.d.ts.map +1 -1
  152. package/lib/runWithRetry.js +4 -2
  153. package/lib/runWithRetry.js.map +1 -1
  154. package/lib/summaryForCreateNew.d.ts +3 -1
  155. package/lib/summaryForCreateNew.d.ts.map +1 -1
  156. package/lib/summaryForCreateNew.js +4 -2
  157. package/lib/summaryForCreateNew.js.map +1 -1
  158. package/lib/treeConversions.d.ts +1 -0
  159. package/lib/treeConversions.d.ts.map +1 -1
  160. package/lib/treeConversions.js +1 -0
  161. package/lib/treeConversions.js.map +1 -1
  162. package/package.json +12 -13
  163. package/src/adapters/compression/compressionTypes.ts +6 -0
  164. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +4 -0
  165. package/src/adapters/predefinedAdapters.ts +1 -0
  166. package/src/blob.ts +3 -0
  167. package/src/buildSnapshotTree.ts +1 -0
  168. package/src/documentStorageServiceProxy.ts +3 -0
  169. package/src/error.ts +4 -1
  170. package/src/index.ts +1 -0
  171. package/src/insecureUrlResolver.ts +1 -0
  172. package/src/messageRecognition.ts +10 -3
  173. package/src/network.ts +49 -6
  174. package/src/networkUtils.ts +3 -0
  175. package/src/packageVersion.ts +1 -1
  176. package/src/parallelRequests.ts +12 -0
  177. package/src/prefetchDocumentStorageService.ts +3 -0
  178. package/src/rateLimiter.ts +3 -0
  179. package/src/readAndParse.ts +1 -0
  180. package/src/runWithRetry.ts +7 -4
  181. package/src/summaryForCreateNew.ts +4 -1
  182. package/src/treeConversions.ts +1 -0
  183. package/dist/driver-utils-alpha.d.ts +0 -467
  184. package/dist/driver-utils-beta.d.ts +0 -467
  185. package/dist/driver-utils-public.d.ts +0 -467
  186. package/dist/driver-utils.d.ts +0 -481
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-utils",
3
- "version": "2.0.0-internal.7.1.0",
3
+ "version": "2.0.0-internal.7.2.0",
4
4
  "description": "Collection of utility functions for Fluid drivers",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,32 +35,31 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
39
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
40
- "@fluidframework/core-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
41
- "@fluidframework/driver-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
38
+ "@fluid-internal/client-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
39
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
40
+ "@fluidframework/core-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
41
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
42
42
  "@fluidframework/gitresources": "^2.0.1",
43
43
  "@fluidframework/protocol-base": "^2.0.1",
44
44
  "@fluidframework/protocol-definitions": "^3.0.0",
45
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
45
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
46
46
  "axios": "^0.26.0",
47
47
  "lz4js": "^0.2.0",
48
48
  "url": "^0.11.0",
49
49
  "uuid": "^9.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@fluid-tools/build-cli": "^0.25.0",
53
- "@fluidframework/build-common": "^2.0.1",
54
- "@fluidframework/build-tools": "^0.25.0",
55
- "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.0.0",
52
+ "@fluid-tools/build-cli": "^0.26.1",
53
+ "@fluidframework/build-common": "^2.0.3",
54
+ "@fluidframework/build-tools": "^0.26.1",
55
+ "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.1.0",
56
56
  "@fluidframework/eslint-config-fluid": "^3.0.0",
57
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
57
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.2.0 <2.0.0-internal.7.3.0",
58
58
  "@microsoft/api-extractor": "^7.37.0",
59
59
  "@types/mocha": "^9.1.1",
60
60
  "@types/node": "^16.18.38",
61
61
  "@types/sinon": "^7.0.13",
62
62
  "c8": "^7.7.1",
63
- "copyfiles": "^2.4.1",
64
63
  "cross-env": "^7.0.3",
65
64
  "eslint": "~8.50.0",
66
65
  "mocha": "^10.2.0",
@@ -84,7 +83,7 @@
84
83
  "build:genver": "gen-version",
85
84
  "build:test": "tsc --project ./src/test/tsconfig.json",
86
85
  "ci:build:docs": "api-extractor run",
87
- "clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
86
+ "clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
88
87
  "eslint": "eslint --format stylish src",
89
88
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
90
89
  "format": "npm run prettier:fix",
@@ -3,11 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ /**
7
+ * @public
8
+ */
6
9
  export enum SummaryCompressionAlgorithm {
7
10
  None = 0,
8
11
  LZ4 = 1,
9
12
  }
10
13
 
14
+ /**
15
+ * @public
16
+ */
11
17
  export interface ICompressionStorageConfig {
12
18
  algorithm: SummaryCompressionAlgorithm;
13
19
  minSizeToCompress: number;
@@ -19,6 +19,9 @@ import { compress, decompress } from "lz4js";
19
19
  import { DocumentStorageServiceProxy } from "../../../documentStorageServiceProxy";
20
20
  import { ICompressionStorageConfig, SummaryCompressionAlgorithm } from "../";
21
21
 
22
+ /**
23
+ * @public
24
+ */
22
25
  export const blobHeadersBlobName = ".metadata.blobHeaders";
23
26
  const metadataBlobName = ".metadata";
24
27
 
@@ -32,6 +35,7 @@ const metadataBlobName = ".metadata";
32
35
  * In case, the markup blob is present, it is expected that the first byte of the markup blob
33
36
  * will contain the info about the compression. If the first byte is not present, it is assumed
34
37
  * that the compression is not enabled and no first prefix byte is present in the blobs.
38
+ * @public
35
39
  */
36
40
  export class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {
37
41
  private _isCompressionEnabled: boolean = false;
@@ -17,6 +17,7 @@ import {
17
17
  * @param documentServiceFactory - The document service factory to apply compression to.
18
18
  * @param config - The compression configuration.
19
19
  * @returns The document service factory possibly with compression applied.
20
+ * @public
20
21
  */
21
22
  export function applyStorageCompression(
22
23
  documentServiceFactory: IDocumentServiceFactory,
package/src/blob.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
 
14
14
  /**
15
15
  * Basic implementation of a blob ITreeEntry
16
+ * @public
16
17
  */
17
18
  export class BlobTreeEntry {
18
19
  public readonly mode = FileMode.File;
@@ -36,6 +37,7 @@ export class BlobTreeEntry {
36
37
 
37
38
  /**
38
39
  * Basic implementation of a tree ITreeEntry
40
+ * @public
39
41
  */
40
42
  export class TreeTreeEntry {
41
43
  public readonly mode = FileMode.Directory;
@@ -54,6 +56,7 @@ export class TreeTreeEntry {
54
56
 
55
57
  /**
56
58
  * Basic implementation of an attachment ITreeEntry
59
+ * @public
57
60
  */
58
61
  export class AttachmentTreeEntry {
59
62
  public readonly mode = FileMode.File;
@@ -86,6 +86,7 @@ function flatten(tree: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): git
86
86
  * @param blobMap - a map of blob's sha1 to content that gets filled with content from entries
87
87
  * NOTE: blobMap's validity is contingent on the returned promise's resolution
88
88
  * @returns the hierarchical tree
89
+ * @public
89
90
  */
90
91
  export function buildSnapshotTree(
91
92
  entries: ITreeEntry[],
@@ -17,6 +17,9 @@ import {
17
17
  IVersion,
18
18
  } from "@fluidframework/protocol-definitions";
19
19
 
20
+ /**
21
+ * @public
22
+ */
20
23
  export class DocumentStorageServiceProxy implements IDocumentStorageService {
21
24
  private _policies: IDocumentStorageServicePolicies | undefined;
22
25
 
package/src/error.ts CHANGED
@@ -7,7 +7,10 @@
7
7
  import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
8
8
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
9
9
 
10
- /** Error indicating an API is being used improperly resulting in an invalid operation. */
10
+ /**
11
+ * Error indicating an API is being used improperly resulting in an invalid operation.
12
+ * @public
13
+ */
11
14
  export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
12
15
  // eslint-disable-next-line import/no-deprecated
13
16
  readonly errorType = DriverErrorType.usageError;
package/src/index.ts CHANGED
@@ -51,5 +51,6 @@ export { convertSummaryTreeToSnapshotITree } from "./treeConversions";
51
51
  export {
52
52
  applyStorageCompression,
53
53
  ICompressionStorageConfig,
54
+ SummaryCompressionAlgorithm,
54
55
  blobHeadersBlobName,
55
56
  } from "./adapters";
@@ -22,6 +22,7 @@ import Axios from "axios";
22
22
  * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
23
23
  * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
24
24
  * works or a router inside of a single page app framework.
25
+ * @public
25
26
  */
26
27
  export class InsecureUrlResolver implements IUrlResolver {
27
28
  private readonly cache = new Map<string, Promise<IResolvedUrl>>();
@@ -12,18 +12,25 @@ import {
12
12
  * Tells if message was sent by container runtime
13
13
  * @privateRemarks ADO #1385: To be moved to container-definitions
14
14
  * @returns whether the message is a runtime message
15
+ * @public
15
16
  */
16
17
  export function isRuntimeMessage(message: { type: string }): boolean {
17
18
  return message.type === MessageType.Operation;
18
19
  }
19
20
 
20
- // ADO #1385: staging code changes across layers.
21
- // Eventually to be replaced by MessageType.accept
21
+ /**
22
+ * @privateRemarks ADO #1385: staging code changes across layers.
23
+ * Eventually to be replaced by MessageType.accept
24
+ * @public
25
+ */
22
26
  export enum MessageType2 {
23
27
  Accept = "accept",
24
28
  }
25
29
 
26
- // ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
30
+ /**
31
+ * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
32
+ * @public
33
+ */
27
34
  export function canBeCoalescedByService(
28
35
  message: ISequencedDocumentMessage | IDocumentMessage,
29
36
  ): boolean {
package/src/network.ts CHANGED
@@ -16,15 +16,21 @@ import {
16
16
  import { ITelemetryProperties } from "@fluidframework/core-interfaces";
17
17
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
18
18
 
19
+ /**
20
+ * @public
21
+ */
19
22
  export enum OnlineStatus {
20
23
  Offline,
21
24
  Online,
22
25
  Unknown,
23
26
  }
24
27
 
25
- // It tells if we have local connection only - we might not have connection to web.
26
- // No solution for node.js (other than resolve dns names / ping specific sites)
27
- // Can also use window.addEventListener("online" / "offline")
28
+ /**
29
+ * It tells if we have local connection only - we might not have connection to web.
30
+ * No solution for node.js (other than resolve dns names / ping specific sites)
31
+ * Can also use window.addEventListener("online" / "offline")
32
+ * @public
33
+ */
28
34
  export function isOnline(): OnlineStatus {
29
35
  if (
30
36
  typeof navigator === "object" &&
@@ -36,13 +42,17 @@ export function isOnline(): OnlineStatus {
36
42
  return OnlineStatus.Unknown;
37
43
  }
38
44
 
39
- /** Telemetry props with driver-specific required properties */
45
+ /**
46
+ * Telemetry props with driver-specific required properties
47
+ * @public
48
+ */
40
49
  export type DriverErrorTelemetryProps = ITelemetryProperties & {
41
50
  driverVersion: string | undefined;
42
51
  };
43
52
 
44
53
  /**
45
54
  * Generic network error class.
55
+ * @public
46
56
  */
47
57
  export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
48
58
  // eslint-disable-next-line import/no-deprecated
@@ -59,6 +69,7 @@ export class GenericNetworkError extends LoggingError implements IDriverErrorBas
59
69
 
60
70
  /**
61
71
  * FluidInvalidSchema error class.
72
+ * @public
62
73
  */
63
74
  export class FluidInvalidSchemaError
64
75
  extends LoggingError
@@ -73,6 +84,9 @@ export class FluidInvalidSchemaError
73
84
  }
74
85
  }
75
86
 
87
+ /**
88
+ * @public
89
+ */
76
90
  export class DeltaStreamConnectionForbiddenError
77
91
  extends LoggingError
78
92
  implements IDriverErrorBase, IFluidErrorBase
@@ -89,6 +103,9 @@ export class DeltaStreamConnectionForbiddenError
89
103
  }
90
104
  }
91
105
 
106
+ /**
107
+ * @public
108
+ */
92
109
  export class AuthorizationError
93
110
  extends LoggingError
94
111
  implements IAuthorizationError, IFluidErrorBase
@@ -108,6 +125,9 @@ export class AuthorizationError
108
125
  }
109
126
  }
110
127
 
128
+ /**
129
+ * @public
130
+ */
111
131
  export class LocationRedirectionError
112
132
  extends LoggingError
113
133
  implements ILocationRedirectionError, IFluidErrorBase
@@ -126,6 +146,9 @@ export class LocationRedirectionError
126
146
  }
127
147
  }
128
148
 
149
+ /**
150
+ * @public
151
+ */
129
152
  export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
130
153
  constructor(
131
154
  message: string,
@@ -137,6 +160,9 @@ export class NetworkErrorBasic<T extends string> extends LoggingError implements
137
160
  }
138
161
  }
139
162
 
163
+ /**
164
+ * @public
165
+ */
140
166
  export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
141
167
  constructor(
142
168
  message: string,
@@ -147,6 +173,9 @@ export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
147
173
  }
148
174
  }
149
175
 
176
+ /**
177
+ * @public
178
+ */
150
179
  export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
151
180
  constructor(
152
181
  message: string,
@@ -159,6 +188,7 @@ export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
159
188
 
160
189
  /**
161
190
  * Throttling error class - used to communicate all throttling errors
191
+ * @public
162
192
  */
163
193
  export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
164
194
  // eslint-disable-next-line import/no-deprecated
@@ -174,9 +204,15 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
174
204
  }
175
205
  }
176
206
 
207
+ /**
208
+ * @public
209
+ */
177
210
  export const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>
178
211
  new NonRetryableError(message, DriverErrorTypes.writeError, props);
179
212
 
213
+ /**
214
+ * @public
215
+ */
180
216
  export function createGenericNetworkError(
181
217
  message: string,
182
218
  retryInfo: { canRetry: boolean; retryAfterMs?: number },
@@ -192,13 +228,20 @@ export function createGenericNetworkError(
192
228
  * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
193
229
  * I.e. asserts or unexpected exceptions in our code result in container failure.
194
230
  * @param error - The error to inspect for ability to retry
231
+ * @public
195
232
  */
196
233
  export const canRetryOnError = (error: any): boolean => error?.canRetry === true;
197
234
 
198
- /** Check retryAfterSeconds property on error */
235
+ /**
236
+ * Check retryAfterSeconds property on error
237
+ * @public
238
+ * */
199
239
  export const getRetryDelaySecondsFromError = (error: any): number | undefined =>
200
240
  error?.retryAfterSeconds as number | undefined;
201
241
 
202
- /** Check retryAfterSeconds property on error and convert to ms */
242
+ /**
243
+ * Check retryAfterSeconds property on error and convert to ms
244
+ * @public
245
+ * */
203
246
  export const getRetryDelayFromError = (error: any): number | undefined =>
204
247
  error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
@@ -7,6 +7,9 @@ import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
7
7
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
8
8
  import { isOnline, OnlineStatus, canRetryOnError } from "./network";
9
9
 
10
+ /**
11
+ * @public
12
+ */
10
13
  export function logNetworkFailure(
11
14
  logger: ITelemetryLoggerExt,
12
15
  event: ITelemetryErrorEvent,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-utils";
9
- export const pkgVersion = "2.0.0-internal.7.1.0";
9
+ export const pkgVersion = "2.0.0-internal.7.2.0";
@@ -29,6 +29,7 @@ type WorkingState = "working" | "done" | "canceled";
29
29
  * @param logger - logger to use
30
30
  * @param requestCallback - callback to request batches
31
31
  * @returns Queue that can be used to retrieve data
32
+ * @public
32
33
  */
33
34
  export class ParallelRequests<T> {
34
35
  private latestRequested: number;
@@ -338,6 +339,7 @@ export class ParallelRequests<T> {
338
339
  /**
339
340
  * Helper queue class to allow async push / pull
340
341
  * It's essentially a pipe allowing multiple writers, and single reader
342
+ * @public
341
343
  */
342
344
  export class Queue<T> implements IStream<T> {
343
345
  private readonly queue: Promise<IStreamResult<T>>[] = [];
@@ -531,6 +533,7 @@ async function getSingleOpBatch(
531
533
  * @param signal - Cancelation signal
532
534
  * @param scenarioName - Reason for fetching ops
533
535
  * @returns Messages fetched
536
+ * @public
534
537
  */
535
538
  export function requestOps(
536
539
  get: (
@@ -651,12 +654,18 @@ export function requestOps(
651
654
  return queue;
652
655
  }
653
656
 
657
+ /**
658
+ * @public
659
+ */
654
660
  export const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {
655
661
  read: async () => {
656
662
  return { done: true };
657
663
  },
658
664
  };
659
665
 
666
+ /**
667
+ * @public
668
+ */
660
669
  export function streamFromMessages(
661
670
  messagesArg: Promise<ISequencedDocumentMessage[]>,
662
671
  ): IStream<ISequencedDocumentMessage[]> {
@@ -673,6 +682,9 @@ export function streamFromMessages(
673
682
  };
674
683
  }
675
684
 
685
+ /**
686
+ * @public
687
+ */
676
688
  export function streamObserver<T>(
677
689
  stream: IStream<T>,
678
690
  handler: (value: IStreamResult<T>) => void,
@@ -7,6 +7,9 @@ import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
7
7
  import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
8
8
  import { canRetryOnError } from "./network";
9
9
 
10
+ /**
11
+ * @public
12
+ */
10
13
  export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
11
14
  // BlobId -> blob prefetchCache cache
12
15
  private readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();
@@ -5,6 +5,9 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils";
7
7
 
8
+ /**
9
+ * @public
10
+ */
8
11
  export class RateLimiter {
9
12
  private readonly tasks: (() => void)[] = [];
10
13
  constructor(private maxRequests: number) {
@@ -17,6 +17,7 @@ import { IDocumentStorageService } from "@fluidframework/driver-definitions";
17
17
  * @typeParam T - Output type matching JSON format of inpyt blob data.
18
18
  *
19
19
  * @returns The object that we decoded and parsed via `JSON.parse`.
20
+ * @public
20
21
  */
21
22
  export async function readAndParse<T>(
22
23
  storage: Pick<IDocumentStorageService, "readBlob">,
@@ -14,6 +14,7 @@ import { NonRetryableError } from ".";
14
14
  /**
15
15
  * Interface describing an object passed to various network APIs.
16
16
  * It allows caller to control cancellation, as well as learn about any delays.
17
+ * @public
17
18
  */
18
19
  export interface IProgress {
19
20
  /**
@@ -43,6 +44,9 @@ export interface IProgress {
43
44
  onRetry?(delayInMs: number, error: any): void;
44
45
  }
45
46
 
47
+ /**
48
+ * @public
49
+ */
46
50
  export async function runWithRetry<T>(
47
51
  api: (cancel?: AbortSignal) => Promise<T>,
48
52
  fetchCallName: string,
@@ -81,8 +85,7 @@ export async function runWithRetry<T>(
81
85
  retry: numRetries,
82
86
  duration: performance.now() - startTime,
83
87
  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,
88
+ reason: progress.cancel.reason,
86
89
  },
87
90
  err,
88
91
  );
@@ -92,8 +95,7 @@ export async function runWithRetry<T>(
92
95
  {
93
96
  driverVersion: pkgVersion,
94
97
  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,
98
+ reason: progress.cancel.reason,
97
99
  },
98
100
  );
99
101
  }
@@ -148,6 +150,7 @@ const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
148
150
  * to when endpoint is reachable in which case it is 30s.
149
151
  * @param error - error based on which we decide max wait time.
150
152
  * @returns Max wait time.
153
+ * @public
151
154
  */
152
155
  export function calculateMaxWaitTime(error: unknown): number {
153
156
  return isFluidError(error) && error.getTelemetryProperties().endpointReached === true
@@ -30,6 +30,7 @@ export interface CombinedAppAndProtocolSummary extends ISummaryTree {
30
30
  */
31
31
  export function isCombinedAppAndProtocolSummary(
32
32
  summary: ISummaryTree | undefined,
33
+ ...optionalRootTrees: string[]
33
34
  ): summary is CombinedAppAndProtocolSummary {
34
35
  if (
35
36
  summary?.tree === undefined ||
@@ -38,7 +39,7 @@ export function isCombinedAppAndProtocolSummary(
38
39
  ) {
39
40
  return false;
40
41
  }
41
- const treeKeys = Object.keys(summary.tree);
42
+ const treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));
42
43
  if (treeKeys.length !== 2) {
43
44
  return false;
44
45
  }
@@ -48,6 +49,7 @@ export function isCombinedAppAndProtocolSummary(
48
49
  /**
49
50
  * Extract the attributes from the protocol summary.
50
51
  * @param protocolSummary - protocol summary from which the values are to be extracted.
52
+ * @public
51
53
  */
52
54
  export function getDocAttributesFromProtocolSummary(
53
55
  protocolSummary: ISummaryTree,
@@ -59,6 +61,7 @@ export function getDocAttributesFromProtocolSummary(
59
61
  /**
60
62
  * Extract quorum values from the protocol summary.
61
63
  * @param protocolSummary - protocol summary from which the values are to be extracted.
64
+ * @public
62
65
  */
63
66
  export function getQuorumValuesFromProtocolSummary(
64
67
  protocolSummary: ISummaryTree,
@@ -12,6 +12,7 @@ import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";
12
12
  /**
13
13
  * Converts ISummaryTree to ITree format.
14
14
  * @param summaryTree - summary tree in ISummaryTree format
15
+ * @public
15
16
  */
16
17
  export function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree {
17
18
  const entries: ITreeEntry[] = [];