@fluidframework/driver-utils 2.0.0-internal.1.4.2 → 2.0.0-internal.2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/error.d.ts CHANGED
@@ -2,10 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
5
6
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
6
7
  /** Error indicating an API is being used improperly resulting in an invalid operation. */
7
- export declare class UsageError extends LoggingError implements IFluidErrorBase {
8
- readonly errorType = "usageError";
8
+ export declare class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
9
+ readonly errorType = DriverErrorType.usageError;
10
+ readonly canRetry = false;
9
11
  constructor(message: string);
10
12
  }
11
13
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,qBAAa,UAAW,SAAQ,YAAa,YAAW,eAAe;IACnE,QAAQ,CAAC,SAAS,gBAAgB;gBAG9B,OAAO,EAAE,MAAM;CAItB"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,qBAAa,UAAW,SAAQ,YAAa,YAAW,gBAAgB,EAAE,eAAe;IACrF,QAAQ,CAAC,SAAS,8BAA8B;IAChD,QAAQ,CAAC,QAAQ,SAAS;gBAGtB,OAAO,EAAE,MAAM;CAItB"}
package/dist/error.js CHANGED
@@ -5,12 +5,14 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.UsageError = void 0;
8
+ const driver_definitions_1 = require("@fluidframework/driver-definitions");
8
9
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
9
10
  /** Error indicating an API is being used improperly resulting in an invalid operation. */
10
11
  class UsageError extends telemetry_utils_1.LoggingError {
11
12
  constructor(message) {
12
13
  super(message, { usageError: true });
13
- this.errorType = "usageError";
14
+ this.errorType = driver_definitions_1.DriverErrorType.usageError;
15
+ this.canRetry = false;
14
16
  }
15
17
  }
16
18
  exports.UsageError = UsageError;
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAgF;AAEhF,0FAA0F;AAC1F,MAAa,UAAW,SAAQ,8BAAY;IAGxC,YACI,OAAe;QAEf,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QALhC,cAAS,GAAG,YAAY,CAAC;IAMlC,CAAC;CACJ;AARD,gCAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IFluidErrorBase {\n readonly errorType = \"usageError\";\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAAuF;AACvF,qEAAgF;AAEhF,0FAA0F;AAC1F,MAAa,UAAW,SAAQ,8BAAY;IAIxC,YACI,OAAe;QAEf,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QANhC,cAAS,GAAG,oCAAe,CAAC,UAAU,CAAC;QACvC,aAAQ,GAAG,KAAK,CAAC;IAM1B,CAAC;CACJ;AATD,gCASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverErrorType, IDriverErrorBase } from \"@fluidframework/driver-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.usageError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n"]}
@@ -3,22 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
- /**
7
- * Determines whether or not the message type is one of the following:
8
- *
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}
20
- */
21
- export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
22
6
  /**
23
7
  * Tells if message was sent by container runtime
24
8
  * @privateRemarks ADO #1385: To be moved to container-definitions
@@ -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;;;;;;;;;;;;;;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
+ {"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;;;;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,42 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.canBeCoalescedByService = exports.MessageType2 = exports.isUnpackedRuntimeMessage = exports.isRuntimeMessage = exports.isClientMessage = void 0;
3
+ exports.canBeCoalescedByService = exports.MessageType2 = exports.isUnpackedRuntimeMessage = exports.isRuntimeMessage = 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
- /**
10
- * Determines whether or not the message type is one of the following:
11
- *
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}
23
- */
24
- function isClientMessage(message) {
25
- if (isRuntimeMessage(message)) {
26
- return true;
27
- }
28
- switch (message.type) {
29
- case protocol_definitions_1.MessageType.Propose:
30
- case protocol_definitions_1.MessageType.Reject:
31
- case protocol_definitions_1.MessageType.NoOp:
32
- case MessageType2.Accept:
33
- case protocol_definitions_1.MessageType.Summarize:
34
- return true;
35
- default:
36
- return false;
37
- }
38
- }
39
- exports.isClientMessage = isClientMessage;
40
9
  /**
41
10
  * Tells if message was sent by container runtime
42
11
  * @privateRemarks ADO #1385: To be moved to container-definitions
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAAgH;AAEhH;;;;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 * 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 CHANGED
@@ -19,7 +19,10 @@ export declare function isOnline(): OnlineStatus;
19
19
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
20
20
  * It will be either DriverErrorType or the specific driver's specialized error type enum,
21
21
  * but we can't reference a specific driver's error type enum in this code.
22
- */
22
+ *
23
+ * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
24
+ * it can used from the base to upper layers.
25
+ */
23
26
  export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
