@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
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/tree";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.21.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.21.0\";\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, getBranch, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, } from "./sharedTree.js";
|
|
5
|
+
export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./sharedTree.js";
|
|
6
|
+
export { SharedTreeAttributes, SharedTreeFactoryType, } from "./publicContracts.js";
|
|
6
7
|
export { createTreeCheckout, TreeCheckout, type ITreeCheckout, type CheckoutEvents, type ITreeCheckoutFork, type BranchableTree, type TreeBranchFork, } from "./treeCheckout.js";
|
|
7
8
|
export { type TreeStoredContent } from "./schematizeTree.js";
|
|
8
9
|
export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
|
|
@@ -4,15 +4,20 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.rollback = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.
|
|
7
|
+
exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.rollback = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.SharedTreeFactoryType = exports.SharedTreeAttributes = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTree = exports.SharedTreeFactory = void 0;
|
|
8
8
|
var sharedTree_js_1 = require("./sharedTree.js");
|
|
9
9
|
Object.defineProperty(exports, "SharedTreeFactory", { enumerable: true, get: function () { return sharedTree_js_1.SharedTreeFactory; } });
|
|
10
10
|
Object.defineProperty(exports, "SharedTree", { enumerable: true, get: function () { return sharedTree_js_1.SharedTree; } });
|
|
11
11
|
Object.defineProperty(exports, "getBranch", { enumerable: true, get: function () { return sharedTree_js_1.getBranch; } });
|
|
12
|
-
Object.defineProperty(exports, "ForestType", { enumerable: true, get: function () { return sharedTree_js_1.ForestType; } });
|
|
13
12
|
Object.defineProperty(exports, "SharedTreeFormatVersion", { enumerable: true, get: function () { return sharedTree_js_1.SharedTreeFormatVersion; } });
|
|
14
13
|
Object.defineProperty(exports, "buildConfiguredForest", { enumerable: true, get: function () { return sharedTree_js_1.buildConfiguredForest; } });
|
|
15
14
|
Object.defineProperty(exports, "defaultSharedTreeOptions", { enumerable: true, get: function () { return sharedTree_js_1.defaultSharedTreeOptions; } });
|
|
15
|
+
Object.defineProperty(exports, "ForestTypeOptimized", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeOptimized; } });
|
|
16
|
+
Object.defineProperty(exports, "ForestTypeExpensiveDebug", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeExpensiveDebug; } });
|
|
17
|
+
Object.defineProperty(exports, "ForestTypeReference", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeReference; } });
|
|
18
|
+
var publicContracts_js_1 = require("./publicContracts.js");
|
|
19
|
+
Object.defineProperty(exports, "SharedTreeAttributes", { enumerable: true, get: function () { return publicContracts_js_1.SharedTreeAttributes; } });
|
|
20
|
+
Object.defineProperty(exports, "SharedTreeFactoryType", { enumerable: true, get: function () { return publicContracts_js_1.SharedTreeFactoryType; } });
|
|
16
21
|
var treeCheckout_js_1 = require("./treeCheckout.js");
|
|
17
22
|
Object.defineProperty(exports, "createTreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.createTreeCheckout; } });
|
|
18
23
|
Object.defineProperty(exports, "TreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.TreeCheckout; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAiByB;AAfxB,kHAAA,iBAAiB,OAAA;AAEjB,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AAIT,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAGxB,oHAAA,mBAAmB,OAAA;AACnB,yHAAA,wBAAwB,OAAA;AACxB,oHAAA,mBAAmB,OAAA;AAGpB,2DAG8B;AAF7B,0HAAA,oBAAoB,OAAA;AACpB,2HAAA,qBAAqB,OAAA;AAGtB,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAUb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAIsB;AAHrB,kGAAA,OAAO,OAAQ;AAKhB,6DAW+B;AAD9B,+GAAA,QAAQ,OAAA;AAGT,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAElB,2DAI8B;AAH7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\tSharedTreeFactory,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./sharedTree.js\";\n\nexport {\n\tSharedTreeAttributes,\n\tSharedTreeFactoryType,\n} from \"./publicContracts.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\ttype CheckoutEvents,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } from \"./schematizeTree.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype RunTransaction,\n} from \"./treeApi.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IChannelAttributes } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
/**
|
|
7
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
8
|
+
* @alpha
|
|
9
|
+
* @legacy
|
|
10
|
+
*/
|
|
11
|
+
export declare const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
12
|
+
/**
|
|
13
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
14
|
+
* @alpha
|
|
15
|
+
* @legacy
|
|
16
|
+
*/
|
|
17
|
+
export declare const SharedTreeAttributes: IChannelAttributes;
|
|
18
|
+
//# sourceMappingURL=publicContracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicContracts.d.ts","sourceRoot":"","sources":["../../src/shared-tree/publicContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,2CAA2C,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAIlC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SharedTreeAttributes = exports.SharedTreeFactoryType = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
10
|
+
* @alpha
|
|
11
|
+
* @legacy
|
|
12
|
+
*/
|
|
13
|
+
exports.SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
16
|
+
* @alpha
|
|
17
|
+
* @legacy
|
|
18
|
+
*/
|
|
19
|
+
exports.SharedTreeAttributes = {
|
|
20
|
+
type: exports.SharedTreeFactoryType,
|
|
21
|
+
snapshotFormatVersion: "0.0.0",
|
|
22
|
+
packageVersion: "0.0.0",
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=publicContracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicContracts.js","sourceRoot":"","sources":["../../src/shared-tree/publicContracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,wCAAwC,CAAC;AAE9E;;;;GAIG;AACU,QAAA,oBAAoB,GAAuB;IACvD,IAAI,EAAE,6BAAqB;IAC3B,qBAAqB,EAAE,OAAO;IAC9B,cAAc,EAAE,OAAO;CACvB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelAttributes } from \"@fluidframework/datastore-definitions/internal\";\n\n/**\n * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n * @alpha\n * @legacy\n */\nexport const SharedTreeFactoryType = \"https://graph.microsoft.com/types/tree\";\n\n/**\n * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n * @alpha\n * @legacy\n */\nexport const SharedTreeAttributes: IChannelAttributes = {\n\ttype: SharedTreeFactoryType,\n\tsnapshotFormatVersion: \"0.0.0\",\n\tpackageVersion: \"0.0.0\",\n};\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { ErasedType } from "@fluidframework/core-interfaces/internal";
|
|
5
6
|
import type { IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChannelServices, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
7
|
import type { ISharedObject } from "@fluidframework/shared-object-base/internal";
|
|
7
8
|
import { type ICodecOptions } from "../codec/index.js";
|
|
@@ -69,10 +70,6 @@ export interface ISharedTree extends ISharedObject, ITreeInternal {
|
|
|
69
70
|
*/
|
|
70
71
|
contentSnapshot(): SharedTreeContentSnapshot;
|
|
71
72
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Build and return a forest of the requested type.
|
|
74
|
-
*/
|
|
75
|
-
export declare function buildConfiguredForest(type: ForestType, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor): IEditableForest;
|
|
76
73
|
/**
|
|
77
74
|
* Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.
|
|
78
75
|
*
|
|
@@ -190,22 +187,45 @@ export interface SharedTreeFormatOptions {
|
|
|
190
187
|
}
|
|
191
188
|
/**
|
|
192
189
|
* Used to distinguish between different forest types.
|
|
193
|
-
* @
|
|
190
|
+
* @remarks
|
|
191
|
+
* Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.
|
|
192
|
+
* @sealed @alpha
|
|
194
193
|
*/
|
|
195
|
-
export
|
|
196
|
-
/**
|
|
197
|
-
* The "ObjectForest" forest type.
|
|
198
|
-
*/
|
|
199
|
-
Reference = 0,
|
|
200
|
-
/**
|
|
201
|
-
* The "ChunkedForest" forest type.
|
|
202
|
-
*/
|
|
203
|
-
Optimized = 1,
|
|
204
|
-
/**
|
|
205
|
-
* The "ObjectForest" forest type with expensive asserts for debugging.
|
|
206
|
-
*/
|
|
207
|
-
Expensive = 2
|
|
194
|
+
export interface ForestType extends ErasedType<"ForestType"> {
|
|
208
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Reference implementation of forest.
|
|
198
|
+
* @remarks
|
|
199
|
+
* A simple implementation with minimal complexity and moderate debuggability, validation and performance.
|
|
200
|
+
* @privateRemarks
|
|
201
|
+
* The "ObjectForest" forest type.
|
|
202
|
+
* @alpha
|
|
203
|
+
*/
|
|
204
|
+
export declare const ForestTypeReference: ForestType;
|
|
205
|
+
/**
|
|
206
|
+
* Optimized implementation of forest.
|
|
207
|
+
* @remarks
|
|
208
|
+
* A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.
|
|
209
|
+
* Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.
|
|
210
|
+
* @privateRemarks
|
|
211
|
+
* The "ChunkedForest" forest type.
|
|
212
|
+
* @alpha
|
|
213
|
+
*/
|
|
214
|
+
export declare const ForestTypeOptimized: ForestType;
|
|
215
|
+
/**
|
|
216
|
+
* Slow implementation of forest intended only for debugging.
|
|
217
|
+
* @remarks
|
|
218
|
+
* Includes validation with scales poorly.
|
|
219
|
+
* May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.
|
|
220
|
+
* @privateRemarks
|
|
221
|
+
* The "ObjectForest" forest type with expensive asserts for debugging.
|
|
222
|
+
* @alpha
|
|
223
|
+
*/
|
|
224
|
+
export declare const ForestTypeExpensiveDebug: ForestType;
|
|
225
|
+
/**
|
|
226
|
+
* Build and return a forest of the requested type.
|
|
227
|
+
*/
|
|
228
|
+
export declare function buildConfiguredForest(factory: ForestType, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor): IEditableForest;
|
|
209
229
|
export declare const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal>;
|
|
210
230
|
/**
|
|
211
231
|
* A channel factory that creates {@link ISharedTree}s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;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AAQ,UAAU,CAAC,YAAY,CAAC;CAAG;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,YAAoC,CAAC;AAErE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,YAG/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,YAAmD,CAAC;AAWzF;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,aAAa,GACzB,eAAe,CAEjB;AAED,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,yBAAyB,CAMxE,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe,CAAC,WAAW,CAAC;IAKlD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ3C,SAAgB,IAAI,EAAE,MAAM,CAAyB;IAErD,SAAgB,UAAU,EAAE,kBAAkB,CAAwB;gBAElC,OAAO,GAAE,yBAA8B;IAE9D,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAC7C,OAAO,CAAC,UAAU,CAAC;IAMf,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU;CAKtE"}
|
|
@@ -42,7 +42,7 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
42
42
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.SharedTreeFactory = exports.defaultSharedTreeOptions = exports.
|
|
45
|
+
exports.SharedTreeFactory = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.ForestTypeReference = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTree = void 0;
|
|
46
46
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
47
47
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
48
48
|
const index_js_1 = require("../codec/index.js");
|
|
@@ -55,6 +55,7 @@ const sharedTreeChangeEnricher_js_1 = require("./sharedTreeChangeEnricher.js");
|
|
|
55
55
|
const sharedTreeChangeFamily_js_1 = require("./sharedTreeChangeFamily.js");
|
|
56
56
|
const treeCheckout_js_1 = require("./treeCheckout.js");
|
|
57
57
|
const index_js_6 = require("../util/index.js");
|
|
58
|
+
const publicContracts_js_1 = require("./publicContracts.js");
|
|
58
59
|
const formatVersionToTopLevelCodecVersions = new Map([
|
|
59
60
|
[
|
|
60
61
|
1,
|
|
@@ -78,22 +79,6 @@ function getCodecVersions(formatVersion) {
|
|
|
78
79
|
(0, internal_1.assert)(versions !== undefined, 0x90e /* Unknown format version */);
|
|
79
80
|
return versions;
|
|
80
81
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Build and return a forest of the requested type.
|
|
83
|
-
*/
|
|
84
|
-
function buildConfiguredForest(type, schema, idCompressor) {
|
|
85
|
-
switch (type) {
|
|
86
|
-
case ForestType.Optimized:
|
|
87
|
-
return (0, index_js_3.buildChunkedForest)((0, index_js_3.makeTreeChunker)(schema, index_js_3.defaultSchemaPolicy), undefined, idCompressor);
|
|
88
|
-
case ForestType.Reference:
|
|
89
|
-
return (0, index_js_3.buildForest)();
|
|
90
|
-
case ForestType.Expensive:
|
|
91
|
-
return (0, index_js_3.buildForest)(undefined, true);
|
|
92
|
-
default:
|
|
93
|
-
(0, internal_1.unreachableCase)(type);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.buildConfiguredForest = buildConfiguredForest;
|
|
97
82
|
/**
|
|
98
83
|
* Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.
|
|
99
84
|
*
|
|
@@ -313,27 +298,47 @@ exports.SharedTreeFormatVersion = {
|
|
|
313
298
|
v3: 3,
|
|
314
299
|
};
|
|
315
300
|
/**
|
|
316
|
-
*
|
|
301
|
+
* Reference implementation of forest.
|
|
302
|
+
* @remarks
|
|
303
|
+
* A simple implementation with minimal complexity and moderate debuggability, validation and performance.
|
|
304
|
+
* @privateRemarks
|
|
305
|
+
* The "ObjectForest" forest type.
|
|
317
306
|
* @alpha
|
|
318
307
|
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
308
|
+
exports.ForestTypeReference = toForestType(() => (0, index_js_3.buildForest)());
|
|
309
|
+
/**
|
|
310
|
+
* Optimized implementation of forest.
|
|
311
|
+
* @remarks
|
|
312
|
+
* A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.
|
|
313
|
+
* Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.
|
|
314
|
+
* @privateRemarks
|
|
315
|
+
* The "ChunkedForest" forest type.
|
|
316
|
+
* @alpha
|
|
317
|
+
*/
|
|
318
|
+
exports.ForestTypeOptimized = toForestType((schema, idCompressor) => (0, index_js_3.buildChunkedForest)((0, index_js_3.makeTreeChunker)(schema, index_js_3.defaultSchemaPolicy), undefined, idCompressor));
|
|
319
|
+
/**
|
|
320
|
+
* Slow implementation of forest intended only for debugging.
|
|
321
|
+
* @remarks
|
|
322
|
+
* Includes validation with scales poorly.
|
|
323
|
+
* May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.
|
|
324
|
+
* @privateRemarks
|
|
325
|
+
* The "ObjectForest" forest type with expensive asserts for debugging.
|
|
326
|
+
* @alpha
|
|
327
|
+
*/
|
|
328
|
+
exports.ForestTypeExpensiveDebug = toForestType(() => (0, index_js_3.buildForest)(undefined, true));
|
|
329
|
+
function toForestType(factory) {
|
|
330
|
+
return factory;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Build and return a forest of the requested type.
|
|
334
|
+
*/
|
|
335
|
+
function buildConfiguredForest(factory, schema, idCompressor) {
|
|
336
|
+
return factory(schema, idCompressor);
|
|
337
|
+
}
|
|
338
|
+
exports.buildConfiguredForest = buildConfiguredForest;
|
|
334
339
|
exports.defaultSharedTreeOptions = {
|
|
335
340
|
jsonValidator: index_js_1.noopValidator,
|
|
336
|
-
forest:
|
|
341
|
+
forest: exports.ForestTypeReference,
|
|
337
342
|
treeEncodeType: index_js_3.TreeCompressionStrategy.Compressed,
|
|
338
343
|
formatVersion: exports.SharedTreeFormatVersion.v3,
|
|
339
344
|
disposeForksAfterTransaction: true,
|
|
@@ -344,12 +349,8 @@ exports.defaultSharedTreeOptions = {
|
|
|
344
349
|
class SharedTreeFactory {
|
|
345
350
|
constructor(options = {}) {
|
|
346
351
|
this.options = options;
|
|
347
|
-
this.type =
|
|
348
|
-
this.attributes =
|
|
349
|
-
type: this.type,
|
|
350
|
-
snapshotFormatVersion: "0.0.0",
|
|
351
|
-
packageVersion: "0.0.0",
|
|
352
|
-
};
|
|
352
|
+
this.type = publicContracts_js_1.SharedTreeFactoryType;
|
|
353
|
+
this.attributes = publicContracts_js_1.SharedTreeAttributes;
|
|
353
354
|
}
|
|
354
355
|
async load(runtime, id, services, channelAttributes) {
|
|
355
356
|
const tree = new SharedTree(id, runtime, channelAttributes, this.options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA8E;AAU9E,uEAAsE;AAEtE,gDAAsE;AACtE,+CAkB0B;AAE1B,4DAauC;AACvC,2DAKsC;AACtC,sDAkBiC;AAEjC,uEAAuE;AACvE,+EAAiF;AACjF,2EAAq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,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces/internal\";\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TaggedChange,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\n\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ClonableSchemaAndPolicy,\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tcustomFromCursorStored,\n\tFieldKind,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport { breakingClass, fail, throwIfBroken } from \"../util/index.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends ISharedObject, ITree {\n\t/**\n\t * Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.\n\t * @privateRemarks\n\t * TODO:\n\t * This should probably get promoted to a public API on ITree eventually.\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n */\nexport interface ISharedTree extends ISharedObject, ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\ttype: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\tswitch (type) {\n\t\tcase ForestType.Optimized:\n\t\t\treturn buildChunkedForest(\n\t\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy),\n\t\t\t\tundefined,\n\t\t\t\tidCompressor,\n\t\t\t);\n\t\tcase ForestType.Reference:\n\t\t\treturn buildForest();\n\t\tcase ForestType.Expensive:\n\t\t\treturn buildForest(undefined, true);\n\t\tdefault:\n\t\t\tunreachableCase(type);\n\t}\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(options.forest, schema, runtime.idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t\tbreaker: this.breaker,\n\t\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t\t},\n\t\t);\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.isAttached()) {\n\t\t\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t\t\tthis.commitEnricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(\"Invalid document root length\");\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn {\n\t\t\t...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),\n\t\t\tdefinitions: new Map(\n\t\t\t\t[...this.storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t\t}),\n\t\t\t),\n\t\t};\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tprotected override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tprotected override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tthis.checkout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tassert(\n\t\ttreeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,\n\t\t0xa48 /* Unsupported implementation */,\n\t);\n\tconst checkout: TreeCheckout = treeOrView.checkout;\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\nexport interface SharedTreeOptionsInternal extends SharedTreeOptions {\n\tdisposeForksAfterTransaction?: boolean;\n}\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @alpha\n */\nexport enum ForestType {\n\t/**\n\t * The \"ObjectForest\" forest type.\n\t */\n\tReference = 0,\n\t/**\n\t * The \"ChunkedForest\" forest type.\n\t */\n\tOptimized = 1,\n\t/**\n\t * The \"ObjectForest\" forest type with expensive asserts for debugging.\n\t */\n\tExpensive = 2,\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestType.Reference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n\tdisposeForksAfterTransaction: true,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = \"https://graph.microsoft.com/types/tree\";\n\n\tpublic readonly attributes: IChannelAttributes = {\n\t\ttype: this.type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: \"0.0.0\",\n\t};\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema = schema.get(reader.type) ?? fail(\"missing schema for type in cursor\");\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue<IFluidHandle>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(\"invalid field kind\");\n\t}\n\treturn { kind, allowedTypes: schema.types };\n}\n\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn { kind: NodeKind.Array, allowedTypes: arrayTypes };\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields: Record<string, SimpleFieldSchema> = {};\n\t\tfor (const [key, field] of schema.objectNodeFields) {\n\t\t\tfields[key] = exportSimpleFieldSchemaStored(field);\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn { kind: NodeKind.Map, allowedTypes: schema.mapFields.types };\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn { kind: NodeKind.Leaf, leafKind: schema.leafValue };\n\t}\n\tfail(\"invalid schema kind\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAU7D,uEAAsE;AAEtE,gDAAsE;AACtE,+CAkB0B;AAE1B,4DAauC;AACvC,2DAKsC;AACtC,sDAkBiC;AAEjC,uEAAuE;AACvE,+EAAiF;AACjF,2EAAqE;AAGrE,uDAA+F;AAC/F,+CAAsE;AAEtE,6DAAmF;AA8EnF,MAAM,oCAAoC,GAAG,IAAI,GAAG,CAAgC;IACnF;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC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,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,CAAC,GAAG,CAAC,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,mBAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,MAAM,YAAY,8BAAmB,EAAE,CAAC;QAC3C,IAAA,iBAAM,EACL,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,mBAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,YAAY,+BAAoB,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,mBAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC;IACD,IAAA,eAAI,EAAC,qBAAqB,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ErasedType, IFluidHandle } from \"@fluidframework/core-interfaces/internal\";\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TaggedChange,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\n\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ClonableSchemaAndPolicy,\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tcustomFromCursorStored,\n\tFieldKind,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport { breakingClass, fail, throwIfBroken } from \"../util/index.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { SharedTreeAttributes, SharedTreeFactoryType } from \"./publicContracts.js\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends ISharedObject, ITree {\n\t/**\n\t * Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.\n\t * @privateRemarks\n\t * TODO:\n\t * This should probably get promoted to a public API on ITree eventually.\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n */\nexport interface ISharedTree extends ISharedObject, ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(options.forest, schema, runtime.idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t\tbreaker: this.breaker,\n\t\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t\t},\n\t\t);\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.isAttached()) {\n\t\t\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t\t\tthis.commitEnricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(\"Invalid document root length\");\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn {\n\t\t\t...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),\n\t\t\tdefinitions: new Map(\n\t\t\t\t[...this.storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t\t}),\n\t\t\t),\n\t\t};\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tprotected override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tprotected override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tthis.checkout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tassert(\n\t\ttreeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,\n\t\t0xa48 /* Unsupported implementation */,\n\t);\n\tconst checkout: TreeCheckout = treeOrView.checkout;\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\nexport interface SharedTreeOptionsInternal extends SharedTreeOptions {\n\tdisposeForksAfterTransaction?: boolean;\n}\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @sealed @alpha\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @alpha\n */\nexport const ForestTypeReference = toForestType(() => buildForest());\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @alpha\n */\nexport const ForestTypeOptimized = toForestType(\n\t(schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @alpha\n */\nexport const ForestTypeExpensiveDebug = toForestType(() => buildForest(undefined, true));\n\ntype ForestFactory = (\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(schema, idCompressor);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n\tdisposeForksAfterTransaction: true,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = SharedTreeFactoryType;\n\n\tpublic readonly attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema = schema.get(reader.type) ?? fail(\"missing schema for type in cursor\");\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue<IFluidHandle>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(\"invalid field kind\");\n\t}\n\treturn { kind, allowedTypes: schema.types };\n}\n\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn { kind: NodeKind.Array, allowedTypes: arrayTypes };\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields: Record<string, SimpleFieldSchema> = {};\n\t\tfor (const [key, field] of schema.objectNodeFields) {\n\t\t\tfields[key] = exportSimpleFieldSchemaStored(field);\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn { kind: NodeKind.Map, allowedTypes: schema.mapFields.types };\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn { kind: NodeKind.Leaf, leafKind: schema.leafValue };\n\t}\n\tfail(\"invalid schema kind\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeCheckout.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EAOjC,KAAK,sBAAsB,EAE3B,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"treeCheckout.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BA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;IACI,aAAa,CACnB,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,EACrC,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,GACjD,OAAO;IAWV,iGAAiG;IACjG,OAAO,CAAC,cAAc;CAStB"}
|
|
@@ -271,16 +271,20 @@ class TreeCheckout {
|
|
|
271
271
|
revertible.dispose();
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
|
-
clone: (
|
|
275
|
-
if (forkedBranch === undefined) {
|
|
276
|
-
return this.createRevertible(revision, kind, checkout, onRevertibleDisposed);
|
|
277
|
-
}
|
|
274
|
+
clone: (targetBranch) => {
|
|
278
275
|
// 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.
|
|
279
|
-
const
|
|
276
|
+
const targetCheckout = (0, schematizingTreeView_js_1.getCheckout)(targetBranch);
|
|
280
277
|
const revertibleBranch = this.revertibleCommitBranches.get(revision);
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
278
|
+
if (revertibleBranch === undefined) {
|
|
279
|
+
throw new internal_2.UsageError("Unable to clone a revertible that has been disposed.");
|
|
280
|
+
}
|
|
281
|
+
const commitToRevert = revertibleBranch.getHead();
|
|
282
|
+
const activeBranchHead = __classPrivateFieldGet(targetCheckout, _TreeCheckout_transaction, "f").activeBranch.getHead();
|
|
283
|
+
if ((0, index_js_2.isAncestor)(commitToRevert, activeBranchHead, true) === false) {
|
|
284
|
+
throw new internal_2.UsageError("Cannot clone revertible for a commit that is not present on the given branch.");
|
|
285
|
+
}
|
|
286
|
+
targetCheckout.revertibleCommitBranches.set(revision, revertibleBranch.fork());
|
|
287
|
+
return this.createRevertible(revision, kind, targetCheckout, onRevertibleDisposed);
|
|
284
288
|
},
|
|
285
289
|
dispose: () => {
|
|
286
290
|
if (revertible.status === index_js_2.RevertibleStatus.Disposed) {
|