@fluidframework/container-loader 2.0.0-internal.6.1.1 → 2.0.0-internal.6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +4 -3
  3. package/dist/audience.js +2 -2
  4. package/dist/audience.js.map +1 -1
  5. package/dist/catchUpMonitor.js +2 -2
  6. package/dist/catchUpMonitor.js.map +1 -1
  7. package/dist/connectionManager.d.ts +1 -1
  8. package/dist/connectionManager.d.ts.map +1 -1
  9. package/dist/connectionManager.js +38 -37
  10. package/dist/connectionManager.js.map +1 -1
  11. package/dist/connectionStateHandler.js +24 -24
  12. package/dist/connectionStateHandler.js.map +1 -1
  13. package/dist/container.d.ts +8 -1
  14. package/dist/container.d.ts.map +1 -1
  15. package/dist/container.js +117 -98
  16. package/dist/container.js.map +1 -1
  17. package/dist/containerStorageAdapter.d.ts.map +1 -1
  18. package/dist/containerStorageAdapter.js +10 -9
  19. package/dist/containerStorageAdapter.js.map +1 -1
  20. package/dist/contracts.d.ts +2 -2
  21. package/dist/contracts.d.ts.map +1 -1
  22. package/dist/contracts.js.map +1 -1
  23. package/dist/debugLogger.js +2 -2
  24. package/dist/debugLogger.js.map +1 -1
  25. package/dist/deltaManager.d.ts +3 -4
  26. package/dist/deltaManager.d.ts.map +1 -1
  27. package/dist/deltaManager.js +39 -38
  28. package/dist/deltaManager.js.map +1 -1
  29. package/dist/deltaQueue.d.ts +1 -1
  30. package/dist/deltaQueue.d.ts.map +1 -1
  31. package/dist/deltaQueue.js +9 -8
  32. package/dist/deltaQueue.js.map +1 -1
  33. package/dist/disposal.d.ts +2 -2
  34. package/dist/disposal.d.ts.map +1 -1
  35. package/dist/disposal.js +1 -1
  36. package/dist/disposal.js.map +1 -1
  37. package/dist/error.d.ts +23 -0
  38. package/dist/error.d.ts.map +1 -0
  39. package/dist/error.js +32 -0
  40. package/dist/error.js.map +1 -0
  41. package/dist/loader.d.ts +9 -2
  42. package/dist/loader.d.ts.map +1 -1
  43. package/dist/loader.js +12 -7
  44. package/dist/loader.js.map +1 -1
  45. package/dist/noopHeuristic.d.ts +2 -2
  46. package/dist/noopHeuristic.d.ts.map +1 -1
  47. package/dist/noopHeuristic.js +6 -5
  48. package/dist/noopHeuristic.js.map +1 -1
  49. package/dist/packageVersion.d.ts +1 -1
  50. package/dist/packageVersion.js +1 -1
  51. package/dist/packageVersion.js.map +1 -1
  52. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  53. package/dist/retriableDocumentStorageService.js +4 -4
  54. package/dist/retriableDocumentStorageService.js.map +1 -1
  55. package/dist/utils.d.ts.map +1 -1
  56. package/dist/utils.js +9 -8
  57. package/dist/utils.js.map +1 -1
  58. package/lib/audience.js +1 -1
  59. package/lib/audience.js.map +1 -1
  60. package/lib/catchUpMonitor.js +1 -1
  61. package/lib/catchUpMonitor.js.map +1 -1
  62. package/lib/connectionManager.d.ts +1 -1
  63. package/lib/connectionManager.d.ts.map +1 -1
  64. package/lib/connectionManager.js +10 -9
  65. package/lib/connectionManager.js.map +1 -1
  66. package/lib/connectionStateHandler.js +1 -1
  67. package/lib/connectionStateHandler.js.map +1 -1
  68. package/lib/container.d.ts +8 -1
  69. package/lib/container.d.ts.map +1 -1
  70. package/lib/container.js +73 -54
  71. package/lib/container.js.map +1 -1
  72. package/lib/containerStorageAdapter.d.ts.map +1 -1
  73. package/lib/containerStorageAdapter.js +2 -1
  74. package/lib/containerStorageAdapter.js.map +1 -1
  75. package/lib/contracts.d.ts +2 -2
  76. package/lib/contracts.d.ts.map +1 -1
  77. package/lib/contracts.js.map +1 -1
  78. package/lib/debugLogger.js +1 -1
  79. package/lib/debugLogger.js.map +1 -1
  80. package/lib/deltaManager.d.ts +3 -4
  81. package/lib/deltaManager.d.ts.map +1 -1
  82. package/lib/deltaManager.js +6 -5
  83. package/lib/deltaManager.js.map +1 -1
  84. package/lib/deltaQueue.d.ts +1 -1
  85. package/lib/deltaQueue.d.ts.map +1 -1
  86. package/lib/deltaQueue.js +2 -1
  87. package/lib/deltaQueue.js.map +1 -1
  88. package/lib/disposal.d.ts +2 -2
  89. package/lib/disposal.d.ts.map +1 -1
  90. package/lib/disposal.js +1 -1
  91. package/lib/disposal.js.map +1 -1
  92. package/lib/error.d.ts +23 -0
  93. package/lib/error.d.ts.map +1 -0
  94. package/lib/error.js +28 -0
  95. package/lib/error.js.map +1 -0
  96. package/lib/loader.d.ts +9 -2
  97. package/lib/loader.d.ts.map +1 -1
  98. package/lib/loader.js +11 -6
  99. package/lib/loader.js.map +1 -1
  100. package/lib/noopHeuristic.d.ts +2 -2
  101. package/lib/noopHeuristic.d.ts.map +1 -1
  102. package/lib/noopHeuristic.js +2 -1
  103. package/lib/noopHeuristic.js.map +1 -1
  104. package/lib/packageVersion.d.ts +1 -1
  105. package/lib/packageVersion.js +1 -1
  106. package/lib/packageVersion.js.map +1 -1
  107. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  108. package/lib/retriableDocumentStorageService.js +2 -2
  109. package/lib/retriableDocumentStorageService.js.map +1 -1
  110. package/lib/utils.d.ts.map +1 -1
  111. package/lib/utils.js +4 -3
  112. package/lib/utils.js.map +1 -1
  113. package/package.json +21 -27
  114. package/src/audience.ts +1 -1
  115. package/src/catchUpMonitor.ts +1 -1
  116. package/src/connectionManager.ts +20 -10
  117. package/src/connectionStateHandler.ts +1 -1
  118. package/src/container.ts +120 -79
  119. package/src/containerStorageAdapter.ts +2 -1
  120. package/src/contracts.ts +1 -2
  121. package/src/debugLogger.ts +1 -1
  122. package/src/deltaManager.ts +16 -13
  123. package/src/deltaQueue.ts +2 -1
  124. package/src/disposal.ts +2 -2
  125. package/src/error.ts +44 -0
  126. package/src/loader.ts +30 -5
  127. package/src/noopHeuristic.ts +3 -2
  128. package/src/packageVersion.ts +1 -1
  129. package/src/retriableDocumentStorageService.ts +2 -4
  130. package/src/utils.ts +4 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @fluidframework/container-loader