24
27
  readonly errorType: string;
25
28
  }
@@ -35,9 +38,17 @@ export declare class GenericNetworkError extends LoggingError implements IDriver
35
38
  readonly errorType = DriverErrorType.genericNetworkError;
36
39
  constructor(message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
37
40
  }
38
- export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {
39
- static readonly errorType: string;
40
- readonly errorType: string;
41
+ /**
42
+ * FluidInvalidSchema error class.
43
+ */
44
+ export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
45
+ readonly errorType = DriverErrorType.fluidInvalidSchema;
46
+ readonly canRetry = false;
47
+ constructor(message: string, props: DriverErrorTelemetryProps);
48
+ }
49
+ export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
50
+ static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
51
+ readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
41
52
  readonly canRetry = false;
42
53
  constructor(message: string, props: DriverErrorTelemetryProps);
43
54
  }
@@ -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,CA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AK,EAAE,yBAAyB;CAIvC;AAED,qBAAa,cAAc,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAGlE,QAAQ,CAAC,SAAS,EAAE,CAAC;gBADrB,OAAO,EAAE,MAAM,EACN,SAAS,EAAE,CAAC,EACrB,KAAK,EAAE,yBAAyB;CAIvC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAMxF,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IALtC,QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGrB,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,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/dist/network.js CHANGED
@@ -3,9 +3,8 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var _a;
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getRetryDelayFromError = exports.getRetryDelaySecondsFromError = exports.canRetryOnError = exports.createGenericNetworkError = exports.createWriteError = exports.ThrottlingError = exports.RetryableError = exports.NonRetryableError = exports.NetworkErrorBasic = exports.LocationRedirectionError = exports.AuthorizationError = exports.DeltaStreamConnectionForbiddenError = exports.GenericNetworkError = exports.isOnline = exports.OnlineStatus = void 0;
7
+ exports.getRetryDelayFromError = exports.getRetryDelaySecondsFromError = exports.canRetryOnError = exports.createGenericNetworkError = exports.createWriteError = exports.ThrottlingError = exports.RetryableError = exports.NonRetryableError = exports.NetworkErrorBasic = exports.LocationRedirectionError = exports.AuthorizationError = exports.DeltaStreamConnectionForbiddenError = exports.FluidInvalidSchemaError = exports.GenericNetworkError = exports.isOnline = exports.OnlineStatus = void 0;
9
8
  const driver_definitions_1 = require("@fluidframework/driver-definitions");
10
9
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
11
10
  var OnlineStatus;
@@ -35,12 +34,17 @@ class GenericNetworkError extends telemetry_utils_1.LoggingError {
35
34
  }
36
35
  }
37
36
  exports.GenericNetworkError = GenericNetworkError;
38
- // Todo GH #6214: Remove after next drive def bump. This is necessary as there is no
39
- // compatible way to augment an enum, as it can't be optional. So for now
40
- // we need to duplicate the value here. We likely need to rethink our
41
- // DriverErrorType strategy so that it supports extension with optional
42
- // value.
43
- const deltaStreamConnectionForbiddenStr = "deltaStreamConnectionForbidden";
37
+ /**
38
+ * FluidInvalidSchema error class.
39
+ */
40
+ class FluidInvalidSchemaError extends telemetry_utils_1.LoggingError {
41
+ constructor(message, props) {
42
+ super(message, props);
43
+ this.errorType = driver_definitions_1.DriverErrorType.fluidInvalidSchema;
44
+ this.canRetry = false;
45
+ }
46
+ }
47
+ exports.FluidInvalidSchemaError = FluidInvalidSchemaError;
44
48
  class DeltaStreamConnectionForbiddenError extends telemetry_utils_1.LoggingError {
45
49
  constructor(message, props) {
46
50
  super(message, Object.assign(Object.assign({}, props), { statusCode: 400 }));
@@ -49,7 +53,7 @@ class DeltaStreamConnectionForbiddenError extends telemetry_utils_1.LoggingError
49
53
  }
50
54
  }
51
55
  exports.DeltaStreamConnectionForbiddenError = DeltaStreamConnectionForbiddenError;
