@fluidframework/id-compressor 2.0.0-dev-rc.1.0.0.224419

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 +7 -0
  4. package/LICENSE +21 -0
  5. package/README.md +170 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +4 -0
  8. package/api-report/id-compressor.api.md +139 -0
  9. package/dist/appendOnlySortedMap.cjs +318 -0
  10. package/dist/appendOnlySortedMap.cjs.map +1 -0
  11. package/dist/appendOnlySortedMap.d.ts +124 -0
  12. package/dist/appendOnlySortedMap.d.ts.map +1 -0
  13. package/dist/finalSpace.cjs +62 -0
  14. package/dist/finalSpace.cjs.map +1 -0
  15. package/dist/finalSpace.d.ts +29 -0
  16. package/dist/finalSpace.d.ts.map +1 -0
  17. package/dist/id-compressor-alpha.d.ts +320 -0
  18. package/dist/id-compressor-beta.d.ts +172 -0
  19. package/dist/id-compressor-public.d.ts +172 -0
  20. package/dist/id-compressor-untrimmed.d.ts +333 -0
  21. package/dist/idCompressor.cjs +502 -0
  22. package/dist/idCompressor.cjs.map +1 -0
  23. package/dist/idCompressor.d.ts +84 -0
  24. package/dist/idCompressor.d.ts.map +1 -0
  25. package/dist/identifiers.cjs +15 -0
  26. package/dist/identifiers.cjs.map +1 -0
  27. package/dist/identifiers.d.ts +32 -0
  28. package/dist/identifiers.d.ts.map +1 -0
  29. package/dist/index.cjs +20 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.ts +11 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/packageVersion.cjs +12 -0
  34. package/dist/packageVersion.cjs.map +1 -0
  35. package/dist/packageVersion.d.ts +9 -0
  36. package/dist/packageVersion.d.ts.map +1 -0
  37. package/dist/persistanceUtilities.cjs +43 -0
  38. package/dist/persistanceUtilities.cjs.map +1 -0
  39. package/dist/persistanceUtilities.d.ts +22 -0
  40. package/dist/persistanceUtilities.d.ts.map +1 -0
  41. package/dist/sessionSpaceNormalizer.cjs +80 -0
  42. package/dist/sessionSpaceNormalizer.cjs.map +1 -0
  43. package/dist/sessionSpaceNormalizer.d.ts +46 -0
  44. package/dist/sessionSpaceNormalizer.d.ts.map +1 -0
  45. package/dist/sessions.cjs +305 -0
  46. package/dist/sessions.cjs.map +1 -0
  47. package/dist/sessions.d.ts +115 -0
  48. package/dist/sessions.d.ts.map +1 -0
  49. package/dist/tsdoc-metadata.json +11 -0
  50. package/dist/types/idCompressor.cjs +7 -0
  51. package/dist/types/idCompressor.cjs.map +1 -0
  52. package/dist/types/idCompressor.d.ts +139 -0
  53. package/dist/types/idCompressor.d.ts.map +1 -0
  54. package/dist/types/identifiers.cjs +7 -0
  55. package/dist/types/identifiers.cjs.map +1 -0
  56. package/dist/types/identifiers.d.ts +40 -0
  57. package/dist/types/identifiers.d.ts.map +1 -0
  58. package/dist/types/index.cjs +7 -0
  59. package/dist/types/index.cjs.map +1 -0
  60. package/dist/types/index.d.ts +8 -0
  61. package/dist/types/index.d.ts.map +1 -0
  62. package/dist/types/persisted-types/0.0.1.cjs +7 -0
  63. package/dist/types/persisted-types/0.0.1.cjs.map +1 -0
  64. package/dist/types/persisted-types/0.0.1.d.ts +52 -0
  65. package/dist/types/persisted-types/0.0.1.d.ts.map +1 -0
  66. package/dist/types/persisted-types/index.cjs +7 -0
  67. package/dist/types/persisted-types/index.cjs.map +1 -0
  68. package/dist/types/persisted-types/index.d.ts +6 -0
  69. package/dist/types/persisted-types/index.d.ts.map +1 -0
  70. package/dist/utilities.cjs +170 -0
  71. package/dist/utilities.cjs.map +1 -0
  72. package/dist/utilities.d.ts +53 -0
  73. package/dist/utilities.d.ts.map +1 -0
  74. package/lib/appendOnlySortedMap.d.mts +124 -0
  75. package/lib/appendOnlySortedMap.d.mts.map +1 -0
  76. package/lib/appendOnlySortedMap.mjs +312 -0
  77. package/lib/appendOnlySortedMap.mjs.map +1 -0
  78. package/lib/finalSpace.d.mts +29 -0
  79. package/lib/finalSpace.d.mts.map +1 -0
  80. package/lib/finalSpace.mjs +58 -0
  81. package/lib/finalSpace.mjs.map +1 -0
  82. package/lib/id-compressor-alpha.d.mts +320 -0
  83. package/lib/id-compressor-beta.d.mts +172 -0
  84. package/lib/id-compressor-public.d.mts +172 -0
  85. package/lib/id-compressor-untrimmed.d.mts +333 -0
  86. package/lib/idCompressor.d.mts +84 -0
  87. package/lib/idCompressor.d.mts.map +1 -0
  88. package/lib/idCompressor.mjs +496 -0
  89. package/lib/idCompressor.mjs.map +1 -0
  90. package/lib/identifiers.d.mts +32 -0
  91. package/lib/identifiers.d.mts.map +1 -0
  92. package/lib/identifiers.mjs +11 -0
  93. package/lib/identifiers.mjs.map +1 -0
  94. package/lib/index.d.mts +8 -0
  95. package/lib/index.d.mts.map +1 -0
  96. package/lib/index.mjs +7 -0
  97. package/lib/index.mjs.map +1 -0
  98. package/lib/packageVersion.d.mts +9 -0
  99. package/lib/packageVersion.d.mts.map +1 -0
  100. package/lib/packageVersion.mjs +9 -0
  101. package/lib/packageVersion.mjs.map +1 -0
  102. package/lib/persistanceUtilities.d.mts +22 -0
  103. package/lib/persistanceUtilities.d.mts.map +1 -0
  104. package/lib/persistanceUtilities.mjs +34 -0
  105. package/lib/persistanceUtilities.mjs.map +1 -0
  106. package/lib/sessionSpaceNormalizer.d.mts +46 -0
  107. package/lib/sessionSpaceNormalizer.d.mts.map +1 -0
  108. package/lib/sessionSpaceNormalizer.mjs +76 -0
  109. package/lib/sessionSpaceNormalizer.mjs.map +1 -0
  110. package/lib/sessions.d.mts +115 -0
  111. package/lib/sessions.d.mts.map +1 -0
  112. package/lib/sessions.mjs +290 -0
  113. package/lib/sessions.mjs.map +1 -0
  114. package/lib/types/idCompressor.d.mts +139 -0
  115. package/lib/types/idCompressor.d.mts.map +1 -0
  116. package/lib/types/idCompressor.mjs +6 -0
  117. package/lib/types/idCompressor.mjs.map +1 -0
  118. package/lib/types/identifiers.d.mts +40 -0
  119. package/lib/types/identifiers.d.mts.map +1 -0
  120. package/lib/types/identifiers.mjs +6 -0
  121. package/lib/types/identifiers.mjs.map +1 -0
  122. package/lib/types/index.d.mts +8 -0
  123. package/lib/types/index.d.mts.map +1 -0
  124. package/lib/types/index.mjs +6 -0
  125. package/lib/types/index.mjs.map +1 -0
  126. package/lib/types/persisted-types/0.0.1.d.mts +52 -0
  127. package/lib/types/persisted-types/0.0.1.d.mts.map +1 -0
  128. package/lib/types/persisted-types/0.0.1.mjs +6 -0
  129. package/lib/types/persisted-types/0.0.1.mjs.map +1 -0
  130. package/lib/types/persisted-types/index.d.mts +6 -0
  131. package/lib/types/persisted-types/index.d.mts.map +1 -0
  132. package/lib/types/persisted-types/index.mjs +6 -0
  133. package/lib/types/persisted-types/index.mjs.map +1 -0
  134. package/lib/utilities.d.mts +53 -0
  135. package/lib/utilities.d.mts.map +1 -0
  136. package/lib/utilities.mjs +151 -0
  137. package/lib/utilities.mjs.map +1 -0
  138. package/package.json +114 -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 +685 -0
  143. package/src/identifiers.ts +42 -0
  144. package/src/index.ts +23 -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 +15 -0
  152. package/src/types/persisted-types/0.0.1.ts +58 -0
  153. package/src/types/persisted-types/README.md +3 -0
  154. package/src/types/persisted-types/index.ts +11 -0
  155. package/src/utilities.ts +191 -0
  156. package/tsc-multi.test.json +4 -0
  157. package/tsconfig.json +12 -0
