@fluidframework/tree 2.13.0 → 2.21.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 +22 -0
- package/api-report/tree.alpha.api.md +22 -12
- package/api-report/tree.beta.api.md +9 -5
- package/api-report/tree.legacy.alpha.api.md +15 -5
- package/api-report/tree.legacy.public.api.md +9 -5
- package/api-report/tree.public.api.md +9 -5
- package/assertTagging.config.mjs +14 -0
- package/dist/alpha.d.ts +3 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +5 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +5 -4
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +29 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +22 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/delta.d.ts +21 -26
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +1 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -14
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +1 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +82 -80
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +13 -0
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
- 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/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modularChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +105 -199
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +4 -4
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +36 -4
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +5 -2
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +3 -1
- package/dist/package.json +2 -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/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +7 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/publicContracts.d.ts +18 -0
- package/dist/shared-tree/publicContracts.d.ts.map +1 -0
- package/dist/shared-tree/publicContracts.js +24 -0
- package/dist/shared-tree/publicContracts.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +38 -18
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +41 -40
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +12 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +2 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +2 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +4 -0
- 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/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/arrayNode.js +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -2
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -6
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +10 -13
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/proxies.js +1 -1
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +10 -0
- package/dist/util/bTreeUtils.d.ts.map +1 -0
- package/dist/util/bTreeUtils.js +52 -0
- package/dist/util/bTreeUtils.js.map +1 -0
- package/dist/util/idAllocator.d.ts +0 -2
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +0 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +5 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +61 -30
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +189 -117
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +4 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +7 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +3 -0
- package/lib/core/index.d.ts +2 -2
- 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 +2 -2
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +2 -2
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +5 -4
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +26 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +20 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/delta.d.ts +21 -26
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +1 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -12
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +82 -80
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +13 -0
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
- 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/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modularChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +74 -166
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +4 -4
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +36 -4
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +6 -3
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +26 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +3 -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/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/publicContracts.d.ts +18 -0
- package/lib/shared-tree/publicContracts.d.ts.map +1 -0
- package/lib/shared-tree/publicContracts.js +21 -0
- package/lib/shared-tree/publicContracts.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +38 -18
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +40 -39
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +13 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +2 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +4 -0
- 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/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/arrayNode.js +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +2 -2
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -6
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +9 -11
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/proxies.js +2 -2
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +10 -0
- package/lib/util/bTreeUtils.d.ts.map +1 -0
- package/lib/util/bTreeUtils.js +47 -0
- package/lib/util/bTreeUtils.js.map +1 -0
- package/lib/util/idAllocator.d.ts +0 -2
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +0 -2
- package/lib/util/idAllocator.js.map +1 -1
- 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 +61 -30
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +188 -117
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +4 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +7 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +25 -25
- package/src/core/index.ts +5 -2
- package/src/core/rebase/index.ts +5 -0
- package/src/core/rebase/types.ts +33 -5
- package/src/core/rebase/utils.ts +27 -0
- package/src/core/tree/delta.ts +21 -26
- package/src/core/tree/deltaUtil.ts +1 -16
- package/src/core/tree/index.ts +0 -2
- package/src/core/tree/visitDelta.ts +108 -97
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
- package/src/feature-libraries/deltaUtils.ts +13 -0
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +21 -1
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +2 -2
- package/src/feature-libraries/modular-schema/index.ts +2 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +138 -225
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +40 -27
- package/src/feature-libraries/optional-field/optionalField.ts +3 -3
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/rebase.ts +9 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
- package/src/feature-libraries/sequence-field/utils.ts +36 -4
- package/src/feature-libraries/treeCursorUtils.ts +10 -3
- package/src/index.ts +36 -6
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +9 -1
- package/src/shared-tree/publicContracts.ts +24 -0
- package/src/shared-tree/sharedTree.ts +63 -46
- package/src/shared-tree/treeCheckout.ts +19 -12
- package/src/simple-tree/api/schemaFactory.ts +2 -0
- package/src/simple-tree/api/tree.ts +4 -0
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/arrayNode.ts +1 -1
- package/src/simple-tree/core/getOrCreateNode.ts +6 -2
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +16 -14
- package/src/simple-tree/proxies.ts +2 -2
- package/src/simple-tree/toMapTree.ts +1 -1
- package/src/util/bTreeUtils.ts +60 -0
- package/src/util/idAllocator.ts +0 -2
- package/src/util/index.ts +3 -0
- package/src/util/rangeMap.ts +237 -143
- package/src/util/utils.ts +10 -3
- package/lib/package.json +0 -3
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
type ChangesetLocalId,
|
|
12
12
|
type DeltaDetachedNodeChanges,
|
|
13
13
|
type DeltaDetachedNodeId,
|
|
14
|
-
type DeltaFieldChanges,
|
|
15
14
|
type DeltaMark,
|
|
16
15
|
type RevisionTag,
|
|
17
16
|
areEqualChangeAtomIds,
|
|
@@ -40,6 +39,7 @@ import {
|
|
|
40
39
|
type RelevantRemovedRootsFromChild,
|
|
41
40
|
type ToDelta,
|
|
42
41
|
type NestedChangesIndices,
|
|
42
|
+
type FieldChangeDelta,
|
|
43
43
|
} from "../modular-schema/index.js";
|
|
44
44
|
|
|
45
45
|
import type {
|
|
@@ -657,8 +657,8 @@ export const optionalFieldEditor: OptionalFieldEditor = {
|
|
|
657
657
|
export function optionalFieldIntoDelta(
|
|
658
658
|
change: OptionalChangeset,
|
|
659
659
|
deltaFromChild: ToDelta,
|
|
660
|
-
):
|
|
661
|
-
const delta: Mutable<
|
|
660
|
+
): FieldChangeDelta {
|
|
661
|
+
const delta: Mutable<FieldChangeDelta> = {};
|
|
662
662
|
|
|
663
663
|
let markIsANoop = true;
|
|
664
664
|
const mark: Mutable<DeltaMark> = { count: 1 };
|
|
@@ -101,7 +101,7 @@ export function getMoveEffect(
|
|
|
101
101
|
id: MoveId,
|
|
102
102
|
count: number,
|
|
103
103
|
addDependency: boolean = true,
|
|
104
|
-
): RangeQueryResult<MoveEffect> {
|
|
104
|
+
): RangeQueryResult<ChangeAtomId, MoveEffect> {
|
|
105
105
|
const result = moveEffects.get(target, revision, id, count, addDependency);
|
|
106
106
|
return result.value !== undefined
|
|
107
107
|
? { ...result, value: adjustMoveEffectBasis(result.value as MoveEffectWithBasis, id) }
|
|
@@ -545,9 +545,14 @@ function getMovedChangesFromBaseMark(
|
|
|
545
545
|
baseMark: Mark,
|
|
546
546
|
): NodeId | undefined {
|
|
547
547
|
if (isMoveIn(baseMark)) {
|
|
548
|
-
return getMovedNodeChanges(moveEffects, baseMark.revision, baseMark.id);
|
|
548
|
+
return getMovedNodeChanges(moveEffects, baseMark.revision, baseMark.id, baseMark.count);
|
|
549
549
|
} else if (isAttachAndDetachEffect(baseMark) && isMoveIn(baseMark.attach)) {
|
|
550
|
-
return getMovedNodeChanges(
|
|
550
|
+
return getMovedNodeChanges(
|
|
551
|
+
moveEffects,
|
|
552
|
+
baseMark.attach.revision,
|
|
553
|
+
baseMark.attach.id,
|
|
554
|
+
baseMark.count,
|
|
555
|
+
);
|
|
551
556
|
} else {
|
|
552
557
|
return undefined;
|
|
553
558
|
}
|
|
@@ -557,7 +562,8 @@ function getMovedNodeChanges(
|
|
|
557
562
|
moveEffects: MoveEffectTable,
|
|
558
563
|
revision: RevisionTag | undefined,
|
|
559
564
|
id: MoveId,
|
|
565
|
+
count: number,
|
|
560
566
|
): NodeId | undefined {
|
|
561
|
-
return getMoveEffect(moveEffects, CrossFieldTarget.Destination, revision, id,
|
|
567
|
+
return getMoveEffect(moveEffects, CrossFieldTarget.Destination, revision, id, count).value
|
|
562
568
|
?.rebasedChanges;
|
|
563
569
|
}
|
|
@@ -8,7 +8,6 @@ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
|
8
8
|
import {
|
|
9
9
|
type DeltaDetachedNodeChanges,
|
|
10
10
|
type DeltaDetachedNodeRename,
|
|
11
|
-
type DeltaFieldChanges,
|
|
12
11
|
type DeltaMark,
|
|
13
12
|
areEqualChangeAtomIds,
|
|
14
13
|
} from "../../core/index.js";
|
|
@@ -25,12 +24,12 @@ import {
|
|
|
25
24
|
getInputCellId,
|
|
26
25
|
isAttachAndDetachEffect,
|
|
27
26
|
} from "./utils.js";
|
|
28
|
-
import type { ToDelta } from "../modular-schema/index.js";
|
|
27
|
+
import type { FieldChangeDelta, ToDelta } from "../modular-schema/index.js";
|
|
29
28
|
|
|
30
29
|
export function sequenceFieldToDelta(
|
|
31
30
|
change: MarkList,
|
|
32
31
|
deltaFromChild: ToDelta,
|
|
33
|
-
):
|
|
32
|
+
): FieldChangeDelta {
|
|
34
33
|
const local: DeltaMark[] = [];
|
|
35
34
|
const global: DeltaDetachedNodeChanges[] = [];
|
|
36
35
|
const rename: DeltaDetachedNodeRename[] = [];
|
|
@@ -187,7 +186,7 @@ export function sequenceFieldToDelta(
|
|
|
187
186
|
}
|
|
188
187
|
local.pop();
|
|
189
188
|
}
|
|
190
|
-
const delta: Mutable<
|
|
189
|
+
const delta: Mutable<FieldChangeDelta> = {};
|
|
191
190
|
if (local.length > 0) {
|
|
192
191
|
delta.local = local;
|
|
193
192
|
}
|
|
@@ -942,13 +942,45 @@ function getCrossFieldKeysForMarkEffect(
|
|
|
942
942
|
// An insert behaves like a move where the source and destination are at the same location.
|
|
943
943
|
// An insert can become a move when after rebasing.
|
|
944
944
|
return [
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
{
|
|
946
|
+
key: {
|
|
947
|
+
target: CrossFieldTarget.Source,
|
|
948
|
+
revision: effect.revision,
|
|
949
|
+
localId: effect.id,
|
|
950
|
+
},
|
|
951
|
+
count,
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
key: {
|
|
955
|
+
target: CrossFieldTarget.Destination,
|
|
956
|
+
revision: effect.revision,
|
|
957
|
+
localId: effect.id,
|
|
958
|
+
},
|
|
959
|
+
count,
|
|
960
|
+
},
|
|
947
961
|
];
|
|
948
962
|
case "MoveOut":
|
|
949
|
-
return [
|
|
963
|
+
return [
|
|
964
|
+
{
|
|
965
|
+
key: {
|
|
966
|
+
target: CrossFieldTarget.Source,
|
|
967
|
+
revision: effect.revision,
|
|
968
|
+
localId: effect.id,
|
|
969
|
+
},
|
|
970
|
+
count,
|
|
971
|
+
},
|
|
972
|
+
];
|
|
950
973
|
case "MoveIn":
|
|
951
|
-
return [
|
|
974
|
+
return [
|
|
975
|
+
{
|
|
976
|
+
key: {
|
|
977
|
+
target: CrossFieldTarget.Destination,
|
|
978
|
+
revision: effect.revision,
|
|
979
|
+
localId: effect.id,
|
|
980
|
+
},
|
|
981
|
+
count,
|
|
982
|
+
},
|
|
983
|
+
];
|
|
952
984
|
case "AttachAndDetach":
|
|
953
985
|
return [
|
|
954
986
|
...getCrossFieldKeysForMarkEffect(effect.attach, count),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, oob, debugAssert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
CursorLocationType,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
rootField,
|
|
21
21
|
} from "../core/index.js";
|
|
22
22
|
import { fail } from "../util/index.js";
|
|
23
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* {@link ITreeCursorSynchronous} that can return the underlying node objects.
|
|
@@ -146,7 +147,9 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
public getFieldKey(): FieldKey {
|
|
149
|
-
|
|
150
|
+
debugAssert(() =>
|
|
151
|
+
this.mode === CursorLocationType.Fields ? true : "must be in fields mode",
|
|
152
|
+
);
|
|
150
153
|
return this.siblings[this.index] as FieldKey;
|
|
151
154
|
}
|
|
152
155
|
|
|
@@ -177,7 +180,11 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
|
|
|
177
180
|
public enterNode(index: number): void {
|
|
178
181
|
// assert(this.mode === CursorLocationType.Fields, "must be in fields mode");
|
|
179
182
|
const siblings = this.getField();
|
|
180
|
-
|
|
183
|
+
if (!(index in siblings)) {
|
|
184
|
+
throw new UsageError(
|
|
185
|
+
"A child does not exist at the specified index, check the status of a node using `Tree.status()`.",
|
|
186
|
+
);
|
|
187
|
+
}
|
|
181
188
|
this.siblingStack.push(this.siblings);
|
|
182
189
|
this.indexStack.push(this.index);
|
|
183
190
|
this.index = index;
|
package/src/index.ts
CHANGED
|
@@ -14,13 +14,38 @@ export {
|
|
|
14
14
|
type RevertibleAlpha,
|
|
15
15
|
} from "./core/index.js";
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
Listeners,
|
|
19
|
-
IsListener,
|
|
20
|
-
Listenable,
|
|
21
|
-
Off,
|
|
17
|
+
import type {
|
|
18
|
+
Listeners as EventListeners,
|
|
19
|
+
IsListener as EventIsListener,
|
|
20
|
+
Listenable as EventListenable,
|
|
21
|
+
Off as EventOff,
|
|
22
22
|
} from "@fluidframework/core-interfaces";
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* {@inheritdoc @fluidframework/core-interfaces#Listeners}
|
|
26
|
+
* @public
|
|
27
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
28
|
+
*/
|
|
29
|
+
export type Listeners<T extends object> = EventListeners<T>;
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritdoc @fluidframework/core-interfaces#IsListener}
|
|
32
|
+
* @public
|
|
33
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
34
|
+
*/
|
|
35
|
+
export type IsListener<T> = EventIsListener<T>;
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritdoc @fluidframework/core-interfaces#Listenable}
|
|
38
|
+
* @public
|
|
39
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
40
|
+
*/
|
|
41
|
+
export type Listenable<T extends object> = EventListenable<T>;
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritdoc @fluidframework/core-interfaces#Off}
|
|
44
|
+
* @public
|
|
45
|
+
* @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.
|
|
46
|
+
*/
|
|
47
|
+
export type Off = EventOff;
|
|
48
|
+
|
|
24
49
|
export {
|
|
25
50
|
TreeStatus,
|
|
26
51
|
TreeCompressionStrategy,
|
|
@@ -32,7 +57,7 @@ export {
|
|
|
32
57
|
export {
|
|
33
58
|
type ITreeInternal,
|
|
34
59
|
type SharedTreeOptions,
|
|
35
|
-
ForestType,
|
|
60
|
+
type ForestType,
|
|
36
61
|
type SharedTreeFormatOptions,
|
|
37
62
|
SharedTreeFormatVersion,
|
|
38
63
|
Tree,
|
|
@@ -55,6 +80,11 @@ export {
|
|
|
55
80
|
type TransactionResultExt,
|
|
56
81
|
type TransactionResultSuccess,
|
|
57
82
|
type TransactionResultFailed,
|
|
83
|
+
ForestTypeOptimized,
|
|
84
|
+
ForestTypeExpensiveDebug,
|
|
85
|
+
ForestTypeReference,
|
|
86
|
+
SharedTreeAttributes,
|
|
87
|
+
SharedTreeFactoryType,
|
|
58
88
|
} from "./shared-tree/index.js";
|
|
59
89
|
|
|
60
90
|
export {
|
package/src/packageVersion.ts
CHANGED
package/src/shared-tree/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export {
|
|
|
9
9
|
type SharedTreeOptions,
|
|
10
10
|
SharedTree,
|
|
11
11
|
getBranch,
|
|
12
|
-
ForestType,
|
|
12
|
+
type ForestType,
|
|
13
13
|
type SharedTreeContentSnapshot,
|
|
14
14
|
type SharedTreeFormatOptions,
|
|
15
15
|
SharedTreeFormatVersion,
|
|
@@ -17,8 +17,16 @@ export {
|
|
|
17
17
|
defaultSharedTreeOptions,
|
|
18
18
|
type ForestOptions,
|
|
19
19
|
type ITreeInternal,
|
|
20
|
+
ForestTypeOptimized,
|
|
21
|
+
ForestTypeExpensiveDebug,
|
|
22
|
+
ForestTypeReference,
|
|
20
23
|
} from "./sharedTree.js";
|
|
21
24
|
|
|
25
|
+
export {
|
|
26
|
+
SharedTreeAttributes,
|
|
27
|
+
SharedTreeFactoryType,
|
|
28
|
+
} from "./publicContracts.js";
|
|
29
|
+
|
|
22
30
|
export {
|
|
23
31
|
createTreeCheckout,
|
|
24
32
|
TreeCheckout,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IChannelAttributes } from "@fluidframework/datastore-definitions/internal";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
10
|
+
* @alpha
|
|
11
|
+
* @legacy
|
|
12
|
+
*/
|
|
13
|
+
export const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
17
|
+
* @alpha
|
|
18
|
+
* @legacy
|
|
19
|
+
*/
|
|
20
|
+
export const SharedTreeAttributes: IChannelAttributes = {
|
|
21
|
+
type: SharedTreeFactoryType,
|
|
22
|
+
snapshotFormatVersion: "0.0.0",
|
|
23
|
+
packageVersion: "0.0.0",
|
|
24
|
+
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert
|
|
7
|
-
import type { IFluidHandle } from "@fluidframework/core-interfaces/internal";
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces/internal";
|
|
8
8
|
import type {
|
|
9
9
|
IChannelAttributes,
|
|
10
10
|
IChannelFactory,
|
|
@@ -84,6 +84,7 @@ import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
|
84
84
|
import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
|
|
85
85
|
import { breakingClass, fail, throwIfBroken } from "../util/index.js";
|
|
86
86
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
87
|
+
import { SharedTreeAttributes, SharedTreeFactoryType } from "./publicContracts.js";
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* Copy of data from an {@link ISharedTree} at some point in time.
|
|
@@ -186,30 +187,6 @@ function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
|
|
|
186
187
|
return versions;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
/**
|
|
190
|
-
* Build and return a forest of the requested type.
|
|
191
|
-
*/
|
|
192
|
-
export function buildConfiguredForest(
|
|
193
|
-
type: ForestType,
|
|
194
|
-
schema: TreeStoredSchemaSubscription,
|
|
195
|
-
idCompressor: IIdCompressor,
|
|
196
|
-
): IEditableForest {
|
|
197
|
-
switch (type) {
|
|
198
|
-
case ForestType.Optimized:
|
|
199
|
-
return buildChunkedForest(
|
|
200
|
-
makeTreeChunker(schema, defaultSchemaPolicy),
|
|
201
|
-
undefined,
|
|
202
|
-
idCompressor,
|
|
203
|
-
);
|
|
204
|
-
case ForestType.Reference:
|
|
205
|
-
return buildForest();
|
|
206
|
-
case ForestType.Expensive:
|
|
207
|
-
return buildForest(undefined, true);
|
|
208
|
-
default:
|
|
209
|
-
unreachableCase(type);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
190
|
/**
|
|
214
191
|
* Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.
|
|
215
192
|
*
|
|
@@ -596,26 +573,70 @@ export interface SharedTreeFormatOptions {
|
|
|
596
573
|
|
|
597
574
|
/**
|
|
598
575
|
* Used to distinguish between different forest types.
|
|
576
|
+
* @remarks
|
|
577
|
+
* Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.
|
|
578
|
+
* @sealed @alpha
|
|
579
|
+
*/
|
|
580
|
+
export interface ForestType extends ErasedType<"ForestType"> {}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Reference implementation of forest.
|
|
584
|
+
* @remarks
|
|
585
|
+
* A simple implementation with minimal complexity and moderate debuggability, validation and performance.
|
|
586
|
+
* @privateRemarks
|
|
587
|
+
* The "ObjectForest" forest type.
|
|
599
588
|
* @alpha
|
|
600
589
|
*/
|
|
601
|
-
export
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
590
|
+
export const ForestTypeReference = toForestType(() => buildForest());
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Optimized implementation of forest.
|
|
594
|
+
* @remarks
|
|
595
|
+
* A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.
|
|
596
|
+
* Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.
|
|
597
|
+
* @privateRemarks
|
|
598
|
+
* The "ChunkedForest" forest type.
|
|
599
|
+
* @alpha
|
|
600
|
+
*/
|
|
601
|
+
export const ForestTypeOptimized = toForestType(
|
|
602
|
+
(schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>
|
|
603
|
+
buildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Slow implementation of forest intended only for debugging.
|
|
608
|
+
* @remarks
|
|
609
|
+
* Includes validation with scales poorly.
|
|
610
|
+
* May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.
|
|
611
|
+
* @privateRemarks
|
|
612
|
+
* The "ObjectForest" forest type with expensive asserts for debugging.
|
|
613
|
+
* @alpha
|
|
614
|
+
*/
|
|
615
|
+
export const ForestTypeExpensiveDebug = toForestType(() => buildForest(undefined, true));
|
|
616
|
+
|
|
617
|
+
type ForestFactory = (
|
|
618
|
+
schema: TreeStoredSchemaSubscription,
|
|
619
|
+
idCompressor: IIdCompressor,
|
|
620
|
+
) => IEditableForest;
|
|
621
|
+
|
|
622
|
+
function toForestType(factory: ForestFactory): ForestType {
|
|
623
|
+
return factory as unknown as ForestType;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Build and return a forest of the requested type.
|
|
628
|
+
*/
|
|
629
|
+
export function buildConfiguredForest(
|
|
630
|
+
factory: ForestType,
|
|
631
|
+
schema: TreeStoredSchemaSubscription,
|
|
632
|
+
idCompressor: IIdCompressor,
|
|
633
|
+
): IEditableForest {
|
|
634
|
+
return (factory as unknown as ForestFactory)(schema, idCompressor);
|
|
614
635
|
}
|
|
615
636
|
|
|
616
637
|
export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
617
638
|
jsonValidator: noopValidator,
|
|
618
|
-
forest:
|
|
639
|
+
forest: ForestTypeReference,
|
|
619
640
|
treeEncodeType: TreeCompressionStrategy.Compressed,
|
|
620
641
|
formatVersion: SharedTreeFormatVersion.v3,
|
|
621
642
|
disposeForksAfterTransaction: true,
|
|
@@ -625,13 +646,9 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
625
646
|
* A channel factory that creates {@link ISharedTree}s.
|
|
626
647
|
*/
|
|
627
648
|
export class SharedTreeFactory implements IChannelFactory<ISharedTree> {
|
|
628
|
-
public readonly type: string =
|
|
649
|
+
public readonly type: string = SharedTreeFactoryType;
|
|
629
650
|
|
|
630
|
-
public readonly attributes: IChannelAttributes =
|
|
631
|
-
type: this.type,
|
|
632
|
-
snapshotFormatVersion: "0.0.0",
|
|
633
|
-
packageVersion: "0.0.0",
|
|
634
|
-
};
|
|
651
|
+
public readonly attributes: IChannelAttributes = SharedTreeAttributes;
|
|
635
652
|
|
|
636
653
|
public constructor(private readonly options: SharedTreeOptionsInternal = {}) {}
|
|
637
654
|
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
type RevertibleAlphaFactory,
|
|
42
42
|
type RevertibleAlpha,
|
|
43
43
|
type GraphCommit,
|
|
44
|
+
isAncestor,
|
|
44
45
|
} from "../core/index.js";
|
|
45
46
|
import {
|
|
46
47
|
type FieldBatchCodec,
|
|
@@ -605,21 +606,27 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
605
606
|
revertible.dispose();
|
|
606
607
|
}
|
|
607
608
|
},
|
|
608
|
-
clone: (
|
|
609
|
-
if (forkedBranch === undefined) {
|
|
610
|
-
return this.createRevertible(revision, kind, checkout, onRevertibleDisposed);
|
|
611
|
-
}
|
|
612
|
-
|
|
609
|
+
clone: (targetBranch: TreeBranch) => {
|
|
613
610
|
// TODO:#23442: When a revertible is cloned for a forked branch, optimize to create a fork of a revertible branch once per revision NOT once per revision per checkout.
|
|
614
|
-
const
|
|
611
|
+
const targetCheckout = getCheckout(targetBranch);
|
|
612
|
+
|
|
615
613
|
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
614
|
+
if (revertibleBranch === undefined) {
|
|
615
|
+
throw new UsageError("Unable to clone a revertible that has been disposed.");
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const commitToRevert = revertibleBranch.getHead();
|
|
619
|
+
const activeBranchHead = targetCheckout.#transaction.activeBranch.getHead();
|
|
620
|
+
|
|
621
|
+
if (isAncestor(commitToRevert, activeBranchHead, true) === false) {
|
|
622
|
+
throw new UsageError(
|
|
623
|
+
"Cannot clone revertible for a commit that is not present on the given branch.",
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
targetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());
|
|
621
628
|
|
|
622
|
-
return this.createRevertible(revision, kind,
|
|
629
|
+
return this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed);
|
|
623
630
|
},
|
|
624
631
|
dispose: () => {
|
|
625
632
|
if (revertible.status === RevertibleStatus.Disposed) {
|
|
@@ -263,6 +263,8 @@ export type ScopedSchemaName<
|
|
|
263
263
|
*
|
|
264
264
|
* Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.
|
|
265
265
|
*
|
|
266
|
+
* @see {@link SchemaFactoryAlpha}
|
|
267
|
+
*
|
|
266
268
|
* @sealed @public
|
|
267
269
|
*/
|
|
268
270
|
export class SchemaFactory<
|
|
@@ -467,6 +467,10 @@ export interface TreeBranch extends IDisposable {
|
|
|
467
467
|
* Doing that would however complicate trivial "hello world" style example slightly, as well as be a breaking API change.
|
|
468
468
|
* It also seems more complex to handle invalidation with that pattern.
|
|
469
469
|
* Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.
|
|
470
|
+
*
|
|
471
|
+
* @see {@link TreeViewAlpha}
|
|
472
|
+
* @see {@link asTreeViewAlpha}
|
|
473
|
+
*
|
|
470
474
|
* @sealed @public
|
|
471
475
|
*/
|
|
472
476
|
export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
@@ -174,7 +174,7 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
174
174
|
changedFields,
|
|
175
175
|
(field) =>
|
|
176
176
|
nodeSchema.storedKeyToPropertyKey.get(field) ??
|
|
177
|
-
fail(
|
|
177
|
+
fail("Could not find stored key in schema."),
|
|
178
178
|
),
|
|
179
179
|
);
|
|
180
180
|
listener({ changedProperties });
|
|
@@ -993,7 +993,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
993
993
|
if (!destinationField.context.isHydrated()) {
|
|
994
994
|
if (!(sourceField instanceof UnhydratedTreeSequenceField)) {
|
|
995
995
|
throw new UsageError(
|
|
996
|
-
"Cannot move elements from
|
|
996
|
+
"Cannot move elements from a hydrated array to an unhydrated array.",
|
|
997
997
|
);
|
|
998
998
|
}
|
|
999
999
|
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
import type { TreeValue } from "../../core/index.js";
|
|
7
7
|
import type { FlexTreeNode } from "../../feature-libraries/index.js";
|
|
8
8
|
import { fail } from "../../util/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type InnerNode,
|
|
11
|
+
unhydratedFlexTreeNodeToTreeNode,
|
|
12
|
+
proxySlot,
|
|
13
|
+
} from "./treeNodeKernel.js";
|
|
10
14
|
import { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
|
|
11
15
|
import type { TreeNode, InternalTreeNode } from "./types.js";
|
|
12
16
|
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
@@ -20,7 +24,7 @@ import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
|
20
24
|
export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | TreeValue {
|
|
21
25
|
const cached =
|
|
22
26
|
flexNode instanceof UnhydratedFlexTreeNode
|
|
23
|
-
?
|
|
27
|
+
? unhydratedFlexTreeNodeToTreeNode.get(flexNode)
|
|
24
28
|
: flexNode.anchorNode.slots.get(proxySlot);
|
|
25
29
|
|
|
26
30
|
if (cached !== undefined) {
|
|
@@ -146,7 +146,7 @@ export class TreeNodeKernel {
|
|
|
146
146
|
|
|
147
147
|
if (innerNode instanceof UnhydratedFlexTreeNode) {
|
|
148
148
|
// Unhydrated case
|
|
149
|
-
|
|
149
|
+
unhydratedFlexTreeNodeToTreeNodeInternal.set(innerNode, node);
|
|
150
150
|
// Register for change events from the unhydrated flex node.
|
|
151
151
|
// These will be fired if the unhydrated node is edited, and will also be forwarded later to the hydrated node.
|
|
152
152
|
this.#hydrationState = {
|
|
@@ -158,7 +158,7 @@ export class TreeNodeKernel {
|
|
|
158
158
|
|
|
159
159
|
let n: UnhydratedFlexTreeNode | undefined = innerNode;
|
|
160
160
|
while (n !== undefined) {
|
|
161
|
-
const treeNode =
|
|
161
|
+
const treeNode = unhydratedFlexTreeNodeToTreeNodeInternal.get(n);
|
|
162
162
|
if (treeNode !== undefined) {
|
|
163
163
|
const kernel = getKernel(treeNode);
|
|
164
164
|
kernel.#unhydratedEvents.value.emit("subtreeChangedAfterBatch");
|
|
@@ -200,7 +200,7 @@ export class TreeNodeKernel {
|
|
|
200
200
|
private hydrate(anchorNode: AnchorNode): void {
|
|
201
201
|
assert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);
|
|
202
202
|
assert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);
|
|
203
|
-
|
|
203
|
+
unhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);
|
|
204
204
|
this.#hydrationState = this.createHydratedState(anchorNode);
|
|
205
205
|
|
|
206
206
|
// If needed, register forwarding emitters for events from before hydration
|
|
@@ -389,9 +389,20 @@ type KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;
|
|
|
389
389
|
export type InnerNode = FlexTreeNode | UnhydratedFlexTreeNode;
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
|
-
* {@
|
|
392
|
+
* Associates a given {@link UnhydratedFlexTreeNode} with a {@link TreeNode}.
|
|
393
393
|
*/
|
|
394
|
-
|
|
394
|
+
const unhydratedFlexTreeNodeToTreeNodeInternal = new WeakMap<
|
|
395
|
+
UnhydratedFlexTreeNode,
|
|
396
|
+
TreeNode
|
|
397
|
+
>();
|
|
398
|
+
/**
|
|
399
|
+
* Retrieves the {@link TreeNode} associated with the given {@link UnhydratedFlexTreeNode} if any.
|
|
400
|
+
*/
|
|
401
|
+
export const unhydratedFlexTreeNodeToTreeNode =
|
|
402
|
+
unhydratedFlexTreeNodeToTreeNodeInternal as Pick<
|
|
403
|
+
WeakMap<UnhydratedFlexTreeNode, TreeNode>,
|
|
404
|
+
"get"
|
|
405
|
+
>;
|
|
395
406
|
|
|
396
407
|
/**
|
|
397
408
|
* An anchor slot which associates an anchor with its corresponding TreeNode, if there is one.
|
|
@@ -401,15 +412,6 @@ export const mapTreeNodeToProxy = new WeakMap<UnhydratedFlexTreeNode, TreeNode>(
|
|
|
401
412
|
*/
|
|
402
413
|
export const proxySlot = anchorSlot<TreeNode>();
|
|
403
414
|
|
|
404
|
-
/**
|
|
405
|
-
* Retrieves the node associated with the given MapTreeNode node if any.
|
|
406
|
-
*/
|
|
407
|
-
export function tryGetTreeNodeFromMapNode(
|
|
408
|
-
flexNode: UnhydratedFlexTreeNode,
|
|
409
|
-
): TreeNode | undefined {
|
|
410
|
-
return mapTreeNodeToProxy.get(flexNode);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
415
|
export function tryDisposeTreeNode(anchorNode: AnchorNode): void {
|
|
414
416
|
const treeNode = anchorNode.slots.get(proxySlot);
|
|
415
417
|
if (treeNode !== undefined) {
|