52
- DeltaStreamConnectionForbiddenError.errorType = (_a = driver_definitions_1.DriverErrorType[deltaStreamConnectionForbiddenStr]) !== null && _a !== void 0 ? _a : deltaStreamConnectionForbiddenStr;
56
+ DeltaStreamConnectionForbiddenError.errorType = driver_definitions_1.DriverErrorType.deltaStreamConnectionForbidden;
53
57
  class AuthorizationError extends telemetry_utils_1.LoggingError {
54
58
  constructor(message, claims, tenantId, props) {
55
59
  // don't log claims or tenantId
@@ -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;QAJrB,cAAS,GAAG,oCAAe,CAAC,mBAAmB,CAAC;IAQzD,CAAC;CACJ;AAVD,kDAUC;AAED,oFAAoF;AACpF,yEAAyE;AACzE,qEAA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D;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"]}
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;AAqBD;;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;;GAEG;AACF,MAAa,uBAAwB,SAAQ,8BAAY;IAItD,YACI,OAAe,EACf,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAPjB,cAAS,GAAG,oCAAe,CAAC,kBAAkB,CAAC;Q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AC,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 * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that\n * it can used from the base to upper layers.\n*/\nexport 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/**\n * FluidInvalidSchema error class.\n */\n export class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.fluidInvalidSchema;\n readonly canRetry = false;\n\n constructor(\n message: string,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n readonly errorType = 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"]}
@@ -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.4.2";
8
+ export declare const pkgVersion = "2.0.0-internal.2.0.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.4.2";
11
+ exports.pkgVersion = "2.0.0-internal.2.0.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.4.2\";\n"]}
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.2.0.0\";\n"]}
@@ -11,7 +11,7 @@ export declare class PrefetchDocumentStorageService extends DocumentStorageServi
11
11
  get policies(): {
12
12
  caching: LoaderCachingPolicy;
13
13
  minBlobSize?: number | undefined;
14
- maximumCacheDurationMs?: number | undefined;
14
+ maximumCacheDurationMs?: 432000000 | undefined;
15
15
  } | undefined;
16
16
  getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
17
17
  readBlob(blobId: string): Promise<ArrayBufferLike>;
package/lib/error.d.ts CHANGED
@@ -2,10 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
5
6
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
6
7
  /** Error indicating an API is being used improperly resulting in an invalid operation. */
7
- export declare class UsageError extends LoggingError implements IFluidErrorBase {
8
- readonly errorType = "usageError";
8
+ export declare class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
9
+ readonly errorType = DriverErrorType.usageError;
10
+ readonly canRetry = false;
9
11
  constructor(message: string);
10
12
  }
11
13
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,qBAAa,UAAW,SAAQ,YAAa,YAAW,eAAe;IACnE,QAAQ,CAAC,SAAS,gBAAgB;gBAG9B,OAAO,EAAE,MAAM;CAItB"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,qBAAa,UAAW,SAAQ,YAAa,YAAW,gBAAgB,EAAE,eAAe;IACrF,QAAQ,CAAC,SAAS,8BAA8B;IAChD,QAAQ,CAAC,QAAQ,SAAS;gBAGtB,OAAO,EAAE,MAAM;CAItB"}
package/lib/error.js CHANGED
@@ -2,12 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { DriverErrorType } from "@fluidframework/driver-definitions";
5
6
  import { LoggingError } from "@fluidframework/telemetry-utils";
6
7
  /** Error indicating an API is being used improperly resulting in an invalid operation. */
7
8
  export class UsageError extends LoggingError {
8
9
  constructor(message) {
9
10
  super(message, { usageError: true });
10
- this.errorType = "usageError";
11
+ this.errorType = DriverErrorType.usageError;
12
+ this.canRetry = false;
11
13
  }
12
14
  }
13
15
  //# sourceMappingURL=error.js.map
