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