@fluidframework/id-compressor 2.0.0-dev.7.4.0.221926

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 (157) hide show
  1. package/.eslintrc.js +27 -0
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +170 -0
  6. package/api-extractor-lint.json +13 -0
  7. package/api-extractor.json +12 -0
  8. package/api-report/id-compressor.api.md +143 -0
  9. package/dist/appendOnlySortedMap.d.ts +124 -0
  10. package/dist/appendOnlySortedMap.d.ts.map +1 -0
  11. package/dist/appendOnlySortedMap.js +318 -0
  12. package/dist/appendOnlySortedMap.js.map +1 -0
  13. package/dist/finalSpace.d.ts +29 -0
  14. package/dist/finalSpace.d.ts.map +1 -0
  15. package/dist/finalSpace.js +62 -0
  16. package/dist/finalSpace.js.map +1 -0
  17. package/dist/id-compressor-alpha.d.ts +311 -0
  18. package/dist/id-compressor-beta.d.ts +41 -0
  19. package/dist/id-compressor-public.d.ts +41 -0
  20. package/dist/id-compressor-untrimmed.d.ts +329 -0
  21. package/dist/idCompressor.d.ts +85 -0
  22. package/dist/idCompressor.d.ts.map +1 -0
  23. package/dist/idCompressor.js +509 -0
  24. package/dist/idCompressor.js.map +1 -0
  25. package/dist/identifiers.d.ts +32 -0
  26. package/dist/identifiers.d.ts.map +1 -0
  27. package/dist/identifiers.js +15 -0
  28. package/dist/identifiers.js.map +1 -0
  29. package/dist/index.d.ts +11 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +22 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/packageVersion.d.ts +9 -0
  34. package/dist/packageVersion.d.ts.map +1 -0
  35. package/dist/packageVersion.js +12 -0
  36. package/dist/packageVersion.js.map +1 -0
  37. package/dist/persistanceUtilities.d.ts +22 -0
  38. package/dist/persistanceUtilities.d.ts.map +1 -0
  39. package/dist/persistanceUtilities.js +43 -0
  40. package/dist/persistanceUtilities.js.map +1 -0
  41. package/dist/sessionSpaceNormalizer.d.ts +46 -0
  42. package/dist/sessionSpaceNormalizer.d.ts.map +1 -0
  43. package/dist/sessionSpaceNormalizer.js +80 -0
  44. package/dist/sessionSpaceNormalizer.js.map +1 -0
  45. package/dist/sessions.d.ts +115 -0
  46. package/dist/sessions.d.ts.map +1 -0
  47. package/dist/sessions.js +305 -0
  48. package/dist/sessions.js.map +1 -0
  49. package/dist/tsdoc-metadata.json +11 -0
  50. package/dist/types/idCompressor.d.ts +139 -0
  51. package/dist/types/idCompressor.d.ts.map +1 -0
  52. package/dist/types/idCompressor.js +7 -0
  53. package/dist/types/idCompressor.js.map +1 -0
  54. package/dist/types/identifiers.d.ts +40 -0
  55. package/dist/types/identifiers.d.ts.map +1 -0
  56. package/dist/types/identifiers.js +7 -0
  57. package/dist/types/identifiers.js.map +1 -0
  58. package/dist/types/index.d.ts +8 -0
  59. package/dist/types/index.d.ts.map +1 -0
  60. package/dist/types/index.js +10 -0
  61. package/dist/types/index.js.map +1 -0
  62. package/dist/types/persisted-types/0.0.1.d.ts +46 -0
  63. package/dist/types/persisted-types/0.0.1.d.ts.map +1 -0
  64. package/dist/types/persisted-types/0.0.1.js +14 -0
  65. package/dist/types/persisted-types/0.0.1.js.map +1 -0
  66. package/dist/types/persisted-types/index.d.ts +6 -0
  67. package/dist/types/persisted-types/index.d.ts.map +1 -0
  68. package/dist/types/persisted-types/index.js +10 -0
  69. package/dist/types/persisted-types/index.js.map +1 -0
  70. package/dist/utilities.d.ts +53 -0
  71. package/dist/utilities.d.ts.map +1 -0
  72. package/dist/utilities.js +170 -0
  73. package/dist/utilities.js.map +1 -0
  74. package/lib/appendOnlySortedMap.d.ts +124 -0
  75. package/lib/appendOnlySortedMap.d.ts.map +1 -0
  76. package/lib/appendOnlySortedMap.js +314 -0
  77. package/lib/appendOnlySortedMap.js.map +1 -0
  78. package/lib/finalSpace.d.ts +29 -0
  79. package/lib/finalSpace.d.ts.map +1 -0
  80. package/lib/finalSpace.js +58 -0
  81. package/lib/finalSpace.js.map +1 -0
  82. package/lib/id-compressor-alpha.d.ts +311 -0
  83. package/lib/id-compressor-beta.d.ts +41 -0
  84. package/lib/id-compressor-public.d.ts +41 -0
  85. package/lib/id-compressor-untrimmed.d.ts +329 -0
  86. package/lib/idCompressor.d.ts +85 -0
  87. package/lib/idCompressor.d.ts.map +1 -0
  88. package/lib/idCompressor.js +503 -0
  89. package/lib/idCompressor.js.map +1 -0
  90. package/lib/identifiers.d.ts +32 -0
  91. package/lib/identifiers.d.ts.map +1 -0
  92. package/lib/identifiers.js +11 -0
  93. package/lib/identifiers.js.map +1 -0
  94. package/lib/index.d.ts +11 -0
  95. package/lib/index.d.ts.map +1 -0
  96. package/lib/index.js +11 -0
  97. package/lib/index.js.map +1 -0
  98. package/lib/packageVersion.d.ts +9 -0
  99. package/lib/packageVersion.d.ts.map +1 -0
  100. package/lib/packageVersion.js +9 -0
  101. package/lib/packageVersion.js.map +1 -0
  102. package/lib/persistanceUtilities.d.ts +22 -0
  103. package/lib/persistanceUtilities.d.ts.map +1 -0
  104. package/lib/persistanceUtilities.js +34 -0
  105. package/lib/persistanceUtilities.js.map +1 -0
  106. package/lib/sessionSpaceNormalizer.d.ts +46 -0
  107. package/lib/sessionSpaceNormalizer.d.ts.map +1 -0
  108. package/lib/sessionSpaceNormalizer.js +76 -0
  109. package/lib/sessionSpaceNormalizer.js.map +1 -0
  110. package/lib/sessions.d.ts +115 -0
  111. package/lib/sessions.d.ts.map +1 -0
  112. package/lib/sessions.js +290 -0
  113. package/lib/sessions.js.map +1 -0
  114. package/lib/types/idCompressor.d.ts +139 -0
  115. package/lib/types/idCompressor.d.ts.map +1 -0
  116. package/lib/types/idCompressor.js +6 -0
  117. package/lib/types/idCompressor.js.map +1 -0
  118. package/lib/types/identifiers.d.ts +40 -0
  119. package/lib/types/identifiers.d.ts.map +1 -0
  120. package/lib/types/identifiers.js +6 -0
  121. package/lib/types/identifiers.js.map +1 -0
  122. package/lib/types/index.d.ts +8 -0
  123. package/lib/types/index.d.ts.map +1 -0
  124. package/lib/types/index.js +6 -0
  125. package/lib/types/index.js.map +1 -0
  126. package/lib/types/persisted-types/0.0.1.d.ts +46 -0
  127. package/lib/types/persisted-types/0.0.1.d.ts.map +1 -0
  128. package/lib/types/persisted-types/0.0.1.js +11 -0
  129. package/lib/types/persisted-types/0.0.1.js.map +1 -0
  130. package/lib/types/persisted-types/index.d.ts +6 -0
  131. package/lib/types/persisted-types/index.d.ts.map +1 -0
  132. package/lib/types/persisted-types/index.js +6 -0
  133. package/lib/types/persisted-types/index.js.map +1 -0
  134. package/lib/utilities.d.ts +53 -0
  135. package/lib/utilities.d.ts.map +1 -0
  136. package/lib/utilities.js +152 -0
  137. package/lib/utilities.js.map +1 -0
  138. package/package.json +110 -0
  139. package/prettier.config.cjs +8 -0
  140. package/src/appendOnlySortedMap.ts +366 -0
  141. package/src/finalSpace.ts +67 -0
  142. package/src/idCompressor.ts +689 -0
  143. package/src/identifiers.ts +42 -0
  144. package/src/index.ts +24 -0
  145. package/src/packageVersion.ts +9 -0
  146. package/src/persistanceUtilities.ts +58 -0
  147. package/src/sessionSpaceNormalizer.ts +83 -0
  148. package/src/sessions.ts +405 -0
  149. package/src/types/idCompressor.ts +155 -0
  150. package/src/types/identifiers.ts +39 -0
  151. package/src/types/index.ts +16 -0
  152. package/src/types/persisted-types/0.0.1.ts +51 -0
  153. package/src/types/persisted-types/README.md +3 -0
  154. package/src/types/persisted-types/index.ts +12 -0
  155. package/src/utilities.ts +191 -0
  156. package/tsconfig.esnext.json +7 -0
  157. package/tsconfig.json +10 -0
