@fluidframework/tree 2.116.0 → 2.117.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 +116 -0
- package/api-report/tree.alpha.api.md +78 -30
- package/api-report/tree.beta.api.md +12 -9
- package/api-report/tree.legacy.beta.api.md +12 -9
- package/dist/codec/codec.d.ts +18 -0
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +18 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +39 -2
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +37 -2
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +1 -0
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/revertible.d.ts +62 -6
- package/dist/core/revertible.d.ts.map +1 -1
- package/dist/core/revertible.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/feature-libraries/indexing/types.d.ts +1 -1
- package/dist/feature-libraries/indexing/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/history.d.ts +22 -0
- package/dist/shared-tree/history.d.ts.map +1 -0
- package/dist/shared-tree/history.js +66 -0
- package/dist/shared-tree/history.js.map +1 -0
- package/dist/shared-tree/schematizingTreeView.d.ts +12 -7
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +13 -0
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +2 -0
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/tree.js +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +8 -20
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +9 -12
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +16 -9
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +130 -33
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.d.ts +3 -2
- package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -0
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +16 -2
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +20 -2
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitCounter.d.ts +31 -0
- package/dist/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
- package/dist/shared-tree-core/branchCommitCounter.js +79 -0
- package/dist/shared-tree-core/branchCommitCounter.js.map +1 -0
- package/dist/shared-tree-core/customMetadataCodec.d.ts +9 -0
- package/dist/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
- package/dist/shared-tree-core/customMetadataCodec.js +37 -0
- package/dist/shared-tree-core/customMetadataCodec.js.map +1 -0
- package/dist/shared-tree-core/customMetadataFormat.d.ts +18 -0
- package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
- package/dist/shared-tree-core/customMetadataFormat.js +15 -0
- package/dist/shared-tree-core/customMetadataFormat.js.map +1 -0
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +15 -3
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +5 -0
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +17 -5
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +18 -8
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -3
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +12 -3
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +5 -0
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +1 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +6 -0
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +10 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -0
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +4 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +9 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +26 -4
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +28 -2
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +180 -61
- 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/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/tableSchema.js +10 -10
- package/dist/tableSchema.js.map +1 -1
- package/lib/codec/codec.d.ts +18 -0
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +18 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- 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/types.d.ts +39 -2
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +35 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +1 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/revertible.d.ts +62 -6
- package/lib/core/revertible.d.ts.map +1 -1
- package/lib/core/revertible.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/feature-libraries/indexing/types.d.ts +1 -1
- package/lib/feature-libraries/indexing/types.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/history.d.ts +22 -0
- package/lib/shared-tree/history.d.ts.map +1 -0
- package/lib/shared-tree/history.js +62 -0
- package/lib/shared-tree/history.js.map +1 -0
- package/lib/shared-tree/schematizingTreeView.d.ts +12 -7
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +13 -0
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -0
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/tree.js +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +8 -20
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +9 -12
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +16 -9
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +131 -34
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.d.ts +3 -2
- package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +3 -0
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +16 -2
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +20 -2
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitCounter.d.ts +31 -0
- package/lib/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
- package/lib/shared-tree-core/branchCommitCounter.js +75 -0
- package/lib/shared-tree-core/branchCommitCounter.js.map +1 -0
- package/lib/shared-tree-core/customMetadataCodec.d.ts +9 -0
- package/lib/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
- package/lib/shared-tree-core/customMetadataCodec.js +32 -0
- package/lib/shared-tree-core/customMetadataCodec.js.map +1 -0
- package/lib/shared-tree-core/customMetadataFormat.d.ts +18 -0
- package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
- package/lib/shared-tree-core/customMetadataFormat.js +11 -0
- package/lib/shared-tree-core/customMetadataFormat.js.map +1 -0
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +16 -4
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +5 -0
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +17 -5
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +18 -8
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +4 -3
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +1 -0
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +12 -3
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +5 -0
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +1 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +6 -0
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +10 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +2 -0
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +5 -3
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +9 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +27 -5
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +28 -2
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +180 -61
- 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/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/tableSchema.js +10 -10
- package/lib/tableSchema.js.map +1 -1
- package/package.json +23 -23
- package/src/codec/codec.ts +19 -0
- package/src/core/index.ts +4 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +72 -2
- package/src/core/rebase/utils.ts +1 -0
- package/src/core/revertible.ts +67 -6
- package/src/entrypoints/alpha.ts +8 -0
- package/src/entrypoints/beta.ts +1 -0
- package/src/entrypoints/legacy.ts +1 -0
- package/src/feature-libraries/indexing/types.ts +1 -1
- package/src/index.ts +8 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/history.ts +99 -0
- package/src/shared-tree/schematizingTreeView.ts +25 -8
- package/src/shared-tree/sharedTree.ts +5 -2
- package/src/shared-tree/tree.ts +1 -1
- package/src/shared-tree/treeAlpha.ts +17 -35
- package/src/shared-tree/treeCheckout.ts +178 -39
- package/src/shared-tree/unhydratedTreeContext.ts +6 -2
- package/src/shared-tree-core/branch.ts +34 -2
- package/src/shared-tree-core/branchCommitCounter.ts +103 -0
- package/src/shared-tree-core/customMetadataCodec.ts +42 -0
- package/src/shared-tree-core/customMetadataFormat.ts +39 -0
- package/src/shared-tree-core/editManager.ts +22 -3
- package/src/shared-tree-core/editManagerCodecs.ts +12 -0
- package/src/shared-tree-core/editManagerCodecsCommons.ts +41 -15
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +7 -1
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -0
- package/src/shared-tree-core/editManagerFormatCommons.ts +46 -12
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +13 -5
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -2
- package/src/shared-tree-core/index.ts +3 -0
- package/src/shared-tree-core/messageCodecV1ToV4.ts +18 -5
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +9 -2
- package/src/shared-tree-core/messageCodecs.ts +12 -0
- package/src/shared-tree-core/messageFormat.ts +6 -0
- package/src/shared-tree-core/messageFormatV1ToV4.ts +21 -3
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +8 -0
- package/src/shared-tree-core/sharedTreeCore.ts +5 -2
- package/src/shared-tree-core/transaction.ts +56 -4
- package/src/simple-tree/api/index.ts +5 -0
- package/src/simple-tree/api/transactionTypes.ts +29 -2
- package/src/simple-tree/api/tree.ts +199 -60
- package/src/simple-tree/index.ts +5 -0
- package/src/tableSchema.ts +9 -9
|
@@ -8,8 +8,12 @@ import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/co
|
|
|
8
8
|
import type {
|
|
9
9
|
ChangeMetadata,
|
|
10
10
|
CommitMetadata,
|
|
11
|
+
CustomMetadataTree,
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
|
|
13
|
+
Revertible,
|
|
11
14
|
RevertibleAlphaFactory,
|
|
12
15
|
RevertibleFactory,
|
|
16
|
+
RevertToOptionsAlpha,
|
|
13
17
|
} from "../../core/index.js";
|
|
14
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
|
|
15
19
|
import type { TreeStatus } from "../../feature-libraries/index.js";
|
|
@@ -17,7 +21,10 @@ import type {
|
|
|
17
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This is referenced by doc comments.
|
|
18
22
|
TreeAlpha,
|
|
19
23
|
} from "../../shared-tree/index.js";
|
|
20
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
JsonCompatibleReadOnly,
|
|
26
|
+
JsonCompatibleReadOnlyObject,
|
|
27
|
+
} from "../../util/index.js";
|
|
21
28
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
|
|
22
29
|
import type { Unhydrated } from "../core/index.js";
|
|
23
30
|
import type {
|
|
@@ -144,58 +151,66 @@ export interface ITreeAlpha extends ITree {
|
|
|
144
151
|
}
|
|
145
152
|
|
|
146
153
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @remarks
|
|
154
|
+
* An untyped view of a (version-control-style) branch of a SharedTree.
|
|
155
|
+
* @remarks An `UntypedTreeView` allows for the {@link UntypedTreeView.fork | creation of branches} and for those branches to later be {@link UntypedTreeView.merge | merged}.
|
|
149
156
|
*
|
|
150
157
|
* The branch associated directly with the {@link ITree | SharedTree} is the "main" branch, and all other branches fork (directly or transitively) from that main branch.
|
|
151
158
|
*
|
|
152
|
-
* See {@link
|
|
159
|
+
* See {@link UntypedTreeViewAlpha} for additional APIs that are in an earlier stage of development.
|
|
153
160
|
* @sealed @beta
|
|
154
161
|
*/
|
|
155
|
-
export interface
|
|
162
|
+
export interface UntypedTreeView extends IDisposable {
|
|
156
163
|
/**
|
|
157
164
|
* Fork a new branch off of this branch which is based off of this branch's current state.
|
|
158
|
-
* @remarks Any changes to the tree on the new
|
|
159
|
-
* The
|
|
165
|
+
* @remarks Any changes to the tree on the new view will not apply to this view until the new view is e.g. {@link UntypedTreeView.merge | merged} back into this view.
|
|
166
|
+
* The view should be disposed when no longer needed, either {@link UntypedTreeView.dispose | explicitly} or {@link UntypedTreeView.merge | implicitly when merging} into another view.
|
|
160
167
|
*/
|
|
161
|
-
fork():
|
|
168
|
+
fork(): UntypedTreeView;
|
|
162
169
|
|
|
163
170
|
/**
|
|
164
|
-
* Apply all the new changes on the given
|
|
165
|
-
* @param
|
|
166
|
-
* @param disposeMerged -
|
|
171
|
+
* Apply all the new changes on the given view to this view.
|
|
172
|
+
* @param view - A view created by {@link UntypedTreeView.fork}.
|
|
173
|
+
* @param disposeMerged - Whether or not to dispose `view` after the merge completes.
|
|
167
174
|
* Defaults to true.
|
|
168
|
-
* The {@link
|
|
169
|
-
* @remarks All ongoing transactions (if any) in `
|
|
175
|
+
* The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
|
|
176
|
+
* @remarks All ongoing transactions (if any) in `view` will be committed before the merge.
|
|
170
177
|
*/
|
|
171
|
-
merge(
|
|
178
|
+
merge(view: UntypedTreeView, disposeMerged?: boolean): void;
|
|
172
179
|
|
|
173
180
|
/**
|
|
174
|
-
* Advance this
|
|
175
|
-
* @param
|
|
176
|
-
* @remarks After rebasing, this
|
|
177
|
-
* This method may only be called on
|
|
181
|
+
* Advance this view forward such that all new changes on the target view become part of this view.
|
|
182
|
+
* @param view - The view to rebase onto.
|
|
183
|
+
* @remarks After rebasing, this view will be "ahead" of the target view, that is, its unique changes will have been recreated as if they happened after all changes on the target view.
|
|
184
|
+
* This method may only be called on views produced via {@link UntypedTreeView.fork | fork} - attempting to rebase the main view will throw.
|
|
178
185
|
*
|
|
179
186
|
* Rebasing long-lived branches is important to avoid consuming memory unnecessarily.
|
|
180
187
|
* In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last rebased.
|
|
181
188
|
*
|
|
182
|
-
* The {@link
|
|
189
|
+
* The {@link UntypedTreeView | main view} cannot be rebased onto another view - attempting to do so will throw an error.
|
|
183
190
|
*/
|
|
184
|
-
rebaseOnto(
|
|
191
|
+
rebaseOnto(view: UntypedTreeView): void;
|
|
185
192
|
|
|
186
193
|
/**
|
|
187
|
-
* Dispose of this
|
|
194
|
+
* Dispose of this view, cleaning up any resources associated with it.
|
|
188
195
|
* @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
|
|
189
|
-
* @remarks
|
|
196
|
+
* @remarks Views can also be automatically disposed when {@link UntypedTreeView.merge | they are merged} into another view.
|
|
190
197
|
*
|
|
191
198
|
* Disposing branches is important to avoid consuming memory unnecessarily.
|
|
192
|
-
* In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind"
|
|
199
|
+
* In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" view was created or last {@link UntypedTreeView.rebaseOnto | rebased}.
|
|
193
200
|
*
|
|
194
|
-
* The {@link
|
|
201
|
+
* The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
|
|
195
202
|
*/
|
|
196
203
|
dispose(error?: Error): void;
|
|
197
204
|
}
|
|
198
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Compatibility alias for {@link UntypedTreeView}.
|
|
208
|
+
*
|
|
209
|
+
* @deprecated Use {@link UntypedTreeView} instead.
|
|
210
|
+
* @beta
|
|
211
|
+
*/
|
|
212
|
+
export type TreeBranch = UntypedTreeView;
|
|
213
|
+
|
|
199
214
|
/**
|
|
200
215
|
* Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.
|
|
201
216
|
* @alpha
|
|
@@ -223,7 +238,7 @@ export interface TreeContextAlpha {
|
|
|
223
238
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
224
239
|
*
|
|
225
240
|
* `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.
|
|
226
|
-
* Use {@link TreeContextAlpha.
|
|
241
|
+
* Use {@link TreeContextAlpha.isView | isView() } to check whether this context is associated with a view and gain {@link UntypedTreeViewAlpha.(runTransaction:1) | access to more transaction capabilities} if so.
|
|
227
242
|
*/
|
|
228
243
|
runTransaction<TValue>(
|
|
229
244
|
transaction: () => WithValue<TValue>,
|
|
@@ -271,44 +286,130 @@ export interface TreeContextAlpha {
|
|
|
271
286
|
): Promise<TransactionVoidResult>;
|
|
272
287
|
|
|
273
288
|
/**
|
|
274
|
-
* True if this context is associated with
|
|
275
|
-
* @remarks If this returns true, the context can be safely inferred or cast to {@link
|
|
289
|
+
* True if this context is associated with an {@link UntypedTreeViewAlpha | untyped view} and false if it is associated with an {@link Unhydrated | unhydrated } node.
|
|
290
|
+
* @remarks If this returns true, the context can be safely inferred or cast to {@link UntypedTreeViewAlpha} to access additional view-specific APIs.
|
|
276
291
|
* @example
|
|
277
292
|
* ```typescript
|
|
278
293
|
* const context = tree.context(someNode);
|
|
279
|
-
* if (context.
|
|
280
|
-
* assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on
|
|
294
|
+
* if (context.isView()) {
|
|
295
|
+
* assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on UntypedTreeViewAlpha, so this is only accessible if `context` is a view context.
|
|
281
296
|
* context.root.foo = "bar"; // Edit the root of the SharedTree that `someNode` belongs to.
|
|
282
297
|
* }
|
|
283
298
|
* ```
|
|
299
|
+
* @returns Whether this context is associated with an untyped view.
|
|
300
|
+
*/
|
|
301
|
+
isView(): this is UntypedTreeViewAlpha;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* {@inheritDoc TreeContextAlpha.isView}
|
|
305
|
+
* @deprecated Use {@link TreeContextAlpha.isView | isView()} instead.
|
|
306
|
+
*/
|
|
307
|
+
isBranch(): this is UntypedTreeViewAlpha;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* An identifier for a commit in a {@link UntypedTreeViewAlpha}'s {@link UntypedTreeViewAlpha.branchHistory | history}.
|
|
312
|
+
* @alpha
|
|
313
|
+
*/
|
|
314
|
+
export type CommitRevision = string;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Metadata describing a single commit in a {@link UntypedTreeViewAlpha}'s history.
|
|
318
|
+
* @sealed @alpha
|
|
319
|
+
*/
|
|
320
|
+
export interface TreeBranchCommitMetadata {
|
|
321
|
+
/**
|
|
322
|
+
* The revision UUID that uniquely identifies this commit within the branch's history.
|
|
323
|
+
*/
|
|
324
|
+
readonly revision: CommitRevision;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Arbitrary, application-defined metadata that was {@link RunTransactionParamsAlpha.customMetadata | attached}
|
|
328
|
+
* to this commit when it was created, flattened into a single object.
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* This is `undefined` for commits that were not annotated.
|
|
332
|
+
*
|
|
333
|
+
* A commit may be produced by nested transactions, each of which may supply metadata. This property combines
|
|
334
|
+
* them: where two of them used the same property, the outermost transaction wins, and between siblings the
|
|
335
|
+
* later one wins. Use {@link TreeBranchCommitMetadata.customTree} to recover which transaction supplied what.
|
|
336
|
+
*/
|
|
337
|
+
readonly custom: JsonCompatibleReadOnlyObject | undefined;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The {@link CustomMetadataTree | tree} of metadata attached to this commit, reflecting the nesting of
|
|
341
|
+
* the transactions that produced it.
|
|
342
|
+
*
|
|
343
|
+
* @remarks
|
|
344
|
+
* The structural counterpart to {@link TreeBranchCommitMetadata.custom}, and `undefined` whenever it is.
|
|
345
|
+
* Prefer `custom` unless you need to know which transaction supplied a particular property.
|
|
346
|
+
*/
|
|
347
|
+
readonly customTree: CustomMetadataTree | undefined;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The metadata for the commit that this commit was based on, or `undefined` if this commit has no parent
|
|
351
|
+
* (i.e. it is the oldest commit in the branch's history).
|
|
352
|
+
*
|
|
353
|
+
* @remarks
|
|
354
|
+
* This method may return a different value over time if the parent commit is trimmed from the branch's history.
|
|
284
355
|
*/
|
|
285
|
-
|
|
356
|
+
getParent(): TreeBranchCommitMetadata | undefined;
|
|
286
357
|
}
|
|
287
358
|
|
|
288
359
|
/**
|
|
289
|
-
* {@link
|
|
360
|
+
* Provides APIs for querying information about the history of a {@link UntypedTreeViewAlpha}.
|
|
290
361
|
* @remarks
|
|
291
|
-
* The
|
|
362
|
+
* The history of a branch is the sequence of commits leading up to its current state.
|
|
363
|
+
* @sealed @alpha
|
|
364
|
+
*/
|
|
365
|
+
export interface TreeBranchHistory {
|
|
366
|
+
/**
|
|
367
|
+
* The number of commits in this branch's history.
|
|
368
|
+
* @remarks
|
|
369
|
+
* This number grows when any of the following occurs:
|
|
370
|
+
* - A new edit is made on this branch (either through editing or by reverting an existing commit on this branch).
|
|
371
|
+
* - A branch that contains commits not already on this branch is merged into this branch.
|
|
372
|
+
* - The branch is rebased onto another branch that contains commits not already on this branch.
|
|
373
|
+
* This number shrinks when past commits are trimmed from the history.
|
|
374
|
+
*/
|
|
375
|
+
readonly length: number;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Returns metadata for the current head commit of this branch.
|
|
379
|
+
* @returns The metadata for the head commit, or `undefined` if the branch has no commits.
|
|
380
|
+
*/
|
|
381
|
+
getHead(): TreeBranchCommitMetadata | undefined;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* An untyped view of a {@link UntypedTreeView} with alpha-level APIs.
|
|
386
|
+
* @remarks
|
|
387
|
+
* The untyped view for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.context` and checking {@link TreeContextAlpha.isView | isView()}.
|
|
292
388
|
*
|
|
293
|
-
*
|
|
389
|
+
* An untyped view does not necessarily know the schema of its SharedTree. To convert it to a {@link TreeViewAlpha | view with a schema}, use {@link UntypedTreeViewAlpha.hasRootSchema | hasRootSchema()}.
|
|
294
390
|
* @sealed @alpha
|
|
295
391
|
*/
|
|
296
|
-
export interface
|
|
392
|
+
export interface UntypedTreeViewAlpha extends UntypedTreeView, TreeContextAlpha {
|
|
297
393
|
/**
|
|
298
|
-
* Events for the branch
|
|
394
|
+
* Events for the view's underlying branch.
|
|
299
395
|
*/
|
|
300
396
|
readonly events: Listenable<TreeBranchEvents>;
|
|
301
397
|
|
|
302
398
|
/**
|
|
303
|
-
*
|
|
304
|
-
|
|
399
|
+
* APIs for querying the history of the branch being viewed.
|
|
400
|
+
*/
|
|
401
|
+
readonly branchHistory: TreeBranchHistory;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Returns true if this view has the given schema as its root schema.
|
|
405
|
+
* @remarks This is a type guard which allows this view to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
|
|
305
406
|
*
|
|
306
407
|
* To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.
|
|
307
408
|
* For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.
|
|
308
409
|
* @example
|
|
309
410
|
* ```typescript
|
|
310
|
-
* if (
|
|
311
|
-
* const { root } =
|
|
411
|
+
* if (view.hasRootSchema(MySchema)) {
|
|
412
|
+
* const { root } = view; // `view` is now a TreeViewAlpha<MySchema>
|
|
312
413
|
* // ...
|
|
313
414
|
* }
|
|
314
415
|
* ```
|
|
@@ -318,10 +419,40 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
318
419
|
): this is TreeViewAlpha<TSchema>;
|
|
319
420
|
|
|
320
421
|
// Override the base fork method to return the alpha variant.
|
|
321
|
-
fork():
|
|
422
|
+
fork(): UntypedTreeViewAlpha;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Switches this view to a new underlying branch with the given commit as the head, updating the view state accordingly.
|
|
426
|
+
*
|
|
427
|
+
* @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to rewind to.
|
|
428
|
+
* Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
|
|
429
|
+
*
|
|
430
|
+
* @remarks
|
|
431
|
+
* Unlike {@link UntypedTreeViewAlpha.revertTo | revertTo}, this does not apply a change to the underlying branch.
|
|
432
|
+
* The original underlying branch will be disposed.
|
|
433
|
+
* Consider {@link UntypedTreeViewAlpha.fork | forking} before rewinding.
|
|
434
|
+
* Not valid to invoke on the main branch or a {@link (ITreeAlpha:interface).createSharedBranch | shared branch}.
|
|
435
|
+
*/
|
|
436
|
+
rewindTo(revision: CommitRevision): void;
|
|
322
437
|
|
|
323
438
|
/**
|
|
324
|
-
*
|
|
439
|
+
* Applies a new change which reverts all changes made since the given `revision`.
|
|
440
|
+
* This is a no-op if the given revision is the head commit of the underlying branch being viewed.
|
|
441
|
+
*
|
|
442
|
+
* @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to restore the state of.
|
|
443
|
+
* Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
|
|
444
|
+
* @param options - Optional {@link RevertToOptionsAlpha | options} for the revert.
|
|
445
|
+
*
|
|
446
|
+
* @remarks
|
|
447
|
+
* The generated change is subject to the same merge semantics as the {@link Revertible.(revert:1) | reverts of individual commits}:
|
|
448
|
+
* Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.
|
|
449
|
+
*
|
|
450
|
+
* Unlike {@link UntypedTreeViewAlpha.rewindTo | rewindTo}, this does not switch to a new branch.
|
|
451
|
+
*/
|
|
452
|
+
revertTo(revision: CommitRevision, options?: RevertToOptionsAlpha): void;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on this view of the SharedTree.
|
|
325
456
|
* @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusAlpha | value or rollback signal}.
|
|
326
457
|
* @remarks
|
|
327
458
|
* If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.
|
|
@@ -332,7 +463,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
332
463
|
): TransactionValueResult<TSuccessValue, TFailureValue>;
|
|
333
464
|
|
|
334
465
|
/**
|
|
335
|
-
* An overload of {@link
|
|
466
|
+
* An overload of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction } which does not return a value.
|
|
336
467
|
*
|
|
337
468
|
* @privateRemarks
|
|
338
469
|
* TODO: Consider updating these methods to avoid the need for overloads.
|
|
@@ -344,7 +475,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
344
475
|
): TransactionVoidResult;
|
|
345
476
|
|
|
346
477
|
/**
|
|
347
|
-
* An asynchronous version of {@link
|
|
478
|
+
* An asynchronous version of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction}.
|
|
348
479
|
* @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.
|
|
349
480
|
*/
|
|
350
481
|
|
|
@@ -354,7 +485,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
354
485
|
): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;
|
|
355
486
|
|
|
356
487
|
/**
|
|
357
|
-
* An overload of {@link
|
|
488
|
+
* An overload of {@link UntypedTreeViewAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.
|
|
358
489
|
*
|
|
359
490
|
* @privateRemarks
|
|
360
491
|
* TODO: Consider updating these methods to avoid the need for overloads.
|
|
@@ -379,27 +510,35 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
379
510
|
applyChange(change: JsonCompatibleReadOnly): void;
|
|
380
511
|
|
|
381
512
|
/**
|
|
382
|
-
* Determines if there are changes on the given
|
|
383
|
-
* @param
|
|
513
|
+
* Determines if there are changes on the given view that are not present on this view.
|
|
514
|
+
* @param view - The view to compare to.
|
|
384
515
|
*
|
|
385
|
-
* The new edits, if any, can be applied to this
|
|
386
|
-
* or by {@link
|
|
516
|
+
* The new edits, if any, can be applied to this view by {@link UntypedTreeView.rebaseOnto | rebasing this view onto the given view}
|
|
517
|
+
* or by {@link UntypedTreeView.merge | merging the given view into this view}.
|
|
387
518
|
*
|
|
388
519
|
* @throws UsageError if the branches are unrelated.
|
|
389
520
|
*/
|
|
390
|
-
isMissingEditsFrom(
|
|
521
|
+
isMissingEditsFrom(view: UntypedTreeView): boolean;
|
|
391
522
|
|
|
392
523
|
/**
|
|
393
|
-
* Computes the net change that would result if this
|
|
394
|
-
* Note that this method does not actually perform the rebase and therefore has no effect on this
|
|
524
|
+
* Computes the net change that would result if this view were {@link UntypedTreeView.rebaseOnto | rebased onto} the given view.
|
|
525
|
+
* Note that this method does not actually perform the rebase and therefore has no effect on this view.
|
|
395
526
|
*
|
|
396
|
-
* @param
|
|
397
|
-
* @returns The net change that would result if this
|
|
527
|
+
* @param view - The view that would be rebased onto.
|
|
528
|
+
* @returns The net change that would result if this view were rebased onto the given view,
|
|
398
529
|
* or `undefined` if rebasing would have no impact.
|
|
399
530
|
*/
|
|
400
|
-
computeNetChangeIfRebasedOnto(
|
|
531
|
+
computeNetChangeIfRebasedOnto(view: UntypedTreeView): JsonCompatibleReadOnly | undefined;
|
|
401
532
|
}
|
|
402
533
|
|
|
534
|
+
/**
|
|
535
|
+
* Compatibility alias for {@link UntypedTreeViewAlpha}.
|
|
536
|
+
*
|
|
537
|
+
* @deprecated Use {@link UntypedTreeViewAlpha} instead.
|
|
538
|
+
* @alpha
|
|
539
|
+
*/
|
|
540
|
+
export type TreeBranchAlpha = UntypedTreeViewAlpha;
|
|
541
|
+
|
|
403
542
|
/**
|
|
404
543
|
* An editable view of a (version control style) branch of a shared tree based on some schema.
|
|
405
544
|
*
|
|
@@ -410,7 +549,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
410
549
|
* Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}
|
|
411
550
|
* and choose a schema compatibility policy that aligns with their application's needs.
|
|
412
551
|
*
|
|
413
|
-
* See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link
|
|
552
|
+
* See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link UntypedTreeView} for additional APIs that are in earlier stages of development.
|
|
414
553
|
*
|
|
415
554
|
* @privateRemarks
|
|
416
555
|
* From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.
|
|
@@ -542,9 +681,9 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
542
681
|
*/
|
|
543
682
|
export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>
|
|
544
683
|
extends TreeView<TSchema>,
|
|
545
|
-
|
|
684
|
+
UntypedTreeView {
|
|
546
685
|
// Override the base branch method to return a typed view rather than merely a branch.
|
|
547
|
-
fork(): ReturnType<
|
|
686
|
+
fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewBeta<TSchema>;
|
|
548
687
|
|
|
549
688
|
/**
|
|
550
689
|
* Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.
|
|
@@ -622,7 +761,7 @@ export interface TreeViewAlpha<
|
|
|
622
761
|
TreeViewBeta<ReadSchema<TSchema>>,
|
|
623
762
|
"root" | "initialize" | "fork" | "runTransaction" | "runTransactionAsync"
|
|
624
763
|
>,
|
|
625
|
-
|
|
764
|
+
UntypedTreeViewAlpha {
|
|
626
765
|
get root(): ReadableField<TSchema>;
|
|
627
766
|
|
|
628
767
|
set root(newRoot: InsertableField<TSchema>);
|
|
@@ -647,7 +786,7 @@ export interface TreeViewAlpha<
|
|
|
647
786
|
readonly events: Listenable<TreeViewEvents & TreeBranchEvents>;
|
|
648
787
|
|
|
649
788
|
// Override the base fork method to return a TreeViewAlpha.
|
|
650
|
-
fork(): ReturnType<
|
|
789
|
+
fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewAlpha<TSchema>;
|
|
651
790
|
}
|
|
652
791
|
|
|
653
792
|
/**
|
|
@@ -744,7 +883,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
744
883
|
}
|
|
745
884
|
|
|
746
885
|
/**
|
|
747
|
-
* Events for {@link
|
|
886
|
+
* Events for {@link UntypedTreeView}.
|
|
748
887
|
* @sealed @alpha
|
|
749
888
|
*/
|
|
750
889
|
export interface TreeBranchEvents {
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -67,6 +67,7 @@ export {
|
|
|
67
67
|
export { walkFieldSchema } from "./walkFieldSchema.js";
|
|
68
68
|
export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
|
|
69
69
|
export {
|
|
70
|
+
type CommitRevision,
|
|
70
71
|
type ITree,
|
|
71
72
|
type TreeView,
|
|
72
73
|
type ViewableTree,
|
|
@@ -159,9 +160,13 @@ export {
|
|
|
159
160
|
type InsertableObjectFromSchemaRecordAlphaUnsafe,
|
|
160
161
|
type TreeViewAlpha,
|
|
161
162
|
type TreeViewBeta,
|
|
163
|
+
type UntypedTreeView,
|
|
162
164
|
type TreeBranch,
|
|
163
165
|
type TreeBranchAlpha,
|
|
166
|
+
type UntypedTreeViewAlpha,
|
|
164
167
|
type TreeBranchEvents,
|
|
168
|
+
type TreeBranchCommitMetadata,
|
|
169
|
+
type TreeBranchHistory,
|
|
165
170
|
getPropertyKeyFromStoredKey,
|
|
166
171
|
getStoredKey,
|
|
167
172
|
tryGetSchema,
|
package/src/tableSchema.ts
CHANGED
|
@@ -1123,19 +1123,14 @@ export namespace System_TableSchema {
|
|
|
1123
1123
|
preconditionsOnRevert?: readonly TransactionConstraintAlpha[];
|
|
1124
1124
|
}): void {
|
|
1125
1125
|
const { applyEdits, preconditions, preconditionsOnRevert } = options;
|
|
1126
|
-
const
|
|
1126
|
+
const context = TreeAlpha.context(this);
|
|
1127
1127
|
|
|
1128
1128
|
// Ensure events are paused until all of the edits are applied.
|
|
1129
1129
|
// This ensures that the user sees the corresponding table-level edit as atomic,
|
|
1130
1130
|
// and ensures they are not spammed with intermediate events.
|
|
1131
1131
|
withBufferedTreeEvents(() => {
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1134
|
-
// I.e., it is not part of a collaborative session yet.
|
|
1135
|
-
// Therefore, we don't need to run the edits as a transaction.
|
|
1136
|
-
applyEdits();
|
|
1137
|
-
} else {
|
|
1138
|
-
branch.runTransaction(
|
|
1132
|
+
if (context.isView()) {
|
|
1133
|
+
context.runTransaction(
|
|
1139
1134
|
() => {
|
|
1140
1135
|
applyEdits();
|
|
1141
1136
|
if (preconditionsOnRevert !== undefined) {
|
|
@@ -1144,6 +1139,11 @@ export namespace System_TableSchema {
|
|
|
1144
1139
|
},
|
|
1145
1140
|
preconditions === undefined ? undefined : { preconditions },
|
|
1146
1141
|
);
|
|
1142
|
+
} else {
|
|
1143
|
+
// If this node does not have a corresponding view, then it is unhydrated.
|
|
1144
|
+
// I.e., it is not part of a collaborative session yet.
|
|
1145
|
+
// Therefore, we don't need to run the edits as a transaction.
|
|
1146
|
+
applyEdits();
|
|
1147
1147
|
}
|
|
1148
1148
|
});
|
|
1149
1149
|
}
|
|
@@ -1168,7 +1168,7 @@ export namespace System_TableSchema {
|
|
|
1168
1168
|
#buildColumnInDocumentConstraintsForRows(
|
|
1169
1169
|
rows: Iterable<RowValueType>,
|
|
1170
1170
|
): TransactionConstraintAlpha[] | undefined {
|
|
1171
|
-
if (!TreeAlpha.context(this).
|
|
1171
|
+
if (!TreeAlpha.context(this).isView()) {
|
|
1172
1172
|
return undefined;
|
|
1173
1173
|
}
|
|
1174
1174
|
|