@fluidframework/id-compressor 2.53.1 → 2.61.0-355054

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 (134) hide show
  1. package/.mocharc.cjs +1 -2
  2. package/CHANGELOG.md +4 -0
  3. package/api-report/{id-compressor.legacy.alpha.api.md → id-compressor.legacy.beta.api.md} +11 -11
  4. package/dist/finalSpace.d.ts +2 -2
  5. package/dist/finalSpace.d.ts.map +1 -1
  6. package/dist/finalSpace.js.map +1 -1
  7. package/dist/idCompressor.d.ts +20 -17
  8. package/dist/idCompressor.d.ts.map +1 -1
  9. package/dist/idCompressor.js +14 -13
  10. package/dist/idCompressor.js.map +1 -1
  11. package/dist/identifiers.d.ts +1 -1
  12. package/dist/identifiers.d.ts.map +1 -1
  13. package/dist/identifiers.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/legacy.d.ts +4 -2
  18. package/dist/packageVersion.d.ts +1 -1
  19. package/dist/packageVersion.d.ts.map +1 -1
  20. package/dist/packageVersion.js +1 -1
  21. package/dist/packageVersion.js.map +1 -1
  22. package/dist/persistanceUtilities.d.ts +1 -1
  23. package/dist/persistanceUtilities.d.ts.map +1 -1
  24. package/dist/persistanceUtilities.js.map +1 -1
  25. package/dist/public.d.ts +2 -1
  26. package/dist/sessionSpaceNormalizer.d.ts +1 -1
  27. package/dist/sessionSpaceNormalizer.d.ts.map +1 -1
  28. package/dist/sessionSpaceNormalizer.js.map +1 -1
  29. package/dist/sessions.d.ts +2 -2
  30. package/dist/sessions.d.ts.map +1 -1
  31. package/dist/sessions.js.map +1 -1
  32. package/dist/test/appendOnlySortedMap.perf.spec.js.map +1 -1
  33. package/dist/test/idCompressor.perf.spec.js.map +1 -1
  34. package/dist/test/idCompressor.spec.js.map +1 -1
  35. package/dist/test/idCompressorTestUtilities.d.ts +4 -4
  36. package/dist/test/idCompressorTestUtilities.d.ts.map +1 -1
  37. package/dist/test/idCompressorTestUtilities.js +5 -2
  38. package/dist/test/idCompressorTestUtilities.js.map +1 -1
  39. package/dist/test/numericUuid.spec.js.map +1 -1
  40. package/dist/test/snapshots/summary.spec.js.map +1 -1
  41. package/dist/test/testCommon.d.ts +2 -2
  42. package/dist/test/testCommon.d.ts.map +1 -1
  43. package/dist/test/testCommon.js.map +1 -1
  44. package/dist/types/idCompressor.d.ts +3 -4
  45. package/dist/types/idCompressor.d.ts.map +1 -1
  46. package/dist/types/idCompressor.js.map +1 -1
  47. package/dist/types/index.d.ts +3 -3
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/types/persisted-types/0.0.1.d.ts +4 -8
  51. package/dist/types/persisted-types/0.0.1.d.ts.map +1 -1
  52. package/dist/types/persisted-types/0.0.1.js.map +1 -1
  53. package/dist/types/persisted-types/index.d.ts +1 -1
  54. package/dist/types/persisted-types/index.d.ts.map +1 -1
  55. package/dist/types/persisted-types/index.js.map +1 -1
  56. package/dist/utilities.d.ts +3 -4
  57. package/dist/utilities.d.ts.map +1 -1
  58. package/dist/utilities.js +1 -2
  59. package/dist/utilities.js.map +1 -1
  60. package/internal.d.ts +1 -1
  61. package/legacy.d.ts +1 -1
  62. package/lib/finalSpace.d.ts +2 -2
  63. package/lib/finalSpace.d.ts.map +1 -1
  64. package/lib/finalSpace.js.map +1 -1
  65. package/lib/idCompressor.d.ts +20 -17
  66. package/lib/idCompressor.d.ts.map +1 -1
  67. package/lib/idCompressor.js +14 -13
  68. package/lib/idCompressor.js.map +1 -1
  69. package/lib/identifiers.d.ts +1 -1
  70. package/lib/identifiers.d.ts.map +1 -1
  71. package/lib/identifiers.js.map +1 -1
  72. package/lib/index.d.ts +1 -1
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js.map +1 -1
  75. package/lib/legacy.d.ts +4 -2
  76. package/lib/packageVersion.d.ts +1 -1
  77. package/lib/packageVersion.d.ts.map +1 -1
  78. package/lib/packageVersion.js +1 -1
  79. package/lib/packageVersion.js.map +1 -1
  80. package/lib/persistanceUtilities.d.ts +1 -1
  81. package/lib/persistanceUtilities.d.ts.map +1 -1
  82. package/lib/persistanceUtilities.js.map +1 -1
  83. package/lib/public.d.ts +2 -1
  84. package/lib/sessionSpaceNormalizer.d.ts +1 -1
  85. package/lib/sessionSpaceNormalizer.d.ts.map +1 -1
  86. package/lib/sessionSpaceNormalizer.js.map +1 -1
  87. package/lib/sessions.d.ts +2 -2
  88. package/lib/sessions.d.ts.map +1 -1
  89. package/lib/sessions.js.map +1 -1
  90. package/lib/test/appendOnlySortedMap.perf.spec.js.map +1 -1
  91. package/lib/test/idCompressor.perf.spec.js.map +1 -1
  92. package/lib/test/idCompressor.spec.js.map +1 -1
  93. package/lib/test/idCompressorTestUtilities.d.ts +4 -4
  94. package/lib/test/idCompressorTestUtilities.d.ts.map +1 -1
  95. package/lib/test/idCompressorTestUtilities.js +5 -2
  96. package/lib/test/idCompressorTestUtilities.js.map +1 -1
  97. package/lib/test/numericUuid.spec.js.map +1 -1
  98. package/lib/test/snapshots/summary.spec.js.map +1 -1
  99. package/lib/test/testCommon.d.ts +2 -2
  100. package/lib/test/testCommon.d.ts.map +1 -1
  101. package/lib/test/testCommon.js.map +1 -1
  102. package/lib/tsdoc-metadata.json +1 -1
  103. package/lib/types/idCompressor.d.ts +3 -4
  104. package/lib/types/idCompressor.d.ts.map +1 -1
  105. package/lib/types/idCompressor.js.map +1 -1
  106. package/lib/types/index.d.ts +3 -3
  107. package/lib/types/index.d.ts.map +1 -1
  108. package/lib/types/index.js.map +1 -1
  109. package/lib/types/persisted-types/0.0.1.d.ts +4 -8
  110. package/lib/types/persisted-types/0.0.1.d.ts.map +1 -1
  111. package/lib/types/persisted-types/0.0.1.js.map +1 -1
  112. package/lib/types/persisted-types/index.d.ts +1 -1
  113. package/lib/types/persisted-types/index.d.ts.map +1 -1
  114. package/lib/types/persisted-types/index.js.map +1 -1
  115. package/lib/utilities.d.ts +3 -4
  116. package/lib/utilities.d.ts.map +1 -1
  117. package/lib/utilities.js +1 -2
  118. package/lib/utilities.js.map +1 -1
  119. package/package.json +17 -17
  120. package/src/finalSpace.ts +2 -2
  121. package/src/idCompressor.ts +42 -49
  122. package/src/identifiers.ts +1 -1
  123. package/src/index.ts +1 -1
  124. package/src/packageVersion.ts +1 -1
  125. package/src/persistanceUtilities.ts +1 -1
  126. package/src/sessionSpaceNormalizer.ts +1 -1
  127. package/src/sessions.ts +2 -2
  128. package/src/test/idCompressorTestUtilities.ts +18 -15
  129. package/src/test/testCommon.ts +2 -2
  130. package/src/types/idCompressor.ts +3 -4
  131. package/src/types/index.ts +3 -3
  132. package/src/types/persisted-types/0.0.1.ts +4 -8
  133. package/src/types/persisted-types/index.ts +1 -1
  134. package/src/utilities.ts +3 -4
