@fluidframework/id-compressor 2.110.0 → 2.112.0
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.
- package/CHANGELOG.md +36 -0
- package/api-report/id-compressor.beta.api.md +2 -1
- package/api-report/id-compressor.legacy.beta.api.md +2 -1
- package/api-report/id-compressor.legacy.public.api.md +2 -1
- package/api-report/id-compressor.public.api.md +2 -1
- package/dist/idCompressor.d.ts +1 -0
- package/dist/idCompressor.d.ts.map +1 -1
- package/dist/idCompressor.js +16 -1
- package/dist/idCompressor.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/test/idCompressor.spec.js.map +1 -1
- package/dist/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/dist/types/idCompressor.d.ts +32 -0
- package/dist/types/idCompressor.d.ts.map +1 -1
- package/dist/types/idCompressor.js.map +1 -1
- package/lib/idCompressor.d.ts +1 -0
- package/lib/idCompressor.d.ts.map +1 -1
- package/lib/idCompressor.js +16 -1
- package/lib/idCompressor.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/test/idCompressor.spec.js.map +1 -1
- package/lib/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/lib/types/idCompressor.d.ts +32 -0
- package/lib/types/idCompressor.d.ts.map +1 -1
- package/lib/types/idCompressor.js.map +1 -1
- package/package.json +9 -9
- package/src/idCompressor.ts +20 -3
- package/src/packageVersion.ts +1 -1
- package/src/test/types/validateIdCompressorPrevious.generated.ts +1 -10
- package/src/types/idCompressor.ts +35 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.103.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]}
|
|
1
|
+
{"version":3,"file":"validateIdCompressorPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateIdCompressorPrevious.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by \"flub generate typetests\" from @fluid-tools/build-cli.\n *\n * Baseline (previous) version: 2.111.0\n */\n\nimport type { TypeOnly, MinimalType, FullType, requireAssignableTo } from \"@fluidframework/build-tools\";\nimport type * as old from \"@fluidframework/id-compressor-previous/legacy\";\n\nimport type * as current from \"@fluidframework/id-compressor/legacy\";\n\ndeclare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | FullType<T> | typeof old | typeof current | requireAssignableTo<true, true>;\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createIdCompressor = requireAssignableTo<TypeOnly<typeof current.createIdCompressor>, TypeOnly<typeof old.createIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_createSessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_createSessionId = requireAssignableTo<TypeOnly<typeof current.createSessionId>, TypeOnly<typeof old.createSessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_deserializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_deserializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.deserializeIdCompressor>, TypeOnly<typeof old.deserializeIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Function_serializeIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Function_serializeIdCompressor = requireAssignableTo<TypeOnly<typeof current.serializeIdCompressor>, TypeOnly<typeof old.serializeIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<old.IdCreationRange>, TypeOnly<current.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IdCreationRange\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"Interface_IIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<current.IIdCompressor>, TypeOnly<old.IIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<old.OpSpaceCompressedId>, TypeOnly<current.OpSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_OpSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_OpSpaceCompressedId = requireAssignableTo<TypeOnly<current.OpSpaceCompressedId>, TypeOnly<old.OpSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<old.SerializedIdCompressor>, TypeOnly<current.SerializedIdCompressor>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressor\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressor = requireAssignableTo<TypeOnly<current.SerializedIdCompressor>, TypeOnly<old.SerializedIdCompressor>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithNoSession>, TypeOnly<current.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithNoSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithNoSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithNoSession>, TypeOnly<old.SerializedIdCompressorWithNoSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<old.SerializedIdCompressorWithOngoingSession>, TypeOnly<current.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SerializedIdCompressorWithOngoingSession\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SerializedIdCompressorWithOngoingSession = requireAssignableTo<TypeOnly<current.SerializedIdCompressorWithOngoingSession>, TypeOnly<old.SerializedIdCompressorWithOngoingSession>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<old.SessionId>, TypeOnly<current.SessionId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionId = requireAssignableTo<TypeOnly<current.SessionId>, TypeOnly<old.SessionId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<old.SessionSpaceCompressedId>, TypeOnly<current.SessionSpaceCompressedId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_SessionSpaceCompressedId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_SessionSpaceCompressedId = requireAssignableTo<TypeOnly<current.SessionSpaceCompressedId>, TypeOnly<old.SessionSpaceCompressedId>>\n\n/*\n * Validate forward compatibility by using the old type in place of the current type.\n * If this test starts failing, it indicates a change that is not forward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"forwardCompat\": false}\n */\ndeclare type old_as_current_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<old.StableId>, TypeOnly<current.StableId>>\n\n/*\n * Validate backward compatibility by using the current type in place of the old type.\n * If this test starts failing, it indicates a change that is not backward compatible.\n * To acknowledge the breaking change, add the following to package.json under\n * typeValidation.broken:\n * \"TypeAlias_StableId\": {\"backCompat\": false}\n */\ndeclare type current_as_old_for_TypeAlias_StableId = requireAssignableTo<TypeOnly<current.StableId>, TypeOnly<old.StableId>>\n"]}
|
|
@@ -189,6 +189,7 @@ export interface IIdCompressorCore {
|
|
|
189
189
|
* const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);
|
|
190
190
|
* ```
|
|
191
191
|
* @public
|
|
192
|
+
* @sealed
|
|
192
193
|
*/
|
|
193
194
|
export interface IIdCompressor {
|
|
194
195
|
/**
|
|
@@ -241,6 +242,37 @@ export interface IIdCompressor {
|
|
|
241
242
|
* so they should explicitly include session IDs if required to decode them just like regular summaries and exported data.
|
|
242
243
|
*/
|
|
243
244
|
normalizeToSessionSpace(id: OpSpaceCompressedId, originSessionId: SessionId): SessionSpaceCompressedId;
|
|
245
|
+
/**
|
|
246
|
+
* Attempts to normalize an op-space ID into session space without an originator session id.
|
|
247
|
+
* This mainly exists for data recovery purposes, when the originator session id was lost.
|
|
248
|
+
* When possible, use {@link IIdCompressor.normalizeToSessionSpace} instead.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* When the id is a final ID, this will return the properly translated session-space ID,
|
|
252
|
+
* or throw if it detects that the final id is not valid in this compressor.
|
|
253
|
+
*
|
|
254
|
+
* Returns `undefined` if `id` is a non-final op-space ID — those are local to the
|
|
255
|
+
* originating session and require its session id to resolve. Callers which have the
|
|
256
|
+
* originating session id should call {@link IIdCompressor.normalizeToSessionSpace} instead.
|
|
257
|
+
*
|
|
258
|
+
* @param id - The ID to normalize.
|
|
259
|
+
* @returns The session-space ID corresponding to `id`, or `undefined` if `id` is
|
|
260
|
+
* non-final and therefore requires an originator session id to resolve.
|
|
261
|
+
* @throws If `id` is final but is not known to this compressor (i.e. it refers to
|
|
262
|
+
* a final id that has never been observed as finalized).
|
|
263
|
+
* Note that it is possible (even likely) for a finalized id from another id compressor to pass this check,
|
|
264
|
+
* and return an incorrect session-space ID.
|
|
265
|
+
* This error is thrown only in cases where it is possible to detect the input is invalid,
|
|
266
|
+
* and intended to help with catching bugs where invalid identifiers are being provided.
|
|
267
|
+
* It cannot be relied upon for validation.
|
|
268
|
+
*
|
|
269
|
+
* @privateRemarks
|
|
270
|
+
* Currently this is only used for data recovery in the case of lost session ids,
|
|
271
|
+
* but we could theoretically provide an API to determine if the session id is required when encoding data (some IDs were non-final):
|
|
272
|
+
* in such a setup, this API, and/or a version of normalizeToSessionSpace where the session id is optional,
|
|
273
|
+
* could be used for a regular non-recovery use-case.
|
|
274
|
+
*/
|
|
275
|
+
tryNormalizeToSessionSpaceWithoutSession(id: OpSpaceCompressedId): SessionSpaceCompressedId | undefined;
|
|
244
276
|
/**
|
|
245
277
|
* Decompresses a previously compressed ID into a UUID.
|
|
246
278
|
* @param id - The compressed ID to be decompressed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,eAAe,EACf,mCAAmC,EACnC,wCAAwC,EACxC,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;OAMG;IACH,qBAAqB,IAAI,eAAe,CAAC;IAEzC;;;;;;;OAOG;IACH,4BAA4B,IAAI,eAAe,CAAC;IAEhD;;;;;;;;;;;;;OAaG;IACH,6BAA6B,IAAI,IAAI,CAAC;IAEtC;;;OAGG;IACH,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAEpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,cAAc,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAErF;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAE,IAAI,GAAG,wCAAwC,CAAC;IAEvE;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,mCAAmC,CAAC;CACnE;AAED
|
|
1
|
+
{"version":3,"file":"idCompressor.d.ts","sourceRoot":"","sources":["../../src/types/idCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,eAAe,EACf,mCAAmC,EACnC,wCAAwC,EACxC,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;OAMG;IACH,qBAAqB,IAAI,eAAe,CAAC;IAEzC;;;;;;;OAOG;IACH,4BAA4B,IAAI,eAAe,CAAC;IAEhD;;;;;;;;;;;;;OAaG;IACH,6BAA6B,IAAI,IAAI,CAAC;IAEtC;;;OAGG;IACH,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAEpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,cAAc,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAErF;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAE,IAAI,GAAG,wCAAwC,CAAC;IAEvE;;;OAGG;IACH,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,mCAAmC,CAAC;CACnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,cAAc,EAAE,SAAS,CAAC;IAE1B;;;;OAIG;IACH,oBAAoB,IAAI,wBAAwB,CAAC;IAEjD;;;;;;;;;OASG;IACH,wBAAwB,IAAI,CAAC,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,QAAQ,CAAC;IAExF;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,EAAE,wBAAwB,GAAG,mBAAmB,CAAC;IAEtE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,uBAAuB,CACtB,EAAE,EAAE,mBAAmB,EACvB,eAAe,EAAE,SAAS,GACxB,wBAAwB,CAAC;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,wCAAwC,CACvC,EAAE,EAAE,mBAAmB,GACrB,wBAAwB,GAAG,SAAS,CAAC;IAExC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,wBAAwB,GAAG,QAAQ,CAAC;IAEnD;;;;;OAKG;IACH,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,CAAC;IAE7D;;;;OAIG;IACH,aAAa,CAAC,YAAY,EAAE,QAAQ,GAAG,wBAAwB,GAAG,SAAS,CAAC;CAC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.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 {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then be sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 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\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 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\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * 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\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 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\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * 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\n * 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\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 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\n * 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\n * 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\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * 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\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @internal\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirements will result in divergence across clients and eventual consistency errors.\n\t * While the ghost session callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probable in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized.\n\t * However, it should be {@link IIdCompressor.normalizeToSessionSpace|normalized back to session space} before use.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The {@link IIdCompressor.localSessionId} of the compressor which {@link IIdCompressor.normalizeToOpSpace|encoded} `id`.\n\t * This might not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t * @remarks\n\t * For this to be valid, `originSessionId` must be the {@link IIdCompressor.localSessionId} of the compressor that normalized `id` to op space.\n\t * Additionally, this compressor must know about the relevant {@link IdCreationRange} from the encoding `IIdCompressor`.\n\t * This can be accomplished using creating the compressor using {@link (deserializeIdCompressor:1)},\n\t * or relying on something (like the Fluid runtime) to synchronize the range information using internal mechanisms.\n\t *\n\t * The {@link IIdCompressor} provided by the Fluid Framework runtime will automatically track {@link IdCreationRange| Id Creation Ranges} (via its own ops) from other clients in the container.\n\t * It is up to the user of the {@link IIdCompressor} to ensure the relevant session information is available,\n\t * either by depending on the originating client's session ID for ops, or by explicitly storing it alongside the data containing the {@link OpSpaceCompressedId}.\n\t *\n\t * Note that attachment summaries, while they are ops, are also interpreted as summaries without the context of their originating session,\n\t * so they should explicitly include session IDs if required to decode them just like regular summaries and exported data.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"idCompressor.js","sourceRoot":"","sources":["../../src/types/idCompressor.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 {\n\tOpSpaceCompressedId,\n\tSessionId,\n\tSessionSpaceCompressedId,\n\tStableId,\n} from \"./identifiers.js\";\nimport type {\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"./persisted-types/index.js\";\n\n/**\n * A distributed UUID generator and compressor.\n *\n * Generates arbitrary non-colliding v4 UUIDs, called stable IDs, for multiple \"sessions\" (which can be distributed across the network),\n * providing each session with the ability to map these UUIDs to `numbers`.\n *\n * A session is a unique identifier that denotes a single compressor. New IDs are created through a single compressor API\n * which should then be sent in ranges to the server for total ordering (and are subsequently relayed to other clients). When a new ID is\n * created it is said to be created by the compressor's \"local\" session.\n *\n * For each stable ID created, two numeric IDs are provided by the compressor:\n *\n * 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\n * be serialized for offline usage). Available as soon as the stable ID is allocated. These IDs are session-unique and are thus only\n * safely usable within the scope of the compressor that created it.\n *\n * 2. A final ID, which is stable across serialization and deserialization of an IdCompressor. Available as soon as the range containing\n * the corresponding session-local ID is totally ordered (via consensus) with respect to other sessions' allocations.\n * Final IDs are known to and publicly usable by any compressor that has received them.\n *\n * Compressors will allocate UUIDs in non-random ways to reduce entropy allowing for optimized storage of the data needed\n * to map the UUIDs to the numbers.\n *\n * The following invariants are upheld by IdCompressor:\n *\n * 1. Session-local IDs will always decompress to the same UUIDs for the lifetime of the session.\n *\n * 2. Final IDs will always decompress to the same UUIDs.\n *\n * 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\n * translated by the compressor into the corresponding final ID. For any given session-local ID, this translation will always yield the\n * same final ID.\n *\n * 4. A UUID will always compress into the same session-local ID for the lifetime of the session.\n *\n * Session-local IDs are sent across the wire in efficiently-represented ranges. These ranges are created by querying the compressor, and *must*\n * be ordered (i.e. sent to the server) in the order they are created in order to preserve the above invariants.\n *\n * Session-local IDs can be used immediately after creation, but will eventually (after being sequenced) have a corresponding final ID. This\n * could make reasoning about equality of those two forms difficult. For example, if a cache is keyed off of a\n * 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\n * produce a cache miss. In order to make using collections of both remotely created and locally created IDs easy, regardless of whether the\n * session-local IDs have been finalized, the compressor defines two \"spaces\" of IDs:\n *\n * 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\n * will be in local form, regardless of if they have been finalized. Remotely created IDs, which could only have been received after\n * 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\n * 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\n * these IDs across compressor objects, as the local IDs are specific to the compressor that created them.\n *\n * 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\n * 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\n * 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\n * out of Op space over time, namely, when a session-local ID in this space becomes finalized, and thereafter has a \"more final form\".\n * Consequentially, it may be useful to restrict parameters of a persisted type to this space (to optimize perf), but it is potentially\n * 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\n * \"local as possible\".\n *\n * These two spaces naturally define a rule: consumers of compressed IDs should use session-space IDs, but serialized forms such as ops\n * should use op-space IDs.\n *\n * @internal\n */\nexport interface IIdCompressorCore {\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all IDs generated via calls to `generateCompressedId` since the last time a\n\t * range was taken (via this method or `takeUnfinalizedCreationRange`).\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t */\n\ttakeNextCreationRange(): IdCreationRange;\n\n\t/**\n\t * Returns a range of IDs created by this session in a format for sending to the server for finalizing.\n\t * The range will include all unfinalized IDs generated via calls to `generateCompressedId`.\n\t * @returns the range of IDs, which may be empty. This range must be sent to the server for ordering before\n\t * it is finalized. Ranges must be sent to the server in the order that they are taken via calls to this method.\n\t * Note: after finalizing the range returned by this method, finalizing any ranges that had been previously taken\n\t * will result in an error.\n\t */\n\ttakeUnfinalizedCreationRange(): IdCreationRange;\n\n\t/**\n\t * Resets the next creation range to include all unfinalized IDs.\n\t *\n\t * @remarks\n\t * IMPORTANT: This must only be called if it's CERTAIN that the unfinalized range will never be finalized as-is (e.g. by in-flight ops).\n\t *\n\t * After calling this, the next call to {@link IIdCompressorCore.takeNextCreationRange} will produce a range\n\t * covering all unfinalized IDs (equivalent to what {@link IIdCompressorCore.takeUnfinalizedCreationRange} would\n\t * have returned) plus any IDs generated after this call.\n\t *\n\t * Unlike {@link IIdCompressorCore.takeUnfinalizedCreationRange}, this method does not produce or return a range,\n\t * and does not advance the internal range counter. It is useful when the caller wants to\n\t * defer the actual range submission to the next natural {@link IIdCompressorCore.takeNextCreationRange} call.\n\t */\n\tresetUnfinalizedCreationRange(): void;\n\n\t/**\n\t * Finalizes the supplied range of IDs (which may be from either a remote or local session).\n\t * @param range - the range of session-local IDs to finalize.\n\t */\n\tfinalizeCreationRange(range: IdCreationRange): void;\n\n\t/**\n\t * Run a callback that is performed from the perspective of a special \"ghost\" session.\n\t * Any ids generated by this session will be immediately finalized on the local client as if\n\t * they were created by a remote client with `ghostSessionId`.\n\t *\n\t * *WARNING:* This API requires an external consensus mechanism to safely use:\n\t * In an attached container (i.e. multiple clients may have the document loaded), all clients must guarantee that:\n\t * - They invoke this API starting from the same finalized creation ranges\n\t * - This API is invoked with the same ghost session id\n\t * - `ghostSessionCallback` deterministically mints the same number of ids on each client within the ghost session\n\t * Failure to meet these requirements will result in divergence across clients and eventual consistency errors.\n\t * While the ghost session callback is running, IdCompressor does not support serialization.\n\t * @remarks This API is primarily intended for data migration scenarios which are able to deterministically transform\n\t * data in some format into data in a new format.\n\t * The first requirement (that all clients must invoke the API with the same finalized creation ranges) is guaranteed\n\t * for this scenario because the data transformation callback occurs at a specific ack within the op stream on all\n\t * clients, and clients don't finalize creation ranges for local changes they might have at this point in time.\n\t * @param ghostSessionId - The session id that minted ids generated within `ghostSessionCallback` should be attributed to.\n\t * @param ghostSessionCallback - Callback which mints ids attributed to the ghost session.\n\t */\n\tbeginGhostSession(ghostSessionId: SessionId, ghostSessionCallback: () => void): void;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This includes finalized state as well as un-finalized state and is therefore suitable for use in offline scenarios.\n\t */\n\tserialize(withSession: true): SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Returns a persistable form of the current state of this `IdCompressor` which can be rehydrated via `IdCompressor.deserialize()`.\n\t * This only includes finalized state and is therefore suitable for use in summaries.\n\t */\n\tserialize(withSession: false): SerializedIdCompressorWithNoSession;\n}\n\n/**\n * A distributed UUID generator and compressor.\n * `IdCompressor` offers the ability to generate arbitrary non-colliding v4 UUIDs, called stable IDs, while compressing them into small integers\n * for efficient storage and transmission. It also provides the ability to decompress these integers back into their original UUIDs.\n *\n * The compressor is designed to be used in a distributed environment, where multiple clients may be generating IDs concurrently.\n * IDs generated by a compressor, via calls to `generateCompressedId`, are created in the compressor's \"local\" session.\n * These IDs are unique within the session, but may not be unique across sessions. In the context of Fluid, the scope of a session\n * is the same as the scope of a container. This means that anytime IDs are transferred between sessions, they must be translated\n * through a process called \"normalization\":\n * - The scope of a local session (in which local IDs are unique) is called the \"session space\" of the client.\n * - The context of persisted state (in Fluid, this is the context of ops and summaries) is called \"op space\".\n * - `SessionSpaceCompressedId`s, generated via calls to `generateCompressedId`, should NEVER be serialized directly.\n * In Fluid, this means they should not be included in ops or summaries.\n * - Before serialization, IDs must be normalized to op space to ensure they are interpretable by other clients.\n * - Upon receipt, IDs should be normalized back to session space before use.\n *\n * Example Usage:\n *\n * ### Client A (Sender)\n *\n * ```typescript\n * // Generate several local IDs\n * const localId1 = idCompressor.generateCompressedId();\n * const localId2 = idCompressor.generateCompressedId();\n * const localId3 = idCompressor.generateCompressedId();\n *\n * // Normalize these IDs to op space for inclusion in a message\n * const opSpaceId1 = idCompressor.normalizeToOpSpace(localId1);\n * const opSpaceId2 = idCompressor.normalizeToOpSpace(localId2);\n * const opSpaceId3 = idCompressor.normalizeToOpSpace(localId3);\n *\n * // Create and send a message containing these op space IDs along with the sender's session ID\n * // In Fluid, this would be an op or summary\n * const message = {\n * sessionID: idCompressor.localSessionId,\n * ids: [opSpaceId1, opSpaceId2, opSpaceId3]\n * };\n * ```\n *\n * ### Client B (Receiver)\n *\n * ```typescript\n * // Receive the message from Client A\n * const receivedMessage = ...; // In Fluid, this would be an op or summary\n *\n * // Normalize the received IDs back to session space, utilizing the sender's session ID\n * const sessionSpaceId1 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[0], receivedMessage.sessionID);\n * const sessionSpaceId2 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[1], receivedMessage.sessionID);\n * const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);\n * ```\n * @public\n * @sealed\n */\nexport interface IIdCompressor {\n\t/**\n\t * The local session ID.\n\t */\n\tlocalSessionId: SessionId;\n\n\t/**\n\t * Generates a new compressed ID.\n\t * The returned ID is in session space and should not be serialized directly. See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateCompressedId(): SessionSpaceCompressedId;\n\n\t/**\n\t * Generates a new ID that is guaranteed to be unique across all sessions known to this compressor without the need for any\n\t * normalization. The returned ID is not guaranteed to be a compressed ID (small number); it may be a stable ID (UUID string).\n\t * In Fluid, the likelihood of generating the bulkier stable ID is dictated by network conditions and is highly probable in\n\t * scenarios such as offline. This is still useful for use cases where simplicity is more important than performance and\n\t * this approach will often be superior to generating a UUID.\n\t * If small numbers are a requirement, `generateCompressedId` and normalization should be used instead.\n\t * See `IIdCompressor` for more details.\n\t * @returns A new local ID in session space.\n\t */\n\tgenerateDocumentUniqueId(): (SessionSpaceCompressedId & OpSpaceCompressedId) | StableId;\n\n\t/**\n\t * Normalizes a session space ID into op space.\n\t * The returned ID is in op space and can be safely serialized.\n\t * However, it should be {@link IIdCompressor.normalizeToSessionSpace|normalized back to session space} before use.\n\t * @param id - The local ID to normalize.\n\t * @returns The ID in op space.\n\t */\n\tnormalizeToOpSpace(id: SessionSpaceCompressedId): OpSpaceCompressedId;\n\n\t/**\n\t * Normalizes an ID into session space.\n\t * @param id - The ID to normalize.\n\t * @param originSessionId - The {@link IIdCompressor.localSessionId} of the compressor which {@link IIdCompressor.normalizeToOpSpace|encoded} `id`.\n\t * This might not be the client that created `id` in the first place, but rather the client that serialized it.\n\t * This is an important distinction in the case of a reference, where a client might refer to an ID created by another client.\n\t * @returns The session-space ID in the local session corresponding to `id`.\n\t * @remarks\n\t * For this to be valid, `originSessionId` must be the {@link IIdCompressor.localSessionId} of the compressor that normalized `id` to op space.\n\t * Additionally, this compressor must know about the relevant {@link IdCreationRange} from the encoding `IIdCompressor`.\n\t * This can be accomplished using creating the compressor using {@link (deserializeIdCompressor:1)},\n\t * or relying on something (like the Fluid runtime) to synchronize the range information using internal mechanisms.\n\t *\n\t * The {@link IIdCompressor} provided by the Fluid Framework runtime will automatically track {@link IdCreationRange| Id Creation Ranges} (via its own ops) from other clients in the container.\n\t * It is up to the user of the {@link IIdCompressor} to ensure the relevant session information is available,\n\t * either by depending on the originating client's session ID for ops, or by explicitly storing it alongside the data containing the {@link OpSpaceCompressedId}.\n\t *\n\t * Note that attachment summaries, while they are ops, are also interpreted as summaries without the context of their originating session,\n\t * so they should explicitly include session IDs if required to decode them just like regular summaries and exported data.\n\t */\n\tnormalizeToSessionSpace(\n\t\tid: OpSpaceCompressedId,\n\t\toriginSessionId: SessionId,\n\t): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to normalize an op-space ID into session space without an originator session id.\n\t * This mainly exists for data recovery purposes, when the originator session id was lost.\n\t * When possible, use {@link IIdCompressor.normalizeToSessionSpace} instead.\n\t *\n\t * @remarks\n\t * When the id is a final ID, this will return the properly translated session-space ID,\n\t * or throw if it detects that the final id is not valid in this compressor.\n\t *\n\t * Returns `undefined` if `id` is a non-final op-space ID — those are local to the\n\t * originating session and require its session id to resolve. Callers which have the\n\t * originating session id should call {@link IIdCompressor.normalizeToSessionSpace} instead.\n\t *\n\t * @param id - The ID to normalize.\n\t * @returns The session-space ID corresponding to `id`, or `undefined` if `id` is\n\t * non-final and therefore requires an originator session id to resolve.\n\t * @throws If `id` is final but is not known to this compressor (i.e. it refers to\n\t * a final id that has never been observed as finalized).\n\t * Note that it is possible (even likely) for a finalized id from another id compressor to pass this check,\n\t * and return an incorrect session-space ID.\n\t * This error is thrown only in cases where it is possible to detect the input is invalid,\n\t * and intended to help with catching bugs where invalid identifiers are being provided.\n\t * It cannot be relied upon for validation.\n\t *\n\t * @privateRemarks\n\t * Currently this is only used for data recovery in the case of lost session ids,\n\t * but we could theoretically provide an API to determine if the session id is required when encoding data (some IDs were non-final):\n\t * in such a setup, this API, and/or a version of normalizeToSessionSpace where the session id is optional,\n\t * could be used for a regular non-recovery use-case.\n\t */\n\ttryNormalizeToSessionSpaceWithoutSession(\n\t\tid: OpSpaceCompressedId,\n\t): SessionSpaceCompressedId | undefined;\n\n\t/**\n\t * Decompresses a previously compressed ID into a UUID.\n\t * @param id - The compressed ID to be decompressed.\n\t * @returns The UUID associated with the compressed ID.\n\t * @throws If the ID was not generated by any session known to this compressor.\n\t */\n\tdecompress(id: SessionSpaceCompressedId): StableId;\n\n\t/**\n\t * Recompresses a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed`.\n\t * @throws If the UUID was not generated by any session known to this compressor.\n\t */\n\trecompress(uncompressed: StableId): SessionSpaceCompressedId;\n\n\t/**\n\t * Attempts to recompress a UUID.\n\t * @param uncompressed - The UUID to recompress.\n\t * @returns The `CompressedId` associated with `uncompressed` or undefined if the UUID was not generated by any session known to this compressor.\n\t */\n\ttryRecompress(uncompressed: StableId): SessionSpaceCompressedId | undefined;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/id-compressor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.112.0",
|
|
4
4
|
"description": "ID compressor",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -81,29 +81,29 @@
|
|
|
81
81
|
"temp-directory": "nyc/.nyc_output"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@fluid-internal/client-utils": "~2.
|
|
85
|
-
"@fluidframework/core-interfaces": "~2.
|
|
86
|
-
"@fluidframework/core-utils": "~2.
|
|
87
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
84
|
+
"@fluid-internal/client-utils": "~2.112.0",
|
|
85
|
+
"@fluidframework/core-interfaces": "~2.112.0",
|
|
86
|
+
"@fluidframework/core-utils": "~2.112.0",
|
|
87
|
+
"@fluidframework/telemetry-utils": "~2.112.0",
|
|
88
88
|
"@tylerbu/sorted-btree-es6": "^2.1.1",
|
|
89
89
|
"uuid": "^11.1.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
93
93
|
"@biomejs/biome": "~2.4.5",
|
|
94
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
95
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
94
|
+
"@fluid-internal/mocha-test-setup": "~2.112.0",
|
|
95
|
+
"@fluid-private/stochastic-test-utils": "~2.112.0",
|
|
96
96
|
"@fluid-tools/benchmark": "^0.59.0",
|
|
97
97
|
"@fluid-tools/build-cli": "^0.65.0",
|
|
98
98
|
"@fluidframework/build-common": "^2.0.3",
|
|
99
99
|
"@fluidframework/build-tools": "^0.65.0",
|
|
100
100
|
"@fluidframework/eslint-config-fluid": "^13.0.0",
|
|
101
|
-
"@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.
|
|
101
|
+
"@fluidframework/id-compressor-previous": "npm:@fluidframework/id-compressor@2.111.0",
|
|
102
102
|
"@microsoft/api-extractor": "7.58.1",
|
|
103
103
|
"@types/mocha": "^10.0.10",
|
|
104
104
|
"@types/node": "~22.19.17",
|
|
105
105
|
"c8": "^10.1.3",
|
|
106
|
-
"concurrently": "^
|
|
106
|
+
"concurrently": "^10.0.3",
|
|
107
107
|
"copyfiles": "^2.4.1",
|
|
108
108
|
"cross-env": "^10.1.0",
|
|
109
109
|
"eslint": "~9.39.1",
|
package/src/idCompressor.ts
CHANGED
|
@@ -412,10 +412,9 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
public
|
|
415
|
+
public tryNormalizeToSessionSpaceWithoutSession(
|
|
416
416
|
id: OpSpaceCompressedId,
|
|
417
|
-
|
|
418
|
-
): SessionSpaceCompressedId {
|
|
417
|
+
): SessionSpaceCompressedId | undefined {
|
|
419
418
|
if (isFinalId(id)) {
|
|
420
419
|
const containingCluster = this.localSession.getClusterByAllocatedFinal(id);
|
|
421
420
|
if (containingCluster === undefined) {
|
|
@@ -430,12 +429,28 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
|
430
429
|
return alignedLocal;
|
|
431
430
|
} else {
|
|
432
431
|
if (genCountFromLocalId(alignedLocal) > this.localGenCount) {
|
|
432
|
+
// The ID is not valid in this compressor. It is either from a future version of this compressor, or another compressor.
|
|
433
|
+
// Since IDs from other compressors often are valid in this one, but uncompress incorrectly,
|
|
434
|
+
// we cannot rely on this function (tryNormalizeToSessionSpaceWithoutSession) to validate that the IDs are from the same compressor.
|
|
435
|
+
// Since such validation can not be robust, this "try" function is explicitly documented not to be allowed to be used for this case.
|
|
436
|
+
// Therefore, as documented in the API docs for this function, calls can not rely on a specific output in this case,
|
|
437
|
+
// and therefore the document behavior of throwing makes the most sense (helps catch bugs).
|
|
433
438
|
throw new Error("Unknown op space ID.");
|
|
434
439
|
}
|
|
435
440
|
return id as unknown as SessionSpaceCompressedId;
|
|
436
441
|
}
|
|
437
442
|
}
|
|
438
443
|
} else {
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
public normalizeToSessionSpace(
|
|
449
|
+
id: OpSpaceCompressedId,
|
|
450
|
+
originSessionId: SessionId,
|
|
451
|
+
): SessionSpaceCompressedId {
|
|
452
|
+
const normalizedWithoutSession = this.tryNormalizeToSessionSpaceWithoutSession(id);
|
|
453
|
+
if (normalizedWithoutSession === undefined) {
|
|
439
454
|
const localToNormalize = id as unknown as LocalCompressedId;
|
|
440
455
|
if (originSessionId === this.localSessionId) {
|
|
441
456
|
if (this.normalizer.contains(localToNormalize)) {
|
|
@@ -456,6 +471,8 @@ export class IdCompressor implements IIdCompressor, IIdCompressorCore {
|
|
|
456
471
|
}
|
|
457
472
|
return correspondingFinal as unknown as SessionSpaceCompressedId;
|
|
458
473
|
}
|
|
474
|
+
} else {
|
|
475
|
+
return normalizedWithoutSession;
|
|
459
476
|
}
|
|
460
477
|
}
|
|
461
478
|
|
package/src/packageVersion.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
8
|
* Generated by "flub generate typetests" from @fluid-tools/build-cli.
|
|
9
9
|
*
|
|
10
|
-
* Baseline (previous) version: 2.
|
|
10
|
+
* Baseline (previous) version: 2.111.0
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { TypeOnly, MinimalType, FullType, requireAssignableTo } from "@fluidframework/build-tools";
|
|
@@ -71,15 +71,6 @@ declare type old_as_current_for_Interface_IdCreationRange = requireAssignableTo<
|
|
|
71
71
|
*/
|
|
72
72
|
declare type current_as_old_for_Interface_IdCreationRange = requireAssignableTo<TypeOnly<current.IdCreationRange>, TypeOnly<old.IdCreationRange>>
|
|
73
73
|
|
|
74
|
-
/*
|
|
75
|
-
* Validate forward compatibility by using the old type in place of the current type.
|
|
76
|
-
* If this test starts failing, it indicates a change that is not forward compatible.
|
|
77
|
-
* To acknowledge the breaking change, add the following to package.json under
|
|
78
|
-
* typeValidation.broken:
|
|
79
|
-
* "Interface_IIdCompressor": {"forwardCompat": false}
|
|
80
|
-
*/
|
|
81
|
-
declare type old_as_current_for_Interface_IIdCompressor = requireAssignableTo<TypeOnly<old.IIdCompressor>, TypeOnly<current.IIdCompressor>>
|
|
82
|
-
|
|
83
74
|
/*
|
|
84
75
|
* Validate backward compatibility by using the current type in place of the old type.
|
|
85
76
|
* If this test starts failing, it indicates a change that is not backward compatible.
|
|
@@ -207,6 +207,7 @@ export interface IIdCompressorCore {
|
|
|
207
207
|
* const sessionSpaceId3 = idCompressor.normalizeToSessionSpace(receivedMessage.ids[2], receivedMessage.sessionID);
|
|
208
208
|
* ```
|
|
209
209
|
* @public
|
|
210
|
+
* @sealed
|
|
210
211
|
*/
|
|
211
212
|
export interface IIdCompressor {
|
|
212
213
|
/**
|
|
@@ -267,6 +268,40 @@ export interface IIdCompressor {
|
|
|
267
268
|
originSessionId: SessionId,
|
|
268
269
|
): SessionSpaceCompressedId;
|
|
269
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Attempts to normalize an op-space ID into session space without an originator session id.
|
|
273
|
+
* This mainly exists for data recovery purposes, when the originator session id was lost.
|
|
274
|
+
* When possible, use {@link IIdCompressor.normalizeToSessionSpace} instead.
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* When the id is a final ID, this will return the properly translated session-space ID,
|
|
278
|
+
* or throw if it detects that the final id is not valid in this compressor.
|
|
279
|
+
*
|
|
280
|
+
* Returns `undefined` if `id` is a non-final op-space ID — those are local to the
|
|
281
|
+
* originating session and require its session id to resolve. Callers which have the
|
|
282
|
+
* originating session id should call {@link IIdCompressor.normalizeToSessionSpace} instead.
|
|
283
|
+
*
|
|
284
|
+
* @param id - The ID to normalize.
|
|
285
|
+
* @returns The session-space ID corresponding to `id`, or `undefined` if `id` is
|
|
286
|
+
* non-final and therefore requires an originator session id to resolve.
|
|
287
|
+
* @throws If `id` is final but is not known to this compressor (i.e. it refers to
|
|
288
|
+
* a final id that has never been observed as finalized).
|
|
289
|
+
* Note that it is possible (even likely) for a finalized id from another id compressor to pass this check,
|
|
290
|
+
* and return an incorrect session-space ID.
|
|
291
|
+
* This error is thrown only in cases where it is possible to detect the input is invalid,
|
|
292
|
+
* and intended to help with catching bugs where invalid identifiers are being provided.
|
|
293
|
+
* It cannot be relied upon for validation.
|
|
294
|
+
*
|
|
295
|
+
* @privateRemarks
|
|
296
|
+
* Currently this is only used for data recovery in the case of lost session ids,
|
|
297
|
+
* but we could theoretically provide an API to determine if the session id is required when encoding data (some IDs were non-final):
|
|
298
|
+
* in such a setup, this API, and/or a version of normalizeToSessionSpace where the session id is optional,
|
|
299
|
+
* could be used for a regular non-recovery use-case.
|
|
300
|
+
*/
|
|
301
|
+
tryNormalizeToSessionSpaceWithoutSession(
|
|
302
|
+
id: OpSpaceCompressedId,
|
|
303
|
+
): SessionSpaceCompressedId | undefined;
|
|
304
|
+
|
|
270
305
|
/**
|
|
271
306
|
* Decompresses a previously compressed ID into a UUID.
|
|
272
307
|
* @param id - The compressed ID to be decompressed.
|