@fluid-experimental/tree 0.59.2001 → 0.59.3000
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.
- package/.eslintrc.js +2 -0
- package/.vscode/SharedTree.code-workspace +15 -0
- package/.vscode/settings.json +6 -0
- package/dist/ChangeCompression.js +9 -9
- package/dist/ChangeCompression.js.map +1 -1
- package/dist/ChangeTypes.d.ts +1 -6
- package/dist/ChangeTypes.d.ts.map +1 -1
- package/dist/ChangeTypes.js +5 -5
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.js +14 -14
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +21 -3
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js +29 -4
- package/dist/Common.js.map +1 -1
- package/dist/EditLog.js +26 -25
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.js +17 -17
- package/dist/EditUtilities.js.map +1 -1
- package/dist/Forest.js +31 -31
- package/dist/Forest.js.map +1 -1
- package/dist/HistoryEditFactory.js +9 -9
- package/dist/HistoryEditFactory.js.map +1 -1
- package/dist/IdConversion.js +9 -9
- package/dist/IdConversion.js.map +1 -1
- package/dist/Identifiers.d.ts +4 -0
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js.map +1 -1
- package/dist/LogViewer.d.ts +1 -5
- package/dist/LogViewer.d.ts.map +1 -1
- package/dist/LogViewer.js +11 -19
- package/dist/LogViewer.js.map +1 -1
- package/dist/MergeHealth.js +2 -2
- package/dist/MergeHealth.js.map +1 -1
- package/dist/NodeIdUtilities.js +2 -2
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.js +1 -1
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +13 -10
- package/dist/RevisionValueCache.d.ts.map +1 -1
- package/dist/RevisionValueCache.js +14 -11
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.js +4 -4
- package/dist/RevisionView.js.map +1 -1
- package/dist/SerializationUtilities.js +4 -4
- package/dist/SerializationUtilities.js.map +1 -1
- package/dist/SharedTree.d.ts +93 -31
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +160 -131
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +3 -3
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js +36 -36
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/StringInterner.js +1 -1
- package/dist/StringInterner.js.map +1 -1
- package/dist/Summary.js +1 -1
- package/dist/Summary.js.map +1 -1
- package/dist/SummaryBackCompatibility.js +8 -8
- package/dist/SummaryBackCompatibility.js.map +1 -1
- package/dist/Transaction.js +1 -1
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.js +17 -17
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeCompressor.d.ts.map +1 -1
- package/dist/TreeCompressor.js +6 -8
- package/dist/TreeCompressor.js.map +1 -1
- package/dist/TreeNodeHandle.js +4 -4
- package/dist/TreeNodeHandle.js.map +1 -1
- package/dist/TreeView.js +7 -7
- package/dist/TreeView.js.map +1 -1
- package/dist/TreeViewUtilities.js +2 -2
- package/dist/TreeViewUtilities.js.map +1 -1
- package/dist/UndoRedoHandler.js +1 -1
- package/dist/UndoRedoHandler.js.map +1 -1
- package/dist/UuidUtilities.d.ts +30 -0
- package/dist/UuidUtilities.d.ts.map +1 -0
- package/dist/UuidUtilities.js +106 -0
- package/dist/UuidUtilities.js.map +1 -0
- package/dist/id-compressor/AppendOnlySortedMap.d.ts +52 -28
- package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/AppendOnlySortedMap.js +167 -90
- package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/IdCompressor.d.ts +43 -42
- package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
- package/dist/id-compressor/IdCompressor.js +179 -177
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/IdRange.js +1 -1
- package/dist/id-compressor/IdRange.js.map +1 -1
- package/dist/id-compressor/NumericUuid.d.ts +6 -14
- package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
- package/dist/id-compressor/NumericUuid.js +15 -76
- package/dist/id-compressor/NumericUuid.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.d.ts +122 -0
- package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -0
- package/dist/id-compressor/SessionIdNormalizer.js +418 -0
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -0
- package/dist/id-compressor/persisted-types/0.0.1.d.ts +6 -13
- package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
- package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/persisted-types/0.1.1.d.ts +1 -6
- package/dist/persisted-types/0.1.1.d.ts.map +1 -1
- package/dist/persisted-types/0.1.1.js +3 -3
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/lib/ChangeTypes.d.ts +1 -6
- package/lib/ChangeTypes.d.ts.map +1 -1
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +21 -3
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +25 -3
- package/lib/Common.js.map +1 -1
- package/lib/EditLog.js +2 -1
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.js.map +1 -1
- package/lib/Forest.js.map +1 -1
- package/lib/HistoryEditFactory.js.map +1 -1
- package/lib/Identifiers.d.ts +4 -0
- package/lib/Identifiers.d.ts.map +1 -1
- package/lib/Identifiers.js.map +1 -1
- package/lib/LogViewer.d.ts +1 -5
- package/lib/LogViewer.d.ts.map +1 -1
- package/lib/LogViewer.js +5 -13
- package/lib/LogViewer.js.map +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +13 -10
- package/lib/RevisionValueCache.d.ts.map +1 -1
- package/lib/RevisionValueCache.js +10 -7
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.js.map +1 -1
- package/lib/SharedTree.d.ts +93 -31
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +107 -78
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +3 -3
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js +4 -4
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/StringInterner.js.map +1 -1
- package/lib/Summary.js.map +1 -1
- package/lib/TreeCompressor.d.ts.map +1 -1
- package/lib/TreeCompressor.js +1 -3
- package/lib/TreeCompressor.js.map +1 -1
- package/lib/TreeNodeHandle.js.map +1 -1
- package/lib/TreeView.js.map +1 -1
- package/lib/TreeViewUtilities.js.map +1 -1
- package/lib/UuidUtilities.d.ts +30 -0
- package/lib/UuidUtilities.d.ts.map +1 -0
- package/lib/UuidUtilities.js +98 -0
- package/lib/UuidUtilities.js.map +1 -0
- package/lib/id-compressor/AppendOnlySortedMap.d.ts +52 -28
- package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/AppendOnlySortedMap.js +165 -88
- package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/IdCompressor.d.ts +43 -42
- package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
- package/lib/id-compressor/IdCompressor.js +97 -95
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/NumericUuid.d.ts +6 -14
- package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
- package/lib/id-compressor/NumericUuid.js +11 -70
- package/lib/id-compressor/NumericUuid.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.d.ts +122 -0
- package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -0
- package/lib/id-compressor/SessionIdNormalizer.js +414 -0
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -0
- package/lib/id-compressor/persisted-types/0.0.1.d.ts +6 -13
- package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
- package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/persisted-types/0.1.1.d.ts +1 -6
- package/lib/persisted-types/0.1.1.d.ts.map +1 -1
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +6 -0
- package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +1 -0
- package/lib/test/AppendOnlySortedMap.perf.tests.js +49 -0
- package/lib/test/AppendOnlySortedMap.perf.tests.js.map +1 -0
- package/lib/test/AppendOnlySortedMap.tests.js +56 -14
- package/lib/test/AppendOnlySortedMap.tests.js.map +1 -1
- package/lib/test/Checkout.tests.js +2 -2
- package/lib/test/Checkout.tests.js.map +1 -1
- package/lib/test/Forest.tests.js.map +1 -1
- package/lib/test/IdCompressor.perf.tests.js +8 -2
- package/lib/test/IdCompressor.perf.tests.js.map +1 -1
- package/lib/test/IdCompressor.tests.js +75 -24
- package/lib/test/IdCompressor.tests.js.map +1 -1
- package/lib/test/LogViewer.tests.js +3 -5
- package/lib/test/LogViewer.tests.js.map +1 -1
- package/lib/test/NumericUuid.perf.tests.js +4 -4
- package/lib/test/NumericUuid.perf.tests.js.map +1 -1
- package/lib/test/NumericUuid.tests.js +5 -4
- package/lib/test/NumericUuid.tests.js.map +1 -1
- package/lib/test/RevisionValueCache.tests.js.map +1 -1
- package/lib/test/RevisionView.tests.js.map +1 -1
- package/lib/test/SessionIdNormalizer.tests.d.ts +6 -0
- package/lib/test/SessionIdNormalizer.tests.d.ts.map +1 -0
- package/lib/test/SessionIdNormalizer.tests.js +299 -0
- package/lib/test/SessionIdNormalizer.tests.js.map +1 -0
- package/lib/test/Summary.tests.js +1 -1
- package/lib/test/Summary.tests.js.map +1 -1
- package/lib/test/TreeCompression.tests.js +1 -1
- package/lib/test/TreeCompression.tests.js.map +1 -1
- package/lib/test/Virtualization.tests.js +1 -1
- package/lib/test/Virtualization.tests.js.map +1 -1
- package/lib/test/fuzz/Generators.d.ts +3 -14
- package/lib/test/fuzz/Generators.d.ts.map +1 -1
- package/lib/test/fuzz/Generators.js +60 -151
- package/lib/test/fuzz/Generators.js.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +10 -7
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +94 -104
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
- package/lib/test/fuzz/Types.d.ts +2 -9
- package/lib/test/fuzz/Types.d.ts.map +1 -1
- package/lib/test/fuzz/Types.js +1 -1
- package/lib/test/fuzz/Types.js.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts +57 -11
- package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/IdCompressorTestUtilities.js +112 -98
- package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -1
- package/lib/test/utilities/PendingLocalStateTests.js +2 -1
- package/lib/test/utilities/PendingLocalStateTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +30 -1
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +20 -0
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
- package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -1
- package/lib/test/utilities/SummaryLoadPerfTests.js +6 -3
- package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -1
- package/lib/test/utilities/TestNode.js.map +1 -1
- package/lib/test/utilities/TestUtilities.d.ts +9 -1
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +27 -13
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/package.json +19 -17
- package/src/Common.ts +42 -4
- package/src/EditLog.ts +1 -1
- package/src/Identifiers.ts +5 -0
- package/src/LogViewer.ts +4 -20
- package/src/RevisionValueCache.ts +11 -8
- package/src/SharedTree.ts +222 -75
- package/src/SharedTreeEncoder.ts +17 -11
- package/src/TreeCompressor.ts +2 -4
- package/src/UuidUtilities.ts +123 -0
- package/src/id-compressor/AppendOnlySortedMap.ts +183 -94
- package/src/id-compressor/IdCompressor.ts +144 -132
- package/src/id-compressor/NumericUuid.ts +11 -80
- package/src/id-compressor/SessionIdNormalizer.ts +497 -0
- package/src/id-compressor/persisted-types/0.0.1.ts +12 -15
- package/src/index.ts +5 -0
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
6
6
|
import BTree from 'sorted-btree';
|
|
7
|
-
import { assert, assertNotUndefined, compareFiniteNumbers, compareMaps, compareStrings, fail, setPropertyIfDefined, } from '../Common';
|
|
7
|
+
import { assert, hasLength, assertNotUndefined, compareFiniteNumbers, compareFiniteNumbersReversed, compareMaps, compareStrings, fail, getOrCreate, setPropertyIfDefined, } from '../Common';
|
|
8
|
+
import { assertIsStableId, assertIsUuidString, isStableId } from '../UuidUtilities';
|
|
8
9
|
import { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from './AppendOnlySortedMap';
|
|
9
10
|
import { getIds } from './IdRange';
|
|
10
|
-
import { numericUuidEquals, getPositiveDelta, incrementUuid, numericUuidFromStableId, stableIdFromNumericUuid,
|
|
11
|
+
import { numericUuidEquals, getPositiveDelta, incrementUuid, numericUuidFromStableId, stableIdFromNumericUuid, ensureSessionUuid, } from './NumericUuid';
|
|
11
12
|
/**
|
|
12
13
|
* Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
|
|
13
14
|
* This value must *NOT* change without careful consideration to compatibility.
|
|
@@ -98,14 +99,17 @@ const nonStableOverridePrefix = '\ue15e'; // A character in the Private Use Area
|
|
|
98
99
|
*/
|
|
99
100
|
export class IdCompressor {
|
|
100
101
|
/**
|
|
101
|
-
* @param localSessionId the `IdCompressor`'s current local session ID.
|
|
102
|
-
* @param reservedIdCount the number of IDs that will be known by this compressor without relying on consensus.
|
|
103
|
-
* for a given session must be constant for any compressor that contains IDs from that session
|
|
104
|
-
* compressor must have the same reservedIdCount forever). Compressors with different
|
|
105
|
-
* IDs.
|
|
106
|
-
* @param
|
|
102
|
+
* @param localSessionId - the `IdCompressor`'s current local session ID.
|
|
103
|
+
* @param reservedIdCount - the number of IDs that will be known by this compressor without relying on consensus.
|
|
104
|
+
* The reserved ID count for a given session must be constant for any compressor that contains IDs from that session
|
|
105
|
+
* (i.e. any DDS that uses the ID compressor must have the same reservedIdCount forever). Compressors with different
|
|
106
|
+
* reserved ID counts will fail to synchronize their IDs.
|
|
107
|
+
* @param attributionId - a UUID that identifies the user of this instance of the compressor. IDs created by this
|
|
108
|
+
* compressor will be associated with this UUID and can be queried later via `attributeID`. If no UUID is provided,
|
|
109
|
+
* this compressor will generate its own. An `AttributionId` is an `UuidString` which may be validated via
|
|
110
|
+
* {@link isUuidString} or generated via {@link generateStableId}.
|
|
107
111
|
*/
|
|
108
|
-
constructor(localSessionId, reservedIdCount,
|
|
112
|
+
constructor(localSessionId, reservedIdCount, attributionId) {
|
|
109
113
|
this.localSessionId = localSessionId;
|
|
110
114
|
this.reservedIdCount = reservedIdCount;
|
|
111
115
|
/**
|
|
@@ -114,14 +118,10 @@ export class IdCompressor {
|
|
|
114
118
|
*/
|
|
115
119
|
this.newClusterCapacity = defaultClusterCapacity;
|
|
116
120
|
/**
|
|
117
|
-
* Session ID
|
|
121
|
+
* Session ID -\> data about the session's current cluster.
|
|
118
122
|
* Sessions are mutable, and thus should only be created via `createSession`.
|
|
119
123
|
*/
|
|
120
124
|
this.sessions = new Map();
|
|
121
|
-
/**
|
|
122
|
-
* Boolean to track whether attribution has been sent with an ID range yet. Prevents unnecessary bloat of ranges.
|
|
123
|
-
*/
|
|
124
|
-
this.sentAttributionInfo = false;
|
|
125
125
|
/**
|
|
126
126
|
* The base final ID of the next cluster to be created.
|
|
127
127
|
*/
|
|
@@ -137,10 +137,10 @@ export class IdCompressor {
|
|
|
137
137
|
this.localOverrides = new AppendOnlySortedMap(compareFiniteNumbersReversed);
|
|
138
138
|
/**
|
|
139
139
|
* Maps local IDs to the cluster they belong to (if any). This can be used to efficiently convert a local ID to a
|
|
140
|
-
* final ID by finding an entry
|
|
140
|
+
* final ID by finding an entry \<= a given local ID (to find the cluster it is associated with) and checking
|
|
141
141
|
* it against `numFinalizedLocalIds`.
|
|
142
142
|
*/
|
|
143
|
-
this.localIdToCluster = new AppendOnlyDoublySortedMap(compareFiniteNumbersReversed, (value) => value[0],
|
|
143
|
+
this.localIdToCluster = new AppendOnlyDoublySortedMap(compareFiniteNumbersReversed, (value) => value[0], compareFiniteNumbers);
|
|
144
144
|
/**
|
|
145
145
|
* Contains entries for cluster base UUIDs and override strings (both local and final).
|
|
146
146
|
* As a performance optimization, entries for finalized strings also include the containing cluster object.
|
|
@@ -156,7 +156,10 @@ export class IdCompressor {
|
|
|
156
156
|
*/
|
|
157
157
|
this.finalIdToCluster = new AppendOnlySortedMap(compareFiniteNumbers);
|
|
158
158
|
assert(reservedIdCount >= 0, 'reservedIdCount must be non-negative');
|
|
159
|
-
|
|
159
|
+
if (attributionId !== undefined) {
|
|
160
|
+
assertIsUuidString(attributionId);
|
|
161
|
+
}
|
|
162
|
+
this.localSession = this.createSession(localSessionId, attributionId);
|
|
160
163
|
if (reservedIdCount > 0) {
|
|
161
164
|
const clusterCapacity = this.clusterCapacity;
|
|
162
165
|
this.clusterCapacity = reservedIdCount;
|
|
@@ -164,7 +167,7 @@ export class IdCompressor {
|
|
|
164
167
|
sessionId: reservedSessionId,
|
|
165
168
|
ids: {
|
|
166
169
|
last: -reservedIdCount,
|
|
167
|
-
overrides: [[-1, legacySharedTreeInitialTreeId]],
|
|
170
|
+
overrides: [[-1, legacySharedTreeInitialTreeId]], // Kludge: see `initialTreeId`
|
|
168
171
|
},
|
|
169
172
|
};
|
|
170
173
|
// Reserved final IDs are implicitly finalized and no one locally created them, so finalizing immediately is safe.
|
|
@@ -187,6 +190,12 @@ export class IdCompressor {
|
|
|
187
190
|
assert(value <= IdCompressor.maxClusterSize, 'Clusters must not exceed max cluster size');
|
|
188
191
|
this.newClusterCapacity = value;
|
|
189
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* The UUID used for attribution of identities created by this compressor
|
|
195
|
+
*/
|
|
196
|
+
get attributionId() {
|
|
197
|
+
return this.localSession.attributionId;
|
|
198
|
+
}
|
|
190
199
|
/**
|
|
191
200
|
* Helper comparator for searching append-only sorted maps.
|
|
192
201
|
*/
|
|
@@ -196,31 +205,28 @@ export class IdCompressor {
|
|
|
196
205
|
/**
|
|
197
206
|
* Creates a session object for the supplied ID.
|
|
198
207
|
* Must only be called once per ID.
|
|
199
|
-
* @param sessionId the ID for the session
|
|
208
|
+
* @param sessionId - the ID for the session
|
|
200
209
|
* @returns the session object for the supplied ID
|
|
201
210
|
*/
|
|
202
|
-
createSession(sessionId,
|
|
211
|
+
createSession(sessionId, attributionId) {
|
|
212
|
+
assert(!this.clustersAndOverridesInversion.has(sessionId));
|
|
203
213
|
const existingSession = this.sessions.get(sessionId);
|
|
204
214
|
if (existingSession !== undefined) {
|
|
205
215
|
fail('createSession must only be called once for each session ID.');
|
|
206
216
|
}
|
|
207
217
|
const sessionUuid = numericUuidFromStableId(sessionId);
|
|
208
|
-
assert(!this.clustersAndOverridesInversion.has(sessionId));
|
|
209
218
|
const session = {
|
|
210
219
|
sessionUuid,
|
|
211
220
|
currentClusterDetails: undefined,
|
|
212
221
|
lastFinalizedLocalId: undefined,
|
|
222
|
+
attributionId: attributionId !== null && attributionId !== void 0 ? attributionId : sessionId,
|
|
213
223
|
};
|
|
214
|
-
setPropertyIfDefined(attributionInfo, session, 'attributionInfo');
|
|
215
224
|
this.sessions.set(sessionId, session);
|
|
216
225
|
return session;
|
|
217
226
|
}
|
|
218
|
-
tryGetSession(sessionId) {
|
|
219
|
-
return this.sessions.get(sessionId);
|
|
220
|
-
}
|
|
221
227
|
/**
|
|
222
228
|
* Return the nth reserved ID.
|
|
223
|
-
* @param index the index of the ID to return
|
|
229
|
+
* @param index - the index of the ID to return
|
|
224
230
|
*/
|
|
225
231
|
getReservedId(index) {
|
|
226
232
|
if (index < 0 || index >= this.reservedIdCount) {
|
|
@@ -240,16 +246,16 @@ export class IdCompressor {
|
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
/**
|
|
243
|
-
* Returns the attribution
|
|
249
|
+
* Returns the attribution ID associated with the compressor that created the ID
|
|
244
250
|
*/
|
|
245
251
|
attributeId(id) {
|
|
246
252
|
var _a;
|
|
247
253
|
const opSpaceNormalizedId = this.normalizeToOpSpace(id);
|
|
248
254
|
if (isLocalId(opSpaceNormalizedId)) {
|
|
249
|
-
return this.
|
|
255
|
+
return this.attributionId;
|
|
250
256
|
}
|
|
251
257
|
const [_, cluster] = (_a = this.getClusterForFinalId(opSpaceNormalizedId)) !== null && _a !== void 0 ? _a : fail('Cluster does not exist for final ID');
|
|
252
|
-
return cluster.session.
|
|
258
|
+
return cluster.session.attributionId;
|
|
253
259
|
}
|
|
254
260
|
/**
|
|
255
261
|
* Provides the session-space IDs corresponding to a range of IDs.
|
|
@@ -270,7 +276,7 @@ export class IdCompressor {
|
|
|
270
276
|
};
|
|
271
277
|
}
|
|
272
278
|
else {
|
|
273
|
-
const session = (_a = this.
|
|
279
|
+
const session = (_a = this.sessions.get(sessionId)) !== null && _a !== void 0 ? _a : fail('Unknown session, range may not be finalized.');
|
|
274
280
|
const firstNumericUuid = incrementUuid(session.sessionUuid, -first - 1);
|
|
275
281
|
const firstFinal = (_b = this.compressNumericUuid(firstNumericUuid)) !== null && _b !== void 0 ? _b : fail('Remote range must be finalized before getting IDs.');
|
|
276
282
|
assert(isFinalId(firstFinal), 'ID from a remote session ID must have final form, as overrides are impossible by definition.');
|
|
@@ -316,15 +322,15 @@ export class IdCompressor {
|
|
|
316
322
|
const lastLocalInRange = -this.localIdCount;
|
|
317
323
|
const lastTakenNormalized = (_a = this.lastTakenLocalId) !== null && _a !== void 0 ? _a : 0;
|
|
318
324
|
assert(lastLocalInRange <= lastTakenNormalized);
|
|
325
|
+
// The attribution ID is sent with each range, but it can be elided after the first IDs are allocated.
|
|
326
|
+
const sendAttributionId = this.lastTakenLocalId === undefined;
|
|
319
327
|
let ids;
|
|
320
328
|
if (lastLocalInRange !== lastTakenNormalized) {
|
|
321
329
|
const firstLocalInRange = (lastTakenNormalized - 1);
|
|
322
|
-
const
|
|
330
|
+
const overrides = [
|
|
323
331
|
...this.localOverrides.getRange((lastTakenNormalized - 1), lastLocalInRange),
|
|
324
332
|
];
|
|
325
|
-
if (
|
|
326
|
-
// Cast: typecript 4.4.4 doesn't infer that `localOverrides` has at least one element and is therefore an `Overrides`
|
|
327
|
-
const overrides = localOverrides;
|
|
333
|
+
if (hasLength(overrides, 1)) {
|
|
328
334
|
assert(overrides[0][0] <= firstLocalInRange);
|
|
329
335
|
assert(overrides[overrides.length - 1][0] >= lastLocalInRange);
|
|
330
336
|
ids = {
|
|
@@ -344,9 +350,8 @@ export class IdCompressor {
|
|
|
344
350
|
this.lastTakenLocalId = lastLocalInRange;
|
|
345
351
|
}
|
|
346
352
|
const range = { sessionId: this.localSessionId };
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
this.sentAttributionInfo = true;
|
|
353
|
+
if (this.attributionId !== this.localSessionId && sendAttributionId) {
|
|
354
|
+
range.attributionId = this.attributionId;
|
|
350
355
|
}
|
|
351
356
|
if (ids === undefined) {
|
|
352
357
|
return range;
|
|
@@ -357,15 +362,14 @@ export class IdCompressor {
|
|
|
357
362
|
}
|
|
358
363
|
/**
|
|
359
364
|
* Finalizes the supplied range of IDs (which may be from either a remote or local session).
|
|
360
|
-
* @param range the range of session-local IDs to finalize.
|
|
365
|
+
* @param range - the range of session-local IDs to finalize.
|
|
361
366
|
*/
|
|
362
367
|
finalizeCreationRange(range) {
|
|
363
|
-
var _a, _b;
|
|
364
|
-
const { sessionId,
|
|
368
|
+
var _a, _b, _c;
|
|
369
|
+
const { sessionId, attributionId } = range;
|
|
365
370
|
const isLocal = sessionId === this.localSessionId;
|
|
366
|
-
|
|
367
|
-
assert(range.
|
|
368
|
-
session !== null && session !== void 0 ? session : (session = this.createSession(sessionId, attributionInfo));
|
|
371
|
+
const session = (_a = this.sessions.get(sessionId)) !== null && _a !== void 0 ? _a : this.createSession(sessionId, attributionId);
|
|
372
|
+
assert(range.attributionId === undefined || range.attributionId === session.attributionId, "A session's attribution ID may never be modified.");
|
|
369
373
|
const ids = getIds(range);
|
|
370
374
|
if (ids === undefined) {
|
|
371
375
|
return;
|
|
@@ -375,7 +379,7 @@ export class IdCompressor {
|
|
|
375
379
|
cluster: undefined,
|
|
376
380
|
clusterBase: undefined,
|
|
377
381
|
};
|
|
378
|
-
const normalizedLastFinalized = (
|
|
382
|
+
const normalizedLastFinalized = (_b = session.lastFinalizedLocalId) !== null && _b !== void 0 ? _b : 0;
|
|
379
383
|
const { first: newFirstFinalizedLocalId, last: newLastFinalizedLocalId } = ids;
|
|
380
384
|
assert(newFirstFinalizedLocalId === normalizedLastFinalized - 1, 'Ranges finalized out of order.');
|
|
381
385
|
// The total number of session-local IDs to finalize
|
|
@@ -481,9 +485,8 @@ export class IdCompressor {
|
|
|
481
485
|
(normalizedLastFinalized - overriddenLocal) -
|
|
482
486
|
1);
|
|
483
487
|
}
|
|
484
|
-
(
|
|
488
|
+
(_c = cluster.overrides) !== null && _c !== void 0 ? _c : (cluster.overrides = new Map());
|
|
485
489
|
const inversionKey = IdCompressor.createInversionKey(override);
|
|
486
|
-
// TODO: This cast can be removed on typescript 4.6
|
|
487
490
|
const existingIds = this.getExistingIdsForNewOverride(inversionKey, true);
|
|
488
491
|
let overrideForCluster;
|
|
489
492
|
let associatedLocal;
|
|
@@ -578,7 +581,6 @@ export class IdCompressor {
|
|
|
578
581
|
return typeof compressionMapping === 'number';
|
|
579
582
|
}
|
|
580
583
|
static createInversionKey(inversionKey) {
|
|
581
|
-
// TODO: This cast can be removed on typescript 4.6
|
|
582
584
|
return isStableId(inversionKey) ? inversionKey : `${nonStableOverridePrefix}${inversionKey}`;
|
|
583
585
|
}
|
|
584
586
|
static isStableInversionKey(inversionKey) {
|
|
@@ -638,7 +640,7 @@ export class IdCompressor {
|
|
|
638
640
|
}
|
|
639
641
|
/**
|
|
640
642
|
* Check if `a` might be within `range` of `b`, where both are treated as hex numbers.
|
|
641
|
-
* @param range an integer
|
|
643
|
+
* @param range - an integer
|
|
642
644
|
*/
|
|
643
645
|
static uuidsMightCollide(a, b, range) {
|
|
644
646
|
// Check if any of the UUIDs in the cluster collide (i.e. any in [base, base + capacity)).
|
|
@@ -668,7 +670,7 @@ export class IdCompressor {
|
|
|
668
670
|
/**
|
|
669
671
|
* Generates a new compressed ID or returns an existing one.
|
|
670
672
|
* This should ONLY be called to generate IDs for local operations.
|
|
671
|
-
* @param override Specifies a specific string to be associated with the returned compressed ID.
|
|
673
|
+
* @param override - Specifies a specific string to be associated with the returned compressed ID.
|
|
672
674
|
* Performance note: assigning override strings incurs a performance overhead.
|
|
673
675
|
* @returns an existing ID if one already exists for `override`, and a new local ID otherwise. The returned ID is in session space.
|
|
674
676
|
*/
|
|
@@ -696,7 +698,7 @@ export class IdCompressor {
|
|
|
696
698
|
/**
|
|
697
699
|
* Generates a range of compressed IDs.
|
|
698
700
|
* This should ONLY be called to generate IDs for local operations.
|
|
699
|
-
* @param count the number of IDs to generate, must be
|
|
701
|
+
* @param count - the number of IDs to generate, must be \> 0.
|
|
700
702
|
* @returns a persistable descriptor of the ID range.
|
|
701
703
|
*/
|
|
702
704
|
generateCompressedIdRange(count) {
|
|
@@ -711,7 +713,7 @@ export class IdCompressor {
|
|
|
711
713
|
}
|
|
712
714
|
/**
|
|
713
715
|
* Decompresses a previously compressed ID into a UUID or override string.
|
|
714
|
-
* @param id the compressed ID to be decompressed.
|
|
716
|
+
* @param id - the compressed ID to be decompressed.
|
|
715
717
|
* @returns the UUID or override string associated with the compressed ID. Fails if the ID was not generated by this compressor.
|
|
716
718
|
*/
|
|
717
719
|
decompress(id) {
|
|
@@ -720,7 +722,7 @@ export class IdCompressor {
|
|
|
720
722
|
}
|
|
721
723
|
/**
|
|
722
724
|
* Attempts to decompress a previously compressed ID into a UUID or override string.
|
|
723
|
-
* @param id the compressed ID to be decompressed.
|
|
725
|
+
* @param id - the compressed ID to be decompressed.
|
|
724
726
|
* @returns the UUID or override string associated with the compressed ID, or undefined if the ID was not generated by this compressor.
|
|
725
727
|
*/
|
|
726
728
|
tryDecompress(id) {
|
|
@@ -762,7 +764,7 @@ export class IdCompressor {
|
|
|
762
764
|
}
|
|
763
765
|
/**
|
|
764
766
|
* Recompresses a decompressed ID, which could be a UUID or an override string.
|
|
765
|
-
* @param uncompressed the UUID or override string to recompress.
|
|
767
|
+
* @param uncompressed - the UUID or override string to recompress.
|
|
766
768
|
* @returns the `CompressedId` associated with `uncompressed`. Fails if it has not been previously compressed by this compressor.
|
|
767
769
|
*/
|
|
768
770
|
recompress(uncompressed) {
|
|
@@ -771,7 +773,7 @@ export class IdCompressor {
|
|
|
771
773
|
}
|
|
772
774
|
/**
|
|
773
775
|
* Attempts to recompresses a decompressed ID, which could be a UUID or an override string.
|
|
774
|
-
* @param uncompressed the UUID or override string to recompress,
|
|
776
|
+
* @param uncompressed - the UUID or override string to recompress,
|
|
775
777
|
* @returns the `CompressedId` associated with `uncompressed` or undefined if it has not been previously compressed by this compressor.
|
|
776
778
|
*/
|
|
777
779
|
tryRecompress(uncompressed) {
|
|
@@ -784,7 +786,6 @@ export class IdCompressor {
|
|
|
784
786
|
recompressInternal(uncompressed, uncompressedUuidNumeric) {
|
|
785
787
|
var _a, _b;
|
|
786
788
|
let numericUuid = uncompressedUuidNumeric;
|
|
787
|
-
// TODO: This cast can be removed on typescript 4.6, and should give improved typesafety.
|
|
788
789
|
const inversionKey = IdCompressor.createInversionKey(uncompressed);
|
|
789
790
|
const isStable = IdCompressor.isStableInversionKey(inversionKey);
|
|
790
791
|
const closestMatch = this.clustersAndOverridesInversion.getPairOrNextLower(inversionKey, reusedArray);
|
|
@@ -827,7 +828,6 @@ export class IdCompressor {
|
|
|
827
828
|
}
|
|
828
829
|
if (isStable) {
|
|
829
830
|
// May have already computed the numeric UUID, so avoid recomputing if possible
|
|
830
|
-
// TODO: This cast can be removed on typescript 4.6
|
|
831
831
|
const localId = this.getLocalIdForStableId(numericUuid !== null && numericUuid !== void 0 ? numericUuid : inversionKey);
|
|
832
832
|
if (localId !== undefined) {
|
|
833
833
|
return localId;
|
|
@@ -837,7 +837,7 @@ export class IdCompressor {
|
|
|
837
837
|
}
|
|
838
838
|
/**
|
|
839
839
|
* Normalizes a session space ID into op space.
|
|
840
|
-
* @param id the local ID to normalize.
|
|
840
|
+
* @param id - the local ID to normalize.
|
|
841
841
|
* @returns the ID in op space.
|
|
842
842
|
*/
|
|
843
843
|
normalizeToOpSpace(id) {
|
|
@@ -887,7 +887,7 @@ export class IdCompressor {
|
|
|
887
887
|
return id;
|
|
888
888
|
}
|
|
889
889
|
else {
|
|
890
|
-
const session = this.
|
|
890
|
+
const session = this.sessions.get(originSessionId !== null && originSessionId !== void 0 ? originSessionId : fail());
|
|
891
891
|
if (session === undefined) {
|
|
892
892
|
fail('No IDs have ever been finalized by the supplied session.');
|
|
893
893
|
}
|
|
@@ -942,8 +942,7 @@ export class IdCompressor {
|
|
|
942
942
|
return sessionSpaceId;
|
|
943
943
|
}
|
|
944
944
|
getLocalIdForStableId(stableId) {
|
|
945
|
-
|
|
946
|
-
const numericUuid = (typeof stableId === 'string' ? numericUuidFromStableId(stableId) : stableId);
|
|
945
|
+
const numericUuid = typeof stableId === 'string' ? numericUuidFromStableId(stableId) : stableId;
|
|
947
946
|
const offset = getPositiveDelta(numericUuid, this.localSession.sessionUuid, this.localIdCount - 1);
|
|
948
947
|
if (offset === undefined) {
|
|
949
948
|
return undefined;
|
|
@@ -962,15 +961,15 @@ export class IdCompressor {
|
|
|
962
961
|
return possibleCluster;
|
|
963
962
|
}
|
|
964
963
|
/**
|
|
965
|
-
* @returns if `other` is equal to this `IdCompressor`. The equality check includes local session state.
|
|
966
|
-
*
|
|
964
|
+
* @returns if `other` is equal to this `IdCompressor`. The equality check includes local session state only if specified.
|
|
965
|
+
* \@testOnly
|
|
967
966
|
*/
|
|
968
967
|
equals(other, compareLocalState) {
|
|
969
968
|
if (compareLocalState) {
|
|
970
969
|
if (this.localIdCount !== other.localIdCount ||
|
|
971
970
|
this.localSessionId !== other.localSessionId ||
|
|
972
971
|
this.lastTakenLocalId !== other.lastTakenLocalId ||
|
|
973
|
-
this.
|
|
972
|
+
this.attributionId !== other.attributionId) {
|
|
974
973
|
return false;
|
|
975
974
|
}
|
|
976
975
|
if (!this.localOverrides.equals(other.localOverrides, (a, b) => a === b)) {
|
|
@@ -1052,7 +1051,7 @@ export class IdCompressor {
|
|
|
1052
1051
|
return diff === undefined;
|
|
1053
1052
|
}
|
|
1054
1053
|
static sessionDataEqual(a, b, checkCluster = true, compareLocalState = true) {
|
|
1055
|
-
if (a.
|
|
1054
|
+
if (a.attributionId !== b.attributionId ||
|
|
1056
1055
|
!numericUuidEquals(a.sessionUuid, b.sessionUuid) ||
|
|
1057
1056
|
a.lastFinalizedLocalId !== b.lastFinalizedLocalId) {
|
|
1058
1057
|
return false;
|
|
@@ -1101,6 +1100,8 @@ export class IdCompressor {
|
|
|
1101
1100
|
var _a;
|
|
1102
1101
|
const serializedSessions = [];
|
|
1103
1102
|
const sessionIdToSessionIndex = new Map();
|
|
1103
|
+
const attributionIdToAttributionIndex = new Map();
|
|
1104
|
+
let serializedAttributionIds;
|
|
1104
1105
|
for (const [sessionId, session] of this.sessions) {
|
|
1105
1106
|
const isLocalSession = sessionId === this.localSessionId;
|
|
1106
1107
|
const includeSession = sessionId !== reservedSessionId && // Ignore reserved clusters, but
|
|
@@ -1108,8 +1109,10 @@ export class IdCompressor {
|
|
|
1108
1109
|
(isLocalSession && withSession)); // include the un-acked local session if requested
|
|
1109
1110
|
if (includeSession) {
|
|
1110
1111
|
const sessionData = [sessionId];
|
|
1111
|
-
if (session.
|
|
1112
|
-
|
|
1112
|
+
if (session.attributionId !== sessionId) {
|
|
1113
|
+
// As an optimization, don't include the attributionId if it is its default (the sessionId)
|
|
1114
|
+
// Get the index into the array for the given attribution ID. If it doesn't exist, push it onto the array and update the map.
|
|
1115
|
+
sessionData.push(getOrCreate(attributionIdToAttributionIndex, session.attributionId, (id) => (serializedAttributionIds !== null && serializedAttributionIds !== void 0 ? serializedAttributionIds : (serializedAttributionIds = [])).push(id) - 1));
|
|
1113
1116
|
}
|
|
1114
1117
|
sessionIdToSessionIndex.set(sessionId, serializedSessions.length);
|
|
1115
1118
|
serializedSessions.push(sessionData);
|
|
@@ -1156,6 +1159,7 @@ export class IdCompressor {
|
|
|
1156
1159
|
sessions: serializedSessions,
|
|
1157
1160
|
clusters: serializedClusters,
|
|
1158
1161
|
};
|
|
1162
|
+
setPropertyIfDefined(serializedAttributionIds, serializedIdCompressor, 'attributionIds');
|
|
1159
1163
|
if (withSession) {
|
|
1160
1164
|
const serializedWithSession = serializedIdCompressor;
|
|
1161
1165
|
serializedWithSession.localSessionIndex = serializedWithSession.sessions.findIndex(([sessionId]) => sessionId === this.localSessionId);
|
|
@@ -1164,40 +1168,41 @@ export class IdCompressor {
|
|
|
1164
1168
|
localIdCount: this.localIdCount,
|
|
1165
1169
|
overrides: [...this.localOverrides.entries()].map((entry) => [...entry]),
|
|
1166
1170
|
lastTakenLocalId: this.lastTakenLocalId,
|
|
1167
|
-
sentAttributionInfo: this.sentAttributionInfo,
|
|
1168
1171
|
};
|
|
1169
1172
|
}
|
|
1170
1173
|
return serializedWithSession;
|
|
1171
1174
|
}
|
|
1172
1175
|
return serializedIdCompressor;
|
|
1173
1176
|
}
|
|
1174
|
-
static deserialize(
|
|
1175
|
-
const
|
|
1177
|
+
static deserialize(...args) {
|
|
1178
|
+
const [serialized, newSessionIdMaybe, attributionIdMaybe] = args;
|
|
1179
|
+
const { clusterCapacity, reservedIdCount, sessions: serializedSessions, clusters: serializedClusters, attributionIds: serializedAttributionIds, } = serialized;
|
|
1176
1180
|
let localSessionId;
|
|
1177
|
-
let
|
|
1181
|
+
let attributionId;
|
|
1178
1182
|
let serializedLocalState;
|
|
1179
|
-
if (
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1183
|
+
if (newSessionIdMaybe === undefined) {
|
|
1184
|
+
// Alias of serialized, but known to be a SerializedIdCompressorWithOngoingSession
|
|
1185
|
+
const [serializedWithSession] = args;
|
|
1186
|
+
const serializedSessionData = serializedSessions[serializedWithSession.localSessionIndex];
|
|
1187
|
+
localSessionId = serializedSessionData[0];
|
|
1188
|
+
const attributionIndex = serializedSessionData[1];
|
|
1189
|
+
if (attributionIndex !== undefined) {
|
|
1190
|
+
assert(serializedAttributionIds !== undefined && serializedAttributionIds.length > attributionIndex);
|
|
1191
|
+
attributionId = serializedAttributionIds[attributionIndex];
|
|
1192
|
+
}
|
|
1193
|
+
serializedLocalState = serializedWithSession.localState;
|
|
1186
1194
|
}
|
|
1187
1195
|
else {
|
|
1188
|
-
assert(newSessionIdMaybe !== undefined);
|
|
1189
1196
|
localSessionId = newSessionIdMaybe;
|
|
1190
|
-
|
|
1197
|
+
attributionId = attributionIdMaybe;
|
|
1191
1198
|
}
|
|
1192
|
-
const
|
|
1193
|
-
const compressor = new IdCompressor(localSessionId, reservedIdCount, attributionInfo);
|
|
1199
|
+
const compressor = new IdCompressor(localSessionId, reservedIdCount, attributionId);
|
|
1194
1200
|
compressor.clusterCapacity = clusterCapacity;
|
|
1195
1201
|
const localOverridesInverse = new Map();
|
|
1196
1202
|
if (serializedLocalState !== undefined) {
|
|
1197
1203
|
// Do this part of local rehydration first since the cluster map population needs to query to local overrides
|
|
1198
1204
|
compressor.localIdCount = serializedLocalState.localIdCount;
|
|
1199
1205
|
compressor.lastTakenLocalId = serializedLocalState.lastTakenLocalId;
|
|
1200
|
-
compressor.sentAttributionInfo = serializedLocalState.sentAttributionInfo;
|
|
1201
1206
|
if (serializedLocalState.overrides !== undefined) {
|
|
1202
1207
|
for (const [localId, override] of serializedLocalState.overrides) {
|
|
1203
1208
|
compressor.localOverrides.append(localId, override);
|
|
@@ -1208,13 +1213,18 @@ export class IdCompressor {
|
|
|
1208
1213
|
}
|
|
1209
1214
|
const sessionInfos = [];
|
|
1210
1215
|
for (const serializedSession of serializedSessions) {
|
|
1211
|
-
const [sessionId,
|
|
1216
|
+
const [sessionId, attributionIndex] = serializedSession;
|
|
1212
1217
|
if (sessionId === localSessionId) {
|
|
1213
|
-
assert(
|
|
1218
|
+
assert(hasOngoingSession(serialized), 'Cannot resume existing session.');
|
|
1214
1219
|
sessionInfos.push({ session: compressor.localSession, sessionId });
|
|
1215
1220
|
}
|
|
1216
1221
|
else {
|
|
1217
|
-
|
|
1222
|
+
let attributionId;
|
|
1223
|
+
if (attributionIndex !== undefined) {
|
|
1224
|
+
assert(serializedAttributionIds !== undefined && serializedAttributionIds.length > attributionIndex, 'AttributionId index out of bounds');
|
|
1225
|
+
attributionId = serializedAttributionIds[attributionIndex];
|
|
1226
|
+
}
|
|
1227
|
+
const session = compressor.createSession(sessionId, attributionId);
|
|
1218
1228
|
sessionInfos.push({ session, sessionId });
|
|
1219
1229
|
}
|
|
1220
1230
|
}
|
|
@@ -1321,10 +1331,8 @@ function deserializeCluster(serializedCluster) {
|
|
|
1321
1331
|
return {
|
|
1322
1332
|
sessionIndex,
|
|
1323
1333
|
capacity,
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
// TODO: This cast can be removed on typescript 4.6
|
|
1327
|
-
overrides: (hasCount ? overrides : countOrOverrides),
|
|
1334
|
+
count: hasCount ? countOrOverrides : capacity,
|
|
1335
|
+
overrides: hasCount ? overrides : countOrOverrides,
|
|
1328
1336
|
};
|
|
1329
1337
|
}
|
|
1330
1338
|
/**
|
|
@@ -1334,10 +1342,4 @@ function deserializeCluster(serializedCluster) {
|
|
|
1334
1342
|
* lookup results should be extracted from the tuple immediately after invocation.
|
|
1335
1343
|
*/
|
|
1336
1344
|
const reusedArray = [];
|
|
1337
|
-
/**
|
|
1338
|
-
* A numeric comparator used for sorting in descending order.
|
|
1339
|
-
*/
|
|
1340
|
-
function compareFiniteNumbersReversed(a, b) {
|
|
1341
|
-
return b - a;
|
|
1342
|
-
}
|
|
1343
1345
|
//# sourceMappingURL=IdCompressor.js.map
|