@fluidframework/driver-utils 2.0.0-internal.1.2.0.93071 → 2.0.0-internal.1.2.1

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.
@@ -4,36 +4,47 @@
4
4
  */
5
5
  import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
6
  /**
7
+ * Determines whether or not the message type is one of the following:
7
8
  *
8
- * @param message-message
9
- * @returns whether or not the message type is one listed below
10
- * "op"
11
- * "summarize"
12
- * "propose"
13
- * "reject"
14
- * "noop"
9
+ * - {@link @fluidframework/protocol-definitions#MessageType.Operation}
10
+ *
11
+ * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
12
+ *
13
+ * - {@link @fluidframework/protocol-definitions#MessageType.Propose}
14
+ *
15
+ * - {@link @fluidframework/protocol-definitions#MessageType.Reject}
16
+ *
17
+ * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
18
+ *
19
+ * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
15
20
  */
16
21
  export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
17
22
  /**
18
23
  * Tells if message was sent by container runtime
19
- * // ADO #1385: To be moved to container-definitions
20
- * @param message-message
24
+ * @privateRemarks ADO #1385: To be moved to container-definitions
21
25
  * @returns whether the message is a runtime message
22
26
  */
23
27
  export declare function isRuntimeMessage(message: {
24
28
  type: string;
25
29
  }): boolean;
26
30
  /**
27
- * @deprecated - this API should not be used!
28
- * @param message-message
29
- * @returns whether or not the message type is one listed below (legacy)
30
- * "component"
31
- * "attach"
32
- * "chunkedOp"
33
- * "blobAttach"
34
- * "rejoin"
35
- * "alias"
36
- * "op"
31
+ * Determines whether or not the message type is one of the following: (legacy)
32
+ *
33
+ * - "component"
34
+ *
35
+ * - "attach"
36
+ *
37
+ * - "chunkedOp"
38
+ *
39
+ * - "blobAttach"
40
+ *
41
+ * - "rejoin"
42
+ *
43
+ * - "alias"
44
+ *
45
+ * - "op"
46
+ *
47
+ * @deprecated This API should not be used.
37
48
  */
38
49
  export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
