@fluidframework/container-runtime 2.0.0-internal.5.3.2 → 2.0.0-internal.6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/batchTracker.d.ts +2 -1
  3. package/dist/batchTracker.d.ts.map +1 -1
  4. package/dist/batchTracker.js +1 -1
  5. package/dist/batchTracker.js.map +1 -1
  6. package/dist/blobManager.d.ts +13 -2
  7. package/dist/blobManager.d.ts.map +1 -1
  8. package/dist/blobManager.js +103 -25
  9. package/dist/blobManager.js.map +1 -1
  10. package/dist/connectionTelemetry.d.ts.map +1 -1
  11. package/dist/connectionTelemetry.js +12 -4
  12. package/dist/connectionTelemetry.js.map +1 -1
  13. package/dist/containerRuntime.d.ts +69 -22
  14. package/dist/containerRuntime.d.ts.map +1 -1
  15. package/dist/containerRuntime.js +344 -238
  16. package/dist/containerRuntime.js.map +1 -1
  17. package/dist/dataStore.js +11 -2
  18. package/dist/dataStore.js.map +1 -1
  19. package/dist/dataStoreContext.d.ts +1 -1
  20. package/dist/dataStoreContext.d.ts.map +1 -1
  21. package/dist/dataStoreContext.js +40 -44
  22. package/dist/dataStoreContext.js.map +1 -1
  23. package/dist/dataStoreContexts.js +1 -1
  24. package/dist/dataStoreContexts.js.map +1 -1
  25. package/dist/dataStores.d.ts +21 -5
  26. package/dist/dataStores.d.ts.map +1 -1
  27. package/dist/dataStores.js +102 -58
  28. package/dist/dataStores.js.map +1 -1
  29. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
  30. package/dist/deltaManagerSummarizerProxy.js +2 -0
  31. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  32. package/dist/deltaScheduler.d.ts.map +1 -1
  33. package/dist/deltaScheduler.js +5 -5
  34. package/dist/deltaScheduler.js.map +1 -1
  35. package/dist/gc/garbageCollection.d.ts.map +1 -1
  36. package/dist/gc/garbageCollection.js +29 -25
  37. package/dist/gc/garbageCollection.js.map +1 -1
  38. package/dist/gc/gcConfigs.js +13 -11
  39. package/dist/gc/gcConfigs.js.map +1 -1
  40. package/dist/gc/gcHelpers.d.ts +1 -0
  41. package/dist/gc/gcHelpers.d.ts.map +1 -1
  42. package/dist/gc/gcHelpers.js +5 -6
  43. package/dist/gc/gcHelpers.js.map +1 -1
  44. package/dist/gc/gcSummaryStateTracker.js +4 -6
  45. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  46. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  47. package/dist/gc/gcTelemetry.js +44 -33
  48. package/dist/gc/gcTelemetry.js.map +1 -1
  49. package/dist/id-compressor/idCompressor.d.ts +3 -3
  50. package/dist/id-compressor/idCompressor.d.ts.map +1 -1
  51. package/dist/id-compressor/idCompressor.js +52 -52
  52. package/dist/id-compressor/idCompressor.js.map +1 -1
  53. package/dist/id-compressor/idRange.js +2 -2
  54. package/dist/id-compressor/idRange.js.map +1 -1
  55. package/dist/id-compressor/sessionIdNormalizer.js +11 -16
  56. package/dist/id-compressor/sessionIdNormalizer.js.map +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/opLifecycle/batchManager.js +10 -6
  61. package/dist/opLifecycle/batchManager.js.map +1 -1
  62. package/dist/opLifecycle/opCompressor.d.ts +2 -2
  63. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  64. package/dist/opLifecycle/opCompressor.js +7 -2
  65. package/dist/opLifecycle/opCompressor.js.map +1 -1
  66. package/dist/opLifecycle/opDecompressor.d.ts +2 -2
  67. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  68. package/dist/opLifecycle/opDecompressor.js +12 -10
  69. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  70. package/dist/opLifecycle/opGroupingManager.js +13 -5
  71. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  72. package/dist/opLifecycle/opSplitter.d.ts +2 -2
  73. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  74. package/dist/opLifecycle/opSplitter.js +11 -7
  75. package/dist/opLifecycle/opSplitter.js.map +1 -1
  76. package/dist/opLifecycle/outbox.d.ts +6 -5
  77. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  78. package/dist/opLifecycle/outbox.js +6 -14
  79. package/dist/opLifecycle/outbox.js.map +1 -1
  80. package/dist/opLifecycle/remoteMessageProcessor.d.ts +6 -1
  81. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  82. package/dist/opLifecycle/remoteMessageProcessor.js +8 -2
  83. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  84. package/dist/opProperties.js +1 -2
  85. package/dist/opProperties.js.map +1 -1
  86. package/dist/packageVersion.d.ts +1 -1
  87. package/dist/packageVersion.js +1 -1
  88. package/dist/packageVersion.js.map +1 -1
  89. package/dist/pendingStateManager.d.ts +6 -3
  90. package/dist/pendingStateManager.d.ts.map +1 -1
  91. package/dist/pendingStateManager.js +41 -32
  92. package/dist/pendingStateManager.js.map +1 -1
  93. package/dist/scheduleManager.d.ts.map +1 -1
  94. package/dist/scheduleManager.js +15 -11
  95. package/dist/scheduleManager.js.map +1 -1
  96. package/dist/summary/orderedClientElection.d.ts +2 -1
  97. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  98. package/dist/summary/orderedClientElection.js +18 -19
  99. package/dist/summary/orderedClientElection.js.map +1 -1
  100. package/dist/summary/runningSummarizer.d.ts +3 -5
  101. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  102. package/dist/summary/runningSummarizer.js +42 -66
  103. package/dist/summary/runningSummarizer.js.map +1 -1
  104. package/dist/summary/summarizer.js +5 -8
  105. package/dist/summary/summarizer.js.map +1 -1
  106. package/dist/summary/summarizerClientElection.js +5 -9
  107. package/dist/summary/summarizerClientElection.js.map +1 -1
  108. package/dist/summary/summarizerHeuristics.js +8 -12
  109. package/dist/summary/summarizerHeuristics.js.map +1 -1
  110. package/dist/summary/summarizerNode/summarizerNode.d.ts +5 -5
  111. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  112. package/dist/summary/summarizerNode/summarizerNode.js +26 -22
  113. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  114. package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -4
  115. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  116. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +4 -3
  117. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  118. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +13 -16
  119. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  120. package/dist/summary/summaryCollection.js +3 -5
  121. package/dist/summary/summaryCollection.js.map +1 -1
  122. package/dist/summary/summaryFormat.js +1 -2
  123. package/dist/summary/summaryFormat.js.map +1 -1
  124. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  125. package/dist/summary/summaryGenerator.js +67 -21
  126. package/dist/summary/summaryGenerator.js.map +1 -1
  127. package/dist/summary/summaryManager.d.ts +2 -3
  128. package/dist/summary/summaryManager.d.ts.map +1 -1
  129. package/dist/summary/summaryManager.js +9 -7
  130. package/dist/summary/summaryManager.js.map +1 -1
  131. package/lib/batchTracker.d.ts +2 -1
  132. package/lib/batchTracker.d.ts.map +1 -1
  133. package/lib/batchTracker.js +2 -2
  134. package/lib/batchTracker.js.map +1 -1
  135. package/lib/blobManager.d.ts +13 -2
  136. package/lib/blobManager.d.ts.map +1 -1
  137. package/lib/blobManager.js +103 -25
  138. package/lib/blobManager.js.map +1 -1
  139. package/lib/connectionTelemetry.d.ts.map +1 -1
  140. package/lib/connectionTelemetry.js +13 -5
  141. package/lib/connectionTelemetry.js.map +1 -1
  142. package/lib/containerRuntime.d.ts +69 -22
  143. package/lib/containerRuntime.d.ts.map +1 -1
  144. package/lib/containerRuntime.js +343 -238
  145. package/lib/containerRuntime.js.map +1 -1
  146. package/lib/dataStore.js +11 -2
  147. package/lib/dataStore.js.map +1 -1
  148. package/lib/dataStoreContext.d.ts +1 -1
  149. package/lib/dataStoreContext.d.ts.map +1 -1
  150. package/lib/dataStoreContext.js +42 -46
  151. package/lib/dataStoreContext.js.map +1 -1
  152. package/lib/dataStoreContexts.js +2 -2
  153. package/lib/dataStoreContexts.js.map +1 -1
  154. package/lib/dataStores.d.ts +21 -5
  155. package/lib/dataStores.d.ts.map +1 -1
  156. package/lib/dataStores.js +103 -59
  157. package/lib/dataStores.js.map +1 -1
  158. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -1
  159. package/lib/deltaManagerSummarizerProxy.js +2 -0
  160. package/lib/deltaManagerSummarizerProxy.js.map +1 -1
  161. package/lib/deltaScheduler.d.ts.map +1 -1
  162. package/lib/deltaScheduler.js +6 -6
  163. package/lib/deltaScheduler.js.map +1 -1
  164. package/lib/gc/garbageCollection.d.ts.map +1 -1
  165. package/lib/gc/garbageCollection.js +30 -26
  166. package/lib/gc/garbageCollection.js.map +1 -1
  167. package/lib/gc/gcConfigs.js +13 -11
  168. package/lib/gc/gcConfigs.js.map +1 -1
  169. package/lib/gc/gcHelpers.d.ts +1 -0
  170. package/lib/gc/gcHelpers.d.ts.map +1 -1
  171. package/lib/gc/gcHelpers.js +5 -6
  172. package/lib/gc/gcHelpers.js.map +1 -1
  173. package/lib/gc/gcSummaryStateTracker.js +4 -6
  174. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  175. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  176. package/lib/gc/gcTelemetry.js +45 -34
  177. package/lib/gc/gcTelemetry.js.map +1 -1
  178. package/lib/id-compressor/idCompressor.d.ts +3 -3
  179. package/lib/id-compressor/idCompressor.d.ts.map +1 -1
  180. package/lib/id-compressor/idCompressor.js +52 -52
  181. package/lib/id-compressor/idCompressor.js.map +1 -1
  182. package/lib/id-compressor/idRange.js +2 -2
  183. package/lib/id-compressor/idRange.js.map +1 -1
  184. package/lib/id-compressor/sessionIdNormalizer.js +11 -16
  185. package/lib/id-compressor/sessionIdNormalizer.js.map +1 -1
  186. package/lib/index.d.ts +1 -1
  187. package/lib/index.d.ts.map +1 -1
  188. package/lib/index.js.map +1 -1
  189. package/lib/opLifecycle/batchManager.js +10 -6
  190. package/lib/opLifecycle/batchManager.js.map +1 -1
  191. package/lib/opLifecycle/opCompressor.d.ts +2 -2
  192. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  193. package/lib/opLifecycle/opCompressor.js +8 -3
  194. package/lib/opLifecycle/opCompressor.js.map +1 -1
  195. package/lib/opLifecycle/opDecompressor.d.ts +2 -2
  196. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  197. package/lib/opLifecycle/opDecompressor.js +13 -11
  198. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  199. package/lib/opLifecycle/opGroupingManager.js +13 -5
  200. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  201. package/lib/opLifecycle/opSplitter.d.ts +2 -2
  202. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  203. package/lib/opLifecycle/opSplitter.js +12 -8
  204. package/lib/opLifecycle/opSplitter.js.map +1 -1
  205. package/lib/opLifecycle/outbox.d.ts +6 -5
  206. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  207. package/lib/opLifecycle/outbox.js +7 -15
  208. package/lib/opLifecycle/outbox.js.map +1 -1
  209. package/lib/opLifecycle/remoteMessageProcessor.d.ts +6 -1
  210. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  211. package/lib/opLifecycle/remoteMessageProcessor.js +8 -2
  212. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  213. package/lib/opProperties.js +1 -2
  214. package/lib/opProperties.js.map +1 -1
  215. package/lib/packageVersion.d.ts +1 -1
  216. package/lib/packageVersion.js +1 -1
  217. package/lib/packageVersion.js.map +1 -1
  218. package/lib/pendingStateManager.d.ts +6 -3
  219. package/lib/pendingStateManager.d.ts.map +1 -1
  220. package/lib/pendingStateManager.js +41 -32
  221. package/lib/pendingStateManager.js.map +1 -1
  222. package/lib/scheduleManager.d.ts.map +1 -1
  223. package/lib/scheduleManager.js +16 -12
  224. package/lib/scheduleManager.js.map +1 -1
  225. package/lib/summary/orderedClientElection.d.ts +2 -1
  226. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  227. package/lib/summary/orderedClientElection.js +19 -20
  228. package/lib/summary/orderedClientElection.js.map +1 -1
  229. package/lib/summary/runningSummarizer.d.ts +3 -5
  230. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  231. package/lib/summary/runningSummarizer.js +43 -67
  232. package/lib/summary/runningSummarizer.js.map +1 -1
  233. package/lib/summary/summarizer.js +6 -9
  234. package/lib/summary/summarizer.js.map +1 -1
  235. package/lib/summary/summarizerClientElection.js +5 -9
  236. package/lib/summary/summarizerClientElection.js.map +1 -1
  237. package/lib/summary/summarizerHeuristics.js +8 -12
  238. package/lib/summary/summarizerHeuristics.js.map +1 -1
  239. package/lib/summary/summarizerNode/summarizerNode.d.ts +5 -5
  240. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  241. package/lib/summary/summarizerNode/summarizerNode.js +27 -23
  242. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  243. package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -4
  244. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  245. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +4 -3
  246. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  247. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +14 -17
  248. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  249. package/lib/summary/summaryCollection.js +3 -5
  250. package/lib/summary/summaryCollection.js.map +1 -1
  251. package/lib/summary/summaryFormat.js +1 -2
  252. package/lib/summary/summaryFormat.js.map +1 -1
  253. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  254. package/lib/summary/summaryGenerator.js +68 -22
  255. package/lib/summary/summaryGenerator.js.map +1 -1
  256. package/lib/summary/summaryManager.d.ts +2 -3
  257. package/lib/summary/summaryManager.d.ts.map +1 -1
  258. package/lib/summary/summaryManager.js +10 -8
  259. package/lib/summary/summaryManager.js.map +1 -1
  260. package/package.json +30 -18
  261. package/src/batchTracker.ts +4 -3
  262. package/src/blobManager.ts +113 -15
  263. package/src/connectionTelemetry.ts +7 -3
  264. package/src/containerRuntime.ts +354 -194
  265. package/src/dataStore.ts +10 -1
  266. package/src/dataStoreContext.ts +31 -33
  267. package/src/dataStoreContexts.ts +2 -2
  268. package/src/dataStores.ts +108 -71
  269. package/src/deltaManagerSummarizerProxy.ts +2 -0
  270. package/src/deltaScheduler.ts +6 -10
  271. package/src/gc/garbageCollection.ts +13 -8
  272. package/src/gc/gcHelpers.ts +1 -0
  273. package/src/gc/gcTelemetry.ts +13 -10
  274. package/src/id-compressor/idCompressor.ts +6 -5
  275. package/src/index.ts +0 -1
  276. package/src/opLifecycle/opCompressor.ts +4 -3
  277. package/src/opLifecycle/opDecompressor.ts +4 -3
  278. package/src/opLifecycle/opSplitter.ts +4 -3
  279. package/src/opLifecycle/outbox.ts +13 -25
  280. package/src/opLifecycle/remoteMessageProcessor.ts +8 -2
  281. package/src/packageVersion.ts +1 -1
  282. package/src/pendingStateManager.ts +34 -25
  283. package/src/scheduleManager.ts +2 -2
  284. package/src/summary/orderedClientElection.ts +4 -3
  285. package/src/summary/runningSummarizer.ts +18 -44
  286. package/src/summary/summarizer.ts +2 -2
  287. package/src/summary/summarizerNode/summarizerNode.ts +13 -15
  288. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +8 -7
  289. package/src/summary/summaryGenerator.ts +6 -2
  290. package/src/summary/summaryManager.ts +9 -5
