@fluidframework/driver-utils 2.0.0-internal.6.3.3 → 2.0.0-internal.7.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.
- package/CHANGELOG.md +66 -0
- package/dist/adapters/compression/compressionTypes.js +1 -1
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +18 -18
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +18 -18
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.js +2 -2
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/documentStorageServiceProxy.js +3 -3
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/insecureUrlResolver.js +1 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.js +1 -1
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +1 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +1 -1
- package/dist/network.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +2 -2
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +9 -9
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +0 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/runWithRetry.d.ts +1 -1
- package/dist/runWithRetry.js +1 -1
- package/dist/runWithRetry.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +18 -18
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +18 -18
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -1
- package/lib/adapters/predefinedAdapters.js +2 -2
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/documentStorageServiceProxy.js +3 -3
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/insecureUrlResolver.js +1 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/network.d.ts +1 -1
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +2 -2
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +9 -9
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +0 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/runWithRetry.d.ts +1 -1
- package/lib/runWithRetry.js +1 -1
- package/lib/runWithRetry.js.map +1 -1
- package/package.json +15 -15
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +1 -9
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +18 -18
- package/src/adapters/predefinedAdapters.ts +2 -2
- package/src/insecureUrlResolver.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +4 -4
- package/src/runWithRetry.ts +1 -1
package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts
CHANGED
|
@@ -48,9 +48,9 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* This method returns true if there is a compression markup byte in the blob, otherwise false
|
|
51
|
+
* This method returns `true` if there is a compression markup byte in the blob, otherwise `false`.
|
|
52
52
|
* @param blob - The blob to compress.
|
|
53
|
-
* @returns
|
|
53
|
+
* @returns `true` if there is a compression markup byte in the blob, otherwise `false`.
|
|
54
54
|
*/
|
|
55
55
|
private static hasPrefix(blob: ArrayBufferLike): boolean {
|
|
56
56
|
const firstByte = IsoBuffer.from(blob)[0];
|
|
@@ -73,7 +73,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
73
73
|
* This method writes the given algorithm to the blob as the first byte.
|
|
74
74
|
* @param blob - The blob to write the algorithm to.
|
|
75
75
|
* @param algorithm - The algorithm to write.
|
|
76
|
-
* @returns
|
|
76
|
+
* @returns The blob with the algorithm as the first byte.
|
|
77
77
|
*/
|
|
78
78
|
private static writeAlgorithmToBlob(blob: ArrayBufferLike, algorithm: number): ArrayBufferLike {
|
|
79
79
|
if (algorithm === SummaryCompressionAlgorithm.None) {
|
|
@@ -97,7 +97,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
97
97
|
/**
|
|
98
98
|
* This method removes the algorithm markup prefix from the blob (1 byte)
|
|
99
99
|
* @param blob - The blob to remove the prefix from.
|
|
100
|
-
* @returns
|
|
100
|
+
* @returns The blob without the prefix.
|
|
101
101
|
*/
|
|
102
102
|
private static removePrefixFromBlobIfPresent(blob: ArrayBufferLike): ArrayBufferLike {
|
|
103
103
|
const blobView = new Uint8Array(blob);
|
|
@@ -109,7 +109,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
109
109
|
* it is just returned as is. If the parameter is string, it is converted to Uint8Array using
|
|
110
110
|
* TextEncoder.
|
|
111
111
|
* @param input - The input to convert to Uint8Array.
|
|
112
|
-
* @returns
|
|
112
|
+
* @returns The Uint8Array representation of the input.
|
|
113
113
|
*/
|
|
114
114
|
private static toBinaryArray(input: string | Uint8Array): Uint8Array {
|
|
115
115
|
return typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
@@ -120,7 +120,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
120
120
|
* containing the compression algorithm.
|
|
121
121
|
* @param input - The summary object to encode.
|
|
122
122
|
* @param config - The config containing the compression algorithm.
|
|
123
|
-
* @returns
|
|
123
|
+
* @returns The summary object with the encoded blob.
|
|
124
124
|
*/
|
|
125
125
|
private static readonly blobEncoder = (
|
|
126
126
|
input: SummaryObject,
|
|
@@ -147,7 +147,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
147
147
|
/**
|
|
148
148
|
* This method decodes the blob inside the given summary object of the SummaryType.Blob type.
|
|
149
149
|
* @param input - The summary object to decode.
|
|
150
|
-
* @returns
|
|
150
|
+
* @returns The summary object with the decoded blob.
|
|
151
151
|
*/
|
|
152
152
|
private static readonly blobDecoder = (input: SummaryObject): SummaryObject => {
|
|
153
153
|
if (input.type === SummaryType.Blob) {
|
|
@@ -171,7 +171,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
171
171
|
* This method encodes the given blob according to the given config.
|
|
172
172
|
* @param file - The blob to encode.
|
|
173
173
|
* @param config - The config to use for encoding.
|
|
174
|
-
* @returns
|
|
174
|
+
* @returns The encoded blob.
|
|
175
175
|
*/
|
|
176
176
|
private static encodeBlob(
|
|
177
177
|
file: ArrayBufferLike,
|
|
@@ -200,7 +200,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
200
200
|
/**
|
|
201
201
|
* This method decodes the given blob.
|
|
202
202
|
* @param file - The blob to decode.
|
|
203
|
-
* @returns
|
|
203
|
+
* @returns The decoded blob.
|
|
204
204
|
*/
|
|
205
205
|
private static decodeBlob(file: ArrayBufferLike): ArrayBufferLike {
|
|
206
206
|
let decompressed: ArrayBufferLike;
|
|
@@ -232,7 +232,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
232
232
|
* @param decoder - The decoder function to use.
|
|
233
233
|
* @param config - The config to use for encoding.
|
|
234
234
|
* @param context - The summary context.
|
|
235
|
-
* @returns
|
|
235
|
+
* @returns The summary object with the encoded/decoded blob.
|
|
236
236
|
*/
|
|
237
237
|
private static recursivelyReplace(
|
|
238
238
|
isEncode: boolean,
|
|
@@ -275,7 +275,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
275
275
|
* it returns the summary tree containing that blob.
|
|
276
276
|
*
|
|
277
277
|
* @param summary - The summary tree to traverse.
|
|
278
|
-
* @returns
|
|
278
|
+
* @returns The summary tree containing the metadata blob.
|
|
279
279
|
*/
|
|
280
280
|
private static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {
|
|
281
281
|
assert(typeof summary === "object", 0x6f7 /* summary must be a non-null object */);
|
|
@@ -299,7 +299,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
299
299
|
* This method obtains the summary tree containing the metadata blob. It returns the content
|
|
300
300
|
* of the tree atribute.
|
|
301
301
|
* @param summary - The summary tree to traverse.
|
|
302
|
-
* @returns
|
|
302
|
+
* @returns The content of the tree attribute of the summary tree containing the metadata blob.
|
|
303
303
|
*/
|
|
304
304
|
private static getMetadataHolderTree(summary: ISummaryTree) {
|
|
305
305
|
const metadataHolder = this.findMetadataHolderSummary(summary);
|
|
@@ -326,7 +326,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
326
326
|
* it checks, if the SummaryTree holder of that object also contains the compression markup blob. If it is found,
|
|
327
327
|
* it returns true, otherwise false.
|
|
328
328
|
* @param snapshot - The snapshot tree to traverse.
|
|
329
|
-
* @returns
|
|
329
|
+
* @returns True if the compression markup blob is found, otherwise false.
|
|
330
330
|
*/
|
|
331
331
|
private static hasCompressionMarkup(snapshot: ISnapshotTree): boolean {
|
|
332
332
|
assert(typeof snapshot === "object", 0x6f9 /* snapshot must be a non-null object */);
|
|
@@ -354,7 +354,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
354
354
|
* This method performs compression of the blobs in the summary tree.
|
|
355
355
|
* @param summary - The summary tree to compress.
|
|
356
356
|
* @param config - The compression config.
|
|
357
|
-
* @returns
|
|
357
|
+
* @returns The compressed summary tree.
|
|
358
358
|
*/
|
|
359
359
|
public static compressSummary(
|
|
360
360
|
summary: ISummaryTree,
|
|
@@ -375,7 +375,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
375
375
|
/**
|
|
376
376
|
* This method read blob from the storage and decompresses it if it is compressed.
|
|
377
377
|
* @param id - The id of the blob to read.
|
|
378
|
-
* @returns
|
|
378
|
+
* @returns The decompressed blob.
|
|
379
379
|
*/
|
|
380
380
|
public override async readBlob(id: string): Promise<ArrayBufferLike> {
|
|
381
381
|
const originalBlob = await super.readBlob(id);
|
|
@@ -395,7 +395,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
395
395
|
* algorithm byte prefix and store them.
|
|
396
396
|
* @param version - The version of the snapshot tree to load.
|
|
397
397
|
* @param scenarioName - The scenario name of the snapshot tree to load.
|
|
398
|
-
* @returns
|
|
398
|
+
* @returns The snapshot tree.
|
|
399
399
|
*/
|
|
400
400
|
public override async getSnapshotTree(
|
|
401
401
|
version?: IVersion | undefined,
|
|
@@ -414,7 +414,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
414
414
|
* This method uploads the summary to the storage. It performs compression of the blobs in the summary tree.
|
|
415
415
|
* @param summary - The summary tree to upload.
|
|
416
416
|
* @param context - The summary context.
|
|
417
|
-
* @returns
|
|
417
|
+
* @returns The ID of the uploaded summary.
|
|
418
418
|
*/
|
|
419
419
|
public override async uploadSummaryWithContext(
|
|
420
420
|
summary: ISummaryTree,
|
|
@@ -430,7 +430,7 @@ export class DocumentStorageServiceCompressionAdapter extends DocumentStorageSer
|
|
|
430
430
|
/**
|
|
431
431
|
* This method downloads the summary from the storage and then applies decompression on the compressed blobs.
|
|
432
432
|
* @param id - The ID of the summary to be downloaded
|
|
433
|
-
* @returns
|
|
433
|
+
* @returns The summary with decompressed blobs
|
|
434
434
|
*/
|
|
435
435
|
public override async downloadSummary(id: ISummaryHandle): Promise<ISummaryTree> {
|
|
436
436
|
const summary = await super.downloadSummary(id);
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
* must be enabled by setting the config to true or by passing a compression config object.
|
|
17
17
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
18
18
|
* @param config - The compression configuration.
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns The document service factory possibly with compression applied.
|
|
20
20
|
*/
|
|
21
21
|
export function applyStorageCompression(
|
|
22
22
|
documentServiceFactory: IDocumentServiceFactory,
|
|
@@ -43,7 +43,7 @@ export function applyStorageCompression(
|
|
|
43
43
|
* This method applies compression to the given document service factory.
|
|
44
44
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
45
45
|
* @param config - The compression configuration.
|
|
46
|
-
* @returns
|
|
46
|
+
* @returns The document service factory with compression applied.
|
|
47
47
|
*/
|
|
48
48
|
function applyStorageCompressionInternal(
|
|
49
49
|
constructor: new (
|
|
@@ -48,7 +48,7 @@ export class InsecureUrlResolver implements IUrlResolver {
|
|
|
48
48
|
// service using our bearer token.
|
|
49
49
|
if (this.isForNodeTest) {
|
|
50
50
|
const [, documentId, tmpRelativePath] = parsedUrl.pathname.substr(1).split("/");
|
|
51
|
-
const relativePath = tmpRelativePath
|
|
51
|
+
const relativePath = tmpRelativePath ?? "";
|
|
52
52
|
return this.resolveHelper(documentId, relativePath, parsedUrl.search);
|
|
53
53
|
} else if (parsedUrl.host === window.location.host) {
|
|
54
54
|
const fullPath = parsedUrl.pathname.substr(1);
|
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -28,12 +28,12 @@ type WorkingState = "working" | "done" | "canceled";
|
|
|
28
28
|
* @param payloadSize - batch size
|
|
29
29
|
* @param logger - logger to use
|
|
30
30
|
* @param requestCallback - callback to request batches
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns Queue that can be used to retrieve data
|
|
32
32
|
*/
|
|
33
33
|
export class ParallelRequests<T> {
|
|
34
34
|
private latestRequested: number;
|
|
35
35
|
private nextToDeliver: number;
|
|
36
|
-
private readonly results
|
|
36
|
+
private readonly results = new Map<number, T[]>();
|
|
37
37
|
private workingState: WorkingState = "working";
|
|
38
38
|
private requestsInFlight = 0;
|
|
39
39
|
private readonly endEvent = new Deferred<void>();
|
|
@@ -405,7 +405,7 @@ const waitForOnline = async (): Promise<void> => {
|
|
|
405
405
|
* @param logger - logger object to use to log progress & errors
|
|
406
406
|
* @param signal - cancelation signal
|
|
407
407
|
* @param scenarioName - reason for fetching ops
|
|
408
|
-
* @returns
|
|
408
|
+
* @returns An object with resulting ops and cancellation / partial result flags
|
|
409
409
|
*/
|
|
410
410
|
async function getSingleOpBatch(
|
|
411
411
|
get: (telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,
|
|
@@ -530,7 +530,7 @@ async function getSingleOpBatch(
|
|
|
530
530
|
* @param logger - Logger to log progress and errors
|
|
531
531
|
* @param signal - Cancelation signal
|
|
532
532
|
* @param scenarioName - Reason for fetching ops
|
|
533
|
-
* @returns
|
|
533
|
+
* @returns Messages fetched
|
|
534
534
|
*/
|
|
535
535
|
export function requestOps(
|
|
536
536
|
get: (
|
package/src/runWithRetry.ts
CHANGED
|
@@ -147,7 +147,7 @@ const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
|
|
|
147
147
|
* not related to endpoint, in that case we want to try at faster pace and hence the max wait is lesser 8s as compared
|
|
148
148
|
* to when endpoint is reachable in which case it is 30s.
|
|
149
149
|
* @param error - error based on which we decide max wait time.
|
|
150
|
-
* @returns
|
|
150
|
+
* @returns Max wait time.
|
|
151
151
|
*/
|
|
152
152
|
export function calculateMaxWaitTime(error: unknown): number {
|
|
153
153
|
return isFluidError(error) && error.getTelemetryProperties().endpointReached === true
|