2
2
 
3
+ ## 2.0.0-internal.6.3.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.0.0-internal.6.2.0
8
+
9
+ ### Minor Changes
10
+
11
+ - Temporarily restore id property on IContainerContext ([#16846](https://github.com/microsoft/FluidFramework/issues/16846)) [9825a692dd](https://github.com/microsoft/FluidFramework/commits/9825a692dd27eded214e3978a7fd6028b05e6fab)
12
+
13
+ The `id` property on `IContainerContext` has been temporarily restored to ease the transition to `2.0.0-internal.6.x`.
14
+ It will be removed again in `2.0.0-internal.7.0.0`.
15
+
16
+ The original deprecation announcement can be found [here](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.0.0-internal.5.2.0).
17
+
18
+ - Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
19
+
20
+ The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
21
+ imported from the **@fluidframework/core-interfaces** package:
22
+
23
+ - interface IDisposable
24
+ - interface IErrorEvent
25
+ - interface IErrorEvent
26
+ - interface IEvent
27
+ - interface IEventProvider
28
+ - interface ILoggingError
29
+ - interface ITaggedTelemetryPropertyType
30
+ - interface ITelemetryBaseEvent
31
+ - interface ITelemetryBaseLogger
32
+ - interface ITelemetryErrorEvent
33
+ - interface ITelemetryGenericEvent
34
+ - interface ITelemetryLogger
35
+ - interface ITelemetryPerformanceEvent
36
+ - interface ITelemetryProperties
37
+ - type ExtendEventProvider
38
+ - type IEventThisPlaceHolder
39
+ - type IEventTransformer
40
+ - type ReplaceIEventThisPlaceHolder
41
+ - type ReplaceIEventThisPlaceHolder
42
+ - type TelemetryEventCategory
43
+ - type TelemetryEventPropertyType
44
+
3
45
  ## 2.0.0-internal.6.1.0
4
46
 
5
47
  Dependency updates only.
package/README.md CHANGED
@@ -11,9 +11,10 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
11
11
  While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
12
12
  library consumers should always prefer `^`.
13
13
 
14
- Note that when depending on a library version of the form 2.0.0-internal.x.y.z, called the Fluid internal version
15
- scheme, you must use a `>= <` dependency range. Standard `^` and `~` ranges will not work as expected. See the
16
- [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
14
+ Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
15
+ you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
16
+ Standard `^` and `~` ranges will not work as expected.
17
+ See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
17
18
  package for more information including tools to convert between version schemes.
18
19
 
19
20
  <!-- prettier-ignore-end -->
package/dist/audience.js CHANGED
@@ -6,7 +6,7 @@ exports.Audience = void 0;
6
6
  * Licensed under the MIT License.
7
7
  */
8
8
  const events_1 = require("events");
9
- const common_utils_1 = require("@fluidframework/common-utils");
9
+ const core_utils_1 = require("@fluidframework/core-utils");
10
10
  /**
11
11
  * Audience represents all clients connected to the op stream.
12
12
  */
@@ -28,7 +28,7 @@ class Audience extends events_1.EventEmitter {
28
28
  // In such case we should see exactly same payload (IClient), and should not raise event twice!
29
29
  if (this.members.has(clientId)) {
30
30
  const client = this.members.get(clientId);
31
- (0, common_utils_1.assert)(JSON.stringify(client) === JSON.stringify(details), 0x4b2 /* new client has different payload from existing one */);
31
+ (0, core_utils_1.assert)(JSON.stringify(client) === JSON.stringify(details), 0x4b2 /* new client has different payload from existing one */);
32
32
  }
33
33
  else {
34
34
  this.members.set(clientId, details);
@@ -1 +1 @@
1
- {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAAsC;AACtC,+DAAsD;AAItD;;GA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AU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AA/DD,4BA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends EventEmitter implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic on(\n\t\tevent: \"addMember\" | \"removeMember\",\n\t\tlistener: (clientId: string, client: IClient) => void,\n\t): this;\n\tpublic on(event: string, listener: (...args: any[]) => void): this {\n\t\treturn super.on(event, listener);\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../src/audience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAAsC;AACtC,2DAAoD;AAIpD;;GAEG;AACH,MAAa,QAAS,SAAQ,qBAAY;IAGzC;QACC,KAAK,EAAE,CAAC;QAHQ,YAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;QAIrD,kHAAkH;QAClH,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAMM,EAAE,CAAC,KAAa,EAAE,QAAkC;QAC1D,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB,EAAE,OAAgB;QAClD,mGAAmG;QACnG,+FAA+F;QAC/F,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC1C,IAAA,mBAAM,EACL,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAClD,KAAK,CAAC,wDAAwD,CAC9D,CAAC;SACF;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC1C;IACF,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,QAAgB;QACnC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,aAAa,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC;SACZ;aAAM;YACN,OAAO,KAAK,CAAC;SACb;IACF,CAAC;IAED;;OAEG;IACI,UAAU;QAChB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACD;AA/DD,4BA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Audience represents all clients connected to the op stream.\n */\nexport class Audience extends EventEmitter implements IAudienceOwner {\n\tprivate readonly members = new Map<string, IClient>();\n\n\tconstructor() {\n\t\tsuper();\n\t\t// We are expecting this class to have many listeners, so we suppress noisy \"MaxListenersExceededWarning\" logging.\n\t\tsuper.setMaxListeners(0);\n\t}\n\n\tpublic on(\n\t\tevent: \"addMember\" | \"removeMember\",\n\t\tlistener: (clientId: string, client: IClient) => void,\n\t): this;\n\tpublic on(event: string, listener: (...args: any[]) => void): this {\n\t\treturn super.on(event, listener);\n\t}\n\n\t/**\n\t * Adds a new client to the audience\n\t */\n\tpublic addMember(clientId: string, details: IClient) {\n\t\t// Given that signal delivery is unreliable process, we might observe same client being added twice\n\t\t// In such case we should see exactly same payload (IClient), and should not raise event twice!\n\t\tif (this.members.has(clientId)) {\n\t\t\tconst client = this.members.get(clientId);\n\t\t\tassert(\n\t\t\t\tJSON.stringify(client) === JSON.stringify(details),\n\t\t\t\t0x4b2 /* new client has different payload from existing one */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.members.set(clientId, details);\n\t\t\tthis.emit(\"addMember\", clientId, details);\n\t\t}\n\t}\n\n\t/**\n\t * Removes a client from the audience. Only emits an event if a client is actually removed\n\t * @returns if a client was removed from the audience\n\t */\n\tpublic removeMember(clientId: string): boolean {\n\t\tconst removedClient = this.members.get(clientId);\n\t\tif (removedClient !== undefined) {\n\t\t\tthis.members.delete(clientId);\n\t\t\tthis.emit(\"removeMember\", clientId, removedClient);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all the members in the audience\n\t */\n\tpublic getMembers(): Map<string, IClient> {\n\t\treturn new Map(this.members);\n\t}\n\n\t/**\n\t * Retrieves a specific member of the audience\n\t */\n\tpublic getMember(clientId: string): IClient | undefined {\n\t\treturn this.members.get(clientId);\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.CatchUpMonitor = void 0;
8
- const common_utils_1 = require("@fluidframework/common-utils");
8
+ const core_utils_1 = require("@fluidframework/core-utils");
9
9
  /**
10
10
  * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed
11
11
  * that were known at the time the monitor was created.
@@ -26,7 +26,7 @@ class CatchUpMonitor {
26
26
  };
27
27
  this.disposed = false;
28
28
  this.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;
29
- (0, common_utils_1.assert)(this.targetSeqNumber >= this.deltaManager.lastSequenceNumber, 0x37c /* Cannot wait for seqNumber below last processed sequence number */);
29
+ (0, core_utils_1.assert)(this.targetSeqNumber >= this.deltaManager.lastSequenceNumber, 0x37c /* Cannot wait for seqNumber below last processed sequence number */);
30
30
  this.deltaManager.on("op", this.opHandler);
31
31
  // Simulate the last processed op to set caughtUp in case we already are
32
32
  this.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });
@@ -1 +1 @@
1
- {"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsD;AAUtD;;;GAGG;AACH,MAAa,cAAc;IAW1B;;OAEG;IACH,YACkB,YAAqC,EACrC,QAA0B;QAD1B,iBAAY,GAAZ,YAAY,CAAyB;QACrC,aAAQ,GAAR,QAAQ,CAAkB;QAdpC,aAAQ,GAAY,KAAK,CAAC;QAEjB,cAAS,GAAG,CAAC,OAA0D,EAAE,EAAE;YAC3F,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE;gBACrE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,IAAI,CAAC,QAAQ,EAAE,CAAC;aAChB;QACF,CAAC,CAAC;QAsBK,aAAQ,GAAY,KAAK,CAAC;QAbhC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAE5D,IAAA,qBAAM,EACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAC5D,KAAK,CAAC,oEAAoE,CAC1E,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3C,wEAAwE;QACxE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC1E,CAAC;IAGM,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AAxCD,wCAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/** @see CatchUpMonitor for usage */\ntype CaughtUpListener = () => void;\n\n/** Monitor that emits an event when a Container has caught up to a given point in the op stream */\nexport type ICatchUpMonitor = IDisposable;\n\n/**\n * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed\n * that were known at the time the monitor was created.\n */\nexport class CatchUpMonitor implements ICatchUpMonitor {\n\tprivate readonly targetSeqNumber: number;\n\tprivate caughtUp: boolean = false;\n\n\tprivate readonly opHandler = (message: Pick<ISequencedDocumentMessage, \"sequenceNumber\">) => {\n\t\tif (!this.caughtUp && message.sequenceNumber >= this.targetSeqNumber) {\n\t\t\tthis.caughtUp = true;\n\t\t\tthis.listener();\n\t\t}\n\t};\n\n\t/**\n\t * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.\n\t */\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<any, any>,\n\t\tprivate readonly listener: CaughtUpListener,\n\t) {\n\t\tthis.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\n\t\tassert(\n\t\t\tthis.targetSeqNumber >= this.deltaManager.lastSequenceNumber,\n\t\t\t0x37c /* Cannot wait for seqNumber below last processed sequence number */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"op\", this.opHandler);\n\n\t\t// Simulate the last processed op to set caughtUp in case we already are\n\t\tthis.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });\n\t}\n\n\tpublic disposed: boolean = false;\n\tpublic dispose() {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.disposed = true;\n\n\t\tthis.deltaManager.off(\"op\", this.opHandler);\n\t}\n}\n"]}
1
+ {"version":3,"file":"catchUpMonitor.js","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2DAAoD;AAUpD;;;GAGG;AACH,MAAa,cAAc;IAW1B;;OAEG;IACH,YACkB,YAAqC,EACrC,QAA0B;QAD1B,iBAAY,GAAZ,YAAY,CAAyB;QACrC,aAAQ,GAAR,QAAQ,CAAkB;QAdpC,aAAQ,GAAY,KAAK,CAAC;QAEjB,cAAS,GAAG,CAAC,OAA0D,EAAE,EAAE;YAC3F,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE;gBACrE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,IAAI,CAAC,QAAQ,EAAE,CAAC;aAChB;QACF,CAAC,CAAC;QAsBK,aAAQ,GAAY,KAAK,CAAC;QAbhC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAE5D,IAAA,mBAAM,EACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAC5D,KAAK,CAAC,oEAAoE,CAC1E,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3C,wEAAwE;QACxE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC1E,CAAC;IAGM,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACP;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AAxCD,wCAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/** @see CatchUpMonitor for usage */\ntype CaughtUpListener = () => void;\n\n/** Monitor that emits an event when a Container has caught up to a given point in the op stream */\nexport type ICatchUpMonitor = IDisposable;\n\n/**\n * Monitors a Container's DeltaManager, notifying listeners when all ops have been processed\n * that were known at the time the monitor was created.\n */\nexport class CatchUpMonitor implements ICatchUpMonitor {\n\tprivate readonly targetSeqNumber: number;\n\tprivate caughtUp: boolean = false;\n\n\tprivate readonly opHandler = (message: Pick<ISequencedDocumentMessage, \"sequenceNumber\">) => {\n\t\tif (!this.caughtUp && message.sequenceNumber >= this.targetSeqNumber) {\n\t\t\tthis.caughtUp = true;\n\t\t\tthis.listener();\n\t\t}\n\t};\n\n\t/**\n\t * Create the CatchUpMonitor, setting the target sequence number to wait for based on DeltaManager's current state.\n\t */\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<any, any>,\n\t\tprivate readonly listener: CaughtUpListener,\n\t) {\n\t\tthis.targetSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\n\t\tassert(\n\t\t\tthis.targetSeqNumber >= this.deltaManager.lastSequenceNumber,\n\t\t\t0x37c /* Cannot wait for seqNumber below last processed sequence number */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"op\", this.opHandler);\n\n\t\t// Simulate the last processed op to set caughtUp in case we already are\n\t\tthis.opHandler({ sequenceNumber: this.deltaManager.lastSequenceNumber });\n\t}\n\n\tpublic disposed: boolean = false;\n\tpublic dispose() {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.disposed = true;\n\n\t\tthis.deltaManager.off(\"op\", this.opHandler);\n\t}\n}\n"]}
@@ -16,7 +16,7 @@ import { ReconnectMode, IConnectionManager, IConnectionManagerFactoryArgs, IConn
16
16
  export declare class ConnectionManager implements IConnectionManager {
17
17
  private readonly serviceProvider;
18
18
  readonly containerDirty: () => boolean;
19
- private client;
19
+ private readonly client;
20
20
  private readonly logger;
21
21
  private readonly props;
22
22
  /** Connection mode used when reconnecting on error or disconnect. */
@@ -1 +1 @@
1
- {"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEpF,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAGhB,MAAM,oCAAoC,CAAC;AAU5C,OAAO,EACN,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAGhB,yBAAyB,EAOzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAA8B,MAAM,iCAAiC,CAAC;AAClG,OAAO,EACN,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAE7B,4BAA4B,EAC5B,MAAM,aAAa,CAAC;AAwHrB;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAoL1D,OAAO,CAAC,QAAQ,CAAC,eAAe;aAChB,cAAc,EAAE,MAAM,OAAO;IAC7C,OAAO,CAAC,MAAM;IAEd,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAxLvB,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAiB;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;;;;;;;;;;;;;;OAgBG;IACI,aAAa,CAAC,QAAQ,EAAE,OAAO;IAoCtC,OAAO,CAAC,uBAAuB;IAUxB,OAAO,CAAC,MAAM,EAAE,4BAA4B,EAAE,cAAc,CAAC,EAAE,cAAc;YAOtE,WAAW;IA8KzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IActB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAwCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAgJpC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;;;OAMG;YACW,SAAS;IA8DhB,oBAAoB,CAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,GACrD,gBAAgB,GAAG,SAAS;IAuCxB,YAAY,CAAC,OAAO,EAAE,GAAG;IAQzB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE;IA+BzC,0BAA0B,CAAC,OAAO,EAAE,yBAAyB;IAgDpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;IAGF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAkB1B;IAGF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAIxC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;CACF"}
@@ -5,8 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ConnectionManager = void 0;
8
- const common_utils_1 = require("@fluidframework/common-utils");
9
- const container_utils_1 = require("@fluidframework/container-utils");
8
+ const core_utils_1 = require("@fluidframework/core-utils");
9
+ const client_utils_1 = require("@fluid-internal/client-utils");
10
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
11
11
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
12
12
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
@@ -35,7 +35,7 @@ const clientNoDeltaStream = {
35
35
  scopes: [],
36
36
  };
37
37
  const clientIdNoDeltaStream = "storage-only client";
38
- class NoDeltaStream extends common_utils_1.TypedEventEmitter {
38
+ class NoDeltaStream extends client_utils_1.TypedEventEmitter {
39
39
  constructor(storageOnlyReason) {
40
40
  super();
41
41
  this.storageOnlyReason = storageOnlyReason;
@@ -287,13 +287,14 @@ class ConnectionManager {
287
287
  text: "Closing DeltaManager",
288
288
  error,
289
289
  };
290
+ const oldReadonlyValue = this.readonly;
290
291
  // This raises "disconnect" event if we have active connection.
291
292
  this.disconnectFromDeltaStream(disconnectReason);
292
293
  if (switchToReadonly) {
293
294
  // Notify everyone we are in read-only state.
294
295
  // Useful for data stores in case we hit some critical error,
295
296
  // to switch to a mode where user edits are not accepted
296
- this.set_readonlyPermissions(true);
297
+ this.set_readonlyPermissions(true, oldReadonlyValue);
297
298
  }
298
299
  }
299
300
  /**
@@ -301,7 +302,7 @@ class ConnectionManager {
301
302
  * Will throw an error if reconnectMode set to Never.
302
303
  */
303
304
  setAutoReconnect(mode, reason) {
304
- (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" */);
305
+ (0, core_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" */);
305
306
  this._reconnectMode = mode;
306
307
  if (mode !== contracts_1.ReconnectMode.Enabled) {
307
308
  // immediately disconnect - do not rely on service eventually dropping connection.
@@ -336,7 +337,7 @@ class ConnectionManager {
336
337
  this._forceReadonly = readonly;
337
338
  if (oldValue !== this.readonly) {
338
339
  if (this._reconnectMode === contracts_1.ReconnectMode.Never) {
339
- throw new container_utils_1.UsageError("API is not supported for non-connecting or closed container");
340
+ throw new telemetry_utils_1.UsageError("API is not supported for non-connecting or closed container");
340
341
  }
341
342
  let reconnect = false;
342
343
  if (this.readonly === true) {
@@ -357,10 +358,9 @@ class ConnectionManager {
357
358
  }
358
359
  }
359
360
  }
360
- set_readonlyPermissions(readonly) {
361
- const oldValue = this.readonly;
362
- this._readonlyPermissions = readonly;
363
- if (oldValue !== this.readonly) {
361
+ set_readonlyPermissions(newReadonlyValue, oldReadonlyValue) {
362
+ this._readonlyPermissions = newReadonlyValue;
363
+ if (oldReadonlyValue !== this.readonly) {
364
364
  this.props.readonlyChangeHandler(this.readonly);
365
365
  }
366
366
  }
@@ -371,7 +371,7 @@ class ConnectionManager {
371
371
  });
372
372
  }
373
373
  async connectCore(reason, connectionMode) {
374
- (0, common_utils_1.assert)(!this._disposed, 0x26a /* "not closed" */);
374
+ (0, core_utils_1.assert)(!this._disposed, 0x26a /* "not closed" */);
375
375
  if (this.connection !== undefined) {
376
376
  return; // Connection attempt already completed successfully
377
377
  }
@@ -379,7 +379,7 @@ class ConnectionManager {
379
379
  if (this.pendingConnection !== undefined) {
380
380
  pendingConnectionMode = this.pendingConnection.connectionMode;
381
381
  this.cancelConnection(reason); // Throw out in-progress connection attempt in favor of new attempt
382
- (0, common_utils_1.assert)(this.pendingConnection === undefined, 0x344 /* this.pendingConnection should be undefined */);
382
+ (0, core_utils_1.assert)(this.pendingConnection === undefined, 0x344 /* this.pendingConnection should be undefined */);
383
383
  }
384
384
  // If there is no specified ConnectionMode, try the previous mode, if there is no previous mode use default
385
385
  let requestedMode = connectionMode ?? pendingConnectionMode ?? this.defaultReconnectionMode;
@@ -392,17 +392,17 @@ class ConnectionManager {
392
392
  requestedMode = "write";
393
393
  }
394
394
  const docService = this.serviceProvider();
395
- (0, common_utils_1.assert)(docService !== undefined, 0x2a7 /* "Container is not attached" */);
395
+ (0, core_utils_1.assert)(docService !== undefined, 0x2a7 /* "Container is not attached" */);
396
396
  let connection;
397
397
  if (docService.policies?.storageOnly === true) {
398
398
  connection = new NoDeltaStream();
399
399
  this.setupNewSuccessfulConnection(connection, "read", reason);
400
- (0, common_utils_1.assert)(this.pendingConnection === undefined, 0x2b3 /* "logic error" */);
400
+ (0, core_utils_1.assert)(this.pendingConnection === undefined, 0x2b3 /* "logic error" */);
401
401
  return;
402
402
  }
403
403
  let delayMs = InitialReconnectDelayInMs;
404
404
  let connectRepeatCount = 0;
405
- const connectStartTime = common_utils_1.performance.now();
405
+ const connectStartTime = client_utils_1.performance.now();
406
406
  let lastError;
407
407
  const abortController = new AbortController();
408
408
  const abortSignal = abortController.signal;
@@ -422,7 +422,7 @@ class ConnectionManager {
422
422
  this.logger.sendTelemetryEvent({
423
423
  eventName: "ConnectionAttemptCancelled",
424
424
  attempts: connectRepeatCount,
425
- duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
425
+ duration: (0, telemetry_utils_1.formatTick)(client_utils_1.performance.now() - connectStartTime),
426
426
  connectionEstablished: false,
427
427
  });
428
428
  return;
@@ -457,10 +457,10 @@ class ConnectionManager {
457
457
  attempts: connectRepeatCount,
458
458
  delay: delayMs,
459
459
  eventName: "DeltaConnectionFailureToConnect",
460
- duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
460
+ duration: (0, telemetry_utils_1.formatTick)(client_utils_1.performance.now() - connectStartTime),
461
461
  }, origError);
462
462
  lastError = origError;
463
- const waitStartTime = common_utils_1.performance.now();
463
+ const waitStartTime = client_utils_1.performance.now();
464
464
  const retryDelayFromError = (0, driver_utils_1.getRetryDelayFromError)(origError);
465
465
  if (retryDelayFromError !== undefined) {
466
466
  // If the error told us to wait, then we wait.
@@ -483,7 +483,7 @@ class ConnectionManager {
483
483
  await waitForOnline();
484
484
  this.logger.sendPerformanceEvent({
485
485
  eventName: "WaitBetweenConnectionAttempts",
486
- duration: common_utils_1.performance.now() - waitStartTime,
486
+ duration: client_utils_1.performance.now() - waitStartTime,
487
487
  details: JSON.stringify({
488
488
  retryDelayFromError,
489
489
  delayMs,
@@ -496,7 +496,7 @@ class ConnectionManager {
496
496
  (0, driver_utils_1.logNetworkFailure)(this.logger, {
497
497
  eventName: "MultipleDeltaConnectionFailures",
498
498
  attempts: connectRepeatCount,
499
- duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
499
+ duration: (0, telemetry_utils_1.formatTick)(client_utils_1.performance.now() - connectStartTime),
500
500
  }, lastError);
501
501
  }
502
502
  // Check for abort signal after while loop as well
@@ -505,7 +505,7 @@ class ConnectionManager {
505
505
  this.logger.sendTelemetryEvent({
506
506
  eventName: "ConnectionAttemptCancelled",
507
507
  attempts: connectRepeatCount,
508
- duration: (0, telemetry_utils_1.formatTick)(common_utils_1.performance.now() - connectStartTime),
508
+ duration: (0, telemetry_utils_1.formatTick)(client_utils_1.performance.now() - connectStartTime),
509
509
  connectionEstablished: true,
510
510
  });
511
511
  return;
@@ -544,7 +544,7 @@ class ConnectionManager {
544
544
  }
545
545
  return false;
546
546
  }
547
- (0, common_utils_1.assert)(this.pendingConnection === undefined, 0x27b /* "reentrancy may result in incorrect behavior" */);
547
+ (0, core_utils_1.assert)(this.pendingConnection === undefined, 0x27b /* "reentrancy may result in incorrect behavior" */);
548
548
  const connection = this.connection;
549
549
  // Avoid any re-entrancy - clear object reference
550
550
  this.connection = undefined;
@@ -567,7 +567,7 @@ class ConnectionManager {
567
567
  * Cancel in-progress connection attempt.
568
568
  */
569
569
  cancelConnection(reason) {
570
- (0, common_utils_1.assert)(this.pendingConnection !== undefined, 0x345 /* this.pendingConnection is undefined when trying to cancel */);
570
+ (0, core_utils_1.assert)(this.pendingConnection !== undefined, 0x345 /* this.pendingConnection is undefined when trying to cancel */);
571
571
  this.pendingConnection.abort();
572
572
  this.pendingConnection = undefined;
573
573
  this.logger.sendTelemetryEvent({ eventName: "ConnectionCancelReceived" });
@@ -583,9 +583,10 @@ class ConnectionManager {
583
583
  */
584
584
  setupNewSuccessfulConnection(connection, requestedMode, reason) {
585
585
  // Old connection should have been cleaned up before establishing a new one
586
- (0, common_utils_1.assert)(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
587
- (0, common_utils_1.assert)(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
586
+ (0, core_utils_1.assert)(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */);
587
+ (0, core_utils_1.assert)(!connection.disposed, 0x28a /* "can't be disposed - Callers need to ensure that!" */);
588
588
  this.pendingConnection = undefined;
589
+ const oldReadonlyValue = this.readonly;
589
590
  this.connection = connection;
590
591
  // Does information in scopes & mode matches?
591
592
  // If we asked for "write" and got "read", then file is read-only
@@ -600,9 +601,9 @@ class ConnectionManager {
600
601
  }
601
602
  // This connection mode validation logic is moving to the driver layer in 0.44. These two asserts can be
602
603
  // removed after those packages have released and become ubiquitous.
603
- (0, common_utils_1.assert)(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
604
- (0, common_utils_1.assert)(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
605
- this.set_readonlyPermissions(readonly);
604
+ (0, core_utils_1.assert)(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
605
+ (0, core_utils_1.assert)(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
606
+ this.set_readonlyPermissions(readonly, oldReadonlyValue);
606
607
  if (this._disposed) {
607
608
  // Raise proper events, Log telemetry event and close connection.
608
609
  this.disconnectFromDeltaStream({ text: "ConnectionManager already closed" });
@@ -703,7 +704,7 @@ class ConnectionManager {
703
704
  // We quite often get protocol errors before / after observing nack/disconnect
704
705
  // we do not want to run through same sequence twice.
705
706
  // If we're already disconnected/disconnecting it's not appropriate to call this again.
706
- (0, common_utils_1.assert)(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */);
707
+ (0, core_utils_1.assert)(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */);
707
708
  this.disconnectFromDeltaStream(reason);
708
709
  // We will always trigger reconnect, even if canRetry is false.
709
710
  // Any truly fatal error state will result in container close upon attempted reconnect,
@@ -745,8 +746,8 @@ class ConnectionManager {
745
746
  }
746
747
  prepareMessageToSend(message) {
747
748
  if (this.readonly === true) {
748
- (0, common_utils_1.assert)(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
749
- const error = new container_utils_1.GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
749
+ (0, core_utils_1.assert)(this.readOnlyInfo.readonly === true, 0x1f0 /* "Unexpected mismatch in readonly" */);
750
+ const error = new telemetry_utils_1.GenericError("deltaManagerReadonlySubmit", undefined /* error */, {
750
751
  readonly: this.readOnlyInfo.readonly,
751
752
  forcedReadonly: this.readOnlyInfo.forced,
752
753
  readonlyPermissions: this.readOnlyInfo.permissions,
@@ -759,7 +760,7 @@ class ConnectionManager {
759
760
  // reset clientSequenceNumber if we are using new clientId.
760
761
  // we keep info about old connection as long as possible to be able to account for all non-acked ops
761
762
  // that we pick up on next connection.
762
- (0, common_utils_1.assert)(!!this.connection, 0x0e4 /* "Lost old connection!" */);
763
+ (0, core_utils_1.assert)(!!this.connection, 0x0e4 /* "Lost old connection!" */);
763
764
  if (this.lastSubmittedClientId !== this.connection?.clientId) {
764
765
  this.lastSubmittedClientId = this.connection?.clientId;
765
766
  this.clientSequenceNumber = 0;
@@ -785,7 +786,7 @@ class ConnectionManager {
785
786
  }
786
787
  }
787
788
  sendMessages(messages) {
788
- (0, common_utils_1.assert)(this.connected, 0x2b4 /* "not connected on sending ops!" */);
789
+ (0, core_utils_1.assert)(this.connected, 0x2b4 /* "not connected on sending ops!" */);
789
790
  // If connection is "read" or implicit "read" (got leave op for "write" connection),
790
791
  // then op can't make it through - we will get a nack if op is sent.
791
792
  // We can short-circuit this process.
@@ -807,17 +808,17 @@ class ConnectionManager {
807
808
  }
808
809
  return;
809
810
  }
810
- (0, common_utils_1.assert)(!this.pendingReconnect, 0x2b5 /* "logic error" */);
811
+ (0, core_utils_1.assert)(!this.pendingReconnect, 0x2b5 /* "logic error" */);
811
812
  this._outbound.push(messages);
812
813
  }
813
814
  beforeProcessingIncomingOp(message) {
814
815
  // if we have connection, and message is local, then we better treat is as local!
815
- (0, common_utils_1.assert)(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, 0x0ee /* "Not accounting local messages correctly" */);
816
+ (0, core_utils_1.assert)(this.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, 0x0ee /* "Not accounting local messages correctly" */);
816
817
  if (this.lastSubmittedClientId !== undefined &&
817
818
  this.lastSubmittedClientId === message.clientId) {
818
819
  const clientSequenceNumber = message.clientSequenceNumber;
819
- (0, common_utils_1.assert)(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */);
820
- (0, common_utils_1.assert)(clientSequenceNumber <= this.clientSequenceNumber, 0x0f0 /* "Incoming local client seq# > generated by this client" */);
820
+ (0, core_utils_1.assert)(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */);
821
+ (0, core_utils_1.assert)(clientSequenceNumber <= this.clientSequenceNumber, 0x0f0 /* "Incoming local client seq# > generated by this client" */);
821
822
  this.clientSequenceNumberObserved = clientSequenceNumber;
822
823
  }
823
824
  if (message.type === protocol_definitions_1.MessageType.ClientLeave) {