@fluidframework/id-compressor 2.0.0-dev-rc.5.0.0.272251 → 2.0.0-dev-rc.5.0.0.272889
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/api-extractor.json +1 -1
- package/dist/appendOnlySortedMap.d.ts.map +1 -1
- package/dist/appendOnlySortedMap.js.map +1 -1
- package/dist/finalSpace.d.ts.map +1 -1
- package/dist/finalSpace.js.map +1 -1
- package/dist/idCompressor.d.ts.map +1 -1
- package/dist/idCompressor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sessionSpaceNormalizer.d.ts.map +1 -1
- package/dist/sessionSpaceNormalizer.js.map +1 -1
- package/dist/test/idCompressor.perf.spec.js.map +1 -1
- package/dist/test/idCompressor.spec.js.map +1 -1
- package/dist/test/idCompressorTestUtilities.d.ts.map +1 -1
- package/dist/test/idCompressorTestUtilities.js +1 -2
- package/dist/test/idCompressorTestUtilities.js.map +1 -1
- package/dist/test/numericUuid.spec.js.map +1 -1
- package/dist/test/testCommon.d.ts +0 -3
- package/dist/test/testCommon.d.ts.map +1 -1
- package/dist/test/testCommon.js.map +1 -1
- package/dist/types/identifiers.d.ts.map +1 -1
- package/dist/types/identifiers.js.map +1 -1
- package/lib/appendOnlySortedMap.d.ts.map +1 -1
- package/lib/appendOnlySortedMap.js.map +1 -1
- package/lib/finalSpace.d.ts.map +1 -1
- package/lib/finalSpace.js +1 -1
- package/lib/finalSpace.js.map +1 -1
- package/lib/idCompressor.d.ts.map +1 -1
- package/lib/idCompressor.js +1 -1
- package/lib/idCompressor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sessionSpaceNormalizer.d.ts.map +1 -1
- package/lib/sessionSpaceNormalizer.js.map +1 -1
- package/lib/test/idCompressor.perf.spec.js.map +1 -1
- package/lib/test/idCompressor.spec.js.map +1 -1
- package/lib/test/idCompressorTestUtilities.d.ts.map +1 -1
- package/lib/test/idCompressorTestUtilities.js +1 -2
- package/lib/test/idCompressorTestUtilities.js.map +1 -1
- package/lib/test/numericUuid.spec.js.map +1 -1
- package/lib/test/testCommon.d.ts +0 -3
- package/lib/test/testCommon.d.ts.map +1 -1
- package/lib/test/testCommon.js.map +1 -1
- package/lib/types/identifiers.d.ts.map +1 -1
- package/lib/types/identifiers.js.map +1 -1
- package/package.json +9 -9
- package/src/appendOnlySortedMap.ts +1 -4
- package/src/finalSpace.ts +6 -1
- package/src/idCompressor.ts +23 -19
- package/src/index.ts +6 -1
- package/src/packageVersion.ts +1 -1
- package/src/sessionSpaceNormalizer.ts +3 -1
- package/src/test/idCompressorTestUtilities.ts +20 -16
- package/src/test/testCommon.ts +0 -3
- package/src/types/identifiers.ts +3 -1
|
@@ -120,7 +120,10 @@ export function buildHugeCompressor(
|
|
|
120
120
|
capacity = 10,
|
|
121
121
|
numClustersPerSession = 3,
|
|
122
122
|
): IdCompressor {
|
|
123
|
-
const compressor = CompressorFactory.createCompressorWithSession(
|
|
123
|
+
const compressor = CompressorFactory.createCompressorWithSession(
|
|
124
|
+
createSessionId(),
|
|
125
|
+
capacity,
|
|
126
|
+
);
|
|
124
127
|
const sessions: SessionId[] = [];
|
|
125
128
|
for (let i = 0; i < numSessions; i++) {
|
|
126
129
|
sessions.push(createSessionId());
|
|
@@ -378,7 +381,10 @@ export class IdCompressorTestNetwork {
|
|
|
378
381
|
/**
|
|
379
382
|
* Delivers all undelivered ID ranges from the server to the target clients.
|
|
380
383
|
*/
|
|
381
|
-
public deliverOperations(
|
|
384
|
+
public deliverOperations(
|
|
385
|
+
clientTakingDelivery: DestinationClient,
|
|
386
|
+
opsToDeliver?: number,
|
|
387
|
+
): void {
|
|
382
388
|
let opIndexBound: number;
|
|
383
389
|
if (clientTakingDelivery === DestinationClient.All) {
|
|
384
390
|
assert(opsToDeliver === undefined);
|
|
@@ -397,10 +403,7 @@ export class IdCompressorTestNetwork {
|
|
|
397
403
|
const ids = range.ids;
|
|
398
404
|
if (ids !== undefined) {
|
|
399
405
|
for (const id of opSpaceIds) {
|
|
400
|
-
const sessionSpaceId = compressorTo.normalizeToSessionSpace(
|
|
401
|
-
id,
|
|
402
|
-
range.sessionId,
|
|
403
|
-
);
|
|
406
|
+
const sessionSpaceId = compressorTo.normalizeToSessionSpace(id, range.sessionId);
|
|
404
407
|
this.addNewId(clientTo, sessionSpaceId, clientFrom, sessionIdFrom, true);
|
|
405
408
|
}
|
|
406
409
|
}
|
|
@@ -584,18 +587,14 @@ export class IdCompressorTestNetwork {
|
|
|
584
587
|
if (originatingSession !== OriginatingClient.Remote) {
|
|
585
588
|
assert.strictEqual(
|
|
586
589
|
idDataA.sessionId,
|
|
587
|
-
this.compressors.get(idDataA.originatingClient as Client)
|
|
588
|
-
.localSessionId,
|
|
590
|
+
this.compressors.get(idDataA.originatingClient as Client).localSessionId,
|
|
589
591
|
);
|
|
590
592
|
}
|
|
591
593
|
idCreatorCount++;
|
|
592
594
|
}
|
|
593
595
|
|
|
594
596
|
const uuidASessionSpace = compressorA.decompress(sessionSpaceIdA);
|
|
595
|
-
assert.strictEqual(
|
|
596
|
-
uuidASessionSpace,
|
|
597
|
-
incrementStableId(idDataA.sessionId, idIndex),
|
|
598
|
-
);
|
|
597
|
+
assert.strictEqual(uuidASessionSpace, incrementStableId(idDataA.sessionId, idIndex));
|
|
599
598
|
assert.strictEqual(compressorA.recompress(uuidASessionSpace), sessionSpaceIdA);
|
|
600
599
|
uuids.add(uuidASessionSpace);
|
|
601
600
|
const opSpaceIdA = compressorA.normalizeToOpSpace(sessionSpaceIdA);
|
|
@@ -675,7 +674,10 @@ export function roundtrip(
|
|
|
675
674
|
export function roundtrip(
|
|
676
675
|
compressor: ReadonlyIdCompressor,
|
|
677
676
|
withSession: boolean,
|
|
678
|
-
): [
|
|
677
|
+
): [
|
|
678
|
+
SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession,
|
|
679
|
+
IdCompressor,
|
|
680
|
+
] {
|
|
679
681
|
// preserve the capacity request as this property is normally private and resets
|
|
680
682
|
// to a default on construction (deserialization)
|
|
681
683
|
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
@@ -867,7 +869,9 @@ export function makeOpGenerator(
|
|
|
867
869
|
selectableClients,
|
|
868
870
|
network,
|
|
869
871
|
}: FuzzTestState): DeliverSomeOperations {
|
|
870
|
-
const pendingClients = selectableClients.filter(
|
|
872
|
+
const pendingClients = selectableClients.filter(
|
|
873
|
+
(c) => network.getPendingOperations(c) > 0,
|
|
874
|
+
);
|
|
871
875
|
if (pendingClients.length === 0) {
|
|
872
876
|
return {
|
|
873
877
|
type: "deliverSomeOperations",
|
|
@@ -1016,8 +1020,8 @@ export function createAlwaysFinalizedIdCompressor(
|
|
|
1016
1020
|
sessionIdOrLogger === undefined
|
|
1017
1021
|
? createIdCompressor()
|
|
1018
1022
|
: typeof sessionIdOrLogger === "string"
|
|
1019
|
-
|
|
1020
|
-
|
|
1023
|
+
? createIdCompressor(sessionIdOrLogger, loggerOrUndefined)
|
|
1024
|
+
: createIdCompressor(sessionIdOrLogger);
|
|
1021
1025
|
// Permanently put the compressor in a ghost session
|
|
1022
1026
|
(compressor as IdCompressor).startGhostSession(createSessionId());
|
|
1023
1027
|
return compressor;
|
package/src/test/testCommon.ts
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
/**
|
|
17
17
|
* An identifier (v4 UUID) that has been shortened by a distributed compression algorithm.
|
|
18
18
|
* Lacks a space (session/op), meaning its scope is the same as the space-specific ID from which it was derived.
|
|
19
|
-
* @alpha
|
|
20
19
|
*/
|
|
21
20
|
export type CompressedId =
|
|
22
21
|
| SessionSpaceCompressedId
|
|
@@ -27,7 +26,6 @@ export type CompressedId =
|
|
|
27
26
|
/**
|
|
28
27
|
* A compressed ID that is stable and unique within the scope of network of compressors (i.e. a document).
|
|
29
28
|
* It can only be used/decompressed in the context of the originating document.
|
|
30
|
-
* @alpha
|
|
31
29
|
*/
|
|
32
30
|
export type FinalCompressedId = number & {
|
|
33
31
|
readonly FinalCompressedId: "5d83d1e2-98b7-4e4e-a889-54c855cfa73d";
|
|
@@ -40,7 +38,6 @@ export type FinalCompressedId = number & {
|
|
|
40
38
|
* A compressed ID that is local to a session (can only be decompressed when paired with a SessionId).
|
|
41
39
|
* Internally, it should not be persisted outside a scope annotated with the originating SessionId in order to be unambiguous.
|
|
42
40
|
* If external persistence is needed (e.g. by a client), a StableId should be used instead.
|
|
43
|
-
* @alpha
|
|
44
41
|
*/
|
|
45
42
|
export type LocalCompressedId = number & {
|
|
46
43
|
readonly LocalCompressedId: "6fccb42f-e2a4-4243-bd29-f13d12b9c6d1";
|
package/src/types/identifiers.ts
CHANGED
|
@@ -36,4 +36,6 @@ export type StableId = string & { readonly StableId: "53172b0d-a3d5-41ea-bd75-b4
|
|
|
36
36
|
* A StableId which is suitable for use as a session identifier
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
|
-
export type SessionId = StableId & {
|
|
39
|
+
export type SessionId = StableId & {
|
|
40
|
+
readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58";
|
|
41
|
+
};
|