@fluidframework/sequence 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.2.0.0.245554
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/{.eslintrc.js → .eslintrc.cjs} +4 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor.json +1 -1
- package/api-report/sequence.api.md +15 -27
- package/dist/{localValues.d.ts → IntervalCollectionValues.d.ts} +13 -12
- package/dist/IntervalCollectionValues.d.ts.map +1 -0
- package/dist/{localValues.js → IntervalCollectionValues.js} +4 -4
- package/dist/IntervalCollectionValues.js.map +1 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +28 -22
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +59 -110
- package/dist/intervalCollection.js.map +1 -1
- package/dist/{defaultMap.d.ts → intervalCollectionMap.d.ts} +18 -57
- package/dist/intervalCollectionMap.d.ts.map +1 -0
- package/dist/{defaultMap.js → intervalCollectionMap.js} +77 -129
- package/dist/intervalCollectionMap.js.map +1 -0
- package/{lib/defaultMapInterfaces.d.mts → dist/intervalCollectionMapInterfaces.d.ts} +16 -22
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -0
- package/dist/{defaultMapInterfaces.js → intervalCollectionMapInterfaces.js} +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -0
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +3 -3
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js +8 -8
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +3 -3
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js +4 -4
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.d.ts +2 -2
- package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.js +2 -2
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/index.d.ts +8 -8
- package/dist/intervalIndex/index.d.ts.map +1 -1
- package/dist/intervalIndex/index.js +16 -16
- package/dist/intervalIndex/index.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +7 -10
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js +12 -13
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +7 -7
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -2
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +3 -3
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +8 -8
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervalTree.d.ts +1 -1
- package/dist/intervalTree.d.ts.map +1 -1
- package/dist/intervalTree.js.map +1 -1
- package/dist/intervals/index.d.ts +3 -3
- package/dist/intervals/index.d.ts.map +1 -1
- package/dist/intervals/index.js +16 -16
- package/dist/intervals/index.js.map +1 -1
- package/dist/intervals/interval.d.ts +2 -2
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +2 -2
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +3 -3
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +1 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +2 -2
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +22 -23
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.d.ts +12 -12
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +26 -26
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence-alpha.d.ts +172 -13
- package/dist/sequence-beta.d.ts +2 -0
- package/dist/sequence-public.d.ts +2 -0
- package/dist/sequence-untrimmed.d.ts +73 -14
- package/dist/sequence.d.ts +48 -5
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +103 -29
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceFactory.d.ts +4 -1
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +8 -5
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +2 -2
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +5 -5
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +1 -1
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js +2 -2
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +2 -2
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +6 -6
- package/dist/sharedString.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/{localValues.d.mts → IntervalCollectionValues.d.ts} +13 -12
- package/lib/IntervalCollectionValues.d.ts.map +1 -0
- package/lib/{localValues.mjs → IntervalCollectionValues.js} +2 -2
- package/lib/IntervalCollectionValues.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +24 -12
- package/lib/index.d.ts.map +1 -0
- package/lib/{index.mjs → index.js} +11 -11
- package/lib/index.js.map +1 -0
- package/lib/{intervalCollection.d.mts → intervalCollection.d.ts} +29 -23
- package/lib/intervalCollection.d.ts.map +1 -0
- package/lib/{intervalCollection.mjs → intervalCollection.js} +23 -74
- package/lib/intervalCollection.js.map +1 -0
- package/lib/{defaultMap.d.mts → intervalCollectionMap.d.ts} +18 -57
- package/lib/intervalCollectionMap.d.ts.map +1 -0
- package/lib/{defaultMap.mjs → intervalCollectionMap.js} +75 -127
- package/lib/intervalCollectionMap.js.map +1 -0
- package/{dist/defaultMapInterfaces.d.ts → lib/intervalCollectionMapInterfaces.d.ts} +16 -22
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -0
- package/lib/{intervalIndex/sequenceIntervalIndexes.mjs → intervalCollectionMapInterfaces.js} +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -0
- package/lib/intervalIndex/{endpointInRangeIndex.d.mts → endpointInRangeIndex.d.ts} +4 -4
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{endpointInRangeIndex.mjs → endpointInRangeIndex.js} +3 -3
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -0
- package/lib/intervalIndex/{endpointIndex.d.mts → endpointIndex.d.ts} +4 -4
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{endpointIndex.mjs → endpointIndex.js} +2 -2
- package/lib/intervalIndex/endpointIndex.js.map +1 -0
- package/lib/intervalIndex/{idIntervalIndex.d.mts → idIntervalIndex.d.ts} +3 -3
- package/lib/intervalIndex/idIntervalIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{idIntervalIndex.mjs → idIntervalIndex.js} +2 -2
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -0
- package/lib/intervalIndex/{index.d.mts → index.d.ts} +9 -9
- package/lib/intervalIndex/index.d.ts.map +1 -0
- package/lib/intervalIndex/{index.mjs → index.js} +7 -7
- package/lib/intervalIndex/index.js.map +1 -0
- package/lib/intervalIndex/{intervalIndex.d.mts → intervalIndex.d.ts} +2 -2
- package/lib/intervalIndex/intervalIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{intervalIndex.mjs → intervalIndex.js} +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -0
- package/lib/intervalIndex/{intervalIndexUtils.d.mts → intervalIndexUtils.d.ts} +1 -1
- package/lib/intervalIndex/intervalIndexUtils.d.ts.map +1 -0
- package/lib/intervalIndex/{intervalIndexUtils.mjs → intervalIndexUtils.js} +1 -1
- package/lib/intervalIndex/intervalIndexUtils.js.map +1 -0
- package/lib/intervalIndex/{overlappingIntervalsIndex.d.mts → overlappingIntervalsIndex.d.ts} +8 -11
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{overlappingIntervalsIndex.mjs → overlappingIntervalsIndex.js} +8 -9
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -0
- package/lib/intervalIndex/{overlappingSequenceIntervalsIndex.d.mts → overlappingSequenceIntervalsIndex.d.ts} +3 -3
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{overlappingSequenceIntervalsIndex.mjs → overlappingSequenceIntervalsIndex.js} +3 -3
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -0
- package/lib/intervalIndex/{sequenceIntervalIndexes.d.mts → sequenceIntervalIndexes.d.ts} +3 -3
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -0
- package/lib/{defaultMapInterfaces.mjs → intervalIndex/sequenceIntervalIndexes.js} +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -0
- package/lib/intervalIndex/{startpointInRangeIndex.d.mts → startpointInRangeIndex.d.ts} +4 -4
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -0
- package/lib/intervalIndex/{startpointInRangeIndex.mjs → startpointInRangeIndex.js} +3 -3
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -0
- package/lib/{intervalTree.d.mts → intervalTree.d.ts} +2 -2
- package/lib/intervalTree.d.ts.map +1 -0
- package/lib/{intervalTree.mjs → intervalTree.js} +1 -1
- package/lib/intervalTree.js.map +1 -0
- package/lib/intervals/{index.d.mts → index.d.ts} +4 -4
- package/lib/intervals/index.d.ts.map +1 -0
- package/lib/intervals/{index.mjs → index.js} +4 -4
- package/lib/intervals/index.js.map +1 -0
- package/lib/intervals/{interval.d.mts → interval.d.ts} +3 -3
- package/lib/intervals/{interval.d.mts.map → interval.d.ts.map} +1 -1
- package/lib/intervals/{interval.mjs → interval.js} +2 -2
- package/lib/intervals/interval.js.map +1 -0
- package/lib/intervals/{intervalUtils.d.mts → intervalUtils.d.ts} +4 -4
- package/lib/intervals/intervalUtils.d.ts.map +1 -0
- package/lib/intervals/{intervalUtils.mjs → intervalUtils.js} +3 -2
- package/lib/intervals/intervalUtils.js.map +1 -0
- package/lib/intervals/{sequenceInterval.d.mts → sequenceInterval.d.ts} +3 -3
- package/lib/intervals/sequenceInterval.d.ts.map +1 -0
- package/lib/intervals/{sequenceInterval.mjs → sequenceInterval.js} +5 -4
- package/lib/intervals/{sequenceInterval.mjs.map → sequenceInterval.js.map} +1 -1
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{revertibles.d.mts → revertibles.d.ts} +13 -13
- package/lib/revertibles.d.ts.map +1 -0
- package/lib/{revertibles.mjs → revertibles.js} +11 -10
- package/lib/revertibles.js.map +1 -0
- package/lib/{sequence-alpha.d.mts → sequence-alpha.d.ts} +185 -13
- package/lib/{sequence-beta.d.mts → sequence-beta.d.ts} +15 -0
- package/lib/{sequence-public.d.mts → sequence-public.d.ts} +15 -0
- package/lib/{sequence-untrimmed.d.mts → sequence-untrimmed.d.ts} +86 -14
- package/lib/{sequence.d.mts → sequence.d.ts} +49 -6
- package/lib/sequence.d.ts.map +1 -0
- package/lib/{sequence.mjs → sequence.js} +100 -29
- package/lib/sequence.js.map +1 -0
- package/lib/{sequenceDeltaEvent.d.mts → sequenceDeltaEvent.d.ts} +1 -1
- package/lib/sequenceDeltaEvent.d.ts.map +1 -0
- package/lib/{sequenceDeltaEvent.mjs → sequenceDeltaEvent.js} +1 -1
- package/lib/sequenceDeltaEvent.js.map +1 -0
- package/lib/{sequenceFactory.d.mts → sequenceFactory.d.ts} +5 -2
- package/lib/sequenceFactory.d.ts.map +1 -0
- package/lib/{sequenceFactory.mjs → sequenceFactory.js} +6 -3
- package/lib/sequenceFactory.js.map +1 -0
- package/lib/{sharedIntervalCollection.d.mts → sharedIntervalCollection.d.ts} +3 -3
- package/lib/sharedIntervalCollection.d.ts.map +1 -0
- package/lib/{sharedIntervalCollection.mjs → sharedIntervalCollection.js} +5 -5
- package/lib/sharedIntervalCollection.js.map +1 -0
- package/lib/{sharedSequence.d.mts → sharedSequence.d.ts} +2 -2
- package/lib/sharedSequence.d.ts.map +1 -0
- package/lib/{sharedSequence.mjs → sharedSequence.js} +2 -2
- package/lib/sharedSequence.js.map +1 -0
- package/lib/{sharedString.d.mts → sharedString.d.ts} +3 -3
- package/lib/sharedString.d.ts.map +1 -0
- package/lib/{sharedString.mjs → sharedString.js} +3 -3
- package/lib/sharedString.js.map +1 -0
- package/lib/test/collections.intervalTree.js +73 -0
- package/lib/test/collections.intervalTree.js.map +1 -0
- package/lib/test/createSnapshotFiles.js +15 -0
- package/lib/test/createSnapshotFiles.js.map +1 -0
- package/lib/test/dirname.cjs +16 -0
- package/lib/test/dirname.cjs.map +1 -0
- package/lib/test/endpointInRangeIndex.spec.js +182 -0
- package/lib/test/endpointInRangeIndex.spec.js.map +1 -0
- package/lib/test/fuzz/fuzzUtils.js +362 -0
- package/lib/test/fuzz/fuzzUtils.js.map +1 -0
- package/lib/test/fuzz/intervalCollection.fuzz.spec.js +87 -0
- package/lib/test/fuzz/intervalCollection.fuzz.spec.js.map +1 -0
- package/lib/test/fuzz/intervalRevertibles.fuzz.spec.js +128 -0
- package/lib/test/fuzz/intervalRevertibles.fuzz.spec.js.map +1 -0
- package/lib/test/fuzz/sharedString.fuzz.spec.js +91 -0
- package/lib/test/fuzz/sharedString.fuzz.spec.js.map +1 -0
- package/lib/test/generateSharedStrings.js +138 -0
- package/lib/test/generateSharedStrings.js.map +1 -0
- package/lib/test/intervalCollection.detached.spec.js +126 -0
- package/lib/test/intervalCollection.detached.spec.js.map +1 -0
- package/lib/test/intervalCollection.events.spec.js +491 -0
- package/lib/test/intervalCollection.events.spec.js.map +1 -0
- package/lib/test/intervalCollection.perf.spec.js +88 -0
- package/lib/test/intervalCollection.perf.spec.js.map +1 -0
- package/lib/test/intervalCollection.snapshot.spec.js +171 -0
- package/lib/test/intervalCollection.snapshot.spec.js.map +1 -0
- package/lib/test/intervalCollection.spec.js +1660 -0
- package/lib/test/intervalCollection.spec.js.map +1 -0
- package/lib/test/intervalIndexTestUtils.js +49 -0
- package/lib/test/intervalIndexTestUtils.js.map +1 -0
- package/lib/test/intervalRebasing.spec.js +589 -0
- package/lib/test/intervalRebasing.spec.js.map +1 -0
- package/lib/test/intervalStashedOps.spec.js +142 -0
- package/lib/test/intervalStashedOps.spec.js.map +1 -0
- package/lib/test/intervalTestUtils.js +81 -0
- package/lib/test/intervalTestUtils.js.map +1 -0
- package/lib/test/marshalling.spec.js +55 -0
- package/lib/test/marshalling.spec.js.map +1 -0
- package/lib/test/memory/sharedSequence.spec.js +82 -0
- package/lib/test/memory/sharedSequence.spec.js.map +1 -0
- package/lib/test/memory/sharedString.spec.js +134 -0
- package/lib/test/memory/sharedString.spec.js.map +1 -0
- package/lib/test/overlappingSequenceIntervalsIndex.spec.js +348 -0
- package/lib/test/overlappingSequenceIntervalsIndex.spec.js.map +1 -0
- package/lib/test/partialLoad.spec.js +211 -0
- package/lib/test/partialLoad.spec.js.map +1 -0
- package/lib/test/rebasing.spec.js +81 -0
- package/lib/test/rebasing.spec.js.map +1 -0
- package/lib/test/reentrancy.spec.js +174 -0
- package/lib/test/reentrancy.spec.js.map +1 -0
- package/lib/test/revertibles.spec.js +971 -0
- package/lib/test/revertibles.spec.js.map +1 -0
- package/lib/test/sequenceDeltaEvent.spec.js +2144 -0
- package/lib/test/sequenceDeltaEvent.spec.js.map +1 -0
- package/lib/test/sharedIntervalCollection.spec.js +159 -0
- package/lib/test/sharedIntervalCollection.spec.js.map +1 -0
- package/lib/test/sharedString.spec.js +532 -0
- package/lib/test/sharedString.spec.js.map +1 -0
- package/lib/test/snapshotEmptyProps.spec.js +45 -0
- package/lib/test/snapshotEmptyProps.spec.js.map +1 -0
- package/lib/test/snapshotVersion.spec.js +149 -0
- package/lib/test/snapshotVersion.spec.js.map +1 -0
- package/lib/test/startpointInRangeIndex.spec.js +182 -0
- package/lib/test/startpointInRangeIndex.spec.js.map +1 -0
- package/lib/test/subSequence.spec.js +92 -0
- package/lib/test/subSequence.spec.js.map +1 -0
- package/lib/test/types/validateSequencePrevious.generated.js +162 -0
- package/lib/test/types/validateSequencePrevious.generated.js.map +1 -0
- package/lib/test/v1IntervalCollectionHelpers.js +93 -0
- package/lib/test/v1IntervalCollectionHelpers.js.map +1 -0
- package/package.json +66 -60
- package/src/{localValues.ts → IntervalCollectionValues.ts} +23 -17
- package/src/index.ts +15 -11
- package/src/intervalCollection.ts +73 -106
- package/src/{defaultMap.ts → intervalCollectionMap.ts} +120 -211
- package/src/{defaultMapInterfaces.ts → intervalCollectionMapInterfaces.ts} +24 -23
- package/src/intervalIndex/endpointInRangeIndex.ts +4 -4
- package/src/intervalIndex/endpointIndex.ts +3 -3
- package/src/intervalIndex/idIntervalIndex.ts +3 -4
- package/src/intervalIndex/index.ts +8 -8
- package/src/intervalIndex/intervalIndex.ts +1 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +10 -11
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +4 -4
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -2
- package/src/intervalIndex/startpointInRangeIndex.ts +4 -4
- package/src/intervalTree.ts +1 -1
- package/src/intervals/index.ts +3 -3
- package/src/intervals/interval.ts +2 -4
- package/src/intervals/intervalUtils.ts +3 -3
- package/src/intervals/sequenceInterval.ts +3 -4
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +13 -13
- package/src/sequence.ts +128 -50
- package/src/sequenceFactory.ts +5 -2
- package/src/sharedIntervalCollection.ts +7 -11
- package/src/sharedSequence.ts +1 -1
- package/src/sharedString.ts +2 -2
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/dist/defaultMap.d.ts.map +0 -1
- package/dist/defaultMap.js.map +0 -1
- package/dist/defaultMapInterfaces.d.ts.map +0 -1
- package/dist/defaultMapInterfaces.js.map +0 -1
- package/dist/localValues.d.ts.map +0 -1
- package/dist/localValues.js.map +0 -1
- package/lib/defaultMap.d.mts.map +0 -1
- package/lib/defaultMap.mjs.map +0 -1
- package/lib/defaultMapInterfaces.d.mts.map +0 -1
- package/lib/defaultMapInterfaces.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/lib/intervalCollection.d.mts.map +0 -1
- package/lib/intervalCollection.mjs.map +0 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.mts.map +0 -1
- package/lib/intervalIndex/endpointInRangeIndex.mjs.map +0 -1
- package/lib/intervalIndex/endpointIndex.d.mts.map +0 -1
- package/lib/intervalIndex/endpointIndex.mjs.map +0 -1
- package/lib/intervalIndex/idIntervalIndex.d.mts.map +0 -1
- package/lib/intervalIndex/idIntervalIndex.mjs.map +0 -1
- package/lib/intervalIndex/index.d.mts.map +0 -1
- package/lib/intervalIndex/index.mjs.map +0 -1
- package/lib/intervalIndex/intervalIndex.d.mts.map +0 -1
- package/lib/intervalIndex/intervalIndex.mjs.map +0 -1
- package/lib/intervalIndex/intervalIndexUtils.d.mts.map +0 -1
- package/lib/intervalIndex/intervalIndexUtils.mjs.map +0 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.mts.map +0 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.mjs.map +0 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.mts.map +0 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.mjs.map +0 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.mts.map +0 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.mjs.map +0 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.mts.map +0 -1
- package/lib/intervalIndex/startpointInRangeIndex.mjs.map +0 -1
- package/lib/intervalTree.d.mts.map +0 -1
- package/lib/intervalTree.mjs.map +0 -1
- package/lib/intervals/index.d.mts.map +0 -1
- package/lib/intervals/index.mjs.map +0 -1
- package/lib/intervals/interval.mjs.map +0 -1
- package/lib/intervals/intervalUtils.d.mts.map +0 -1
- package/lib/intervals/intervalUtils.mjs.map +0 -1
- package/lib/intervals/sequenceInterval.d.mts.map +0 -1
- package/lib/localValues.d.mts.map +0 -1
- package/lib/localValues.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/revertibles.d.mts.map +0 -1
- package/lib/revertibles.mjs.map +0 -1
- package/lib/sequence.d.mts.map +0 -1
- package/lib/sequence.mjs.map +0 -1
- package/lib/sequenceDeltaEvent.d.mts.map +0 -1
- package/lib/sequenceDeltaEvent.mjs.map +0 -1
- package/lib/sequenceFactory.d.mts.map +0 -1
- package/lib/sequenceFactory.mjs.map +0 -1
- package/lib/sharedIntervalCollection.d.mts.map +0 -1
- package/lib/sharedIntervalCollection.mjs.map +0 -1
- package/lib/sharedSequence.d.mts.map +0 -1
- package/lib/sharedSequence.mjs.map +0 -1
- package/lib/sharedString.d.mts.map +0 -1
- package/lib/sharedString.mjs.map +0 -1
|
@@ -6,11 +6,13 @@ import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { IFluidSerializer } from "@fluidframework/shared-object-base";
|
|
8
8
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
9
|
-
import {
|
|
9
|
+
import { ISerializableIntervalCollection, IIntervalCollectionType, ISharedDefaultMapEvents, IMapMessageLocalMetadata, SequenceOptions, IIntervalCollectionTypeOperationValue } from "./intervalCollectionMapInterfaces.js";
|
|
10
|
+
import { type ISerializableInterval } from "./intervals/index.js";
|
|
11
|
+
import { type IntervalCollection } from "./intervalCollection.js";
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
13
|
+
* Description of a map delta operation
|
|
12
14
|
*/
|
|
13
|
-
export interface
|
|
15
|
+
export interface IMapOperation {
|
|
14
16
|
/**
|
|
15
17
|
* String identifier of the operation type.
|
|
16
18
|
*/
|
|
@@ -21,23 +23,15 @@ export interface IMapValueTypeOperation {
|
|
|
21
23
|
key: string;
|
|
22
24
|
/**
|
|
23
25
|
* Value of the operation, specific to the value type.
|
|
24
|
-
* @alpha
|
|
25
26
|
*/
|
|
26
|
-
value:
|
|
27
|
+
value: IIntervalCollectionTypeOperationValue;
|
|
27
28
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Description of a map delta operation
|
|
30
|
-
*/
|
|
31
|
-
export type IMapOperation = IMapValueTypeOperation;
|
|
32
29
|
/**
|
|
33
30
|
* Defines the in-memory object structure to be used for the conversion to/from serialized.
|
|
34
31
|
* Directly used in JSON.stringify, direct result from JSON.parse
|
|
35
32
|
*/
|
|
36
33
|
export interface IMapDataObjectSerializable {
|
|
37
|
-
[key: string]:
|
|
38
|
-
}
|
|
39
|
-
export interface IMapDataObjectSerialized {
|
|
40
|
-
[key: string]: ISerializedValue;
|
|
34
|
+
[key: string]: ISerializableIntervalCollection;
|
|
41
35
|
}
|
|
42
36
|
/**
|
|
43
37
|
* A DefaultMap is a map-like distributed data structure, supporting operations on values stored by
|
|
@@ -46,7 +40,7 @@ export interface IMapDataObjectSerialized {
|
|
|
46
40
|
* Creation of values is implicit on access (either via `get` or a remote op application referring to
|
|
47
41
|
* a collection that wasn't previously known)
|
|
48
42
|
*/
|
|
49
|
-
export declare class
|
|
43
|
+
export declare class IntervalCollectionMap<T extends ISerializableInterval> {
|
|
50
44
|
private readonly serializer;
|
|
51
45
|
private readonly handle;
|
|
52
46
|
private readonly submitMessage;
|
|
@@ -60,7 +54,7 @@ export declare class DefaultMap<T> {
|
|
|
60
54
|
/**
|
|
61
55
|
* Mapping of op types to message handlers.
|
|
62
56
|
*/
|
|
63
|
-
private readonly
|
|
57
|
+
private readonly messageHandler;
|
|
64
58
|
/**
|
|
65
59
|
* The in-memory data the map is storing.
|
|
66
60
|
*/
|
|
@@ -73,56 +67,29 @@ export declare class DefaultMap<T> {
|
|
|
73
67
|
* @param type - The value type to create at values of this map
|
|
74
68
|
* @param eventEmitter - The object that will emit map events
|
|
75
69
|
*/
|
|
76
|
-
constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op:
|
|
70
|
+
constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => void, type: IIntervalCollectionType<T>, options?: Partial<SequenceOptions> | undefined, eventEmitter?: TypedEventEmitter<ISharedDefaultMapEvents>);
|
|
77
71
|
/**
|
|
78
72
|
* Get an iterator over the keys in this map.
|
|
79
73
|
* @returns The iterator
|
|
80
74
|
*/
|
|
81
75
|
keys(): IterableIterator<string>;
|
|
82
|
-
/**
|
|
83
|
-
* Get an iterator over the entries in this map.
|
|
84
|
-
* @returns The iterator
|
|
85
|
-
*/
|
|
86
|
-
entries(): IterableIterator<[string, any]>;
|
|
87
76
|
/**
|
|
88
77
|
* Get an iterator over the values in this map.
|
|
89
78
|
* @returns The iterator
|
|
90
79
|
*/
|
|
91
80
|
values(): IterableIterator<any>;
|
|
92
|
-
/**
|
|
93
|
-
* Get an iterator over the entries in this map.
|
|
94
|
-
* @returns The iterator
|
|
95
|
-
*/
|
|
96
|
-
[Symbol.iterator](): IterableIterator<[string, any]>;
|
|
97
|
-
/**
|
|
98
|
-
* Executes the given callback on each entry in the map.
|
|
99
|
-
* @param callbackFn - Callback function
|
|
100
|
-
*/
|
|
101
|
-
forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
|
|
102
81
|
/**
|
|
103
82
|
* {@inheritDoc ISharedMap.get}
|
|
104
83
|
*/
|
|
105
|
-
get(key: string): T
|
|
106
|
-
/**
|
|
107
|
-
* Check if a key exists in the map.
|
|
108
|
-
* @param key - The key to check
|
|
109
|
-
* @returns True if the key exists, false otherwise
|
|
110
|
-
*/
|
|
111
|
-
has(key: string): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Serializes the data stored in the shared map to a JSON string
|
|
114
|
-
* @param serializer - The serializer to use to serialize handles in its values.
|
|
115
|
-
* @returns A JSON string containing serialized map data
|
|
116
|
-
*/
|
|
117
|
-
getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized;
|
|
84
|
+
get(key: string): IntervalCollection<T>;
|
|
118
85
|
getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable;
|
|
119
86
|
serialize(serializer: IFluidSerializer): string;
|
|
120
87
|
/**
|
|
121
88
|
* Populate the kernel with the given map data.
|
|
122
|
-
*
|
|
89
|
+
*
|
|
90
|
+
* @param serialized - A JSON string containing serialized map data
|
|
123
91
|
*/
|
|
124
|
-
|
|
125
|
-
populate(json: string): void;
|
|
92
|
+
populate(serialized: string): void;
|
|
126
93
|
/**
|
|
127
94
|
* Submit the given op if a handler is registered.
|
|
128
95
|
* @param op - The operation to attempt to submit
|
|
@@ -131,8 +98,8 @@ export declare class DefaultMap<T> {
|
|
|
131
98
|
* also sent if we are asked to resubmit the message.
|
|
132
99
|
* @returns True if the operation was submitted, false otherwise.
|
|
133
100
|
*/
|
|
134
|
-
tryResubmitMessage(op:
|
|
135
|
-
|
|
101
|
+
tryResubmitMessage(op: unknown, localOpMetadata: IMapMessageLocalMetadata): boolean;
|
|
102
|
+
tryApplyStashedOp(op: unknown): boolean;
|
|
136
103
|
/**
|
|
137
104
|
* Process the given op if a handler is registered.
|
|
138
105
|
* @param message - The message to process
|
|
@@ -141,7 +108,7 @@ export declare class DefaultMap<T> {
|
|
|
141
108
|
* For messages from a remote client, this will be undefined.
|
|
142
109
|
* @returns True if the operation was processed, false otherwise.
|
|
143
110
|
*/
|
|
144
|
-
tryProcessMessage(op:
|
|
111
|
+
tryProcessMessage(op: unknown, local: boolean, message: ISequencedDocumentMessage, localOpMetadata: unknown): boolean;
|
|
145
112
|
/**
|
|
146
113
|
* Initializes a default ValueType at the provided key.
|
|
147
114
|
* Should be used when a map operation incurs creation.
|
|
@@ -160,17 +127,11 @@ export declare class DefaultMap<T> {
|
|
|
160
127
|
* @returns The local value that was produced
|
|
161
128
|
*/
|
|
162
129
|
private makeLocal;
|
|
163
|
-
/**
|
|
164
|
-
* Get the message handlers for the map.
|
|
165
|
-
* @returns A map of string op names to IMapMessageHandlers for those ops
|
|
166
|
-
*/
|
|
167
|
-
private getMessageHandlers;
|
|
168
130
|
/**
|
|
169
131
|
* Create an emitter for a value type to emit ops from the given key.
|
|
170
|
-
* @alpha
|
|
171
132
|
* @param key - The key of the map that the value type will be stored on
|
|
172
133
|
* @returns A value op emitter for the given key
|
|
173
134
|
*/
|
|
174
135
|
private makeMapValueOpEmitter;
|
|
175
136
|
}
|
|
176
|
-
//# sourceMappingURL=
|
|
137
|
+
//# sourceMappingURL=intervalCollectionMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervalCollectionMap.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAa,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EACN,+BAA+B,EAI/B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EACf,qCAAqC,EACrC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGN,KAAK,qBAAqB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,yBAAyB,CAAC;AAMjC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,qCAAqC,CAAC;CAC7C;AACD;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,+BAA+B,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,qBAAa,qBAAqB,CAAC,CAAC,SAAS,qBAAqB;IAyDhE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAI9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;aACT,YAAY;IAhE7B;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,C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
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.IntervalCollectionMap = void 0;
|
|
8
8
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
9
9
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
10
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
11
|
-
const
|
|
11
|
+
const IntervalCollectionValues_js_1 = require("./IntervalCollectionValues.js");
|
|
12
|
+
const intervalCollection_js_1 = require("./intervalCollection.js");
|
|
12
13
|
function isMapOperation(op) {
|
|
13
14
|
return typeof op === "object" && op !== null && "type" in op && op.type === "act";
|
|
14
15
|
}
|
|
@@ -19,7 +20,7 @@ function isMapOperation(op) {
|
|
|
19
20
|
* Creation of values is implicit on access (either via `get` or a remote op application referring to
|
|
20
21
|
* a collection that wasn't previously known)
|
|
21
22
|
*/
|
|
22
|
-
class
|
|
23
|
+
class IntervalCollectionMap {
|
|
23
24
|
/**
|
|
24
25
|
* The number of key/value pairs stored in the map.
|
|
25
26
|
*/
|
|
@@ -44,12 +45,34 @@ class DefaultMap {
|
|
|
44
45
|
/**
|
|
45
46
|
* Mapping of op types to message handlers.
|
|
46
47
|
*/
|
|
47
|
-
this.
|
|
48
|
+
this.messageHandler = {
|
|
49
|
+
process: (op, local, message, localOpMetadata) => {
|
|
50
|
+
const localValue = this.data.get(op.key) ?? this.createCore(op.key, local);
|
|
51
|
+
const handler = localValue.getOpHandler(op.value.opName);
|
|
52
|
+
const previousValue = localValue.value;
|
|
53
|
+
const translatedValue = op.value.value;
|
|
54
|
+
handler.process(previousValue, translatedValue, local, message, localOpMetadata);
|
|
55
|
+
const event = { key: op.key, previousValue };
|
|
56
|
+
this.eventEmitter.emit("valueChanged", event, local, message, this.eventEmitter);
|
|
57
|
+
},
|
|
58
|
+
submit: (op, localOpMetadata) => {
|
|
59
|
+
this.submitMessage(op, localOpMetadata);
|
|
60
|
+
},
|
|
61
|
+
resubmit: (op, localOpMetadata) => {
|
|
62
|
+
const localValue = this.data.get(op.key);
|
|
63
|
+
(0, core_utils_1.assert)(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);
|
|
64
|
+
const handler = localValue.getOpHandler(op.value.opName);
|
|
65
|
+
const rebased = handler.rebase(localValue.value, op.value, localOpMetadata);
|
|
66
|
+
if (rebased !== undefined) {
|
|
67
|
+
const { rebasedOp, rebasedLocalOpMetadata } = rebased;
|
|
68
|
+
this.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
48
72
|
/**
|
|
49
73
|
* The in-memory data the map is storing.
|
|
50
74
|
*/
|
|
51
75
|
this.data = new Map();
|
|
52
|
-
this.messageHandlers = this.getMessageHandlers();
|
|
53
76
|
}
|
|
54
77
|
/**
|
|
55
78
|
* Get an iterator over the keys in this map.
|
|
@@ -58,25 +81,6 @@ class DefaultMap {
|
|
|
58
81
|
keys() {
|
|
59
82
|
return this.data.keys();
|
|
60
83
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Get an iterator over the entries in this map.
|
|
63
|
-
* @returns The iterator
|
|
64
|
-
*/
|
|
65
|
-
entries() {
|
|
66
|
-
const localEntriesIterator = this.data.entries();
|
|
67
|
-
const iterator = {
|
|
68
|
-
next() {
|
|
69
|
-
const nextVal = localEntriesIterator.next();
|
|
70
|
-
return nextVal.done
|
|
71
|
-
? { value: undefined, done: true }
|
|
72
|
-
: { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value
|
|
73
|
-
},
|
|
74
|
-
[Symbol.iterator]() {
|
|
75
|
-
return this;
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
return iterator;
|
|
79
|
-
}
|
|
80
84
|
/**
|
|
81
85
|
* Get an iterator over the values in this map.
|
|
82
86
|
* @returns The iterator
|
|
@@ -96,22 +100,6 @@ class DefaultMap {
|
|
|
96
100
|
};
|
|
97
101
|
return iterator;
|
|
98
102
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Get an iterator over the entries in this map.
|
|
101
|
-
* @returns The iterator
|
|
102
|
-
*/
|
|
103
|
-
[Symbol.iterator]() {
|
|
104
|
-
return this.entries();
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Executes the given callback on each entry in the map.
|
|
108
|
-
* @param callbackFn - Callback function
|
|
109
|
-
*/
|
|
110
|
-
forEach(callbackFn) {
|
|
111
|
-
this.data.forEach((localValue, key, m) => {
|
|
112
|
-
callbackFn(localValue.value, key, m);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
103
|
/**
|
|
116
104
|
* {@inheritDoc ISharedMap.get}
|
|
117
105
|
*/
|
|
@@ -119,30 +107,10 @@ class DefaultMap {
|
|
|
119
107
|
const localValue = this.data.get(key) ?? this.createCore(key, true);
|
|
120
108
|
return localValue.value;
|
|
121
109
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Check if a key exists in the map.
|
|
124
|
-
* @param key - The key to check
|
|
125
|
-
* @returns True if the key exists, false otherwise
|
|
126
|
-
*/
|
|
127
|
-
has(key) {
|
|
128
|
-
return this.data.has(key);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Serializes the data stored in the shared map to a JSON string
|
|
132
|
-
* @param serializer - The serializer to use to serialize handles in its values.
|
|
133
|
-
* @returns A JSON string containing serialized map data
|
|
134
|
-
*/
|
|
135
|
-
getSerializedStorage(serializer) {
|
|
136
|
-
const serializableMapData = {};
|
|
137
|
-
this.data.forEach((localValue, key) => {
|
|
138
|
-
serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);
|
|
139
|
-
});
|
|
140
|
-
return serializableMapData;
|
|
141
|
-
}
|
|
142
110
|
getSerializableStorage(serializer) {
|
|
143
111
|
const serializableMapData = {};
|
|
144
112
|
this.data.forEach((localValue, key) => {
|
|
145
|
-
serializableMapData[key] = (0,
|
|
113
|
+
serializableMapData[key] = (0, IntervalCollectionValues_js_1.makeSerializable)(localValue, serializer, this.handle);
|
|
146
114
|
});
|
|
147
115
|
return serializableMapData;
|
|
148
116
|
}
|
|
@@ -151,10 +119,12 @@ class DefaultMap {
|
|
|
151
119
|
}
|
|
152
120
|
/**
|
|
153
121
|
* Populate the kernel with the given map data.
|
|
154
|
-
*
|
|
122
|
+
*
|
|
123
|
+
* @param serialized - A JSON string containing serialized map data
|
|
155
124
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
125
|
+
populate(serialized) {
|
|
126
|
+
const parsed = this.serializer.parse(serialized);
|
|
127
|
+
for (const [key, serializable] of Object.entries(parsed)) {
|
|
158
128
|
// Back-compat: legacy documents may have handles to an intervalCollection map kernel.
|
|
159
129
|
// These collections should be empty, and ValueTypes are no longer supported.
|
|
160
130
|
if (serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
|
|
@@ -173,9 +143,6 @@ class DefaultMap {
|
|
|
173
143
|
this.data.set(localValue.key, localValue.value);
|
|
174
144
|
}
|
|
175
145
|
}
|
|
176
|
-
populate(json) {
|
|
177
|
-
this.populateFromSerializable(JSON.parse(json));
|
|
178
|
-
}
|
|
179
146
|
/**
|
|
180
147
|
* Submit the given op if a handler is registered.
|
|
181
148
|
* @param op - The operation to attempt to submit
|
|
@@ -185,20 +152,47 @@ class DefaultMap {
|
|
|
185
152
|
* @returns True if the operation was submitted, false otherwise.
|
|
186
153
|
*/
|
|
187
154
|
tryResubmitMessage(op, localOpMetadata) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (handler !== undefined) {
|
|
191
|
-
handler.resubmit(op, localOpMetadata);
|
|
155
|
+
if (isMapOperation(op)) {
|
|
156
|
+
this.messageHandler.resubmit(op, localOpMetadata);
|
|
192
157
|
return true;
|
|
193
158
|
}
|
|
194
159
|
return false;
|
|
195
160
|
}
|
|
196
|
-
|
|
197
|
-
if (isMapOperation(op)
|
|
198
|
-
|
|
199
|
-
|
|
161
|
+
tryApplyStashedOp(op) {
|
|
162
|
+
if (isMapOperation(op)) {
|
|
163
|
+
const { value, key } = op;
|
|
164
|
+
const map = this.get(key);
|
|
165
|
+
switch (value.opName) {
|
|
166
|
+
case "add": {
|
|
167
|
+
map.add({
|
|
168
|
+
// Todo: we should improve typing so we know add ops always have start and end
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
170
|
+
start: (0, intervalCollection_js_1.toSequencePlace)(value.value.start, value.value.startSide),
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
172
|
+
end: (0, intervalCollection_js_1.toSequencePlace)(value.value.end, value.value.endSide),
|
|
173
|
+
props: value.value.properties,
|
|
174
|
+
});
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
case "change": {
|
|
178
|
+
const { [intervalCollection_js_1.reservedIntervalIdKey]: id, ...props } = value.value.properties ?? {};
|
|
179
|
+
map.change(id, {
|
|
180
|
+
start: (0, intervalCollection_js_1.toOptionalSequencePlace)(value.value.start, value.value.startSide),
|
|
181
|
+
end: (0, intervalCollection_js_1.toOptionalSequencePlace)(value.value.end, value.value.endSide),
|
|
182
|
+
props,
|
|
183
|
+
});
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
case "delete": {
|
|
187
|
+
const { [intervalCollection_js_1.reservedIntervalIdKey]: id } = value.value.properties ?? {};
|
|
188
|
+
map.removeIntervalById(id);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
default:
|
|
192
|
+
throw new Error("unknown ops should not be stashed");
|
|
193
|
+
}
|
|
200
194
|
}
|
|
201
|
-
return
|
|
195
|
+
return false;
|
|
202
196
|
}
|
|
203
197
|
/**
|
|
204
198
|
* Process the given op if a handler is registered.
|
|
@@ -209,9 +203,8 @@ class DefaultMap {
|
|
|
209
203
|
* @returns True if the operation was processed, false otherwise.
|
|
210
204
|
*/
|
|
211
205
|
tryProcessMessage(op, local, message, localOpMetadata) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
handler.process(op, local, message, localOpMetadata);
|
|
206
|
+
if (isMapOperation(op)) {
|
|
207
|
+
this.messageHandler.process(op, local, message, localOpMetadata);
|
|
215
208
|
return true;
|
|
216
209
|
}
|
|
217
210
|
return false;
|
|
@@ -223,7 +216,7 @@ class DefaultMap {
|
|
|
223
216
|
* @param local - Whether the message originated from the local client
|
|
224
217
|
*/
|
|
225
218
|
createCore(key, local) {
|
|
226
|
-
const localValue = new
|
|
219
|
+
const localValue = new IntervalCollectionValues_js_1.IntervalCollectionTypeLocalValue(this.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options), this.type);
|
|
227
220
|
const previousValue = this.data.get(key);
|
|
228
221
|
this.data.set(key, localValue);
|
|
229
222
|
const event = { key, previousValue };
|
|
@@ -243,55 +236,11 @@ class DefaultMap {
|
|
|
243
236
|
makeLocal(key, serializable) {
|
|
244
237
|
(0, core_utils_1.assert)(serializable.type !== shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] &&
|
|
245
238
|
serializable.type !== shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared], 0x2e1 /* "Support for plain value types removed." */);
|
|
246
|
-
serializable.value = (0, shared_object_base_1.parseHandles)(serializable.value, this.serializer);
|
|
247
239
|
const localValue = this.type.factory.load(this.makeMapValueOpEmitter(key), serializable.value, this.options);
|
|
248
|
-
return new
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Get the message handlers for the map.
|
|
252
|
-
* @returns A map of string op names to IMapMessageHandlers for those ops
|
|
253
|
-
*/
|
|
254
|
-
getMessageHandlers() {
|
|
255
|
-
const messageHandlers = new Map();
|
|
256
|
-
// Ops with type "act" describe actions taken by custom value type handlers of whatever item is
|
|
257
|
-
// being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has
|
|
258
|
-
// stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone
|
|
259
|
-
// watching for manipulations of that item.
|
|
260
|
-
messageHandlers.set("act", {
|
|
261
|
-
process: (op, local, message, localOpMetadata) => {
|
|
262
|
-
const localValue = this.data.get(op.key) ?? this.createCore(op.key, local);
|
|
263
|
-
const handler = localValue.getOpHandler(op.value.opName);
|
|
264
|
-
const previousValue = localValue.value;
|
|
265
|
-
const translatedValue = (0, shared_object_base_1.parseHandles)(op.value.value, this.serializer);
|
|
266
|
-
handler.process(previousValue, translatedValue, local, message, localOpMetadata);
|
|
267
|
-
const event = { key: op.key, previousValue };
|
|
268
|
-
this.eventEmitter.emit("valueChanged", event, local, message, this.eventEmitter);
|
|
269
|
-
},
|
|
270
|
-
submit: (op, localOpMetadata) => {
|
|
271
|
-
this.submitMessage(op, localOpMetadata);
|
|
272
|
-
},
|
|
273
|
-
resubmit: (op, localOpMetadata) => {
|
|
274
|
-
const localValue = this.data.get(op.key);
|
|
275
|
-
(0, core_utils_1.assert)(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);
|
|
276
|
-
const handler = localValue.getOpHandler(op.value.opName);
|
|
277
|
-
const rebased = handler.rebase(localValue.value, op.value, localOpMetadata);
|
|
278
|
-
if (rebased !== undefined) {
|
|
279
|
-
const { rebasedOp, rebasedLocalOpMetadata } = rebased;
|
|
280
|
-
this.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
getStashedOpLocalMetadata: (op) => {
|
|
284
|
-
const localValue = this.data.get(op.key) ?? this.createCore(op.key, true);
|
|
285
|
-
(0, core_utils_1.assert)(localValue !== undefined, 0x879 /* Local value expected on applying stashed op */);
|
|
286
|
-
const handler = localValue.getOpHandler(op.value.opName);
|
|
287
|
-
return handler.applyStashedOp(localValue.value, op.value);
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
return messageHandlers;
|
|
240
|
+
return new IntervalCollectionValues_js_1.IntervalCollectionTypeLocalValue(localValue, this.type);
|
|
291
241
|
}
|
|
292
242
|
/**
|
|
293
243
|
* Create an emitter for a value type to emit ops from the given key.
|
|
294
|
-
* @alpha
|
|
295
244
|
* @param key - The key of the map that the value type will be stored on
|
|
296
245
|
* @returns A value op emitter for the given key
|
|
297
246
|
*/
|
|
@@ -299,13 +248,12 @@ class DefaultMap {
|
|
|
299
248
|
makeMapValueOpEmitter(key) {
|
|
300
249
|
// eslint-disable-next-line import/no-deprecated
|
|
301
250
|
const emit = (opName, previousValue, params, localOpMetadata) => {
|
|
302
|
-
const translatedParams = (0, shared_object_base_1.makeHandlesSerializable)(params, this.serializer, this.handle);
|
|
303
251
|
const op = {
|
|
304
252
|
key,
|
|
305
253
|
type: "act",
|
|
306
254
|
value: {
|
|
307
255
|
opName,
|
|
308
|
-
value:
|
|
256
|
+
value: params,
|
|
309
257
|
},
|
|
310
258
|
};
|
|
311
259
|
this.submitMessage(op, localOpMetadata);
|
|
@@ -315,5 +263,5 @@ class DefaultMap {
|
|
|
315
263
|
return { emit };
|
|
316
264
|
}
|
|
317
265
|
}
|
|
318
|
-
exports.
|
|
319
|
-
//# sourceMappingURL=
|
|
266
|
+
exports.IntervalCollectionMap = IntervalCollectionMap;
|
|
267
|
+
//# sourceMappingURL=intervalCollectionMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervalCollectionMap.js","sourceRoot":"","sources":["../src/intervalCollectionMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2EAAiF;AACjF,+DAAiE;AACjE,2DAAoD;AACpD,+EAAmG;AAiBnG,mEAKiC;AAEjC,SAAS,cAAc,CAAC,EAAW;IAClC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC;AACnF,CAAC;AA6BD;;;;;;GAMG;AACH,MAAa,qBAAqB;IACjC;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IA0CD;;;;;;;OAOG;IACH,YACkB,UAA4B,EA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EAAE;YACT,MAAM,EAAE,GAAkB;gBACzB,GAAG;gBACH,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE;oBACN,MAAM;oBACN,KAAK,EAAE,MAAM;iBACb;aACD,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;YAExC,MAAM,KAAK,GAAkB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACjB,CAAC;CACD;AAlTD,sDAkTC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { makeSerializable, IntervalCollectionTypeLocalValue } from \"./IntervalCollectionValues.js\";\nimport {\n\tISerializableIntervalCollection,\n\tIValueChanged,\n\t// eslint-disable-next-line import/no-deprecated\n\tIValueOpEmitter,\n\tIIntervalCollectionType,\n\tISharedDefaultMapEvents,\n\tIMapMessageLocalMetadata,\n\tSequenceOptions,\n\tIIntervalCollectionTypeOperationValue,\n} from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\tSerializedIntervalDelta,\n\tIntervalDeltaOpType,\n\ttype ISerializableInterval,\n} from \"./intervals/index.js\";\nimport {\n\ttoSequencePlace,\n\ttoOptionalSequencePlace,\n\treservedIntervalIdKey,\n\ttype IntervalCollection,\n} from \"./intervalCollection.js\";\n\nfunction isMapOperation(op: unknown): op is IMapOperation {\n\treturn typeof op === \"object\" && op !== null && \"type\" in op && op.type === \"act\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport interface IMapOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t */\n\tvalue: IIntervalCollectionTypeOperationValue;\n}\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableIntervalCollection;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class IntervalCollectionMap<T extends ISerializableInterval> {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandler = {\n\t\tprocess: (\n\t\t\top: IMapOperation,\n\t\t\tlocal: boolean,\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => {\n\t\t\tconst localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\tconst previousValue = localValue.value;\n\t\t\tconst translatedValue = op.value.value as any;\n\t\t\thandler.process(previousValue, translatedValue, local, message, localOpMetadata);\n\t\t\tconst event: IValueChanged = { key: op.key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n\t\t},\n\t\tsubmit: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t},\n\t\tresubmit: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\tconst localValue = this.data.get(op.key);\n\n\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\n\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\tconst rebased = handler.rebase(localValue.value, op.value, localOpMetadata);\n\t\t\tif (rebased !== undefined) {\n\t\t\t\tconst { rebasedOp, rebasedLocalOpMetadata } = rebased;\n\t\t\t\tthis.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);\n\t\t\t}\n\t\t},\n\t};\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, IntervalCollectionTypeLocalValue<T>>();\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: IMapOperation,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly type: IIntervalCollectionType<T>,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t\tpublic readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n\t) {}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): IntervalCollection<T> {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue.value;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t *\n\t * @param serialized - A JSON string containing serialized map data\n\t */\n\tpublic populate(serialized: string): void {\n\t\tconst parsed = this.serializer.parse(serialized) as IMapDataObjectSerializable;\n\n\t\tfor (const [key, serializable] of Object.entries(parsed)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tconst localValue = {\n\t\t\t\tkey: normalizedKey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: unknown, localOpMetadata: IMapMessageLocalMetadata): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tthis.messageHandler.resubmit(op, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryApplyStashedOp(op: unknown): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tconst { value, key } = op;\n\t\t\tconst map = this.get(key);\n\n\t\t\tswitch (value.opName) {\n\t\t\t\tcase \"add\": {\n\t\t\t\t\tmap.add({\n\t\t\t\t\t\t// Todo: we should improve typing so we know add ops always have start and end\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tstart: toSequencePlace(value.value.start!, value.value.startSide),\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tend: toSequencePlace(value.value.end!, value.value.endSide),\n\t\t\t\t\t\tprops: value.value.properties,\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tcase \"change\": {\n\t\t\t\t\tconst { [reservedIntervalIdKey]: id, ...props } = value.value.properties ?? {};\n\t\t\t\t\tmap.change(id, {\n\t\t\t\t\t\tstart: toOptionalSequencePlace(value.value.start, value.value.startSide),\n\t\t\t\t\t\tend: toOptionalSequencePlace(value.value.end, value.value.endSide),\n\t\t\t\t\t\tprops,\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tcase \"delete\": {\n\t\t\t\t\tconst { [reservedIntervalIdKey]: id } = value.value.properties ?? {};\n\t\t\t\t\tmap.removeIntervalById(id);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"unknown ops should not be stashed\");\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(\n\t\top: unknown,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tthis.messageHandler.process(\n\t\t\t\top,\n\t\t\t\tlocal,\n\t\t\t\tmessage,\n\t\t\t\tlocalOpMetadata as IMapMessageLocalMetadata,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate createCore(key: string, local: boolean): IntervalCollectionTypeLocalValue<T> {\n\t\tconst localValue = new IntervalCollectionTypeLocalValue(\n\t\t\tthis.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options),\n\t\t\tthis.type,\n\t\t);\n\t\tconst previousValue = this.data.get(key);\n\t\tthis.data.set(key, localValue);\n\t\tconst event: IValueChanged = { key, previousValue };\n\t\tthis.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(\n\t\tkey: string,\n\t\tserializable: ISerializableIntervalCollection,\n\t): IntervalCollectionTypeLocalValue<T> {\n\t\tassert(\n\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t);\n\n\t\tconst localValue = this.type.factory.load(\n\t\t\tthis.makeMapValueOpEmitter(key),\n\t\t\tserializable.value,\n\t\t\tthis.options,\n\t\t);\n\t\treturn new IntervalCollectionTypeLocalValue(localValue, this.type);\n\t}\n\n\t/**\n\t * Create an emitter for a value type to emit ops from the given key.\n\t * @param key - The key of the map that the value type will be stored on\n\t * @returns A value op emitter for the given key\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate makeMapValueOpEmitter(key: string): IValueOpEmitter {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst emit: IValueOpEmitter[\"emit\"] = (\n\t\t\topName: IntervalDeltaOpType,\n\t\t\tpreviousValue: unknown,\n\t\t\tparams: SerializedIntervalDelta,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t): void => {\n\t\t\tconst op: IMapOperation = {\n\t\t\t\tkey,\n\t\t\t\ttype: \"act\",\n\t\t\t\tvalue: {\n\t\t\t\t\topName,\n\t\t\t\t\tvalue: params,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\n\t\t\tconst event: IValueChanged = { key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n\t\t};\n\n\t\treturn { emit };\n\t}\n}\n"]}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
6
6
|
import { ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
7
7
|
import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
|
|
8
|
-
import { ISerializedInterval, IntervalOpType, SerializedIntervalDelta, IntervalDeltaOpType } from "./intervals/index.
|
|
8
|
+
import { ISerializedInterval, IntervalOpType, SerializedIntervalDelta, IntervalDeltaOpType, type ISerializableInterval } from "./intervals/index.js";
|
|
9
|
+
import type { IntervalCollection } from "./intervalCollection.js";
|
|
9
10
|
/**
|
|
10
11
|
* Type of "valueChanged" event parameter.
|
|
11
12
|
*/
|
|
@@ -75,30 +76,28 @@ export interface SequenceOptions {
|
|
|
75
76
|
* A value factory is used to serialize/deserialize value types to a map
|
|
76
77
|
* @alpha
|
|
77
78
|
*/
|
|
78
|
-
export interface
|
|
79
|
+
export interface IIntervalCollectionFactory<T extends ISerializableInterval> {
|
|
79
80
|
/**
|
|
80
81
|
* Create a new value type. Used both in creation of new value types, as well as in loading existing ones
|
|
81
82
|
* from remote.
|
|
82
83
|
* @param emitter - Emitter object that the created value type will use to emit operations
|
|
83
84
|
* @param raw - Initialization parameters as defined by the value type
|
|
84
85
|
* @returns The new value type
|
|
85
|
-
* @alpha
|
|
86
86
|
*/
|
|
87
|
-
load(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): T
|
|
87
|
+
load(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): IntervalCollection<T>;
|
|
88
88
|
/**
|
|
89
89
|
* Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be
|
|
90
90
|
* loadable using the load method of its factory.
|
|
91
91
|
* @param value - The value type to serialize
|
|
92
92
|
* @returns The JSONable form of the value type
|
|
93
|
-
* @alpha
|
|
94
93
|
*/
|
|
95
|
-
store(value: T): any;
|
|
94
|
+
store(value: IntervalCollection<T>): any;
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
97
|
* Defines an operation that a value type is able to handle.
|
|
99
98
|
* @alpha
|
|
100
99
|
*/
|
|
101
|
-
export interface
|
|
100
|
+
export interface IIntervalCollectionOperation<T extends ISerializableInterval> {
|
|
102
101
|
/**
|
|
103
102
|
* Performs the actual processing on the incoming operation.
|
|
104
103
|
* @param value - The current value stored at the given key, which should be the value type
|
|
@@ -106,9 +105,8 @@ export interface IValueOperation<T> {
|
|
|
106
105
|
* @param local - Whether the operation originated from this client
|
|
107
106
|
* @param message - The operation itself
|
|
108
107
|
* @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.
|
|
109
|
-
* @alpha
|
|
110
108
|
*/
|
|
111
|
-
process(value: T
|
|
109
|
+
process(value: IntervalCollection<T>, params: ISerializedInterval, local: boolean, message: ISequencedDocumentMessage | undefined, localOpMetadata: IMapMessageLocalMetadata | undefined): void;
|
|
112
110
|
/**
|
|
113
111
|
* Rebases an `op` on `value` from its original perspective (ref/local seq) to the current
|
|
114
112
|
* perspective. Should be invoked on reconnection.
|
|
@@ -117,31 +115,27 @@ export interface IValueOperation<T> {
|
|
|
117
115
|
* @param localOpMetadata - Any local metadata that was originally submitted with the op.
|
|
118
116
|
* @returns A rebased version of the op and any local metadata that should be submitted with it.
|
|
119
117
|
*/
|
|
120
|
-
rebase(value: T
|
|
121
|
-
rebasedOp:
|
|
118
|
+
rebase(value: IntervalCollection<T>, op: IIntervalCollectionTypeOperationValue, localOpMetadata: IMapMessageLocalMetadata): {
|
|
119
|
+
rebasedOp: IIntervalCollectionTypeOperationValue;
|
|
122
120
|
rebasedLocalOpMetadata: IMapMessageLocalMetadata;
|
|
123
121
|
} | undefined;
|
|
124
|
-
applyStashedOp(value: T, op: IValueTypeOperationValue): IMapMessageLocalMetadata;
|
|
125
122
|
}
|
|
126
123
|
/**
|
|
127
124
|
* Defines a value type that can be registered on a container type.
|
|
128
125
|
*/
|
|
129
|
-
export interface
|
|
126
|
+
export interface IIntervalCollectionType<T extends ISerializableInterval> {
|
|
130
127
|
/**
|
|
131
128
|
* Name of the value type.
|
|
132
|
-
* @alpha
|
|
133
129
|
*/
|
|
134
130
|
name: string;
|
|
135
131
|
/**
|
|
136
132
|
* Factory method used to convert to/from a JSON form of the type.
|
|
137
|
-
* @alpha
|
|
138
133
|
*/
|
|
139
|
-
factory:
|
|
134
|
+
factory: IIntervalCollectionFactory<T>;
|
|
140
135
|
/**
|
|
141
136
|
* Operations that can be applied to the value type.
|
|
142
|
-
* @alpha
|
|
143
137
|
*/
|
|
144
|
-
ops: Map<IntervalOpType,
|
|
138
|
+
ops: Map<IntervalOpType, IIntervalCollectionOperation<T>>;
|
|
145
139
|
}
|
|
146
140
|
export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
|
|
147
141
|
(event: "valueChanged" | "create", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): void;
|
|
@@ -157,7 +151,7 @@ export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
|
|
|
157
151
|
* The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes
|
|
158
152
|
* and deserializes via .store() and .load().
|
|
159
153
|
*/
|
|
160
|
-
export interface
|
|
154
|
+
export interface ISerializableIntervalCollection {
|
|
161
155
|
/**
|
|
162
156
|
* A type annotation to help indicate how the value serializes.
|
|
163
157
|
*/
|
|
@@ -167,7 +161,7 @@ export interface ISerializableValue {
|
|
|
167
161
|
*/
|
|
168
162
|
value: any;
|
|
169
163
|
}
|
|
170
|
-
export interface
|
|
164
|
+
export interface ISerializedIntervalCollection {
|
|
171
165
|
/**
|
|
172
166
|
* A type annotation to help indicate how the value serializes.
|
|
173
167
|
*/
|
|
@@ -186,7 +180,7 @@ export interface ISerializedValue {
|
|
|
186
180
|
* it just describes an operation to be applied to an already-in-memory value.
|
|
187
181
|
* @alpha
|
|
188
182
|
*/
|
|
189
|
-
export interface
|
|
183
|
+
export interface IIntervalCollectionTypeOperationValue {
|
|
190
184
|
/**
|
|
191
185
|
* The name of the operation.
|
|
192
186
|
*/
|
|
@@ -196,4 +190,4 @@ export interface IValueTypeOperationValue {
|
|
|
196
190
|
*/
|
|
197
191
|
value: SerializedIntervalDelta;
|
|
198
192
|
}
|
|
199
|
-
//# sourceMappingURL=
|
|
193
|
+
//# sourceMappingURL=intervalCollectionMapInterfaces.d.ts.map
|