@fluidframework/container-runtime 2.0.0-internal.5.4.2 → 2.0.0-internal.6.0.1

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