@fluidframework/container-loader 0.59.2000 → 0.59.3000-67119

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.
Files changed (94) hide show
  1. package/.eslintrc.js +0 -1
  2. package/README.md +4 -4
  3. package/dist/collabWindowTracker.js +5 -5
  4. package/dist/collabWindowTracker.js.map +1 -1
  5. package/dist/connectionManager.d.ts.map +1 -1
  6. package/dist/connectionManager.js +32 -32
  7. package/dist/connectionManager.js.map +1 -1
  8. package/dist/connectionStateHandler.d.ts.map +1 -1
  9. package/dist/connectionStateHandler.js +10 -10
  10. package/dist/connectionStateHandler.js.map +1 -1
  11. package/dist/container.d.ts +2 -1
  12. package/dist/container.d.ts.map +1 -1
  13. package/dist/container.js +76 -71
  14. package/dist/container.js.map +1 -1
  15. package/dist/containerContext.js +2 -2
  16. package/dist/containerContext.js.map +1 -1
  17. package/dist/containerStorageAdapter.d.ts.map +1 -1
  18. package/dist/containerStorageAdapter.js.map +1 -1
  19. package/dist/contracts.js +1 -1
  20. package/dist/contracts.js.map +1 -1
  21. package/dist/deltaManager.d.ts.map +1 -1
  22. package/dist/deltaManager.js +27 -27
  23. package/dist/deltaManager.js.map +1 -1
  24. package/dist/deltaQueue.d.ts.map +1 -1
  25. package/dist/deltaQueue.js +1 -1
  26. package/dist/deltaQueue.js.map +1 -1
  27. package/dist/loader.d.ts +2 -0
  28. package/dist/loader.d.ts.map +1 -1
  29. package/dist/loader.js +9 -9
  30. package/dist/loader.js.map +1 -1
  31. package/dist/packageVersion.d.ts +1 -1
  32. package/dist/packageVersion.d.ts.map +1 -1
  33. package/dist/packageVersion.js +1 -1
  34. package/dist/packageVersion.js.map +1 -1
  35. package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
  36. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  37. package/dist/protocolTreeDocumentStorageService.js +1 -1
  38. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  39. package/dist/quorum.d.ts +4 -1
  40. package/dist/quorum.d.ts.map +1 -1
  41. package/dist/quorum.js +25 -6
  42. package/dist/quorum.js.map +1 -1
  43. package/dist/retriableDocumentStorageService.js +2 -2
  44. package/dist/retriableDocumentStorageService.js.map +1 -1
  45. package/dist/utils.d.ts +1 -0
  46. package/dist/utils.d.ts.map +1 -1
  47. package/dist/utils.js +11 -7
  48. package/dist/utils.js.map +1 -1
  49. package/lib/connectionManager.d.ts.map +1 -1
  50. package/lib/connectionManager.js.map +1 -1
  51. package/lib/connectionStateHandler.d.ts.map +1 -1
  52. package/lib/connectionStateHandler.js +3 -3
  53. package/lib/connectionStateHandler.js.map +1 -1
  54. package/lib/container.d.ts +2 -1
  55. package/lib/container.d.ts.map +1 -1
  56. package/lib/container.js +28 -23
  57. package/lib/container.js.map +1 -1
  58. package/lib/containerContext.js.map +1 -1
  59. package/lib/containerStorageAdapter.d.ts.map +1 -1
  60. package/lib/containerStorageAdapter.js.map +1 -1
  61. package/lib/contracts.js.map +1 -1
  62. package/lib/deltaManager.d.ts.map +1 -1
  63. package/lib/deltaManager.js.map +1 -1
  64. package/lib/deltaQueue.d.ts.map +1 -1
  65. package/lib/deltaQueue.js.map +1 -1
  66. package/lib/loader.d.ts +2 -0
  67. package/lib/loader.d.ts.map +1 -1
  68. package/lib/loader.js.map +1 -1
  69. package/lib/packageVersion.d.ts +1 -1
  70. package/lib/packageVersion.d.ts.map +1 -1
  71. package/lib/packageVersion.js +1 -1
  72. package/lib/packageVersion.js.map +1 -1
  73. package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
  74. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  75. package/lib/quorum.d.ts +4 -1
  76. package/lib/quorum.d.ts.map +1 -1
  77. package/lib/quorum.js +18 -1
  78. package/lib/quorum.js.map +1 -1
  79. package/lib/utils.d.ts +1 -0
  80. package/lib/utils.d.ts.map +1 -1
  81. package/lib/utils.js +3 -0
  82. package/lib/utils.js.map +1 -1
  83. package/package.json +12 -11
  84. package/src/connectionManager.ts +2 -3
  85. package/src/connectionStateHandler.ts +11 -8
  86. package/src/container.ts +55 -49
  87. package/src/containerStorageAdapter.ts +4 -4
  88. package/src/contracts.ts +8 -8
  89. package/src/deltaManager.ts +5 -8
  90. package/src/deltaQueue.ts +2 -4
  91. package/src/loader.ts +5 -3
  92. package/src/packageVersion.ts +1 -1
  93. package/src/quorum.ts +26 -1
  94. package/src/utils.ts +6 -2