@@ -5,24 +5,21 @@
5
5
  import type { SessionId } from "../identifiers.js";
6
6
  /**
7
7
  * The serialized contents of an IdCompressor, suitable for persistence in a summary.
8
- * @legacy
9
- * @alpha
8
+ * @legacy @beta
10
9
  */
11
10
  export type SerializedIdCompressor = string & {
12
11
  readonly _serializedIdCompressor: "8c73c57c-1cf4-4278-8915-6444cb4f6af5";
13
12
  };
14
13
  /**
15
14
  * The serialized contents of an IdCompressor, suitable for persistence in a summary.
16
- * @legacy
17
- * @alpha
15
+ * @legacy @beta
18
16
  */
19
17
  export type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {
20
18
  readonly _noLocalState: "3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb";
21
19
  };
22
20
  /**
23
21
  * The serialized contents of an IdCompressor, suitable for persistence in a summary.
24
- * @legacy
25
- * @alpha
22
+ * @legacy @beta
26
23
  */
27
24
  export type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {
28
25
  readonly _hasLocalState: "1281acae-6d14-47e7-bc92-71c8ee0819cb";
@@ -31,8 +28,7 @@ export type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor &
31
28
  * Data describing a range of session-local IDs (from a remote or local session).
32
29
  *
33
30
  * A range is composed of local IDs that were generated.
34
- * @legacy
35
- * @alpha
31
+ * @legacy @beta
36
32
  */
37
33
  export interface IdCreationRange {
38
34
  readonly sessionId: SessionId;
@@ -1 +1 @@
1
- {"version":3,"file":"0.0.1.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG;IAC7C,QAAQ,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;CACzE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mCAAmC,GAAG,sBAAsB,GAAG;IAC1E,QAAQ,CAAC,aAAa,EAAE,sCAAsC,CAAC;CAC/D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wCAAwC,GAAG,sBAAsB,GAAG;IAC/E,QAAQ,CAAC,cAAc,EAAE,sCAAsC,CAAC;CAChE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE;QACd;;WAEG;QACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAE/B;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAEvB;;;;WAIG;QACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QAEtC;;WAEG;QACH,QAAQ,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;KAC5D,CAAC;CACF"}
1
+ {"version":3,"file":"0.0.1.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG;IAC7C,QAAQ,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;CACzE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mCAAmC,GAAG,sBAAsB,GAAG;IAC1E,QAAQ,CAAC,aAAa,EAAE,sCAAsC,CAAC;CAC/D,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wCAAwC,GAAG,sBAAsB,GAAG;IAC/E,QAAQ,CAAC,cAAc,EAAE,sCAAsC,CAAC;CAChE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE;QACd;;WAEG;QACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAE/B;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAEvB;;;;WAIG;QACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QAEtC;;WAEG;QACH,QAAQ,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;KAC5D,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"0.0.1.js","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"../identifiers.js\";\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy\n * @alpha\n */\nexport type SerializedIdCompressor = string & {\n\treadonly _serializedIdCompressor: \"8c73c57c-1cf4-4278-8915-6444cb4f6af5\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy\n * @alpha\n */\nexport type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {\n\treadonly _noLocalState: \"3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy\n * @alpha\n */\nexport type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {\n\treadonly _hasLocalState: \"1281acae-6d14-47e7-bc92-71c8ee0819cb\";\n};\n\n/**\n * Data describing a range of session-local IDs (from a remote or local session).\n *\n * A range is composed of local IDs that were generated.\n * @legacy\n * @alpha\n */\nexport interface IdCreationRange {\n\treadonly sessionId: SessionId;\n\treadonly ids?: {\n\t\t/**\n\t\t * The gen count of the first ID in the range created by `sessionId.`\n\t\t */\n\t\treadonly firstGenCount: number;\n\n\t\t/**\n\t\t * The number of IDs created in the range created by `sessionId.`\n\t\t */\n\t\treadonly count: number;\n\n\t\t/**\n\t\t * The size of the ID cluster to create if `count` overflows the existing cluster for\n\t\t * `sessionId`, if one exists. This request will be respected, and the size of the cluster\n\t\t * will be equal to overflow + `requestedClusterSize`.\n\t\t */\n\t\treadonly requestedClusterSize: number;\n\n\t\t/**\n\t\t * The ranges of IDs that were allocated as local IDs in the range created by `sessionId.`\n\t\t */\n\t\treadonly localIdRanges: [genCount: number, count: number][];\n\t};\n}\n"]}
1
+ {"version":3,"file":"0.0.1.js","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"../identifiers.js\";\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy @beta\n */\nexport type SerializedIdCompressor = string & {\n\treadonly _serializedIdCompressor: \"8c73c57c-1cf4-4278-8915-6444cb4f6af5\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy @beta\n */\nexport type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {\n\treadonly _noLocalState: \"3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb\";\n};\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\n * @legacy @beta\n */\nexport type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {\n\treadonly _hasLocalState: \"1281acae-6d14-47e7-bc92-71c8ee0819cb\";\n};\n\n/**\n * Data describing a range of session-local IDs (from a remote or local session).\n *\n * A range is composed of local IDs that were generated.\n * @legacy @beta\n */\nexport interface IdCreationRange {\n\treadonly sessionId: SessionId;\n\treadonly ids?: {\n\t\t/**\n\t\t * The gen count of the first ID in the range created by `sessionId.`\n\t\t */\n\t\treadonly firstGenCount: number;\n\n\t\t/**\n\t\t * The number of IDs created in the range created by `sessionId.`\n\t\t */\n\t\treadonly count: number;\n\n\t\t/**\n\t\t * The size of the ID cluster to create if `count` overflows the existing cluster for\n\t\t * `sessionId`, if one exists. This request will be respected, and the size of the cluster\n\t\t * will be equal to overflow + `requestedClusterSize`.\n\t\t */\n\t\treadonly requestedClusterSize: number;\n\n\t\t/**\n\t\t * The ranges of IDs that were allocated as local IDs in the range created by `sessionId.`\n\t\t */\n\t\treadonly localIdRanges: [genCount: number, count: number][];\n\t};\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, } from "./0.0.1.js";
5
+ export type { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, } from "./0.0.1.js";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,GACxC,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,GACxC,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./0.0.1.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tIdCreationRange,\n\tSerializedIdCompressor,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./0.0.1.js\";\n"]}
@@ -2,12 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { LocalCompressedId, NumericUuid } from "./identifiers.js";
6
- import { SessionId, StableId } from "./types/index.js";
5
+ import type { LocalCompressedId, NumericUuid } from "./identifiers.js";
6
+ import type { SessionId, StableId } from "./types/index.js";
7
7
  /**
8
8
  * Generate a random session ID
9
- * @legacy
10
- * @alpha
9
+ * @legacy @beta
11
10
  */
