@fluidframework/container-loader 2.1.0-274160 → 2.1.0-276985

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 (225) hide show
  1. package/.eslintrc.cjs +2 -5
  2. package/README.md +3 -1
  3. package/dist/attachment.d.ts +2 -1
  4. package/dist/attachment.d.ts.map +1 -1
  5. package/dist/attachment.js.map +1 -1
  6. package/dist/audience.d.ts.map +1 -1
  7. package/dist/audience.js +4 -4
  8. package/dist/audience.js.map +1 -1
  9. package/dist/catchUpMonitor.d.ts +15 -4
  10. package/dist/catchUpMonitor.d.ts.map +1 -1
  11. package/dist/catchUpMonitor.js +12 -3
  12. package/dist/catchUpMonitor.js.map +1 -1
  13. package/dist/connectionManager.d.ts +24 -8
  14. package/dist/connectionManager.d.ts.map +1 -1
  15. package/dist/connectionManager.js +36 -23
  16. package/dist/connectionManager.js.map +1 -1
  17. package/dist/connectionStateHandler.d.ts +30 -20
  18. package/dist/connectionStateHandler.d.ts.map +1 -1
  19. package/dist/connectionStateHandler.js +15 -11
  20. package/dist/connectionStateHandler.js.map +1 -1
  21. package/dist/container.d.ts +7 -2
  22. package/dist/container.d.ts.map +1 -1
  23. package/dist/container.js +53 -32
  24. package/dist/container.js.map +1 -1
  25. package/dist/containerContext.d.ts +8 -4
  26. package/dist/containerContext.d.ts.map +1 -1
  27. package/dist/containerContext.js +3 -1
  28. package/dist/containerContext.js.map +1 -1
  29. package/dist/containerStorageAdapter.d.ts +1 -1
  30. package/dist/containerStorageAdapter.d.ts.map +1 -1
  31. package/dist/containerStorageAdapter.js +12 -6
  32. package/dist/containerStorageAdapter.js.map +1 -1
  33. package/dist/contracts.d.ts +17 -8
  34. package/dist/contracts.d.ts.map +1 -1
  35. package/dist/contracts.js +4 -2
  36. package/dist/contracts.js.map +1 -1
  37. package/dist/debugLogger.js +3 -3
  38. package/dist/debugLogger.js.map +1 -1
  39. package/dist/deltaManager.d.ts +13 -9
  40. package/dist/deltaManager.d.ts.map +1 -1
  41. package/dist/deltaManager.js +32 -23
  42. package/dist/deltaManager.js.map +1 -1
  43. package/dist/deltaQueue.d.ts +1 -4
  44. package/dist/deltaQueue.d.ts.map +1 -1
  45. package/dist/deltaQueue.js +2 -2
  46. package/dist/deltaQueue.js.map +1 -1
  47. package/dist/disposal.d.ts +1 -1
  48. package/dist/disposal.d.ts.map +1 -1
  49. package/dist/disposal.js.map +1 -1
  50. package/dist/error.d.ts.map +1 -1
  51. package/dist/error.js.map +1 -1
  52. package/dist/legacy.d.ts +1 -1
  53. package/dist/loadPaused.d.ts +2 -2
  54. package/dist/loadPaused.d.ts.map +1 -1
  55. package/dist/loadPaused.js +7 -3
  56. package/dist/loadPaused.js.map +1 -1
  57. package/dist/loader.d.ts +10 -1
  58. package/dist/loader.d.ts.map +1 -1
  59. package/dist/loader.js +11 -1
  60. package/dist/loader.js.map +1 -1
  61. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
  62. package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  63. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
  64. package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  65. package/dist/memoryBlobStorage.d.ts +2 -2
  66. package/dist/memoryBlobStorage.d.ts.map +1 -1
  67. package/dist/memoryBlobStorage.js +7 -3
  68. package/dist/memoryBlobStorage.js.map +1 -1
  69. package/dist/noopHeuristic.js +1 -1
  70. package/dist/noopHeuristic.js.map +1 -1
  71. package/dist/packageVersion.d.ts +1 -1
  72. package/dist/packageVersion.js +1 -1
  73. package/dist/packageVersion.js.map +1 -1
  74. package/dist/protocol/protocol.d.ts +4 -3
  75. package/dist/protocol/protocol.d.ts.map +1 -1
  76. package/dist/protocol/protocol.js +6 -5
  77. package/dist/protocol/protocol.js.map +1 -1
  78. package/dist/protocol/quorum.d.ts +11 -8
  79. package/dist/protocol/quorum.d.ts.map +1 -1
  80. package/dist/protocol/quorum.js +8 -8
  81. package/dist/protocol/quorum.js.map +1 -1
  82. package/dist/protocol.d.ts +2 -0
  83. package/dist/protocol.d.ts.map +1 -1
  84. package/dist/protocol.js +7 -2
  85. package/dist/protocol.js.map +1 -1
  86. package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
  87. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  88. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  89. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  90. package/dist/retriableDocumentStorageService.js +4 -1
  91. package/dist/retriableDocumentStorageService.js.map +1 -1
  92. package/dist/serializedStateManager.d.ts +29 -12
  93. package/dist/serializedStateManager.d.ts.map +1 -1
  94. package/dist/serializedStateManager.js +55 -24
  95. package/dist/serializedStateManager.js.map +1 -1
  96. package/dist/utils.d.ts +4 -2
  97. package/dist/utils.d.ts.map +1 -1
  98. package/dist/utils.js +15 -6
  99. package/dist/utils.js.map +1 -1
  100. package/lib/attachment.d.ts +2 -1
  101. package/lib/attachment.d.ts.map +1 -1
  102. package/lib/attachment.js.map +1 -1
  103. package/lib/audience.d.ts.map +1 -1
  104. package/lib/audience.js +4 -4
  105. package/lib/audience.js.map +1 -1
  106. package/lib/catchUpMonitor.d.ts +15 -4
  107. package/lib/catchUpMonitor.d.ts.map +1 -1
  108. package/lib/catchUpMonitor.js +12 -3
  109. package/lib/catchUpMonitor.js.map +1 -1
  110. package/lib/connectionManager.d.ts +24 -8
  111. package/lib/connectionManager.d.ts.map +1 -1
  112. package/lib/connectionManager.js +36 -23
  113. package/lib/connectionManager.js.map +1 -1
  114. package/lib/connectionStateHandler.d.ts +30 -20
  115. package/lib/connectionStateHandler.d.ts.map +1 -1
  116. package/lib/connectionStateHandler.js +14 -12
  117. package/lib/connectionStateHandler.js.map +1 -1
  118. package/lib/container.d.ts +7 -2
  119. package/lib/container.d.ts.map +1 -1
  120. package/lib/container.js +53 -32
  121. package/lib/container.js.map +1 -1
  122. package/lib/containerContext.d.ts +8 -4
  123. package/lib/containerContext.d.ts.map +1 -1
  124. package/lib/containerContext.js +3 -1
  125. package/lib/containerContext.js.map +1 -1
  126. package/lib/containerStorageAdapter.d.ts +1 -1
  127. package/lib/containerStorageAdapter.d.ts.map +1 -1
  128. package/lib/containerStorageAdapter.js +12 -6
  129. package/lib/containerStorageAdapter.js.map +1 -1
  130. package/lib/contracts.d.ts +17 -8
  131. package/lib/contracts.d.ts.map +1 -1
  132. package/lib/contracts.js +4 -2
  133. package/lib/contracts.js.map +1 -1
  134. package/lib/debugLogger.js +3 -3
  135. package/lib/debugLogger.js.map +1 -1
  136. package/lib/deltaManager.d.ts +13 -9
  137. package/lib/deltaManager.d.ts.map +1 -1
  138. package/lib/deltaManager.js +32 -23
  139. package/lib/deltaManager.js.map +1 -1
  140. package/lib/deltaQueue.d.ts +1 -4
  141. package/lib/deltaQueue.d.ts.map +1 -1
  142. package/lib/deltaQueue.js +2 -2
  143. package/lib/deltaQueue.js.map +1 -1
  144. package/lib/disposal.d.ts +1 -1
  145. package/lib/disposal.d.ts.map +1 -1
  146. package/lib/disposal.js.map +1 -1
  147. package/lib/error.d.ts.map +1 -1
  148. package/lib/error.js.map +1 -1
  149. package/lib/legacy.d.ts +1 -1
  150. package/lib/loadPaused.d.ts +2 -2
  151. package/lib/loadPaused.d.ts.map +1 -1
  152. package/lib/loadPaused.js +8 -4
  153. package/lib/loadPaused.js.map +1 -1
  154. package/lib/loader.d.ts +10 -1
  155. package/lib/loader.d.ts.map +1 -1
  156. package/lib/loader.js +11 -1
  157. package/lib/loader.js.map +1 -1
  158. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +2 -1
  159. package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
  160. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +3 -1
  161. package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
  162. package/lib/memoryBlobStorage.d.ts +2 -2
  163. package/lib/memoryBlobStorage.d.ts.map +1 -1
  164. package/lib/memoryBlobStorage.js +7 -3
  165. package/lib/memoryBlobStorage.js.map +1 -1
  166. package/lib/noopHeuristic.js +1 -1
  167. package/lib/noopHeuristic.js.map +1 -1
  168. package/lib/packageVersion.d.ts +1 -1
  169. package/lib/packageVersion.js +1 -1
  170. package/lib/packageVersion.js.map +1 -1
  171. package/lib/protocol/protocol.d.ts +4 -3
  172. package/lib/protocol/protocol.d.ts.map +1 -1
  173. package/lib/protocol/protocol.js +6 -5
  174. package/lib/protocol/protocol.js.map +1 -1
  175. package/lib/protocol/quorum.d.ts +11 -8
  176. package/lib/protocol/quorum.d.ts.map +1 -1
  177. package/lib/protocol/quorum.js +8 -8
  178. package/lib/protocol/quorum.js.map +1 -1
  179. package/lib/protocol.d.ts +2 -0
  180. package/lib/protocol.d.ts.map +1 -1
  181. package/lib/protocol.js +7 -2
  182. package/lib/protocol.js.map +1 -1
  183. package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
  184. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  185. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  186. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  187. package/lib/retriableDocumentStorageService.js +4 -1
  188. package/lib/retriableDocumentStorageService.js.map +1 -1
  189. package/lib/serializedStateManager.d.ts +29 -12
  190. package/lib/serializedStateManager.d.ts.map +1 -1
  191. package/lib/serializedStateManager.js +56 -25
  192. package/lib/serializedStateManager.js.map +1 -1
  193. package/lib/utils.d.ts +4 -2
  194. package/lib/utils.d.ts.map +1 -1
  195. package/lib/utils.js +16 -7
  196. package/lib/utils.js.map +1 -1
  197. package/package.json +13 -13
  198. package/src/attachment.ts +2 -1
  199. package/src/audience.ts +4 -4
  200. package/src/catchUpMonitor.ts +23 -8
  201. package/src/connectionManager.ts +85 -60
  202. package/src/connectionStateHandler.ts +85 -63
  203. package/src/container.ts +129 -89
  204. package/src/containerContext.ts +5 -3
  205. package/src/containerStorageAdapter.ts +20 -13
  206. package/src/contracts.ts +21 -9
  207. package/src/debugLogger.ts +4 -4
  208. package/src/deltaManager.ts +75 -56
  209. package/src/deltaQueue.ts +16 -10
  210. package/src/disposal.ts +3 -3
  211. package/src/error.ts +2 -1
  212. package/src/loadPaused.ts +16 -8
  213. package/src/loader.ts +20 -2
  214. package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +7 -3
  215. package/src/memoryBlobStorage.ts +13 -7
  216. package/src/noopHeuristic.ts +1 -1
  217. package/src/packageVersion.ts +1 -1
  218. package/src/protocol/protocol.ts +12 -11
  219. package/src/protocol/quorum.ts +49 -40
  220. package/src/protocol.ts +12 -4
  221. package/src/protocolTreeDocumentStorageService.ts +3 -2
  222. package/src/retriableDocumentStorageService.ts +6 -3
  223. package/src/serializedStateManager.ts +95 -39
  224. package/src/utils.ts +26 -10
  225. /package/api-report/{container-loader.alpha.api.md → container-loader.legacy.alpha.api.md} +0 -0