@@ -0,0 +1,52 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { SessionId } from "../identifiers.mjs";
6
+ /**
7
+ * The serialized contents of an IdCompressor, suitable for persistence in a summary.
8
+ * @alpha
9
+ */
10
+ export type SerializedIdCompressor = string & {
11
+ readonly _serializedIdCompressor: "8c73c57c-1cf4-4278-8915-6444cb4f6af5";
12
+ };
13
+ /**
14
+ * The serialized contents of an IdCompressor, suitable for persistence in a summary.
15
+ * @alpha
16
+ */
17
+ export type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {
18
+ readonly _noLocalState: "3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb";
19
+ };
20
+ /**
21
+ * The serialized contents of an IdCompressor, suitable for persistence in a summary.
22
+ * @alpha
23
+ */
24
+ export type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {
25
+ readonly _hasLocalState: "1281acae-6d14-47e7-bc92-71c8ee0819cb";
26
+ };
27
+ /**
28
+ * Data describing a range of session-local IDs (from a remote or local session).
29
+ *
30
+ * A range is composed of local IDs that were generated.
31
+ * @alpha
32
+ */
33
+ export interface IdCreationRange {
34
+ readonly sessionId: SessionId;
35
+ readonly ids?: {
36
+ /**
37
+ * The gen count of the first ID in the range created by `sessionId.`
38
+ */
39
+ readonly firstGenCount: number;
40
+ /**
41
+ * The number of IDs created in the range created by `sessionId.`
42
+ */
43
+ readonly count: number;
44
+ /**
45
+ * The size of the ID cluster to create if `count` overflows the existing cluster for
46
+ * `sessionId`, if one exists. This request will be respected, and the size of the cluster
47
+ * will be equal to overflow + `requestedClusterSize`.
48
+ */
49
+ readonly requestedClusterSize: number;
50
+ };
51
+ }
52
+ //# sourceMappingURL=0.0.1.d.ts.map
@@ -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;OAEI,KAAK,EAAE,SAAS,EAAE;AAEzB;;;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;KACtC,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=0.0.1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0.0.1.mjs","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\";\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\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\t};\n}\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, } from "./0.0.1.mjs";
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;OAEI,EACN,eAAe,EACf,sBAAsB,EACtB,mCAAmC,EACnC,wCAAwC,GACxC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","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\";\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/index.mjs";
6
+ import { LocalCompressedId, NumericUuid } from "./identifiers.mjs";
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;OAKI,EAAE,SAAS,EAAE,QAAQ,EAAE;OACvB,EAAE,iBAAiB,EAAE,WAAW,EAAE;AAmBzC;;;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,151 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { assert } from "@fluidframework/core-utils";
6
+ import { v4 } from "uuid";
7
+ const hexadecimalCharCodes = Array.from("09afAF").map((c) => c.charCodeAt(0));
8
+ function isHexadecimalCharacter(charCode) {
9
+ return ((charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||
10
+ (charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||
11
+ (charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5]));
12
+ }
13
+ /**
14
+ * Generate a random session ID
15
+ * @alpha
16
+ */
17
+ export function createSessionId() {
18
+ return assertIsStableId(v4());
19
+ }
20
+ /**
21
+ * Asserts that the given string is a stable ID.
22
+ * @internal
23
+ */
24
+ export function assertIsStableId(stableId) {
25
+ assert(isStableId(stableId), 0x4a3 /* Expected a StableId */);
26
+ return stableId;
27
+ }
28
+ /**
29
+ * Asserts that the given string is a stable ID.
30
+ */
31
+ export function assertIsSessionId(stableId) {
32
+ assertIsStableId(stableId);
33
+ return stableId;
34
+ }
35
+ /**
36
+ * Generate a random stable ID
37
+ * @internal
38
+ */
39
+ export function generateStableId() {
40
+ return assertIsStableId(v4());
41
+ }
42
+ /**
43
+ * Returns true iff the given string is a valid Version 4, variant 2 UUID
44
+ * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
45
+ * @internal
46
+ */
47
+ export function isStableId(str) {
48
+ if (str.length !== 36) {
49
+ return false;
50
+ }
51
+ for (let i = 0; i < str.length; i++) {
52
+ switch (i) {
53
+ case 8:
54
+ case 13:
55
+ case 18:
56
+ case 23:
57
+ if (str.charAt(i) !== "-") {
58
+ return false;
59
+ }
60
+ break;
61
+ case 14:
62
+ if (str.charAt(i) !== "4") {
63
+ return false;
64
+ }
65
+ break;
66
+ case 19: {
67
+ const char = str.charAt(i);
68
+ if (char !== "8" && char !== "9" && char !== "a" && char !== "b") {
69
+ return false;
70
+ }
71
+ break;
72
+ }
73
+ default:
74
+ if (!isHexadecimalCharacter(str.charCodeAt(i))) {
75
+ return false;
76
+ }
77
+ break;
78
+ }
79
+ }
80
+ return true;
81
+ }
82
+ /**
83
+ * A numeric comparator used for sorting in ascending order.
84
+ *
85
+ * Handles +/-0 like Map: -0 is equal to +0.
86
+ */
87
+ export function compareFiniteNumbers(a, b) {
88
+ return a - b;
89
+ }
90
+ /**
91
+ * Compares strings lexically to form a strict partial ordering.
92
+ */
93
+ export function compareStrings(a, b) {
94
+ return a > b ? 1 : a === b ? 0 : -1;
95
+ }
96
+ /**
97
+ * Compares bigints to form a strict partial ordering.
98
+ */
99
+ export function compareBigints(a, b) {
100
+ return a > b ? 1 : a === b ? 0 : -1;
101
+ }
102
+ export function genCountFromLocalId(localId) {
103
+ return -localId;
104
+ }
105
+ export function localIdFromGenCount(genCount) {
106
+ return -genCount;
107
+ }
108
+ // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
109
+ const versionMask = 0x4n << (19n * 4n); // Version 4
110
+ const variantMask = 0x8n << (15n * 4n); // Variant RFC4122 (1 0 x x)
111
+ const upperMask = 0xffffffffffffn << (20n * 4n);
112
+ // Upper mask when version/variant bits are removed
113
+ const strippedUpperMask = upperMask >> 6n;
114
+ const middieBittiesMask = 0xfffn << (16n * 4n);
115
+ // Middie mask when version/variant bits are removed
116
+ const strippedMiddieBittiesMask = middieBittiesMask >> 2n;
117
+ // Note: leading character should be 3 to mask at 0011
118
+ // The more-significant half of the N nibble is used to denote the variant (10xx)
119
+ const lowerMask = 0x3fffffffffffffffn;
120
+ export function numericUuidFromStableId(stableId) {
121
+ const uuidU128 = BigInt(`0x${stableId.replace(/-/g, "")}`);
122
+ const upperMasked = uuidU128 & upperMask;
123
+ const middieBittiesMasked = uuidU128 & middieBittiesMask;
124
+ const lowerMasked = uuidU128 & lowerMask;
125
+ const upperMaskedPlaced = upperMasked >> 6n;
126
+ const middieBittiesMaskedPlaced = middieBittiesMasked >> 2n;
127
+ const id = upperMaskedPlaced | middieBittiesMaskedPlaced | lowerMasked;
128
+ return id;
129
+ }
130
+ export function stableIdFromNumericUuid(numericUuid) {
131
+ // bitwise reverse transform
132
+ const upperMasked = (numericUuid & strippedUpperMask) << 6n;
133
+ const middieBittiesMasked = (numericUuid & strippedMiddieBittiesMask) << 2n;
134
+ const lowerMasked = numericUuid & lowerMask;
135
+ const uuidU128 = upperMasked | versionMask | middieBittiesMasked | variantMask | lowerMasked;
136
+ // Pad to 32 characters, inserting leading zeroes if needed
137
+ const uuidString = uuidU128.toString(16).padStart(32, "0");
138
+ return `${uuidString.substring(0, 8)}-${uuidString.substring(8, 12)}-${uuidString.substring(12, 16)}-${uuidString.substring(16, 20)}-${uuidString.substring(20, 32)}`;
139
+ }
140
+ export function offsetNumericUuid(numericUuid, offset) {
141
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
142
+ return (numericUuid + BigInt(offset));
143
+ }
144
+ export function subtractNumericUuids(a, b) {
145
+ return (a - b);
146
+ }
147
+ export function addNumericUuids(a, b) {
148
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
149
+ return (a + b);
150
+ }
151
+ //# sourceMappingURL=utilities.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.mjs","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,EAAE,EAAE,MAAM,MAAM;AAIzB,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,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;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,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,114 @@
1
+ {
2
+ "name": "@fluidframework/id-compressor",
3
+ "version": "2.0.0-dev-rc.1.0.0.224419",
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.cjs",
15
+ "module": "lib/index.mjs",
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-rc.1.0.0.224419",
39
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.224419",
40
+ "@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.224419",
41
+ "@fluidframework/telemetry-utils": "2.0.0-dev-rc.1.0.0.224419",
42
+ "sorted-btree": "^1.8.0",
43
+ "uuid": "^9.0.0"
44
+ },
45
+ "devDependencies": {
46
+ "@arethetypeswrong/cli": "^0.13.3",
47
+ "@fluid-private/stochastic-test-utils": "2.0.0-dev-rc.1.0.0.224419",
48
+ "@fluid-tools/benchmark": "^0.48.0",
49
+ "@fluid-tools/build-cli": "0.29.0-222379",
50
+ "@fluidframework/build-common": "^2.0.3",
51
+ "@fluidframework/build-tools": "0.29.0-222379",
52
+ "@fluidframework/eslint-config-fluid": "^3.1.0",
53
+ "@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.224419",
54
+ "@microsoft/api-extractor": "^7.38.3",
55
+ "@types/mocha": "^9.1.1",
56
+ "@types/uuid": "^9.0.2",
57
+ "c8": "^7.7.1",
58
+ "copyfiles": "^2.4.1",
59
+ "cross-env": "^7.0.3",
60
+ "eslint": "~8.50.0",
61
+ "mocha": "^10.2.0",
62
+ "mocha-json-output-reporter": "^2.0.1",
63
+ "mocha-multi-reporters": "^1.5.1",
64
+ "moment": "^2.21.0",
65
+ "prettier": "~3.0.3",
66
+ "renamer": "^4.0.0",
67
+ "rimraf": "^4.4.0",
68
+ "tsc-multi": "^1.1.0",
69
+ "typescript": "~5.1.6"
70
+ },
71
+ "fluidBuild": {
72
+ "tasks": {
73
+ "build:docs": {
74
+ "dependsOn": [
75
+ "...",
76
+ "api-extractor:commonjs",
77
+ "api-extractor:esnext"
78
+ ],
79
+ "script": false
80
+ }
81
+ }
82
+ },
83
+ "scripts": {
84
+ "api": "fluid-build . --task api",
85
+ "api-extractor:commonjs": "api-extractor run --local",
86
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
87
+ "build": "fluid-build . --task build",
88
+ "build:commonjs": "fluid-build . --task commonjs",
89
+ "build:compile": "fluid-build . --task compile",
90
+ "build:docs": "fluid-build . --task api",
91
+ "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
92
+ "build:genver": "gen-version",
93
+ "build:rename-types": "renamer \"lib/**\" -f .d.ts -r .d.mts --force",
94
+ "build:test": "tsc-multi --config ./tsc-multi.test.json",
95
+ "check:are-the-types-wrong": "attw --pack",
96
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
97
+ "ci:build:docs": "api-extractor run",
98
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
99
+ "eslint": "eslint --format stylish src",
100
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
101
+ "format": "npm run prettier:fix",
102
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
103
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
104
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
105
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
106
+ "test": "npm run test:mocha",
107
+ "test:benchmark:report": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js \"./dist/**/*.perf.spec.*js\"",
108
+ "test:coverage": "c8 npm test",
109
+ "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
110
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
111
+ "tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
112
+ "tsc:watch": "tsc --watch"
113
+ }
114
+ }
@@ -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
+ };