@fluidframework/container-runtime 2.0.0-internal.6.1.0 → 2.0.0-internal.6.2.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 +35 -0
- package/README.md +4 -3
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +4 -20
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +47 -125
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +82 -14
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +236 -138
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +1 -2
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +4 -5
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -2
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.js +2 -2
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +4 -5
- package/dist/dataStores.js.map +1 -1
- package/dist/error.d.ts +14 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +21 -0
- package/dist/error.js.map +1 -0
- package/dist/gc/garbageCollection.d.ts +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +23 -5
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +5 -3
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +2 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +2 -0
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js +25 -67
- package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/finalSpace.d.ts +29 -0
- package/dist/id-compressor/finalSpace.d.ts.map +1 -0
- package/dist/id-compressor/finalSpace.js +62 -0
- package/dist/id-compressor/finalSpace.js.map +1 -0
- package/dist/id-compressor/idCompressor.d.ts +25 -250
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js +385 -1149
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/id-compressor/identifiers.d.ts +32 -0
- package/dist/id-compressor/identifiers.d.ts.map +1 -0
- package/dist/id-compressor/identifiers.js +15 -0
- package/dist/id-compressor/identifiers.js.map +1 -0
- package/dist/id-compressor/index.d.ts +5 -6
- package/dist/id-compressor/index.d.ts.map +1 -1
- package/dist/id-compressor/index.js +20 -26
- package/dist/id-compressor/index.js.map +1 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +22 -0
- package/dist/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/dist/id-compressor/persistanceUtilities.js +43 -0
- package/dist/id-compressor/persistanceUtilities.js.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js +80 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/dist/id-compressor/sessions.d.ts +115 -0
- package/dist/id-compressor/sessions.d.ts.map +1 -0
- package/dist/id-compressor/sessions.js +305 -0
- package/dist/id-compressor/sessions.js.map +1 -0
- package/dist/id-compressor/utilities.d.ts +49 -0
- package/dist/id-compressor/utilities.d.ts.map +1 -0
- package/dist/id-compressor/utilities.js +166 -0
- package/dist/id-compressor/utilities.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -2
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +2 -3
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +1 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +10 -11
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +11 -5
- package/dist/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +12 -5
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +24 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +4 -5
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +2 -2
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +2 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -2
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +2 -3
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +27 -4
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +237 -66
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +6 -5
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +70 -67
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +38 -25
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +1 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +9 -3
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +42 -38
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +7 -6
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +22 -15
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.js +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +4 -20
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +46 -124
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +82 -14
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +223 -123
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +1 -2
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +1 -2
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +1 -2
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +1 -2
- package/lib/dataStores.js.map +1 -1
- package/lib/error.d.ts +14 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +17 -0
- package/lib/error.js.map +1 -0
- package/lib/gc/garbageCollection.d.ts +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +22 -4
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +3 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +2 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +2 -0
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js +24 -65
- package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/finalSpace.d.ts +29 -0
- package/lib/id-compressor/finalSpace.d.ts.map +1 -0
- package/lib/id-compressor/finalSpace.js +58 -0
- package/lib/id-compressor/finalSpace.js.map +1 -0
- package/lib/id-compressor/idCompressor.d.ts +25 -250
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js +381 -1139
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/id-compressor/identifiers.d.ts +32 -0
- package/lib/id-compressor/identifiers.d.ts.map +1 -0
- package/lib/id-compressor/identifiers.js +11 -0
- package/lib/id-compressor/identifiers.js.map +1 -0
- package/lib/id-compressor/index.d.ts +5 -6
- package/lib/id-compressor/index.d.ts.map +1 -1
- package/lib/id-compressor/index.js +5 -6
- package/lib/id-compressor/index.js.map +1 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +22 -0
- package/lib/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/lib/id-compressor/persistanceUtilities.js +34 -0
- package/lib/id-compressor/persistanceUtilities.js.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js +76 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/lib/id-compressor/sessions.d.ts +115 -0
- package/lib/id-compressor/sessions.d.ts.map +1 -0
- package/lib/id-compressor/sessions.js +290 -0
- package/lib/id-compressor/sessions.js.map +1 -0
- package/lib/id-compressor/utilities.d.ts +49 -0
- package/lib/id-compressor/utilities.d.ts.map +1 -0
- package/lib/id-compressor/utilities.js +148 -0
- package/lib/id-compressor/utilities.js.map +1 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -2
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +1 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +6 -7
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +12 -6
- package/lib/opLifecycle/remoteMessageProcessor.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/pendingStateManager.d.ts +12 -5
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -7
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +1 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/index.d.ts +2 -2
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -2
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +1 -2
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +27 -4
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +237 -66
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +6 -5
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +68 -65
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +38 -25
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +1 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +9 -3
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +43 -39
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +7 -6
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +23 -16
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +27 -24
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +57 -146
- package/src/containerRuntime.ts +331 -158
- package/src/dataStore.ts +1 -2
- package/src/dataStoreContext.ts +3 -6
- package/src/dataStoreContexts.ts +1 -2
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +3 -5
- package/src/error.ts +18 -0
- package/src/gc/garbageCollection.ts +38 -5
- package/src/gc/gcConfigs.ts +4 -2
- package/src/gc/gcDefinitions.ts +2 -0
- package/src/gc/gcTelemetry.ts +2 -0
- package/src/id-compressor/appendOnlySortedMap.ts +25 -86
- package/src/id-compressor/finalSpace.ts +67 -0
- package/src/id-compressor/idCompressor.ts +455 -1681
- package/src/id-compressor/identifiers.ts +42 -0
- package/src/id-compressor/index.ts +11 -20
- package/src/id-compressor/persistanceUtilities.ts +58 -0
- package/src/id-compressor/sessionSpaceNormalizer.ts +83 -0
- package/src/id-compressor/sessions.ts +405 -0
- package/src/id-compressor/utilities.ts +187 -0
- package/src/index.ts +7 -1
- package/src/opLifecycle/opCompressor.ts +1 -2
- package/src/opLifecycle/opSplitter.ts +4 -4
- package/src/opLifecycle/outbox.ts +13 -10
- package/src/opLifecycle/remoteMessageProcessor.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +49 -27
- package/src/scheduleManager.ts +5 -4
- package/src/summary/index.ts +3 -1
- package/src/summary/orderedClientElection.ts +6 -4
- package/src/summary/runningSummarizer.ts +276 -95
- package/src/summary/summarizer.ts +22 -12
- package/src/summary/summarizerClientElection.ts +1 -1
- package/src/summary/summarizerTypes.ts +40 -25
- package/src/summary/summaryCollection.ts +1 -2
- package/src/summary/summaryGenerator.ts +49 -52
- package/src/summary/summaryManager.ts +33 -11
- package/dist/id-compressor/idRange.d.ts +0 -11
- package/dist/id-compressor/idRange.d.ts.map +0 -1
- package/dist/id-compressor/idRange.js +0 -29
- package/dist/id-compressor/idRange.js.map +0 -1
- package/dist/id-compressor/numericUuid.d.ts +0 -59
- package/dist/id-compressor/numericUuid.d.ts.map +0 -1
- package/dist/id-compressor/numericUuid.js +0 -325
- package/dist/id-compressor/numericUuid.js.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/dist/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.js +0 -483
- package/dist/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/dist/id-compressor/utils.d.ts +0 -57
- package/dist/id-compressor/utils.d.ts.map +0 -1
- package/dist/id-compressor/utils.js +0 -90
- package/dist/id-compressor/utils.js.map +0 -1
- package/dist/id-compressor/uuidUtilities.d.ts +0 -28
- package/dist/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/dist/id-compressor/uuidUtilities.js +0 -104
- package/dist/id-compressor/uuidUtilities.js.map +0 -1
- package/lib/id-compressor/idRange.d.ts +0 -11
- package/lib/id-compressor/idRange.d.ts.map +0 -1
- package/lib/id-compressor/idRange.js +0 -25
- package/lib/id-compressor/idRange.js.map +0 -1
- package/lib/id-compressor/numericUuid.d.ts +0 -59
- package/lib/id-compressor/numericUuid.d.ts.map +0 -1
- package/lib/id-compressor/numericUuid.js +0 -315
- package/lib/id-compressor/numericUuid.js.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/lib/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.js +0 -479
- package/lib/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/lib/id-compressor/utils.d.ts +0 -57
- package/lib/id-compressor/utils.d.ts.map +0 -1
- package/lib/id-compressor/utils.js +0 -79
- package/lib/id-compressor/utils.js.map +0 -1
- package/lib/id-compressor/uuidUtilities.d.ts +0 -28
- package/lib/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/lib/id-compressor/uuidUtilities.js +0 -96
- package/lib/id-compressor/uuidUtilities.js.map +0 -1
- package/src/id-compressor/idRange.ts +0 -35
- package/src/id-compressor/numericUuid.ts +0 -383
- package/src/id-compressor/sessionIdNormalizer.ts +0 -609
- package/src/id-compressor/utils.ts +0 -114
- package/src/id-compressor/uuidUtilities.ts +0 -120
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.setPropertyIfDefined = exports.fail = exports.compareStrings = exports.getOrCreate = exports.compareMaps = exports.compareFiniteNumbersReversed = exports.compareFiniteNumbers = exports.hasAtLeastLength = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Fails true iff `array` has at least `length` elements
|
|
10
|
-
*/
|
|
11
|
-
function hasAtLeastLength(array, length) {
|
|
12
|
-
return array.length >= length;
|
|
13
|
-
}
|
|
14
|
-
exports.hasAtLeastLength = hasAtLeastLength;
|
|
15
|
-
/**
|
|
16
|
-
* A numeric comparator used for sorting in ascending order.
|
|
17
|
-
*
|
|
18
|
-
* Handles +/-0 like Map: -0 is equal to +0.
|
|
19
|
-
*/
|
|
20
|
-
function compareFiniteNumbers(a, b) {
|
|
21
|
-
return a - b;
|
|
22
|
-
}
|
|
23
|
-
exports.compareFiniteNumbers = compareFiniteNumbers;
|
|
24
|
-
/**
|
|
25
|
-
* A numeric comparator used for sorting in descending order.
|
|
26
|
-
*
|
|
27
|
-
* Handles +/-0 like Map: -0 is equal to +0.
|
|
28
|
-
*/
|
|
29
|
-
function compareFiniteNumbersReversed(a, b) {
|
|
30
|
-
return b - a;
|
|
31
|
-
}
|
|
32
|
-
exports.compareFiniteNumbersReversed = compareFiniteNumbersReversed;
|
|
33
|
-
/**
|
|
34
|
-
* Compare two maps and return true if their contents are equivalent.
|
|
35
|
-
* @param mapA - The first array to compare
|
|
36
|
-
* @param mapB - The second array to compare
|
|
37
|
-
* @param elementComparator - The function used to check if two `T`s are equivalent.
|
|
38
|
-
* Defaults to `Object.is()` equality (a shallow compare)
|
|
39
|
-
*/
|
|
40
|
-
function compareMaps(mapA, mapB, elementComparator = Object.is) {
|
|
41
|
-
if (mapA.size !== mapB.size) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
for (const [keyA, valueA] of mapA) {
|
|
45
|
-
const valueB = mapB.get(keyA);
|
|
46
|
-
if (valueB === undefined || !elementComparator(valueA, valueB)) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
exports.compareMaps = compareMaps;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.
|
|
55
|
-
* @param map - The map to query/update
|
|
56
|
-
* @param key - The key to lookup in the map
|
|
57
|
-
* @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists
|
|
58
|
-
* @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)
|
|
59
|
-
*/
|
|
60
|
-
function getOrCreate(map, key, defaultValue) {
|
|
61
|
-
let value = map.get(key);
|
|
62
|
-
if (value === undefined) {
|
|
63
|
-
value = defaultValue(key);
|
|
64
|
-
map.set(key, value);
|
|
65
|
-
}
|
|
66
|
-
return value;
|
|
67
|
-
}
|
|
68
|
-
exports.getOrCreate = getOrCreate;
|
|
69
|
-
/**
|
|
70
|
-
* Compares strings lexically to form a strict partial ordering.
|
|
71
|
-
*/
|
|
72
|
-
function compareStrings(a, b) {
|
|
73
|
-
return a > b ? 1 : a === b ? 0 : -1;
|
|
74
|
-
}
|
|
75
|
-
exports.compareStrings = compareStrings;
|
|
76
|
-
function fail(message) {
|
|
77
|
-
throw new Error(message);
|
|
78
|
-
}
|
|
79
|
-
exports.fail = fail;
|
|
80
|
-
/**
|
|
81
|
-
* Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.
|
|
82
|
-
* This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.
|
|
83
|
-
*/
|
|
84
|
-
function setPropertyIfDefined(value, destination, property) {
|
|
85
|
-
if (value !== undefined) {
|
|
86
|
-
destination[property] = value;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.setPropertyIfDefined = setPropertyIfDefined;
|
|
90
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/id-compressor/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiBH;;GAEG;AACH,SAAgB,gBAAgB,CAC/B,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;AAC/B,CAAC;AALD,4CAKC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAmB,CAAI,EAAE,CAAI;IAChE,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAAmB,CAAI,EAAE,CAAI;IACxE,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAFD,oEAEC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAC1B,IAAuB,EACvB,IAAuB,EACvB,oBAA6C,MAAM,CAAC,EAAE;IAEtD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;QAC5B,OAAO,KAAK,CAAC;KACb;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;YAC/D,OAAO,KAAK,CAAC;SACb;KACD;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAjBD,kCAiBC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAO,GAAc,EAAE,GAAM,EAAE,YAA2B;IACpF,IAAI,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,KAAK,KAAK,SAAS,EAAE;QACxB,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpB;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAPD,kCAOC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAmB,CAAI,EAAE,CAAI;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAFD,wCAEC;AAED,SAAgB,IAAI,CAAC,OAAe;IACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,KAA0B,EAC1B,WAAiB,EACjB,QAAW;IAEX,IAAI,KAAK,KAAK,SAAS,EAAE;QACxB,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;KAC9B;AACF,CAAC;AARD,oDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Remove `readonly` from all fields.\n */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/** A union type of the first `N` positive integers */\nexport type TakeWholeNumbers<N extends number, A extends never[] = []> = N extends A[\"length\"]\n\t? never\n\t: A[\"length\"] | TakeWholeNumbers<N, [never, ...A]>;\n\n/** Returns a tuple type with exactly `Length` elements of type `T` */\nexport type ArrayOfLength<T, Length extends number, A extends T[] = []> = Length extends A[\"length\"]\n\t? A\n\t: ArrayOfLength<T, Length, [T, ...A]>;\n\n/**\n * Fails true iff `array` has at least `length` elements\n */\nexport function hasAtLeastLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len,\n): array is [...ArrayOfLength<T, Len>, ...T[]] {\n\treturn array.length >= length;\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * A numeric comparator used for sorting in descending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbersReversed<T extends number>(a: T, b: T): number {\n\treturn b - a;\n}\n\n/**\n * Compare two maps and return true if their contents are equivalent.\n * @param mapA - The first array to compare\n * @param mapB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareMaps<K, V>(\n\tmapA: ReadonlyMap<K, V>,\n\tmapB: ReadonlyMap<K, V>,\n\telementComparator: (a: V, b: V) => boolean = Object.is,\n): boolean {\n\tif (mapA.size !== mapB.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [keyA, valueA] of mapA) {\n\t\tconst valueB = mapB.get(keyA);\n\t\tif (valueB === undefined || !elementComparator(valueA, valueB)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(map: Map<K, V>, key: K, defaultValue: (key: K) => V): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\nexport function fail(message: string): never {\n\tthrow new Error(message);\n}\n\n/**\n * Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function setPropertyIfDefined<TDst, P extends keyof TDst>(\n\tvalue: TDst[P] | undefined,\n\tdestination: TDst,\n\tproperty: P,\n): void {\n\tif (value !== undefined) {\n\t\tdestination[property] = value;\n\t}\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { StableId, UuidString } from "@fluidframework/runtime-definitions";
|
|
6
|
-
/**
|
|
7
|
-
* Asserts that the given string is a UUID
|
|
8
|
-
*/
|
|
9
|
-
export declare function assertIsUuidString(uuidString: string): UuidString;
|
|
10
|
-
/**
|
|
11
|
-
* Returns true iff the given string is a valid UUID-like string of hexadecimal characters
|
|
12
|
-
* 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
|
13
|
-
*/
|
|
14
|
-
export declare function isUuidString(str: string): str is UuidString;
|
|
15
|
-
/**
|
|
16
|
-
* Generate a random stable ID
|
|
17
|
-
*/
|
|
18
|
-
export declare function generateStableId(): StableId;
|
|
19
|
-
/**
|
|
20
|
-
* Asserts that the given string is a stable ID.
|
|
21
|
-
*/
|
|
22
|
-
export declare function assertIsStableId(stableId: string): StableId;
|
|
23
|
-
/**
|
|
24
|
-
* Returns true iff the given string is a valid Version 4, variant 2 UUID
|
|
25
|
-
* 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
|
|
26
|
-
*/
|
|
27
|
-
export declare function isStableId(str: string): str is StableId;
|
|
28
|
-
//# sourceMappingURL=uuidUtilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uuidUtilities.d.ts","sourceRoot":"","sources":["../../src/id-compressor/uuidUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAoB3E;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAGjE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,UAAU,CAqB3D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,CAE3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAG3D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,QAAQ,CAuCvD"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isStableId = exports.assertIsStableId = exports.generateStableId = exports.isUuidString = exports.assertIsUuidString = void 0;
|
|
8
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
const hexadecimalCharCodes = Array.from("09afAF").map((c) => c.charCodeAt(0));
|
|
11
|
-
function isHexadecimalCharacter(charCode) {
|
|
12
|
-
return ((charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||
|
|
13
|
-
(charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||
|
|
14
|
-
(charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5]));
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Asserts that the given string is a UUID
|
|
18
|
-
*/
|
|
19
|
-
function assertIsUuidString(uuidString) {
|
|
20
|
-
(0, common_utils_1.assert)(isUuidString(uuidString), 0x4a2 /* Expected an UuidString */);
|
|
21
|
-
return uuidString;
|
|
22
|
-
}
|
|
23
|
-
exports.assertIsUuidString = assertIsUuidString;
|
|
24
|
-
/**
|
|
25
|
-
* Returns true iff the given string is a valid UUID-like string of hexadecimal characters
|
|
26
|
-
* 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
|
27
|
-
*/
|
|
28
|
-
function isUuidString(str) {
|
|
29
|
-
for (let i = 0; i < str.length; i++) {
|
|
30
|
-
switch (i) {
|
|
31
|
-
case 8:
|
|
32
|
-
case 13:
|
|
33
|
-
case 18:
|
|
34
|
-
case 23:
|
|
35
|
-
if (str.charAt(i) !== "-") {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
if (!isHexadecimalCharacter(str.charCodeAt(i))) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
exports.isUuidString = isUuidString;
|
|
49
|
-
/**
|
|
50
|
-
* Generate a random stable ID
|
|
51
|
-
*/
|
|
52
|
-
function generateStableId() {
|
|
53
|
-
return assertIsStableId((0, uuid_1.v4)());
|
|
54
|
-
}
|
|
55
|
-
exports.generateStableId = generateStableId;
|
|
56
|
-
/**
|
|
57
|
-
* Asserts that the given string is a stable ID.
|
|
58
|
-
*/
|
|
59
|
-
function assertIsStableId(stableId) {
|
|
60
|
-
(0, common_utils_1.assert)(isStableId(stableId), 0x4a3 /* Expected a StableId */);
|
|
61
|
-
return stableId;
|
|
62
|
-
}
|
|
63
|
-
exports.assertIsStableId = assertIsStableId;
|
|
64
|
-
/**
|
|
65
|
-
* Returns true iff the given string is a valid Version 4, variant 2 UUID
|
|
66
|
-
* 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
|
|
67
|
-
*/
|
|
68
|
-
function isStableId(str) {
|
|
69
|
-
if (str.length !== 36) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
for (let i = 0; i < str.length; i++) {
|
|
73
|
-
switch (i) {
|
|
74
|
-
case 8:
|
|
75
|
-
case 13:
|
|
76
|
-
case 18:
|
|
77
|
-
case 23:
|
|
78
|
-
if (str.charAt(i) !== "-") {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
break;
|
|
82
|
-
case 14:
|
|
83
|
-
if (str.charAt(i) !== "4") {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
case 19: {
|
|
88
|
-
const char = str.charAt(i);
|
|
89
|
-
if (char !== "8" && char !== "9" && char !== "a" && char !== "b") {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
default:
|
|
95
|
-
if (!isHexadecimalCharacter(str.charCodeAt(i))) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
exports.isStableId = isStableId;
|
|
104
|
-
//# sourceMappingURL=uuidUtilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uuidUtilities.js","sourceRoot":"","sources":["../../src/id-compressor/uuidUtilities.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { StableId, UuidString } from \"@fluidframework/runtime-definitions\";\nimport { v4 } from \"uuid\";\n\nconst hexadecimalCharCodes = Array.from(\"09afAF\").map((c) => c.charCodeAt(0)) as [\n\tzero: number,\n\tnine: number,\n\ta: number,\n\tf: number,\n\tA: number,\n\tF: number,\n];\n\nfunction isHexadecimalCharacter(charCode: number): boolean {\n\treturn (\n\t\t(charCode >= hexadecimalCharCodes[0] && charCode <= hexadecimalCharCodes[1]) ||\n\t\t(charCode >= hexadecimalCharCodes[2] && charCode <= hexadecimalCharCodes[3]) ||\n\t\t(charCode >= hexadecimalCharCodes[4] && charCode <= hexadecimalCharCodes[5])\n\t);\n}\n\n/**\n * Asserts that the given string is a UUID\n */\nexport function assertIsUuidString(uuidString: string): UuidString {\n\tassert(isUuidString(uuidString), 0x4a2 /* Expected an UuidString */);\n\treturn uuidString;\n}\n\n/**\n * Returns true iff the given string is a valid UUID-like string of hexadecimal characters\n * 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n */\nexport function isUuidString(str: string): str is UuidString {\n\tfor (let i = 0; i < str.length; i++) {\n\t\tswitch (i) {\n\t\t\tcase 8:\n\t\t\tcase 13:\n\t\t\tcase 18:\n\t\t\tcase 23:\n\t\t\t\tif (str.charAt(i) !== \"-\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tif (!isHexadecimalCharacter(str.charCodeAt(i))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Generate a random stable ID\n */\nexport function generateStableId(): StableId {\n\treturn assertIsStableId(v4());\n}\n\n/**\n * Asserts that the given string is a stable ID.\n */\nexport function assertIsStableId(stableId: string): StableId {\n\tassert(isStableId(stableId), 0x4a3 /* Expected a StableId */);\n\treturn stableId;\n}\n\n/**\n * Returns true iff the given string is a valid Version 4, variant 2 UUID\n * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'\n */\nexport function isStableId(str: string): str is StableId {\n\tif (str.length !== 36) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tswitch (i) {\n\t\t\tcase 8:\n\t\t\tcase 13:\n\t\t\tcase 18:\n\t\t\tcase 23:\n\t\t\t\tif (str.charAt(i) !== \"-\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 14:\n\t\t\t\tif (str.charAt(i) !== \"4\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 19: {\n\t\t\t\tconst char = str.charAt(i);\n\t\t\t\tif (char !== \"8\" && char !== \"9\" && char !== \"a\" && char !== \"b\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tif (!isHexadecimalCharacter(str.charCodeAt(i))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn true;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { IdCreationRange, UnackedLocalId } from "@fluidframework/runtime-definitions";
|
|
6
|
-
export declare function getIds(range: IdCreationRange): {
|
|
7
|
-
first: UnackedLocalId;
|
|
8
|
-
last: UnackedLocalId;
|
|
9
|
-
overrides?: IdCreationRange.Overrides;
|
|
10
|
-
} | undefined;
|
|
11
|
-
//# sourceMappingURL=idRange.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idRange.d.ts","sourceRoot":"","sources":["../../src/id-compressor/idRange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE3F,wBAAgB,MAAM,CACrB,KAAK,EAAE,eAAe,GAEpB;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAA;CAAE,GACtF,SAAS,CAsBX"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert } from "@fluidframework/common-utils";
|
|
6
|
-
export function getIds(range) {
|
|
7
|
-
const { ids } = range;
|
|
8
|
-
if (ids === undefined) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
let first = ids.first;
|
|
12
|
-
let last = ids.last;
|
|
13
|
-
const overrides = ids;
|
|
14
|
-
if (overrides.overrides !== undefined) {
|
|
15
|
-
first ?? (first = overrides.overrides[0][0]);
|
|
16
|
-
last ?? (last = overrides.overrides[overrides.overrides.length - 1][0]);
|
|
17
|
-
}
|
|
18
|
-
assert(first !== undefined && last !== undefined, 0x49b /* malformed IdCreationRange */);
|
|
19
|
-
return {
|
|
20
|
-
first,
|
|
21
|
-
last,
|
|
22
|
-
overrides: overrides.overrides,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=idRange.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idRange.js","sourceRoot":"","sources":["../../src/id-compressor/idRange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,MAAM,UAAU,MAAM,CACrB,KAAsB;IAItB,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IACtB,IAAI,GAAG,KAAK,SAAS,EAAE;QACtB,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACtB,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IAEpB,MAAM,SAAS,GAAG,GAA4C,CAAC;IAC/D,IAAI,SAAS,CAAC,SAAS,KAAK,SAAS,EAAE;QACtC,KAAK,KAAL,KAAK,GAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;QACpC,IAAI,KAAJ,IAAI,GAAK,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;KAChE;IAED,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEzF,OAAO;QACN,KAAK;QACL,IAAI;QACJ,SAAS,EAAE,SAAS,CAAC,SAAS;KAC9B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport type { IdCreationRange, UnackedLocalId } from \"@fluidframework/runtime-definitions\";\n\nexport function getIds(\n\trange: IdCreationRange,\n):\n\t| { first: UnackedLocalId; last: UnackedLocalId; overrides?: IdCreationRange.Overrides }\n\t| undefined {\n\tconst { ids } = range;\n\tif (ids === undefined) {\n\t\treturn undefined;\n\t}\n\n\tlet first = ids.first;\n\tlet last = ids.last;\n\n\tconst overrides = ids as Partial<IdCreationRange.HasOverrides>;\n\tif (overrides.overrides !== undefined) {\n\t\tfirst ??= overrides.overrides[0][0];\n\t\tlast ??= overrides.overrides[overrides.overrides.length - 1][0];\n\t}\n\n\tassert(first !== undefined && last !== undefined, 0x49b /* malformed IdCreationRange */);\n\n\treturn {\n\t\tfirst,\n\t\tlast,\n\t\toverrides: overrides.overrides,\n\t};\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { SessionId, StableId } from "@fluidframework/runtime-definitions";
|
|
6
|
-
/**
|
|
7
|
-
* A UUID (128 bit identifier) optimized for use as a 128 bit unsigned integer with fast addition and toString operations.
|
|
8
|
-
* The string entry is the upper 76 bits of the uuid and the integer entry holds the lower 52 bits:
|
|
9
|
-
*
|
|
10
|
-
* ```
|
|
11
|
-
* UUUUUUUU-UUUU-VUUU-vUUU-UUUUUUUUUUUU - the uuid
|
|
12
|
-
* SSSSSSSS-SSSS-SSSS-SSS - array[0]: string
|
|
13
|
-
* N NNNNNNNNNNNN - array[1]: integer
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* The integer keeps the common case cost of incrementing and computing deltas very low.
|
|
17
|
-
* The string optimizes toString by caching the the majority of the resulting string.
|
|
18
|
-
*/
|
|
19
|
-
export declare type NumericUuid = readonly [string, number] & {
|
|
20
|
-
readonly NumericUuid: "9132ea20-a811-4756-85f8-aa6da5ca90f8";
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Calculates the numeric delta between a and b (i.e. a - b).
|
|
24
|
-
* @param a - an uuid
|
|
25
|
-
* @param b - an other uuid
|
|
26
|
-
* @param maxDelta - the maximum integer delta (inclusive) to tolerate.
|
|
27
|
-
* @returns undefined if the delta is negative or greater than `maxDelta`
|
|
28
|
-
*/
|
|
29
|
-
export declare function getPositiveDelta(a: NumericUuid, b: NumericUuid, maxDelta: number): number | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* @param offset - an optional offset to increment the returned StableId
|
|
32
|
-
* @returns the string representation of a `NumericUuid`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function stableIdFromNumericUuid(uuid: NumericUuid, offset?: number): StableId;
|
|
35
|
-
/**
|
|
36
|
-
* @param stableId - a minimal uuid string
|
|
37
|
-
* @returns a numeric representation of `stableId`.
|
|
38
|
-
*/
|
|
39
|
-
export declare function numericUuidFromStableId(stableId: StableId): NumericUuid;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a session base ID.
|
|
42
|
-
* This method (rather than standard uuid generation methods) should be used to generate session IDs.
|
|
43
|
-
*/
|
|
44
|
-
export declare function createSessionId(): SessionId;
|
|
45
|
-
/**
|
|
46
|
-
* Compares numeric uuids for equality.
|
|
47
|
-
*/
|
|
48
|
-
export declare function numericUuidEquals(a: NumericUuid, b: NumericUuid): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Increments the uuid. `amount` must be a positive integer.
|
|
51
|
-
* @returns the result of incrementing the uuid by `amount`.
|
|
52
|
-
*/
|
|
53
|
-
export declare function incrementUuid(uuid: NumericUuid, amount: number): NumericUuid;
|
|
54
|
-
/**
|
|
55
|
-
* Any session uuid with all of its highish bits set is in danger of overflowing after fewer than 2^53 increments.
|
|
56
|
-
* By zeroing one of those bits at random, potential overflow is prevented.
|
|
57
|
-
*/
|
|
58
|
-
export declare function ensureSessionUuid(uuid: StableId): SessionId;
|
|
59
|
-
//# sourceMappingURL=numericUuid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numericUuid.d.ts","sourceRoot":"","sources":["../../src/id-compressor/numericUuid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAI1E;;;;;;;;;;;;GAYG;AACH,oBAAY,WAAW,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACrD,QAAQ,CAAC,WAAW,EAAE,sCAAsC,CAAC;CAC7D,CAAC;AAQF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,EACd,QAAQ,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAgDpB;AAaD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,SAAI,GAAG,QAAQ,CAW/E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAKvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAE3C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAEzE;AAQD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAoD5E;AAiJD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAoB3D"}
|