package/lib/container.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /* eslint-disable unicorn/consistent-function-scoping */
5
6
  import { TypedEventEmitter, performance } from "@fluid-internal/client-utils";
6
7
  import { AttachState, } from "@fluidframework/container-definitions";
7
8
  import { isFluidCodeDetails, } from "@fluidframework/container-definitions/internal";
@@ -50,6 +51,7 @@ const packageNotFactoryError = "Code package does not implement IRuntimeFactory"
50
51
  * but it maybe still behind.
51
52
  *
52
53
  * @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
54
+ * @legacy
53
55
  * @alpha
54
56
  */
55
57
  export async function waitContainerToCatchUp(container) {
@@ -62,9 +64,9 @@ export async function waitContainerToCatchUp(container) {
62
64
  const closedCallback = (err) => {
63
65
  container.off("closed", closedCallback);
64
66
  const baseMessage = "Container closed while waiting to catch up";
65
- reject(err !== undefined
66
- ? wrapError(err, (innerMessage) => new GenericError(`${baseMessage}: ${innerMessage}`))
67
- : new GenericError(baseMessage));
67
+ reject(err === undefined
68
+ ? new GenericError(baseMessage)
69
+ : wrapError(err, (innerMessage) => new GenericError(`${baseMessage}: ${innerMessage}`)));
68
70
  };
69
71
  container.on("closed", closedCallback);
70
72
  // Depending on config, transition to "connected" state may include the guarantee
@@ -388,7 +390,9 @@ export class Container extends EventEmitterWithErrorHandling {
388
390
  * disposed: Container has been disposed
389
391
  */
390
392
  this._lifecycleState = "loading";
391
- /** During initialization we pause the inbound queues. We track this state to ensure we only call resume once */
393
+ /**
394
+ * During initialization we pause the inbound queues. We track this state to ensure we only call resume once
395
+ */
392
396
  this.inboundQueuePausedFromInit = true;
393
397
  this.firstConnection = true;
394
398
  this.connectionTransitionTimes = [];
@@ -469,7 +473,7 @@ export class Container extends EventEmitterWithErrorHandling {
469
473
  const snapshotWithBlobs = await attachP;
470
474
  this.serializedStateManager.setInitialSnapshot(snapshotWithBlobs);
471
475
  if (!this.closed) {
472
- this.detachedBlobStorage.dispose?.();
476
+ this.detachedBlobStorage?.dispose?.();
473
477
  this.handleDeltaConnectionArg(attachProps?.deltaConnection, {
474
478
  fetchOpsFromStorage: false,
475
479
  reason: { text: "createDetached" },
@@ -507,7 +511,6 @@ export class Container extends EventEmitterWithErrorHandling {
507
511
  // Tracking alternative ways to handle this in AB#4129.
508
512
  this.options = { ...options };
509
513
  this.scope = scope;
510
- this.detachedBlobStorage = detachedBlobStorage ?? createMemoryDetachedBlobStorage();
511
514
  this.protocolHandlerBuilder =
512
515
  protocolHandlerBuilder ??
513
516
  ((attributes, quorumSnapshot, sendProposal) => new ProtocolHandler(attributes, quorumSnapshot, sendProposal, new Audience(), (clientId) => this.clientsWhoShouldHaveLeft.has(clientId)));
@@ -632,11 +635,16 @@ export class Container extends EventEmitterWithErrorHandling {
632
635
  // Whether the combined summary tree has been forced on by either the supportedFeatures flag by the service or the the loader option or the monitoring context
633
636
  const enableSummarizeProtocolTree = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree2") ??
634
637
  options.summarizeProtocolTree;
638
+ this.detachedBlobStorage =
639
+ detachedBlobStorage ??
640
+ (this.mc.config.getBoolean("Fluid.Container.MemoryBlobStorageEnabled") === true
641
+ ? createMemoryDetachedBlobStorage()
642
+ : undefined);
635
643
  this.storageAdapter = new ContainerStorageAdapter(this.detachedBlobStorage, this.mc.logger, pendingLocalState?.snapshotBlobs, pendingLocalState?.loadedGroupIdSnapshots, addProtocolSummaryIfMissing, enableSummarizeProtocolTree);
636
644
  const offlineLoadEnabled = (this.isInteractiveClient &&
637
645
  this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad")) ??
638
646
  options.enableOfflineLoad === true;
639
- this.serializedStateManager = new SerializedStateManager(pendingLocalState, this.subLogger, this.storageAdapter, offlineLoadEnabled, this, () => this._deltaManager.connectionManager.shouldJoinWrite(), () => this.supportGetSnapshotApi());
647
+ this.serializedStateManager = new SerializedStateManager(pendingLocalState, this.subLogger, this.storageAdapter, offlineLoadEnabled, this, () => this._deltaManager.connectionManager.shouldJoinWrite(), () => this.supportGetSnapshotApi(), this.mc.config.getNumber("Fluid.Container.snapshotRefreshTimeoutMs"));
640
648
  const isDomAvailable = typeof document === "object" &&
641
649
  document !== null &&
642
650
  typeof document.addEventListener === "function" &&
@@ -701,8 +709,8 @@ export class Container extends EventEmitterWithErrorHandling {
701
709
  this._protocolHandler?.close();
702
710
  this.connectionStateHandler.dispose();
703
711
  }
704
- catch (exception) {
705
- this.mc.logger.sendErrorEvent({ eventName: "ContainerCloseException" }, exception);
712
+ catch (newError) {
713
+ this.mc.logger.sendErrorEvent({ eventName: "ContainerCloseException" }, newError);
706
714
  }
707
715
  this.emit("closed", error);
708
716
  if (this.visibilityEventHandler !== undefined) {
@@ -736,7 +744,7 @@ export class Container extends EventEmitterWithErrorHandling {
736
744
  }
737
745
  this._protocolHandler?.close();
738
746
  this.connectionStateHandler.dispose();
739
- const maybeError = error !== undefined ? new Error(error.message) : undefined;
747
+ const maybeError = error === undefined ? undefined : new Error(error.message);
740
748
  this._runtime?.dispose(maybeError);
741
749
  this.storageAdapter.dispose();
742
750
  // Notify storage about critical errors. They may be due to disconnect between client & server knowledge
@@ -744,8 +752,8 @@ export class Container extends EventEmitterWithErrorHandling {
744
752
  // Driver need to ensure all caches are cleared on critical errors
745
753
  this.service?.dispose(error);
746
754
  }
747
- catch (exception) {
748
- this.mc.logger.sendErrorEvent({ eventName: "ContainerDisposeException" }, exception);
755
+ catch (error_) {
756
+ this.mc.logger.sendErrorEvent({ eventName: "ContainerDisposeException" }, error_);
749
757
  }
750
758
  this.emit("disposed", error);
751
759
  this.removeAllListeners();
@@ -803,14 +811,14 @@ export class Container extends EventEmitterWithErrorHandling {
803
811
  const combinedSummary = attachingData?.summary ??
804
812
  combineAppAndProtocolSummary(this.runtime.createSummary(), this.captureProtocolSummary());
805
813
  const { baseSnapshot, snapshotBlobs } = getSnapshotTreeAndBlobsFromSerializedContainer(combinedSummary);
806
- const pendingRuntimeState = attachingData !== undefined ? this.runtime.getPendingLocalState() : undefined;
814
+ const pendingRuntimeState = attachingData === undefined ? undefined : this.runtime.getPendingLocalState();
807
815
  assert(!isPromiseLike(pendingRuntimeState), 0x8e3 /* should not be a promise */);
808
816
  const detachedContainerState = {
809
817
  attached: false,
810
818
  baseSnapshot,
811
819
  snapshotBlobs,
812
820
  pendingRuntimeState,
813
- hasAttachmentBlobs: this.detachedBlobStorage.size > 0,
821
+ hasAttachmentBlobs: this.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,
814
822
  attachmentBlobs: serializeMemoryDetachedBlobStorage(this.detachedBlobStorage),
815
823
  };
816
824
  return JSON.stringify(detachedContainerState);
@@ -1003,17 +1011,20 @@ export class Container extends EventEmitterWithErrorHandling {
1003
1011
  // Attach op handlers to finish initialization and be able to start processing ops
1004
1012
  // Kick off any ops fetching if required.
1005
1013
  switch (loadMode.opsBeforeReturn) {
1006
- case undefined:
1014
+ case undefined: {
1007
1015
  // Start prefetch, but not set opsBeforeReturnP - boot is not blocked by it!
1008
1016
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1009
- this.attachDeltaManagerOpHandler(attributes, loadMode.deltaConnection !== "none" ? "all" : "none", lastProcessedSequenceNumber);
1017
+ this.attachDeltaManagerOpHandler(attributes, loadMode.deltaConnection === "none" ? "none" : "all", lastProcessedSequenceNumber);
1010
1018
  break;
1019
+ }
1011
1020
  case "cached":
1012
- case "all":
1021
+ case "all": {
1013
1022
  opsBeforeReturnP = this.attachDeltaManagerOpHandler(attributes, loadMode.opsBeforeReturn, lastProcessedSequenceNumber);
1014
1023
  break;
1015
- default:
1024
+ }
1025
+ default: {
1016
1026
  unreachableCase(loadMode.opsBeforeReturn);
1027
+ }
1017
1028
  }
1018
1029
  // ...load in the existing quorum
1019
1030
  // Initialize the protocol handler
@@ -1099,7 +1110,7 @@ export class Container extends EventEmitterWithErrorHandling {
1099
1110
  if (attachmentBlobs !== undefined) {
1100
1111
  tryInitializeMemoryDetachedBlobStorage(this.detachedBlobStorage, attachmentBlobs);
1101
1112
  }
1102
- assert(this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
1113
+ assert(this.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
1103
1114
  }
1104
1115
  const snapshotTreeWithBlobContents = combineSnapshotTreeAndSnapshotBlobs(baseSnapshot, snapshotBlobs);
1105
1116
  this.storageAdapter.loadSnapshotFromSnapshotBlobs(snapshotBlobs);
@@ -1135,7 +1146,9 @@ export class Container extends EventEmitterWithErrorHandling {
1135
1146
  this.initializeProtocolState(attributes, quorumSnapshot);
1136
1147
  }
1137
1148
  initializeProtocolState(attributes, quorumSnapshot) {
1138
- const protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) => this.submitMessage(MessageType.Propose, JSON.stringify({ key, value })));
1149
+ const protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) =>
1150
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1151
+ this.submitMessage(MessageType.Propose, JSON.stringify({ key, value })));
1139
1152
  const protocolLogger = createChildLogger({
1140
1153
  logger: this.subLogger,
1141
1154
  namespace: "ProtocolHandler",
@@ -1199,9 +1212,8 @@ export class Container extends EventEmitterWithErrorHandling {
1199
1212
  return pkg;
1200
1213
  }
1201
1214
  static setupClient(containerId, loaderOptionsClient, clientDetailsOverride) {
1202
- const client = loaderOptionsClient !== undefined
1203
- ? structuredClone(loaderOptionsClient)
1204
- : {
1215
+ const client = loaderOptionsClient === undefined
1216
+ ? {
1205
1217
  details: {
1206
1218
  capabilities: { interactive: true },
1207
1219
  },
@@ -1209,7 +1221,8 @@ export class Container extends EventEmitterWithErrorHandling {
1209
1221
  permission: [],
1210
1222
  scopes: [],
1211
1223
  user: { id: "" },
1212
- };
1224
+ }
1225
+ : structuredClone(loaderOptionsClient);
1213
1226
  if (clientDetailsOverride !== undefined) {
1214
1227
  client.details = {
1215
1228
  ...client.details,
@@ -1352,7 +1365,7 @@ export class Container extends EventEmitterWithErrorHandling {
1352
1365
  autoReconnect,
1353
1366
  opsBehind,
1354
1367
  online: OnlineStatus[isOnline()],
1355
- lastVisible: this.lastVisible !== undefined ? performance.now() - this.lastVisible : undefined,
1368
+ lastVisible: this.lastVisible === undefined ? undefined : performance.now() - this.lastVisible,
1356
1369
  checkpointSequenceNumber,
1357
1370
  quorumSize: this._protocolHandler?.quorum.getMembers().size,
1358
1371
  isDirty: this.isDirty,
@@ -1383,10 +1396,12 @@ export class Container extends EventEmitterWithErrorHandling {
1383
1396
  // back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()
1384
1397
  submitContainerMessage(type, contents, batch, metadata) {
1385
1398
  switch (type) {
1386
- case MessageType.Operation:
1399
+ case MessageType.Operation: {
1387
1400
  return this.submitMessage(type, JSON.stringify(contents), batch, metadata);
1388
- case MessageType.Summarize:
1401
+ }
1402
+ case MessageType.Summarize: {
1389
1403
  return this.submitSummaryMessage(contents);
1404
+ }
1390
1405
  default: {
1391
1406
  const newError = new GenericError("invalidContainerSubmitOpType", undefined /* error */, { messageType: type });
1392
1407
  this.close(newError);
@@ -1394,7 +1409,9 @@ export class Container extends EventEmitterWithErrorHandling {
1394
1409
  }
1395
1410
  }
1396
1411
  }
1397
- /** @returns clientSequenceNumber of last message in a batch */
1412
+ /**
1413
+ * Gets the `clientSequenceNumber` of last message in a batch.
1414
+ */
1398
1415
  submitBatch(batch, referenceSequenceNumber) {
1399
1416
  let clientSequenceNumber = -1;
1400
1417
  for (const message of batch) {
@@ -1520,22 +1537,26 @@ export class Container extends EventEmitterWithErrorHandling {
1520
1537
  // and runtime implementation may miss such events.
1521
1538
  assert(this.loaded, 0x96f /* has to be called after container transitions to loaded state */);
1522
1539
  switch (deltaConnectionArg) {
1523
- case undefined:
1540
+ case undefined: {
1524
1541
  if (connectionArgs) {
1525
1542
  // connect to delta stream now since we did not before
1526
1543
  this.connectToDeltaStream(connectionArgs);
1527
1544
  }
1545
+ }
1528
1546
  // intentional fallthrough
1529
- case "delayed":
1547
+ case "delayed": {
1530
1548
  assert(this.inboundQueuePausedFromInit, 0x346 /* inboundQueuePausedFromInit should be true */);
1531
1549
  this.inboundQueuePausedFromInit = false;
1532
1550
  this._deltaManager.inbound.resume();
1533
1551
  this._deltaManager.inboundSignal.resume();
1534
1552
  break;
1535
- case "none":
1553
+ }
1554
+ case "none": {
1536
1555
  break;
1537
- default:
1556
+ }
1557
+ default: {
1538
1558
  unreachableCase(deltaConnectionArg);
1559
+ }
1539
1560
  }
1540
1561
  }
1541
1562
  }