@fluidframework/tree 2.113.1 → 2.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +289 -0
- package/api-report/tree.alpha.api.md +127 -39
- package/dist/core/change-family/changeFamily.d.ts +15 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts +2 -3
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -2
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/change-family/index.d.ts +1 -1
- package/dist/core/change-family/index.d.ts.map +1 -1
- package/dist/core/change-family/index.js.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +110 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +47 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/tree/delta.d.ts +62 -16
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +7 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +32 -46
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +2 -4
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +2 -2
- package/dist/core/tree/visitorUtils.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 +8 -3
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +98 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.js +10 -0
- package/dist/feature-libraries/comparison-forest/index.js.map +1 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +18 -6
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +77 -72
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/invert.js +159 -0
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +53 -406
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +205 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.js +49 -0
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.d.ts +15 -0
- package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +64 -1
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- 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/serializedChange.d.ts +2 -2
- package/dist/shared-tree/serializedChange.d.ts.map +1 -1
- package/dist/shared-tree/serializedChange.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +11 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +9 -7
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +57 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -2
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +13 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +59 -13
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +24 -9
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +7 -0
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +4 -4
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -0
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -14
- 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 +11 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- 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 +4 -11
- 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/editManagerSummarizer.d.ts +4 -4
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +8 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +10 -10
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +6 -3
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.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 +2 -3
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +6 -7
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +48 -49
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +5 -6
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +2 -4
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +20 -7
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js +4 -7
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +6 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +91 -10
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +26 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +2 -2
- package/dist/text/codePointUtils.js +2 -2
- package/dist/text/codePointUtils.js.map +1 -1
- package/dist/text/index.d.ts +3 -3
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -4
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +30 -18
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +44 -23
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +180 -82
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +164 -84
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +48 -25
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +24 -19
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.d.ts +49 -0
- package/dist/treeDataStore.d.ts.map +1 -0
- package/dist/treeDataStore.js +57 -0
- package/dist/treeDataStore.js.map +1 -0
- package/dist/treeFactory.d.ts +8 -3
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +6 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/compressedIds.d.ts +22 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +22 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +15 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts +2 -3
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -2
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/change-family/index.d.ts +1 -1
- package/lib/core/change-family/index.d.ts.map +1 -1
- package/lib/core/change-family/index.js.map +1 -1
- package/lib/core/index.d.ts +4 -3
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +110 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +46 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/tree/delta.d.ts +62 -16
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +7 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +7 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +2 -4
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +2 -2
- package/lib/core/tree/visitorUtils.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 +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +94 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.js +6 -0
- package/lib/feature-libraries/comparison-forest/index.js.map +1 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +16 -4
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/invert.js +155 -0
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +16 -367
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +192 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.js +45 -0
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.d.ts +15 -0
- package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +62 -1
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- 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/serializedChange.d.ts +2 -2
- package/lib/shared-tree/serializedChange.d.ts.map +1 -1
- package/lib/shared-tree/serializedChange.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +11 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -8
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +55 -0
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +3 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +13 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +61 -15
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +24 -9
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +7 -0
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +4 -4
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -0
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -14
- 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 +11 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +8 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +10 -10
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +6 -3
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.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 +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +6 -7
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +46 -46
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +5 -6
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +2 -4
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +20 -7
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js +4 -7
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +6 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +93 -12
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +27 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +2 -2
- package/lib/text/codePointUtils.js +2 -2
- package/lib/text/codePointUtils.js.map +1 -1
- package/lib/text/index.d.ts +3 -3
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +3 -3
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +30 -18
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +41 -22
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +180 -82
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +165 -86
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +48 -25
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +25 -20
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/treeDataStore.d.ts +49 -0
- package/lib/treeDataStore.d.ts.map +1 -0
- package/lib/treeDataStore.js +52 -0
- package/lib/treeDataStore.js.map +1 -0
- package/lib/treeFactory.d.ts +8 -3
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +5 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/compressedIds.d.ts +22 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +22 -1
- package/lib/util/compressedIds.js.map +1 -1
- package/package.json +32 -24
- package/src/core/change-family/changeFamily.ts +32 -4
- package/src/core/change-family/editBuilder.ts +1 -2
- package/src/core/change-family/index.ts +2 -0
- package/src/core/index.ts +11 -6
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +113 -0
- package/src/core/tree/delta.ts +62 -16
- package/src/core/tree/detachedFieldIndex.ts +7 -38
- package/src/core/tree/index.ts +2 -0
- package/src/core/tree/visitorUtils.ts +3 -17
- package/src/entrypoints/alpha.ts +9 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -14
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +11 -1
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +140 -0
- package/src/feature-libraries/comparison-forest/index.ts +6 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +20 -6
- package/src/feature-libraries/default-schema/index.ts +1 -0
- package/src/feature-libraries/default-schema/noChangeCodecs.ts +11 -3
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +33 -5
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -3
- package/src/feature-libraries/index.ts +5 -0
- package/src/feature-libraries/mitigatedChangeFamily.ts +21 -3
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -1
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +9 -4
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/invert.ts +338 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +3 -5
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +16 -13
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +3 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +45 -644
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +340 -0
- package/src/feature-libraries/modular-schema/prune.ts +69 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +4 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +6 -3
- package/src/feature-libraries/treeTextCursor.ts +66 -1
- package/src/index.ts +11 -4
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/serializedChange.ts +2 -2
- package/src/shared-tree/sharedTree.ts +40 -15
- package/src/shared-tree/sharedTreeChangeCodecs.ts +11 -3
- package/src/shared-tree/sharedTreeChangeFamily.ts +77 -2
- package/src/shared-tree/transactionMinimize.ts +7 -3
- package/src/shared-tree/transactionPostProcessor.ts +5 -1
- package/src/shared-tree/treeCheckout.ts +136 -30
- package/src/shared-tree-core/branch.ts +41 -12
- package/src/shared-tree-core/editManager.ts +46 -25
- package/src/shared-tree-core/editManagerCodecs.ts +9 -21
- package/src/shared-tree-core/editManagerCodecsCommons.ts +14 -2
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +18 -21
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +18 -20
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -6
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -2
- package/src/shared-tree-core/messageCodecs.ts +12 -2
- package/src/shared-tree-core/sharedTreeCore.ts +16 -7
- package/src/shared-tree-core/transaction.ts +47 -25
- package/src/simple-tree/api/eraseSchemaDetails.ts +15 -0
- package/src/simple-tree/api/index.ts +0 -1
- package/src/simple-tree/api/schemaStatics.ts +2 -2
- package/src/simple-tree/api/treeNodeApi.ts +64 -48
- package/src/simple-tree/core/treeNode.ts +13 -10
- package/src/simple-tree/core/withType.ts +20 -7
- package/src/simple-tree/index.ts +1 -2
- package/src/simple-tree/leafNodeSchema.ts +6 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +130 -16
- package/src/simple-tree/node-kinds/map/mapNode.ts +137 -5
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
- package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
- package/src/text/README.md +1 -1
- package/src/text/codePointUtils.ts +2 -2
- package/src/text/index.ts +3 -3
- package/src/text/textDomain.ts +50 -27
- package/src/text/textDomainFormatted.ts +384 -163
- package/src/text/textDomainFormattedDefault.ts +32 -32
- package/src/treeDataStore.ts +125 -0
- package/src/treeFactory.ts +11 -3
- package/src/util/compressedIds.ts +36 -3
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import {
|
|
8
|
+
newChangeAtomIdRangeMap,
|
|
9
|
+
type ChangesetLocalId,
|
|
10
|
+
type FieldKey,
|
|
11
|
+
type FieldKindIdentifier,
|
|
12
|
+
type RevisionInfo,
|
|
13
|
+
type RevisionTag,
|
|
14
|
+
type TaggedChange,
|
|
15
|
+
type TreeChunk,
|
|
16
|
+
} from "../../core/index.js";
|
|
17
|
+
import { brand, type Mutable, type RangeQueryResult } from "../../util/index.js";
|
|
18
|
+
import {
|
|
19
|
+
getFromChangeAtomIdMap,
|
|
20
|
+
newChangeAtomIdBTree,
|
|
21
|
+
type ChangeAtomIdBTree,
|
|
22
|
+
} from "../changeAtomIdBTree.js";
|
|
23
|
+
import {
|
|
24
|
+
CrossFieldTarget,
|
|
25
|
+
getFirstFromCrossFieldMap,
|
|
26
|
+
setInCrossFieldMap,
|
|
27
|
+
type CrossFieldManager,
|
|
28
|
+
type CrossFieldMap,
|
|
29
|
+
} from "./crossFieldQueries.js";
|
|
30
|
+
import type { FieldChangeHandler } from "./fieldChangeHandler.js";
|
|
31
|
+
import { NodeAttachState } from "./fieldChangeHandler.js";
|
|
32
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
33
|
+
import { genericFieldKind } from "./genericFieldKind.js";
|
|
34
|
+
import {
|
|
35
|
+
newCrossFieldKeyTable,
|
|
36
|
+
type CrossFieldKeyTable,
|
|
37
|
+
type FieldChange,
|
|
38
|
+
type FieldChangeMap,
|
|
39
|
+
type FieldId,
|
|
40
|
+
type ModularChangeset,
|
|
41
|
+
type NoChangeConstraint,
|
|
42
|
+
type NodeChangeset,
|
|
43
|
+
type NodeId,
|
|
44
|
+
} from "./modularChangeTypes.js";
|
|
45
|
+
|
|
46
|
+
export function hasConflicts(change: ModularChangeset): boolean {
|
|
47
|
+
return (change.constraintViolationCount ?? 0) > 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function makeModularChangeset(props?: {
|
|
51
|
+
fieldChanges?: FieldChangeMap;
|
|
52
|
+
nodeChanges?: ChangeAtomIdBTree<NodeChangeset>;
|
|
53
|
+
nodeToParent?: ChangeAtomIdBTree<FieldId>;
|
|
54
|
+
nodeAliases?: ChangeAtomIdBTree<NodeId>;
|
|
55
|
+
crossFieldKeys?: CrossFieldKeyTable;
|
|
56
|
+
maxId: number;
|
|
57
|
+
revisions?: readonly RevisionInfo[];
|
|
58
|
+
constraintViolationCount?: number;
|
|
59
|
+
noChangeConstraint?: NoChangeConstraint;
|
|
60
|
+
noChangeConstraintOnRevert?: NoChangeConstraint;
|
|
61
|
+
builds?: ChangeAtomIdBTree<TreeChunk>;
|
|
62
|
+
destroys?: ChangeAtomIdBTree<number>;
|
|
63
|
+
refreshers?: ChangeAtomIdBTree<TreeChunk>;
|
|
64
|
+
}): ModularChangeset {
|
|
65
|
+
const p = props ?? { maxId: -1 };
|
|
66
|
+
const changeset: Mutable<ModularChangeset> = {
|
|
67
|
+
fieldChanges: p.fieldChanges ?? new Map<FieldKey, FieldChange>(),
|
|
68
|
+
nodeChanges: p.nodeChanges ?? newChangeAtomIdBTree(),
|
|
69
|
+
nodeToParent: p.nodeToParent ?? newChangeAtomIdBTree(),
|
|
70
|
+
nodeAliases: p.nodeAliases ?? newChangeAtomIdBTree(),
|
|
71
|
+
crossFieldKeys: p.crossFieldKeys ?? newCrossFieldKeyTable(),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
if (p.revisions !== undefined && p.revisions.length > 0) {
|
|
75
|
+
changeset.revisions = p.revisions;
|
|
76
|
+
}
|
|
77
|
+
if (p.maxId >= 0) {
|
|
78
|
+
changeset.maxId = brand(p.maxId);
|
|
79
|
+
}
|
|
80
|
+
if (p.constraintViolationCount !== undefined && p.constraintViolationCount > 0) {
|
|
81
|
+
changeset.constraintViolationCount = p.constraintViolationCount;
|
|
82
|
+
}
|
|
83
|
+
if (p.noChangeConstraint !== undefined) {
|
|
84
|
+
changeset.noChangeConstraint = p.noChangeConstraint;
|
|
85
|
+
}
|
|
86
|
+
if (p.noChangeConstraintOnRevert !== undefined) {
|
|
87
|
+
changeset.noChangeConstraintOnRevert = p.noChangeConstraintOnRevert;
|
|
88
|
+
}
|
|
89
|
+
if (p.builds !== undefined && p.builds.size > 0) {
|
|
90
|
+
changeset.builds = p.builds;
|
|
91
|
+
}
|
|
92
|
+
if (p.destroys !== undefined && p.destroys.size > 0) {
|
|
93
|
+
changeset.destroys = p.destroys;
|
|
94
|
+
}
|
|
95
|
+
if (p.refreshers !== undefined && p.refreshers.size > 0) {
|
|
96
|
+
changeset.refreshers = p.refreshers;
|
|
97
|
+
}
|
|
98
|
+
return changeset;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// TODO: TFieldData could instead just be a numeric ID generated by the CrossFieldTable
|
|
102
|
+
// The CrossFieldTable could have a generic field ID to context table
|
|
103
|
+
export interface CrossFieldTable<TFieldData> {
|
|
104
|
+
srcTable: CrossFieldMap<unknown>;
|
|
105
|
+
dstTable: CrossFieldMap<unknown>;
|
|
106
|
+
srcDependents: CrossFieldMap<TFieldData>;
|
|
107
|
+
dstDependents: CrossFieldMap<TFieldData>;
|
|
108
|
+
invalidatedFields: Set<TFieldData>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export abstract class CrossFieldManagerI<T> implements CrossFieldManager {
|
|
112
|
+
public constructor(
|
|
113
|
+
protected readonly crossFieldTable: CrossFieldTable<T>,
|
|
114
|
+
private readonly currentFieldKey: T,
|
|
115
|
+
protected readonly allowInval = true,
|
|
116
|
+
) {}
|
|
117
|
+
|
|
118
|
+
public set(
|
|
119
|
+
target: CrossFieldTarget,
|
|
120
|
+
revision: RevisionTag | undefined,
|
|
121
|
+
id: ChangesetLocalId,
|
|
122
|
+
count: number,
|
|
123
|
+
newValue: unknown,
|
|
124
|
+
invalidateDependents: boolean,
|
|
125
|
+
): void {
|
|
126
|
+
if (invalidateDependents && this.allowInval) {
|
|
127
|
+
const lastChangedId = (id as number) + count - 1;
|
|
128
|
+
let firstId = id;
|
|
129
|
+
while (firstId <= lastChangedId) {
|
|
130
|
+
const dependentEntry = getFirstFromCrossFieldMap(
|
|
131
|
+
this.getDependents(target),
|
|
132
|
+
revision,
|
|
133
|
+
firstId,
|
|
134
|
+
lastChangedId - firstId + 1,
|
|
135
|
+
);
|
|
136
|
+
if (dependentEntry.value !== undefined) {
|
|
137
|
+
this.crossFieldTable.invalidatedFields.add(dependentEntry.value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
firstId = brand(firstId + dependentEntry.length);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
setInCrossFieldMap(this.getMap(target), revision, id, count, newValue);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public get(
|
|
147
|
+
target: CrossFieldTarget,
|
|
148
|
+
revision: RevisionTag | undefined,
|
|
149
|
+
id: ChangesetLocalId,
|
|
150
|
+
count: number,
|
|
151
|
+
addDependency: boolean,
|
|
152
|
+
): RangeQueryResult<unknown> {
|
|
153
|
+
if (addDependency) {
|
|
154
|
+
// We assume that if there is already an entry for this ID it is because
|
|
155
|
+
// a field handler has called compose on the same node multiple times.
|
|
156
|
+
// In this case we only want to update the latest version, so we overwrite the dependency.
|
|
157
|
+
setInCrossFieldMap(
|
|
158
|
+
this.getDependents(target),
|
|
159
|
+
revision,
|
|
160
|
+
id,
|
|
161
|
+
count,
|
|
162
|
+
this.currentFieldKey,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return getFirstFromCrossFieldMap(this.getMap(target), revision, id, count);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public abstract onMoveIn(id: NodeId): void;
|
|
169
|
+
|
|
170
|
+
public abstract moveKey(
|
|
171
|
+
target: CrossFieldTarget,
|
|
172
|
+
revision: RevisionTag | undefined,
|
|
173
|
+
id: ChangesetLocalId,
|
|
174
|
+
count: number,
|
|
175
|
+
): void;
|
|
176
|
+
|
|
177
|
+
private getMap(target: CrossFieldTarget): CrossFieldMap<unknown> {
|
|
178
|
+
return target === CrossFieldTarget.Source
|
|
179
|
+
? this.crossFieldTable.srcTable
|
|
180
|
+
: this.crossFieldTable.dstTable;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private getDependents(target: CrossFieldTarget): CrossFieldMap<T> {
|
|
184
|
+
return target === CrossFieldTarget.Source
|
|
185
|
+
? this.crossFieldTable.srcDependents
|
|
186
|
+
: this.crossFieldTable.dstDependents;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function newCrossFieldTable<T>(): CrossFieldTable<T> {
|
|
191
|
+
return {
|
|
192
|
+
srcTable: newChangeAtomIdRangeMap(),
|
|
193
|
+
dstTable: newChangeAtomIdRangeMap(),
|
|
194
|
+
srcDependents: newChangeAtomIdRangeMap(),
|
|
195
|
+
dstDependents: newChangeAtomIdRangeMap(),
|
|
196
|
+
invalidatedFields: new Set(),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {
|
|
201
|
+
revInfos: RevisionInfo[];
|
|
202
|
+
maxId: ChangesetLocalId;
|
|
203
|
+
} {
|
|
204
|
+
let maxId = -1;
|
|
205
|
+
const revInfos: RevisionInfo[] = [];
|
|
206
|
+
const revisions = new Set<RevisionTag>();
|
|
207
|
+
for (const taggedChange of changes) {
|
|
208
|
+
const change = taggedChange.change;
|
|
209
|
+
maxId = Math.max(change.maxId ?? -1, maxId);
|
|
210
|
+
const infosToAdd = revisionInfoFromTaggedChange(taggedChange);
|
|
211
|
+
for (const info of infosToAdd) {
|
|
212
|
+
if (!revisions.has(info.revision)) {
|
|
213
|
+
revisions.add(info.revision);
|
|
214
|
+
revInfos.push(info);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const rolledBackRevisions: RevisionTag[] = [];
|
|
220
|
+
for (const info of revInfos) {
|
|
221
|
+
if (info.rollbackOf !== undefined) {
|
|
222
|
+
rolledBackRevisions.push(info.rollbackOf);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
rolledBackRevisions.reverse();
|
|
227
|
+
for (const revision of rolledBackRevisions) {
|
|
228
|
+
if (!revisions.has(revision)) {
|
|
229
|
+
revInfos.push({ revision });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return { maxId: brand(maxId), revInfos };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function revisionInfoFromTaggedChange(
|
|
237
|
+
taggedChange: TaggedChange<ModularChangeset>,
|
|
238
|
+
): RevisionInfo[] {
|
|
239
|
+
const revInfos: RevisionInfo[] = [];
|
|
240
|
+
if (taggedChange.change.revisions !== undefined) {
|
|
241
|
+
revInfos.push(...taggedChange.change.revisions);
|
|
242
|
+
} else if (taggedChange.revision !== undefined) {
|
|
243
|
+
const info: Mutable<RevisionInfo> = { revision: taggedChange.revision };
|
|
244
|
+
if (taggedChange.rollbackOf !== undefined) {
|
|
245
|
+
info.rollbackOf = taggedChange.rollbackOf;
|
|
246
|
+
}
|
|
247
|
+
revInfos.push(info);
|
|
248
|
+
}
|
|
249
|
+
return revInfos;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function getChangeHandler(
|
|
253
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
254
|
+
kind: FieldKindIdentifier,
|
|
255
|
+
): FieldChangeHandler<unknown> {
|
|
256
|
+
return getFieldKind(fieldKinds, kind).changeHandler;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function getFieldKind(
|
|
260
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
261
|
+
kind: FieldKindIdentifier,
|
|
262
|
+
): FlexFieldKind {
|
|
263
|
+
if (kind === genericFieldKind.identifier) {
|
|
264
|
+
return genericFieldKind;
|
|
265
|
+
}
|
|
266
|
+
const fieldKind = fieldKinds.get(kind);
|
|
267
|
+
assert(fieldKind !== undefined, 0x3ad /* Unknown field kind */);
|
|
268
|
+
return fieldKind;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface ConstraintState {
|
|
272
|
+
violationCount: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export function newConstraintState(violationCount: number): ConstraintState {
|
|
276
|
+
return {
|
|
277
|
+
violationCount,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export function updateConstraintsForFields(
|
|
282
|
+
fields: FieldChangeMap,
|
|
283
|
+
parentInputAttachState: NodeAttachState,
|
|
284
|
+
constraintState: ConstraintState,
|
|
285
|
+
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
286
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
287
|
+
): void {
|
|
288
|
+
for (const field of fields.values()) {
|
|
289
|
+
const handler = getChangeHandler(fieldKinds, field.fieldKind);
|
|
290
|
+
for (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(field.change)) {
|
|
291
|
+
const isInputDetached = inputIndex === undefined;
|
|
292
|
+
const inputAttachState =
|
|
293
|
+
parentInputAttachState === NodeAttachState.Detached || isInputDetached
|
|
294
|
+
? NodeAttachState.Detached
|
|
295
|
+
: NodeAttachState.Attached;
|
|
296
|
+
|
|
297
|
+
updateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState, fieldKinds);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function updateConstraintsForNode(
|
|
303
|
+
nodeId: NodeId,
|
|
304
|
+
inputAttachState: NodeAttachState,
|
|
305
|
+
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
306
|
+
constraintState: ConstraintState,
|
|
307
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
308
|
+
): void {
|
|
309
|
+
const node =
|
|
310
|
+
nodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);
|
|
311
|
+
if (node.nodeExistsConstraint !== undefined) {
|
|
312
|
+
const isNowViolated = inputAttachState === NodeAttachState.Detached;
|
|
313
|
+
if (node.nodeExistsConstraint.violated !== isNowViolated) {
|
|
314
|
+
node.nodeExistsConstraint = {
|
|
315
|
+
...node.nodeExistsConstraint,
|
|
316
|
+
violated: isNowViolated,
|
|
317
|
+
};
|
|
318
|
+
constraintState.violationCount += isNowViolated ? 1 : -1;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (node.fieldChanges !== undefined) {
|
|
323
|
+
updateConstraintsForFields(
|
|
324
|
+
node.fieldChanges,
|
|
325
|
+
inputAttachState,
|
|
326
|
+
constraintState,
|
|
327
|
+
nodes,
|
|
328
|
+
fieldKinds,
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function nodeChangeFromId(
|
|
334
|
+
nodes: ChangeAtomIdBTree<NodeChangeset>,
|
|
335
|
+
id: NodeId,
|
|
336
|
+
): NodeChangeset {
|
|
337
|
+
const node = getFromChangeAtomIdMap(nodes, id);
|
|
338
|
+
assert(node !== undefined, 0x9ca /* Unknown node ID */);
|
|
339
|
+
return node;
|
|
340
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FieldKindIdentifier } from "../../core/index.js";
|
|
7
|
+
import { brand } from "../../util/index.js";
|
|
8
|
+
import { setInChangeAtomIdMap, type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
|
|
9
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
10
|
+
import type { FieldChangeMap, NodeChangeset, NodeId } from "./modularChangeTypes.js";
|
|
11
|
+
import { getChangeHandler, nodeChangeFromId } from "./modularChangeUtils.js";
|
|
12
|
+
|
|
13
|
+
export function pruneFieldMap(
|
|
14
|
+
changeset: FieldChangeMap | undefined,
|
|
15
|
+
nodeMap: ChangeAtomIdBTree<NodeChangeset>,
|
|
16
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
17
|
+
): FieldChangeMap | undefined {
|
|
18
|
+
if (changeset === undefined) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const prunedChangeset: FieldChangeMap = new Map();
|
|
23
|
+
for (const [field, fieldChange] of changeset) {
|
|
24
|
+
const handler = getChangeHandler(fieldKinds, fieldChange.fieldKind);
|
|
25
|
+
|
|
26
|
+
const prunedFieldChangeset = handler.rebaser.prune(fieldChange.change, (nodeId) =>
|
|
27
|
+
pruneNodeChange(nodeId, nodeMap, fieldKinds),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (!handler.isEmpty(prunedFieldChangeset)) {
|
|
31
|
+
prunedChangeset.set(field, { ...fieldChange, change: brand(prunedFieldChangeset) });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return prunedChangeset.size > 0 ? prunedChangeset : undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function pruneNodeChange(
|
|
39
|
+
nodeId: NodeId,
|
|
40
|
+
nodeMap: ChangeAtomIdBTree<NodeChangeset>,
|
|
41
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
42
|
+
): NodeId | undefined {
|
|
43
|
+
const changeset = nodeChangeFromId(nodeMap, nodeId);
|
|
44
|
+
const prunedFields =
|
|
45
|
+
changeset.fieldChanges === undefined
|
|
46
|
+
? undefined
|
|
47
|
+
: pruneFieldMap(changeset.fieldChanges, nodeMap, fieldKinds);
|
|
48
|
+
|
|
49
|
+
const prunedChange = { ...changeset, fieldChanges: prunedFields };
|
|
50
|
+
if (prunedChange.fieldChanges === undefined) {
|
|
51
|
+
delete prunedChange.fieldChanges;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (isEmptyNodeChangeset(prunedChange)) {
|
|
55
|
+
nodeMap.delete([nodeId.revision, nodeId.localId]);
|
|
56
|
+
return undefined;
|
|
57
|
+
} else {
|
|
58
|
+
setInChangeAtomIdMap(nodeMap, nodeId, prunedChange);
|
|
59
|
+
return nodeId;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isEmptyNodeChangeset(change: NodeChangeset): boolean {
|
|
64
|
+
return (
|
|
65
|
+
change.fieldChanges === undefined &&
|
|
66
|
+
change.nodeExistsConstraint === undefined &&
|
|
67
|
+
change.nodeExistsConstraintOnRevert === undefined
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -16,6 +16,7 @@ import type { Mutable } from "../../util/index.js";
|
|
|
16
16
|
import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
|
|
17
17
|
import type {
|
|
18
18
|
FieldChangeEncodingContext,
|
|
19
|
+
FieldChangeDecodingContext,
|
|
19
20
|
EncodedChangeAtomId,
|
|
20
21
|
} from "../modular-schema/index.js";
|
|
21
22
|
import { EncodedNodeChangeset } from "../modular-schema/index.js";
|
|
@@ -57,7 +58,8 @@ export function makeOptionalFieldCodec(
|
|
|
57
58
|
OptionalChangeset,
|
|
58
59
|
EncodedOptionalChangeset<TAnySchema>,
|
|
59
60
|
EncodedOptionalChangeset<TAnySchema>,
|
|
60
|
-
FieldChangeEncodingContext
|
|
61
|
+
FieldChangeEncodingContext,
|
|
62
|
+
FieldChangeDecodingContext
|
|
61
63
|
> {
|
|
62
64
|
const changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);
|
|
63
65
|
const registerIdCodec = makeRegisterIdCodec(changeAtomIdCodec);
|
|
@@ -98,7 +100,7 @@ export function makeOptionalFieldCodec(
|
|
|
98
100
|
|
|
99
101
|
decode: (
|
|
100
102
|
encoded: EncodedOptionalChangeset<TAnySchema>,
|
|
101
|
-
context:
|
|
103
|
+
context: FieldChangeDecodingContext,
|
|
102
104
|
) => {
|
|
103
105
|
const decoded: Mutable<OptionalChangeset> = {
|
|
104
106
|
moves:
|
|
@@ -9,7 +9,10 @@ import type {
|
|
|
9
9
|
RevisionTag,
|
|
10
10
|
RevisionTagSchema,
|
|
11
11
|
} from "../../core/index.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
FieldChangeEncodingContext,
|
|
14
|
+
FieldChangeDecodingContext,
|
|
15
|
+
} from "../modular-schema/index.js";
|
|
13
16
|
|
|
14
17
|
import type { OptionalChangeset } from "./optionalFieldChangeTypes.js";
|
|
15
18
|
import { makeOptionalFieldCodec as makeV2Codec } from "./optionalFieldCodecV2.js";
|
|
@@ -20,5 +23,5 @@ export const makeOptionalFieldCodecFamily = (
|
|
|
20
23
|
typeof RevisionTagSchema,
|
|
21
24
|
ChangeEncodingContext
|
|
22
25
|
>,
|
|
23
|
-
): ICodecFamily<OptionalChangeset, FieldChangeEncodingContext> =>
|
|
26
|
+
): ICodecFamily<OptionalChangeset, FieldChangeEncodingContext, FieldChangeDecodingContext> =>
|
|
24
27
|
makeCodecFamily([[2, makeV2Codec(revisionTagCodec)]]);
|
|
@@ -24,6 +24,7 @@ import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
|
|
|
24
24
|
import {
|
|
25
25
|
EncodedNodeChangeset,
|
|
26
26
|
type FieldChangeEncodingContext,
|
|
27
|
+
type FieldChangeDecodingContext,
|
|
27
28
|
} from "../modular-schema/index.js";
|
|
28
29
|
|
|
29
30
|
import { Changeset as ChangesetSchema, type Encoded } from "./formatV2.js";
|
|
@@ -271,7 +272,8 @@ export function makeV2Codec(
|
|
|
271
272
|
Changeset,
|
|
272
273
|
JsonCompatibleReadOnly,
|
|
273
274
|
JsonCompatibleReadOnly,
|
|
274
|
-
FieldChangeEncodingContext
|
|
275
|
+
FieldChangeEncodingContext,
|
|
276
|
+
FieldChangeDecodingContext
|
|
275
277
|
> {
|
|
276
278
|
const { markEffectCodec, changeAtomIdCodec } = makeV2CodecHelpers(revisionTagCodec);
|
|
277
279
|
/**
|
|
@@ -305,7 +307,7 @@ export function makeV2Codec(
|
|
|
305
307
|
},
|
|
306
308
|
decode: (
|
|
307
309
|
changeset: Encoded.Changeset<NodeChangeSchema>,
|
|
308
|
-
context:
|
|
310
|
+
context: FieldChangeDecodingContext,
|
|
309
311
|
): Changeset => {
|
|
310
312
|
const marks: Changeset = [];
|
|
311
313
|
for (const mark of changeset) {
|
|
@@ -19,6 +19,7 @@ import type { JsonCompatibleReadOnly } from "../../util/index.js";
|
|
|
19
19
|
import {
|
|
20
20
|
EncodedNodeChangeset,
|
|
21
21
|
type FieldChangeEncodingContext,
|
|
22
|
+
type FieldChangeDecodingContext,
|
|
22
23
|
} from "../modular-schema/index.js";
|
|
23
24
|
|
|
24
25
|
import { Changeset as ChangesetSchema, type Encoded } from "./formatV3.js";
|
|
@@ -36,7 +37,8 @@ export function makeV3Codec(
|
|
|
36
37
|
Changeset,
|
|
37
38
|
JsonCompatibleReadOnly,
|
|
38
39
|
JsonCompatibleReadOnly,
|
|
39
|
-
FieldChangeEncodingContext
|
|
40
|
+
FieldChangeEncodingContext,
|
|
41
|
+
FieldChangeDecodingContext
|
|
40
42
|
> {
|
|
41
43
|
const {
|
|
42
44
|
changeAtomIdCodec: atomIdCodec,
|
|
@@ -115,7 +117,7 @@ export function makeV3Codec(
|
|
|
115
117
|
},
|
|
116
118
|
decode: (
|
|
117
119
|
changeset: Encoded.Changeset<NodeChangeSchema>,
|
|
118
|
-
context:
|
|
120
|
+
context: FieldChangeDecodingContext,
|
|
119
121
|
): Changeset => {
|
|
120
122
|
const marks: Changeset = [];
|
|
121
123
|
for (const mark of changeset) {
|
|
@@ -9,7 +9,10 @@ import type {
|
|
|
9
9
|
RevisionTag,
|
|
10
10
|
RevisionTagSchema,
|
|
11
11
|
} from "../../core/index.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
FieldChangeEncodingContext,
|
|
14
|
+
FieldChangeDecodingContext,
|
|
15
|
+
} from "../modular-schema/index.js";
|
|
13
16
|
|
|
14
17
|
import { makeV2Codec } from "./sequenceFieldCodecV2.js";
|
|
15
18
|
import { makeV3Codec } from "./sequenceFieldCodecV3.js";
|
|
@@ -21,8 +24,8 @@ export const sequenceFieldChangeCodecFactory = (
|
|
|
21
24
|
typeof RevisionTagSchema,
|
|
22
25
|
ChangeEncodingContext
|
|
23
26
|
>,
|
|
24
|
-
): ICodecFamily<MarkList, FieldChangeEncodingContext> =>
|
|
25
|
-
makeCodecFamily<Changeset, FieldChangeEncodingContext>([
|
|
27
|
+
): ICodecFamily<MarkList, FieldChangeEncodingContext, FieldChangeDecodingContext> =>
|
|
28
|
+
makeCodecFamily<Changeset, FieldChangeEncodingContext, FieldChangeDecodingContext>([
|
|
26
29
|
[2, makeV2Codec(revisionTagCodec)],
|
|
27
30
|
[3, makeV3Codec(revisionTagCodec)],
|
|
28
31
|
]);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, fail, oob } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
CursorLocationType,
|
|
@@ -132,3 +132,68 @@ export function jsonableTreeFromForest(forest: IForestSubscription): JsonableTre
|
|
|
132
132
|
readCursor.free();
|
|
133
133
|
return jsonable;
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The full content of `forest` (every detached/removed field) as a single {@link JsonableTree}.
|
|
138
|
+
* @remarks
|
|
139
|
+
* The returned node is the forest's above-root placeholder: its fields are the forest's detached fields.
|
|
140
|
+
* Only content is captured: schema, anchors and other forest state are not.
|
|
141
|
+
*/
|
|
142
|
+
function forestContent(forest: IForestSubscription): JsonableTree {
|
|
143
|
+
return jsonableTreeFromCursor(forest.getCursorAboveDetachedFields());
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Structural equality of two {@link JsonableTree}s, comparing type, value and fields recursively.
|
|
148
|
+
* @remarks
|
|
149
|
+
* Fields are compared as an unordered set of keys, so this is independent of the order in which different
|
|
150
|
+
* forest implementations enumerate fields. The nodes within each field are compared in order.
|
|
151
|
+
*/
|
|
152
|
+
function treesEqual(a: JsonableTree, b: JsonableTree): boolean {
|
|
153
|
+
if (a.type !== b.type || !Object.is(a.value, b.value)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
// JsonableTree never stores empty fields, so equal key counts plus a matching field for every key in
|
|
157
|
+
// `a` implies `b` has no extra fields.
|
|
158
|
+
const aKeys = genericTreeKeys(a);
|
|
159
|
+
if (aKeys.length !== genericTreeKeys(b).length) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
for (const key of aKeys) {
|
|
163
|
+
const aField = getGenericTreeField(a, key, false);
|
|
164
|
+
const bField = getGenericTreeField(b, key, false);
|
|
165
|
+
if (aField.length !== bField.length) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
for (const [index, aChild] of aField.entries()) {
|
|
169
|
+
const bChild = bField[index] ?? oob();
|
|
170
|
+
if (!treesEqual(aChild, bChild)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Returns true if `a` and `b` have identical content, including all detached/removed fields.
|
|
180
|
+
* @remarks
|
|
181
|
+
* Only content is compared: schema, anchors and other forest state are ignored.
|
|
182
|
+
* This is intended for debugging and testing, and is not optimized.
|
|
183
|
+
*/
|
|
184
|
+
export function forestsEqual(a: IForestSubscription, b: IForestSubscription): boolean {
|
|
185
|
+
return treesEqual(forestContent(a), forestContent(b));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Asserts that `a` and `b` have identical content, including all detached/removed fields.
|
|
190
|
+
* @remarks
|
|
191
|
+
* Only content is compared: schema, anchors and other forest state are ignored.
|
|
192
|
+
* This is intended for debugging and testing, and is not optimized.
|
|
193
|
+
* @throws an Error if the forests differ.
|
|
194
|
+
*/
|
|
195
|
+
export function assertForestsEqual(a: IForestSubscription, b: IForestSubscription): void {
|
|
196
|
+
if (!forestsEqual(a, b)) {
|
|
197
|
+
fail(0xd10 /* Forests are not equal */);
|
|
198
|
+
}
|
|
199
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ export {
|
|
|
12
12
|
CommitKind,
|
|
13
13
|
RevertibleStatus,
|
|
14
14
|
type CommitMetadata,
|
|
15
|
+
CommitOutcome,
|
|
16
|
+
type LocalCommitEvents,
|
|
15
17
|
type LocalChangeMetadata,
|
|
16
18
|
type RemoteChangeMetadata,
|
|
17
19
|
type ChangeMetadata,
|
|
@@ -300,6 +302,7 @@ export {
|
|
|
300
302
|
type HandleConverter,
|
|
301
303
|
allowUnused,
|
|
302
304
|
type LeafSchema,
|
|
305
|
+
type StringSchema,
|
|
303
306
|
type ArrayNodeCustomizableSchema,
|
|
304
307
|
type ArrayNodeCustomizableSchemaAlpha,
|
|
305
308
|
type ArrayNodePojoEmulationSchema,
|
|
@@ -344,6 +347,7 @@ export {
|
|
|
344
347
|
} from "./simple-tree/index.js";
|
|
345
348
|
export {
|
|
346
349
|
SharedTree,
|
|
350
|
+
SharedTreeAlpha,
|
|
347
351
|
configuredSharedTree,
|
|
348
352
|
configuredSharedTreeAlpha,
|
|
349
353
|
configuredSharedTreeBeta,
|
|
@@ -403,7 +407,7 @@ import * as InternalTypes from "./internalTypes.js";
|
|
|
403
407
|
export { InternalTypes };
|
|
404
408
|
|
|
405
409
|
// Internal/System types:
|
|
406
|
-
// These would be put in `internalTypes` except doing so
|
|
410
|
+
// These would be put in `internalTypes` except doing so tends to cause errors like:
|
|
407
411
|
// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.
|
|
408
412
|
export type { MapNodeInsertableData } from "./simple-tree/index.js";
|
|
409
413
|
|
|
@@ -413,11 +417,14 @@ export { TableSchema, type System_TableSchema } from "./tableSchema.js";
|
|
|
413
417
|
export { asAlpha, asBeta } from "./api.js";
|
|
414
418
|
|
|
415
419
|
export {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
420
|
+
PlainText,
|
|
421
|
+
FormattedText,
|
|
422
|
+
FormattedTextDefault,
|
|
419
423
|
codePointCount,
|
|
420
424
|
utf16LengthForCodePoints,
|
|
421
425
|
} from "./text/index.js";
|
|
422
426
|
export { ExtensibleUnionNode } from "./extensibleUnionNode.js";
|
|
423
427
|
export { Component } from "./componentApi.js";
|
|
428
|
+
|
|
429
|
+
export { defineTreeDataStore, instantiateTreeFirstTime } from "./treeDataStore.js";
|
|
430
|
+
export type { TreeDataStoreOptions } from "./treeDataStore.js";
|
package/src/packageVersion.ts
CHANGED
|
@@ -48,7 +48,7 @@ function isSerializedChangeV1(value: unknown): value is SerializedChange {
|
|
|
48
48
|
|
|
49
49
|
function encodeSerializedChangeV1(
|
|
50
50
|
idCompressor: IIdCompressor,
|
|
51
|
-
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
|
|
51
|
+
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange, unknown>,
|
|
52
52
|
change: SharedTreeChange,
|
|
53
53
|
changeRevision: RevisionTag,
|
|
54
54
|
contextRevision?: RevisionTag,
|
|
@@ -73,7 +73,7 @@ function encodeSerializedChangeV1(
|
|
|
73
73
|
|
|
74
74
|
function decodeSerializedChangeV1(
|
|
75
75
|
idCompressor: IIdCompressor,
|
|
76
|
-
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
|
|
76
|
+
changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange, unknown>,
|
|
77
77
|
serializedChange: JsonCompatibleReadOnly,
|
|
78
78
|
): TaggedChange<SharedTreeChange> {
|
|
79
79
|
if (!isSerializedChangeV1(serializedChange)) {
|