package/lib/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,OAAO,UAAW,SAAQ,YAAY;IAGxC,YACI,OAAe;QAEf,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QALhC,cAAS,GAAG,YAAY,CAAC;IAMlC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IFluidErrorBase {\n readonly errorType = \"usageError\";\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAoB,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,OAAO,UAAW,SAAQ,YAAY;IAIxC,YACI,OAAe;QAEf,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QANhC,cAAS,GAAG,eAAe,CAAC,UAAU,CAAC;QACvC,aAAQ,GAAG,KAAK,CAAC;IAM1B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverErrorType, IDriverErrorBase } from \"@fluidframework/driver-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.usageError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n"]}
@@ -3,22 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
- /**
7
- * Determines whether or not the message type is one of the following:
8
- *
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}
20
- */
21
- export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
22
6
  /**
23
7
  * Tells if message was sent by container runtime
24
8
  * @privateRemarks ADO #1385: To be moved to container-definitions
@@ -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;;;;;;;;;;;;;;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
+ {"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;;;;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"}
@@ -3,36 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { MessageType } from "@fluidframework/protocol-definitions";
6
- /**
7
- * Determines whether or not the message type is one of the following:
8
- *
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}
20
- */
21
- export function isClientMessage(message) {
22
- if (isRuntimeMessage(message)) {
23
- return true;
24
- }
25
- switch (message.type) {
26
- case MessageType.Propose:
27
- case MessageType.Reject:
28
- case MessageType.NoOp:
29
- case MessageType2.Accept:
30
- case MessageType.Summarize:
31
- return true;
32
- default:
33
- return false;
34
- }
35
- }
36
6
  /**
37
7
  * Tells if message was sent by container runtime
38
8
  * @privateRemarks ADO #1385: To be moved to container-definitions
@@ -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;;;;;;;;;;;;;;GAcG;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;;;;GAIG;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;;;;;;;;;;;;;;;;;;GAkBG;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 * 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"]}
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;;;;GAIG;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;;;;;;;;;;;;;;;;;;GAkBG;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 * 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 CHANGED
@@ -19,7 +19,10 @@ export declare function isOnline(): OnlineStatus;
19
19
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
20
20
  * It will be either DriverErrorType or the specific driver's specialized error type enum,
21
21
  * but we can't reference a specific driver's error type enum in this code.
22
- */
22
+ *
23
+ * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
24
+ * it can used from the base to upper layers.
25
+ */
23
26
  export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
24
27
  readonly errorType: string;
25
28
  }
@@ -35,9 +38,17 @@ export declare class GenericNetworkError extends LoggingError implements IDriver
35
38
  readonly errorType = DriverErrorType.genericNetworkError;
36
39
  constructor(message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
37
40
  }
38
- export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {
39
- static readonly errorType: string;
40
- readonly errorType: string;
41
+ /**
42
+ * FluidInvalidSchema error class.
43
+ */
44
+ export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
45
+ readonly errorType = DriverErrorType.fluidInvalidSchema;
46
+ readonly canRetry = false;
47
+ constructor(message: string, props: DriverErrorTelemetryProps);
48
+ }
49
+ export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
50
+ static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
51
+ readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
41
52
  readonly canRetry = false;
42
53
  constructor(message: string, props: DriverErrorTelemetryProps);
43
54
  }
@@ -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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QAAQ,CAAC,SAAS,EAAE,CAAC;gBADrB,OAAO,EAAE,MAAM,EACN,SAAS,EAAE,CAAC,EACrB,KAAK,EAAE,yBAAyB;CAIvC;AAED,qBAAa,cAAc,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAGlE,QAAQ,CAAC,SAAS,EAAE,CAAC;gBADrB,OAAO,EAAE,MAAM,EACN,SAAS,EAAE,CAAC,EACrB,KAAK,EAAE,yBAAyB;CAIvC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAMxF,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IALtC,QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGrB,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,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
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- var _a;
6
5
  import { DriverErrorType, } from "@fluidframework/driver-definitions";
7
6
  import { LoggingError } from "@fluidframework/telemetry-utils";
8
7
  export var OnlineStatus;
@@ -30,12 +29,16 @@ export class GenericNetworkError extends LoggingError {
30
29
  this.errorType = DriverErrorType.genericNetworkError;
31
30
  }
32
31
  }
