@fluidframework/id-compressor 2.0.0-dev-rc.3.0.0.254513 → 2.0.0-dev-rc.3.0.0.254674

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.
@@ -1,179 +0,0 @@
1
- import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
2
- import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
3
-
4
- /* Excluded from this release type: assertIsStableId */
5
-
6
- /* Excluded from this release type: createIdCompressor */
7
-
8
- /* Excluded from this release type: createSessionId */
9
-
10
- /* Excluded from this release type: deserializeIdCompressor */
11
-
12
- /* Excluded from this release type: generateStableId */
13
-
14
- /* Excluded from this release type: IdCreationRange */
15
-
16
- /**
17
- * A distributed UUID generator and compressor.
18
- * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers
19
- * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.
20
- *
21
- * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.
22
- * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's "local" session.
23
- * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session
24
- * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated
25
- * through a process called "normalization":
26
- * - The scope of a local session (in which local IDs are unique) is called the "session space" of the client.
27
- * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called "op space".
28
- * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.
29
- * In Fluid, this means they should not be included in ops or summaries.
30
- * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.
31
- * - Upon receipt, IDs should be normalized back to session space before use.
32
- *
33
- * Example Usage:
34
- *
35
- * ### Client A (Sender)
36
- *
37
- * ```typescript
38
- * // Generate several local IDs
39
- * const localId1 = idCompressor.generateCompressedId();
40
- * const localId2 = idCompressor.generateCompressedId();
41
- * const localId3 = idCompressor.generateCompressedId();
42
- *
43
- * // Normalize these IDs to op space for inclusion in a message
44
- * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);
45
- * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);
46
- * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);
47
- *
48
- * // Create and send a message containing these op space IDs along with the sender's session ID
49
- * // In Fluid, this would be an op or summary
50
- * const message = {
51
- * sessionID: idCompressor.localSessionId,
52
- * ids: [opSpaceId1, opSpaceId2, opSpaceId3]
53
- * };
54
- * ```
55
- *
56
- * ### Client B (Receiver)
57
- *
58
- * ```typescript
59
- * // Receive the message from Client A
60
- * const receivedMessage = ...; // In Fluid, this would be an op or summary
61
- *
62
- * // Normalize the received IDs back to session space, utilizing the sender's session ID
63
- * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);
64
- * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);
65
- * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);
66
- * ```
67
- * @public
68
- */
69
- export declare interface IIdCompressor {
70
- /**
71
- * The local session ID.
72
- */
73
- localSessionId: SessionId;
74
- /**
75
- * Generates a new compressed ID.
76
- * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.
77
- * @returns A new local ID in session space.
78
- */
79
- generateCompressedId(): SessionSpaceCompressedId;
80
- /**
81
- * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any
82
- * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).
83
- * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in
84
- * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and
85
- * this approach will often be superior to generating a UUID.
86
- * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.
87
- * See `IIdCompressor` for more details.
88
- * @returns A new local ID in session space.
89
- */
90
- generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;
91
- /**
92
- * Normalizes a session space ID into op space.
93
- * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.
94
- * See `IIdCompressor` for more details.
95
- * @param id - The local ID to normalize.
96
- * @returns The ID in op space.
97
- */
98
- normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
99
- /**
100
- * Normalizes an ID into session space.
101
- * @param id - The ID to normalize.
102
- * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.
103
- * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.
104
- * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.
105
- * @returns The session-space ID in the local session corresponding to `id`.
106
- */
107
- normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
108
- /**
109
- * Decompresses a previously compressed ID into a UUID.
110
- * @param id - The compressed ID to be decompressed.
111
- * @returns The UUID associated with the compressed ID.
112
- * @throws If the ID was not generated by any session known to this compressor.
113
- */
114
- decompress(id: SessionSpaceCompressedId): StableId;
115
- /**
116
- * Recompresses a UUID.
117
- * @param uncompressed - The UUID to recompress.
118
- * @returns The `CompressedId` associated with `uncompressed`.
119
- * @throws If the UUID was not generated by any session known to this compressor.
120
- */
121
- recompress(uncompressed: StableId): SessionSpaceCompressedId;
122
- /**
123
- * Attempts to recompress a UUID.
124
- * @param uncompressed - The UUID to recompress.
125
- * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.
126
- */
127
- tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
128
- }
129
-
130
- /* Excluded from this release type: IIdCompressorCore */
131
-
132
- /* Excluded from this release type: isStableId */
133
-
134
- /**
135
- * A compressed ID that has been normalized into "op space".
136
- * Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require less normalizing when
137
- * received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.
138
- * @public
139
- */
140
- export declare type OpSpaceCompressedId = number & {
141
- readonly OpNormalized: "9209432d-a959-4df7-b2ad-767ead4dbcae";
142
- };
143
-
144
- /* Excluded from this release type: SerializedIdCompressor */
145
-
146
- /* Excluded from this release type: SerializedIdCompressorWithNoSession */
147
-
148
- /* Excluded from this release type: SerializedIdCompressorWithOngoingSession */
149
-
150
- /**
151
- * A StableId which is suitable for use as a session identifier
152
- * @public
153
- */
154
- export declare type SessionId = StableId & {
155
- readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58";
156
- };
157
-
158
- /**
159
- * A compressed ID that has been normalized into "session space" (see `IdCompressor` for more).
160
- * Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to
161
- * the scope of the session (i.e. compressor) that produced them.
162
- * @public
163
- */
164
- export declare type SessionSpaceCompressedId = number & {
165
- readonly SessionUnique: "cea55054-6b82-4cbf-ad19-1fa645ea3b3e";
166
- };
167
-
168
- /**
169
- * A version 4, variant 1 uuid (https://datatracker.ietf.org/doc/html/rfc4122).
170
- * A 128-bit Universally Unique IDentifier. Represented here
171
- * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,
172
- * where x is a lowercase hex digit.
173
- * @public
174
- */
175
- export declare type StableId = string & {
176
- readonly StableId: "53172b0d-a3d5-41ea-bd75-b43839c97f5a";
177
- };
178
-
179
- export { }
@@ -1,369 +0,0 @@
1
- import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
2
- import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
3
-
4
- /**
5
- * Asserts that the given string is a stable ID.
6
- * @internal
7
- */
8
- export declare function assertIsStableId(stableId: string): StableId;
9
-
10
- /**
11
- * Create a new {@link IIdCompressor}.
12
- * @alpha
13
- */
14
- export declare function createIdCompressor(logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
15
-
16
- /**
17
- * Create a new {@link IIdCompressor}.
18
- * @param sessionId - The seed ID for the compressor.
19
- * @alpha
20
- */
21
- export declare function createIdCompressor(sessionId: SessionId, logger?: ITelemetryBaseLogger): IIdCompressor & IIdCompressorCore;
22
-
23
- /**
24
- * Generate a random session ID
25
- * @alpha
26
- */
27
- export declare function createSessionId(): SessionId;
28
-
29
- /**
30
- * Deserializes the supplied state into an ID compressor.
31
- * @alpha
32
- */
33
- export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithOngoingSession, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
34
-
35
- /**
36
- * Deserializes the supplied state into an ID compressor.
37
- * @alpha
38
- */
39
- export declare function deserializeIdCompressor(serialized: SerializedIdCompressorWithNoSession, newSessionId: SessionId, logger?: ITelemetryLoggerExt): IIdCompressor & IIdCompressorCore;
40
-
41
- /**
42
- * Generate a random stable ID
43
- * @internal
44
- */
45
- export declare function generateStableId(): StableId;
46
-
47
- /**
48
- * Data describing a range of session-local IDs (from a remote or local session).
49
- *
50
- * A range is composed of local IDs that were generated.
51
- * @alpha
52
- */
53
- export declare interface IdCreationRange {
54
- readonly sessionId: SessionId;
55
- readonly ids?: {
56
- /**
57
- * The gen count of the first ID in the range created by `sessionId.`
58
- */
59
- readonly firstGenCount: number;
60
- /**
61
- * The number of IDs created in the range created by `sessionId.`
62
- */
63
- readonly count: number;
64
- /**
65
- * The size of the ID cluster to create if `count` overflows the existing cluster for
66
- * `sessionId`, if one exists. This request will be respected, and the size of the cluster
67
- * will be equal to overflow + `requestedClusterSize`.
68
- */
69
- readonly requestedClusterSize: number;
70
- /**
71
- * The ranges of IDs that were allocated as local IDs in the range created by `sessionId.`
72
- */
73
- readonly localIdRanges: [genCount: number, count: number][];
74
- };
75
- }
76
-
77
- /**
78
- * A distributed UUID generator and compressor.
79
- * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers
80
- * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.
81
- *
82
- * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.
83
- * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's "local" session.
84
- * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session
85
- * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated
86
- * through a process called "normalization":
87
- * - The scope of a local session (in which local IDs are unique) is called the "session space" of the client.
88
- * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called "op space".
89
- * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.
90
- * In Fluid, this means they should not be included in ops or summaries.
91
- * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.
92
- * - Upon receipt, IDs should be normalized back to session space before use.
93
- *
94
- * Example Usage:
95
- *
96
- * ### Client A (Sender)
97
- *
98
- * ```typescript
99
- * // Generate several local IDs
100
- * const localId1 = idCompressor.generateCompressedId();
101
- * const localId2 = idCompressor.generateCompressedId();
102
- * const localId3 = idCompressor.generateCompressedId();
103
- *
104
- * // Normalize these IDs to op space for inclusion in a message
105
- * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);
106
- * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);
107
- * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);
108
- *
109
- * // Create and send a message containing these op space IDs along with the sender's session ID
110
- * // In Fluid, this would be an op or summary
111
- * const message = {
112
- * sessionID: idCompressor.localSessionId,
113
- * ids: [opSpaceId1, opSpaceId2, opSpaceId3]
114
- * };
115
- * ```
116
- *
117
- * ### Client B (Receiver)
118
- *
119
- * ```typescript
120
- * // Receive the message from Client A
121
- * const receivedMessage = ...; // In Fluid, this would be an op or summary
122
- *
123
- * // Normalize the received IDs back to session space, utilizing the sender's session ID
124
- * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);
125
- * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);
126
- * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);
127
- * ```
128
- * @public
129
- */
130
- export declare interface IIdCompressor {
131
- /**
132
- * The local session ID.
133
- */
134
- localSessionId: SessionId;
135
- /**
136
- * Generates a new compressed ID.
137
- * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.
138
- * @returns A new local ID in session space.
139
- */
140
- generateCompressedId(): SessionSpaceCompressedId;
141
- /**
142
- * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any
143
- * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).
144
- * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probably in
145
- * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and
146
- * this approach will often be superior to generating a UUID.
147
- * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.
148
- * See `IIdCompressor` for more details.
149
- * @returns A new local ID in session space.
150
- */
151
- generateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;
152
- /**
153
- * Normalizes a session space ID into op space.
154
- * The returned ID is in op space and can be safely serialized. However, it should be normalized back to session space before use.
155
- * See `IIdCompressor` for more details.
156
- * @param id - The local ID to normalize.
157
- * @returns The ID in op space.
158
- */
159
- normalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;
160
- /**
161
- * Normalizes an ID into session space.
162
- * @param id - The ID to normalize.
163
- * @param originSessionId - The session from which `id` originated. This should be the ID of the client that normalized `id` to op space.
164
- * This means that it may not be the client that created `id` in the first place, but rather the client that serialized it.
165
- * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.
166
- * @returns The session-space ID in the local session corresponding to `id`.
167
- */
168
- normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
169
- /**
170
- * Decompresses a previously compressed ID into a UUID.
171
- * @param id - The compressed ID to be decompressed.
172
- * @returns The UUID associated with the compressed ID.
173
- * @throws If the ID was not generated by any session known to this compressor.
174
- */
175
- decompress(id: SessionSpaceCompressedId): StableId;
176
- /**
177
- * Recompresses a UUID.
178
- * @param uncompressed - The UUID to recompress.
179
- * @returns The `CompressedId` associated with `uncompressed`.
180
- * @throws If the UUID was not generated by any session known to this compressor.
181
- */
182
- recompress(uncompressed: StableId): SessionSpaceCompressedId;
183
- /**
184
- * Attempts to recompress a UUID.
185
- * @param uncompressed - The UUID to recompress.
186
- * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.
187
- */
188
- tryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;
189
- }
190
-
191
- /**
192
- * A distributed UUID generator and compressor.
193
- *
194
- * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple "sessions" (which can be distributed across the network),
195
- * providing each session with the ability to map these UUIDs to `numbers`.
196
- *
197
- * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API
198
- * which should then sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is
199
- * created it is said to be created by the compressor's "local" session.
200
- *
201
- * For each stable ID created, two numeric IDs are provided by the compressor:
202
- *
203
- * 1. A session-local ID, which is stable for the lifetime of the session (which could be longer than that of the compressor object, as it may
204
- * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only
205
- * safely usable within the scope of the compressor that created it.
206
- *
207
- * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing
208
- * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.
209
- * Final IDs are known to and publicly usable by any compressor that has received them.
210
- *
211
- * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed
212
- * to map the UUIDs to the numbers.
213
- *
214
- * The following invariants are upheld by IdCompressor:
215
- *
216
- * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.
217
- *
218
- * 2. Final IDs will always decompress to the same UUIDs.
219
- *
220
- * 3. After a server-processed range of session-local IDs (from any session) is received by a compressor, any of those session-local IDs may be
221
- * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the
222
- * same final ID.
223
- *
224
- * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.
225
- *
226
- * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*
227
- * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.
228
- *
229
- * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This
230
- * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a
231
- * session-local ID but is later queried using the final ID (which is semantically equal, as it decompresses to the same UUID/string) it will
232
- * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the
233
- * session-local IDs have been finalized, the compressor defines two "spaces" of IDs:
234
- *
235
- * 1. Session space: in this space, all IDs are normalized to their "most local form". This means that all IDs created by the local session
236
- * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after
237
- * finalizing and will never have a local form for the compressor, will of course be final IDs. This space should be used with consumer APIs
238
- * and data structures, as the lifetime of the IDs is guaranteed to be the same as the compressor object. Care must be taken to not use
239
- * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.
240
- *
241
- * 2. Op space: in this space, all IDs are normalized to their "most final form". This means that all IDs except session-local IDs that
242
- * have not yet been finalized will be in final ID form. This space is useful for serialization in ops (e.g. references), as other clients
243
- * that receive them need not do any work to normalize them to *their* session-space in the common case. Note that IDs in op space may move
244
- * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a "more final form".
245
- * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially
246
- * incorrect to use this type for a runtime variable. This is an asymmetry that does not affect session space, as local IDs are always as
247
- * "local as possible".
248
- *
249
- * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops
250
- * should use op-space IDs.
251
- * @alpha
252
- */
253
- export declare interface IIdCompressorCore {
254
- /**
255
- * Returns a range of IDs created by this session in a format for sending to the server for finalizing.
256
- * The range will include all IDs generated via calls to `generateCompressedId` since the last time this method was called.
257
- * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before
258
- * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.
259
- */
260
- takeNextCreationRange(): IdCreationRange;
261
- /**
262
- * Finalizes the supplied range of IDs (which may be from either a remote or local session).
263
- * @param range - the range of session-local IDs to finalize.
264
- */
265
- finalizeCreationRange(range: IdCreationRange): void;
266
- /**
267
- * Run a callback that is performed from the perspective of a special "ghost" session.
268
- * Any ids generated by this session will be immediately finalized on the local client as if
269
- * they were created by a remote client with `ghostSessionId`.
270
- *
271
- * *WARNING:* This API requires an external consensus mechanism to safely use:
272
- * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:
273
- * - They invoke this API starting from the same finalized creation ranges
274
- * - This API is invoked with the same ghost session id
275
- * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session
276
- * Failure to meet these requirement will result in divergence across clients and eventual consistency errors.
277
- * While the ghost sesion callback is running, IdCompressor does not support serialization.
278
- * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform
279
- * data in some format into data in a new format.
280
- * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed
281
- * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all
282
- * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.
283
- * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.
284
- * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.
285
- */
286
- beginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;
287
- /**
288
- * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.
289
- * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.
290
- */
291
- serialize(withSession: true): SerializedIdCompressorWithOngoingSession;
292
- /**
293
- * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.
294
- * This only includes finalized state and is therefore suitable for use in summaries.
295
- */
296
- serialize(withSession: false): SerializedIdCompressorWithNoSession;
297
- }
298
-
299
- /**
300
- * Returns true iff the given string is a valid Version 4, variant 2 UUID
301
- * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
302
- * @internal
303
- */
304
- export declare function isStableId(str: string): str is StableId;
305
-
306
- /**
307
- * A compressed ID that has been normalized into "op space".
308
- * Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require less normalizing when
309
- * received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.
310
- * @public
311
- */
312
- export declare type OpSpaceCompressedId = number & {
313
- readonly OpNormalized: "9209432d-a959-4df7-b2ad-767ead4dbcae";
314
- };
315
-
316
- /**
317
- * The serialized contents of an IdCompressor, suitable for persistence in a summary.
318
- * @alpha
319
- */
320
- export declare type SerializedIdCompressor = string & {
321
- readonly _serializedIdCompressor: "8c73c57c-1cf4-4278-8915-6444cb4f6af5";
322
- };
323
-
324
- /**
325
- * The serialized contents of an IdCompressor, suitable for persistence in a summary.
326
- * @alpha
327
- */
328
- export declare type SerializedIdCompressorWithNoSession = SerializedIdCompressor & {
329
- readonly _noLocalState: "3aa2e1e8-cc28-4ea7-bc1a-a11dc3f26dfb";
330
- };
331
-
332
- /**
333
- * The serialized contents of an IdCompressor, suitable for persistence in a summary.
334
- * @alpha
335
- */
336
- export declare type SerializedIdCompressorWithOngoingSession = SerializedIdCompressor & {
337
- readonly _hasLocalState: "1281acae-6d14-47e7-bc92-71c8ee0819cb";
338
- };
339
-
340
- /**
341
- * A StableId which is suitable for use as a session identifier
342
- * @public
343
- */
344
- export declare type SessionId = StableId & {
345
- readonly SessionId: "4498f850-e14e-4be9-8db0-89ec00997e58";
346
- };
347
-
348
- /**
349
- * A compressed ID that has been normalized into "session space" (see `IdCompressor` for more).
350
- * Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to
351
- * the scope of the session (i.e. compressor) that produced them.
352
- * @public
353
- */
354
- export declare type SessionSpaceCompressedId = number & {
355
- readonly SessionUnique: "cea55054-6b82-4cbf-ad19-1fa645ea3b3e";
356
- };
357
-
358
- /**
359
- * A version 4, variant 1 uuid (https://datatracker.ietf.org/doc/html/rfc4122).
360
- * A 128-bit Universally Unique IDentifier. Represented here
361
- * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,
362
- * where x is a lowercase hex digit.
363
- * @public
364
- */
365
- export declare type StableId = string & {
366
- readonly StableId: "53172b0d-a3d5-41ea-bd75-b43839c97f5a";
367
- };
368
-
369
- export { }