@fluidframework/id-compressor 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/id-compressor.api.md +2 -1
  3. package/dist/appendOnlySortedMap.js +2 -2
  4. package/dist/appendOnlySortedMap.js.map +1 -1
  5. package/dist/finalSpace.d.ts +1 -1
  6. package/dist/finalSpace.d.ts.map +1 -1
  7. package/dist/finalSpace.js +2 -2
  8. package/dist/finalSpace.js.map +1 -1
  9. package/dist/idCompressor.d.ts +1 -1
  10. package/dist/idCompressor.d.ts.map +1 -1
  11. package/dist/idCompressor.js +25 -24
  12. package/dist/idCompressor.js.map +1 -1
  13. package/dist/legacy.d.ts +28 -0
  14. package/dist/packageVersion.d.ts +1 -1
  15. package/dist/packageVersion.js +1 -1
  16. package/dist/packageVersion.js.map +1 -1
  17. package/dist/public.d.ts +18 -0
  18. package/dist/sessionSpaceNormalizer.d.ts +2 -0
  19. package/dist/sessionSpaceNormalizer.d.ts.map +1 -1
  20. package/dist/sessionSpaceNormalizer.js +44 -0
  21. package/dist/sessionSpaceNormalizer.js.map +1 -1
  22. package/dist/sessions.d.ts +1 -1
  23. package/dist/sessions.d.ts.map +1 -1
  24. package/dist/sessions.js +5 -5
  25. package/dist/sessions.js.map +1 -1
  26. package/dist/test/appendOnlySortedMap.perf.spec.js.map +1 -1
  27. package/dist/test/appendOnlySortedMap.spec.js.map +1 -1
  28. package/dist/test/idCompressor.perf.spec.js.map +1 -1
  29. package/dist/test/idCompressor.spec.js.map +1 -1
  30. package/dist/test/idCompressorTestUtilities.d.ts +2 -2
  31. package/dist/test/idCompressorTestUtilities.d.ts.map +1 -1
  32. package/dist/test/idCompressorTestUtilities.js +25 -1
  33. package/dist/test/idCompressorTestUtilities.js.map +1 -1
  34. package/dist/test/numericUuid.spec.js.map +1 -1
  35. package/dist/test/sessionSpaceNormalizer.spec.js.map +1 -1
  36. package/dist/test/snapshots/summary.spec.js.map +1 -1
  37. package/dist/test/testCommon.d.ts +1 -1
  38. package/dist/test/testCommon.d.ts.map +1 -1
  39. package/dist/test/testCommon.js +4 -4
  40. package/dist/test/testCommon.js.map +1 -1
  41. package/dist/types/idCompressor.d.ts +2 -2
  42. package/dist/types/idCompressor.d.ts.map +1 -1
  43. package/dist/types/idCompressor.js.map +1 -1
  44. package/dist/types/persisted-types/0.0.1.d.ts +4 -0
  45. package/dist/types/persisted-types/0.0.1.d.ts.map +1 -1
  46. package/dist/types/persisted-types/0.0.1.js.map +1 -1
  47. package/dist/utilities.d.ts +1 -1
  48. package/dist/utilities.d.ts.map +1 -1
  49. package/dist/utilities.js +2 -2
  50. package/dist/utilities.js.map +1 -1
  51. package/internal.d.ts +11 -0
  52. package/legacy.d.ts +11 -0
  53. package/lib/appendOnlySortedMap.js +1 -1
  54. package/lib/appendOnlySortedMap.js.map +1 -1
  55. package/lib/finalSpace.d.ts +1 -1
  56. package/lib/finalSpace.d.ts.map +1 -1
  57. package/lib/finalSpace.js +1 -1
  58. package/lib/finalSpace.js.map +1 -1
  59. package/lib/idCompressor.d.ts +1 -1
  60. package/lib/idCompressor.d.ts.map +1 -1
  61. package/lib/idCompressor.js +6 -5
  62. package/lib/idCompressor.js.map +1 -1
  63. package/lib/legacy.d.ts +28 -0
  64. package/lib/packageVersion.d.ts +1 -1
  65. package/lib/packageVersion.js +1 -1
  66. package/lib/packageVersion.js.map +1 -1
  67. package/lib/public.d.ts +18 -0
  68. package/lib/sessionSpaceNormalizer.d.ts +2 -0
  69. package/lib/sessionSpaceNormalizer.d.ts.map +1 -1
  70. package/lib/sessionSpaceNormalizer.js +44 -0
  71. package/lib/sessionSpaceNormalizer.js.map +1 -1
  72. package/lib/sessions.d.ts +1 -1
  73. package/lib/sessions.d.ts.map +1 -1
  74. package/lib/sessions.js +2 -2
  75. package/lib/sessions.js.map +1 -1
  76. package/lib/test/appendOnlySortedMap.perf.spec.js.map +1 -1
  77. package/lib/test/appendOnlySortedMap.spec.js.map +1 -1
  78. package/lib/test/idCompressor.perf.spec.js.map +1 -1
  79. package/lib/test/idCompressor.spec.js.map +1 -1
  80. package/lib/test/idCompressorTestUtilities.d.ts +2 -2
  81. package/lib/test/idCompressorTestUtilities.d.ts.map +1 -1
  82. package/lib/test/idCompressorTestUtilities.js +27 -3
  83. package/lib/test/idCompressorTestUtilities.js.map +1 -1
  84. package/lib/test/numericUuid.spec.js.map +1 -1
  85. package/lib/test/sessionSpaceNormalizer.spec.js.map +1 -1
  86. package/lib/test/snapshots/summary.spec.js.map +1 -1
  87. package/lib/test/testCommon.d.ts +1 -1
  88. package/lib/test/testCommon.d.ts.map +1 -1
  89. package/lib/test/testCommon.js +1 -1
  90. package/lib/test/testCommon.js.map +1 -1
  91. package/lib/types/idCompressor.d.ts +2 -2
  92. package/lib/types/idCompressor.d.ts.map +1 -1
  93. package/lib/types/idCompressor.js.map +1 -1
  94. package/lib/types/persisted-types/0.0.1.d.ts +4 -0
  95. package/lib/types/persisted-types/0.0.1.d.ts.map +1 -1
  96. package/lib/types/persisted-types/0.0.1.js.map +1 -1
  97. package/lib/utilities.d.ts +1 -1
  98. package/lib/utilities.d.ts.map +1 -1
  99. package/lib/utilities.js +1 -1
  100. package/lib/utilities.js.map +1 -1
  101. package/package.json +35 -65
  102. package/src/appendOnlySortedMap.ts +1 -1
  103. package/src/finalSpace.ts +3 -2
  104. package/src/idCompressor.ts +31 -25
  105. package/src/packageVersion.ts +1 -1
  106. package/src/sessionSpaceNormalizer.ts +63 -0
  107. package/src/sessions.ts +5 -4
  108. package/src/test/idCompressorTestUtilities.ts +38 -10
  109. package/src/test/testCommon.ts +4 -3
  110. package/src/test/tsconfig.json +1 -1
  111. package/src/types/idCompressor.ts +2 -2
  112. package/src/types/persisted-types/0.0.1.ts +5 -0
  113. package/src/utilities.ts +3 -2
  114. package/api-extractor-cjs.json +0 -8
  115. package/dist/id-compressor-alpha.d.ts +0 -352
  116. package/dist/id-compressor-beta.d.ts +0 -179
  117. package/dist/id-compressor-public.d.ts +0 -179
  118. package/dist/id-compressor-untrimmed.d.ts +0 -365
  119. package/lib/id-compressor-alpha.d.ts +0 -352
  120. package/lib/id-compressor-beta.d.ts +0 -179
  121. package/lib/id-compressor-public.d.ts +0 -179
  122. package/lib/id-compressor-untrimmed.d.ts +0 -365
  123. package/lib/test/appendOnlySortedMap.perf.spec.js +0 -49
  124. package/lib/test/appendOnlySortedMap.spec.js +0 -166
  125. package/lib/test/idCompressor.perf.spec.js +0 -281
  126. package/lib/test/idCompressor.spec.js +0 -953
  127. package/lib/test/numericUuid.spec.js +0 -74
  128. package/lib/test/sessionSpaceNormalizer.spec.js +0 -43
  129. package/lib/test/snapshots/summary.spec.js +0 -127
  130. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAmBlE;;;GAGG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAE3C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAG3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAG7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,QAAQ,CAuCvD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GA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;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,QAAQ,CAuCvD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEzE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEnE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,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,CAGvF;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,CAG3E"}