39
50
  export declare enum MessageType2 {
@@ -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,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
+ {"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"}
@@ -7,14 +7,19 @@ exports.canBeCoalescedByService = exports.MessageType2 = exports.isUnpackedRunti
7
7
  */
8
8
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
9
9
  /**
10
+ * Determines whether or not the message type is one of the following:
10
11
  *
11
- * @param message-message
12
- * @returns whether or not the message type is one listed below
13
- * "op"
14
- * "summarize"
15
- * "propose"
16
- * "reject"
17
- * "noop"
12
+ * - {@link @fluidframework/protocol-definitions#MessageType.Operation}
13
+ *
14
+ * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
15
+ *
16
+ * - {@link @fluidframework/protocol-definitions#MessageType.Propose}
17
+ *
18
+ * - {@link @fluidframework/protocol-definitions#MessageType.Reject}
19
+ *
20
+ * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
21
+ *
22
+ * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
18
23
  */
19
24
  function isClientMessage(message) {
20
25
  if (isRuntimeMessage(message)) {
@@ -34,8 +39,7 @@ function isClientMessage(message) {
34
39
  exports.isClientMessage = isClientMessage;
35
40
  /**
36
41
  * Tells if message was sent by container runtime
37
- * // ADO #1385: To be moved to container-definitions
38
- * @param message-message
42
+ * @privateRemarks ADO #1385: To be moved to container-definitions
39
43
  * @returns whether the message is a runtime message
40
44
  */
41
45
  function isRuntimeMessage(message) {
@@ -53,16 +57,23 @@ var RuntimeMessage;
53
57
  RuntimeMessage["Operation"] = "op";
54
58
  })(RuntimeMessage || (RuntimeMessage = {}));
55
59
  /**
56
- * @deprecated - this API should not be used!
57
- * @param message-message
58
- * @returns whether or not the message type is one listed below (legacy)
59
- * "component"
60
- * "attach"
61
- * "chunkedOp"
62
- * "blobAttach"
63
- * "rejoin"
64
- * "alias"
65
- * "op"
60
+ * Determines whether or not the message type is one of the following: (legacy)
61
+ *
62
+ * - "component"
63
+ *
64
+ * - "attach"
65
+ *
66
+ * - "chunkedOp"
67
+ *
68
+ * - "blobAttach"
69
+ *
70
+ * - "rejoin"
71
+ *
72
+ * - "alias"
73
+ *
74
+ * - "op"
75
+ *
76
+ * @deprecated This API should not be used.
66
77
  */
67
78
  function isUnpackedRuntimeMessage(message) {
68
79
  if (Object.values(RuntimeMessage).includes(message.type)) {
@@ -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,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"]}
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"]}
@@ -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.2.0.93071";
8
+ export declare const pkgVersion = "2.0.0-internal.1.2.1";
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,+BAA+B,CAAC"}
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,yBAAyB,CAAC"}
@@ -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.2.0.93071";
11
+ exports.pkgVersion = "2.0.0-internal.1.2.1";
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,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"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.2.1\";\n"]}
@@ -9,14 +9,18 @@ import { ITelemetryLogger } from "@fluidframework/common-definitions";
9
9
  */
10
10
  export interface IProgress {
11
11
  /**
12
- * Abort signal used to cancel operation
13
- * Note that most of the layers do not use this signal yet. We need to change that over time.
12
+ * Abort signal used to cancel operation.
13
+ *
14
+ * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
14
15
  * Please consult with API documentation / implementation.
15
16
  * Note that number of layers may not check this signal while holding this request in a queue,
16
17
  * so it may take a while it takes effect. This can be improved in the future.
17
- * Layers in question are:
18
- * - driver (RateLimiter)
19
- * - runWithRetry
18
+ *
19
+ * The layers in question are:
20
+ *
21
+ * - driver (RateLimiter)
22
+ *
23
+ * - runWithRetry
20
24
  */
21
25
  cancel?: AbortSignal;
22
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACjD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,CAAC,CA2DZ"}
1
+ {"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"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ChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC;AAhED,oCAgEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation\n * Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n * Layers in question are:\n * - driver (RateLimiter)\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
1
+ {"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAkE;AAClE,2EAAqE;AACrE,uCAAoE;AACpE,qDAA8C;AAC9C,wBAAsC;AAkC/B,KAAK,UAAU,YAAY,CAC9B,GAAyC,EACzC,aAAqB,EACrB,MAAwB,EACxB,QAAmB;;IAEnB,IAAI,MAAqB,CAAC;IAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,YAAY,GAAG,IAAI,CAAC,CAAC,sBAAsB;IAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,SAAS,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,SAAc,CAAC;IACnB,GAAG;QACC,IAAI;YACA,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC;SAClB;QAAC,OAAO,GAAG,EAAE;YACV,q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U;YACjB,QAAQ,EAAE,0BAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SAChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC;AAhED,oCAgEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation.\n *\n * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n *\n * The layers in question are:\n *\n * - driver (RateLimiter)\n *\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
@@ -4,36 +4,47 @@
4
4
  */
5
5
  import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
6
  /**
7
+ * Determines whether or not the message type is one of the following:
7
8
  *
8
- * @param message-message
9
- * @returns whether or not the message type is one listed below
10
- * "op"
11
- * "summarize"
12
- * "propose"
13
- * "reject"
14
- * "noop"
9
+ * - {@link @fluidframework/protocol-definitions#MessageType.Operation}
10
+ *
11
+ * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
12
+ *
13
+ * - {@link @fluidframework/protocol-definitions#MessageType.Propose}
14
+ *
15
+ * - {@link @fluidframework/protocol-definitions#MessageType.Reject}
16
+ *
17
+ * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
18
+ *
19
+ * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
15
20
  */
16
21
  export declare function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
17
22
  /**
18
23
  * Tells if message was sent by container runtime
19
- * // ADO #1385: To be moved to container-definitions
20
- * @param message-message
24
+ * @privateRemarks ADO #1385: To be moved to container-definitions
21
25
  * @returns whether the message is a runtime message
22
26
  */
23
27
  export declare function isRuntimeMessage(message: {
24
28
  type: string;
25
29
  }): boolean;
26
30
  /**
27
- * @deprecated - this API should not be used!
28
- * @param message-message
29
- * @returns whether or not the message type is one listed below (legacy)
30
- * "component"
31
- * "attach"
32
- * "chunkedOp"
33
- * "blobAttach"
34
- * "rejoin"
35
- * "alias"
36
- * "op"
31
+ * Determines whether or not the message type is one of the following: (legacy)
32
+ *
33
+ * - "component"
34
+ *
35
+ * - "attach"
36
+ *
37
+ * - "chunkedOp"
38
+ *
39
+ * - "blobAttach"
40
+ *
41
+ * - "rejoin"
42
+ *
43
+ * - "alias"
44
+ *
45
+ * - "op"
46
+ *
47
+ * @deprecated This API should not be used.
37
48
  */
38
49
  export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean;
39
50
  export declare enum MessageType2 {
@@ -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,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
+ {"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAEhH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,GAAG,OAAO,CAEpE;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAKpF;AAID,oBAAY,YAAY;IACpB,MAAM,WAAW;CACpB;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GAAG,OAAO,CAItG"}
@@ -4,14 +4,19 @@
4
4
  */
5
5
  import { MessageType } from "@fluidframework/protocol-definitions";
6
6
  /**
7
+ * Determines whether or not the message type is one of the following:
7
8
  *
8
- * @param message-message
9
- * @returns whether or not the message type is one listed below
10
- * "op"
11
- * "summarize"
12
- * "propose"
13
- * "reject"
14
- * "noop"
9
+ * - {@link @fluidframework/protocol-definitions#MessageType.Operation}
10
+ *
11
+ * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
12
+ *
13
+ * - {@link @fluidframework/protocol-definitions#MessageType.Propose}
14
+ *
15
+ * - {@link @fluidframework/protocol-definitions#MessageType.Reject}
16
+ *
17
+ * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
18
+ *
19
+ * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
15
20
  */
16
21
  export function isClientMessage(message) {
17
22
  if (isRuntimeMessage(message)) {
@@ -30,8 +35,7 @@ export function isClientMessage(message) {
30
35
  }
31
36
  /**
32
37
  * Tells if message was sent by container runtime
33
- * // ADO #1385: To be moved to container-definitions
34
- * @param message-message
38
+ * @privateRemarks ADO #1385: To be moved to container-definitions
35
39
  * @returns whether the message is a runtime message
36
40
  */
37
41
  export function isRuntimeMessage(message) {
@@ -48,16 +52,23 @@ var RuntimeMessage;
48
52
  RuntimeMessage["Operation"] = "op";
49
53
  })(RuntimeMessage || (RuntimeMessage = {}));
50
54
  /**
51
- * @deprecated - this API should not be used!
52
- * @param message-message
53
- * @returns whether or not the message type is one listed below (legacy)
54
- * "component"
55
- * "attach"
56
- * "chunkedOp"
57
- * "blobAttach"
58
- * "rejoin"
59
- * "alias"
60
- * "op"
55
+ * Determines whether or not the message type is one of the following: (legacy)
56
+ *
57
+ * - "component"
58
+ *
59
+ * - "attach"
60
+ *
61
+ * - "chunkedOp"
62
+ *
63
+ * - "blobAttach"
64
+ *
65
+ * - "rejoin"
66
+ *
67
+ * - "alias"
68
+ *
69
+ * - "op"
70
+ *
71
+ * @deprecated This API should not be used.
61
72
  */
62
73
  export function isUnpackedRuntimeMessage(message) {
63
74
  if (Object.values(RuntimeMessage).includes(message.type)) {
@@ -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,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"]}
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;QA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Content":["/*!\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"]}
@@ -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.2.0.93071";
8
+ export declare const pkgVersion = "2.0.0-internal.1.2.1";
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,+BAA+B,CAAC"}
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,yBAAyB,CAAC"}
@@ -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.2.0.93071";
8
+ export const pkgVersion = "2.0.0-internal.1.2.1";
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,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"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.1.2.1\";\n"]}
@@ -9,14 +9,18 @@ import { ITelemetryLogger } from "@fluidframework/common-definitions";
9
9
  */
10
10
  export interface IProgress {
11
11
  /**
12
- * Abort signal used to cancel operation
13
- * Note that most of the layers do not use this signal yet. We need to change that over time.
12
+ * Abort signal used to cancel operation.
13
+ *
14
+ * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
14
15
  * Please consult with API documentation / implementation.
15
16
  * Note that number of layers may not check this signal while holding this request in a queue,
16
17
  * so it may take a while it takes effect. This can be improved in the future.
17
- * Layers in question are:
18
- * - driver (RateLimiter)
19
- * - runWithRetry
18
+ *
19
+ * The layers in question are:
20
+ *
21
+ * - driver (RateLimiter)
22
+ *
23
+ * - runWithRetry
20
24
  */
21
25
  cancel?: AbortSignal;
22
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACjD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,CAAC,CA2DZ"}
1
+ {"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CACjD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,CAAC,CA2DZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,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ACvB,0BAA0B,EAC1B,eAAe,CAAC,YAAY,EAC5B,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAC/C,CAAC;aACL;YAED,UAAU,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,sFAAsF;YACtF,0FAA0F;YAC1F,YAAY,GAAG,MAAA,sBAAsB,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YAC/E,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAClB,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;aACvC;YACD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;SAC7B;KACJ,QAAQ,CAAC,OAAO,EAAE;IACnB,IAAI,UAAU,GAAG,CAAC,EAAE;QAChB,MAAM,CAAC,kBAAkB,CAAC;YACtB,SAAS,EAAE,GAAG,aAAa,YAAY;YACvC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SAChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation\n * Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n * Layers in question are:\n * - driver (RateLimiter)\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
1
+ {"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAkCtC,MAAM,CAAC,KAAK,UAAU,YAAY,CAC9B,GAAyC,EACzC,aAAqB,EACrB,MAAwB,EACxB,QAAmB;;IAEnB,IAAI,MAAqB,CAAC;IAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,YAAY,GAAG,IAAI,CAAC,CAAC,sBAAsB;IAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,SAAc,CAAC;IACnB,GAAG;QACC,IAAI;YACA,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC;SAClB;QAAC,OAAO,GAAG,EAAE;YACV,qDAAqD;YACrD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE;gBACvB,MAAM,CAAC,kBAAkB,CAAC;oBACtB,SAAS,EAAE,GAAG,aAAa,SAAS;oBACpC,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;iBAChB,EAAE,GAAG,CAAC,CAAC;gBACR,MAAM,GAAG,CAAC;aACb;YAED,IAAI,CAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,OAAO,MAAK,IAAI,EAAE;gBACnC,MAAM,CAAC,kBAAkB,CAAC;oBACtB,SAAS,EAAE,GAAG,aAAa,sBAAsB;oBACjD,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;iBAChB,EAAE,GAAG,CAAC,CAAC;gBACR,MAAM,IAAI,iBAAiB,CACvB,0BAA0B,EAC1B,eAAe,CAAC,YAAY,EAC5B,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAC/C,CAAC;aACL;YAED,UAAU,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,sFAAsF;YACtF,0FAA0F;YAC1F,YAAY,GAAG,MAAA,sBAAsB,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YAC/E,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAClB,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;aACvC;YACD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;SAC7B;KACJ,QAAQ,CAAC,OAAO,EAAE;IACnB,IAAI,UAAU,GAAG,CAAC,EAAE;QAChB,MAAM,CAAC,kBAAkB,CAAC;YACtB,SAAS,EAAE,GAAG,aAAa,YAAY;YACvC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SAChB,EACD,SAAS,CAAC,CAAC;KACd;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { delay, performance } from \"@fluidframework/common-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { NonRetryableError } from \".\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n */\nexport interface IProgress {\n /**\n * Abort signal used to cancel operation.\n *\n * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n * Please consult with API documentation / implementation.\n * Note that number of layers may not check this signal while holding this request in a queue,\n * so it may take a while it takes effect. This can be improved in the future.\n *\n * The layers in question are:\n *\n * - driver (RateLimiter)\n *\n * - runWithRetry\n */\n cancel?: AbortSignal;\n\n /**\n * Called whenever api returns cancellable error and the call is going to be retried.\n * Any exception thrown from this call back result in cancellation of operation\n * and propagation of thrown exception.\n * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n * as well as information provided by service (like 429 error asking to wait for some time before retry)\n * @param error - error object returned from the call.\n */\n onRetry?(delayInMs: number, error: any): void;\n}\n\nexport async function runWithRetry<T>(\n api: (cancel?: AbortSignal) => Promise<T>,\n fetchCallName: string,\n logger: ITelemetryLogger,\n progress: IProgress,\n): Promise<T> {\n let result: T | undefined;\n let success = false;\n let retryAfterMs = 1000; // has to be positive!\n let numRetries = 0;\n const startTime = performance.now();\n let lastError: any;\n do {\n try {\n result = await api(progress.cancel);\n success = true;\n } catch (err) {\n // If it is not retriable, then just throw the error.\n if (!canRetryOnError(err)) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_cancel`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw err;\n }\n\n if (progress.cancel?.aborted === true) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_runWithRetryAborted`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n }, err);\n throw new NonRetryableError(\n \"runWithRetry was Aborted\",\n DriverErrorType.genericError,\n { driverVersion: pkgVersion, fetchCallName },\n );\n }\n\n numRetries++;\n lastError = err;\n // If the error is throttling error, then wait for the specified time before retrying.\n // If the waitTime is not specified, then we start with retrying immediately to max of 8s.\n retryAfterMs = getRetryDelayFromError(err) ?? Math.min(retryAfterMs * 2, 8000);\n if (progress.onRetry) {\n progress.onRetry(retryAfterMs, err);\n }\n await delay(retryAfterMs);\n }\n } while (!success);\n if (numRetries > 0) {\n logger.sendTelemetryEvent({\n eventName: `${fetchCallName}_lastError`,\n retry: numRetries,\n duration: performance.now() - startTime,\n fetchCallName,\n },\n lastError);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return result!;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-utils",
3
- "version": "2.0.0-internal.1.2.0.93071",
3
+ "version": "2.0.0-internal.1.2.1",
4
4
  "description": "Collection of utility functions for Fluid drivers",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -62,12 +62,12 @@
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.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",
65
+ "@fluidframework/core-interfaces": "^2.0.0-internal.1.2.1",
66
+ "@fluidframework/driver-definitions": "^2.0.0-internal.1.2.1",
67
+ "@fluidframework/gitresources": "^0.1037.2001",
68
+ "@fluidframework/protocol-base": "^0.1037.2001",
69
69
  "@fluidframework/protocol-definitions": "^1.0.0",
70
- "@fluidframework/telemetry-utils": "2.0.0-internal.1.2.0.93071",
70
+ "@fluidframework/telemetry-utils": "^2.0.0-internal.1.2.1",
71
71
  "axios": "^0.26.0",
72
72
  "url": "^0.11.0",
73
73
  "uuid": "^8.3.1"
@@ -76,9 +76,9 @@
76
76
  "@fluidframework/build-common": "^1.0.0",
77
77
  "@fluidframework/build-tools": "^0.4.4000",
78
78
  "@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@^1.0.0",
79
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
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",
79
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
80
+ "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.2.1",
81
+ "@fluidframework/runtime-utils": "^2.0.0-internal.1.2.1",
82
82
  "@microsoft/api-extractor": "^7.22.2",
83
83
  "@rushstack/eslint-config": "^2.5.1",
84
84
  "@types/mocha": "^9.1.1",
@@ -5,14 +5,19 @@
5
5
  import { IDocumentMessage, ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
6
6
 
7
7
  /**
8
+ * Determines whether or not the message type is one of the following:
8
9
  *
9
- * @param message-message
10
- * @returns whether or not the message type is one listed below
11
- * "op"
12
- * "summarize"
13
- * "propose"
14
- * "reject"
15
- * "noop"
10
+ * - {@link @fluidframework/protocol-definitions#MessageType.Operation}
11
+ *
12
+ * - {@link @fluidframework/protocol-definitions#MessageType.Summarize}
13
+ *
14
+ * - {@link @fluidframework/protocol-definitions#MessageType.Propose}
15
+ *
16
+ * - {@link @fluidframework/protocol-definitions#MessageType.Reject}
17
+ *
18
+ * - {@link @fluidframework/protocol-definitions#MessageType2.Accept}
19
+ *
20
+ * - {@link @fluidframework/protocol-definitions#MessageType.NoOp}
16
21
  */
17
22
  export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {
18
23
  if (isRuntimeMessage(message)) {
@@ -32,8 +37,7 @@ export function isClientMessage(message: ISequencedDocumentMessage | IDocumentMe
32
37
 
33
38
  /**
34
39
  * Tells if message was sent by container runtime
35
- * // ADO #1385: To be moved to container-definitions
36
- * @param message-message
40
+ * @privateRemarks ADO #1385: To be moved to container-definitions
37
41
  * @returns whether the message is a runtime message
38
42
  */
39
43
  export function isRuntimeMessage(message: { type: string; }): boolean {
@@ -51,16 +55,23 @@ enum RuntimeMessage {
51
55
  }
52
56
 
53
57
  /**
54
- * @deprecated - this API should not be used!
55
- * @param message-message
56
- * @returns whether or not the message type is one listed below (legacy)
57
- * "component"
58
- * "attach"
59
- * "chunkedOp"
60
- * "blobAttach"
61
- * "rejoin"
62
- * "alias"
63
- * "op"
58
+ * Determines whether or not the message type is one of the following: (legacy)
59
+ *
60
+ * - "component"
61
+ *
62
+ * - "attach"
63
+ *
64
+ * - "chunkedOp"
65
+ *
66
+ * - "blobAttach"
67
+ *
68
+ * - "rejoin"
69
+ *
70
+ * - "alias"
71
+ *
72
+ * - "op"
73
+ *
74
+ * @deprecated This API should not be used.
64
75
  */
65
76
  export function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {
66
77
  if ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {
@@ -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.2.0.93071";
9
+ export const pkgVersion = "2.0.0-internal.1.2.1";
@@ -16,14 +16,18 @@ import { NonRetryableError } from ".";
16
16
  */
17
17
  export interface IProgress {
18
18
  /**
19
- * Abort signal used to cancel operation
20
- * Note that most of the layers do not use this signal yet. We need to change that over time.
19
+ * Abort signal used to cancel operation.
20
+ *
21
+ * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
21
22
  * Please consult with API documentation / implementation.
22
23
  * Note that number of layers may not check this signal while holding this request in a queue,
23
24
  * so it may take a while it takes effect. This can be improved in the future.
24
- * Layers in question are:
25
- * - driver (RateLimiter)
26
- * - runWithRetry
25
+ *
26
+ * The layers in question are:
27
+ *
28
+ * - driver (RateLimiter)
29
+ *
30
+ * - runWithRetry
27
31
  */
28
32
  cancel?: AbortSignal;
29
33