12
11
  export declare function createSessionId(): SessionId;
13
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources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CAEtE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAEvE;AAeD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAWvE;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,QAAQ,CAY1E;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAEvF;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,WAAW,CAEhF;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,WAAW,CAE3E"}
package/lib/utilities.js CHANGED
@@ -13,8 +13,7 @@ function isHexadecimalCharacter(charCode) {
13
13
  }
14
14
  /**
15
15
  * Generate a random session ID
16
- * @legacy
17
- * @alpha
16
+ * @legacy @beta
18
17
  */
19
18
  export function createSessionId() {
20
19
  return assertIsStableId(v4());
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAK1B,MAAM,oBAAoB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAOrE,CAAC;AAEF,SAAS,sBAAsB,CAAC,QAAgB;IAC/C,OAAO,CACN,CAAC,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC;QAC5E,CAAC,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,QAA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All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { v4 } from \"uuid\";\n\nimport { LocalCompressedId, NumericUuid } from \"./identifiers.js\";\nimport { SessionId, StableId } from \"./types/index.js\";\n\nconst hexadecimalCharCodes = [...\"09afAF\"].map((c) => c.codePointAt(0)) as [\n\tzero: number,\n\tnine: number,\n\ta: number,\n\tf: number,\n\tA: number,\n\tF: number,\n];\n\nfunction isHexadecimalCharacter(charCode: number): boolean {\n\treturn (\n\t\t(charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||\n\t\t(charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||\n\t\t(charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5])\n\t);\n}\n\n/**\n * Generate a random session ID\n * @legacy\n * @alpha\n */\nexport function createSessionId(): SessionId {\n\treturn assertIsStableId(v4()) as SessionId;\n}\n\n/**\n * Asserts that the given string is a stable ID.\n * @internal\n */\nexport function assertIsStableId(stableId: string): StableId {\n\tassert(isStableId(stableId), 0x4a3 /* Expected a StableId */);\n\treturn stableId;\n}\n\n/**\n * Asserts that the given string is a stable ID.\n */\nexport function assertIsSessionId(stableId: string): SessionId {\n\tassertIsStableId(stableId);\n\treturn stableId as SessionId;\n}\n\n/**\n * Generate a random stable ID\n * @internal\n */\nexport function generateStableId(): StableId {\n\treturn assertIsStableId(v4());\n}\n\n/**\n * Returns true iff the given string is a valid Version 4, variant 2 UUID\n * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'\n * @internal\n */\nexport function isStableId(str: string): str is StableId {\n\tif (str.length !== 36) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tswitch (i) {\n\t\t\tcase 8:\n\t\t\tcase 13:\n\t\t\tcase 18:\n\t\t\tcase 23: {\n\t\t\t\tif (str.charAt(i) !== \"-\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 14: {\n\t\t\t\tif (str.charAt(i) !== \"4\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 19: {\n\t\t\t\tconst char = str.charAt(i);\n\t\t\t\tif (char !== \"8\" && char !== \"9\" && char !== \"a\" && char !== \"b\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tconst codePoint = str.codePointAt(i);\n\t\t\t\tassert(codePoint !== undefined, 0xaaf /* Unexpected undefined code point */);\n\t\t\t\tif (!isHexadecimalCharacter(codePoint)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Compares bigints to form a strict partial ordering.\n */\nexport function compareBigints<T extends bigint>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\nexport function genCountFromLocalId(localId: LocalCompressedId): number {\n\treturn -localId;\n}\n\nexport function localIdFromGenCount(genCount: number): LocalCompressedId {\n\treturn -genCount as LocalCompressedId;\n}\n\n// xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx\nconst versionMask = 0x4n << (19n * 4n); // Version 4\nconst variantMask = 0x8n << (15n * 4n); // Variant RFC4122 (1 0 x x)\nconst upperMask = 0xffffffffffffn << (20n * 4n);\n// Upper mask when version/variant bits are removed\nconst strippedUpperMask = upperMask >> 6n;\nconst middieBittiesMask = 0xfffn << (16n * 4n);\n// Middie mask when version/variant bits are removed\nconst strippedMiddieBittiesMask = middieBittiesMask >> 2n;\n// Note: leading character should be 3 to mask at 0011\n// The more-significant half of the N nibble is used to denote the variant (10xx)\nconst lowerMask = 0x3fffffffffffffffn;\n\nexport function numericUuidFromStableId(stableId: StableId): NumericUuid {\n\tconst uuidU128 = BigInt(`0x${stableId.replace(/-/g, \"\")}`);\n\tconst upperMasked = uuidU128 & upperMask;\n\tconst middieBittiesMasked = uuidU128 & middieBittiesMask;\n\tconst lowerMasked = uuidU128 & lowerMask;\n\n\tconst upperMaskedPlaced = upperMasked >> 6n;\n\tconst middieBittiesMaskedPlaced = middieBittiesMasked >> 2n;\n\n\tconst id = upperMaskedPlaced | middieBittiesMaskedPlaced | lowerMasked;\n\treturn id as NumericUuid;\n}\n\nexport function stableIdFromNumericUuid(numericUuid: NumericUuid): StableId {\n\t// bitwise reverse transform\n\tconst upperMasked = (numericUuid & strippedUpperMask) << 6n;\n\tconst middieBittiesMasked = (numericUuid & strippedMiddieBittiesMask) << 2n;\n\tconst lowerMasked = numericUuid & lowerMask;\n\tconst uuidU128 = upperMasked | versionMask | middieBittiesMasked | variantMask | lowerMasked;\n\t// Pad to 32 characters, inserting leading zeroes if needed\n\tconst uuidString = uuidU128.toString(16).padStart(32, \"0\");\n\treturn `${uuidString.slice(0, 8)}-${uuidString.slice(8, 12)}-${uuidString.slice(\n\t\t12,\n\t\t16,\n\t)}-${uuidString.slice(16, 20)}-${uuidString.slice(20, 32)}` as StableId;\n}\n\nexport function offsetNumericUuid(numericUuid: NumericUuid, offset: number): NumericUuid {\n\treturn (numericUuid + BigInt(offset)) as NumericUuid;\n}\n\nexport function subtractNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid {\n\treturn (a - b) as NumericUuid;\n}\n\nexport function addNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid {\n\treturn (a + b) as NumericUuid;\n}\n"]}
1
+ {"version":3,"file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EACF,EAAE,CACF,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAc,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAwB,EAAE,MAAc;IACzE,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAgB,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,CAAc,EAAE,CAAc;IAClE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAgB,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAc,EAAE,CAAc;IAC7D,OAAO,CAAC,CAAC,GAAG,CAAC,CAAgB,CAAC;AAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { v4 } from \"uuid\";\n\nimport type { LocalCompressedId, NumericUuid } from \"./identifiers.js\";\nimport type { SessionId, StableId } from \"./types/index.js\";\n\nconst hexadecimalCharCodes = [...\"09afAF\"].map((c) => c.codePointAt(0)) as [\n\tzero: number,\n\tnine: number,\n\ta: number,\n\tf: number,\n\tA: number,\n\tF: number,\n];\n\nfunction isHexadecimalCharacter(charCode: number): boolean {\n\treturn (\n\t\t(charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||\n\t\t(charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||\n\t\t(charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5])\n\t);\n}\n\n/**\n * Generate a random session ID\n * @legacy @beta\n */\nexport function createSessionId(): SessionId {\n\treturn assertIsStableId(v4()) as SessionId;\n}\n\n/**\n * Asserts that the given string is a stable ID.\n * @internal\n */\nexport function assertIsStableId(stableId: string): StableId {\n\tassert(isStableId(stableId), 0x4a3 /* Expected a StableId */);\n\treturn stableId;\n}\n\n/**\n * Asserts that the given string is a stable ID.\n */\nexport function assertIsSessionId(stableId: string): SessionId {\n\tassertIsStableId(stableId);\n\treturn stableId as SessionId;\n}\n\n/**\n * Generate a random stable ID\n * @internal\n */\nexport function generateStableId(): StableId {\n\treturn assertIsStableId(v4());\n}\n\n/**\n * Returns true iff the given string is a valid Version 4, variant 2 UUID\n * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'\n * @internal\n */\nexport function isStableId(str: string): str is StableId {\n\tif (str.length !== 36) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tswitch (i) {\n\t\t\tcase 8:\n\t\t\tcase 13:\n\t\t\tcase 18:\n\t\t\tcase 23: {\n\t\t\t\tif (str.charAt(i) !== \"-\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 14: {\n\t\t\t\tif (str.charAt(i) !== \"4\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 19: {\n\t\t\t\tconst char = str.charAt(i);\n\t\t\t\tif (char !== \"8\" && char !== \"9\" && char !== \"a\" && char !== \"b\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tconst codePoint = str.codePointAt(i);\n\t\t\t\tassert(codePoint !== undefined, 0xaaf /* Unexpected undefined code point */);\n\t\t\t\tif (!isHexadecimalCharacter(codePoint)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Compares bigints to form a strict partial ordering.\n */\nexport function compareBigints<T extends bigint>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\nexport function genCountFromLocalId(localId: LocalCompressedId): number {\n\treturn -localId;\n}\n\nexport function localIdFromGenCount(genCount: number): LocalCompressedId {\n\treturn -genCount as LocalCompressedId;\n}\n\n// xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx\nconst versionMask = 0x4n << (19n * 4n); // Version 4\nconst variantMask = 0x8n << (15n * 4n); // Variant RFC4122 (1 0 x x)\nconst upperMask = 0xffffffffffffn << (20n * 4n);\n// Upper mask when version/variant bits are removed\nconst strippedUpperMask = upperMask >> 6n;\nconst middieBittiesMask = 0xfffn << (16n * 4n);\n// Middie mask when version/variant bits are removed\nconst strippedMiddieBittiesMask = middieBittiesMask >> 2n;\n// Note: leading character should be 3 to mask at 0011\n// The more-significant half of the N nibble is used to denote the variant (10xx)\nconst lowerMask = 0x3fffffffffffffffn;\n\nexport function numericUuidFromStableId(stableId: StableId): NumericUuid {\n\tconst uuidU128 = BigInt(`0x${stableId.replace(/-/g, \"\")}`);\n\tconst upperMasked = uuidU128 & upperMask;\n\tconst middieBittiesMasked = uuidU128 & middieBittiesMask;\n\tconst lowerMasked = uuidU128 & lowerMask;\n\n\tconst upperMaskedPlaced = upperMasked >> 6n;\n\tconst middieBittiesMaskedPlaced = middieBittiesMasked >> 2n;\n\n\tconst id = upperMaskedPlaced | middieBittiesMaskedPlaced | lowerMasked;\n\treturn id as NumericUuid;\n}\n\nexport function stableIdFromNumericUuid(numericUuid: NumericUuid): StableId {\n\t// bitwise reverse transform\n\tconst upperMasked = (numericUuid & strippedUpperMask) << 6n;\n\tconst middieBittiesMasked = (numericUuid & strippedMiddieBittiesMask) << 2n;\n\tconst lowerMasked = numericUuid & lowerMask;\n\tconst uuidU128 = upperMasked | versionMask | middieBittiesMasked | variantMask | lowerMasked;\n\t// Pad to 32 characters, inserting leading zeroes if needed\n\tconst uuidString = uuidU128.toString(16).padStart(32, \"0\");\n\treturn `${uuidString.slice(0, 8)}-${uuidString.slice(8, 12)}-${uuidString.slice(\n\t\t12,\n\t\t16,\n\t)}-${uuidString.slice(16, 20)}-${uuidString.slice(20, 32)}` as StableId;\n}\n\nexport function offsetNumericUuid(numericUuid: NumericUuid, offset: number): NumericUuid {\n\treturn (numericUuid + BigInt(offset)) as NumericUuid;\n}\n\nexport function subtractNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid {\n\treturn (a - b) as NumericUuid;\n}\n\nexport function addNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid {\n\treturn (a + b) as NumericUuid;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/id-compressor",
3
- "version": "2.53.1",
3
+ "version": "2.61.0-355054",
4
4
  "description": "ID compressor",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -81,28 +81,28 @@
81
81
  "temp-directory": "nyc/.nyc_output"
82
82
  },
