@fluidframework/id-compressor 2.0.0-dev-rc.5.0.0.271717 → 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.
Files changed (70) hide show
  1. package/api-extractor/api-extractor-lint-bundle.json +5 -0
  2. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  3. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  4. package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
  5. package/api-extractor/api-extractor-lint-public.esm.json +5 -0
  6. package/api-extractor.json +1 -1
  7. package/dist/appendOnlySortedMap.d.ts.map +1 -1
  8. package/dist/appendOnlySortedMap.js.map +1 -1
  9. package/dist/finalSpace.d.ts.map +1 -1
  10. package/dist/finalSpace.js.map +1 -1
  11. package/dist/idCompressor.d.ts.map +1 -1
  12. package/dist/idCompressor.js.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/packageVersion.d.ts +1 -1
  17. package/dist/packageVersion.js +1 -1
  18. package/dist/packageVersion.js.map +1 -1
  19. package/dist/sessionSpaceNormalizer.d.ts.map +1 -1
  20. package/dist/sessionSpaceNormalizer.js.map +1 -1
  21. package/dist/test/idCompressor.perf.spec.js.map +1 -1
  22. package/dist/test/idCompressor.spec.js.map +1 -1
  23. package/dist/test/idCompressorTestUtilities.d.ts.map +1 -1
  24. package/dist/test/idCompressorTestUtilities.js +1 -2
  25. package/dist/test/idCompressorTestUtilities.js.map +1 -1
  26. package/dist/test/numericUuid.spec.js.map +1 -1
  27. package/dist/test/testCommon.d.ts +0 -3
  28. package/dist/test/testCommon.d.ts.map +1 -1
  29. package/dist/test/testCommon.js.map +1 -1
  30. package/dist/types/identifiers.d.ts.map +1 -1
  31. package/dist/types/identifiers.js.map +1 -1
  32. package/lib/appendOnlySortedMap.d.ts.map +1 -1
  33. package/lib/appendOnlySortedMap.js.map +1 -1
  34. package/lib/finalSpace.d.ts.map +1 -1
  35. package/lib/finalSpace.js +1 -1
  36. package/lib/finalSpace.js.map +1 -1
  37. package/lib/idCompressor.d.ts.map +1 -1
  38. package/lib/idCompressor.js +1 -1
  39. package/lib/idCompressor.js.map +1 -1
  40. package/lib/index.d.ts +1 -1
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +1 -1
  43. package/lib/index.js.map +1 -1
  44. package/lib/packageVersion.d.ts +1 -1
  45. package/lib/packageVersion.js +1 -1
  46. package/lib/packageVersion.js.map +1 -1
  47. package/lib/sessionSpaceNormalizer.d.ts.map +1 -1
  48. package/lib/sessionSpaceNormalizer.js.map +1 -1
  49. package/lib/test/idCompressor.perf.spec.js.map +1 -1
  50. package/lib/test/idCompressor.spec.js.map +1 -1
  51. package/lib/test/idCompressorTestUtilities.d.ts.map +1 -1
  52. package/lib/test/idCompressorTestUtilities.js +1 -2
  53. package/lib/test/idCompressorTestUtilities.js.map +1 -1
  54. package/lib/test/numericUuid.spec.js.map +1 -1
  55. package/lib/test/testCommon.d.ts +0 -3
  56. package/lib/test/testCommon.d.ts.map +1 -1
  57. package/lib/test/testCommon.js.map +1 -1
  58. package/lib/types/identifiers.d.ts.map +1 -1
  59. package/lib/types/identifiers.js.map +1 -1
  60. package/package.json +16 -10
  61. package/src/appendOnlySortedMap.ts +1 -4
  62. package/src/finalSpace.ts +6 -1
  63. package/src/idCompressor.ts +23 -19
  64. package/src/index.ts +6 -1
  65. package/src/packageVersion.ts +1 -1
  66. package/src/sessionSpaceNormalizer.ts +3 -1
  67. package/src/test/idCompressorTestUtilities.ts +20 -16
  68. package/src/test/testCommon.ts +0 -3
  69. package/src/types/identifiers.ts +3 -1
  70. package/tsdoc.json +4 -0
@@ -44,7 +44,9 @@ import { compareFiniteNumbers, genCountFromLocalId } from "./utilities.js";
44
44
  export class SessionSpaceNormalizer {
45
45
  // Run-length encoding of IDs that were generated as local IDs. They are stored as a list of tuples (genCount, count)
46
46
  // that are sorted on the genCount so that contains checks can use a binary search.
47
- private readonly localIdRanges = new AppendOnlySortedMap<number, number>(compareFiniteNumbers);
47
+ private readonly localIdRanges = new AppendOnlySortedMap<number, number>(
48
+ compareFiniteNumbers,
49
+ );
48
50
 
49
51
  public get idRanges(): Pick<AppendOnlySortedMap<number, number>, "size" | "entries"> {
50
52
  return this.localIdRanges;
@@ -120,7 +120,10 @@ export function buildHugeCompressor(
120
120
  capacity = 10,
121
121
  numClustersPerSession = 3,
122
122
  ): IdCompressor {
123
- const compressor = CompressorFactory.createCompressorWithSession(createSessionId(), capacity);
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(clientTakingDelivery: DestinationClient, opsToDeliver?: number): void {
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
- ): [SerializedIdCompressorWithOngoingSession | SerializedIdCompressorWithNoSession, IdCompressor] {
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((c) => network.getPendingOperations(c) > 0);
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
- ? createIdCompressor(sessionIdOrLogger, loggerOrUndefined)
1020
- : createIdCompressor(sessionIdOrLogger);
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;
@@ -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";
@@ -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 & { readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58" };
39
+ export type SessionId = StableId & {
40
+ readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58";
41
+ };
package/tsdoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
3
+ "extends": ["../../../common/build/build-common/tsdoc-base.json"]
4
+ }