33
- // Todo GH #6214: Remove after next drive def bump. This is necessary as there is no
34
- // compatible way to augment an enum, as it can't be optional. So for now
35
- // we need to duplicate the value here. We likely need to rethink our
36
- // DriverErrorType strategy so that it supports extension with optional
37
- // value.
38
- const deltaStreamConnectionForbiddenStr = "deltaStreamConnectionForbidden";
32
+ /**
33
+ * FluidInvalidSchema error class.
34
+ */
35
+ export class FluidInvalidSchemaError extends LoggingError {
36
+ constructor(message, props) {
37
+ super(message, props);
38
+ this.errorType = DriverErrorType.fluidInvalidSchema;
39
+ this.canRetry = false;
40
+ }
41
+ }
39
42
  export class DeltaStreamConnectionForbiddenError extends LoggingError {
40
43
  constructor(message, props) {
41
44
  super(message, Object.assign(Object.assign({}, props), { statusCode: 400 }));
@@ -43,7 +46,7 @@ export class DeltaStreamConnectionForbiddenError extends LoggingError {
43
46
  this.canRetry = false;
44
47
  }
45
48
  }
46
- DeltaStreamConnectionForbiddenError.errorType = (_a = DriverErrorType[deltaStreamConnectionForbiddenStr]) !== null && _a !== void 0 ? _a : deltaStreamConnectionForbiddenStr;
49
+ DeltaStreamConnectionForbiddenError.errorType = DriverErrorType.deltaStreamConnectionForbidden;
47
50
  export class AuthorizationError extends LoggingError {
48
51
  constructor(message, claims, tenantId, props) {
49
52
  // don't log claims or tenantId
@@ -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;I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AC","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"]}
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,SAA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,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 * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that\n * it can used from the base to upper layers.\n*/\nexport 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/**\n * FluidInvalidSchema error class.\n */\n export class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.fluidInvalidSchema;\n readonly canRetry = false;\n\n constructor(\n message: string,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n readonly errorType = 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"]}
@@ -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.4.2";
8
+ export declare const pkgVersion = "2.0.0-internal.2.0.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.4.2";
8
+ export const pkgVersion = "2.0.0-internal.2.0.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.4.2\";\n"]}
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.2.0.0\";\n"]}
@@ -11,7 +11,7 @@ export declare class PrefetchDocumentStorageService extends DocumentStorageServi
11
11
  get policies(): {
12
12
  caching: LoaderCachingPolicy;
13
13
  minBlobSize?: number | undefined;
14
- maximumCacheDurationMs?: number | undefined;
14
+ maximumCacheDurationMs?: 432000000 | undefined;
15
15
  } | undefined;
16
16
  getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
17
17
  readBlob(blobId: string): Promise<ArrayBufferLike>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-utils",
3
- "version": "2.0.0-internal.1.4.2",
3
+ "version": "2.0.0-internal.2.0.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.4.2",
66
- "@fluidframework/driver-definitions": "^2.0.0-internal.1.4.2",
67
- "@fluidframework/gitresources": "^0.1037.2001",
68
- "@fluidframework/protocol-base": "^0.1037.2001",
69
- "@fluidframework/protocol-definitions": "^1.0.0",
70
- "@fluidframework/telemetry-utils": "^2.0.0-internal.1.4.2",
65
+ "@fluidframework/core-interfaces": "^2.0.0-internal.2.0.0",
66
+ "@fluidframework/driver-definitions": "^2.0.0-internal.2.0.0",
67
+ "@fluidframework/gitresources": "^0.1038.2000",
68
+ "@fluidframework/protocol-base": "^0.1038.2000",
69
+ "@fluidframework/protocol-definitions": "^1.1.0",
70
+ "@fluidframework/telemetry-utils": "^2.0.0-internal.2.0.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
76
  "@fluidframework/build-common": "^1.0.0",
77
- "@fluidframework/build-tools": "^0.4.4000",
78
- "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@^1.0.0",
77
+ "@fluidframework/build-tools": "^0.4.6000",
78
+ "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@>=2.0.0-internal.1.4.0 <2.0.0-internal.2.0.0",
79
79
  "@fluidframework/eslint-config-fluid": "^1.0.0",
80
- "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.4.2",
81
- "@fluidframework/runtime-utils": "^2.0.0-internal.1.4.2",
80
+ "@fluidframework/mocha-test-setup": "^2.0.0-internal.2.0.0",
81
+ "@fluidframework/runtime-utils": "^2.0.0-internal.2.0.0",
82
82
  "@microsoft/api-extractor": "^7.22.2",
83
83
  "@rushstack/eslint-config": "^2.5.1",
84
84
  "@types/mocha": "^9.1.1",
