@fluidframework/odsp-driver 2.0.0-dev-rc.4.0.0.261659 → 2.0.0-dev-rc.5.0.0.263932
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 +4 -0
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +0 -5
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +0 -3
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +22 -2
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +11 -2
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +2 -1
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js +5 -1
- package/dist/odspError.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/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js +0 -5
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js +0 -3
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +22 -2
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js +11 -2
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +2 -1
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspError.d.ts.map +1 -1
- package/lib/odspError.js +5 -1
- package/lib/odspError.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/tsdoc-metadata.json +1 -1
- package/package.json +14 -14
- package/src/compactSnapshotParser.ts +0 -9
- package/src/compactSnapshotWriter.ts +0 -4
- package/src/fetchSnapshot.ts +48 -20
- package/src/odspDelayLoadedDeltaStream.ts +14 -3
- package/src/odspDocumentDeltaConnection.ts +7 -3
- package/src/odspError.ts +5 -1
- package/src/packageVersion.ts +1 -1
package/src/fetchSnapshot.ts
CHANGED
|
@@ -375,17 +375,31 @@ async function fetchLatestSnapshotCore(
|
|
|
375
375
|
case "application/json": {
|
|
376
376
|
let text: string;
|
|
377
377
|
[text, receiveContentTime] = await measureP(async () =>
|
|
378
|
-
odspResponse.content
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
378
|
+
odspResponse.content
|
|
379
|
+
.text()
|
|
380
|
+
.then((res) => {
|
|
381
|
+
if (res.length === 0) {
|
|
382
|
+
throwOdspNetworkError(
|
|
383
|
+
"Response from browser is empty",
|
|
384
|
+
fetchIncorrectResponse,
|
|
385
|
+
odspResponse.content, // response
|
|
386
|
+
undefined, // response text
|
|
387
|
+
propsToLog,
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
return res;
|
|
391
|
+
})
|
|
392
|
+
.catch((error) =>
|
|
393
|
+
// Parsing can fail and message could contain full request URI, including
|
|
394
|
+
// tokens, etc. So do not log error object itself.
|
|
395
|
+
throwOdspNetworkError(
|
|
396
|
+
"Error while parsing fetch response",
|
|
397
|
+
fetchIncorrectResponse,
|
|
398
|
+
odspResponse.content, // response
|
|
399
|
+
undefined, // response text
|
|
400
|
+
propsToLog,
|
|
401
|
+
),
|
|
387
402
|
),
|
|
388
|
-
),
|
|
389
403
|
);
|
|
390
404
|
propsToLog.bodySize = text.length;
|
|
391
405
|
let content: IOdspSnapshot;
|
|
@@ -405,17 +419,31 @@ async function fetchLatestSnapshotCore(
|
|
|
405
419
|
case "application/ms-fluid": {
|
|
406
420
|
let content: ArrayBuffer;
|
|
407
421
|
[content, receiveContentTime] = await measureP(async () =>
|
|
408
|
-
odspResponse.content
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
422
|
+
odspResponse.content
|
|
423
|
+
.arrayBuffer()
|
|
424
|
+
.then((res) => {
|
|
425
|
+
if (res.byteLength === 0) {
|
|
426
|
+
throwOdspNetworkError(
|
|
427
|
+
"Response from browser is empty",
|
|
428
|
+
fetchIncorrectResponse,
|
|
429
|
+
odspResponse.content, // response
|
|
430
|
+
undefined, // response text
|
|
431
|
+
propsToLog,
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
return res;
|
|
435
|
+
})
|
|
436
|
+
.catch((error) =>
|
|
437
|
+
// Parsing can fail and message could contain full request URI, including
|
|
438
|
+
// tokens, etc. So do not log error object itself.
|
|
439
|
+
throwOdspNetworkError(
|
|
440
|
+
"Error while parsing fetch response",
|
|
441
|
+
fetchIncorrectResponse,
|
|
442
|
+
odspResponse.content, // response
|
|
443
|
+
undefined, // response text
|
|
444
|
+
propsToLog,
|
|
445
|
+
),
|
|
417
446
|
),
|
|
418
|
-
),
|
|
419
447
|
);
|
|
420
448
|
propsToLog.bodySize = content.byteLength;
|
|
421
449
|
let snapshotContents: ISnapshotContentsWithProps;
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IDocumentDeltaConnection,
|
|
11
11
|
IDocumentServicePolicies,
|
|
12
12
|
IResolvedUrl,
|
|
13
|
+
type IAnyDriverError,
|
|
13
14
|
} from "@fluidframework/driver-definitions/internal";
|
|
14
15
|
import {
|
|
15
16
|
DeltaStreamConnectionForbiddenError,
|
|
@@ -220,9 +221,19 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
220
221
|
this.currentConnection = connection;
|
|
221
222
|
return connection;
|
|
222
223
|
} catch (error) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
// Remove join session information from cache only if it is an error is from socket event connect_document_error.
|
|
225
|
+
// Otherwise keep it in cache so that this session can be re-used after disconnection.
|
|
226
|
+
// Also keeping an undefined check here to account for any unknown code path that is unable to stamp the value as in that case also
|
|
227
|
+
// it is safer to clear join session cache and start over.
|
|
228
|
+
if (
|
|
229
|
+
error &&
|
|
230
|
+
typeof error === "object" &&
|
|
231
|
+
((error as IAnyDriverError).scenarioName === "connect_document_error" ||
|
|
232
|
+
(error as IAnyDriverError).scenarioName === undefined)
|
|
233
|
+
) {
|
|
234
|
+
this.clearJoinSessionTimer();
|
|
235
|
+
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
236
|
+
}
|
|
226
237
|
const normalizedError = this.annotateConnectionError(
|
|
227
238
|
error,
|
|
228
239
|
"createDeltaConnection",
|
|
@@ -7,7 +7,7 @@ import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
|
|
|
7
7
|
import { IEvent } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { assert, Deferred } from "@fluidframework/core-utils/internal";
|
|
9
9
|
import { DocumentDeltaConnection } from "@fluidframework/driver-base/internal";
|
|
10
|
-
import { IAnyDriverError } from "@fluidframework/driver-definitions";
|
|
10
|
+
import { IAnyDriverError } from "@fluidframework/driver-definitions/internal";
|
|
11
11
|
import { createGenericNetworkError } from "@fluidframework/driver-utils/internal";
|
|
12
12
|
import { OdspError } from "@fluidframework/odsp-driver-definitions/internal";
|
|
13
13
|
import {
|
|
@@ -361,8 +361,12 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
|
361
361
|
/**
|
|
362
362
|
* Error raising for socket.io issues
|
|
363
363
|
*/
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
protected createErrorObject(
|
|
365
|
+
handler: string,
|
|
366
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
367
|
+
error?: any,
|
|
368
|
+
canRetry = true,
|
|
369
|
+
): IAnyDriverError {
|
|
366
370
|
// Note: we suspect the incoming error object is either:
|
|
367
371
|
// - a socketError: add it to the OdspError object for driver to be able to parse it and reason over it.
|
|
368
372
|
// - anything else: let base class handle it
|
package/src/odspError.ts
CHANGED
|
@@ -32,7 +32,11 @@ export function errorObjectFromSocketError(
|
|
|
32
32
|
: undefined, // responseText
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
error.addTelemetryProperties({
|
|
35
|
+
error.addTelemetryProperties({
|
|
36
|
+
odspError: true,
|
|
37
|
+
relayServiceError: true,
|
|
38
|
+
scenarioName: handler,
|
|
39
|
+
});
|
|
36
40
|
return error;
|
|
37
41
|
} catch {
|
|
38
42
|
return new NonRetryableError(
|
package/src/packageVersion.ts
CHANGED