@fluidframework/driver-utils 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906

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 (199) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/api-extractor.json +1 -1
  3. package/api-report/driver-utils.api.md +401 -0
  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 +4 -1
  7. package/dist/adapters/compression/compressionTypes.js.map +1 -1
  8. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
  9. package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
  10. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
  11. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
  12. package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
  13. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  14. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  15. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  16. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  17. package/dist/adapters/predefinedAdapters.d.ts +1 -0
  18. package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
  19. package/dist/adapters/predefinedAdapters.js +1 -0
  20. package/dist/adapters/predefinedAdapters.js.map +1 -1
  21. package/dist/blob.d.ts +3 -0
  22. package/dist/blob.d.ts.map +1 -1
  23. package/dist/blob.js +3 -0
  24. package/dist/blob.js.map +1 -1
  25. package/dist/buildSnapshotTree.d.ts +1 -0
  26. package/dist/buildSnapshotTree.d.ts.map +1 -1
  27. package/dist/buildSnapshotTree.js +1 -0
  28. package/dist/buildSnapshotTree.js.map +1 -1
  29. package/dist/documentStorageServiceProxy.d.ts +3 -0
  30. package/dist/documentStorageServiceProxy.d.ts.map +1 -1
  31. package/dist/documentStorageServiceProxy.js +6 -3
  32. package/dist/documentStorageServiceProxy.js.map +1 -1
  33. package/dist/driver-utils-alpha.d.ts +574 -0
  34. package/dist/driver-utils-beta.d.ts +574 -0
  35. package/dist/driver-utils-public.d.ts +574 -0
  36. package/dist/driver-utils-untrimmed.d.ts +588 -0
  37. package/dist/error.d.ts +4 -1
  38. package/dist/error.d.ts.map +1 -1
  39. package/dist/error.js +4 -1
  40. package/dist/error.js.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/insecureUrlResolver.d.ts +1 -0
  46. package/dist/insecureUrlResolver.d.ts.map +1 -1
  47. package/dist/insecureUrlResolver.js +2 -1
  48. package/dist/insecureUrlResolver.js.map +1 -1
  49. package/dist/messageRecognition.d.ts +10 -0
  50. package/dist/messageRecognition.d.ts.map +1 -1
  51. package/dist/messageRecognition.js +11 -4
  52. package/dist/messageRecognition.js.map +1 -1
  53. package/dist/network.d.ts +50 -4
  54. package/dist/network.d.ts.map +1 -1
  55. package/dist/network.js +46 -6
  56. package/dist/network.js.map +1 -1
  57. package/dist/networkUtils.d.ts +3 -0
  58. package/dist/networkUtils.d.ts.map +1 -1
  59. package/dist/networkUtils.js +3 -0
  60. package/dist/networkUtils.js.map +1 -1
  61. package/dist/packageVersion.d.ts +1 -1
  62. package/dist/packageVersion.js +1 -1
  63. package/dist/packageVersion.js.map +1 -1
  64. package/dist/parallelRequests.d.ts +12 -0
  65. package/dist/parallelRequests.d.ts.map +1 -1
  66. package/dist/parallelRequests.js +18 -6
  67. package/dist/parallelRequests.js.map +1 -1
  68. package/dist/prefetchDocumentStorageService.d.ts +3 -1
  69. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  70. package/dist/prefetchDocumentStorageService.js +3 -0
  71. package/dist/prefetchDocumentStorageService.js.map +1 -1
  72. package/dist/rateLimiter.d.ts +3 -0
  73. package/dist/rateLimiter.d.ts.map +1 -1
  74. package/dist/rateLimiter.js +3 -0
  75. package/dist/rateLimiter.js.map +1 -1
  76. package/dist/readAndParse.d.ts +1 -0
  77. package/dist/readAndParse.d.ts.map +1 -1
  78. package/dist/readAndParse.js +1 -0
  79. package/dist/readAndParse.js.map +1 -1
  80. package/dist/runWithRetry.d.ts +5 -0
  81. package/dist/runWithRetry.d.ts.map +1 -1
  82. package/dist/runWithRetry.js +4 -2
  83. package/dist/runWithRetry.js.map +1 -1
  84. package/dist/summaryForCreateNew.d.ts +3 -1
  85. package/dist/summaryForCreateNew.d.ts.map +1 -1
  86. package/dist/summaryForCreateNew.js +4 -2
  87. package/dist/summaryForCreateNew.js.map +1 -1
  88. package/dist/treeConversions.d.ts +1 -0
  89. package/dist/treeConversions.d.ts.map +1 -1
  90. package/dist/treeConversions.js +1 -0
  91. package/dist/treeConversions.js.map +1 -1
  92. package/dist/tsdoc-metadata.json +1 -1
  93. package/lib/adapters/compression/compressionTypes.d.ts +6 -0
  94. package/lib/adapters/compression/compressionTypes.d.ts.map +1 -1
  95. package/lib/adapters/compression/compressionTypes.js +3 -0
  96. package/lib/adapters/compression/compressionTypes.js.map +1 -1
  97. package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
  98. package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
  99. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
  100. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
  101. package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
  102. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  103. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  104. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  105. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  106. package/lib/adapters/predefinedAdapters.d.ts +1 -0
  107. package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
  108. package/lib/adapters/predefinedAdapters.js +1 -0
  109. package/lib/adapters/predefinedAdapters.js.map +1 -1
  110. package/lib/blob.d.ts +3 -0
  111. package/lib/blob.d.ts.map +1 -1
  112. package/lib/blob.js +3 -0
  113. package/lib/blob.js.map +1 -1
  114. package/lib/buildSnapshotTree.d.ts +1 -0
  115. package/lib/buildSnapshotTree.d.ts.map +1 -1
  116. package/lib/buildSnapshotTree.js +1 -0
  117. package/lib/buildSnapshotTree.js.map +1 -1
  118. package/lib/documentStorageServiceProxy.d.ts +3 -0
  119. package/lib/documentStorageServiceProxy.d.ts.map +1 -1
  120. package/lib/documentStorageServiceProxy.js +6 -3
  121. package/lib/documentStorageServiceProxy.js.map +1 -1
  122. package/lib/error.d.ts +4 -1
  123. package/lib/error.d.ts.map +1 -1
  124. package/lib/error.js +4 -1
  125. package/lib/error.js.map +1 -1
  126. package/lib/index.d.ts +1 -1
  127. package/lib/index.d.ts.map +1 -1
  128. package/lib/index.js +1 -1
  129. package/lib/index.js.map +1 -1
  130. package/lib/insecureUrlResolver.d.ts +1 -0
  131. package/lib/insecureUrlResolver.d.ts.map +1 -1
  132. package/lib/insecureUrlResolver.js +2 -1
  133. package/lib/insecureUrlResolver.js.map +1 -1
  134. package/lib/messageRecognition.d.ts +10 -0
  135. package/lib/messageRecognition.d.ts.map +1 -1
  136. package/lib/messageRecognition.js +10 -3
  137. package/lib/messageRecognition.js.map +1 -1
  138. package/lib/network.d.ts +50 -4
  139. package/lib/network.d.ts.map +1 -1
  140. package/lib/network.js +45 -5
  141. package/lib/network.js.map +1 -1
  142. package/lib/networkUtils.d.ts +3 -0
  143. package/lib/networkUtils.d.ts.map +1 -1
  144. package/lib/networkUtils.js +3 -0
  145. package/lib/networkUtils.js.map +1 -1
  146. package/lib/packageVersion.d.ts +1 -1
  147. package/lib/packageVersion.js +1 -1
  148. package/lib/packageVersion.js.map +1 -1
  149. package/lib/parallelRequests.d.ts +12 -0
  150. package/lib/parallelRequests.d.ts.map +1 -1
  151. package/lib/parallelRequests.js +18 -6
  152. package/lib/parallelRequests.js.map +1 -1
  153. package/lib/prefetchDocumentStorageService.d.ts +3 -1
  154. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  155. package/lib/prefetchDocumentStorageService.js +3 -0
  156. package/lib/prefetchDocumentStorageService.js.map +1 -1
  157. package/lib/rateLimiter.d.ts +3 -0
  158. package/lib/rateLimiter.d.ts.map +1 -1
  159. package/lib/rateLimiter.js +3 -0
  160. package/lib/rateLimiter.js.map +1 -1
  161. package/lib/readAndParse.d.ts +1 -0
  162. package/lib/readAndParse.d.ts.map +1 -1
  163. package/lib/readAndParse.js +1 -0
  164. package/lib/readAndParse.js.map +1 -1
  165. package/lib/runWithRetry.d.ts +5 -0
  166. package/lib/runWithRetry.d.ts.map +1 -1
  167. package/lib/runWithRetry.js +4 -2
  168. package/lib/runWithRetry.js.map +1 -1
  169. package/lib/summaryForCreateNew.d.ts +3 -1
  170. package/lib/summaryForCreateNew.d.ts.map +1 -1
  171. package/lib/summaryForCreateNew.js +4 -2
  172. package/lib/summaryForCreateNew.js.map +1 -1
  173. package/lib/treeConversions.d.ts +1 -0
  174. package/lib/treeConversions.d.ts.map +1 -1
  175. package/lib/treeConversions.js +1 -0
  176. package/lib/treeConversions.js.map +1 -1
  177. package/package.json +21 -22
  178. package/src/adapters/compression/compressionTypes.ts +6 -0
  179. package/src/adapters/compression/documentServiceCompressionAdapter.ts +4 -1
  180. package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +1 -9
  181. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +4 -0
  182. package/src/adapters/predefinedAdapters.ts +1 -0
  183. package/src/blob.ts +11 -2
  184. package/src/buildSnapshotTree.ts +1 -0
  185. package/src/documentStorageServiceProxy.ts +3 -0
  186. package/src/error.ts +4 -1
  187. package/src/index.ts +1 -0
  188. package/src/insecureUrlResolver.ts +2 -1
  189. package/src/messageRecognition.ts +10 -3
  190. package/src/network.ts +64 -9
  191. package/src/networkUtils.ts +3 -0
  192. package/src/packageVersion.ts +1 -1
  193. package/src/parallelRequests.ts +13 -1
  194. package/src/prefetchDocumentStorageService.ts +3 -0
  195. package/src/rateLimiter.ts +3 -0
  196. package/src/readAndParse.ts +1 -0
  197. package/src/runWithRetry.ts +7 -4
  198. package/src/summaryForCreateNew.ts +4 -1
  199. package/src/treeConversions.ts +1 -0