@@ -107,6 +107,40 @@
107
107
  "RemovedClassDeclaration_SummaryTreeAssembler": {
108
108
  "forwardCompat": false,
109
109
  "backCompat": false
110
+ },
111
+ "ClassDeclaration_AuthorizationError": {
112
+ "backCompat": false
113
+ },
114
+ "ClassDeclaration_GenericNetworkError": {
115
+ "backCompat": false
116
+ },
117
+ "ClassDeclaration_ThrottlingError": {
118
+ "backCompat": false
119
+ },
120
+ "RemovedFunctionDeclaration_isClientMessage": {
121
+ "backCompat": false,
122
+ "forwardCompat": false
123
+ },
124
+ "ClassDeclaration_DeltaStreamConnectionForbiddenError": {
125
+ "forwardCompat": false
126
+ },
127
+ "ClassDeclaration_UsageError": {
128
+ "forwardCompat": false
129
+ },
130
+ "ClassDeclaration_BlobAggregationStorage": {
131
+ "forwardCompat": false
132
+ },
133
+ "ClassDeclaration_BlobCacheStorageService": {
134
+ "forwardCompat": false
135
+ },
136
+ "ClassDeclaration_DocumentStorageServiceProxy": {
137
+ "forwardCompat": false
138
+ },
139
+ "ClassDeclaration_PrefetchDocumentStorageService": {
140
+ "forwardCompat": false
141
+ },
142
+ "ClassDeclaration_LocationRedirectionError": {
143
+ "backCompat": false
110
144
  }
111
145
  }
112
146
  }
package/src/error.ts CHANGED
@@ -3,11 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
6
7
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
7
8
 
8
9
  /** Error indicating an API is being used improperly resulting in an invalid operation. */
9
- export class UsageError extends LoggingError implements IFluidErrorBase {
10
- readonly errorType = "usageError";
10
+ export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
11
+ readonly errorType = DriverErrorType.usageError;
12
+ readonly canRetry = false;
11
13
 
12
14
  constructor(
13
15
  message: string,
@@ -4,37 +4,6 @@
4
4
  */
5
5
  import { IDocumentMessage, ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
6
6
 
7
- /**
8
- * Determines whether or not the message type is one of the following:
9
- *
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}
21
- */
22
- export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {
23
- if (isRuntimeMessage(message)) {
24
- return true;
25
- }
26
- switch (message.type) {
27
- case MessageType.Propose:
28
- case MessageType.Reject:
29
- case MessageType.NoOp:
30
- case MessageType2.Accept:
31
- case MessageType.Summarize:
32
- return true;
33
- default:
34
- return false;
35
- }
36
- }
37
-
38
7
  /**
39
8
  * Tells if message was sent by container runtime
40
9
  * @privateRemarks ADO #1385: To be moved to container-definitions
package/src/network.ts CHANGED
@@ -38,8 +38,11 @@ export function isOnline(): OnlineStatus {
38
38
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
39
39
  * It will be either DriverErrorType or the specific driver's specialized error type enum,
40
40
  * but we can't reference a specific driver's error type enum in this code.
41
- */
42
- export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
41
+ *
42
+ * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
43
+ * it can used from the base to upper layers.
44
+ */
45
+ export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
43
46
  readonly errorType: string;
44
47
  }
45
48
 
@@ -61,16 +64,24 @@ export class GenericNetworkError extends LoggingError implements IDriverErrorBas
61
64
  }
62
65
  }
63
66
 
64
- // Todo GH #6214: Remove after next drive def bump. This is necessary as there is no
65
- // compatible way to augment an enum, as it can't be optional. So for now
66
- // we need to duplicate the value here. We likely need to rethink our
67
- // DriverErrorType strategy so that it supports extension with optional
68
- // value.
69
- const deltaStreamConnectionForbiddenStr = "deltaStreamConnectionForbidden";
70
- export class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {
71
- static readonly errorType: string =
72
- DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;
73
- readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;
67
+ /**
68
+ * FluidInvalidSchema error class.
69
+ */
70
+ export class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
71
+ readonly errorType = DriverErrorType.fluidInvalidSchema;
72
+ readonly canRetry = false;
73
+
74
+ constructor(
75
+ message: string,
76
+ props: DriverErrorTelemetryProps,
77
+ ) {
78
+ super(message, props);
79
+ }
80
+ }
81
+
82
+ export class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
83
+ static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
84
+ readonly errorType = DeltaStreamConnectionForbiddenError.errorType;
74
85
  readonly canRetry = false;
75
86
 
76
87
  constructor(message: string, props: DriverErrorTelemetryProps) {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-utils";
9
- export const pkgVersion = "2.0.0-internal.1.4.2";
9
+ export const pkgVersion = "2.0.0-internal.2.0.0";