package/lib/utilities.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /* eslint-disable no-bitwise */
6
- import { assert } from "@fluidframework/core-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { v4 } from "uuid";
8
8
  const hexadecimalCharCodes = Array.from("09afAF").map((c) => c.charCodeAt(0));
9
9
  function isHexadecimalCharacter(charCode) {
@@ -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,4BAA4B,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAI1B,MAAM,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAO3E,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,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC;QAC5E,CAAC,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,gBAAgB,CAAC,EAAE,EAAE,CAAc,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAChD,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC9D,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IACjD,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3B,OAAO,QAAqB,CAAC;AAC9B,CA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AwB,EAAE,MAAc;IACzE,qEAAqE;IACrE,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,qEAAqE;IACrE,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\";\nimport { v4 } from \"uuid\";\nimport { SessionId, StableId } from \"./types/index.js\";\nimport { LocalCompressedId, NumericUuid } from \"./identifiers.js\";\n\nconst hexadecimalCharCodes = Array.from(\"09afAF\").map((c) => c.charCodeAt(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 * @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\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\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\tif (!isHexadecimalCharacter(str.charCodeAt(i))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\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.substring(0, 8)}-${uuidString.substring(8, 12)}-${uuidString.substring(\n\t\t12,\n\t\t16,\n\t)}-${uuidString.substring(16, 20)}-${uuidString.substring(20, 32)}` as StableId;\n}\n\nexport function offsetNumericUuid(numericUuid: NumericUuid, offset: number): NumericUuid {\n\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n\treturn (a + b) as NumericUuid;\n}\n"]}
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,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAO3E,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,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC;QAC5E,CAAC,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,gBAAgB,CAAC,EAAE,EAAE,CAAc,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAChD,M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C,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAC1F,EAAE,EACF,EAAE,CACF,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAc,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAwB,EAAE,MAAc;IACzE,qEAAqE;IACrE,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,qEAAqE;IACrE,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 { LocalCompressedId, NumericUuid } from \"./identifiers.js\";\nimport { SessionId, StableId } from \"./types/index.js\";\n\nconst hexadecimalCharCodes = Array.from(\"09afAF\").map((c) => c.charCodeAt(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 * @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\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\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\tif (!isHexadecimalCharacter(str.charCodeAt(i))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\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.substring(0, 8)}-${uuidString.substring(8, 12)}-${uuidString.substring(\n\t\t12,\n\t\t16,\n\t)}-${uuidString.substring(16, 20)}-${uuidString.substring(20, 32)}` as StableId;\n}\n\nexport function offsetNumericUuid(numericUuid: NumericUuid, offset: number): NumericUuid {\n\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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\t// eslint-disable-next-line @typescript-eslint/restrict-plus-operands\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.0.0-rc.2.0.2",
3
+ "version": "2.0.0-rc.3.0.1",
4
4
  "description": "ID compressor",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -15,31 +15,21 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- }