@@ -0,0 +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,gBAAgB,CAAC;AAEhD;;;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,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACvB,CAAC;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.
7
+ * This value must *NOT* change without careful consideration to compatibility.
8
+ * @internal
9
+ */
10
+ export const initialClusterCapacity = 512;
11
+ //# sourceMappingURL=0.0.1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0.0.1.js","sourceRoot":"","sources":["../../../src/types/persisted-types/0.0.1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0CH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"../identifiers\";\n\n/**\n * The serialized contents of an IdCompressor, suitable for persistence in a summary.\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 * @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 * @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 * @alpha\n */\nexport interface IdCreationRange {\n\treadonly sessionId: SessionId;\n\treadonly ids?: {\n\t\treadonly firstGenCount: number;\n\t\treadonly count: number;\n\t};\n}\n\n/**\n * Roughly equates to a minimum of 1M sessions before we start allocating 64 bit IDs.\n * This value must *NOT* change without careful consideration to compatibility.\n * @internal\n */\nexport const initialClusterCapacity = 512;\n"]}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { IdCreationRange, SerializedIdCompressor, SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, initialClusterCapacity, } from "./0.0.1";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EACxC,sBAAsB,GACtB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { initialClusterCapacity, } from "./0.0.1";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persisted-types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAKN,sBAAsB,GACtB,MAAM,SAAS,CAAC","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\tinitialClusterCapacity,\n} from \"./0.0.1\";\n"]}
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { SessionId, StableId } from "./types";
6
+ import { LocalCompressedId, NumericUuid } from "./identifiers";
7
+ /**
8
+ * Generate a random session ID
9
+ * @alpha
10
+ */
11
+ export declare function createSessionId(): SessionId;
12
+ /**
13
+ * Asserts that the given string is a stable ID.
14
+ * @internal
15
+ */
16
+ export declare function assertIsStableId(stableId: string): StableId;
17
+ /**
18
+ * Asserts that the given string is a stable ID.
19
+ */
20
+ export declare function assertIsSessionId(stableId: string): SessionId;
21
+ /**
22
+ * Generate a random stable ID
23
+ * @internal
24
+ */
25
+ export declare function generateStableId(): StableId;
26
+ /**
27
+ * Returns true iff the given string is a valid Version 4, variant 2 UUID
28
+ * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
29
+ * @internal
30
+ */
31
+ export declare function isStableId(str: string): str is StableId;
32
+ /**
33
+ * A numeric comparator used for sorting in ascending order.
34
+ *
35
+ * Handles +/-0 like Map: -0 is equal to +0.
36
+ */
37
+ export declare function compareFiniteNumbers<T extends number>(a: T, b: T): number;
38
+ /**
39
+ * Compares strings lexically to form a strict partial ordering.
40
+ */
41
+ export declare function compareStrings<T extends string>(a: T, b: T): number;
42
+ /**
43
+ * Compares bigints to form a strict partial ordering.
44
+ */
45
+ export declare function compareBigints<T extends bigint>(a: T, b: T): number;
46
+ export declare function genCountFromLocalId(localId: LocalCompressedId): number;
47
+ export declare function localIdFromGenCount(genCount: number): LocalCompressedId;
48
+ export declare function numericUuidFromStableId(stableId: StableId): NumericUuid;
49
+ export declare function stableIdFromNumericUuid(numericUuid: NumericUuid): StableId;
50
+ export declare function offsetNumericUuid(numericUuid: NumericUuid, offset: number): NumericUuid;
51
+ export declare function subtractNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid;
52
+ export declare function addNumericUuids(a: NumericUuid, b: NumericUuid): NumericUuid;
53
+ //# sourceMappingURL=utilities.d.ts.map
@@ -0,0 +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,SAAS,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmB/D;;;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,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"}
@@ -0,0 +1,152 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /* eslint-disable no-bitwise */
6
+ import { assert } from "@fluidframework/core-utils";
7
+ import { v4 } from "uuid";
8
+ const hexadecimalCharCodes = Array.from("09afAF").map((c) => c.charCodeAt(0));
9
+ function isHexadecimalCharacter(charCode) {
10
+ return ((charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||
11
+ (charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||
12
+ (charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5]));
13
+ }
14
+ /**
15
+ * Generate a random session ID
16
+ * @alpha
17
+ */
18
+ export function createSessionId() {
19
+ return assertIsStableId(v4());
20
+ }
21
+ /**
22
+ * Asserts that the given string is a stable ID.
23
+ * @internal
24
+ */
25
+ export function assertIsStableId(stableId) {
26
+ assert(isStableId(stableId), 0x4a3 /* Expected a StableId */);
27
+ return stableId;
28
+ }
29
+ /**
30
+ * Asserts that the given string is a stable ID.
31
+ */
32
+ export function assertIsSessionId(stableId) {
33
+ assertIsStableId(stableId);
34
+ return stableId;
35
+ }
36
+ /**
37
+ * Generate a random stable ID
38
+ * @internal
39
+ */
40
+ export function generateStableId() {
41
+ return assertIsStableId(v4());
42
+ }
43
+ /**
44
+ * Returns true iff the given string is a valid Version 4, variant 2 UUID
45
+ * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
46
+ * @internal
47
+ */
48
+ export function isStableId(str) {
49
+ if (str.length !== 36) {
50
+ return false;
51
+ }
52
+ for (let i = 0; i < str.length; i++) {
53
+ switch (i) {
54
+ case 8:
55
+ case 13:
56
+ case 18:
57
+ case 23:
58
+ if (str.charAt(i) !== "-") {
59
+ return false;
60
+ }
61
+ break;
62
+ case 14:
63
+ if (str.charAt(i) !== "4") {
64
+ return false;
65
+ }
66
+ break;
67
+ case 19: {
68
+ const char = str.charAt(i);
69
+ if (char !== "8" && char !== "9" && char !== "a" && char !== "b") {
70
+ return false;
71
+ }
72
+ break;
73
+ }
74
+ default:
75
+ if (!isHexadecimalCharacter(str.charCodeAt(i))) {
76
+ return false;
77
+ }
78
+ break;
79
+ }
80
+ }
81
+ return true;
82
+ }
83
+ /**
84
+ * A numeric comparator used for sorting in ascending order.
85
+ *
86
+ * Handles +/-0 like Map: -0 is equal to +0.
87
+ */
88
+ export function compareFiniteNumbers(a, b) {
89
+ return a - b;
90
+ }
91
+ /**
92
+ * Compares strings lexically to form a strict partial ordering.
93
+ */
94
+ export function compareStrings(a, b) {
95
+ return a > b ? 1 : a === b ? 0 : -1;
96
+ }
97
+ /**
98
+ * Compares bigints to form a strict partial ordering.
99
+ */
100
+ export function compareBigints(a, b) {
101
+ return a > b ? 1 : a === b ? 0 : -1;
102
+ }
103
+ export function genCountFromLocalId(localId) {
104
+ return -localId;
105
+ }
106
+ export function localIdFromGenCount(genCount) {
107
+ return -genCount;
108
+ }
109
+ // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
110
+ const versionMask = 0x4n << (19n * 4n); // Version 4
111
+ const variantMask = 0x8n << (15n * 4n); // Variant RFC4122 (1 0 x x)
112
+ const upperMask = 0xffffffffffffn << (20n * 4n);
113
+ // Upper mask when version/variant bits are removed
114
+ const strippedUpperMask = upperMask >> 6n;
115
+ const middieBittiesMask = 0xfffn << (16n * 4n);
116
+ // Middie mask when version/variant bits are removed
117
+ const strippedMiddieBittiesMask = middieBittiesMask >> 2n;
118
+ // Note: leading character should be 3 to mask at 0011
119
+ // The more-significant half of the N nibble is used to denote the variant (10xx)
120
+ const lowerMask = 0x3fffffffffffffffn;
121
+ export function numericUuidFromStableId(stableId) {
122
+ const uuidU128 = BigInt(`0x${stableId.replace(/-/g, "")}`);
123
+ const upperMasked = uuidU128 & upperMask;
124
+ const middieBittiesMasked = uuidU128 & middieBittiesMask;
125
+ const lowerMasked = uuidU128 & lowerMask;
126
+ const upperMaskedPlaced = upperMasked >> 6n;
127
+ const middieBittiesMaskedPlaced = middieBittiesMasked >> 2n;
128
+ const id = upperMaskedPlaced | middieBittiesMaskedPlaced | lowerMasked;
129
+ return id;
130
+ }
131
+ export function stableIdFromNumericUuid(numericUuid) {
132
+ // bitwise reverse transform
133
+ const upperMasked = (numericUuid & strippedUpperMask) << 6n;
134
+ const middieBittiesMasked = (numericUuid & strippedMiddieBittiesMask) << 2n;
135
+ const lowerMasked = numericUuid & lowerMask;
136
+ const uuidU128 = upperMasked | versionMask | middieBittiesMasked | variantMask | lowerMasked;
137
+ // Pad to 32 characters, inserting leading zeroes if needed
138
+ const uuidString = uuidU128.toString(16).padStart(32, "0");
139
+ return `${uuidString.substring(0, 8)}-${uuidString.substring(8, 12)}-${uuidString.substring(12, 16)}-${uuidString.substring(16, 20)}-${uuidString.substring(20, 32)}`;
140
+ }
141
+ export function offsetNumericUuid(numericUuid, offset) {
142
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
143
+ return (numericUuid + BigInt(offset));
144
+ }
145
+ export function subtractNumericUuids(a, b) {
146
+ return (a - b);
147
+ }
148
+ export function addNumericUuids(a, b) {
149
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
150
+ return (a + b);
151
+ }
152
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +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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AAE,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\";\nimport { v4 } from \"uuid\";\nimport { SessionId, StableId } from \"./types\";\nimport { LocalCompressedId, NumericUuid } from \"./identifiers\";\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 ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "@fluidframework/id-compressor",
3
+ "version": "2.0.0-dev.7.4.0.221926",
4
+ "description": "ID compressor",
5
+ "homepage": "https://fluidframework.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/FluidFramework.git",
9
+ "directory": "packages/runtime/id-compressor"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Microsoft and contributors",
13
+ "sideEffects": false,
14
+ "main": "dist/index.js",
15
+ "module": "lib/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "c8": {
18
+ "all": true,
19
+ "cache-dir": "nyc/.cache",
20
+ "exclude": [
21
+ "src/test/**/*.ts",
22
+ "dist/test/**/*.js"
23
+ ],
24
+ "exclude-after-remap": false,
25
+ "include": [
26
+ "src/**/*.ts",
27
+ "dist/**/*.js"
28
+ ],
29
+ "report-dir": "nyc/report",
30
+ "reporter": [
31
+ "cobertura",
32
+ "html",
33
+ "text"
34
+ ],
35
+ "temp-directory": "nyc/.nyc_output"
36
+ },
37
+ "dependencies": {
38
+ "@fluid-internal/client-utils": "2.0.0-dev.7.4.0.221926",
39
+ "@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.221926",
40
+ "@fluidframework/core-utils": "2.0.0-dev.7.4.0.221926",
41
+ "@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.221926",
42
+ "sorted-btree": "^1.8.0",
43
+ "uuid": "^9.0.0"
44
+ },
45
+ "devDependencies": {
46
+ "@fluid-private/stochastic-test-utils": "2.0.0-dev.7.4.0.221926",
47
+ "@fluid-tools/benchmark": "^0.48.0",
48
+ "@fluid-tools/build-cli": "^0.28.0",
49
+ "@fluidframework/build-common": "^2.0.3",
50
+ "@fluidframework/build-tools": "^0.28.0",
51
+ "@fluidframework/eslint-config-fluid": "^3.1.0",
52
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.221926",
53
+ "@microsoft/api-extractor": "^7.38.3",
54
+ "@types/mocha": "^9.1.1",
55
+ "@types/uuid": "^9.0.2",
56
+ "c8": "^7.7.1",
57
+ "copyfiles": "^2.4.1",
58
+ "cross-env": "^7.0.3",
59
+ "eslint": "~8.50.0",
60
+ "mocha": "^10.2.0",
61
+ "mocha-json-output-reporter": "^2.0.1",
62
+ "mocha-multi-reporters": "^1.5.1",
63
+ "moment": "^2.21.0",
64
+ "prettier": "~3.0.3",
65
+ "rimraf": "^4.4.0",
66
+ "typescript": "~5.1.6"
67
+ },
68
+ "fluidBuild": {
69
+ "tasks": {
70
+ "build:docs": {
71
+ "dependsOn": [
72
+ "...",
73
+ "api-extractor:commonjs",
74
+ "api-extractor:esnext"
75
+ ],
76
+ "script": false
77
+ }
78
+ }
79
+ },
80
+ "scripts": {
81
+ "api": "fluid-build . --task api",
82
+ "api-extractor:commonjs": "api-extractor run --local",
83
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
84
+ "build": "fluid-build . --task build",
85
+ "build:commonjs": "fluid-build . --task commonjs",
86
+ "build:compile": "fluid-build . --task compile",
87
+ "build:docs": "fluid-build . --task api",
88
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
89
+ "build:genver": "gen-version",
90
+ "build:test": "tsc --project ./src/test/tsconfig.json",
91
+ "check:are-the-types-wrong": "attw --pack",
92
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
93
+ "ci:build:docs": "api-extractor run",
94
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
95
+ "eslint": "eslint --format stylish src",
96
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
97
+ "format": "npm run prettier:fix",
98
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
99
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
100
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
101
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
102
+ "test": "npm run test:mocha",
103
+ "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./dist/**/*.perf.spec.js\"",
104
+ "test:coverage": "c8 npm test",
105
+ "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
106
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
107
+ "tsc": "tsc",
108
+ "tsc:watch": "tsc --watch"
109
+ }
110
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
+ };