@fluidframework/driver-utils 2.0.0-internal.1.1.2 → 2.0.0-internal.1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/messageRecognition.d.ts +38 -22
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +48 -23
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +2 -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/runWithRetry.d.ts +9 -5
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js.map +1 -1
- package/lib/messageRecognition.d.ts +38 -22
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +46 -22
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +2 -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/runWithRetry.d.ts +9 -5
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js.map +1 -1
- package/package.json +11 -11
- package/src/messageRecognition.ts +48 -23
- package/src/network.ts +2 -1
- package/src/packageVersion.ts +1 -1
- package/src/runWithRetry.ts +9 -5
|
@@ -4,35 +4,51 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
|
+
* Determines whether or not the message type is one of the following:
|
|
7
8
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Operation}
|
|
10
|
+
*
|
|
11
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
|
|
12
|
+
*
|
|
13
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Propose}
|
|
14
|
+
*
|
|
15
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Reject}
|
|
16
|
+
*
|
|
17
|
+
* - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
|
|
18
|
+
*
|
|
19
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
|
|
15
20
|
*/
|
|
16
21
|
export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
17
22
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @returns whether
|
|
21
|
-
* "op"
|
|
22
|
-
* "summarize"
|
|
23
|
+
* Tells if message was sent by container runtime
|
|
24
|
+
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
25
|
+
* @returns whether the message is a runtime message
|
|
23
26
|
*/
|
|
24
|
-
export declare function isRuntimeMessage(message:
|
|
27
|
+
export declare function isRuntimeMessage(message: {
|
|
28
|
+
type: string;
|
|
29
|
+
}): boolean;
|
|
25
30
|
/**
|
|
31
|
+
* Determines whether or not the message type is one of the following: (legacy)
|
|
32
|
+
*
|
|
33
|
+
* - "component"
|
|
34
|
+
*
|
|
35
|
+
* - "attach"
|
|
36
|
+
*
|
|
37
|
+
* - "chunkedOp"
|
|
38
|
+
*
|
|
39
|
+
* - "blobAttach"
|
|
40
|
+
*
|
|
41
|
+
* - "rejoin"
|
|
42
|
+
*
|
|
43
|
+
* - "alias"
|
|
44
|
+
*
|
|
45
|
+
* - "op"
|
|
26
46
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @returns whether or not the message type is one listed below (legacy)
|
|
29
|
-
* "component"
|
|
30
|
-
* "attach"
|
|
31
|
-
* "chunkedOp"
|
|
32
|
-
* "blobAttach"
|
|
33
|
-
* "rejoin"
|
|
34
|
-
* "alias"
|
|
35
|
-
* "op"
|
|
47
|
+
* @deprecated This API should not be used.
|
|
36
48
|
*/
|
|
37
49
|
export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
50
|
+
export declare enum MessageType2 {
|
|
51
|
+
Accept = "accept"
|
|
52
|
+
}
|
|
53
|
+
export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
38
54
|
//# sourceMappingURL=messageRecognition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEhH
|
|
1
|
+
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEhH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,GAAG,OAAO,CAEpE;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAKpF;AAID,oBAAY,YAAY;IACpB,MAAM,WAAW;CACpB;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAItG"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUnpackedRuntimeMessage = exports.isRuntimeMessage = exports.isClientMessage = void 0;
|
|
3
|
+
exports.canBeCoalescedByService = exports.MessageType2 = exports.isUnpackedRuntimeMessage = exports.isRuntimeMessage = exports.isClientMessage = void 0;
|
|
4
4
|
/*!
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
7
7
|
*/
|
|
8
8
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
9
9
|
/**
|
|
10
|
+
* Determines whether or not the message type is one of the following:
|
|
10
11
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Operation}
|
|
13
|
+
*
|
|
14
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
|
|
15
|
+
*
|
|
16
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Propose}
|
|
17
|
+
*
|
|
18
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Reject}
|
|
19
|
+
*
|
|
20
|
+
* - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
|
|
21
|
+
*
|
|
22
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
|
|
18
23
|
*/
|
|
19
24
|
function isClientMessage(message) {
|
|
20
25
|
if (isRuntimeMessage(message)) {
|
|
@@ -24,6 +29,8 @@ function isClientMessage(message) {
|
|
|
24
29
|
case protocol_definitions_1.MessageType.Propose:
|
|
25
30
|
case protocol_definitions_1.MessageType.Reject:
|
|
26
31
|
case protocol_definitions_1.MessageType.NoOp:
|
|
32
|
+
case MessageType2.Accept:
|
|
33
|
+
case protocol_definitions_1.MessageType.Summarize:
|
|
27
34
|
return true;
|
|
28
35
|
default:
|
|
29
36
|
return false;
|
|
@@ -31,14 +38,12 @@ function isClientMessage(message) {
|
|
|
31
38
|
}
|
|
32
39
|
exports.isClientMessage = isClientMessage;
|
|
33
40
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
36
|
-
* @returns whether
|
|
37
|
-
* "op"
|
|
38
|
-
* "summarize"
|
|
41
|
+
* Tells if message was sent by container runtime
|
|
42
|
+
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
43
|
+
* @returns whether the message is a runtime message
|
|
39
44
|
*/
|
|
40
45
|
function isRuntimeMessage(message) {
|
|
41
|
-
return message.type === protocol_definitions_1.MessageType.Operation
|
|
46
|
+
return message.type === protocol_definitions_1.MessageType.Operation;
|
|
42
47
|
}
|
|
43
48
|
exports.isRuntimeMessage = isRuntimeMessage;
|
|
44
49
|
var RuntimeMessage;
|
|
@@ -52,16 +57,23 @@ var RuntimeMessage;
|
|
|
52
57
|
RuntimeMessage["Operation"] = "op";
|
|
53
58
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
54
59
|
/**
|
|
60
|
+
* Determines whether or not the message type is one of the following: (legacy)
|
|
61
|
+
*
|
|
62
|
+
* - "component"
|
|
55
63
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* "
|
|
59
|
-
*
|
|
60
|
-
* "
|
|
61
|
-
*
|
|
62
|
-
* "rejoin"
|
|
63
|
-
*
|
|
64
|
-
* "
|
|
64
|
+
* - "attach"
|
|
65
|
+
*
|
|
66
|
+
* - "chunkedOp"
|
|
67
|
+
*
|
|
68
|
+
* - "blobAttach"
|
|
69
|
+
*
|
|
70
|
+
* - "rejoin"
|
|
71
|
+
*
|
|
72
|
+
* - "alias"
|
|
73
|
+
*
|
|
74
|
+
* - "op"
|
|
75
|
+
*
|
|
76
|
+
* @deprecated This API should not be used.
|
|
65
77
|
*/
|
|
66
78
|
function isUnpackedRuntimeMessage(message) {
|
|
67
79
|
if (Object.values(RuntimeMessage).includes(message.type)) {
|
|
@@ -70,4 +82,17 @@ function isUnpackedRuntimeMessage(message) {
|
|
|
70
82
|
return false;
|
|
71
83
|
}
|
|
72
84
|
exports.isUnpackedRuntimeMessage = isUnpackedRuntimeMessage;
|
|
85
|
+
// ADO #1385: staging code changes across layers.
|
|
86
|
+
// Eventually to be replaced by MessageType.accept
|
|
87
|
+
var MessageType2;
|
|
88
|
+
(function (MessageType2) {
|
|
89
|
+
MessageType2["Accept"] = "accept";
|
|
90
|
+
})(MessageType2 = exports.MessageType2 || (exports.MessageType2 = {}));
|
|
91
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
92
|
+
function canBeCoalescedByService(message) {
|
|
93
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
94
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
95
|
+
return message.type === protocol_definitions_1.MessageType.NoOp || message.type === MessageType2.Accept;
|
|
96
|
+
}
|
|
97
|
+
exports.canBeCoalescedByService = canBeCoalescedByService;
|
|
73
98
|
//# sourceMappingURL=messageRecognition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAAgH;AAEhH
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAAgH;AAEhH;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAAC,OAAqD;IACjF,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAC;KACf;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,kCAAW,CAAC,OAAO,CAAC;QACzB,KAAK,kCAAW,CAAC,MAAM,CAAC;QACxB,KAAK,kCAAW,CAAC,IAAI,CAAC;QACtB,KAAK,YAAY,CAAC,MAAM,CAAC;QACzB,KAAK,kCAAW,CAAC,SAAS;YACtB,OAAO,IAAI,CAAC;QAChB;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC;AAdD,0CAcC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,OAA0B;IACvD,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,CAAC;AAClD,CAAC;AAFD,4CAEC;AAED,IAAK,cAQJ;AARD,WAAK,cAAc;IACf,gDAA8B,CAAA;IAC9B,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;IACzB,mCAAiB,CAAA;IACjB,iCAAe,CAAA;IACf,kCAAgB,CAAA;AACpB,CAAC,EARI,cAAc,KAAd,cAAc,QAQlB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,wBAAwB,CAAC,OAAkC;IACvE,IAAK,MAAM,CAAC,MAAM,CAAC,cAAc,CAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACpE,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AALD,4DAKC;AAED,iDAAiD;AACjD,kDAAkD;AAClD,IAAY,YAEX;AAFD,WAAY,YAAY;IACpB,iCAAiB,CAAA;AACrB,CAAC,EAFW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAEvB;AAED,mEAAmE;AACnE,SAAgB,uBAAuB,CAAC,OAAqD;IACzF,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AACrF,CAAC;AAJD,0DAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Determines whether or not the message type is one of the following:\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Operation}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Propose}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Reject}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}\n */\nexport function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n if (isRuntimeMessage(message)) {\n return true;\n }\n switch (message.type) {\n case MessageType.Propose:\n case MessageType.Reject:\n case MessageType.NoOp:\n case MessageType2.Accept:\n case MessageType.Summarize:\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n */\nexport function isRuntimeMessage(message: { type: string; }): boolean {\n return message.type === MessageType.Operation;\n}\n\nenum RuntimeMessage {\n FluidDataStoreOp = \"component\",\n Attach = \"attach\",\n ChunkedOp = \"chunkedOp\",\n BlobAttach = \"blobAttach\",\n Rejoin = \"rejoin\",\n Alias = \"alias\",\n Operation = \"op\",\n}\n\n/**\n * Determines whether or not the message type is one of the following: (legacy)\n *\n * - \"component\"\n *\n * - \"attach\"\n *\n * - \"chunkedOp\"\n *\n * - \"blobAttach\"\n *\n * - \"rejoin\"\n *\n * - \"alias\"\n *\n * - \"op\"\n *\n * @deprecated This API should not be used.\n */\nexport function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {\n if ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {\n return true;\n }\n return false;\n}\n\n// ADO #1385: staging code changes across layers.\n// Eventually to be replaced by MessageType.accept\nexport enum MessageType2 {\n Accept = \"accept\",\n}\n\n// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\nexport function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n // This assumes that in the future relay service may implement coalescing of accept messages,\n // same way it was doing coalescing of immediate noops in the past.\n return message.type === MessageType.NoOp || message.type === MessageType2.Accept;\n}\n"]}
|
package/dist/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts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AM,GAAG,SACf,CAAC"}
|
package/dist/network.js
CHANGED
|
@@ -63,7 +63,8 @@ class AuthorizationError extends telemetry_utils_1.LoggingError {
|
|
|
63
63
|
exports.AuthorizationError = AuthorizationError;
|
|
64
64
|
class LocationRedirectionError extends telemetry_utils_1.LoggingError {
|
|
65
65
|
constructor(message, redirectUrl, props) {
|
|
66
|
-
|
|
66
|
+
// do not log redirectURL
|
|
67
|
+
super(message, props, new Set(["redirectUrl"]));
|
|
67
68
|
this.redirectUrl = redirectUrl;
|
|
68
69
|
this.errorType = driver_definitions_1.DriverErrorType.locationRedirection;
|
|
69
70
|
this.canRetry = false;
|
package/dist/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2EAO4C;AAE5C,qEAAgF;AAEhF,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,SAAgB,QAAQ;IACpB,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC9F,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AALD,4BAKC;AAkBD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,8BAAY;IAGjD,YACI,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAJ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CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAVD,8DAUC;AAED;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAEjF,gDAAgD;AACzC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AADtC,QAAA,6BAA6B,iCACS;AAEnD,kEAAkE;AAC3D,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADlC,QAAA,sBAAsB,0BACY","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n ILocationRedirectionError,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n */\n export interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n readonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined; };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(message: string, props: DriverErrorTelemetryProps) {\n super(message, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {\n readonly errorType = DriverErrorType.locationRedirection;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly redirectUrl: IResolvedUrl,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n message: string,\n retryInfo: { canRetry: boolean; retryAfterMs?: number; },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n message, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2EAO4C;AAE5C,qEAAgF;AAEhF,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,SAAgB,QAAQ;IACpB,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC9F,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AALD,4BAKC;AAkBD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,8BAAY;IAGjD,YACI,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAJrB,cAAS,GAAG,oCAAe,CAAC,mBAAmB,CAAC;IAQzD,CAAC;CACJ;AAVD,kDAUC;AAED,oFAAoF;AACpF,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,SAAS;AACT,MAAM,iCAAiC,GAAG,gCAAgC,CAAC;AAC3E,MAAa,mCAAoC,SAAQ,8BAAY;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,8DAUC;AAED;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAEjF,gDAAgD;AACzC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AADtC,QAAA,6BAA6B,iCACS;AAEnD,kEAAkE;AAC3D,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADlC,QAAA,sBAAsB,0BACY","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n ILocationRedirectionError,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n */\n export interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n readonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined; };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(message: string, props: DriverErrorTelemetryProps) {\n super(message, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {\n readonly errorType = DriverErrorType.locationRedirection;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly redirectUrl: IResolvedUrl,\n props: DriverErrorTelemetryProps,\n ) {\n // do not log redirectURL\n super(message, props, new Set([\"redirectUrl\"]));\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n message: string,\n retryInfo: { canRetry: boolean; retryAfterMs?: number; },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n message, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/driver-utils";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.1.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.1.2.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.2.0\";\n"]}
|
package/dist/runWithRetry.d.ts
CHANGED
|
@@ -9,14 +9,18 @@ import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
|
9
9
|
*/
|
|
10
10
|
export interface IProgress {
|
|
11
11
|
/**
|
|
12
|
-
* Abort signal used to cancel operation
|
|
13
|
-
*
|
|
12
|
+
* Abort signal used to cancel operation.
|
|
13
|
+
*
|
|
14
|
+
* @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
|
|
14
15
|
* Please consult with API documentation / implementation.
|
|
15
16
|
* Note that number of layers may not check this signal while holding this request in a queue,
|
|
16
17
|
* so it may take a while it takes effect. This can be improved in the future.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* The layers in question are:
|
|
20
|
+
*
|
|
21
|
+
* - driver (RateLimiter)
|
|
22
|
+
*
|
|
23
|
+
* - runWithRetry
|
|
20
24
|
*/
|
|
21
25
|
cancel?: AbortSignal;
|
|
22
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB
|
|
1
|
+
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACjD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,CAAC,CA2DZ"}
|
package/dist/runWithRetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAkE;AAClE,2EAAqE;AACrE,uCAAoE;AACpE,qDAA8C;AAC9C,wBAAsC;
|
|
1
|
+
{"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAkE;AAClE,2EAAqE;AACrE,uCAAoE;AACpE,qDAA8C;AAC9C,wBAAsC;AAkC/B,KAAK,UAAU,YAAY,CAC9B,GAAyC,EACzC,aAAqB,EACrB,MAAwB,EACxB,QAAmB;;IAEnB,IAAI,MAAqB,CAAC;IAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,YAAY,GAAG,IAAI,CAAC,CAAC,sBAAsB;IAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,SAAS,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,SAAc,CAAC;IACnB,GAAG;QACC,IAAI;YACA,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC;SACl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AAa,YAAY;YACvC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,0BAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SAChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC;AAhED,oCAgEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation.\n *\n * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n *\n * The layers in question are:\n *\n * - driver (RateLimiter)\n *\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
|
|
@@ -4,35 +4,51 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
|
+
* Determines whether or not the message type is one of the following:
|
|
7
8
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Operation}
|
|
10
|
+
*
|
|
11
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
|
|
12
|
+
*
|
|
13
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Propose}
|
|
14
|
+
*
|
|
15
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Reject}
|
|
16
|
+
*
|
|
17
|
+
* - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
|
|
18
|
+
*
|
|
19
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
|
|
15
20
|
*/
|
|
16
21
|
export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
17
22
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @returns whether
|
|
21
|
-
* "op"
|
|
22
|
-
* "summarize"
|
|
23
|
+
* Tells if message was sent by container runtime
|
|
24
|
+
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
25
|
+
* @returns whether the message is a runtime message
|
|
23
26
|
*/
|
|
24
|
-
export declare function isRuntimeMessage(message:
|
|
27
|
+
export declare function isRuntimeMessage(message: {
|
|
28
|
+
type: string;
|
|
29
|
+
}): boolean;
|
|
25
30
|
/**
|
|
31
|
+
* Determines whether or not the message type is one of the following: (legacy)
|
|
32
|
+
*
|
|
33
|
+
* - "component"
|
|
34
|
+
*
|
|
35
|
+
* - "attach"
|
|
36
|
+
*
|
|
37
|
+
* - "chunkedOp"
|
|
38
|
+
*
|
|
39
|
+
* - "blobAttach"
|
|
40
|
+
*
|
|
41
|
+
* - "rejoin"
|
|
42
|
+
*
|
|
43
|
+
* - "alias"
|
|
44
|
+
*
|
|
45
|
+
* - "op"
|
|
26
46
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @returns whether or not the message type is one listed below (legacy)
|
|
29
|
-
* "component"
|
|
30
|
-
* "attach"
|
|
31
|
-
* "chunkedOp"
|
|
32
|
-
* "blobAttach"
|
|
33
|
-
* "rejoin"
|
|
34
|
-
* "alias"
|
|
35
|
-
* "op"
|
|
47
|
+
* @deprecated This API should not be used.
|
|
36
48
|
*/
|
|
37
49
|
export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
50
|
+
export declare enum MessageType2 {
|
|
51
|
+
Accept = "accept"
|
|
52
|
+
}
|
|
53
|
+
export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
38
54
|
//# sourceMappingURL=messageRecognition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEhH
|
|
1
|
+
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEhH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,GAAG,OAAO,CAEpE;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAKpF;AAID,oBAAY,YAAY;IACpB,MAAM,WAAW;CACpB;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAItG"}
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { MessageType } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
|
+
* Determines whether or not the message type is one of the following:
|
|
7
8
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Operation}
|
|
10
|
+
*
|
|
11
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
|
|
12
|
+
*
|
|
13
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Propose}
|
|
14
|
+
*
|
|
15
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Reject}
|
|
16
|
+
*
|
|
17
|
+
* - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
|
|
18
|
+
*
|
|
19
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
|
|
15
20
|
*/
|
|
16
21
|
export function isClientMessage(message) {
|
|
17
22
|
if (isRuntimeMessage(message)) {
|
|
@@ -21,20 +26,20 @@ export function isClientMessage(message) {
|
|
|
21
26
|
case MessageType.Propose:
|
|
22
27
|
case MessageType.Reject:
|
|
23
28
|
case MessageType.NoOp:
|
|
29
|
+
case MessageType2.Accept:
|
|
30
|
+
case MessageType.Summarize:
|
|
24
31
|
return true;
|
|
25
32
|
default:
|
|
26
33
|
return false;
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
32
|
-
* @returns whether
|
|
33
|
-
* "op"
|
|
34
|
-
* "summarize"
|
|
37
|
+
* Tells if message was sent by container runtime
|
|
38
|
+
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
39
|
+
* @returns whether the message is a runtime message
|
|
35
40
|
*/
|
|
36
41
|
export function isRuntimeMessage(message) {
|
|
37
|
-
return message.type === MessageType.Operation
|
|
42
|
+
return message.type === MessageType.Operation;
|
|
38
43
|
}
|
|
39
44
|
var RuntimeMessage;
|
|
40
45
|
(function (RuntimeMessage) {
|
|
@@ -47,16 +52,23 @@ var RuntimeMessage;
|
|
|
47
52
|
RuntimeMessage["Operation"] = "op";
|
|
48
53
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
49
54
|
/**
|
|
55
|
+
* Determines whether or not the message type is one of the following: (legacy)
|
|
56
|
+
*
|
|
57
|
+
* - "component"
|
|
50
58
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* "
|
|
54
|
-
*
|
|
55
|
-
* "
|
|
56
|
-
*
|
|
57
|
-
* "rejoin"
|
|
58
|
-
*
|
|
59
|
-
* "
|
|
59
|
+
* - "attach"
|
|
60
|
+
*
|
|
61
|
+
* - "chunkedOp"
|
|
62
|
+
*
|
|
63
|
+
* - "blobAttach"
|
|
64
|
+
*
|
|
65
|
+
* - "rejoin"
|
|
66
|
+
*
|
|
67
|
+
* - "alias"
|
|
68
|
+
*
|
|
69
|
+
* - "op"
|
|
70
|
+
*
|
|
71
|
+
* @deprecated This API should not be used.
|
|
60
72
|
*/
|
|
61
73
|
export function isUnpackedRuntimeMessage(message) {
|
|
62
74
|
if (Object.values(RuntimeMessage).includes(message.type)) {
|
|
@@ -64,4 +76,16 @@ export function isUnpackedRuntimeMessage(message) {
|
|
|
64
76
|
}
|
|
65
77
|
return false;
|
|
66
78
|
}
|
|
79
|
+
// ADO #1385: staging code changes across layers.
|
|
80
|
+
// Eventually to be replaced by MessageType.accept
|
|
81
|
+
export var MessageType2;
|
|
82
|
+
(function (MessageType2) {
|
|
83
|
+
MessageType2["Accept"] = "accept";
|
|
84
|
+
})(MessageType2 || (MessageType2 = {}));
|
|
85
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
86
|
+
export function canBeCoalescedByService(message) {
|
|
87
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
88
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
89
|
+
return message.type === MessageType.NoOp || message.type === MessageType2.Accept;
|
|
90
|
+
}
|
|
67
91
|
//# sourceMappingURL=messageRecognition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAA+C,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEhH
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":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AEvB;AAED,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CAAC,OAAqD;IACzF,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AACrF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Determines whether or not the message type is one of the following:\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Operation}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Propose}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.Reject}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}\n *\n * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}\n */\nexport function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n if (isRuntimeMessage(message)) {\n return true;\n }\n switch (message.type) {\n case MessageType.Propose:\n case MessageType.Reject:\n case MessageType.NoOp:\n case MessageType2.Accept:\n case MessageType.Summarize:\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n */\nexport function isRuntimeMessage(message: { type: string; }): boolean {\n return message.type === MessageType.Operation;\n}\n\nenum RuntimeMessage {\n FluidDataStoreOp = \"component\",\n Attach = \"attach\",\n ChunkedOp = \"chunkedOp\",\n BlobAttach = \"blobAttach\",\n Rejoin = \"rejoin\",\n Alias = \"alias\",\n Operation = \"op\",\n}\n\n/**\n * Determines whether or not the message type is one of the following: (legacy)\n *\n * - \"component\"\n *\n * - \"attach\"\n *\n * - \"chunkedOp\"\n *\n * - \"blobAttach\"\n *\n * - \"rejoin\"\n *\n * - \"alias\"\n *\n * - \"op\"\n *\n * @deprecated This API should not be used.\n */\nexport function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {\n if ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {\n return true;\n }\n return false;\n}\n\n// ADO #1385: staging code changes across layers.\n// Eventually to be replaced by MessageType.accept\nexport enum MessageType2 {\n Accept = \"accept\",\n}\n\n// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\nexport function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n // This assumes that in the future relay service may implement coalescing of accept messages,\n // same way it was doing coalescing of immediate noops in the past.\n return message.type === MessageType.NoOp || message.type === MessageType2.Accept;\n}\n"]}
|
package/lib/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,oBAAY,YAAY;IACpB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAAA;CACV;AAKD,wBAAgB,QAAQ,IAAI,YAAY,CAKvC;AAED;;;;;;;;GAQG;AACF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,+DAA+D;AAC/D,oBAAY,yBAAyB,GAAG,oBAAoB,GAAG;IAAE,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE,CAAC;AAEtG;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAa,YAAW,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E,MAAM,EAClC,KAAK,EAAE,yBAAyB;CAIvC;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,yBAAyB,kDACb,CAAC;AAEtE,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAAE,EACxD,KAAK,EAAE,yBAAyB,GACjC,eAAe,GAAG,mBAAmB,CAMvC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,OAAmC,CAAC;AAEjF,gDAAgD;AAChD,eAAO,MAAM,6BAA6B,UAAW,GAAG,KAAG,MAAM,GAAG,SAClB,CAAC;AAEnD,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACf,CAAC"}
|
package/lib/network.js
CHANGED
|
@@ -56,7 +56,8 @@ export class AuthorizationError extends LoggingError {
|
|
|
56
56
|
}
|
|
57
57
|
export class LocationRedirectionError extends LoggingError {
|
|
58
58
|
constructor(message, redirectUrl, props) {
|
|
59
|
-
|
|
59
|
+
// do not log redirectURL
|
|
60
|
+
super(message, props, new Set(["redirectUrl"]));
|
|
60
61
|
this.redirectUrl = redirectUrl;
|
|
61
62
|
this.errorType = DriverErrorType.locationRedirection;
|
|
62
63
|
this.canRetry = false;
|
package/lib/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAIH,eAAe,GAGlB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,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iB,CAAQ;QAL7B,cAAS,GAAG,eAAe,CAAC,eAAe,CAAC;QAC5C,aAAQ,GAAG,IAAI,CAAC;IAQzB,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,KAAgC,EAAE,EAAE,CAClF,IAAI,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAEtE,MAAM,UAAU,yBAAyB,CACrC,OAAe,EACf,SAAwD,EACxD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC5D,OAAO,IAAI,eAAe,CACtB,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEnD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n ILocationRedirectionError,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n */\n export interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n readonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined; };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(message: string, props: DriverErrorTelemetryProps) {\n super(message, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {\n readonly errorType = DriverErrorType.locationRedirection;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly redirectUrl: IResolvedUrl,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n message: string,\n retryInfo: { canRetry: boolean; retryAfterMs?: number; },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n message, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAIH,eAAe,GAGlB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAM,UAAU,QAAQ;IACpB,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC9F,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAA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UAAU,EAAE,KAAK,CAAC,CAAC;AAEtE,MAAM,UAAU,yBAAyB,CACrC,OAAe,EACf,SAAwD,EACxD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC5D,OAAO,IAAI,eAAe,CACtB,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEnD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n ILocationRedirectionError,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n */\n export interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n readonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined; };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(message: string, props: DriverErrorTelemetryProps) {\n super(message, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {\n readonly errorType = DriverErrorType.locationRedirection;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly redirectUrl: IResolvedUrl,\n props: DriverErrorTelemetryProps,\n ) {\n // do not log redirectURL\n super(message, props, new Set([\"redirectUrl\"]));\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n message: string,\n retryInfo: { canRetry: boolean; retryAfterMs?: number; },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n message, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.1.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.1.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.2.0\";\n"]}
|
package/lib/runWithRetry.d.ts
CHANGED
|
@@ -9,14 +9,18 @@ import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
|
9
9
|
*/
|
|
10
10
|
export interface IProgress {
|
|
11
11
|
/**
|
|
12
|
-
* Abort signal used to cancel operation
|
|
13
|
-
*
|
|
12
|
+
* Abort signal used to cancel operation.
|
|
13
|
+
*
|
|
14
|
+
* @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
|
|
14
15
|
* Please consult with API documentation / implementation.
|
|
15
16
|
* Note that number of layers may not check this signal while holding this request in a queue,
|
|
16
17
|
* so it may take a while it takes effect. This can be improved in the future.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* The layers in question are:
|
|
20
|
+
*
|
|
21
|
+
* - driver (RateLimiter)
|
|
22
|
+
*
|
|
23
|
+
* - runWithRetry
|
|
20
24
|
*/
|
|
21
25
|
cancel?: AbortSignal;
|
|
22
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB
|
|
1
|
+
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACjD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,CAAC,CA2DZ"}
|
package/lib/runWithRetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"runWithRetry.js","sourceRoot":"","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B;oBACjD,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;iBAChB,EAAE,GAAG,CAAC,CAAC;gBACR,MAAM,IAAI,iBAAiB,CACvB,0BAA0B,EAC1B,eAAe,CAAC,YAAY,EAC5B,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAC/C,CAAC;aACL;YAED,UAAU,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,sFAAsF;YACtF,0FAA0F;YAC1F,YAAY,GAAG,MAAA,sBAAsB,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YAC/E,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAClB,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;aACvC;YACD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;SAC7B;KACJ,QAAQ,CAAC,OAAO,EAAE;IACnB,IAAI,UAAU,GAAG,CAAC,EAAE;QAChB,MAAM,CAAC,kBAAkB,CAAC;YACtB,SAAS,EAAE,GAAG,aAAa,YAAY;YACvC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SAChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation.\n *\n * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n *\n * The layers in question are:\n *\n * - driver (RateLimiter)\n *\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-internal.1.
|
|
3
|
+
"version": "2.0.0-internal.1.2.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -62,23 +62,23 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
64
|
"@fluidframework/common-utils": "^1.0.0",
|
|
65
|
-
"@fluidframework/core-interfaces": "^2.0.0-internal.1.
|
|
66
|
-
"@fluidframework/driver-definitions": "^2.0.0-internal.1.
|
|
67
|
-
"@fluidframework/gitresources": "^0.
|
|
68
|
-
"@fluidframework/protocol-base": "^0.
|
|
65
|
+
"@fluidframework/core-interfaces": "^2.0.0-internal.1.2.0",
|
|
66
|
+
"@fluidframework/driver-definitions": "^2.0.0-internal.1.2.0",
|
|
67
|
+
"@fluidframework/gitresources": "^0.1038.1000",
|
|
68
|
+
"@fluidframework/protocol-base": "^0.1038.1000",
|
|
69
69
|
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
70
|
-
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.
|
|
70
|
+
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.2.0",
|
|
71
71
|
"axios": "^0.26.0",
|
|
72
72
|
"url": "^0.11.0",
|
|
73
73
|
"uuid": "^8.3.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@fluidframework/build-common": "^0.
|
|
77
|
-
"@fluidframework/build-tools": "^0.
|
|
76
|
+
"@fluidframework/build-common": "^1.0.0",
|
|
77
|
+
"@fluidframework/build-tools": "^0.4.4000",
|
|
78
78
|
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@^1.0.0",
|
|
79
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
80
|
-
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.
|
|
81
|
-
"@fluidframework/runtime-utils": "^2.0.0-internal.1.
|
|
79
|
+
"@fluidframework/eslint-config-fluid": "^1.0.0",
|
|
80
|
+
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.2.0",
|
|
81
|
+
"@fluidframework/runtime-utils": "^2.0.0-internal.1.2.0",
|
|
82
82
|
"@microsoft/api-extractor": "^7.22.2",
|
|
83
83
|
"@rushstack/eslint-config": "^2.5.1",
|
|
84
84
|
"@types/mocha": "^9.1.1",
|
|
@@ -5,14 +5,19 @@
|
|
|
5
5
|
import { IDocumentMessage, ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* Determines whether or not the message type is one of the following:
|
|
8
9
|
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Operation}
|
|
11
|
+
*
|
|
12
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
|
|
13
|
+
*
|
|
14
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Propose}
|
|
15
|
+
*
|
|
16
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.Reject}
|
|
17
|
+
*
|
|
18
|
+
* - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
|
|
19
|
+
*
|
|
20
|
+
* - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
|
|
16
21
|
*/
|
|
17
22
|
export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {
|
|
18
23
|
if (isRuntimeMessage(message)) {
|
|
@@ -22,6 +27,8 @@ export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMe
|
|
|
22
27
|
case MessageType.Propose:
|
|
23
28
|
case MessageType.Reject:
|
|
24
29
|
case MessageType.NoOp:
|
|
30
|
+
case MessageType2.Accept:
|
|
31
|
+
case MessageType.Summarize:
|
|
25
32
|
return true;
|
|
26
33
|
default:
|
|
27
34
|
return false;
|
|
@@ -29,14 +36,12 @@ export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMe
|
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
* @returns whether
|
|
35
|
-
* "op"
|
|
36
|
-
* "summarize"
|
|
39
|
+
* Tells if message was sent by container runtime
|
|
40
|
+
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
41
|
+
* @returns whether the message is a runtime message
|
|
37
42
|
*/
|
|
38
|
-
export function isRuntimeMessage(message:
|
|
39
|
-
return message.type === MessageType.Operation
|
|
43
|
+
export function isRuntimeMessage(message: { type: string; }): boolean {
|
|
44
|
+
return message.type === MessageType.Operation;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
enum RuntimeMessage {
|
|
@@ -50,16 +55,23 @@ enum RuntimeMessage {
|
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
/**
|
|
58
|
+
* Determines whether or not the message type is one of the following: (legacy)
|
|
59
|
+
*
|
|
60
|
+
* - "component"
|
|
61
|
+
*
|
|
62
|
+
* - "attach"
|
|
63
|
+
*
|
|
64
|
+
* - "chunkedOp"
|
|
53
65
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* "
|
|
57
|
-
*
|
|
58
|
-
* "
|
|
59
|
-
*
|
|
60
|
-
* "
|
|
61
|
-
*
|
|
62
|
-
*
|
|
66
|
+
* - "blobAttach"
|
|
67
|
+
*
|
|
68
|
+
* - "rejoin"
|
|
69
|
+
*
|
|
70
|
+
* - "alias"
|
|
71
|
+
*
|
|
72
|
+
* - "op"
|
|
73
|
+
*
|
|
74
|
+
* @deprecated This API should not be used.
|
|
63
75
|
*/
|
|
64
76
|
export function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {
|
|
65
77
|
if ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {
|
|
@@ -67,3 +79,16 @@ export function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): bo
|
|
|
67
79
|
}
|
|
68
80
|
return false;
|
|
69
81
|
}
|
|
82
|
+
|
|
83
|
+
// ADO #1385: staging code changes across layers.
|
|
84
|
+
// Eventually to be replaced by MessageType.accept
|
|
85
|
+
export enum MessageType2 {
|
|
86
|
+
Accept = "accept",
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
90
|
+
export function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean {
|
|
91
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
92
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
93
|
+
return message.type === MessageType.NoOp || message.type === MessageType2.Accept;
|
|
94
|
+
}
|
package/src/network.ts
CHANGED
|
@@ -102,7 +102,8 @@ export class LocationRedirectionError extends LoggingError implements ILocationR
|
|
|
102
102
|
readonly redirectUrl: IResolvedUrl,
|
|
103
103
|
props: DriverErrorTelemetryProps,
|
|
104
104
|
) {
|
|
105
|
-
|
|
105
|
+
// do not log redirectURL
|
|
106
|
+
super(message, props, new Set(["redirectUrl"]));
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
|
package/src/packageVersion.ts
CHANGED
package/src/runWithRetry.ts
CHANGED
|
@@ -16,14 +16,18 @@ import { NonRetryableError } from ".";
|
|
|
16
16
|
*/
|
|
17
17
|
export interface IProgress {
|
|
18
18
|
/**
|
|
19
|
-
* Abort signal used to cancel operation
|
|
20
|
-
*
|
|
19
|
+
* Abort signal used to cancel operation.
|
|
20
|
+
*
|
|
21
|
+
* @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
|
|
21
22
|
* Please consult with API documentation / implementation.
|
|
22
23
|
* Note that number of layers may not check this signal while holding this request in a queue,
|
|
23
24
|
* so it may take a while it takes effect. This can be improved in the future.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* The layers in question are:
|
|
27
|
+
*
|
|
28
|
+
* - driver (RateLimiter)
|
|
29
|
+
*
|
|
30
|
+
* - runWithRetry
|
|
27
31
|
*/
|
|
28
32
|
cancel?: AbortSignal;
|
|
29
33
|
|