25
- },
26
- "./public": {
27
- "import": {
28
- "types": "./lib/id-compressor-public.d.ts",
18
+ "types": "./lib/public.d.ts",
29
19
  "default": "./lib/index.js"
30
20
  },
31
21
  "require": {
32
- "types": "./dist/id-compressor-public.d.ts",
22
+ "types": "./dist/public.d.ts",
33
23
  "default": "./dist/index.js"
34
24
  }
35
25
  },
36
- "./alpha": {
26
+ "./legacy": {
37
27
  "import": {
38
- "types": "./lib/id-compressor-alpha.d.ts",
28
+ "types": "./lib/legacy.d.ts",
39
29
  "default": "./lib/index.js"
40
30
  },
41
31
  "require": {
42
- "types": "./dist/id-compressor-alpha.d.ts",
32
+ "types": "./dist/legacy.d.ts",
43
33
  "default": "./dist/index.js"
44
34
  }
45
35
  },
@@ -53,7 +43,7 @@
53
43
  "default": "./dist/index.js"
54
44
  }
55
45
  },
56
- "./test": {
46
+ "./internal/test-utils": {
57
47
  "import": {
58
48
  "types": "./lib/test/index.d.ts",
59
49
  "default": "./lib/test/index.js"
@@ -62,31 +52,21 @@
62
52
  "types": "./dist/test/index.d.ts",
63
53
  "default": "./dist/test/index.js"
64
54
  }
65
- },
66
- "./test/idCompressorTestUtilities": {
67
- "import": {
68
- "types": "./lib/test/idCompressorTestUtilities.d.ts",
69
- "default": "./lib/test/idCompressorTestUtilities.js"
70
- },
71
- "require": {
72
- "types": "./dist/test/idCompressorTestUtilities.d.ts",
73
- "default": "./dist/test/idCompressorTestUtilities.js"
74
- }
75
55
  }
76
56
  },