@@ -2,8 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /* eslint-disable @typescript-eslint/restrict-plus-operands */
5
6
  import { assert } from "@fluidframework/common-utils";
6
7
  import BTree from "sorted-btree";
8
+ import { createChildLogger } from "@fluidframework/telemetry-utils";
7
9
  import { hasAtLeastLength, compareFiniteNumbers, compareFiniteNumbersReversed, compareMaps, compareStrings, fail, setPropertyIfDefined, } from "./utils";
8
10
  import { assertIsStableId, isStableId } from "./uuidUtilities";
9
11
  import { AppendOnlySortedMap } from "./appendOnlySortedMap";
@@ -44,7 +46,6 @@ export class IdCompressor {
44
46
  */
45
47
  constructor(localSessionId, logger) {
46
48
  this.localSessionId = localSessionId;
47
- this.logger = logger;
48
49
  /**
49
50
  * Trivially reach consensus on default cluster size and reserved IDs.
50
51
  * These initial values must *NOT* change without careful consideration to compatibility.
@@ -99,6 +100,7 @@ export class IdCompressor {
99
100
  */
100
101
  this.finalIdToCluster = new AppendOnlySortedMap(compareFiniteNumbers);
101
102
  this.localSession = this.createSession(localSessionId);
103
+ this.logger = createChildLogger({ logger });
102
104
  }
103
105
  /**
104
106
  * The size of each newly created ID cluster.
@@ -143,9 +145,8 @@ export class IdCompressor {
143
145
  * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.
144
146
  */
145
147
  takeNextCreationRange() {
146
- var _a;
147
148
  const lastLocalInRange = -this.localIdCount;
148
- const lastTakenNormalized = (_a = this.lastTakenLocalId) !== null && _a !== void 0 ? _a : 0;
149
+ const lastTakenNormalized = this.lastTakenLocalId ?? 0;
149
150
  assert(lastLocalInRange <= lastTakenNormalized, 0x485 /* Inconsistent local ID state */);
150
151
  let ids;
151
152
  if (lastLocalInRange !== lastTakenNormalized) {
@@ -188,21 +189,20 @@ export class IdCompressor {
188
189
  * @param range - the range of session-local IDs to finalize.
189
190
  */
190
191
  finalizeCreationRange(range) {
191
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
192
192
  const { sessionId } = range;
193
193
  const isLocal = sessionId === this.localSessionId;
194
- const session = (_a = this.sessions.get(sessionId)) !== null && _a !== void 0 ? _a : this.createSession(sessionId);
194
+ const session = this.sessions.get(sessionId) ?? this.createSession(sessionId);
195
195
  const ids = getIds(range);
196
196
  if (ids === undefined) {
197
197
  return;
198
198
  }
199
199
  const { currentClusterDetails } = session;
200
- const { cluster: currentCluster, clusterBase: currentBaseFinalId } = currentClusterDetails !== null && currentClusterDetails !== void 0 ? currentClusterDetails : {
200
+ const { cluster: currentCluster, clusterBase: currentBaseFinalId } = currentClusterDetails ?? {
201
201
  cluster: undefined,
202
202
  clusterBase: undefined,
203
203
  };
204
204
  const currentClusterExists = currentCluster !== undefined && currentBaseFinalId !== undefined;
205
- const normalizedLastFinalizedLocal = (_b = session.lastFinalizedLocalId) !== null && _b !== void 0 ? _b : 0;
205
+ const normalizedLastFinalizedLocal = session.lastFinalizedLocalId ?? 0;
206
206
  const { first: newFirstFinalizedLocal, last: newLastFinalizedLocal } = ids;
207
207
  assert(newFirstFinalizedLocal === normalizedLastFinalizedLocal - 1, 0x489 /* Ranges finalized out of order. */);
208
208
  // The total number of session-local IDs to finalize
@@ -214,7 +214,8 @@ export class IdCompressor {
214
214
  let newBaseUuid;
215
215
  if (currentClusterExists) {
216
216
  if (isLocal) {
217
- const lastKnownFinal = (_c = this.sessionIdNormalizer.getLastFinalId()) !== null && _c !== void 0 ? _c : fail("Cluster exists but normalizer does not have an entry for it.");
217
+ const lastKnownFinal = this.sessionIdNormalizer.getLastFinalId() ??
218
+ fail("Cluster exists but normalizer does not have an entry for it.");
218
219
  const lastAlignedFinalInCluster = (currentBaseFinalId +
219
220
  Math.min(currentCluster.count + finalizeCount, currentCluster.capacity) -
220
221
  1);
@@ -265,7 +266,7 @@ export class IdCompressor {
265
266
  // actually finalized, because total order broadcast guarantees that any usage of those final IDs will be observed after
266
267
  // the finalization of the ranges.
267
268
  this.sessionIdNormalizer.registerFinalIdBlock(finalPivot, expansionAmount, currentCluster);
268
- (_d = this.logger) === null || _d === void 0 ? void 0 : _d.sendTelemetryEvent({
269
+ this.logger?.sendTelemetryEvent({
269
270
  eventName: "RuntimeIdCompressor:ClusterExpansion",
270
271
  sessionId: this.localSessionId,
271
272
  previousCapacity,
@@ -281,7 +282,7 @@ export class IdCompressor {
281
282
  newBaseUuid = incrementUuid(currentCluster.baseUuid, currentCluster.capacity);
282
283
  currentCluster.count += remainingCapacity;
283
284
  remainingCount -= remainingCapacity;
284
- (_e = this.logger) === null || _e === void 0 ? void 0 : _e.sendTelemetryEvent({
285
+ this.logger?.sendTelemetryEvent({
285
286
  eventName: "RuntimeIdCompressor:OverfilledCluster",
286
287
  sessionId: this.localSessionId,
287
288
  });
@@ -291,7 +292,7 @@ export class IdCompressor {
291
292
  // Session has never made a cluster, form a new one with the session UUID as the baseUuid
292
293
  newBaseUuid = session.sessionUuid;
293
294
  if (isLocal) {
294
- (_f = this.logger) === null || _f === void 0 ? void 0 : _f.sendTelemetryEvent({
295
+ this.logger?.sendTelemetryEvent({
295
296
  eventName: "RuntimeIdCompressor:FirstCluster",
296
297
  sessionId: this.localSessionId,
297
298
  });
@@ -326,7 +327,7 @@ export class IdCompressor {
326
327
  const usedCapacity = finalizeCount - remainingCount;
327
328
  localIdPivot = (newFirstFinalizedLocal - usedCapacity);
328
329
  if (isLocal) {
329
- (_g = this.logger) === null || _g === void 0 ? void 0 : _g.sendTelemetryEvent({
330
+ this.logger?.sendTelemetryEvent({
330
331
  eventName: "RuntimeIdCompressor:NewCluster",
331
332
  sessionId: this.localSessionId,
332
333
  clusterCapacity: newCapacity,
@@ -372,7 +373,7 @@ export class IdCompressor {
372
373
  (normalizedLastFinalizedLocal - overriddenLocal) -
373
374
  1);
374
375
  }
375
- (_h = cluster.overrides) !== null && _h !== void 0 ? _h : (cluster.overrides = new Map());
376
+ cluster.overrides ?? (cluster.overrides = new Map());
376
377
  const inversionKey = IdCompressor.createInversionKey(override);
377
378
  const existingIds = this.getExistingIdsForNewOverride(inversionKey, true);
378
379
  let overrideForCluster;
@@ -440,11 +441,11 @@ export class IdCompressor {
440
441
  }
441
442
  }
442
443
  if (isLocal) {
443
- (_j = this.logger) === null || _j === void 0 ? void 0 : _j.sendTelemetryEvent({
444
+ this.logger?.sendTelemetryEvent({
444
445
  eventName: "RuntimeIdCompressor:IdCompressorStatus",
445
- eagerFinalIdCount: eagerFinalIdCount - ((_k = overrides === null || overrides === void 0 ? void 0 : overrides.length) !== null && _k !== void 0 ? _k : 0),
446
- localIdCount: remainingCount + ((_l = overrides === null || overrides === void 0 ? void 0 : overrides.length) !== null && _l !== void 0 ? _l : 0),
447
- overridesCount: (_m = overrides === null || overrides === void 0 ? void 0 : overrides.length) !== null && _m !== void 0 ? _m : 0,
446
+ eagerFinalIdCount: eagerFinalIdCount - (overrides?.length ?? 0),
447
+ localIdCount: remainingCount + (overrides?.length ?? 0),
448
+ overridesCount: overrides?.length ?? 0,
448
449
  sessionId: this.localSessionId,
449
450
  });
450
451
  }
@@ -489,7 +490,6 @@ export class IdCompressor {
489
490
  * Returns an existing ID associated with an override, or undefined if none exists.
490
491
  */
491
492
  getExistingIdsForNewOverride(inversionKey, isFinalOverride) {
492
- var _a;
493
493
  const closestMatch = this.clustersAndOverridesInversion.getPairOrNextLower(inversionKey, reusedArray);
494
494
  let numericOverride;
495
495
  let stableOverride;
@@ -527,7 +527,9 @@ export class IdCompressor {
527
527
  }
528
528
  }
529
529
  }
530
- const override = (_a = numericOverride !== null && numericOverride !== void 0 ? numericOverride : stableOverride) !== null && _a !== void 0 ? _a : (IdCompressor.isStableInversionKey(inversionKey) ? inversionKey : undefined);
530
+ const override = numericOverride ??
531
+ stableOverride ??
532
+ (IdCompressor.isStableInversionKey(inversionKey) ? inversionKey : undefined);
531
533
  if (override !== undefined) {
532
534
  const sessionSpaceId = this.getCompressedIdForStableId(override);
533
535
  if (sessionSpaceId !== undefined) {
@@ -555,8 +557,7 @@ export class IdCompressor {
555
557
  * Helper for retrieving an override.
556
558
  */
557
559
  static tryGetOverride(cluster, finalId) {
558
- var _a;
559
- const override = (_a = cluster.overrides) === null || _a === void 0 ? void 0 : _a.get(finalId);
560
+ const override = cluster.overrides?.get(finalId);
560
561
  if (override === undefined) {
561
562
  return undefined;
562
563
  }
@@ -601,15 +602,15 @@ export class IdCompressor {
601
602
  const registeredLocal = sessionIdNormalizer.addLocalId();
602
603
  assert(registeredLocal === newLocalId, 0x496 /* Session ID Normalizer produced unexpected local ID */);
603
604
  if (eagerFinalId !== undefined) {
604
- sessionIdNormalizer.addFinalIds(eagerFinalId, eagerFinalId, cluster !== null && cluster !== void 0 ? cluster : fail("No cluster when generating compressed ID"));
605
+ sessionIdNormalizer.addFinalIds(eagerFinalId, eagerFinalId, cluster ?? fail("No cluster when generating compressed ID"));
605
606
  }
606
- this.localOverrides.append(newLocalId, override !== null && override !== void 0 ? override : fail("Override must be defined"));
607
+ this.localOverrides.append(newLocalId, override ?? fail("Override must be defined"));
607
608
  // Since the local ID was just created, it is in both session and op space
608
609
  const compressionMapping = newLocalId;
609
610
  this.clustersAndOverridesInversion.set(overrideInversionKey, compressionMapping);
610
611
  }
611
612
  else if (eagerFinalId !== undefined) {
612
- sessionIdNormalizer.addFinalIds(eagerFinalId, eagerFinalId, cluster !== null && cluster !== void 0 ? cluster : fail("No cluster when generating compressed ID"));
613
+ sessionIdNormalizer.addFinalIds(eagerFinalId, eagerFinalId, cluster ?? fail("No cluster when generating compressed ID"));
613
614
  return eagerFinalId;
614
615
  }
615
616
  else {
@@ -624,8 +625,7 @@ export class IdCompressor {
624
625
  * @returns the UUID or override string associated with the compressed ID. Fails if the ID was not generated by this compressor.
625
626
  */
626
627
  decompress(id) {
627
- var _a;
628
- return (_a = this.tryDecompress(id)) !== null && _a !== void 0 ? _a : fail("Compressed ID was not generated by this compressor");
628
+ return this.tryDecompress(id) ?? fail("Compressed ID was not generated by this compressor");
629
629
  }
630
630
  /**
631
631
  * Attempts to decompress a previously compressed ID into a UUID or override string.
@@ -633,7 +633,6 @@ export class IdCompressor {
633
633
  * @returns the UUID or override string associated with the compressed ID, or undefined if the ID was not generated by this compressor.
634
634
  */
635
635
  tryDecompress(id) {
636
- var _a;
637
636
  if (isFinalId(id)) {
638
637
  const possibleCluster = this.getClusterForFinalId(id);
639
638
  if (possibleCluster === undefined) {
@@ -665,7 +664,7 @@ export class IdCompressor {
665
664
  // If this is a local ID with an override, then it must have been allocated on this machine and will be contained in
666
665
  // `localOverrides`s. Otherwise, it is a sequential allocation from the session UUID and can simply be negated and
667
666
  // added to that UUID to obtain the stable ID associated with it.
668
- const localOverride = (_a = this.localOverrides) === null || _a === void 0 ? void 0 : _a.get(id);
667
+ const localOverride = this.localOverrides?.get(id);
669
668
  return localOverride !== undefined
670
669
  ? localOverride
671
670
  : stableIdFromNumericUuid(this.localSession.sessionUuid, idOffset - 1);
@@ -677,8 +676,7 @@ export class IdCompressor {
677
676
  * @returns the `CompressedId` associated with `uncompressed`. Fails if it has not been previously compressed by this compressor.
678
677
  */
679
678
  recompress(uncompressed) {
680
- var _a;
681
- return (_a = this.tryRecompress(uncompressed)) !== null && _a !== void 0 ? _a : fail("No such string has ever been compressed");
679
+ return this.tryRecompress(uncompressed) ?? fail("No such string has ever been compressed");
682
680
  }
683
681
  /**
684
682
  * Attempts to recompresses a decompressed ID, which could be a UUID or an override string.
@@ -693,7 +691,6 @@ export class IdCompressor {
693
691
  * performance optimization.
694
692
  */
695
693
  recompressInternal(uncompressed, uncompressedUuidNumeric) {
696
- var _a, _b;
697
694
  let numericUuid = uncompressedUuidNumeric;
698
695
  const inversionKey = IdCompressor.createInversionKey(uncompressed);
699
696
  const isStable = IdCompressor.isStableInversionKey(inversionKey);
@@ -704,7 +701,8 @@ export class IdCompressor {
704
701
  if (key === inversionKey) {
705
702
  return IdCompressor.isUnfinalizedOverride(compressionMapping)
706
703
  ? compressionMapping
707
- : (_a = compressionMapping.associatedLocalId) !== null && _a !== void 0 ? _a : compressionMapping.originalOverridingFinal;
704
+ : compressionMapping.associatedLocalId ??
705
+ compressionMapping.originalOverridingFinal;
708
706
  }
709
707
  }
710
708
  else {
@@ -712,11 +710,11 @@ export class IdCompressor {
712
710
  return undefined;
713
711
  }
714
712
  const { clusterBase: closestBaseFinalId, cluster: closestCluster } = compressionMapping;
715
- numericUuid !== null && numericUuid !== void 0 ? numericUuid : (numericUuid = numericUuidFromStableId(inversionKey));
713
+ numericUuid ?? (numericUuid = numericUuidFromStableId(inversionKey));
716
714
  const uuidOffset = getPositiveDelta(numericUuid, closestCluster.baseUuid, closestCluster.count - 1);
717
715
  if (uuidOffset !== undefined) {
718
716
  let targetFinalId = (closestBaseFinalId + uuidOffset);
719
- const override = (_b = closestCluster.overrides) === null || _b === void 0 ? void 0 : _b.get(targetFinalId);
717
+ const override = closestCluster.overrides?.get(targetFinalId);
720
718
  if (typeof override === "object") {
721
719
  if (override.associatedLocalId !== undefined) {
722
720
  return override.associatedLocalId;
@@ -731,7 +729,7 @@ export class IdCompressor {
731
729
  }
732
730
  if (isStable) {
733
731
  // May have already computed the numeric UUID, so avoid recomputing if possible
734
- const sessionSpaceId = this.getCompressedIdForStableId(numericUuid !== null && numericUuid !== void 0 ? numericUuid : inversionKey);
732
+ const sessionSpaceId = this.getCompressedIdForStableId(numericUuid ?? inversionKey);
735
733
  if (sessionSpaceId !== undefined) {
736
734
  return sessionSpaceId;
737
735
  }
@@ -744,7 +742,6 @@ export class IdCompressor {
744
742
  * @returns the ID in op space.
745
743
  */
746
744
  normalizeToOpSpace(id) {
747
- var _a, _b, _c;
748
745
  if (isFinalId(id)) {
749
746
  return id;
750
747
  }
@@ -763,7 +760,8 @@ export class IdCompressor {
763
760
  const override = this.localOverrides.get(id);
764
761
  if (override !== undefined) {
765
762
  const inversionKey = IdCompressor.createInversionKey(override);
766
- const compressionMapping = (_a = this.clustersAndOverridesInversion.get(inversionKey)) !== null && _a !== void 0 ? _a : fail("Bimap is malformed.");
763
+ const compressionMapping = this.clustersAndOverridesInversion.get(inversionKey) ??
764
+ fail("Bimap is malformed.");
767
765
  return !IdCompressor.isClusterInfo(compressionMapping) &&
768
766
  !IdCompressor.isUnfinalizedOverride(compressionMapping) &&
769
767
  compressionMapping.associatedLocalId === id
@@ -771,9 +769,10 @@ export class IdCompressor {
771
769
  : id;
772
770
  }
773
771
  const possibleFinal = this.sessionIdNormalizer.getFinalId(id);
774
- return (_b = possibleFinal === null || possibleFinal === void 0 ? void 0 : possibleFinal[0]) !== null && _b !== void 0 ? _b : id;
772
+ return possibleFinal?.[0] ?? id;
775
773
  }
776
- const [correspondingFinal, cluster] = (_c = this.sessionIdNormalizer.getFinalId(id)) !== null && _c !== void 0 ? _c : fail("Locally created cluster should be added to the map when allocated");
774
+ const [correspondingFinal, cluster] = this.sessionIdNormalizer.getFinalId(id) ??
775
+ fail("Locally created cluster should be added to the map when allocated");
777
776
  if (cluster.overrides) {
778
777
  const override = cluster.overrides.get(correspondingFinal);
779
778
  if (typeof override === "object" && override.originalOverridingFinal !== undefined) {
@@ -784,7 +783,6 @@ export class IdCompressor {
784
783
  return correspondingFinal;
785
784
  }
786
785
  normalizeToSessionSpace(id, sessionIdIfLocal) {
787
- var _a, _b, _c, _d;
788
786
  if (isLocalId(id)) {
789
787
  if (sessionIdIfLocal === undefined || sessionIdIfLocal === this.localSessionId) {
790
788
  const localIndex = -id;
@@ -794,10 +792,12 @@ export class IdCompressor {
794
792
  return id;
795
793
  }
796
794
  else {
797
- const session = (_a = this.sessions.get(sessionIdIfLocal)) !== null && _a !== void 0 ? _a : fail("No IDs have ever been finalized by the supplied session.");
795
+ const session = this.sessions.get(sessionIdIfLocal) ??
796
+ fail("No IDs have ever been finalized by the supplied session.");
798
797
  const localCount = -id;
799
798
  const numericUuid = incrementUuid(session.sessionUuid, localCount - 1);
800
- return ((_b = this.compressNumericUuid(numericUuid)) !== null && _b !== void 0 ? _b : fail("ID is not known to this compressor."));
799
+ return (this.compressNumericUuid(numericUuid) ??
800
+ fail("ID is not known to this compressor."));
801
801
  }
802
802
  }
803
803
  const normalizedId = this.sessionIdNormalizer.getSessionSpaceId(id);
@@ -806,8 +806,9 @@ export class IdCompressor {
806
806
  }
807
807
  // Check for a unified override finalized first by another session but to which the local session
808
808
  // still has an associated local ID.
809
- const [_, cluster] = (_c = this.getClusterForFinalId(id)) !== null && _c !== void 0 ? _c : fail("Supplied final ID was not finalized by this compressor.");
810
- const override = (_d = cluster.overrides) === null || _d === void 0 ? void 0 : _d.get(id);
809
+ const [_, cluster] = this.getClusterForFinalId(id) ??
810
+ fail("Supplied final ID was not finalized by this compressor.");
811
+ const override = cluster.overrides?.get(id);
811
812
  if (typeof override === "object" && override.associatedLocalId !== undefined) {
812
813
  return override.associatedLocalId;
813
814
  }
@@ -976,7 +977,6 @@ export class IdCompressor {
976
977
  return true;
977
978
  }
978
979
  static idClustersEqual(a, b, checkSessionData = true, compareLocalState = true) {
979
- var _a, _b;
980
980
  const areEqual = numericUuidEquals(a.baseUuid, b.baseUuid) &&
981
981
  a.capacity === b.capacity &&
982
982
  a.count === b.count &&
@@ -984,7 +984,7 @@ export class IdCompressor {
984
984
  IdCompressor.sessionDataEqual(a.session, b.session, false, compareLocalState)) &&
985
985
  (a.overrides === undefined) === (b.overrides === undefined) &&
986
986
  (a.overrides === undefined ||
987
- compareMaps((_a = a.overrides) !== null && _a !== void 0 ? _a : fail("Overrides must be defined"), (_b = b.overrides) !== null && _b !== void 0 ? _b : fail("Overrides must be defined"), (overrideA, overrideB) => {
987
+ compareMaps(a.overrides ?? fail("Overrides must be defined"), b.overrides ?? fail("Overrides must be defined"), (overrideA, overrideB) => {
988
988
  if (compareLocalState) {
989
989
  if (typeof overrideA === "string" || typeof overrideB === "string") {
990
990
  return overrideA === overrideB;
@@ -1008,7 +1008,6 @@ export class IdCompressor {
1008
1008
  return areEqual;
1009
1009
  }
1010
1010
  serialize(withSession) {
1011
- var _a, _b;
1012
1011
  const serializedSessions = [];
1013
1012
  const sessionIdToSessionIndex = new Map();
1014
1013
  for (const [sessionId, session] of this.sessions) {
@@ -1026,7 +1025,8 @@ export class IdCompressor {
1026
1025
  for (const [baseFinalId, cluster] of this.finalIdToCluster.entries()) {
1027
1026
  const sessionId = stableIdFromNumericUuid(cluster.session.sessionUuid);
1028
1027
  if (sessionId !== reservedSessionId) {
1029
- const sessionIndex = (_a = sessionIdToSessionIndex.get(sessionId)) !== null && _a !== void 0 ? _a : fail("Session object contains wrong session numeric UUID");
1028
+ const sessionIndex = sessionIdToSessionIndex.get(sessionId) ??
1029
+ fail("Session object contains wrong session numeric UUID");
1030
1030
  const serializedCluster = [
1031
1031
  sessionIndex,
1032
1032
  cluster.capacity,
@@ -1078,7 +1078,7 @@ export class IdCompressor {
1078
1078
  }
1079
1079
  return serializedWithSession;
1080
1080
  }
1081
- (_b = this.logger) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent({
1081
+ this.logger?.sendTelemetryEvent({
1082
1082
  eventName: "RuntimeIdCompressor:SerializedIdCompressorSize",
1083
1083
  size: JSON.stringify(serializedIdCompressor).length,
1084
1084
  clusterCount: serializedIdCompressor.clusters.length,
@@ -1139,7 +1139,7 @@ export class IdCompressor {
1139
1139
  baseUuid: incrementUuid(sessionUuid, currentIdCount),
1140
1140
  session,
1141
1141
  };
1142
- const lastFinalizedNormalized = lastFinalizedLocalId !== null && lastFinalizedLocalId !== void 0 ? lastFinalizedLocalId : 0;
1142
+ const lastFinalizedNormalized = lastFinalizedLocalId ?? 0;
1143
1143
  const clusterBase = compressor.nextClusterBaseFinalId;
1144
1144
  session.lastFinalizedLocalId = (lastFinalizedNormalized - count);
1145
1145
  session.currentClusterDetails = { clusterBase, cluster };
@@ -1193,8 +1193,8 @@ export class IdCompressor {
1193
1193
  }
1194
1194
  if (serializedLocalState !== undefined) {
1195
1195
  compressor.sessionIdNormalizer = SessionIdNormalizer.deserialize(serializedLocalState.sessionNormalizer, (finalId) => {
1196
- var _a;
1197
- const [_, cluster] = (_a = compressor.finalIdToCluster.getPairOrNextLower(finalId)) !== null && _a !== void 0 ? _a : fail("Final in serialized normalizer was never created.");
1196
+ const [_, cluster] = compressor.finalIdToCluster.getPairOrNextLower(finalId) ??
1197
+ fail("Final in serialized normalizer was never created.");
1198
1198
  return cluster;
1199
1199
  });
1200
1200
  }