83
83
  "dependencies": {
84
- "@fluid-internal/client-utils": "~2.53.1",
85
- "@fluidframework/core-interfaces": "~2.53.1",
86
- "@fluidframework/core-utils": "~2.53.1",
87
- "@fluidframework/telemetry-utils": "~2.53.1",
84
+ "@fluid-internal/client-utils": "2.61.0-355054",
85
+ "@fluidframework/core-interfaces": "2.61.0-355054",
86
+ "@fluidframework/core-utils": "2.61.0-355054",
87
+ "@fluidframework/telemetry-utils": "2.61.0-355054",
88
88
  "@tylerbu/sorted-btree-es6": "^1.8.0",
89
89
  "uuid": "^11.1.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@arethetypeswrong/cli": "^0.17.1",
93
93
  "@biomejs/biome": "~1.9.3",
94
- "@fluid-internal/mocha-test-setup": "~2.53.1",
95
- "@fluid-private/stochastic-test-utils": "~2.53.1",
94
+ "@fluid-internal/mocha-test-setup": "2.61.0-355054",
95
+ "@fluid-private/stochastic-test-utils": "2.61.0-355054",
96
96
  "@fluid-tools/benchmark": "^0.51.0",
97
- "@fluid-tools/build-cli": "^0.57.0",
97
+ "@fluid-tools/build-cli": "^0.58.2",
98
98
  "@fluidframework/build-common": "^2.0.3",
99
- "@fluidframework/build-tools": "^0.57.0",
100
- "@fluidframework/eslint-config-fluid": "^5.7.4",
101
- "@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.53.0",
102
- "@microsoft/api-extractor": "7.52.8",
99
+ "@fluidframework/build-tools": "^0.58.2",
100
+ "@fluidframework/eslint-config-fluid": "^6.0.0",
101
+ "@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.60.0",
102
+ "@microsoft/api-extractor": "7.52.11",
103
103
  "@types/mocha": "^10.0.10",
104
104
  "@types/node": "^18.19.0",
105
- "c8": "^8.0.1",
105
+ "c8": "^10.1.3",
106
106
  "concurrently": "^8.2.1",
107
107
  "copyfiles": "^2.4.1",
108
108
  "cross-env": "^7.0.3",
@@ -118,8 +118,8 @@
118
118
  },