77
- "main": "dist/index.js",
78
- "types": "dist/index.d.ts",
57
+ "main": "lib/index.js",
58
+ "types": "lib/public.d.ts",
79
59
  "c8": {
80
60
  "all": true,
81
61
  "cache-dir": "nyc/.cache",
82
62
  "exclude": [
83
63
  "src/test/**/*.*ts",
84
- "dist/test/**/*.*js"
64
+ "lib/test/**/*.*js"
85
65
  ],
86
66
  "exclude-after-remap": false,
87
67
  "include": [
88
68
  "src/**/*.*ts",
89
- "dist/**/*.*js"
69
+ "lib/**/*.*js"
90
70
  ],
91
71
  "report-dir": "nyc/report",
92
72
  "reporter": [
@@ -97,25 +77,27 @@
97
77
  "temp-directory": "nyc/.nyc_output"
98
78
  },
99
79
  "dependencies": {
100
- "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
101
- "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
102
- "@fluidframework/core-utils": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
103
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
80
+ "@fluid-internal/client-utils": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
81
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
82
+ "@fluidframework/core-utils": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
83
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
104
84
  "@tylerbu/sorted-btree-es6": "^1.8.0",
105
85
  "uuid": "^9.0.0"
106
86
  },
107
87
  "devDependencies": {
108
- "@arethetypeswrong/cli": "^0.13.3",
109
- "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
110
- "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.2.0.2 <2.0.0-rc.2.1.0",
88
+ "@arethetypeswrong/cli": "^0.15.2",
89
+ "@biomejs/biome": "^1.6.2",
90
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
91
+ "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.3.0.1 <2.0.0-rc.3.1.0",
111
92
  "@fluid-tools/benchmark": "^0.48.0",
112
- "@fluid-tools/build-cli": "^0.34.0",
93
+ "@fluid-tools/build-cli": "^0.37.0",
113
94
  "@fluidframework/build-common": "^2.0.3",
114
- "@fluidframework/build-tools": "^0.34.0",
115
- "@fluidframework/eslint-config-fluid": "^4.0.0",
95
+ "@fluidframework/build-tools": "^0.37.0",
96
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
116
97
  "@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.0.0-internal.8.0.0",
117
98
  "@microsoft/api-extractor": "^7.42.3",
118
99
  "@types/mocha": "^9.1.1",
100
+ "@types/node": "^18.19.0",
119
101
  "@types/uuid": "^9.0.2",
120
102
  "c8": "^8.0.1",
121
103
  "copyfiles": "^2.4.1",
@@ -129,47 +111,35 @@
129
111
  "rimraf": "^4.4.0",
130
112
  "typescript": "~5.1.6"
131
113
  },
132
- "fluidBuild": {
133
- "tasks": {
134
- "build:docs": {
135
- "dependsOn": [
136
- "...",
137
- "api-extractor:commonjs",
138
- "api-extractor:esnext"
139
- ],
140
- "script": false
141
- }
142
- }
143
- },
144
114
  "typeValidation": {
145
115
  "broken": {}
146
116
  },
147
117
  "scripts": {
148
118
  "api": "fluid-build . --task api",
149
- "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
150
- "api-extractor:esnext": "api-extractor run --local",
119
+ "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
120
+ "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
151
121
  "build": "fluid-build . --task build",
152
122
  "build:commonjs": "fluid-build . --task commonjs",
153
123
  "build:compile": "fluid-build . --task compile",
154
- "build:docs": "fluid-build . --task api",
124
+ "build:docs": "api-extractor run --local",
155
125
  "build:esnext": "tsc --project ./tsconfig.json",
156
126
  "build:genver": "gen-version",
157
127
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
158
128
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
159
129
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
160
- "check:are-the-types-wrong": "attw --pack . --entrypoints .",
130
+ "check:are-the-types-wrong": "attw --pack . --exclude-entrypoints ./internal/test-utils",
131
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
161
132
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
162
133
  "ci:build:docs": "api-extractor run",
163
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
134
+ "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
164
135
  "eslint": "eslint --format stylish src",
165
136
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
166
- "format": "npm run prettier:fix",
167
- "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
168
- "lint:fix": "npm run prettier:fix && npm run eslint:fix",
169
- "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
170
- "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
137
+ "format": "fluid-build --task format .",
138
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
139
+ "lint": "fluid-build . --task lint",
140
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
171
141
  "test": "npm run test:mocha",
172
- "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./dist/**/*.perf.spec.*js\"",
142
+ "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./lib/**/*.perf.spec.*js\"",
173
143
  "test:coverage": "c8 npm test",
174
144
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
175
145
  "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
@@ -177,6 +147,6 @@
177
147
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
178
148
  "test:snapshots:regen": "npm run test:mocha:esm -- --snapshot",
179
149
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
180
- "tsc:watch": "tsc --watch"
150
+ "tsc:watch": "copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist && fluid-tsc commonjs --watch --project ./tsconfig.cjs.json"
181
151
  }
182
152
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  /* eslint-disable tsdoc/syntax */
7
7
  /* eslint-disable no-bitwise */
8
- import { assert } from "@fluidframework/core-utils";
8
+ import { assert } from "@fluidframework/core-utils/internal";
9
9
 
10
10
  /**
11
11
  * A map in which entries are always added in key-sorted order.
package/src/finalSpace.ts CHANGED
@@ -3,9 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
7
- import { IdCluster, clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from "./sessions.js";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+
8
8
  import { FinalCompressedId } from "./identifiers.js";
9
+ import { IdCluster, clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from "./sessions.js";
9
10
 
10
11
  /**
11
12
  * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
@@ -3,14 +3,37 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
7
6
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
8
7
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
9
- import { ITelemetryLoggerExt, createChildLogger } from "@fluidframework/telemetry-utils";
8
+ import { assert } from "@fluidframework/core-utils/internal";
9
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
10
+ import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
11
+
12
+ import { FinalSpace } from "./finalSpace.js";
13
+ import { FinalCompressedId, LocalCompressedId, NumericUuid, isFinalId } from "./identifiers.js";
14
+ import {
15
+ Index,
16
+ readBoolean,
17
+ readNumber,
18
+ readNumericUuid,
19
+ writeBoolean,
20
+ writeNumber,
21
+ writeNumericUuid,
22
+ } from "./persistanceUtilities.js";
23
+ import { SessionSpaceNormalizer } from "./sessionSpaceNormalizer.js";
24
+ import {
25
+ IdCluster,
26
+ Session,
27
+ Sessions,
28
+ getAlignedFinal,
29
+ getAlignedLocal,
30
+ lastFinalizedFinal,
31
+ lastFinalizedLocal,
32
+ } from "./sessions.js";
10
33
  import {
11
- IdCreationRange,
12
34
  IIdCompressor,
13
35
  IIdCompressorCore,
36
+ IdCreationRange,
14
37
  OpSpaceCompressedId,
15
38
  SerializedIdCompressor,
16
39
  SerializedIdCompressorWithNoSession,
@@ -19,36 +42,15 @@ import {
19
42
  SessionSpaceCompressedId,
20
43
  StableId,
21
44
  } from "./types/index.js";
22
- import { FinalCompressedId, isFinalId, LocalCompressedId, NumericUuid } from "./identifiers.js";
23
45
  import {
24
46
  createSessionId,
25
- localIdFromGenCount,
26
47
  genCountFromLocalId,
48
+ localIdFromGenCount,
27
49
  numericUuidFromStableId,
28
50
  offsetNumericUuid,
29
51
  stableIdFromNumericUuid,
30
52
  subtractNumericUuids,
31
53
  } from "./utilities.js";
32
- import {
33
- Index,
34
- readBoolean,
35
- readNumber,
36
- readNumericUuid,
37
- writeBoolean,
38
- writeNumber,
39
- writeNumericUuid,
40
- } from "./persistanceUtilities.js";
41
- import {
42
- getAlignedLocal,
43
- getAlignedFinal,
44
- IdCluster,
45
- lastFinalizedLocal,
46
- Session,
47
- Sessions,
48
- lastFinalizedFinal,
49
- } from "./sessions.js";
50
- import { SessionSpaceNormalizer } from "./sessionSpaceNormalizer.js";
51
- import { FinalSpace } from "./finalSpace.js";
52
54
 
53
55
  /**
54
56
  * The version of IdCompressor that is currently persisted.
@@ -215,6 +217,10 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
215
217
  firstGenCount: this.nextRangeBaseGenCount,
216
218
  count,
217
219
  requestedClusterSize: this.nextRequestedClusterSize,
220
+ localIdRanges: this.normalizer.getRangesBetween(
221
+ this.nextRangeBaseGenCount,
222
+ this.localGenCount,
223
+ ),
218
224
  },
219
225
  };
220
226
  this.nextRangeBaseGenCount = this.localGenCount + 1;
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/id-compressor";
9
- export const pkgVersion = "2.0.0-rc.2.0.2";
9
+ export const pkgVersion = "2.0.0-rc.3.0.1";
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { assert } from "@fluidframework/core-utils/internal";
6
7
  import { AppendOnlySortedMap } from "./appendOnlySortedMap.js";
7
8
  import { LocalCompressedId } from "./identifiers.js";
8
9
  import { compareFiniteNumbers, genCountFromLocalId } from "./utilities.js";
@@ -48,6 +49,68 @@ export class SessionSpaceNormalizer {
48
49
  return this.localIdRanges;
49
50
  }
50
51
 
52
+ public getRangesBetween(
53
+ firstGenCount: number,
54
+ lastGenCount: number,
55
+ ): [genCount: number, count: number][] {
56
+ const ranges: [genCount: number, count: number][] = [];
57
+ // we need to find the first range that either contains firstGenCount or is after it,
58
+ // since this method must find ranges between firstGenCount and lastGenCount
59
+ let firstRange = this.localIdRanges.getPairOrNextLower(firstGenCount);
60
+ // if the first range does not contain the first ID, next higher range is between but non-containing
61
+ if (firstRange === undefined || !this.rangeContains(firstRange, firstGenCount)) {
62
+ firstRange = this.localIdRanges.getPairOrNextHigher(firstGenCount);
63
+ if (firstRange === undefined) {
64
+ return ranges;
65
+ }
66
+ }
67
+
68
+ for (const [genCount, count] of this.localIdRanges.getRange(firstRange[0], lastGenCount)) {
69
+ ranges.push([genCount, count]);
70
+ }
71
+
72
+ if (ranges.length === 0) {
73
+ return ranges;
74
+ }
75
+
76
+ // now we touch up the first and last ranges to ensure that if they contain the
77
+ // queried IDs they are trimmed to start/end with the queried IDs
78
+ const [baseGenCount, baseCount] = ranges[0];
79
+ if (this.rangeContains(ranges[0], firstGenCount)) {
80
+ ranges[0] = [firstGenCount, baseCount - (firstGenCount - baseGenCount)];
81
+ assert(
82
+ this.rangeContains(ranges[0], firstGenCount),
83
+ 0x952 /* Expected the touched up range to contain the queried ID */,
84
+ );
85
+ } else {
86
+ assert(
87
+ baseGenCount > firstGenCount,
88
+ 0x953 /* Expected the first range to start after the queried ID */,
89
+ );
90
+ }
91
+
92
+ const lastRangeIndex = ranges.length - 1;
93
+ const [limitGenCount, limitCount] = ranges[lastRangeIndex];
94
+ if (this.rangeContains(ranges[lastRangeIndex], lastGenCount)) {
95
+ ranges[lastRangeIndex] = [limitGenCount, lastGenCount - limitGenCount + 1];
96
+ assert(
97
+ this.rangeContains(ranges[lastRangeIndex], lastGenCount),
98
+ 0x954 /* Expected the touched up range to contain the queried ID */,
99
+ );
100
+ } else {
101
+ assert(
102
+ limitGenCount + limitCount - 1 < lastGenCount,
103
+ 0x955 /* Expected the last range to end before the queried ID */,
104
+ );
105
+ }
106
+ return ranges;
107
+ }
108
+
109
+ private rangeContains(range: readonly [number, number], genCount: number): boolean {
110
+ const [baseGenCount, count] = range;
111
+ return genCount >= baseGenCount && genCount < baseGenCount + count;
112
+ }
113
+
51
114
  public addLocalRange(baseGenCount: number, count: number): void {
52
115
  const last = this.localIdRanges.last();
53
116
  if (last !== undefined) {
package/src/sessions.ts CHANGED
@@ -3,19 +3,20 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { assert } from "@fluidframework/core-utils/internal";
6
7
  import { BTree } from "@tylerbu/sorted-btree-es6";
7
- import { assert } from "@fluidframework/core-utils";
8
+
9
+ import { FinalCompressedId, LocalCompressedId, NumericUuid } from "./identifiers.js";
8
10
  import { SessionId, StableId } from "./types/index.js";
9
11
  import {
10
12
  compareBigints,
11
- localIdFromGenCount,
12
13
  genCountFromLocalId,
14
+ localIdFromGenCount,
13
15
  numericUuidFromStableId,
16
+ offsetNumericUuid,
14
17
  stableIdFromNumericUuid,
15
18
  subtractNumericUuids,
16
- offsetNumericUuid,
17
19
  } from "./utilities.js";
18
- import { FinalCompressedId, LocalCompressedId, NumericUuid } from "./identifiers.js";
19
20
 
20
21
  /**
21
22
  * A collection of all sessions known to the compressor (i.e. all finalized/acked allocated UUIDs and their corresponding local and final forms).
@@ -4,20 +4,24 @@
4
4
  */
5
5
 
6
6
  import { strict as assert } from "assert";
7
+
7
8
  import {
9
+ BaseFuzzTestState,
8
10
  Generator,
11
+ SaveInfo,
9
12
  createWeightedGenerator,
10
13
  interleave,
11
14
  makeRandom,
12
15
  performFuzzActions as performFuzzActionsBase,
13
16
  repeat,
14
- SaveInfo,
15
17
  take,
16
- BaseFuzzTestState,
17
18
  } from "@fluid-private/stochastic-test-utils";
18
19
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
20
+
21
+ import { IdCompressor } from "../idCompressor.js";
19
22
  import {
20
- createIdCompressor,
23
+ type IIdCompressor,
24
+ type IIdCompressorCore,
21
25
  IdCreationRange,
22
26
  OpSpaceCompressedId,
23
27
  SerializedIdCompressorWithNoSession,
@@ -25,19 +29,18 @@ import {
25
29
  SessionId,
26
30
  SessionSpaceCompressedId,
27
31
  StableId,
28
- type IIdCompressor,
29
- type IIdCompressorCore,
30
- } from "..//index.js";
31
- import { IdCompressor } from "../idCompressor.js";
32
- import { assertIsSessionId, createSessionId } from "../utilities.js";
32
+ createIdCompressor,
33
+ } from "../index.js";
34
+ import { assertIsSessionId, createSessionId, localIdFromGenCount } from "../utilities.js";
35
+
33
36
  import {
34
37
  FinalCompressedId,
38
+ ReadonlyIdCompressor,
39
+ fail,
35
40
  getOrCreate,
36
41
  incrementStableId,
37
42
  isFinalId,
38
43
  isLocalId,
39
- ReadonlyIdCompressor,
40
- fail,
41
44
  } from "./testCommon.js";
42
45
 
43
46
  /**
@@ -135,6 +138,7 @@ export function buildHugeCompressor(
135
138
  firstGenCount: Math.floor(i / numSessions) * capacity + 1,
136
139
  count: capacity,
137
140
  requestedClusterSize: capacity,
141
+ localIdRanges: [], // remote session, can safely ignore in tests
138
142
  },
139
143
  });
140
144
  }
@@ -338,6 +342,7 @@ export class IdCompressorTestNetwork {
338
342
  // eslint-disable-next-line @typescript-eslint/dot-notation
339
343
  "nextRequestedClusterSize"
340
344
  ],
345
+ localIdRanges: [], // remote session, can safely ignore in tests
341
346
  },
342
347
  };
343
348
  const opSpaceIds: OpSpaceCompressedId[] = [];
@@ -422,6 +427,29 @@ export class IdCompressorTestNetwork {
422
427
  (client) => [this.compressors.get(client), this.getSequencedIdLog(client)] as const,
423
428
  );
424
429
 
430
+ // Ensure creation ranges for clients we track contain the correct local ID ranges
431
+ this.serverOperations.forEach(([range, opSpaceIds, clientFrom]) => {
432
+ const localIdsInCreationRange = new Set<SessionSpaceCompressedId>();
433
+ if (clientFrom !== OriginatingClient.Remote) {
434
+ const ids = range.ids;
435
+ if (ids !== undefined) {
436
+ const { firstGenCount, localIdRanges } = ids;
437
+ for (const [genCount, count] of localIdRanges) {
438
+ for (let g = genCount; g < genCount + count; g++) {
439
+ const local = localIdFromGenCount(g);
440
+ assert.strictEqual(opSpaceIds[g - firstGenCount], local);
441
+ localIdsInCreationRange.add(local);
442
+ }
443
+ }
444
+ }
445
+ opSpaceIds.forEach((id) => {
446
+ if (isLocalId(id)) {
447
+ assert(localIdsInCreationRange.has(id), "Local ID not in creation range");
448
+ }
449
+ });
450
+ }
451
+ });
452
+
425
453
  // First, ensure all clients each generated a unique ID for each of their own calls to generate.
426
454
  for (const [compressor, ids] of sequencedLogs) {
427
455
  const allUuids = new Set<StableId | string>();
@@ -3,14 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
7
- import { SessionSpaceCompressedId, StableId, OpSpaceCompressedId } from "..//index.js";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+
8
+ import { IdCompressor } from "../idCompressor.js";
9
+ import { OpSpaceCompressedId, SessionSpaceCompressedId, StableId } from "../index.js";
8
10
  import {
9
11
  numericUuidFromStableId,
10
12
  offsetNumericUuid,
11
13
  stableIdFromNumericUuid,
12
14
  } from "../utilities.js";
13
- import { IdCompressor } from "../idCompressor.js";
14
15
 
15
16
  /**
16
17
  * An identifier (v4 UUID) that has been shortened by a distributed compression algorithm.
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "rootDir": "./",
5
5
  "outDir": "../../lib/test",
6
- "types": ["mocha"],
6
+ "types": ["mocha", "node"],
7
7
 
8
8
  // The package exports utilities for test code from the test folder, so we need to build types for test files, which we typically
9
9
  // don't do.
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import {
7
- SessionSpaceCompressedId,
8
7
  OpSpaceCompressedId,
9
8
  SessionId,
9
+ SessionSpaceCompressedId,
10
10
  StableId,
11
11
  } from "./identifiers.js";
12
12
  import {
@@ -112,7 +112,7 @@ export interface IIdCompressorCore {
112
112
  * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.
113
113
  * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.
114
114
  */
115
- beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void);
115
+ beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;
116
116
 
117
117
  /**
118
118
  * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.
@@ -54,5 +54,10 @@ export interface IdCreationRange {
54
54
  * will be equal to overflow + `requestedClusterSize`.
55
55
  */
56
56
  readonly requestedClusterSize: number;
57
+
58
+ /**
59
+ * The ranges of IDs that were allocated as local IDs in the range created by `sessionId.`
60
+ */
61
+ readonly localIdRanges: [genCount: number, count: number][];
57
62
  };
58
63
  }