package/.eslintrc.js CHANGED
@@ -11,6 +11,5 @@ module.exports = {
11
11
  "project": ["./tsconfig.json", "./src/test/tsconfig.json"]
12
12
  },
13
13
  "rules": {
14
- "no-null/no-null": "off"
15
14
  }
16
15
  }
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  - [`permissions`](#permissions)
20
20
  - [`forced`](#forced)
21
21
  - [`storageOnly`](#storageonly)
22
- - [Dirty events](#Dirty-events)
22
+ - [Dirty events](#dirty-events)
23
23
 
24
24
  **Related topics covered elsewhere:**
25
25
 
@@ -64,7 +64,7 @@ Container is returned as result of Loader.resolve() call. Loader can cache conta
64
64
 
65
65
  ### Connectivity
66
66
 
67
- Usually container is returned when state of container (and data stores) is rehydrated from snapshot. Unless `IRequest.headers.pause` is specified, connection to ordering service will be established at some point (asynchronously) and latest Ops would be processed, allowing local changes to flow form client to server. `Container.connected` indicates whether connection to ordering service is established, and [Connectivity events](#Connectivity-events) are notifying about connectivity changes. While it's highly recommended for listeners to check initial state at the moment they register for connectivity events, new listeners are called on registration to propagate current state. I.e. if container is disconnected when both "connected" & "disconnected" listeners are installed, newly installed listener for "disconnected" event will be called on registration.
67
+ Usually container is returned when state of container (and data stores) is rehydrated from snapshot. Unless `IRequest.headers.pause` is specified, connection to ordering service will be established at some point (asynchronously) and latest Ops would be processed, allowing local changes to flow form client to server. `Container.connectionState` indicates whether connection to ordering service is established, and [Connectivity events](#Connectivity-events) are notifying about connectivity changes. While it's highly recommended for listeners to check initial state at the moment they register for connectivity events, new listeners are called on registration to propagate current state. That is, if a container is disconnected when both "connected" and "disconnected" listeners are installed, newly installed listeners for "disconnected" event will be called on registration.
68
68
 
69
69
  ### Closure
70
70
 
@@ -141,11 +141,11 @@ Container raises two events to notify hosting application about connectivity iss
141
141
  - `"connected"` event is raised when container is connected and is up-to-date, i.e. changes are flowing between client and server.
142
142
  - `"disconnected"` event is raised when container lost connectivity (for any reason).
143
143
 
144
- Container also exposes `Container.connected` property to indicate current state.
144
+ Container also exposes `Container.connectionState` property to indicate current state.
145
145
 
146
146
  In normal circumstances, container will attempt to reconnect back to ordering service as quickly as possible. But it will scale down retries if computer is offline. That said, if IThrottlingWarning is raised through `"warning"` handler, then container is following storage throttling policy and will attempt to reconnect after some amount of time (`IThrottlingWarning.retryAfterSeconds`).
147
147
 
148
- Container will also not attempt to reconnect on lost connection if `Container.setAutoReconnect(false)` was called prior to loss of connection. This might be useful if hosting application implements "user away" type of experience to reduce cost on both client and server of maintaining connection while user is away. Calling setAutoReconnect(true) will reenable automatic reconnections, but host might need to allow extra time for reconnection as it likely involves token fetch and processing of a lot of Ops generated by other clients while this client was not connected.
148
+ Container will also not attempt to reconnect on lost connection if `Container.disconnect()` was called prior to loss of connection. This can be useful if the hosting application implements "user away" type of experience to reduce cost on both client and server of maintaining connection while user is away. Calling `Container.connect()` will reenable automatic reconnections, but the host might need to allow extra time for reconnection as it likely involves token fetch and processing of a lot of Ops generated by other clients while it was not connected.
149
149
 
150
150
  Data stores should almost never listen to these events (see more on [Readonly states](#Readonly-states), and should use consensus DDSes if they need to synchronize activity across clients. DDSes listen for these events to know when to resubmit pending Ops.
151
151
 
@@ -37,7 +37,7 @@ class CollabWindowTracker {
37
37
  // Can get here due to this.stopSequenceNumberUpdate() not resetting timer.
38
38
  // Also timer callback can fire even after timer cancellation if it was queued before cancellation.
39
39
  if (this.opsCountSinceNoop !== 0) {
40
- common_utils_1.assert(this.activeConnection(), 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
40
+ (0, common_utils_1.assert)(this.activeConnection(), 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
41
41
  this.submitNoop(false /* immediate */);
42
42
  }
43
43
  });
@@ -60,10 +60,10 @@ class CollabWindowTracker {
60
60
  // We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN
61
61
  // update, which updates the MSN, then ack the update, etc...). Also, don't
62
62
  // count system messages in ops count.
63
- if (protocol_base_1.isSystemMessage(message)) {
63
+ if ((0, protocol_base_1.isSystemMessage)(message)) {
64
64
  return;
65
65
  }
66
- common_utils_1.assert(message.type !== protocol_definitions_1.MessageType.NoOp, 0x0ce /* "Don't acknowledge no-ops" */);
66
+ (0, common_utils_1.assert)(message.type !== protocol_definitions_1.MessageType.NoOp, 0x0ce /* "Don't acknowledge no-ops" */);
67
67
  this.opsCountSinceNoop++;
68
68
  if (this.opsCountSinceNoop >= this.NoopCountFrequency) {
69
69
  this.submitNoop(false /* immediate */);
@@ -72,12 +72,12 @@ class CollabWindowTracker {
72
72
  if (this.opsCountSinceNoop === 1) {
73
73
  this.timer.restart();
74
74
  }
75
- common_utils_1.assert(this.timer.hasTimer, 0x242 /* "has timer" */);
75
+ (0, common_utils_1.assert)(this.timer.hasTimer, 0x242 /* "has timer" */);
76
76
  }
77
77
  submitNoop(immediate) {
78
78
  // Anything other than null is immediate noop
79
79
  this.submit(protocol_definitions_1.MessageType.NoOp, immediate ? "" : null);
80
- common_utils_1.assert(this.opsCountSinceNoop === 0, 0x243 /* "stopSequenceNumberUpdate should be called as result of sending any op!" */);
80
+ (0, common_utils_1.assert)(this.opsCountSinceNoop === 0, 0x243 /* "stopSequenceNumberUpdate should be called as result of sending any op!" */);
81
81
  }
82
82
  stopSequenceNumberUpdate() {
83
83
  this.opsCountSinceNoop = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"collabWindowTracker.js","sourceRoot":"","sources":["../src/collabWindowTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA6D;AAC7D,+EAA8F;AAC9F,iEAAgE;AAEhE,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O;SACV;QACD,qBAAM,CAAC,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAElF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACnD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YACvC,OAAO;SACV;QACD,IAAI,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE;YAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;QACD,qBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACzD,CAAC;IAEO,UAAU,CAAC,SAAkB;QACjC,6CAA6C;QAC7C,IAAI,CAAC,MAAM,CAAC,kCAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,qBAAM,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAC/B,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAC9F,CAAC;IAEM,wBAAwB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,kGAAkG;QAClG,wGAAwG;QACxG,oDAAoD;QACpD,qGAAqG;QACrG,yFAAyF;QACzF,sBAAsB;IAC1B,CAAC;CACJ;AAzED,kDAyEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Timer } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { isSystemMessage } from \"@fluidframework/protocol-base\";\n\n// Here are key considerations when deciding conditions for when to send non-immediate noops:\n// 1. Sending them too often results in increase in file size and bandwidth, as well as catch up performance\n// 2. Sending too infrequently ensures that collab window is large, and as result Sequence DDS would have\n// large catchUp blobs - see Issue #6364\n// 3. Similarly, processes that rely on \"core\" snapshot (and can't parse trailing ops, including above), like search\n// parser in SPO, will result in non-accurate results due to presence of catch up blobs.\n// 4. Ordering service used 250ms timeout to coalesce non-immediate noops. It was changed to 2000 ms to allow more\n// aggressive noop sending from client side.\n// 5. Number of ops sent by all clients is proportional to number of \"write\" clients (every client sends noops),\n// but number of sequenced noops is a function of time (one op per 2 seconds at most).\n// We should consider impact to both outbound traffic (might be huge, depends on number of clients) and file size.\n// Please also see Issue #5629 for more discussions.\n//\n// With that, the current algorithm is as follows:\n// 1. Sent noop 2000 ms of receiving an op if no ops were sent by this client within this timeframe.\n// This will ensure that MSN moves forward with reasonable speed. If that results in too many sequenced noops,\n// server timeout of 2000ms should be reconsidered to be increased.\n// 2. If there are more than 50 ops received without sending any ops, send noop to keep collab window small.\n// Note that system ops (including noops themselves) are excluded, so it's 1 noop per 50 real ops.\nexport class CollabWindowTracker {\n private opsCountSinceNoop = 0;\n private readonly timer: Timer;\n\n constructor(\n private readonly submit: (type: MessageType, contents: any) => void,\n private readonly activeConnection: () => boolean,\n NoopTimeFrequency: number = 2000,\n private readonly NoopCountFrequency: number = 50,\n ) {\n this.timer = new Timer(NoopTimeFrequency, () => {\n // Can get here due to this.stopSequenceNumberUpdate() not resetting timer.\n // Also timer callback can fire even after timer cancellation if it was queued before cancellation.\n if (this.opsCountSinceNoop !== 0) {\n assert(this.activeConnection(),\n 0x241 /* \"disconnect should result in stopSequenceNumberUpdate() call\" */);\n this.submitNoop(false /* immediate */);\n }\n });\n }\n\n /**\n * Schedules as ack to the server to update the reference sequence number\n */\n public scheduleSequenceNumberUpdate(message: ISequencedDocumentMessage, immediateNoOp: boolean): void {\n // Exit early for inactive (not in quorum or not writers) clients.\n // They don't take part in the minimum sequence number calculation.\n if (!this.activeConnection()) {\n return;\n }\n\n // While processing a message, an immediate no-op can be requested.\n // i.e. to expedite approve or commit phase of quorum.\n if (immediateNoOp) {\n this.submitNoop(true /* immediate */);\n return;\n }\n\n // We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN\n // update, which updates the MSN, then ack the update, etc...). Also, don't\n // count system messages in ops count.\n if (isSystemMessage(message)) {\n return;\n }\n assert(message.type !== MessageType.NoOp, 0x0ce /* \"Don't acknowledge no-ops\" */);\n\n this.opsCountSinceNoop++;\n if (this.opsCountSinceNoop >= this.NoopCountFrequency) {\n this.submitNoop(false /* immediate */);\n return;\n }\n if (this.opsCountSinceNoop === 1) {\n this.timer.restart();\n }\n assert(this.timer.hasTimer, 0x242 /* \"has timer\" */);\n }\n\n private submitNoop(immediate: boolean) {\n // Anything other than null is immediate noop\n this.submit(MessageType.NoOp, immediate ? \"\" : null);\n assert(this.opsCountSinceNoop === 0,\n 0x243 /* \"stopSequenceNumberUpdate should be called as result of sending any op!\" */);\n }\n\n public stopSequenceNumberUpdate(): void {\n this.opsCountSinceNoop = 0;\n // Ideally, we cancel timer here. But that will result in too often set/reset cycle if this client\n // keeps sending ops. In most cases it's actually better to let it expire (at most - 4 times per second)\n // for nothing, then have a ton of set/reset cycles.\n // Note that Timer.restart() is smart and will not change timer expiration if we keep extending timer\n // expiration - it will restart the timer instead when it fires with adjusted expiration.\n // this.timer.clear();\n }\n}\n"]}
1
+ {"version":3,"file":"collabWindowTracker.js","sourceRoot":"","sources":["../src/collabWindowTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA6D;AAC7D,+EAA8F;AAC9F,iEAAgE;AAEhE,6FAA6F;AAC7F,4GAA4G;AAC5G,yGAAyG;AACzG,2CAA2C;AAC3C,oHAAoH;AACpH,2FAA2F;AAC3F,kHAAkH;AAClH,+CAA+C;AAC/C,gHAAgH;AAChH,yFAAyF;AACzF,qHAAqH;AACrH,oDAAoD;AACpD,EAAE;AACF,kDAAkD;AAClD,oGAAoG;AACpG,iHAAiH;AACjH,sEAAsE;AACtE,4GAA4G;AAC5G,qGAAqG;AACrG,MAA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,CAAC;YACvC,OAAO;SACV;QACD,IAAI,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE;YAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;QACD,IAAA,qBAAM,EAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACzD,CAAC;IAEO,UAAU,CAAC,SAAkB;QACjC,6CAA6C;QAC7C,IAAI,CAAC,MAAM,CAAC,kCAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,IAAA,qBAAM,EAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAC/B,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAC9F,CAAC;IAEM,wBAAwB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,kGAAkG;QAClG,wGAAwG;QACxG,oDAAoD;QACpD,qGAAqG;QACrG,yFAAyF;QACzF,sBAAsB;IAC1B,CAAC;CACJ;AAzED,kDAyEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Timer } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { isSystemMessage } from \"@fluidframework/protocol-base\";\n\n// Here are key considerations when deciding conditions for when to send non-immediate noops:\n// 1. Sending them too often results in increase in file size and bandwidth, as well as catch up performance\n// 2. Sending too infrequently ensures that collab window is large, and as result Sequence DDS would have\n// large catchUp blobs - see Issue #6364\n// 3. Similarly, processes that rely on \"core\" snapshot (and can't parse trailing ops, including above), like search\n// parser in SPO, will result in non-accurate results due to presence of catch up blobs.\n// 4. Ordering service used 250ms timeout to coalesce non-immediate noops. It was changed to 2000 ms to allow more\n// aggressive noop sending from client side.\n// 5. Number of ops sent by all clients is proportional to number of \"write\" clients (every client sends noops),\n// but number of sequenced noops is a function of time (one op per 2 seconds at most).\n// We should consider impact to both outbound traffic (might be huge, depends on number of clients) and file size.\n// Please also see Issue #5629 for more discussions.\n//\n// With that, the current algorithm is as follows:\n// 1. Sent noop 2000 ms of receiving an op if no ops were sent by this client within this timeframe.\n// This will ensure that MSN moves forward with reasonable speed. If that results in too many sequenced noops,\n// server timeout of 2000ms should be reconsidered to be increased.\n// 2. If there are more than 50 ops received without sending any ops, send noop to keep collab window small.\n// Note that system ops (including noops themselves) are excluded, so it's 1 noop per 50 real ops.\nexport class CollabWindowTracker {\n private opsCountSinceNoop = 0;\n private readonly timer: Timer;\n\n constructor(\n private readonly submit: (type: MessageType, contents: any) => void,\n private readonly activeConnection: () => boolean,\n NoopTimeFrequency: number = 2000,\n private readonly NoopCountFrequency: number = 50,\n ) {\n this.timer = new Timer(NoopTimeFrequency, () => {\n // Can get here due to this.stopSequenceNumberUpdate() not resetting timer.\n // Also timer callback can fire even after timer cancellation if it was queued before cancellation.\n if (this.opsCountSinceNoop !== 0) {\n assert(this.activeConnection(),\n 0x241 /* \"disconnect should result in stopSequenceNumberUpdate() call\" */);\n this.submitNoop(false /* immediate */);\n }\n });\n }\n\n /**\n * Schedules as ack to the server to update the reference sequence number\n */\n public scheduleSequenceNumberUpdate(message: ISequencedDocumentMessage, immediateNoOp: boolean): void {\n // Exit early for inactive (not in quorum or not writers) clients.\n // They don't take part in the minimum sequence number calculation.\n if (!this.activeConnection()) {\n return;\n }\n\n // While processing a message, an immediate no-op can be requested.\n // i.e. to expedite approve or commit phase of quorum.\n if (immediateNoOp) {\n this.submitNoop(true /* immediate */);\n return;\n }\n\n // We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN\n // update, which updates the MSN, then ack the update, etc...). Also, don't\n // count system messages in ops count.\n if (isSystemMessage(message)) {\n return;\n }\n assert(message.type !== MessageType.NoOp, 0x0ce /* \"Don't acknowledge no-ops\" */);\n\n this.opsCountSinceNoop++;\n if (this.opsCountSinceNoop >= this.NoopCountFrequency) {\n this.submitNoop(false /* immediate */);\n return;\n }\n if (this.opsCountSinceNoop === 1) {\n this.timer.restart();\n }\n assert(this.timer.hasTimer, 0x242 /* \"has timer\" */);\n }\n\n private submitNoop(immediate: boolean) {\n // Anything other than null is immediate noop\n this.submit(MessageType.NoOp, immediate ? \"\" : null);\n assert(this.opsCountSinceNoop === 0,\n 0x243 /* \"stopSequenceNumberUpdate should be called as result of sending any op!\" */);\n }\n\n public stopSequenceNumberUpdate(): void {\n this.opsCountSinceNoop = 0;\n // Ideally, we cancel timer here. But that will result in too often set/reset cycle if this client\n // keeps sending ops. In most cases it's actually better to let it expire (at most - 4 times per second)\n // for nothing, then have a ton of set/reset cycles.\n // Note that Timer.restart() is smart and will not change timer expiration if we keep extending timer\n // expiration - it will restart the timer instead when it fires with adjusted expiration.\n // this.timer.clear();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,gBAAgB,EAChB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,WAAW,EACX,YAAY,EAEZ,uBAAuB,EAC1B,MAAM,uCAAuC,CAAC;AAI/C,OAAO,EACH,gBAAgB,EAGnB,MAAM,oCAAoC,CAAC;AAW5C,OAAO,EACH,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAGhB,yBAAyB,EAO5B,MAAM,sCAAsC,CAAC;AAK9C,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAChC,MAAM,aAAa,CAAC;AAgErB;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAsJpD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,MAAM;IAEd,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KA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MG;IACF,OAAO,CAAC,gBAAgB;IAWzB;;;;;;OAMG;YACW,SAAS;IA2ChB,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,GAAG,gBAAgB,GAAG,SAAS;IAmC3G,YAAY,CAAC,OAAO,EAAE,GAAG;IAQzB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE;IA8BzC,0BAA0B,CAAC,OAAO,EAAE,yBAAyB;IAuCpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;IAGF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAmB1B;IAGF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAOxC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAK3B;CACL"}
@@ -20,7 +20,7 @@ function getNackReconnectInfo(nackContent) {
20
20
  const message = `Nack (${nackContent.type}): ${nackContent.message}`;
21
21
  const canRetry = nackContent.code !== 403;
22
22
  const retryAfterMs = nackContent.retryAfter !== undefined ? nackContent.retryAfter * 1000 : undefined;
23
- return driver_utils_1.createGenericNetworkError(message, { canRetry, retryAfterMs }, { statusCode: nackContent.code, driverVersion: undefined });
23
+ return (0, driver_utils_1.createGenericNetworkError)(message, { canRetry, retryAfterMs }, { statusCode: nackContent.code, driverVersion: undefined });
24
24
  }
25
25
  /**
26
26
  * Implementation of IDocumentDeltaConnection that does not support submitting
@@ -97,7 +97,7 @@ class ConnectionManager {
97
97
  this.nackHandler = (documentId, messages) => {
98
98
  const message = messages[0];
99
99
  if (this._readonlyPermissions === true) {
100
- this.props.closeHandler(driver_utils_1.createWriteError("writeOnReadOnlyDocument", { driverVersion: undefined }));
100
+ this.props.closeHandler((0, driver_utils_1.createWriteError)("writeOnReadOnlyDocument", { driverVersion: undefined }));
101
101
  return;
102
102
  }
103
103
  const reconnectInfo = getNackReconnectInfo(message.content);
@@ -129,7 +129,7 @@ class ConnectionManager {
129
129
  this.connection.submit(messages);
130
130
  });
131
131
  this._outbound.on("error", (error) => {
132
- this.props.closeHandler(telemetry_utils_1.normalizeError(error));
132
+ this.props.closeHandler((0, telemetry_utils_1.normalizeError)(error));
133
133
  });
134
134
  }
135
135
  get connectionVerboseProps() { return this._connectionVerboseProps; }
@@ -251,7 +251,7 @@ class ConnectionManager {
251
251
  * Will throw an error if reconnectMode set to Never.
252
252
  */
253
253
  setAutoReconnect(mode) {
254
- common_utils_1.assert(mode !== contracts_1.ReconnectMode.Never && this._reconnectMode !== contracts_1.ReconnectMode.Never, 0x278 /* "API is not supported for non-connecting or closed container" */);
254
+ (0, common_utils_1.assert)(mode !== contracts_1.ReconnectMode.Never && this._reconnectMode !== contracts_1.ReconnectMode.Never, 0x278 /* "API is not supported for non-connecting or closed container" */);
255
255
  this._reconnectMode = mode;
256
256
  if (mode !== contracts_1.ReconnectMode.Enabled) {
257
257
  // immediately disconnect - do not rely on service eventually dropping connection.
@@ -285,7 +285,7 @@ class ConnectionManager {
285
285
  const oldValue = this.readonly;
286
286
  this._forceReadonly = readonly;
287
287
  if (oldValue !== this.readonly) {
288
- common_utils_1.assert(this._reconnectMode !== contracts_1.ReconnectMode.Never, 0x279 /* "API is not supported for non-connecting or closed container" */);
288
+ (0, common_utils_1.assert)(this._reconnectMode !== contracts_1.ReconnectMode.Never, 0x279 /* "API is not supported for non-connecting or closed container" */);
289
289
  let reconnect = false;
290
290
  if (this.readonly === true) {
291
291
  // If we switch to readonly while connected, we should disconnect first
@@ -314,13 +314,13 @@ class ConnectionManager {
314
314
  }
315
315
  connect(connectionMode) {
316
316
  this.connectCore(connectionMode).catch((error) => {
317
- const normalizedError = telemetry_utils_1.normalizeError(error, { props: fatalConnectErrorProp });
317
+ const normalizedError = (0, telemetry_utils_1.normalizeError)(error, { props: fatalConnectErrorProp });
318
318
  this.props.closeHandler(normalizedError);
319
319
  });
320
320
  }
321
321
  async connectCore(connectionMode) {
322
322
  var _a;
323
- common_utils_1.assert(!this.closed, 0x26a /* "not closed" */);
323
+ (0, common_utils_1.assert)(!this.closed, 0x26a /* "not closed" */);
324
324
  if (this.connection !== undefined || this.pendingConnection) {
325
325
  return;
326
326
  }
@@ -334,14 +334,14 @@ class ConnectionManager {
334
334
  requestedMode = "write";
335
335
  }
336
336
  const docService = this.serviceProvider();
337
- common_utils_1.assert(docService !== undefined, 0x2a7 /* "Container is not attached" */);
337
+ (0, common_utils_1.assert)(docService !== undefined, 0x2a7 /* "Container is not attached" */);
338
338
  let connection;
339
339
  if (((_a = docService.policies) === null || _a === void 0 ? void 0 : _a.storageOnly) === true) {
340
340
  connection = new NoDeltaStream();
341
341
  // to keep setupNewSuccessfulConnection happy
342
342
  this.pendingConnection = true;
343
343
  this.setupNewSuccessfulConnection(connection, "read");
344
- common_utils_1.assert(!this.pendingConnection, 0x2b3 /* "logic error" */);
344
+ (0, common_utils_1.assert)(!this.pendingConnection, 0x2b3 /* "logic error" */);
345
345
  return;
346
346
  }
347
347
  // this.pendingConnection resets to false as soon as we know the outcome of the connection attempt
@@ -373,30 +373,30 @@ class ConnectionManager {
373
373
  break;
374
374
  }
375
375
  // Socket.io error when we connect to wrong socket, or hit some multiplexing bug
376
- if (!driver_utils_1.canRetryOnError(origError)) {
377
- const error = telemetry_utils_1.normalizeError(origError, { props: fatalConnectErrorProp });
376
+ if (!(0, driver_utils_1.canRetryOnError)(origError)) {
377
+ const error = (0, telemetry_utils_1.normalizeError)(origError, { props: fatalConnectErrorProp });
378
378
  this.props.closeHandler(error);
379
379
  throw error;
380
380
  }
381
381
  // Since the error is retryable this will not log to the error table
382
- driver_utils_1.logNetworkFailure(this.logger, {
382
+ (0, driver_utils_1.logNetworkFailure)(this.logger, {
383
383
  attempts: connectRepeatCount,
384
384
  delay: delayMs,
385
385
  eventName: "DeltaConnectionFailureToConnect",
386
386
  duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
387
387
  }, origError);
388
388
  lastError = origError;
389
- const retryDelayFromError = driver_utils_1.getRetryDelayFromError(origError);
389
+ const retryDelayFromError = (0, driver_utils_1.getRetryDelayFromError)(origError);
390
390
  delayMs = retryDelayFromError !== null && retryDelayFromError !== void 0 ? retryDelayFromError : Math.min(delayMs * 2, MaxReconnectDelayInMs);
391
391
  if (retryDelayFromError !== undefined) {
392
392
  this.props.reconnectionDelayHandler(retryDelayFromError, origError);
393
393
  }
394
- await driver_utils_1.waitForConnectedState(delayMs);
394
+ await (0, driver_utils_1.waitForConnectedState)(delayMs);
395
395
  }
396
396
  }
397
397
  // If we retried more than once, log an event about how long it took (this will not log to error table)
398
398
  if (connectRepeatCount > 1) {
399
- driver_utils_1.logNetworkFailure(this.logger, {
399
+ (0, driver_utils_1.logNetworkFailure)(this.logger, {
400
400
  eventName: "MultipleDeltaConnectionFailures",
401
401
  attempts: connectRepeatCount,
402
402
  duration: telemetry_utils_1.TelemetryLogger.formatTick(common_utils_1.performance.now() - connectStartTime),
@@ -410,7 +410,7 @@ class ConnectionManager {
410
410
  * @param args - The connection arguments
411
411
  */
412
412
  triggerConnect(connectionMode) {
413
- common_utils_1.assert(this.connection === undefined, 0x239 /* "called only in disconnected state" */);
413
+ (0, common_utils_1.assert)(this.connection === undefined, 0x239 /* "called only in disconnected state" */);
414
414
  if (this.reconnectMode !== contracts_1.ReconnectMode.Enabled) {
415
415
  return;
416
416
  }
@@ -425,7 +425,7 @@ class ConnectionManager {
425
425
  if (this.connection === undefined) {
426
426
  return false;
427
427
  }
428
- common_utils_1.assert(!this.pendingConnection, 0x27b /* "reentrancy may result in incorrect behavior" */);
428
+ (0, common_utils_1.assert)(!this.pendingConnection, 0x27b /* "reentrancy may result in incorrect behavior" */);
429
429
  const connection = this.connection;
430
430
  // Avoid any re-entrancy - clear object reference
431
431
  this.connection = undefined;
@@ -451,13 +451,13 @@ class ConnectionManager {
451
451
  */
452
452
  setupNewSuccessfulConnection(connection, requestedMode) {
453
453
  // Old connection should have been cleaned up before establishing a new one
454
- common_utils_1.assert(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
455
- common_utils_1.assert(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
454
+ (0, common_utils_1.assert)(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
455
+ (0, common_utils_1.assert)(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
456
456
  if (this.pendingConnection) {
457
457
  this.pendingConnection = false;
458
458
  }
459
459
  else {
460
- common_utils_1.assert(this.closed, 0x27f /* "reentrancy may result in incorrect behavior" */);
460
+ (0, common_utils_1.assert)(this.closed, 0x27f /* "reentrancy may result in incorrect behavior" */);
461
461
  }
462
462
  this.connection = connection;
463
463
  // Does information in scopes & mode matches?
@@ -466,8 +466,8 @@ class ConnectionManager {
466
466
  const readonly = !connection.claims.scopes.includes(protocol_definitions_1.ScopeType.DocWrite);
467
467
  // This connection mode validation logic is moving to the driver layer in 0.44. These two asserts can be
468
468
  // removed after those packages have released and become ubiquitous.
469
- common_utils_1.assert(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
470
- common_utils_1.assert(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
469
+ (0, common_utils_1.assert)(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
470
+ (0, common_utils_1.assert)(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
471
471
  this.set_readonlyPermissions(readonly);
472
472
  if (this.closed) {
473
473
  // Raise proper events, Log telemetry event and close connection.
@@ -545,7 +545,7 @@ class ConnectionManager {
545
545
  // We quite often get protocol errors before / after observing nack/disconnect
546
546
  // we do not want to run through same sequence twice.
547
547
  // If we're already disconnected/disconnecting it's not appropriate to call this again.
548
- common_utils_1.assert(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */);
548
+ (0, common_utils_1.assert)(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */);
549
549
  this.disconnectFromDeltaStream(disconnectMessage);
550
550
  // We will always trigger reconnect, even if canRetry is false.
551
551
  // Any truly fatal error state will result in container close upon attempted reconnect,
@@ -566,17 +566,17 @@ class ConnectionManager {
566
566
  if (this.closed || this.reconnectMode !== contracts_1.ReconnectMode.Enabled) {
567
567
  return;
568
568
  }
569
- const delayMs = driver_utils_1.getRetryDelayFromError(error);
569
+ const delayMs = (0, driver_utils_1.getRetryDelayFromError)(error);
570
570
  if (error !== undefined && delayMs !== undefined) {
571
571
  this.props.reconnectionDelayHandler(delayMs, error);
572
- await driver_utils_1.waitForConnectedState(delayMs);
572
+ await (0, driver_utils_1.waitForConnectedState)(delayMs);
573
573
  }
574
574
  this.triggerConnect(requestedMode);
575
575
  }
576
576
  prepareMessageToSend(message) {
577
577
  var _a, _b;
578
578
  if (this.readonly === true) {
579
- common_utils_1.assert(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
579
+ (0, common_utils_1.assert)(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
580
580
  const error = new container_utils_1.GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
581
581
  readonly: this.readOnlyInfo.readonly,
582
582
  forcedReadonly: this.readOnlyInfo.forced,
@@ -589,7 +589,7 @@ class ConnectionManager {
589
589
  // reset clientSequenceNumber if we are using new clientId.
590
590
  // we keep info about old connection as long as possible to be able to account for all non-acked ops
591
591
  // that we pick up on next connection.
592
- common_utils_1.assert(!!this.connection, 0x0e4 /* "Lost old connection!" */);
592
+ (0, common_utils_1.assert)(!!this.connection, 0x0e4 /* "Lost old connection!" */);
593
593
  if (this.lastSubmittedClientId !== ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.clientId)) {
594
594
  this.lastSubmittedClientId = (_b = this.connection) === null || _b === void 0 ? void 0 : _b.clientId;
595
595
  this.clientSequenceNumber = 0;
@@ -612,7 +612,7 @@ class ConnectionManager {
612
612
  }
613
613
  }
614
614
  sendMessages(messages) {
615
- common_utils_1.assert(this.connected, 0x2b4 /* "not connected on sending ops!" */);
615
+ (0, common_utils_1.assert)(this.connected, 0x2b4 /* "not connected on sending ops!" */);
616
616
  // If connection is "read" or implicit "read" (got leave op for "write" connection),
617
617
  // then op can't make it through - we will get a nack if op is sent.
618
618
  // We can short-circuit this process.
@@ -632,16 +632,16 @@ class ConnectionManager {
632
632
  }
633
633
  return;
634
634
  }
635
- common_utils_1.assert(!this.pendingReconnect, 0x2b5 /* "logic error" */);
635
+ (0, common_utils_1.assert)(!this.pendingReconnect, 0x2b5 /* "logic error" */);
636
636
  this._outbound.push(messages);
637
637
  }
638
638
  beforeProcessingIncomingOp(message) {
639
639
  // if we have connection, and message is local, then we better treat is as local!
640
- common_utils_1.assert(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, 0x0ee /* "Not accounting local messages correctly" */);
640
+ (0, common_utils_1.assert)(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, 0x0ee /* "Not accounting local messages correctly" */);
641
641
  if (this.lastSubmittedClientId !== undefined && this.lastSubmittedClientId === message.clientId) {
642
642
  const clientSequenceNumber = message.clientSequenceNumber;
643
- common_utils_1.assert(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */);
644
- common_utils_1.assert(clientSequenceNumber <= this.clientSequenceNumber, 0x0f0 /* "Incoming local client seq# > generated by this client" */);
643
+ (0, common_utils_1.assert)(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */);
644
+ (0, common_utils_1.assert)(clientSequenceNumber <= this.clientSequenceNumber, 0x0f0 /* "Incoming local client seq# > generated by this client" */);
645
645
  this.clientSequenceNumberObserved = clientSequenceNumber;
646
646
  }
647
647
  if (message.type === protocol_definitions_1.MessageType.ClientLeave) {