119
119
  "scripts": {
120
120
  "api": "fluid-build . --task api",
121
- "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
122
- "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
121
+ "api-extractor:commonjs": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./dist",
122
+ "api-extractor:esnext": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat",
123
123
  "build": "fluid-build . --task build",
124
124
  "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
125
125
  "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
@@ -156,8 +156,8 @@
156
156
  "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --fgrep @ExecutionTime --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./lib/**/*.perf.spec.*js\"",
157
157
  "test:coverage": "c8 npm test",
158
158
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
159
- "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\"",
160
- "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\"",
159
+ "test:mocha:cjs": "cross-env MOCHA_SPEC=dist/test mocha",
160
+ "test:mocha:esm": "mocha",
161
161
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
162
162
  "test:snapshots:regen": "npm run test:mocha:esm -- --snapshot",
163
163
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
package/src/finalSpace.ts CHANGED
@@ -5,9 +5,9 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
- import { FinalCompressedId } from "./identifiers.js";
8
+ import type { FinalCompressedId } from "./identifiers.js";
9
9
  import {
10
- IdCluster,
10
+ type IdCluster,
11
11
  clustersEqual,
12
12
  lastAllocatedFinal,
13
13
  lastFinalizedFinal,
@@ -4,23 +4,23 @@
4
4
  */
5
5
 
6
6
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
7
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
+ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
8
8
  import { assert } from "@fluidframework/core-utils/internal";
9
9
  import {
10
- ITelemetryLoggerExt,
10
+ type ITelemetryLoggerExt,
11
11
  LoggingError,
12
12
  createChildLogger,
13
13
  } from "@fluidframework/telemetry-utils/internal";
14
14
 
15
15
  import { FinalSpace } from "./finalSpace.js";
16
16
  import {
17
- FinalCompressedId,
18
- LocalCompressedId,
19
- NumericUuid,
17
+ type FinalCompressedId,
18
+ type LocalCompressedId,
19
+ type NumericUuid,
20
20
  isFinalId,
21
21
  } from "./identifiers.js";
22
22
  import {
23
- Index,
23
+ type Index,
24
24
  readBoolean,
25
25
  readNumber,
26
26
  readNumericUuid,
@@ -30,7 +30,7 @@ import {
30
30
  } from "./persistanceUtilities.js";
31
31
  import { SessionSpaceNormalizer } from "./sessionSpaceNormalizer.js";
32
32
  import {
33
- IdCluster,
33
+ type IdCluster,
34
34
  Session,
35
35
  Sessions,
36
36
  getAlignedFinal,
@@ -38,7 +38,7 @@ import {
38
38
  lastFinalizedFinal,
39
39
  lastFinalizedLocal,
40
40
  } from "./sessions.js";
41
- import {
41
+ import type {
42
42
  IIdCompressor,
43
43
  IIdCompressorCore,
44
44
  IdCreationRange,
@@ -123,7 +123,7 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
123
123
 
124
124
  public constructor(
125
125
  localSessionIdOrDeserialized: SessionId | Sessions,
126
- private readonly logger?: ITelemetryLoggerExt,
126
+ private readonly logger: ITelemetryLoggerExt | undefined,
127
127
  ) {
128
128
  if (typeof localSessionIdOrDeserialized === "string") {
129
129
  this.localSessionId = localSessionIdOrDeserialized;
@@ -625,26 +625,19 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
625
625
  }
626
626
 
627
627
  public static deserialize(
628
- serialized: SerializedIdCompressorWithOngoingSession,
629
- logger?: ITelemetryLoggerExt,
630
- ): IdCompressor;
631
- public static deserialize(
632
- serialized: SerializedIdCompressorWithNoSession,
633
- newSessionId: SessionId,
634
- logger?: ITelemetryLoggerExt,
635
- ): IdCompressor;
636
- public static deserialize(
637
- serialized: SerializedIdCompressor,
638
- loggerOrSessionId?: ITelemetryLoggerExt | SessionId,
628
+ params:
629
+ | {
630
+ serialized: SerializedIdCompressorWithOngoingSession;
631
+ logger?: ITelemetryLoggerExt | undefined;
632
+ newSessionId?: never;
633
+ }
634
+ | {
635
+ serialized: SerializedIdCompressorWithNoSession;
636
+ newSessionId: SessionId;
637
+ logger?: ITelemetryLoggerExt | undefined;
638
+ },
639
639
  ): IdCompressor {
640
- let sessionId: SessionId | undefined;
641
- let logger: ITelemetryLoggerExt | undefined;
642
- if (typeof loggerOrSessionId === "string") {
643
- sessionId = loggerOrSessionId;
644
- } else {
645
- logger = loggerOrSessionId;
646
- }
647
-
640
+ const { serialized, newSessionId, logger } = params;
648
641
  const buffer = stringToBuffer(serialized, "base64");
649
642
  const index: Index = {
650
643
  index: 0,
@@ -657,7 +650,7 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
657
650
  throw new Error("IdCompressor version 1.0 is no longer supported.");
658
651
  }
659
652
  case 2: {
660
- return IdCompressor.deserialize2_0(index, sessionId, logger);
653
+ return IdCompressor.deserialize2_0(index, newSessionId, logger);
661
654
  }
662
655
  default: {
663
656
  throw new Error("Unknown IdCompressor serialized version.");
@@ -667,8 +660,8 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
667
660
 
668
661
  static deserialize2_0(
669
662
  index: Index,
670
- sessionId?: SessionId,
671
- logger?: ITelemetryLoggerExt,
663
+ sessionId: SessionId | undefined,
664
+ logger: ITelemetryLoggerExt | undefined,
672
665
  ): IdCompressor {
673
666
  const hasLocalState = readBoolean(index);
674
667
  const sessionCount = readNumber(index);
@@ -751,8 +744,7 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
751
744
 
752
745
  /**
753
746
  * Create a new {@link IIdCompressor}.
754
- * @legacy
755
- * @alpha
747
+ * @legacy @beta
756
748
  */
757
749
  export function createIdCompressor(
758
750
  logger?: ITelemetryBaseLogger,
@@ -760,8 +752,7 @@ export function createIdCompressor(
760
752
  /**
761
753
  * Create a new {@link IIdCompressor}.
762
754
  * @param sessionId - The seed ID for the compressor.
763
- * @legacy
764
- * @alpha
755
+ * @legacy @beta
765
756
  */
766
757
  export function createIdCompressor(
767
758
  sessionId: SessionId,
@@ -793,8 +784,7 @@ export function createIdCompressor(
793
784
 
794
785
  /**
795
786
  * Deserializes the supplied state into an ID compressor.
796
- * @legacy
797
- * @alpha
787
+ * @legacy @beta
798
788
  */
799
789
  export function deserializeIdCompressor(
800
790
  serialized: SerializedIdCompressorWithOngoingSession,
@@ -802,8 +792,7 @@ export function deserializeIdCompressor(
802
792
  ): IIdCompressor & IIdCompressorCore;
803
793
  /**
804
794
  * Deserializes the supplied state into an ID compressor.
805
- * @legacy
806
- * @alpha
795
+ * @legacy @beta
807
796
  */
808
797
  export function deserializeIdCompressor(
809
798
  serialized: SerializedIdCompressorWithNoSession,
@@ -812,19 +801,23 @@ export function deserializeIdCompressor(
812
801
  ): IIdCompressor & IIdCompressorCore;
813
802
  export function deserializeIdCompressor(
814
803
  serialized: SerializedIdCompressor | SerializedIdCompressorWithNoSession,
815
- sessionIdOrLogger?: SessionId | ITelemetryLoggerExt,
816
- logger?: ITelemetryLoggerExt | undefined,
804
+ sessionIdOrLogger: SessionId | ITelemetryLoggerExt | undefined,
805
+ loggerOrUndefined?: ITelemetryLoggerExt,
817
806
  ): IIdCompressor & IIdCompressorCore {
818
807
  if (typeof sessionIdOrLogger === "string") {
819
- return IdCompressor.deserialize(
820
- serialized as SerializedIdCompressorWithNoSession,
821
- sessionIdOrLogger,
822
- logger,
823
- );
808
+ return IdCompressor.deserialize({
809
+ serialized: serialized as SerializedIdCompressorWithNoSession,
810
+ logger: loggerOrUndefined,
811
+ newSessionId: sessionIdOrLogger,
812
+ });
824
813
  }
825
814
 
826
- return IdCompressor.deserialize(
827
- serialized as SerializedIdCompressorWithOngoingSession,
828
- logger,
815
+ assert(
816
+ loggerOrUndefined === undefined,
817
+ 0xc2d /* logger would be in sessionIdOrLogger in this codepath */,
829
818
  );
819
+ return IdCompressor.deserialize({
820
+ serialized: serialized as SerializedIdCompressorWithOngoingSession,
821
+ logger: sessionIdOrLogger,
822
+ });
830
823
  }
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { OpSpaceCompressedId, SessionSpaceCompressedId } from "./types/index.js";
6
+ import type { OpSpaceCompressedId, SessionSpaceCompressedId } from "./types/index.js";
7
7
 
8
8
  /**
9
9
  * A compressed ID that is stable and unique within the scope of network of compressors (i.e. a document).
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ export {
14
14
  generateStableId,
15
15
  isStableId,
16
16
  } from "./utilities.js";
17
- export {
17
+ export type {
18
18
  IIdCompressorCore,
19
19
  IIdCompressor,
20
20
  SerializedIdCompressor,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/id-compressor";
9
- export const pkgVersion = "2.53.1";
9
+ export const pkgVersion = "2.61.0-355054";
@@ -6,7 +6,7 @@
6
6
  /* eslint-disable no-bitwise */
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
8
 
9
- import { NumericUuid } from "./identifiers.js";
9
+ import type { NumericUuid } from "./identifiers.js";
10
10
 
11
11
  const halfNumeric = BigInt("0xFFFFFFFFFFFFFFFF");
12
12
  const sixtyFour = BigInt(64);
@@ -6,7 +6,7 @@
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import { AppendOnlySortedMap } from "./appendOnlySortedMap.js";
9
- import { LocalCompressedId } from "./identifiers.js";
9
+ import type { LocalCompressedId } from "./identifiers.js";
10
10
  import { compareFiniteNumbers, genCountFromLocalId } from "./utilities.js";
11
11
 
12
12
  /**
package/src/sessions.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { BTree } from "@tylerbu/sorted-btree-es6";
8
8
 
9
- import { FinalCompressedId, LocalCompressedId, NumericUuid } from "./identifiers.js";
10
- import { SessionId, StableId } from "./types/index.js";
9
+ import type { FinalCompressedId, LocalCompressedId, NumericUuid } from "./identifiers.js";
10
+ import type { SessionId, StableId } from "./types/index.js";
11
11
  import {
12
12
  compareBigints,
13
13
  genCountFromLocalId,
@@ -6,9 +6,9 @@
6
6
  import { strict as assert } from "node:assert";
7
7
 
8
8
  import {
9
- BaseFuzzTestState,
10
- Generator,
11
- SaveInfo,
9
+ type BaseFuzzTestState,
10
+ type Generator,
11
+ type SaveInfo,
12
12
  createWeightedGenerator,
13
13
  interleave,
14
14
  makeRandom,
@@ -16,27 +16,27 @@ import {
16
16
  repeat,
17
17
  take,
18
18
  } from "@fluid-private/stochastic-test-utils";
19
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
19
+ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
20
20
 
21
21
  import { IdCompressor } from "../idCompressor.js";
22
22
  import {
23
23
  type IIdCompressor,
24
24
  type IIdCompressorCore,
25
- IdCreationRange,
26
- OpSpaceCompressedId,
27
- SerializedIdCompressorWithNoSession,
28
- SerializedIdCompressorWithOngoingSession,
29
- SessionId,
30
- SessionSpaceCompressedId,
31
- StableId,
25
+ type IdCreationRange,
26
+ type OpSpaceCompressedId,
27
+ type SerializedIdCompressorWithNoSession,
28
+ type SerializedIdCompressorWithOngoingSession,
29
+ type SessionId,
30
+ type SessionSpaceCompressedId,
31
+ type StableId,
32
32
  createIdCompressor,
33
33
  } from "../index.js";
34
34
  import { SessionSpaceNormalizer } from "../sessionSpaceNormalizer.js";
35
35
  import { assertIsSessionId, createSessionId, localIdFromGenCount } from "../utilities.js";
36
36
 
37
37
  import {
38
- FinalCompressedId,
39
- ReadonlyIdCompressor,
38
+ type FinalCompressedId,
39
+ type ReadonlyIdCompressor,
40
40
  fail,
41
41
  getOrCreate,
42
42
  incrementStableId,
@@ -730,12 +730,15 @@ export function roundtrip(
730
730
  const capacity: number = getClusterSize(compressor);
731
731
  if (withSession) {
732
732
  const serialized = compressor.serialize(withSession);
733
- const roundtripped = IdCompressor.deserialize(serialized);
733
+ const roundtripped = IdCompressor.deserialize({ serialized });
734
734
  modifyClusterSize(roundtripped, capacity);
735
735
  return [serialized, roundtripped];
736
736
  } else {
737
737
  const nonLocalSerialized = compressor.serialize(withSession);
738
- const roundtripped = IdCompressor.deserialize(nonLocalSerialized, createSessionId());
738
+ const roundtripped = IdCompressor.deserialize({
739
+ serialized: nonLocalSerialized,
740
+ newSessionId: createSessionId(),
741
+ });
739
742
  modifyClusterSize(roundtripped, capacity);
740
743
  return [nonLocalSerialized, roundtripped];
741
744
  }
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
- import { IdCompressor } from "../idCompressor.js";
9
- import { OpSpaceCompressedId, SessionSpaceCompressedId, StableId } from "../index.js";
8
+ import type { IdCompressor } from "../idCompressor.js";
9
+ import type { OpSpaceCompressedId, SessionSpaceCompressedId, StableId } from "../index.js";
10
10
  import {
11
11
  numericUuidFromStableId,
12
12
  offsetNumericUuid,
@@ -3,13 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
6
+ import type {
7
7
  OpSpaceCompressedId,
8
8
  SessionId,
9
9
  SessionSpaceCompressedId,
10
10
  StableId,
11
11
  } from "./identifiers.js";
12
- import {
12
+ import type {
13
13
  IdCreationRange,
14
14
  SerializedIdCompressorWithNoSession,
15
15
  SerializedIdCompressorWithOngoingSession,
@@ -75,8 +75,7 @@ import {
75
75
  *
76
76
  * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops
77
77
  * should use op-space IDs.
78
- * @legacy
79
- * @alpha
78
+ * @legacy @beta
80
79
  */
81
80
  export interface IIdCompressorCore {
82
81
  /**
@@ -3,16 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export {
6
+ export type {
7
7
  IdCreationRange,
8
8
  SerializedIdCompressor,
9
9
  SerializedIdCompressorWithNoSession,
10
10
  SerializedIdCompressorWithOngoingSession,
11
11
  } from "./persisted-types/index.js";
12
12
 
13
- export { IIdCompressorCore, IIdCompressor } from "./idCompressor.js";
13
+ export type { IIdCompressorCore, IIdCompressor } from "./idCompressor.js";
14
14
 
15
- export {
15
+ export type {
16
16
  SessionSpaceCompressedId,
17
17
  OpSpaceCompressedId,
18
18
  SessionId,