@@ -0,0 +1,574 @@
1
+ import { FetchSource } from '@fluidframework/driver-definitions';
2
+ import { IAttachment } from '@fluidframework/protocol-definitions';
3
+ import { IAuthorizationError } from '@fluidframework/driver-definitions';
4
+ import { IBlob } from '@fluidframework/protocol-definitions';
5
+ import { ICommittedProposal } from '@fluidframework/protocol-definitions';
6
+ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
7
+ import { IDeltasFetchResult } from '@fluidframework/driver-definitions';
8
+ import { IDocumentAttributes } from '@fluidframework/protocol-definitions';
9
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
10
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
11
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
12
+ import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
13
+ import { IDriverErrorBase } from '@fluidframework/driver-definitions';
14
+ import { IFluidErrorBase } from '@fluidframework/telemetry-utils';
15
+ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
16
+ import { IRequest } from '@fluidframework/core-interfaces';
17
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
18
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
19
+ import { ISnapshotTree } from '@fluidframework/protocol-definitions';
20
+ import { IStream } from '@fluidframework/driver-definitions';
21
+ import { IStreamResult } from '@fluidframework/driver-definitions';
22
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
23
+ import { ISummaryHandle } from '@fluidframework/protocol-definitions';
24
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
25
+ import { ITelemetryErrorEvent } from '@fluidframework/core-interfaces';
26
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
27
+ import { ITelemetryProperties } from '@fluidframework/core-interfaces';
28
+ import { IThrottlingWarning } from '@fluidframework/driver-definitions';
29
+ import { ITree } from '@fluidframework/protocol-definitions';
30
+ import { ITreeEntry } from '@fluidframework/protocol-definitions';
31
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
32
+ import { IVersion } from '@fluidframework/protocol-definitions';
33
+ import { LoaderCachingPolicy } from '@fluidframework/driver-definitions';
34
+
35
+ /**
36
+ * This method optionally applies compression to the given document service factory. The compression
37
+ * must be enabled by setting the config to true or by passing a compression config object.
38
+ * @param documentServiceFactory - The document service factory to apply compression to.
39
+ * @param config - The compression configuration.
40
+ * @returns The document service factory possibly with compression applied.
41
+ * @public
42
+ */
43
+ export declare function applyStorageCompression(documentServiceFactory: IDocumentServiceFactory, config?: ICompressionStorageConfig | boolean): IDocumentServiceFactory;
44
+
45
+ /**
46
+ * Basic implementation of an attachment ITreeEntry
47
+ * @public
48
+ */
49
+ export declare class AttachmentTreeEntry {
50
+ readonly path: string;
51
+ readonly id: string;
52
+ readonly mode = FileMode.File;
53
+ readonly type = TreeEntry.Attachment;
54
+ readonly value: IAttachment;
55
+ /**
56
+ * Creates an attachment ITreeEntry
57
+ * @param path - path of entry
58
+ * @param id - id of external blob attachment
59
+ */
60
+ constructor(path: string, id: string);
61
+ }
62
+
63
+ /**
64
+ * @public
65
+ */
66
+ export declare class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
67
+ readonly claims: string | undefined;
68
+ readonly tenantId: string | undefined;
69
+ readonly errorType = DriverErrorType.authorizationError;
70
+ readonly canRetry = false;
71
+ constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
72
+ }
73
+
74
+ /**
75
+ * @public
76
+ */
77
+ export declare const blobHeadersBlobName = ".metadata.blobHeaders";
78
+
79
+ /**
80
+ * Basic implementation of a blob ITreeEntry
81
+ * @public
82
+ */
83
+ export declare class BlobTreeEntry {
84
+ readonly path: string;
85
+ readonly mode = FileMode.File;
86
+ readonly type = TreeEntry.Blob;
87
+ readonly value: IBlob;
88
+ /**
89
+ * Creates a blob ITreeEntry
90
+ * @param path - path of entry
91
+ * @param contents - blob contents
92
+ * @param encoding - encoding of contents; defaults to utf-8
93
+ */
94
+ constructor(path: string, contents: string, encoding?: "utf-8" | "base64");
95
+ }
96
+
97
+ /**
98
+ * Build a tree hierarchy base on an array of ITreeEntry
99
+ *
100
+ * @param entries - an array of ITreeEntry to flatten
101
+ * @param blobMap - a map of blob's sha1 to content that gets filled with content from entries
102
+ * NOTE: blobMap's validity is contingent on the returned promise's resolution
103
+ * @returns the hierarchical tree
104
+ * @public
105
+ */
106
+ export declare function buildSnapshotTree(entries: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): ISnapshotTree;
107
+
108
+ /**
109
+ * In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some transient error
110
+ * not related to endpoint, in that case we want to try at faster pace and hence the max wait is lesser 8s as compared
111
+ * to when endpoint is reachable in which case it is 30s.
112
+ * @param error - error based on which we decide max wait time.
113
+ * @returns Max wait time.
114
+ * @public
115
+ */
116
+ export declare function calculateMaxWaitTime(error: unknown): number;
117
+
118
+ /**
119
+ * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
120
+ * @public
121
+ */
122
+ export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
123
+
124
+ /**
125
+ * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
126
+ * I.e. asserts or unexpected exceptions in our code result in container failure.
127
+ * @param error - The error to inspect for ability to retry
128
+ * @public
129
+ */
130
+ export declare const canRetryOnError: (error: any) => boolean;
131
+
132
+ /* Excluded from this release type: CombinedAppAndProtocolSummary */
133
+
134
+ /**
135
+ * Converts ISummaryTree to ITree format.
136
+ * @param summaryTree - summary tree in ISummaryTree format
137
+ * @public
138
+ */
139
+ export declare function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree;
140
+
141
+ /**
142
+ * @public
143
+ */
144
+ export declare function createGenericNetworkError(message: string, retryInfo: {
145
+ canRetry: boolean;
146
+ retryAfterMs?: number;
147
+ }, props: DriverErrorTelemetryProps): ThrottlingError | GenericNetworkError;
148
+
149
+ /**
150
+ * @public
151
+ */
152
+ export declare const createWriteError: (message: string, props: DriverErrorTelemetryProps) => NonRetryableError<"writeError">;
153
+
154
+ /**
155
+ * @public
156
+ */
157
+ export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
158
+ static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
159
+ readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
160
+ readonly canRetry = false;
161
+ readonly storageOnlyReason: string | undefined;
162
+ constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string);
163
+ }
164
+
165
+ /**
166
+ * @public
167
+ */
168
+ export declare class DocumentStorageServiceProxy implements IDocumentStorageService {
169
+ protected readonly internalStorageService: IDocumentStorageService;
170
+ private _policies;
171
+ set policies(policies: IDocumentStorageServicePolicies | undefined);
172
+ get policies(): IDocumentStorageServicePolicies | undefined;
173
+ get repositoryUrl(): string;
174
+ constructor(internalStorageService: IDocumentStorageService);
175
+ getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
176
+ getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
177
+ uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
178
+ downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
179
+ createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
180
+ readBlob(blobId: string): Promise<ArrayBufferLike>;
181
+ }
182
+
183
+ /**
184
+ * Telemetry props with driver-specific required properties
185
+ * @public
186
+ */
187
+ export declare type DriverErrorTelemetryProps = ITelemetryProperties & {
188
+ driverVersion: string | undefined;
189
+ };
190
+
191
+ /**
192
+ * @public
193
+ */
194
+ export declare const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
195
+
196
+ /**
197
+ * FluidInvalidSchema error class.
198
+ * @public
199
+ */
200
+ export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
201
+ readonly errorType = DriverErrorType.fluidInvalidSchema;
202
+ readonly canRetry = false;
203
+ constructor(message: string, props: DriverErrorTelemetryProps);
204
+ }
205
+
206
+ /**
207
+ * Generic network error class.
208
+ * @public
209
+ */
210
+ export declare class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
211
+ readonly canRetry: boolean;
212
+ readonly errorType = DriverErrorType.genericNetworkError;
213
+ constructor(message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
214
+ }
215
+
216
+ /**
217
+ * Extract the attributes from the protocol summary.
218
+ * @param protocolSummary - protocol summary from which the values are to be extracted.
219
+ * @public
220
+ */
221
+ export declare function getDocAttributesFromProtocolSummary(protocolSummary: ISummaryTree): IDocumentAttributes;
222
+
223
+ /**
224
+ * Extract quorum values from the protocol summary.
225
+ * @param protocolSummary - protocol summary from which the values are to be extracted.
226
+ * @public
227
+ */
228
+ export declare function getQuorumValuesFromProtocolSummary(protocolSummary: ISummaryTree): [string, ICommittedProposal][];
229
+
230
+ /**
231
+ * Check retryAfterSeconds property on error and convert to ms
232
+ * @public
233
+ * */
234
+ export declare const getRetryDelayFromError: (error: any) => number | undefined;
235
+
236
+ /**
237
+ * Check retryAfterSeconds property on error
238
+ * @public
239
+ * */
240
+ export declare const getRetryDelaySecondsFromError: (error: any) => number | undefined;
241
+
242
+ /**
243
+ * @public
244
+ */
245
+ export declare interface ICompressionStorageConfig {
246
+ algorithm: SummaryCompressionAlgorithm;
247
+ minSizeToCompress: number;
248
+ }
249
+
250
+ /**
251
+ * As the name implies this is not secure and should not be used in production. It simply makes the example easier
252
+ * to get up and running.
253
+ *
254
+ * In our example we run a simple web server via webpack-dev-server. This defines a URL format of the form
255
+ * http://localhost:8080/<documentId>/<path>.
256
+ *
257
+ * We then need to map that to a Fluid based URL. These are of the form
258
+ * fluid://orderingUrl/<tenantId>/<documentId>/<path>.
259
+ *
260
+ * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
261
+ * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
262
+ * works or a router inside of a single page app framework.
263
+ * @public
264
+ */
265
+ export declare class InsecureUrlResolver implements IUrlResolver {
266
+ private readonly hostUrl;
267
+ private readonly ordererUrl;
268
+ private readonly storageUrl;
269
+ private readonly tenantId;
270
+ private readonly bearer;
271
+ private readonly isForNodeTest;
272
+ private readonly cache;
273
+ constructor(hostUrl: string, ordererUrl: string, storageUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
274
+ resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
275
+ private resolveHelper;
276
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
277
+ createCreateNewRequest(fileName?: string): IRequest;
278
+ }
279
+
280
+ /**
281
+ * Interface describing an object passed to various network APIs.
282
+ * It allows caller to control cancellation, as well as learn about any delays.
283
+ * @public
284
+ */
285
+ export declare interface IProgress {
286
+ /**
287
+ * Abort signal used to cancel operation.
288
+ *
289
+ * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
290
+ * Please consult with API documentation / implementation.
291
+ * Note that number of layers may not check this signal while holding this request in a queue,
292
+ * so it may take a while it takes effect. This can be improved in the future.
293
+ *
294
+ * The layers in question are:
295
+ *
296
+ * - driver (RateLimiter)
297
+ *
298
+ * - runWithRetry
299
+ */
300
+ cancel?: AbortSignal;
301
+ /**
302
+ * Called whenever api returns cancellable error and the call is going to be retried.
303
+ * Any exception thrown from this call back result in cancellation of operation
304
+ * and propagation of thrown exception.
305
+ * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,
306
+ * as well as information provided by service (like 429 error asking to wait for some time before retry)
307
+ * @param error - error object returned from the call.
308
+ */
309
+ onRetry?(delayInMs: number, error: any): void;
310
+ }
311
+
312
+ /* Excluded from this release type: isCombinedAppAndProtocolSummary */
313
+
314
+ /**
315
+ * It tells if we have local connection only - we might not have connection to web.
316
+ * No solution for node.js (other than resolve dns names / ping specific sites)
317
+ * Can also use window.addEventListener("online" / "offline")
318
+ * @public
319
+ */
320
+ export declare function isOnline(): OnlineStatus;
321
+
322
+ /**
323
+ * Tells if message was sent by container runtime
324
+ * @privateRemarks ADO #1385: To be moved to container-definitions
325
+ * @returns whether the message is a runtime message
326
+ * @public
327
+ */
328
+ export declare function isRuntimeMessage(message: {
329
+ type: string;
330
+ }): boolean;
331
+
332
+ /**
333
+ * @public
334
+ */
335
+ export declare class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
336
+ readonly redirectUrl: IResolvedUrl;
337
+ readonly errorType = DriverErrorType.locationRedirection;
338
+ readonly canRetry = false;
339
+ constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
340
+ }
341
+
342
+ /* Excluded from this release type: LoggingError */
343
+
344
+ /**
345
+ * @public
346
+ */
347
+ export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEvent, error?: any): void;
348
+
349
+ /**
350
+ * @privateRemarks ADO #1385: staging code changes across layers.
351
+ * Eventually to be replaced by MessageType.accept
352
+ * @public
353
+ */
354
+ export declare enum MessageType2 {
355
+ Accept = "accept"
356
+ }
357
+
358
+ /**
359
+ * @public
360
+ */
361
+ export declare class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
362
+ readonly errorType: T;
363
+ readonly canRetry: boolean;
364
+ constructor(message: string, errorType: T, canRetry: boolean, props: DriverErrorTelemetryProps);
365
+ }
366
+
367
+ /**
368
+ * @public
369
+ */
370
+ export declare class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
371
+ readonly errorType: T;
372
+ constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
373
+ }
374
+
375
+ /**
376
+ * @public
377
+ */
378
+ export declare enum OnlineStatus {
379
+ Offline = 0,
380
+ Online = 1,
381
+ Unknown = 2
382
+ }
383
+
384
+ /**
385
+ * Helper class to organize parallel fetching of data
386
+ * It can be used to concurrently do many requests, while consuming
387
+ * data in the right order. Take a look at UT for examples.
388
+ * @param concurrency - level of concurrency
389
+ * @param from - starting point of fetching data (inclusive)
390
+ * @param to - ending point of fetching data. exclusive, or undefined if unknown
391
+ * @param payloadSize - batch size
392
+ * @param logger - logger to use
393
+ * @param requestCallback - callback to request batches
394
+ * @returns Queue that can be used to retrieve data
395
+ * @public
396
+ */
397
+ export declare class ParallelRequests<T> {
398
+ private to;
399
+ private readonly payloadSize;
400
+ private readonly logger;
401
+ private readonly requestCallback;
402
+ private readonly responseCallback;
403
+ private latestRequested;
404
+ private nextToDeliver;
405
+ private readonly results;
406
+ private workingState;
407
+ private requestsInFlight;
408
+ private readonly endEvent;
409
+ private requests;
410
+ private readonly knewTo;
411
+ private get working();
412
+ get canceled(): boolean;
413
+ constructor(from: number, to: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, requestCallback: (request: number, from: number, to: number, strongTo: boolean, props: ITelemetryProperties) => Promise<{
414
+ partial: boolean;
415
+ cancel: boolean;
416
+ payload: T[];
417
+ }>, responseCallback: (payload: T[]) => void);
418
+ cancel(): void;
419
+ run(concurrency: number): Promise<void>;
420
+ private done;
421
+ private fail;
422
+ private dispatch;
423
+ private getNextChunk;
424
+ private addRequest;
425
+ private addRequestCore;
426
+ }
427
+
428
+ /**
429
+ * @public
430
+ */
431
+ export declare class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
432
+ private readonly prefetchCache;
433
+ private prefetchEnabled;
434
+ get policies(): {
435
+ caching: LoaderCachingPolicy;
436
+ maximumCacheDurationMs?: 432000000 | undefined;
437
+ } | undefined;
438
+ getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
439
+ readBlob(blobId: string): Promise<ArrayBufferLike>;
440
+ stopPrefetch(): void;
441
+ private cachedRead;
442
+ private prefetchTree;
443
+ private prefetchTreeCore;
444
+ }
445
+
446
+ /**
447
+ * Helper queue class to allow async push / pull
448
+ * It's essentially a pipe allowing multiple writers, and single reader
449
+ * @public
450
+ */
451
+ export declare class Queue<T> implements IStream<T> {
452
+ private readonly queue;
453
+ private deferred;
454
+ private done;
455
+ pushValue(value: T): void;
456
+ pushError(error: any): void;
457
+ pushDone(): void;
458
+ protected pushCore(value: Promise<IStreamResult<T>>): void;
459
+ read(): Promise<IStreamResult<T>>;
460
+ }
461
+
462
+ /**
463
+ * @public
464
+ */
465
+ export declare class RateLimiter {
466
+ private maxRequests;
467
+ private readonly tasks;
468
+ constructor(maxRequests: number);
469
+ get waitQueueLength(): number;
470
+ protected readonly release: () => void;
471
+ protected acquire(): Promise<void>;
472
+ schedule<T>(work: () => Promise<T>): Promise<T>;
473
+ }
474
+
475
+ /**
476
+ * Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
477
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
478
+ * it into object of type `T`.
479
+ *
480
+ * @param storage - The `DocumentStorageService` to read from.
481
+ * @param id - The ID of the blob to read and parse.
482
+ *
483
+ * @typeParam T - Output type matching JSON format of inpyt blob data.
484
+ *
485
+ * @returns The object that we decoded and parsed via `JSON.parse`.
486
+ * @public
487
+ */
488
+ export declare function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T>;
489
+
490
+ /**
491
+ * Request ops from storage
492
+ * @param get - Getter callback to get individual batches
493
+ * @param concurrency - Number of concurrent requests to make
494
+ * @param fromTotal - starting sequence number to fetch (inclusive)
495
+ * @param toTotal - max (exclusive) sequence number to fetch
496
+ * @param payloadSize - Payload size
497
+ * @param logger - Logger to log progress and errors
498
+ * @param signal - Cancelation signal
499
+ * @param scenarioName - Reason for fetching ops
500
+ * @returns Messages fetched
501
+ * @public
502
+ */
503
+ export declare function requestOps(get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>, concurrency: number, fromTotal: number, toTotal: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, signal?: AbortSignal, scenarioName?: string): IStream<ISequencedDocumentMessage[]>;
504
+
505
+ /**
506
+ * @public
507
+ */
508
+ export declare class RetryableError<T extends string> extends NetworkErrorBasic<T> {
509
+ readonly errorType: T;
510
+ constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
511
+ }
512
+
513
+ /**
514
+ * @public
515
+ */
516
+ export declare function runWithRetry<T>(api: (cancel?: AbortSignal) => Promise<T>, fetchCallName: string, logger: ITelemetryLoggerExt, progress: IProgress): Promise<T>;
517
+
518
+ /**
519
+ * @public
520
+ */
521
+ export declare function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
522
+
523
+ /**
524
+ * @public
525
+ */
526
+ export declare function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T>;
527
+
528
+ /**
529
+ * @public
530
+ */
531
+ export declare enum SummaryCompressionAlgorithm {
532
+ None = 0,
533
+ LZ4 = 1
534
+ }
535
+
536
+ /**
537
+ * Throttling error class - used to communicate all throttling errors
538
+ * @public
539
+ */
540
+ export declare class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
541
+ readonly retryAfterSeconds: number;
542
+ readonly errorType = DriverErrorType.throttlingError;
543
+ readonly canRetry = true;
544
+ constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
545
+ }
546
+
547
+ /**
548
+ * Basic implementation of a tree ITreeEntry
549
+ * @public
550
+ */
551
+ export declare class TreeTreeEntry {
552
+ readonly path: string;
553
+ readonly value: ITree;
554
+ readonly mode = FileMode.Directory;
555
+ readonly type = TreeEntry.Tree;
556
+ /**
557
+ * Creates a tree ITreeEntry
558
+ * @param path - path of entry
559
+ * @param value - subtree
560
+ */
561
+ constructor(path: string, value: ITree);
562
+ }
563
+
564
+ /**
565
+ * Error indicating an API is being used improperly resulting in an invalid operation.
566
+ * @public
567
+ */
568
+ export declare class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
569
+ readonly errorType = DriverErrorType.usageError;
570
+ readonly canRetry = false;
571
+ constructor(message: string);
572
+ }
573
+
574
+ export { }