@fluidframework/tree 2.61.0 → 2.62.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 +162 -0
- package/api-report/tree.alpha.api.md +26 -21
- package/api-report/tree.beta.api.md +15 -0
- package/api-report/tree.legacy.beta.api.md +18 -0
- package/dist/alpha.d.ts +8 -8
- package/dist/api.d.ts +17 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +24 -0
- package/dist/api.js.map +1 -0
- package/dist/beta.d.ts +5 -0
- package/dist/codec/codec.d.ts +3 -5
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +9 -2
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +0 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +1 -3
- package/dist/codec/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +20 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +1 -1
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/external-utilities/index.d.ts +1 -1
- package/dist/external-utilities/index.d.ts.map +1 -1
- package/dist/external-utilities/index.js +1 -2
- package/dist/external-utilities/index.js.map +1 -1
- package/dist/external-utilities/typeboxValidator.d.ts +0 -13
- package/dist/external-utilities/typeboxValidator.d.ts.map +1 -1
- package/dist/external-utilities/typeboxValidator.js +3 -5
- package/dist/external-utilities/typeboxValidator.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -0
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +4 -1
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +15 -8
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts +32 -0
- package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -0
- package/dist/feature-libraries/flex-tree/observer.js +33 -0
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -0
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +7 -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 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +2 -2
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +21 -6
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +76 -37
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +114 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +140 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +13 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +115 -85
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +3 -0
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.d.ts +11 -0
- package/dist/shared-tree-core/branchIdCodec.d.ts.map +1 -0
- package/dist/shared-tree-core/branchIdCodec.js +18 -0
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -0
- package/dist/shared-tree-core/editManager.d.ts +39 -64
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +455 -295
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +7 -96
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +17 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.js +139 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +16 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +39 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV5.d.ts +16 -0
- package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV5.js +58 -0
- package/dist/shared-tree-core/editManagerCodecsV5.js.map +1 -0
- package/dist/shared-tree-core/{editManagerFormat.d.ts → editManagerFormatCommons.d.ts} +31 -7
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerFormat.js → editManagerFormatCommons.js} +13 -12
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +31 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +24 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV5.d.ts +62 -0
- package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV5.js +20 -0
- package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -0
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +11 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.js +59 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -0
- package/dist/shared-tree-core/messageCodecV5.d.ts +11 -0
- package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -0
- package/dist/shared-tree-core/messageCodecV5.js +78 -0
- package/dist/shared-tree-core/messageCodecV5.js.map +1 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +16 -47
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/{messageFormat.d.ts → messageFormatV1ToV4.d.ts} +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageFormat.js → messageFormatV1ToV4.js} +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -0
- package/dist/shared-tree-core/messageFormatV5.d.ts +42 -0
- package/dist/shared-tree-core/messageFormatV5.d.ts.map +1 -0
- package/dist/shared-tree-core/messageFormatV5.js +20 -0
- package/dist/shared-tree-core/messageFormatV5.js.map +1 -0
- package/dist/shared-tree-core/messageTypes.d.ts +12 -2
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +19 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +182 -58
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +17 -0
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +2 -0
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +7 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/treeFactory.d.ts +38 -9
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +44 -9
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +8 -8
- package/lib/api.d.ts +17 -0
- package/lib/api.d.ts.map +1 -0
- package/lib/api.js +22 -0
- package/lib/api.js.map +1 -0
- package/lib/beta.d.ts +5 -0
- package/lib/codec/codec.d.ts +3 -5
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +8 -1
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +0 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +0 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +18 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +2 -2
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/external-utilities/index.d.ts +1 -1
- package/lib/external-utilities/index.d.ts.map +1 -1
- package/lib/external-utilities/index.js +1 -1
- package/lib/external-utilities/index.js.map +1 -1
- package/lib/external-utilities/typeboxValidator.d.ts +0 -13
- package/lib/external-utilities/typeboxValidator.d.ts.map +1 -1
- package/lib/external-utilities/typeboxValidator.js +1 -3
- package/lib/external-utilities/typeboxValidator.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -0
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +1 -0
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +15 -8
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts +32 -0
- package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -0
- package/lib/feature-libraries/flex-tree/observer.js +40 -0
- package/lib/feature-libraries/flex-tree/observer.js.map +1 -0
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +7 -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 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +2 -2
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +21 -6
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +78 -39
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +114 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +143 -4
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +13 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +117 -87
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +3 -0
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.d.ts +11 -0
- package/lib/shared-tree-core/branchIdCodec.d.ts.map +1 -0
- package/lib/shared-tree-core/branchIdCodec.js +13 -0
- package/lib/shared-tree-core/branchIdCodec.js.map +1 -0
- package/lib/shared-tree-core/editManager.d.ts +39 -64
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +455 -295
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +4 -93
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +17 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.js +134 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +16 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +35 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV5.d.ts +16 -0
- package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV5.js +54 -0
- package/lib/shared-tree-core/editManagerCodecsV5.js.map +1 -0
- package/lib/shared-tree-core/{editManagerFormat.d.ts → editManagerFormatCommons.d.ts} +31 -7
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerFormat.js → editManagerFormatCommons.js} +10 -11
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +31 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +20 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV5.d.ts +62 -0
- package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV5.js +16 -0
- package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -0
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +11 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.js +55 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -0
- package/lib/shared-tree-core/messageCodecV5.d.ts +11 -0
- package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -0
- package/lib/shared-tree-core/messageCodecV5.js +74 -0
- package/lib/shared-tree-core/messageCodecV5.js.map +1 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +17 -48
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/{messageFormat.d.ts → messageFormatV1ToV4.d.ts} +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageFormat.js → messageFormatV1ToV4.js} +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -0
- package/lib/shared-tree-core/messageFormatV5.d.ts +42 -0
- package/lib/shared-tree-core/messageFormatV5.d.ts.map +1 -0
- package/lib/shared-tree-core/messageFormatV5.js +16 -0
- package/lib/shared-tree-core/messageFormatV5.js.map +1 -0
- package/lib/shared-tree-core/messageTypes.d.ts +12 -2
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +19 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +183 -59
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +17 -0
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -0
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +8 -2
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/treeFactory.d.ts +38 -9
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +41 -8
- package/lib/treeFactory.js.map +1 -1
- package/package.json +25 -25
- package/src/api.ts +30 -0
- package/src/codec/codec.ts +12 -6
- package/src/codec/index.ts +0 -1
- package/src/core/index.ts +1 -0
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/utils.ts +27 -0
- package/src/core/tree/detachedFieldIndex.ts +2 -2
- package/src/external-utilities/index.ts +1 -1
- package/src/external-utilities/typeboxValidator.ts +1 -3
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -0
- package/src/feature-libraries/flex-tree/index.ts +2 -0
- package/src/feature-libraries/flex-tree/lazyNode.ts +13 -3
- package/src/feature-libraries/flex-tree/observer.ts +64 -0
- package/src/feature-libraries/index.ts +3 -0
- package/src/index.ts +6 -4
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizingTreeView.ts +2 -2
- package/src/shared-tree/sharedTree.ts +116 -52
- package/src/shared-tree/treeAlpha.ts +309 -4
- package/src/shared-tree/treeCheckout.ts +152 -100
- package/src/shared-tree-core/branch.ts +7 -0
- package/src/shared-tree-core/branchIdCodec.ts +28 -0
- package/src/shared-tree-core/editManager.ts +729 -430
- package/src/shared-tree-core/editManagerCodecs.ts +4 -164
- package/src/shared-tree-core/editManagerCodecsCommons.ts +245 -0
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +108 -0
- package/src/shared-tree-core/editManagerCodecsV5.ts +156 -0
- package/src/shared-tree-core/{editManagerFormat.ts → editManagerFormatCommons.ts} +17 -13
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +42 -0
- package/src/shared-tree-core/editManagerFormatV5.ts +35 -0
- package/src/shared-tree-core/index.ts +3 -1
- package/src/shared-tree-core/messageCodecV1ToV4.ts +104 -0
- package/src/shared-tree-core/messageCodecV5.ts +131 -0
- package/src/shared-tree-core/messageCodecs.ts +16 -85
- package/src/shared-tree-core/messageFormatV5.ts +50 -0
- package/src/shared-tree-core/messageTypes.ts +15 -2
- package/src/shared-tree-core/sequenceIdUtils.ts +1 -1
- package/src/shared-tree-core/sharedTreeCore.ts +281 -85
- package/src/simple-tree/api/tree.ts +23 -0
- package/src/simple-tree/core/unhydratedFlexTree.ts +11 -2
- package/src/treeFactory.ts +48 -8
- package/dist/codec/noopValidator.d.ts +0 -13
- package/dist/codec/noopValidator.d.ts.map +0 -1
- package/dist/codec/noopValidator.js +0 -17
- package/dist/codec/noopValidator.js.map +0 -1
- package/dist/shared-tree-core/editManagerFormat.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerFormat.js.map +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +0 -1
- package/dist/shared-tree-core/messageFormat.js.map +0 -1
- package/docs/user-facing/schema-evolution.md +0 -309
- package/lib/codec/noopValidator.d.ts +0 -13
- package/lib/codec/noopValidator.d.ts.map +0 -1
- package/lib/codec/noopValidator.js +0 -14
- package/lib/codec/noopValidator.js.map +0 -1
- package/lib/shared-tree-core/editManagerFormat.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerFormat.js.map +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +0 -1
- package/lib/shared-tree-core/messageFormat.js.map +0 -1
- package/src/codec/noopValidator.ts +0 -18
- /package/src/shared-tree-core/{messageFormat.ts → messageFormatV1ToV4.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tree",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.62.0",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"./internal/test": {
|
|
67
67
|
"allow-ff-test-exports": {
|
|
68
68
|
"import": {
|
|
69
|
-
"types": "./lib/test/
|
|
70
|
-
"default": "./lib/test/
|
|
69
|
+
"types": "./lib/test/testExports.d.ts",
|
|
70
|
+
"default": "./lib/test/testExports.js"
|
|
71
71
|
},
|
|
72
72
|
"require": {
|
|
73
|
-
"types": "./dist/test/
|
|
74
|
-
"default": "./dist/test/
|
|
73
|
+
"types": "./dist/test/testExports.d.ts",
|
|
74
|
+
"default": "./dist/test/testExports.js"
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"temp-directory": "nyc/.nyc_output"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@fluid-internal/client-utils": "~2.
|
|
105
|
-
"@fluidframework/container-runtime": "~2.
|
|
106
|
-
"@fluidframework/core-interfaces": "~2.
|
|
107
|
-
"@fluidframework/core-utils": "~2.
|
|
108
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
109
|
-
"@fluidframework/driver-definitions": "~2.
|
|
110
|
-
"@fluidframework/id-compressor": "~2.
|
|
111
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
112
|
-
"@fluidframework/runtime-utils": "~2.
|
|
113
|
-
"@fluidframework/shared-object-base": "~2.
|
|
114
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
104
|
+
"@fluid-internal/client-utils": "~2.62.0",
|
|
105
|
+
"@fluidframework/container-runtime": "~2.62.0",
|
|
106
|
+
"@fluidframework/core-interfaces": "~2.62.0",
|
|
107
|
+
"@fluidframework/core-utils": "~2.62.0",
|
|
108
|
+
"@fluidframework/datastore-definitions": "~2.62.0",
|
|
109
|
+
"@fluidframework/driver-definitions": "~2.62.0",
|
|
110
|
+
"@fluidframework/id-compressor": "~2.62.0",
|
|
111
|
+
"@fluidframework/runtime-definitions": "~2.62.0",
|
|
112
|
+
"@fluidframework/runtime-utils": "~2.62.0",
|
|
113
|
+
"@fluidframework/shared-object-base": "~2.62.0",
|
|
114
|
+
"@fluidframework/telemetry-utils": "~2.62.0",
|
|
115
115
|
"@sinclair/typebox": "^0.34.13",
|
|
116
116
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
117
117
|
"@types/ungap__structured-clone": "^1.2.0",
|
|
@@ -121,19 +121,19 @@
|
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
123
123
|
"@biomejs/biome": "~1.9.3",
|
|
124
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
125
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
126
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
127
|
-
"@fluid-private/test-drivers": "~2.
|
|
124
|
+
"@fluid-internal/mocha-test-setup": "~2.62.0",
|
|
125
|
+
"@fluid-private/stochastic-test-utils": "~2.62.0",
|
|
126
|
+
"@fluid-private/test-dds-utils": "~2.62.0",
|
|
127
|
+
"@fluid-private/test-drivers": "~2.62.0",
|
|
128
128
|
"@fluid-tools/benchmark": "^0.51.0",
|
|
129
129
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
130
130
|
"@fluidframework/build-common": "^2.0.3",
|
|
131
131
|
"@fluidframework/build-tools": "^0.58.3",
|
|
132
|
-
"@fluidframework/container-definitions": "~2.
|
|
133
|
-
"@fluidframework/container-loader": "~2.
|
|
132
|
+
"@fluidframework/container-definitions": "~2.62.0",
|
|
133
|
+
"@fluidframework/container-loader": "~2.62.0",
|
|
134
134
|
"@fluidframework/eslint-config-fluid": "^6.0.0",
|
|
135
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
136
|
-
"@fluidframework/test-utils": "~2.
|
|
135
|
+
"@fluidframework/test-runtime-utils": "~2.62.0",
|
|
136
|
+
"@fluidframework/test-utils": "~2.62.0",
|
|
137
137
|
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.60.0",
|
|
138
138
|
"@microsoft/api-extractor": "7.52.11",
|
|
139
139
|
"@types/diff": "^3.5.1",
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"test:memory": "mocha --perfMode --config ./src/test/memory/.mocharc.cjs",
|
|
229
229
|
"test:memory-profiling:report": "mocha --config ./src/test/memory/.mocharc.cjs",
|
|
230
230
|
"test:mocha": "echo skipping non-smoke cjs to avoid overhead && npm run test:mocha:cjs -- --fgrep @Smoke && npm run test:mocha:esm",
|
|
231
|
-
"test:mocha:cjs": "cross-env
|
|
231
|
+
"test:mocha:cjs": "cross-env FLUID_TEST_MODULE_SYSTEM=CJS mocha",
|
|
232
232
|
"test:mocha:esm": "mocha",
|
|
233
233
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
234
234
|
"test:snapshots:regen": "pnpm test:mocha:esm --snapshot",
|
package/src/api.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
type TreeView,
|
|
8
|
+
type TreeViewAlpha,
|
|
9
|
+
type ImplicitFieldSchema,
|
|
10
|
+
// eslint-disable-next-line import/no-deprecated
|
|
11
|
+
asTreeViewAlpha,
|
|
12
|
+
} from "./simple-tree/index.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.
|
|
16
|
+
* For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.
|
|
17
|
+
* In the future, `asBeta` may be added here too.
|
|
18
|
+
* These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function asAlpha<TSchema extends ImplicitFieldSchema>(
|
|
26
|
+
view: TreeView<TSchema>,
|
|
27
|
+
): TreeViewAlpha<TSchema> {
|
|
28
|
+
// eslint-disable-next-line import/no-deprecated
|
|
29
|
+
return asTreeViewAlpha(view);
|
|
30
|
+
}
|
package/src/codec/codec.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type { Static, TAnySchema, TSchema } from "@sinclair/typebox";
|
|
|
10
10
|
|
|
11
11
|
import type { ChangeEncodingContext } from "../core/index.js";
|
|
12
12
|
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
13
|
-
import { noopValidator } from "./noopValidator.js";
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Translates decoded data to encoded data.
|
|
@@ -37,7 +36,6 @@ export interface IDecoder<TDecoded, TEncoded, TContext> {
|
|
|
37
36
|
/**
|
|
38
37
|
* Validates data complies with some particular schema.
|
|
39
38
|
* Implementations are typically created by a {@link JsonValidator}.
|
|
40
|
-
* @alpha @input
|
|
41
39
|
*/
|
|
42
40
|
export interface SchemaValidationFunction<Schema extends TSchema> {
|
|
43
41
|
/**
|
|
@@ -66,6 +64,15 @@ export interface SchemaValidationFunction<Schema extends TSchema> {
|
|
|
66
64
|
*/
|
|
67
65
|
export interface FormatValidator extends ErasedType<"FormatValidator"> {}
|
|
68
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.
|
|
69
|
+
* @privateRemarks Having this as an option unifies opting out of validation with selection of
|
|
70
|
+
* validators, simplifying code performing validation.
|
|
71
|
+
*/
|
|
72
|
+
const noopValidator: JsonValidator = {
|
|
73
|
+
compile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),
|
|
74
|
+
};
|
|
75
|
+
|
|
69
76
|
/**
|
|
70
77
|
* A {@link FormatValidator} which does no validation.
|
|
71
78
|
* @alpha
|
|
@@ -122,11 +129,10 @@ export interface ICodecOptions {
|
|
|
122
129
|
* SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)
|
|
123
130
|
* whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,
|
|
124
131
|
* which reduces the risk of unrecoverable data corruption.
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* it is recommended to use {@link FormatValidator} instead.
|
|
132
|
+
* @privateRemarks
|
|
133
|
+
* This property should probably be renamed to `validator` before stabilizing the API.
|
|
128
134
|
*/
|
|
129
|
-
readonly jsonValidator:
|
|
135
|
+
readonly jsonValidator: FormatValidator;
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
/**
|
package/src/codec/index.ts
CHANGED
package/src/core/index.ts
CHANGED
package/src/core/rebase/index.ts
CHANGED
package/src/core/rebase/utils.ts
CHANGED
|
@@ -678,3 +678,30 @@ export function isAncestor<TNode extends { readonly parent?: TNode }>(
|
|
|
678
678
|
|
|
679
679
|
return false;
|
|
680
680
|
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Returns a change that represents the different between two places in a commit graph.
|
|
684
|
+
* Applying this change to the state at `sourceCommit` will yield the state at `targetCommit`.
|
|
685
|
+
* @param changeRebaser - the change rebaser responsible for providing inverses to the changes in the commits.
|
|
686
|
+
* @param sourceCommit - the commit representing the initial state.
|
|
687
|
+
* @param targetCommit - the commit representing the final state.
|
|
688
|
+
* @param mintRevisionTag - a function which can be called to create revision tags for any rollback changes that need to be generated.
|
|
689
|
+
* @returns a change representing the difference between `sourceCommit` and `targetCommit`.
|
|
690
|
+
*/
|
|
691
|
+
export function diffHistories<TChange>(
|
|
692
|
+
changeRebaser: ChangeRebaser<TChange>,
|
|
693
|
+
sourceCommit: GraphCommit<TChange>,
|
|
694
|
+
targetCommit: GraphCommit<TChange>,
|
|
695
|
+
mintRevisionTag: () => RevisionTag,
|
|
696
|
+
): TChange {
|
|
697
|
+
const sourcePath: GraphCommit<TChange>[] = [];
|
|
698
|
+
const targetPath: GraphCommit<TChange>[] = [];
|
|
699
|
+
const ancestor = findCommonAncestor([sourceCommit, sourcePath], [targetCommit, targetPath]);
|
|
700
|
+
assert(ancestor !== undefined, 0xc6f /* Branches must be related */);
|
|
701
|
+
const inverses = sourcePath.map((commit) =>
|
|
702
|
+
rollbackFromCommit(changeRebaser, commit, mintRevisionTag),
|
|
703
|
+
);
|
|
704
|
+
|
|
705
|
+
inverses.reverse();
|
|
706
|
+
return changeRebaser.compose([...inverses, ...targetPath]);
|
|
707
|
+
}
|
|
@@ -9,8 +9,8 @@ import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
|
9
9
|
import {
|
|
10
10
|
type CodecWriteOptions,
|
|
11
11
|
FluidClientVersion,
|
|
12
|
+
FormatValidatorNoOp,
|
|
12
13
|
type IJsonCodec,
|
|
13
|
-
noopValidator,
|
|
14
14
|
} from "../../codec/index.js";
|
|
15
15
|
import {
|
|
16
16
|
type IdAllocator,
|
|
@@ -83,7 +83,7 @@ export class DetachedFieldIndex {
|
|
|
83
83
|
options?: CodecWriteOptions,
|
|
84
84
|
) {
|
|
85
85
|
this.options = options ?? {
|
|
86
|
-
jsonValidator:
|
|
86
|
+
jsonValidator: FormatValidatorNoOp,
|
|
87
87
|
oldestCompatibleClient: FluidClientVersion.v2_0,
|
|
88
88
|
};
|
|
89
89
|
this.codec = makeDetachedFieldIndexCodec(revisionTagCodec, this.options, idCompressor);
|
|
@@ -18,10 +18,8 @@ import { toFormatValidator, type JsonValidator } from "../codec/index.js";
|
|
|
18
18
|
* (i.e. a JSON validator is only included in an application's bundle if that application references it).
|
|
19
19
|
*
|
|
20
20
|
* Defining this validator in its own file also helps to ensure it is tree-shakeable.
|
|
21
|
-
*
|
|
22
|
-
* @alpha
|
|
23
21
|
*/
|
|
24
|
-
|
|
22
|
+
const typeboxValidator: JsonValidator = {
|
|
25
23
|
compile: <Schema extends TSchema>(schema: Schema) => {
|
|
26
24
|
const compiledFormat = TypeCompiler.Compile(schema);
|
|
27
25
|
return {
|
|
@@ -151,6 +151,8 @@ export enum TreeStatus {
|
|
|
151
151
|
*
|
|
152
152
|
* @remarks
|
|
153
153
|
* All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.
|
|
154
|
+
*
|
|
155
|
+
* All implementations should track read access in {@link currentObserver}'s observation methods as appropriate.
|
|
154
156
|
*/
|
|
155
157
|
export interface FlexTreeNode extends FlexTreeEntity, MapTreeNodeViewGeneric<FlexTreeNode> {
|
|
156
158
|
readonly [flexTreeMarker]: FlexTreeEntityKind.Node;
|
|
@@ -42,3 +42,5 @@ export { getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
|
|
|
42
42
|
export { getSchemaAndPolicy, indexForAt } from "./utilities.js";
|
|
43
43
|
|
|
44
44
|
export { treeStatusFromAnchorCache } from "./utilities.js";
|
|
45
|
+
|
|
46
|
+
export { currentObserver, withObservation, type Observer } from "./observer.js";
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from "./flexTreeTypes.js";
|
|
34
34
|
import { LazyEntity } from "./lazyEntity.js";
|
|
35
35
|
import { makeField } from "./lazyField.js";
|
|
36
|
+
import { currentObserver } from "./observer.js";
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Get or create a {@link HydratedFlexTreeNode} for the given context at node indicated by the cursor.
|
|
@@ -118,18 +119,23 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTree
|
|
|
118
119
|
public readonly fields: Pick<Map<FieldKey, FlexTreeField>, typeof Symbol.iterator | "get"> =
|
|
119
120
|
{
|
|
120
121
|
get: (key: FieldKey): FlexTreeField | undefined => this.tryGetField(key),
|
|
121
|
-
[Symbol.iterator]: (): IterableIterator<[FieldKey, FlexTreeField]> =>
|
|
122
|
-
|
|
122
|
+
[Symbol.iterator]: (): IterableIterator<[FieldKey, FlexTreeField]> => {
|
|
123
|
+
currentObserver?.observeNodeFields(this);
|
|
124
|
+
|
|
125
|
+
return mapCursorFields(this.cursor, (cursor) => {
|
|
123
126
|
const key: FieldKey = cursor.getFieldKey();
|
|
124
127
|
const pair: [FieldKey, FlexTreeField] = [
|
|
125
128
|
key,
|
|
126
129
|
makeField(this.context, this.storedSchema.getFieldSchema(key).kind, cursor),
|
|
127
130
|
];
|
|
128
131
|
return pair;
|
|
129
|
-
}).values()
|
|
132
|
+
}).values();
|
|
133
|
+
},
|
|
130
134
|
};
|
|
131
135
|
|
|
132
136
|
public tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {
|
|
137
|
+
currentObserver?.observeNodeField(this, fieldKey);
|
|
138
|
+
|
|
133
139
|
const schema = this.storedSchema.getFieldSchema(fieldKey);
|
|
134
140
|
return inCursorField(this.cursor, fieldKey, (cursor) => {
|
|
135
141
|
if (cursor.getFieldLength() === 0) {
|
|
@@ -140,6 +146,8 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTree
|
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
public getBoxed(key: FieldKey): FlexTreeField {
|
|
149
|
+
currentObserver?.observeNodeField(this, key);
|
|
150
|
+
|
|
143
151
|
const fieldSchema = this.storedSchema.getFieldSchema(key);
|
|
144
152
|
return inCursorField(this.cursor, key, (cursor) => {
|
|
145
153
|
return makeField(this.context, fieldSchema.kind, cursor);
|
|
@@ -157,6 +165,8 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements HydratedFlexTree
|
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
public get parentField(): { readonly parent: FlexTreeField; readonly index: number } {
|
|
168
|
+
currentObserver?.observeParentOf(this);
|
|
169
|
+
|
|
160
170
|
const cursor = this.cursor;
|
|
161
171
|
const index = this.anchorNode.parentIndex;
|
|
162
172
|
assert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { debugAssert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { FlexTreeNode } from "./flexTreeTypes.js";
|
|
8
|
+
import type { FieldKey } from "../../core/index.js";
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* This file sets up a static observation tracking system.
|
|
12
|
+
*
|
|
13
|
+
* This library used to contain a more general variant of this which was deleted in https://github.com/microsoft/FluidFramework/pull/18659.
|
|
14
|
+
* This pattern somewhat resembles the approach in https://github.com/tc39/proposal-signals.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* An object informed about observation made to trees.
|
|
19
|
+
* @remarks
|
|
20
|
+
* See {@link withObservation} and {@link currentObserver}.
|
|
21
|
+
*/
|
|
22
|
+
export interface Observer {
|
|
23
|
+
observeNodeFields(node: FlexTreeNode): void;
|
|
24
|
+
observeNodeField(node: FlexTreeNode, key: FieldKey): void;
|
|
25
|
+
observeParentOf(node: FlexTreeNode): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The current observer, if any.
|
|
30
|
+
* @remarks
|
|
31
|
+
* Set via {@link setObserver} as used by {@link withObservation}.
|
|
32
|
+
* It should not be assigned in any other way.
|
|
33
|
+
* @privateRemarks
|
|
34
|
+
* This is exported directly as a property instead of via a getter for reduced overhead (less code, faster access) as this is used on some hot paths and its performance matters.
|
|
35
|
+
* The case where this is undefined (no observation) is particularly important for performance as we do not want to regress code which is not using this feature very much.
|
|
36
|
+
* Since it is not exported outside the package, this seems like a fine tradeoff, but could be reevaluated with some benchmarking if needed.
|
|
37
|
+
*/
|
|
38
|
+
export let currentObserver: Observer | undefined;
|
|
39
|
+
|
|
40
|
+
const observerStack: (Observer | undefined)[] = [];
|
|
41
|
+
|
|
42
|
+
function setObserver(newObserver: Observer | undefined): void {
|
|
43
|
+
observerStack.push(newObserver);
|
|
44
|
+
currentObserver = newObserver;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function clearObserver(): void {
|
|
48
|
+
debugAssert(() => observerStack.length > 0 || "Empty Observer stack on clear");
|
|
49
|
+
const popped = observerStack.pop();
|
|
50
|
+
debugAssert(() => popped === currentObserver || "Mismatched observer stack");
|
|
51
|
+
currentObserver = observerStack[observerStack.length - 1];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* For the duration of `f`, pushes `newObserver` onto the observer stack, making it the {@link currentObserver}.
|
|
56
|
+
*/
|
|
57
|
+
export function withObservation<T>(newObserver: Observer | undefined, f: () => T): T {
|
|
58
|
+
setObserver(newObserver);
|
|
59
|
+
try {
|
|
60
|
+
return f();
|
|
61
|
+
} finally {
|
|
62
|
+
clearObserver();
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export {
|
|
|
57
57
|
export {
|
|
58
58
|
type ITreeInternal,
|
|
59
59
|
type SharedTreeOptions,
|
|
60
|
+
type SharedTreeOptionsBeta,
|
|
60
61
|
type ForestType,
|
|
61
62
|
type SharedTreeFormatOptions,
|
|
62
63
|
SharedTreeFormatVersion,
|
|
@@ -69,6 +70,7 @@ export {
|
|
|
69
70
|
independentInitializedView,
|
|
70
71
|
type ViewContent,
|
|
71
72
|
TreeAlpha,
|
|
73
|
+
type ObservationResults,
|
|
72
74
|
type TreeIdentifierUtils,
|
|
73
75
|
independentView,
|
|
74
76
|
ForestTypeOptimized,
|
|
@@ -275,6 +277,8 @@ export {
|
|
|
275
277
|
export {
|
|
276
278
|
SharedTree,
|
|
277
279
|
configuredSharedTree,
|
|
280
|
+
configuredSharedTreeBeta,
|
|
281
|
+
configuredSharedTreeBetaLegacy,
|
|
278
282
|
} from "./treeFactory.js";
|
|
279
283
|
export { SharedTreeAttributes, SharedTreeFactoryType } from "./sharedTreeAttributes.js";
|
|
280
284
|
export { persistedToSimpleSchema } from "./shared-tree/index.js";
|
|
@@ -282,14 +286,11 @@ export { persistedToSimpleSchema } from "./shared-tree/index.js";
|
|
|
282
286
|
export {
|
|
283
287
|
type ICodecOptions,
|
|
284
288
|
type CodecWriteOptions,
|
|
285
|
-
type JsonValidator,
|
|
286
|
-
type SchemaValidationFunction,
|
|
287
289
|
FluidClientVersion,
|
|
288
290
|
type FormatValidator,
|
|
289
291
|
FormatValidatorNoOp,
|
|
290
292
|
} from "./codec/index.js";
|
|
291
|
-
export {
|
|
292
|
-
export { typeboxValidator, FormatValidatorBasic } from "./external-utilities/index.js";
|
|
293
|
+
export { FormatValidatorBasic } from "./external-utilities/index.js";
|
|
293
294
|
|
|
294
295
|
export type {
|
|
295
296
|
// Type Testing
|
|
@@ -332,3 +333,4 @@ export type { MapNodeInsertableData } from "./simple-tree/index.js";
|
|
|
332
333
|
export { JsonAsTree } from "./jsonDomainSchema.js";
|
|
333
334
|
export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
|
|
334
335
|
export { TableSchema, type System_TableSchema } from "./tableSchema.js";
|
|
336
|
+
export { asAlpha } from "./api.js";
|
package/src/packageVersion.ts
CHANGED
package/src/shared-tree/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export {
|
|
|
7
7
|
type ITreePrivate,
|
|
8
8
|
type SharedTreeOptionsInternal,
|
|
9
9
|
type SharedTreeOptions,
|
|
10
|
+
type SharedTreeOptionsBeta,
|
|
10
11
|
SharedTreeKernel,
|
|
11
12
|
getBranch,
|
|
12
13
|
type ForestType,
|
|
@@ -49,6 +50,7 @@ export type { RunTransaction } from "./tree.js";
|
|
|
49
50
|
export {
|
|
50
51
|
TreeAlpha,
|
|
51
52
|
type TreeIdentifierUtils,
|
|
53
|
+
type ObservationResults,
|
|
52
54
|
} from "./treeAlpha.js";
|
|
53
55
|
|
|
54
56
|
export {
|
|
@@ -420,8 +420,8 @@ export class SchematizingSimpleTreeView<
|
|
|
420
420
|
this.checkout.forest.anchors.slots.delete(ViewSlot);
|
|
421
421
|
this.currentCompatibility = undefined;
|
|
422
422
|
this.onDispose?.();
|
|
423
|
-
if (this.checkout.
|
|
424
|
-
// All
|
|
423
|
+
if (!this.checkout.isSharedBranch && !this.checkout.disposed) {
|
|
424
|
+
// All non-shared branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.
|
|
425
425
|
this.checkout.dispose();
|
|
426
426
|
}
|
|
427
427
|
}
|