@fluidframework/tree 2.103.0 → 2.111.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/.vscode/settings.json +1 -0
- package/CHANGELOG.md +109 -0
- package/api-report/tree.alpha.api.md +60 -34
- package/api-report/tree.beta.api.md +49 -3
- package/api-report/tree.legacy.beta.api.md +49 -3
- package/dist/codec/versioned/format.js +2 -24
- package/dist/codec/versioned/format.js.map +1 -1
- package/dist/core/change-family/changeFamily.d.ts +3 -10
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/rebase/types.d.ts +2 -2
- package/dist/core/rebase/types.js +2 -24
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.js +2 -24
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.js +2 -24
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/schema-stored/index.js +3 -25
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/tree/anchorSet.js +4 -8
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -24
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +2 -24
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js +2 -24
- package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/internal.js +2 -15
- package/dist/entrypoints/internal.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -11
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +83 -9
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +2 -24
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +2 -24
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +2 -24
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +2 -24
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -19
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +3 -13
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +2 -24
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -25
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +2 -24
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -24
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +2 -24
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +11 -55
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +2 -24
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +2 -24
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +2 -24
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js +2 -24
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +2 -24
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.js +2 -24
- package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.js +2 -24
- package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.js +2 -24
- package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -25
- package/dist/index.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/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +4 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +7 -41
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +5 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +13 -49
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +2 -24
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/dist/shared-tree/transactionPostProcessor.js +28 -0
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
- package/dist/shared-tree/treeAlpha.js +3 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +28 -15
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +124 -145
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/branch.js +13 -17
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +2 -24
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +2 -24
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -24
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +1 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -24
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +2 -24
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -24
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +9 -44
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +84 -9
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +94 -37
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactory.js +2 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +2 -24
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +4 -26
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +96 -22
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +83 -93
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +6 -10
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +2 -12
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -6
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +2 -24
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/tableSchema.d.ts +50 -4
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +202 -106
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +69 -758
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +275 -322
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +273 -0
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/dist/text/textDomainFormattedDefault.js +94 -0
- package/dist/text/textDomainFormattedDefault.js.map +1 -0
- package/dist/util/arrayUtilities.d.ts +20 -0
- package/dist/util/arrayUtilities.d.ts.map +1 -1
- package/dist/util/arrayUtilities.js +24 -1
- package/dist/util/arrayUtilities.js.map +1 -1
- package/dist/util/compressedIds.d.ts +118 -0
- package/dist/util/compressedIds.d.ts.map +1 -0
- package/dist/util/compressedIds.js +133 -0
- package/dist/util/compressedIds.js.map +1 -0
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +11 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +13 -0
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +69 -8
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/typeboxBrand.js +2 -24
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.js +2 -24
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +0 -30
- package/lib/core/change-family/changeFamily.d.ts +3 -10
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/rebase/types.d.ts +2 -2
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/tree/anchorSet.js +1 -5
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -5
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +82 -9
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -11
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +1 -11
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +1 -45
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.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/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +5 -8
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -38
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +5 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -45
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/lib/shared-tree/transactionPostProcessor.js +23 -0
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
- package/lib/shared-tree/treeAlpha.js +3 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +28 -15
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +80 -101
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/branch.js +1 -5
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +1 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +1 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +4 -39
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +84 -9
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +74 -17
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +96 -22
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +1 -11
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +1 -5
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +1 -11
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -5
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/tableSchema.d.ts +50 -4
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +171 -75
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +69 -758
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +277 -324
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +273 -0
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/lib/text/textDomainFormattedDefault.js +91 -0
- package/lib/text/textDomainFormattedDefault.js.map +1 -0
- package/lib/util/arrayUtilities.d.ts +20 -0
- package/lib/util/arrayUtilities.d.ts.map +1 -1
- package/lib/util/arrayUtilities.js +22 -0
- package/lib/util/arrayUtilities.js.map +1 -1
- package/lib/util/compressedIds.d.ts +118 -0
- package/lib/util/compressedIds.d.ts.map +1 -0
- package/lib/util/compressedIds.js +124 -0
- package/lib/util/compressedIds.js.map +1 -0
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +13 -0
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +69 -8
- package/lib/util/rangeMap.js.map +1 -1
- package/package.json +25 -24
- package/src/core/change-family/changeFamily.ts +3 -12
- package/src/core/rebase/types.ts +2 -2
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
- package/src/entrypoints/alpha.ts +12 -8
- package/src/entrypoints/beta.ts +8 -0
- package/src/entrypoints/legacy.ts +8 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +35 -64
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +138 -42
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
- package/src/feature-libraries/chunked-forest/index.ts +3 -0
- package/src/feature-libraries/forest-summary/codec.ts +5 -3
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
- package/src/feature-libraries/index.ts +3 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -47
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +0 -5
- package/src/index.ts +13 -8
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -10
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizingTreeView.ts +29 -25
- package/src/shared-tree/sharedTree.ts +18 -10
- package/src/shared-tree/transactionPostProcessor.ts +40 -0
- package/src/shared-tree/treeAlpha.ts +3 -3
- package/src/shared-tree/treeCheckout.ts +120 -95
- package/src/shared-tree/unhydratedTreeContext.ts +18 -15
- package/src/shared-tree-core/editManagerCodecs.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
- package/src/shared-tree-core/index.ts +8 -5
- package/src/shared-tree-core/sharedTreeCore.ts +3 -2
- package/src/shared-tree-core/transaction.ts +148 -18
- package/src/simple-tree/api/index.ts +13 -9
- package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
- package/src/simple-tree/api/schemaFactory.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -2
- package/src/simple-tree/api/transactionTypes.ts +111 -39
- package/src/simple-tree/api/tree.ts +152 -47
- package/src/simple-tree/api/treeBeta.ts +2 -0
- package/src/simple-tree/core/treeNodeSchema.ts +7 -7
- package/src/simple-tree/index.ts +12 -8
- package/src/tableSchema.ts +306 -80
- package/src/text/index.ts +1 -0
- package/src/text/textDomainFormatted.ts +520 -415
- package/src/text/textDomainFormattedDefault.ts +150 -0
- package/src/util/arrayUtilities.ts +35 -0
- package/src/util/compressedIds.ts +216 -0
- package/src/util/index.ts +17 -0
- package/src/util/rangeMap.ts +108 -9
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
enumFromStrings,
|
|
8
|
+
SchemaFactory,
|
|
9
|
+
SchemaFactoryAlpha,
|
|
10
|
+
SchemaFactoryBeta,
|
|
11
|
+
} from "../simple-tree/index.js";
|
|
12
|
+
import type {
|
|
13
|
+
TreeNodeFromImplicitAllowedTypes,
|
|
14
|
+
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
15
|
+
} from "../simple-tree/index.js";
|
|
16
|
+
|
|
17
|
+
import { FormattedTextAsTree } from "./textDomainFormatted.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Schema factory for default formatted text types which are not generic.
|
|
21
|
+
*/
|
|
22
|
+
const sf = new SchemaFactoryAlpha("com.fluidframework.text.formatted.default");
|
|
23
|
+
|
|
24
|
+
const defaultFormat = {
|
|
25
|
+
bold: false,
|
|
26
|
+
italic: false,
|
|
27
|
+
underline: false,
|
|
28
|
+
size: 12,
|
|
29
|
+
font: "Arial",
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
|
|
34
|
+
* @remarks
|
|
35
|
+
* This is a default parameterization of the generic {@link FormattedTextAsTree} with hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.
|
|
36
|
+
* It is unlikely this meets the needs of most users, but it can serve as an unstable example of how to use the generic {@link FormattedTextAsTree}.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export namespace FormattedTextAsTreeDefault {
|
|
40
|
+
/**
|
|
41
|
+
* Portion of a string with formatting.
|
|
42
|
+
* @sealed
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export type FormattedAtom = FormattedTextAsTree.FormattedAtom<
|
|
46
|
+
CharacterFormat,
|
|
47
|
+
StringAtomContent
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Formatting options for characters.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export class CharacterFormat extends sf.objectAlpha("CharacterFormat", {
|
|
55
|
+
bold: SchemaFactory.boolean,
|
|
56
|
+
italic: SchemaFactory.boolean,
|
|
57
|
+
underline: SchemaFactory.boolean,
|
|
58
|
+
size: SchemaFactory.number,
|
|
59
|
+
font: SchemaFactory.string,
|
|
60
|
+
}) {
|
|
61
|
+
public static readonly defaultFormat = new CharacterFormat(defaultFormat);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Tag with which a line in text can be formatted from HTML.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export const LineTag = enumFromStrings(sf.scopedFactory("lineTag"), [
|
|
69
|
+
"h1",
|
|
70
|
+
"h2",
|
|
71
|
+
"h3",
|
|
72
|
+
"h4",
|
|
73
|
+
"h5",
|
|
74
|
+
"li",
|
|
75
|
+
"ol",
|
|
76
|
+
"checked",
|
|
77
|
+
"unchecked",
|
|
78
|
+
"blockquote",
|
|
79
|
+
"codeBlock",
|
|
80
|
+
]);
|
|
81
|
+
/**
|
|
82
|
+
* {@inheritdoc FormattedTextAsTreeDefault.(LineTag:variable)}
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
export type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Unit in the string representing a new line character with line formatting.
|
|
89
|
+
* @remarks
|
|
90
|
+
* This aligns with how Quill represents line formatting.
|
|
91
|
+
* Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character
|
|
92
|
+
* and only lines using this atom can have line-specific formatting.
|
|
93
|
+
* The optional indent level mirrors Quill's indent attribute,
|
|
94
|
+
* which is applies to the line before the line break.
|
|
95
|
+
* Any tagged line can be indented independently.
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export class StringLineAtom extends sf.object("StringLineAtom", {
|
|
99
|
+
tag: LineTag.schema,
|
|
100
|
+
indent: SchemaFactory.number,
|
|
101
|
+
}) {
|
|
102
|
+
public readonly content = "\n";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Types of "atoms" that make up the text.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
export const StringAtomContent = [
|
|
110
|
+
FormattedTextAsTree.StringTextAtom,
|
|
111
|
+
StringLineAtom,
|
|
112
|
+
] as const;
|
|
113
|
+
/**
|
|
114
|
+
* {@inheritdoc FormattedTextAsTreeDefault.(StringAtomContent:variable)}
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
export type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Statics for text nodes.
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
export type Statics<TTree = Tree> = FormattedTextAsTree.Statics<TTree>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Insertable shape for a formatted text atom used by {@link FormattedTextAsTree.Members.insertWithFormattingAt}.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export type FormattedAtomInsertable = FormattedTextAsTree.FormattedAtom<
|
|
130
|
+
InsertableTreeNodeFromImplicitAllowedTypes<typeof CharacterFormat>,
|
|
131
|
+
InsertableTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms>
|
|
132
|
+
>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Helper for expressing the full set of formatted text atoms for a given schema.
|
|
136
|
+
* @privateRemarks
|
|
137
|
+
* Eventually this should probably be given a better name and/or made a system type in a system namespace.
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
export type FormattedTextAtoms = FormattedTextAsTree.FormattedTextAtoms<
|
|
141
|
+
[typeof StringLineAtom]
|
|
142
|
+
>;
|
|
143
|
+
|
|
144
|
+
export class Tree extends FormattedTextAsTree.createSchema(
|
|
145
|
+
new SchemaFactoryBeta("default"),
|
|
146
|
+
CharacterFormat,
|
|
147
|
+
[StringLineAtom],
|
|
148
|
+
defaultFormat,
|
|
149
|
+
) {}
|
|
150
|
+
}
|
|
@@ -86,3 +86,38 @@ export function validateIndexRange(
|
|
|
86
86
|
validateIndex(startIndex, array, apiName, true);
|
|
87
87
|
validateIndex(endIndex, array, apiName, true);
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A half-open `[start, end)` range of array indices.
|
|
92
|
+
*/
|
|
93
|
+
export interface IndexRange {
|
|
94
|
+
/** Start index, inclusive. */
|
|
95
|
+
readonly start: number;
|
|
96
|
+
/** End index, exclusive. */
|
|
97
|
+
readonly end: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Walks `array` in order and collects the indices of every element for which `predicate` returns
|
|
102
|
+
* `true` into contiguous `[start, end)` ranges.
|
|
103
|
+
* @param array - The array (or array-like) to scan.
|
|
104
|
+
* @param shouldInclude - Returns `true` for elements whose indices should be included.
|
|
105
|
+
* @returns The collected ranges in ascending order. The returned array is empty if no elements match.
|
|
106
|
+
*/
|
|
107
|
+
export function collectContiguousRanges<T>(
|
|
108
|
+
array: { readonly length: number; readonly [index: number]: T },
|
|
109
|
+
shouldInclude: (item: T) => boolean,
|
|
110
|
+
): readonly IndexRange[] {
|
|
111
|
+
const ranges: { start: number; end: number }[] = [];
|
|
112
|
+
for (let i = 0; i < array.length; i++) {
|
|
113
|
+
if (shouldInclude(array[i] as T)) {
|
|
114
|
+
const last = ranges[ranges.length - 1];
|
|
115
|
+
if (last?.end === i) {
|
|
116
|
+
last.end = i + 1;
|
|
117
|
+
} else {
|
|
118
|
+
ranges.push({ start: i, end: i + 1 });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return ranges;
|
|
123
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type {
|
|
8
|
+
IIdCompressor,
|
|
9
|
+
OpSpaceCompressedId,
|
|
10
|
+
SessionId,
|
|
11
|
+
SessionSpaceCompressedId,
|
|
12
|
+
} from "@fluidframework/id-compressor";
|
|
13
|
+
import { isFinalId, isStableId } from "@fluidframework/id-compressor/internal";
|
|
14
|
+
import { v5 as uuidV5 } from "uuid";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An encoded identifier that can be decoded without an originator session id.
|
|
18
|
+
* A finalized compressed id — the same numeric value in op-space and session-space.
|
|
19
|
+
* @remarks
|
|
20
|
+
* These are safe to use in contexts where the encoding id compressor is available to decode them,
|
|
21
|
+
* even when the session id of the encoding id compressor is not known.
|
|
22
|
+
*/
|
|
23
|
+
export type OriginatorlessEncodedId = SessionSpaceCompressedId & OpSpaceCompressedId;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An encoded identifier that may require an originator session id to decode.
|
|
27
|
+
* Any op-space compressed id, either finalized or session-local.
|
|
28
|
+
* @remarks
|
|
29
|
+
* These are only safe to use in contexts where the encoding id compressor is available
|
|
30
|
+
* and the session id of the encoding id compressor is known.
|
|
31
|
+
* Currently the only such case is in ops, excluding attach summary ops.
|
|
32
|
+
*/
|
|
33
|
+
export type OriginatorDependentEncodedId = OpSpaceCompressedId;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Selects how identifiers are encoded for transport/persistence.
|
|
37
|
+
*/
|
|
38
|
+
export enum EncodedIdType {
|
|
39
|
+
/**
|
|
40
|
+
* {@link OriginatorlessEncodedId}.
|
|
41
|
+
*/
|
|
42
|
+
Originatorless,
|
|
43
|
+
/**
|
|
44
|
+
* {@link OriginatorDependentEncodedId}.
|
|
45
|
+
*/
|
|
46
|
+
OriginatorDependent,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type EncodedId<T extends EncodedIdType> = T extends EncodedIdType.Originatorless
|
|
50
|
+
? OriginatorlessEncodedId
|
|
51
|
+
: T extends EncodedIdType.OriginatorDependent
|
|
52
|
+
? OriginatorDependentEncodedId
|
|
53
|
+
: OriginatorlessEncodedId | OriginatorDependentEncodedId;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Context for encoding identifiers.
|
|
57
|
+
* @remarks
|
|
58
|
+
* See {@link FieldBatchDecodingContext} for the decoder.
|
|
59
|
+
*/
|
|
60
|
+
export interface IdEncodingContext {
|
|
61
|
+
encodePossiblyCompressedId(id: string): string | EncodedId<EncodedIdType>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Encode a string identifier into a possibly compressed form based on the requested mode.
|
|
66
|
+
*
|
|
67
|
+
* @param id - The string identifier to encode.
|
|
68
|
+
* @param idCompressor - The ID compressor to use for compression.
|
|
69
|
+
* @param encodedIdType - The type of encoding to use. If the context doing the decoding will have the originator {@link SessionId},
|
|
70
|
+
* then {@link EncodedIdType.OriginatorDependent} can be used.
|
|
71
|
+
* Otherwise, {@link EncodedIdType.Originatorless} must be used.
|
|
72
|
+
*
|
|
73
|
+
* @privateRemarks
|
|
74
|
+
* Performance:
|
|
75
|
+
* When trying to optimize to avoid unnecessary identifier decompression, and store identifiers compressed in memory,
|
|
76
|
+
* this will likely need to be updated to allow in SessionSpaceCompressedIds.
|
|
77
|
+
*/
|
|
78
|
+
export function encodePossiblyCompressedId<T extends EncodedIdType>(
|
|
79
|
+
id: string,
|
|
80
|
+
idCompressor: IIdCompressor,
|
|
81
|
+
encodedIdType: T,
|
|
82
|
+
): string | EncodedId<T> {
|
|
83
|
+
if (!isStableId(id)) {
|
|
84
|
+
return id;
|
|
85
|
+
}
|
|
86
|
+
const sessionSpaceCompressedId = idCompressor.tryRecompress(id);
|
|
87
|
+
if (sessionSpaceCompressedId === undefined) {
|
|
88
|
+
return id;
|
|
89
|
+
}
|
|
90
|
+
const opSpaceId = idCompressor.normalizeToOpSpace(sessionSpaceCompressedId);
|
|
91
|
+
if (encodedIdType === EncodedIdType.Originatorless) {
|
|
92
|
+
return isFinalId(opSpaceId) ? (opSpaceId as unknown as EncodedId<T>) : id;
|
|
93
|
+
}
|
|
94
|
+
return opSpaceId as unknown as EncodedId<T>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Namespace used for the deterministic UUIDv5 produced by the heal-on-decode workaround
|
|
99
|
+
* in {@link forceDecodeEncodedIdWithoutSession}.
|
|
100
|
+
*
|
|
101
|
+
* This scheme requires consensus across all clients to function — every client that
|
|
102
|
+
* encounters the same unresolvable id must produce the same v5 UUID.
|
|
103
|
+
*/
|
|
104
|
+
const healingNamespace = "f8a89df3-6882-400f-b913-4c1f6f0157bd";
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Decode an {@link OriginatorlessEncodedId} without needing an originator session id.
|
|
108
|
+
*
|
|
109
|
+
* The id is guaranteed to be final by the type contract; it is normalized via
|
|
110
|
+
* {@link IIdCompressor.tryNormalizeToSessionSpaceWithoutSession}, which handles the
|
|
111
|
+
* cluster-aligned-local case rather than relying on the bare numeric value.
|
|
112
|
+
*/
|
|
113
|
+
export function decodeOriginatorlessEncodedId(
|
|
114
|
+
id: OriginatorlessEncodedId,
|
|
115
|
+
idCompressor: IIdCompressor,
|
|
116
|
+
): SessionSpaceCompressedId {
|
|
117
|
+
const sessionSpaceId = idCompressor.tryNormalizeToSessionSpaceWithoutSession(id);
|
|
118
|
+
assert(
|
|
119
|
+
sessionSpaceId !== undefined,
|
|
120
|
+
0xd0a /* OriginatorlessEncodedId must be a finalized compressed id at runtime */,
|
|
121
|
+
);
|
|
122
|
+
return sessionSpaceId;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Decode an {@link OriginatorDependentEncodedId} using a known originator session id.
|
|
127
|
+
*/
|
|
128
|
+
export function decodeEncodedIdWithOriginator(
|
|
129
|
+
id: OriginatorDependentEncodedId,
|
|
130
|
+
originator: SessionId,
|
|
131
|
+
idCompressor: IIdCompressor,
|
|
132
|
+
): SessionSpaceCompressedId {
|
|
133
|
+
return idCompressor.normalizeToSessionSpace(id, originator);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Decode an {@link OriginatorDependentEncodedId} without a session.
|
|
138
|
+
*
|
|
139
|
+
* Returns the session-space id if `id` is finalized (and therefore resolvable
|
|
140
|
+
* without an originator session), or `undefined` if `id` is a non-final op-space
|
|
141
|
+
* id that cannot be resolved without the originator session.
|
|
142
|
+
*/
|
|
143
|
+
export function tryDecodeEncodedIdWithoutSession(
|
|
144
|
+
id: OriginatorDependentEncodedId,
|
|
145
|
+
idCompressor: IIdCompressor,
|
|
146
|
+
): SessionSpaceCompressedId | undefined {
|
|
147
|
+
return idCompressor.tryNormalizeToSessionSpaceWithoutSession(id);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Configuration for the heal-on-decode workaround. The internal counterpart of
|
|
152
|
+
* the user-facing {@link SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode}
|
|
153
|
+
* option — see that option for the user-facing rationale and trade-offs.
|
|
154
|
+
*
|
|
155
|
+
* Carried by decode-side contexts (`ChangeEncodingContext.healing`,
|
|
156
|
+
* `EditManagerEncodingContext.healing`, etc.) when the workaround is enabled.
|
|
157
|
+
* Presence enables healing; `undefined` opts out. There is no separate boolean,
|
|
158
|
+
* which makes it impossible to enable healing without supplying the namespace
|
|
159
|
+
* input.
|
|
160
|
+
*/
|
|
161
|
+
export interface IdentifierHealingConfig {
|
|
162
|
+
/**
|
|
163
|
+
* The SharedTree's shared-object id, used as the v5 namespace input so
|
|
164
|
+
* healed UUIDs are unique across attaches of different documents with the
|
|
165
|
+
* same session offsets.
|
|
166
|
+
*/
|
|
167
|
+
readonly sharedObjectId: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Decode an op-space compressed id without a session.
|
|
172
|
+
*
|
|
173
|
+
* Finalized ids are returned as session-space ids (final ids are invariant
|
|
174
|
+
* across the two spaces). Non-final ids are healed via {@link IdentifierHealingConfig}
|
|
175
|
+
* if provided, or cause the resolver to throw otherwise. A healed result is a
|
|
176
|
+
* deterministic v5 UUID string — *not* a `StableId`, since that brand requires
|
|
177
|
+
* v4, but still a valid identifier value; the `string` arm of the return type
|
|
178
|
+
* covers this case.
|
|
179
|
+
*/
|
|
180
|
+
export function forceDecodeEncodedIdWithoutSession(
|
|
181
|
+
id: OpSpaceCompressedId,
|
|
182
|
+
idCompressor: IIdCompressor,
|
|
183
|
+
healing: IdentifierHealingConfig | undefined,
|
|
184
|
+
): SessionSpaceCompressedId | string {
|
|
185
|
+
const decoded = tryDecodeEncodedIdWithoutSession(id, idCompressor);
|
|
186
|
+
if (decoded !== undefined) {
|
|
187
|
+
return decoded;
|
|
188
|
+
}
|
|
189
|
+
// `id` is a non-final op-space compressed id.
|
|
190
|
+
if (healing !== undefined) {
|
|
191
|
+
return uuidV5(`${healing.sharedObjectId}|${id}`, healingNamespace);
|
|
192
|
+
}
|
|
193
|
+
throw new Error(
|
|
194
|
+
"Summary could not be loaded due to an incorrectly encoded identifier. See SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode for mitigation.",
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Convert a decoded, but possibly compressed, identifier to the decompressed string format.
|
|
200
|
+
*
|
|
201
|
+
* Session-space compressed ids are decompressed to their UUID representation via the compressor.
|
|
202
|
+
* String inputs pass through unchanged — they are already in the stored form,
|
|
203
|
+
* whether a `StableId` UUID, a heal-synthesized v5 UUID or other arbitrary string identifier.
|
|
204
|
+
*/
|
|
205
|
+
export function decompressIdentifierIfNeeded(
|
|
206
|
+
id: SessionSpaceCompressedId | string,
|
|
207
|
+
idCompressor: Pick<IIdCompressor, "decompress">,
|
|
208
|
+
): string {
|
|
209
|
+
if (typeof id === "string") {
|
|
210
|
+
return id;
|
|
211
|
+
} else {
|
|
212
|
+
const decompressed = idCompressor.decompress(id);
|
|
213
|
+
assert(typeof decompressed === "string", 0xd0b /* Decompressed id must be a string */);
|
|
214
|
+
return decompressed;
|
|
215
|
+
}
|
|
216
|
+
}
|
package/src/util/index.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
|
+
collectContiguousRanges,
|
|
8
|
+
type IndexRange,
|
|
7
9
|
validateIndex,
|
|
8
10
|
validateIndexRange,
|
|
9
11
|
validatePositiveIndex,
|
|
@@ -163,3 +165,18 @@ export {
|
|
|
163
165
|
export { cloneWithReplacements } from "./cloneWithReplacements.js";
|
|
164
166
|
|
|
165
167
|
export { readAndParseSnapshotBlob } from "./readSnapshotBlob.js";
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
type OriginatorlessEncodedId,
|
|
171
|
+
type OriginatorDependentEncodedId,
|
|
172
|
+
type IdentifierHealingConfig,
|
|
173
|
+
EncodedIdType,
|
|
174
|
+
encodePossiblyCompressedId,
|
|
175
|
+
type IdEncodingContext,
|
|
176
|
+
type EncodedId,
|
|
177
|
+
decodeOriginatorlessEncodedId,
|
|
178
|
+
decodeEncodedIdWithOriginator,
|
|
179
|
+
tryDecodeEncodedIdWithoutSession,
|
|
180
|
+
forceDecodeEncodedIdWithoutSession,
|
|
181
|
+
decompressIdentifierIfNeeded,
|
|
182
|
+
} from "./compressedIds.js";
|
package/src/util/rangeMap.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { BTree } from "@tylerbu/sorted-btree-es6";
|
|
8
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
9
|
+
import { union } from "@tylerbu/sorted-btree-es6/extended/union";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* RangeMap represents a mapping from keys of type K to values of type V or undefined.
|
|
@@ -215,19 +217,116 @@ export class RangeMap<K, V> {
|
|
|
215
217
|
0xaae /* Maps should have the same behavior */,
|
|
216
218
|
);
|
|
217
219
|
|
|
218
|
-
const merged = a.
|
|
219
|
-
for (const entryB of b.entries()) {
|
|
220
|
-
for (const entryA of a.getAll(entryB.start, entryB.length)) {
|
|
221
|
-
const key = b.offsetKey(entryB.start, entryA.offset);
|
|
222
|
-
const valueB = b.offsetValue(entryB.value, entryA.offset);
|
|
223
|
-
const mergedValue =
|
|
224
|
-
entryA.value === undefined ? valueB : mergeFunc(key, entryA.value, valueB);
|
|
220
|
+
const merged = new RangeMap<K, V>(a.offsetKey, a.subtractKeys, a.offsetValue);
|
|
225
221
|
|
|
226
|
-
|
|
222
|
+
// We first union the underlying B-trees, possibly resulting in a malformed range map.
|
|
223
|
+
merged.tree = union<BTree<K, RangeEntry<V>>, K, RangeEntry<V>>(
|
|
224
|
+
a.tree,
|
|
225
|
+
b.tree,
|
|
226
|
+
(key, v1, v2) => v1,
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// We split the overlapping tree entries into ranges which are either fully overlapping (intersections),
|
|
230
|
+
// or fully non-overlapping (residuals).
|
|
231
|
+
// We create an entry for each of these ranges.
|
|
232
|
+
// After this, the merged map should be well-formed.
|
|
233
|
+
RangeMap.forEachIntersection(
|
|
234
|
+
a,
|
|
235
|
+
b,
|
|
236
|
+
(key, length, valueA, valueB) =>
|
|
237
|
+
merged.tree.set(key, { value: mergeFunc(key, valueA, valueB), length }),
|
|
238
|
+
(key, length, value) => merged.tree.set(key, { value, length }),
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
return merged;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Calls provided handlers on intersecting portions of `mapA` and `mapB`.
|
|
246
|
+
* @param intersectionCallback - called once for each key range which has an entry in both `mapA` and `mapB`.
|
|
247
|
+
* @param residualCallback - called for each key range which only has an entry in one of the input maps,
|
|
248
|
+
* but which is part of a range entry that overlaps an entry in the other map.
|
|
249
|
+
* This may also be called for entries which are not part of an overlapping range.
|
|
250
|
+
*/
|
|
251
|
+
private static forEachIntersection<K, V>(
|
|
252
|
+
mapA: RangeMap<K, V>,
|
|
253
|
+
mapB: RangeMap<K, V>,
|
|
254
|
+
intersectionCallback: (key: K, length: number, valueA: V, valueB: V) => void,
|
|
255
|
+
residualCallback: (key: K, length: number, value: V) => void,
|
|
256
|
+
): void {
|
|
257
|
+
let [entry1, map1, map2] = this.getOrNextEntry(mapA, mapB, undefined);
|
|
258
|
+
while (entry1 !== undefined) {
|
|
259
|
+
const entry2 = map2.getOrNextEntry(entry1.start);
|
|
260
|
+
if (entry2 !== undefined) {
|
|
261
|
+
// This is the number of keys in `entry1` that come before the first key in `entry2`.
|
|
262
|
+
const offset = Math.min(mapA.subtractKeys(entry2.start, entry1.start), entry1.length);
|
|
263
|
+
if (offset > 0) {
|
|
264
|
+
residualCallback(entry1.start, offset, entry1.value);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const intersectionLength = Math.min(entry1.length - offset, entry2.length);
|
|
268
|
+
if (intersectionLength > 0) {
|
|
269
|
+
const value1Offset = mapA.offsetValue(entry1.value, offset);
|
|
270
|
+
const [valueA, valueB] =
|
|
271
|
+
map1 === mapA ? [value1Offset, entry2.value] : [entry2.value, value1Offset];
|
|
272
|
+
|
|
273
|
+
intersectionCallback(entry2.start, intersectionLength, valueA, valueB);
|
|
274
|
+
[entry1, map1, map2] = this.getOrNextEntry(
|
|
275
|
+
mapA,
|
|
276
|
+
mapB,
|
|
277
|
+
mapA.offsetKey(entry2.start, intersectionLength),
|
|
278
|
+
);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
227
281
|
}
|
|
282
|
+
|
|
283
|
+
residualCallback(entry1.start, entry1.length, entry1.value);
|
|
284
|
+
[entry1, map1, map2] = this.getOrNextEntry(
|
|
285
|
+
mapA,
|
|
286
|
+
mapB,
|
|
287
|
+
mapA.offsetKey(entry1.start, entry1.length),
|
|
288
|
+
);
|
|
228
289
|
}
|
|
229
290
|
|
|
230
|
-
return
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private static getOrNextEntry<K, V>(
|
|
295
|
+
mapA: RangeMap<K, V>,
|
|
296
|
+
mapB: RangeMap<K, V>,
|
|
297
|
+
key: K | undefined,
|
|
298
|
+
): [RangeMapEntry<K, V> | undefined, firstMap: RangeMap<K, V>, secondMap: RangeMap<K, V>] {
|
|
299
|
+
const entryA = mapA.getOrNextEntry(key);
|
|
300
|
+
const entryB = mapB.getOrNextEntry(key);
|
|
301
|
+
if (entryA === undefined) {
|
|
302
|
+
return [entryB, mapB, mapA];
|
|
303
|
+
} else if (entryB === undefined) {
|
|
304
|
+
return [entryA, mapA, mapB];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return mapA.le(entryA.start, entryB.start) ? [entryA, mapA, mapB] : [entryB, mapB, mapA];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @returns a range entry representing the first defined key range greater than or equal to `key`.
|
|
312
|
+
*/
|
|
313
|
+
private getOrNextEntry(minKey: K | undefined): RangeMapEntry<K, V> | undefined {
|
|
314
|
+
const key = minKey ?? this.tree.minKey();
|
|
315
|
+
if (key === undefined) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const result = this.getFirst(key, Infinity);
|
|
320
|
+
if (result.value !== undefined) {
|
|
321
|
+
return { start: key, value: result.value, length: result.length };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const entry = this.tree.nextHigherPair(key);
|
|
325
|
+
if (entry === undefined) {
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return { start: entry[0], value: entry[1].value, length: entry[1].length };
|
|
231
330
|
}
|
|
232
331
|
|
|
233
332
|
private getIntersectingEntries(start: K, length: number): RangeMapEntry<K, V>[] {
|
package/tsconfig.json
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
"compilerOptions": {
|
|
6
6
|
"rootDir": "./src",
|
|
7
7
|
"outDir": "./lib",
|
|
8
|
+
// Avoid emitting __classPrivateFieldGet/Set, __esDecorate, __runInitializers, etc.
|
|
9
|
+
// inline in every compiled module. Webpack's concatenateModules cannot dedupe these
|
|
10
|
+
// across modules (each gets unique scope-local var names), so without importHelpers
|
|
11
|
+
// the bundle accumulates ~17 copies of the same helpers (~1KB each).
|
|
12
|
+
"importHelpers": true,
|
|
8
13
|
"noImplicitAny": true,
|
|
9
14
|
"preserveConstEnums": true,
|
|
10
15
|
// Allow unused locals.
|