@fluidframework/driver-utils 2.0.0-internal.1.1.1 → 2.0.0-internal.1.2.0.93071
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 +11 -6
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +21 -7
- 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.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/messageRecognition.d.ts +11 -6
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +19 -6
- 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.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +10 -10
- package/src/messageRecognition.ts +21 -7
- package/src/network.ts +2 -1
- package/src/packageVersion.ts +1 -1
|
@@ -15,15 +15,16 @@ import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/pro
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Tells if message was sent by container runtime
|
|
19
|
+
* // ADO #1385: To be moved to container-definitions
|
|
19
20
|
* @param message-message
|
|
20
|
-
* @returns whether
|
|
21
|
-
* "op"
|
|
22
|
-
* "summarize"
|
|
21
|
+
* @returns whether the message is a runtime message
|
|
23
22
|
*/
|
|
24
|
-
export declare function isRuntimeMessage(message:
|
|
23
|
+
export declare function isRuntimeMessage(message: {
|
|
24
|
+
type: string;
|
|
25
|
+
}): boolean;
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* @deprecated - this API should not be used!
|
|
27
28
|
* @param message-message
|
|
28
29
|
* @returns whether or not the message type is one listed below (legacy)
|
|
29
30
|
* "component"
|
|
@@ -35,4 +36,8 @@ export declare function isRuntimeMessage(message: ISequencedDocumentMessage | ID
|
|
|
35
36
|
* "op"
|
|
36
37
|
*/
|
|
37
38
|
export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
39
|
+
export declare enum MessageType2 {
|
|
40
|
+
Accept = "accept"
|
|
41
|
+
}
|
|
42
|
+
export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
38
43
|
//# 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;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,
|
|
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;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAc9F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,GAAG,OAAO,CAEpE;AAYD;;;;;;;;;;;GAWG;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,6 +1,6 @@
|
|
|
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.
|
|
@@ -24,6 +24,8 @@ function isClientMessage(message) {
|
|
|
24
24
|
case protocol_definitions_1.MessageType.Propose:
|
|
25
25
|
case protocol_definitions_1.MessageType.Reject:
|
|
26
26
|
case protocol_definitions_1.MessageType.NoOp:
|
|
27
|
+
case MessageType2.Accept:
|
|
28
|
+
case protocol_definitions_1.MessageType.Summarize:
|
|
27
29
|
return true;
|
|
28
30
|
default:
|
|
29
31
|
return false;
|
|
@@ -31,14 +33,13 @@ function isClientMessage(message) {
|
|
|
31
33
|
}
|
|
32
34
|
exports.isClientMessage = isClientMessage;
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
36
|
+
* Tells if message was sent by container runtime
|
|
37
|
+
* // ADO #1385: To be moved to container-definitions
|
|
35
38
|
* @param message-message
|
|
36
|
-
* @returns whether
|
|
37
|
-
* "op"
|
|
38
|
-
* "summarize"
|
|
39
|
+
* @returns whether the message is a runtime message
|
|
39
40
|
*/
|
|
40
41
|
function isRuntimeMessage(message) {
|
|
41
|
-
return message.type === protocol_definitions_1.MessageType.Operation
|
|
42
|
+
return message.type === protocol_definitions_1.MessageType.Operation;
|
|
42
43
|
}
|
|
43
44
|
exports.isRuntimeMessage = isRuntimeMessage;
|
|
44
45
|
var RuntimeMessage;
|
|
@@ -52,7 +53,7 @@ var RuntimeMessage;
|
|
|
52
53
|
RuntimeMessage["Operation"] = "op";
|
|
53
54
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
+
* @deprecated - this API should not be used!
|
|
56
57
|
* @param message-message
|
|
57
58
|
* @returns whether or not the message type is one listed below (legacy)
|
|
58
59
|
* "component"
|
|
@@ -70,4 +71,17 @@ function isUnpackedRuntimeMessage(message) {
|
|
|
70
71
|
return false;
|
|
71
72
|
}
|
|
72
73
|
exports.isUnpackedRuntimeMessage = isUnpackedRuntimeMessage;
|
|
74
|
+
// ADO #1385: staging code changes across layers.
|
|
75
|
+
// Eventually to be replaced by MessageType.accept
|
|
76
|
+
var MessageType2;
|
|
77
|
+
(function (MessageType2) {
|
|
78
|
+
MessageType2["Accept"] = "accept";
|
|
79
|
+
})(MessageType2 = exports.MessageType2 || (exports.MessageType2 = {}));
|
|
80
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
81
|
+
function canBeCoalescedByService(message) {
|
|
82
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
83
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
84
|
+
return message.type === protocol_definitions_1.MessageType.NoOp || message.type === MessageType2.Accept;
|
|
85
|
+
}
|
|
86
|
+
exports.canBeCoalescedByService = canBeCoalescedByService;
|
|
73
87
|
//# sourceMappingURL=messageRecognition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAAgH;AAEhH;;;;;;;;;GASG;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;
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAAgH;AAEhH;;;;;;;;;GASG;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;;;;;GAKG;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;;;;;;;;;;;GAWG;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 *\n * @param message-message\n * @returns whether or not the message type is one listed below\n * \"op\"\n * \"summarize\"\n * \"propose\"\n * \"reject\"\n * \"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 * // ADO #1385: To be moved to container-definitions\n * @param message-message\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 * @deprecated - this API should not be used!\n * @param message-message\n * @returns whether or not the message type is one listed below (legacy)\n * \"component\"\n * \"attach\"\n * \"chunkedOp\"\n * \"blobAttach\"\n * \"rejoin\"\n * \"alias\"\n * \"op\"\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","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,gBAAgB,EAAE,eAAe;IAK1F,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAJ9B,QAAQ,CAAC,SAAS,uCAA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,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/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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port {\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,C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C,OAAO,EAAE,oCAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AADzD,QAAA,gBAAgB,oBACyC;AAEtE,SAAgB,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;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 // 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.93071";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,+BAA+B,CAAC"}
|
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.93071";
|
|
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,
|
|
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,4BAA4B,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.93071\";\n"]}
|
|
@@ -15,15 +15,16 @@ import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/pro
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Tells if message was sent by container runtime
|
|
19
|
+
* // ADO #1385: To be moved to container-definitions
|
|
19
20
|
* @param message-message
|
|
20
|
-
* @returns whether
|
|
21
|
-
* "op"
|
|
22
|
-
* "summarize"
|
|
21
|
+
* @returns whether the message is a runtime message
|
|
23
22
|
*/
|
|
24
|
-
export declare function isRuntimeMessage(message:
|
|
23
|
+
export declare function isRuntimeMessage(message: {
|
|
24
|
+
type: string;
|
|
25
|
+
}): boolean;
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* @deprecated - this API should not be used!
|
|
27
28
|
* @param message-message
|
|
28
29
|
* @returns whether or not the message type is one listed below (legacy)
|
|
29
30
|
* "component"
|
|
@@ -35,4 +36,8 @@ export declare function isRuntimeMessage(message: ISequencedDocumentMessage | ID
|
|
|
35
36
|
* "op"
|
|
36
37
|
*/
|
|
37
38
|
export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
39
|
+
export declare enum MessageType2 {
|
|
40
|
+
Accept = "accept"
|
|
41
|
+
}
|
|
42
|
+
export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
38
43
|
//# 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;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,
|
|
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;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAc9F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,GAAG,OAAO,CAEpE;AAYD;;;;;;;;;;;GAWG;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"}
|
|
@@ -21,20 +21,21 @@ export function isClientMessage(message) {
|
|
|
21
21
|
case MessageType.Propose:
|
|
22
22
|
case MessageType.Reject:
|
|
23
23
|
case MessageType.NoOp:
|
|
24
|
+
case MessageType2.Accept:
|
|
25
|
+
case MessageType.Summarize:
|
|
24
26
|
return true;
|
|
25
27
|
default:
|
|
26
28
|
return false;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
32
|
+
* Tells if message was sent by container runtime
|
|
33
|
+
* // ADO #1385: To be moved to container-definitions
|
|
31
34
|
* @param message-message
|
|
32
|
-
* @returns whether
|
|
33
|
-
* "op"
|
|
34
|
-
* "summarize"
|
|
35
|
+
* @returns whether the message is a runtime message
|
|
35
36
|
*/
|
|
36
37
|
export function isRuntimeMessage(message) {
|
|
37
|
-
return message.type === MessageType.Operation
|
|
38
|
+
return message.type === MessageType.Operation;
|
|
38
39
|
}
|
|
39
40
|
var RuntimeMessage;
|
|
40
41
|
(function (RuntimeMessage) {
|
|
@@ -47,7 +48,7 @@ var RuntimeMessage;
|
|
|
47
48
|
RuntimeMessage["Operation"] = "op";
|
|
48
49
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* @deprecated - this API should not be used!
|
|
51
52
|
* @param message-message
|
|
52
53
|
* @returns whether or not the message type is one listed below (legacy)
|
|
53
54
|
* "component"
|
|
@@ -64,4 +65,16 @@ export function isUnpackedRuntimeMessage(message) {
|
|
|
64
65
|
}
|
|
65
66
|
return false;
|
|
66
67
|
}
|
|
68
|
+
// ADO #1385: staging code changes across layers.
|
|
69
|
+
// Eventually to be replaced by MessageType.accept
|
|
70
|
+
export var MessageType2;
|
|
71
|
+
(function (MessageType2) {
|
|
72
|
+
MessageType2["Accept"] = "accept";
|
|
73
|
+
})(MessageType2 || (MessageType2 = {}));
|
|
74
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
75
|
+
export function canBeCoalescedByService(message) {
|
|
76
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
77
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
78
|
+
return message.type === MessageType.NoOp || message.type === MessageType2.Accept;
|
|
79
|
+
}
|
|
67
80
|
//# 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;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAqD;IACjF,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAC;KACf;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,WAAW,CAAC,OAAO,CAAC;QACzB,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,IAAI;
|
|
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;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAqD;IACjF,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAC;KACf;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,WAAW,CAAC,OAAO,CAAC;QACzB,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,IAAI,CAAC;QACtB,KAAK,YAAY,CAAC,MAAM,CAAC;QACzB,KAAK,WAAW,CAAC,SAAS;YACtB,OAAO,IAAI,CAAC;QAChB;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA0B;IACvD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAClD,CAAC;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;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,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;AAED,iDAAiD;AACjD,kDAAkD;AAClD,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACpB,iCAAiB,CAAA;AACrB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;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 *\n * @param message-message\n * @returns whether or not the message type is one listed below\n * \"op\"\n * \"summarize\"\n * \"propose\"\n * \"reject\"\n * \"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 * // ADO #1385: To be moved to container-definitions\n * @param message-message\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 * @deprecated - this API should not be used!\n * @param message-message\n * @returns whether or not the message type is one listed below (legacy)\n * \"component\"\n * \"attach\"\n * \"chunkedOp\"\n * \"blobAttach\"\n * \"rejoin\"\n * \"alias\"\n * \"op\"\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,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|
|
|
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,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,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AAkBD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAGjD,YACI,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAJrB,cAAS,GAAG,eAAe,CAAC,mBAAmB,CAAC;IAQzD,CAAC;CACJ;AAED,oFAAoF;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;;;;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"]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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.93071";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,+BAA+B,CAAC"}
|
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.93071";
|
|
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,
|
|
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,4BAA4B,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.93071\";\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.93071",
|
|
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": "
|
|
66
|
-
"@fluidframework/driver-definitions": "
|
|
67
|
-
"@fluidframework/gitresources": "^0.1037.
|
|
68
|
-
"@fluidframework/protocol-base": "^0.1037.
|
|
65
|
+
"@fluidframework/core-interfaces": "2.0.0-internal.1.2.0.93071",
|
|
66
|
+
"@fluidframework/driver-definitions": "2.0.0-internal.1.2.0.93071",
|
|
67
|
+
"@fluidframework/gitresources": "^0.1037.2000-91174",
|
|
68
|
+
"@fluidframework/protocol-base": "^0.1037.2000-91174",
|
|
69
69
|
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
70
|
-
"@fluidframework/telemetry-utils": "
|
|
70
|
+
"@fluidframework/telemetry-utils": "2.0.0-internal.1.2.0.93071",
|
|
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
79
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
80
|
-
"@fluidframework/mocha-test-setup": "
|
|
81
|
-
"@fluidframework/runtime-utils": "
|
|
80
|
+
"@fluidframework/mocha-test-setup": "2.0.0-internal.1.2.0.93071",
|
|
81
|
+
"@fluidframework/runtime-utils": "2.0.0-internal.1.2.0.93071",
|
|
82
82
|
"@microsoft/api-extractor": "^7.22.2",
|
|
83
83
|
"@rushstack/eslint-config": "^2.5.1",
|
|
84
84
|
"@types/mocha": "^9.1.1",
|
|
@@ -22,6 +22,8 @@ export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMe
|
|
|
22
22
|
case MessageType.Propose:
|
|
23
23
|
case MessageType.Reject:
|
|
24
24
|
case MessageType.NoOp:
|
|
25
|
+
case MessageType2.Accept:
|
|
26
|
+
case MessageType.Summarize:
|
|
25
27
|
return true;
|
|
26
28
|
default:
|
|
27
29
|
return false;
|
|
@@ -29,14 +31,13 @@ export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMe
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
34
|
+
* Tells if message was sent by container runtime
|
|
35
|
+
* // ADO #1385: To be moved to container-definitions
|
|
33
36
|
* @param message-message
|
|
34
|
-
* @returns whether
|
|
35
|
-
* "op"
|
|
36
|
-
* "summarize"
|
|
37
|
+
* @returns whether the message is a runtime message
|
|
37
38
|
*/
|
|
38
|
-
export function isRuntimeMessage(message:
|
|
39
|
-
return message.type === MessageType.Operation
|
|
39
|
+
export function isRuntimeMessage(message: { type: string; }): boolean {
|
|
40
|
+
return message.type === MessageType.Operation;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
enum RuntimeMessage {
|
|
@@ -50,7 +51,7 @@ enum RuntimeMessage {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
+
* @deprecated - this API should not be used!
|
|
54
55
|
* @param message-message
|
|
55
56
|
* @returns whether or not the message type is one listed below (legacy)
|
|
56
57
|
* "component"
|
|
@@ -67,3 +68,16 @@ export function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): bo
|
|
|
67
68
|
}
|
|
68
69
|
return false;
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
// ADO #1385: staging code changes across layers.
|
|
73
|
+
// Eventually to be replaced by MessageType.accept
|
|
74
|
+
export enum MessageType2 {
|
|
75
|
+
Accept = "accept",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
79
|
+
export function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean {
|
|
80
|
+
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
81
|
+
// same way it was doing coalescing of immediate noops in the past.
|
|
82
|
+
return message.type === MessageType.NoOp || message.type === MessageType2.Accept;
|
|
83
|
+
}
|
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