@fluidframework/tree 2.116.1 → 2.118.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 +202 -0
- package/api-report/tree.alpha.api.md +122 -31
- package/api-report/tree.beta.api.md +50 -9
- package/api-report/tree.legacy.beta.api.md +50 -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/index.d.ts +1 -1
- package/dist/feature-libraries/index.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/feature-libraries/schemaChecker.d.ts +9 -19
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +130 -46
- package/dist/feature-libraries/schemaChecker.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 +24 -9
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +61 -11
- 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 +122 -25
- 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/configuration.d.ts +4 -4
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +36 -3
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +40 -14
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +140 -10
- package/dist/simple-tree/api/schemaCompatibilityTester.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 +353 -68
- 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/core/toStored.d.ts +7 -0
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +2 -2
- package/dist/simple-tree/core/treeNodeValid.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 +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/tableSchema.js +10 -10
- package/dist/tableSchema.js.map +1 -1
- package/docs/main/glossary.md +163 -0
- 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/index.d.ts +1 -1
- package/lib/feature-libraries/index.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/feature-libraries/schemaChecker.d.ts +9 -19
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +133 -49
- package/lib/feature-libraries/schemaChecker.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 +24 -9
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +62 -12
- 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 +123 -26
- 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/configuration.d.ts +4 -4
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +36 -3
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +40 -14
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +136 -7
- package/lib/simple-tree/api/schemaCompatibilityTester.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 +353 -68
- 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/core/toStored.d.ts +7 -0
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +3 -3
- package/lib/simple-tree/core/treeNodeValid.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 +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 +22 -22
- 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 +11 -0
- package/src/entrypoints/beta.ts +3 -0
- package/src/entrypoints/legacy.ts +3 -0
- package/src/feature-libraries/index.ts +1 -1
- package/src/feature-libraries/indexing/types.ts +1 -1
- package/src/feature-libraries/schemaChecker.ts +198 -82
- package/src/index.ts +11 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/history.ts +99 -0
- package/src/shared-tree/schematizingTreeView.ts +100 -29
- 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 +170 -31
- 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/configuration.ts +4 -4
- package/src/simple-tree/api/discrepancies.ts +100 -5
- package/src/simple-tree/api/index.ts +12 -1
- package/src/simple-tree/api/schemaCompatibilityTester.ts +185 -11
- package/src/simple-tree/api/transactionTypes.ts +29 -2
- package/src/simple-tree/api/tree.ts +384 -68
- package/src/simple-tree/core/toStored.ts +8 -0
- package/src/simple-tree/core/treeNodeValid.ts +3 -1
- package/src/simple-tree/index.ts +9 -0
- package/src/tableSchema.ts +9 -9
- package/docs/main/runtime-schema-upgrade.md +0 -208
|
@@ -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,9 +21,12 @@ 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
|
-
import type { Unhydrated } from "../core/index.js";
|
|
29
|
+
import type { SchemaUpgrade, Unhydrated } from "../core/index.js";
|
|
23
30
|
import type {
|
|
24
31
|
ImplicitFieldSchema,
|
|
25
32
|
InsertableField,
|
|
@@ -32,6 +39,7 @@ import type { SimpleTreeSchema } from "../simpleSchema.js";
|
|
|
32
39
|
import type { UnsafeUnknownSchema } from "../unsafeUnknownSchema.js";
|
|
33
40
|
|
|
34
41
|
import type { TreeViewConfiguration } from "./configuration.js";
|
|
42
|
+
import type { StagedUpgradeStatus } from "./schemaCompatibilityTester.js";
|
|
35
43
|
import type {
|
|
36
44
|
RunTransactionParamsAlpha,
|
|
37
45
|
RunTransactionParamsBeta,
|
|
@@ -144,58 +152,66 @@ export interface ITreeAlpha extends ITree {
|
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @remarks
|
|
155
|
+
* An untyped view of a (version-control-style) branch of a SharedTree.
|
|
156
|
+
* @remarks An `UntypedTreeView` allows for the {@link UntypedTreeView.fork | creation of branches} and for those branches to later be {@link UntypedTreeView.merge | merged}.
|
|
149
157
|
*
|
|
150
158
|
* 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
159
|
*
|
|
152
|
-
* See {@link
|
|
160
|
+
* See {@link UntypedTreeViewAlpha} for additional APIs that are in an earlier stage of development.
|
|
153
161
|
* @sealed @beta
|
|
154
162
|
*/
|
|
155
|
-
export interface
|
|
163
|
+
export interface UntypedTreeView extends IDisposable {
|
|
156
164
|
/**
|
|
157
165
|
* 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
|
|
166
|
+
* @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.
|
|
167
|
+
* 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
168
|
*/
|
|
161
|
-
fork():
|
|
169
|
+
fork(): UntypedTreeView;
|
|
162
170
|
|
|
163
171
|
/**
|
|
164
|
-
* Apply all the new changes on the given
|
|
165
|
-
* @param
|
|
166
|
-
* @param disposeMerged -
|
|
172
|
+
* Apply all the new changes on the given view to this view.
|
|
173
|
+
* @param view - A view created by {@link UntypedTreeView.fork}.
|
|
174
|
+
* @param disposeMerged - Whether or not to dispose `view` after the merge completes.
|
|
167
175
|
* Defaults to true.
|
|
168
|
-
* The {@link
|
|
169
|
-
* @remarks All ongoing transactions (if any) in `
|
|
176
|
+
* The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
|
|
177
|
+
* @remarks All ongoing transactions (if any) in `view` will be committed before the merge.
|
|
170
178
|
*/
|
|
171
|
-
merge(
|
|
179
|
+
merge(view: UntypedTreeView, disposeMerged?: boolean): void;
|
|
172
180
|
|
|
173
181
|
/**
|
|
174
|
-
* Advance this
|
|
175
|
-
* @param
|
|
176
|
-
* @remarks After rebasing, this
|
|
177
|
-
* This method may only be called on
|
|
182
|
+
* Advance this view forward such that all new changes on the target view become part of this view.
|
|
183
|
+
* @param view - The view to rebase onto.
|
|
184
|
+
* @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.
|
|
185
|
+
* This method may only be called on views produced via {@link UntypedTreeView.fork | fork} - attempting to rebase the main view will throw.
|
|
178
186
|
*
|
|
179
187
|
* Rebasing long-lived branches is important to avoid consuming memory unnecessarily.
|
|
180
188
|
* In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last rebased.
|
|
181
189
|
*
|
|
182
|
-
* The {@link
|
|
190
|
+
* The {@link UntypedTreeView | main view} cannot be rebased onto another view - attempting to do so will throw an error.
|
|
183
191
|
*/
|
|
184
|
-
rebaseOnto(
|
|
192
|
+
rebaseOnto(view: UntypedTreeView): void;
|
|
185
193
|
|
|
186
194
|
/**
|
|
187
|
-
* Dispose of this
|
|
195
|
+
* Dispose of this view, cleaning up any resources associated with it.
|
|
188
196
|
* @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
|
|
189
|
-
* @remarks
|
|
197
|
+
* @remarks Views can also be automatically disposed when {@link UntypedTreeView.merge | they are merged} into another view.
|
|
190
198
|
*
|
|
191
199
|
* 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"
|
|
200
|
+
* 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
201
|
*
|
|
194
|
-
* The {@link
|
|
202
|
+
* The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
|
|
195
203
|
*/
|
|
196
204
|
dispose(error?: Error): void;
|
|
197
205
|
}
|
|
198
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Compatibility alias for {@link UntypedTreeView}.
|
|
209
|
+
*
|
|
210
|
+
* @deprecated Use {@link UntypedTreeView} instead.
|
|
211
|
+
* @beta
|
|
212
|
+
*/
|
|
213
|
+
export type TreeBranch = UntypedTreeView;
|
|
214
|
+
|
|
199
215
|
/**
|
|
200
216
|
* Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.
|
|
201
217
|
* @alpha
|
|
@@ -223,7 +239,7 @@ export interface TreeContextAlpha {
|
|
|
223
239
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
224
240
|
*
|
|
225
241
|
* `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.
|
|
226
|
-
* Use {@link TreeContextAlpha.
|
|
242
|
+
* 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
243
|
*/
|
|
228
244
|
runTransaction<TValue>(
|
|
229
245
|
transaction: () => WithValue<TValue>,
|
|
@@ -271,44 +287,130 @@ export interface TreeContextAlpha {
|
|
|
271
287
|
): Promise<TransactionVoidResult>;
|
|
272
288
|
|
|
273
289
|
/**
|
|
274
|
-
* True if this context is associated with
|
|
275
|
-
* @remarks If this returns true, the context can be safely inferred or cast to {@link
|
|
290
|
+
* True if this context is associated with an {@link UntypedTreeViewAlpha | untyped view} and false if it is associated with an {@link Unhydrated | unhydrated } node.
|
|
291
|
+
* @remarks If this returns true, the context can be safely inferred or cast to {@link UntypedTreeViewAlpha} to access additional view-specific APIs.
|
|
276
292
|
* @example
|
|
277
293
|
* ```typescript
|
|
278
294
|
* const context = tree.context(someNode);
|
|
279
|
-
* if (context.
|
|
280
|
-
* assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on
|
|
295
|
+
* if (context.isView()) {
|
|
296
|
+
* assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on UntypedTreeViewAlpha, so this is only accessible if `context` is a view context.
|
|
281
297
|
* context.root.foo = "bar"; // Edit the root of the SharedTree that `someNode` belongs to.
|
|
282
298
|
* }
|
|
283
299
|
* ```
|
|
300
|
+
* @returns Whether this context is associated with an untyped view.
|
|
301
|
+
*/
|
|
302
|
+
isView(): this is UntypedTreeViewAlpha;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* {@inheritDoc TreeContextAlpha.isView}
|
|
306
|
+
* @deprecated Use {@link TreeContextAlpha.isView | isView()} instead.
|
|
307
|
+
*/
|
|
308
|
+
isBranch(): this is UntypedTreeViewAlpha;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* An identifier for a commit in a {@link UntypedTreeViewAlpha}'s {@link UntypedTreeViewAlpha.branchHistory | history}.
|
|
313
|
+
* @alpha
|
|
314
|
+
*/
|
|
315
|
+
export type CommitRevision = string;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Metadata describing a single commit in a {@link UntypedTreeViewAlpha}'s history.
|
|
319
|
+
* @sealed @alpha
|
|
320
|
+
*/
|
|
321
|
+
export interface TreeBranchCommitMetadata {
|
|
322
|
+
/**
|
|
323
|
+
* The revision UUID that uniquely identifies this commit within the branch's history.
|
|
324
|
+
*/
|
|
325
|
+
readonly revision: CommitRevision;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Arbitrary, application-defined metadata that was {@link RunTransactionParamsAlpha.customMetadata | attached}
|
|
329
|
+
* to this commit when it was created, flattened into a single object.
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* This is `undefined` for commits that were not annotated.
|
|
333
|
+
*
|
|
334
|
+
* A commit may be produced by nested transactions, each of which may supply metadata. This property combines
|
|
335
|
+
* them: where two of them used the same property, the outermost transaction wins, and between siblings the
|
|
336
|
+
* later one wins. Use {@link TreeBranchCommitMetadata.customTree} to recover which transaction supplied what.
|
|
337
|
+
*/
|
|
338
|
+
readonly custom: JsonCompatibleReadOnlyObject | undefined;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* The {@link CustomMetadataTree | tree} of metadata attached to this commit, reflecting the nesting of
|
|
342
|
+
* the transactions that produced it.
|
|
343
|
+
*
|
|
344
|
+
* @remarks
|
|
345
|
+
* The structural counterpart to {@link TreeBranchCommitMetadata.custom}, and `undefined` whenever it is.
|
|
346
|
+
* Prefer `custom` unless you need to know which transaction supplied a particular property.
|
|
347
|
+
*/
|
|
348
|
+
readonly customTree: CustomMetadataTree | undefined;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The metadata for the commit that this commit was based on, or `undefined` if this commit has no parent
|
|
352
|
+
* (i.e. it is the oldest commit in the branch's history).
|
|
353
|
+
*
|
|
354
|
+
* @remarks
|
|
355
|
+
* This method may return a different value over time if the parent commit is trimmed from the branch's history.
|
|
356
|
+
*/
|
|
357
|
+
getParent(): TreeBranchCommitMetadata | undefined;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Provides APIs for querying information about the history of a {@link UntypedTreeViewAlpha}.
|
|
362
|
+
* @remarks
|
|
363
|
+
* The history of a branch is the sequence of commits leading up to its current state.
|
|
364
|
+
* @sealed @alpha
|
|
365
|
+
*/
|
|
366
|
+
export interface TreeBranchHistory {
|
|
367
|
+
/**
|
|
368
|
+
* The number of commits in this branch's history.
|
|
369
|
+
* @remarks
|
|
370
|
+
* This number grows when any of the following occurs:
|
|
371
|
+
* - A new edit is made on this branch (either through editing or by reverting an existing commit on this branch).
|
|
372
|
+
* - A branch that contains commits not already on this branch is merged into this branch.
|
|
373
|
+
* - The branch is rebased onto another branch that contains commits not already on this branch.
|
|
374
|
+
* This number shrinks when past commits are trimmed from the history.
|
|
284
375
|
*/
|
|
285
|
-
|
|
376
|
+
readonly length: number;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Returns metadata for the current head commit of this branch.
|
|
380
|
+
* @returns The metadata for the head commit, or `undefined` if the branch has no commits.
|
|
381
|
+
*/
|
|
382
|
+
getHead(): TreeBranchCommitMetadata | undefined;
|
|
286
383
|
}
|
|
287
384
|
|
|
288
385
|
/**
|
|
289
|
-
* {@link
|
|
386
|
+
* An untyped view of a {@link UntypedTreeView} with alpha-level APIs.
|
|
290
387
|
* @remarks
|
|
291
|
-
* The
|
|
388
|
+
* The untyped view for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.context` and checking {@link TreeContextAlpha.isView | isView()}.
|
|
292
389
|
*
|
|
293
|
-
*
|
|
390
|
+
* 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
391
|
* @sealed @alpha
|
|
295
392
|
*/
|
|
296
|
-
export interface
|
|
393
|
+
export interface UntypedTreeViewAlpha extends UntypedTreeView, TreeContextAlpha {
|
|
297
394
|
/**
|
|
298
|
-
* Events for the branch
|
|
395
|
+
* Events for the view's underlying branch.
|
|
299
396
|
*/
|
|
300
397
|
readonly events: Listenable<TreeBranchEvents>;
|
|
301
398
|
|
|
302
399
|
/**
|
|
303
|
-
*
|
|
304
|
-
|
|
400
|
+
* APIs for querying the history of the branch being viewed.
|
|
401
|
+
*/
|
|
402
|
+
readonly branchHistory: TreeBranchHistory;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Returns true if this view has the given schema as its root schema.
|
|
406
|
+
* @remarks This is a type guard which allows this view to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
|
|
305
407
|
*
|
|
306
408
|
* To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.
|
|
307
409
|
* 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
410
|
* @example
|
|
309
411
|
* ```typescript
|
|
310
|
-
* if (
|
|
311
|
-
* const { root } =
|
|
412
|
+
* if (view.hasRootSchema(MySchema)) {
|
|
413
|
+
* const { root } = view; // `view` is now a TreeViewAlpha<MySchema>
|
|
312
414
|
* // ...
|
|
313
415
|
* }
|
|
314
416
|
* ```
|
|
@@ -318,10 +420,40 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
318
420
|
): this is TreeViewAlpha<TSchema>;
|
|
319
421
|
|
|
320
422
|
// Override the base fork method to return the alpha variant.
|
|
321
|
-
fork():
|
|
423
|
+
fork(): UntypedTreeViewAlpha;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Switches this view to a new underlying branch with the given commit as the head, updating the view state accordingly.
|
|
427
|
+
*
|
|
428
|
+
* @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to rewind to.
|
|
429
|
+
* Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
|
|
430
|
+
*
|
|
431
|
+
* @remarks
|
|
432
|
+
* Unlike {@link UntypedTreeViewAlpha.revertTo | revertTo}, this does not apply a change to the underlying branch.
|
|
433
|
+
* The original underlying branch will be disposed.
|
|
434
|
+
* Consider {@link UntypedTreeViewAlpha.fork | forking} before rewinding.
|
|
435
|
+
* Not valid to invoke on the main branch or a {@link (ITreeAlpha:interface).createSharedBranch | shared branch}.
|
|
436
|
+
*/
|
|
437
|
+
rewindTo(revision: CommitRevision): void;
|
|
322
438
|
|
|
323
439
|
/**
|
|
324
|
-
*
|
|
440
|
+
* Applies a new change which reverts all changes made since the given `revision`.
|
|
441
|
+
* This is a no-op if the given revision is the head commit of the underlying branch being viewed.
|
|
442
|
+
*
|
|
443
|
+
* @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to restore the state of.
|
|
444
|
+
* Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
|
|
445
|
+
* @param options - Optional {@link RevertToOptionsAlpha | options} for the revert.
|
|
446
|
+
*
|
|
447
|
+
* @remarks
|
|
448
|
+
* The generated change is subject to the same merge semantics as the {@link Revertible.(revert:1) | reverts of individual commits}:
|
|
449
|
+
* Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.
|
|
450
|
+
*
|
|
451
|
+
* Unlike {@link UntypedTreeViewAlpha.rewindTo | rewindTo}, this does not switch to a new branch.
|
|
452
|
+
*/
|
|
453
|
+
revertTo(revision: CommitRevision, options?: RevertToOptionsAlpha): void;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on this view of the SharedTree.
|
|
325
457
|
* @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusAlpha | value or rollback signal}.
|
|
326
458
|
* @remarks
|
|
327
459
|
* If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.
|
|
@@ -332,7 +464,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
332
464
|
): TransactionValueResult<TSuccessValue, TFailureValue>;
|
|
333
465
|
|
|
334
466
|
/**
|
|
335
|
-
* An overload of {@link
|
|
467
|
+
* An overload of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction } which does not return a value.
|
|
336
468
|
*
|
|
337
469
|
* @privateRemarks
|
|
338
470
|
* TODO: Consider updating these methods to avoid the need for overloads.
|
|
@@ -344,7 +476,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
344
476
|
): TransactionVoidResult;
|
|
345
477
|
|
|
346
478
|
/**
|
|
347
|
-
* An asynchronous version of {@link
|
|
479
|
+
* An asynchronous version of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction}.
|
|
348
480
|
* @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.
|
|
349
481
|
*/
|
|
350
482
|
|
|
@@ -354,7 +486,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
354
486
|
): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;
|
|
355
487
|
|
|
356
488
|
/**
|
|
357
|
-
* An overload of {@link
|
|
489
|
+
* An overload of {@link UntypedTreeViewAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.
|
|
358
490
|
*
|
|
359
491
|
* @privateRemarks
|
|
360
492
|
* TODO: Consider updating these methods to avoid the need for overloads.
|
|
@@ -379,27 +511,35 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
379
511
|
applyChange(change: JsonCompatibleReadOnly): void;
|
|
380
512
|
|
|
381
513
|
/**
|
|
382
|
-
* Determines if there are changes on the given
|
|
383
|
-
* @param
|
|
514
|
+
* Determines if there are changes on the given view that are not present on this view.
|
|
515
|
+
* @param view - The view to compare to.
|
|
384
516
|
*
|
|
385
|
-
* The new edits, if any, can be applied to this
|
|
386
|
-
* or by {@link
|
|
517
|
+
* The new edits, if any, can be applied to this view by {@link UntypedTreeView.rebaseOnto | rebasing this view onto the given view}
|
|
518
|
+
* or by {@link UntypedTreeView.merge | merging the given view into this view}.
|
|
387
519
|
*
|
|
388
520
|
* @throws UsageError if the branches are unrelated.
|
|
389
521
|
*/
|
|
390
|
-
isMissingEditsFrom(
|
|
522
|
+
isMissingEditsFrom(view: UntypedTreeView): boolean;
|
|
391
523
|
|
|
392
524
|
/**
|
|
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
|
|
525
|
+
* Computes the net change that would result if this view were {@link UntypedTreeView.rebaseOnto | rebased onto} the given view.
|
|
526
|
+
* Note that this method does not actually perform the rebase and therefore has no effect on this view.
|
|
395
527
|
*
|
|
396
|
-
* @param
|
|
397
|
-
* @returns The net change that would result if this
|
|
528
|
+
* @param view - The view that would be rebased onto.
|
|
529
|
+
* @returns The net change that would result if this view were rebased onto the given view,
|
|
398
530
|
* or `undefined` if rebasing would have no impact.
|
|
399
531
|
*/
|
|
400
|
-
computeNetChangeIfRebasedOnto(
|
|
532
|
+
computeNetChangeIfRebasedOnto(view: UntypedTreeView): JsonCompatibleReadOnly | undefined;
|
|
401
533
|
}
|
|
402
534
|
|
|
535
|
+
/**
|
|
536
|
+
* Compatibility alias for {@link UntypedTreeViewAlpha}.
|
|
537
|
+
*
|
|
538
|
+
* @deprecated Use {@link UntypedTreeViewAlpha} instead.
|
|
539
|
+
* @alpha
|
|
540
|
+
*/
|
|
541
|
+
export type TreeBranchAlpha = UntypedTreeViewAlpha;
|
|
542
|
+
|
|
403
543
|
/**
|
|
404
544
|
* An editable view of a (version control style) branch of a shared tree based on some schema.
|
|
405
545
|
*
|
|
@@ -410,7 +550,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
410
550
|
* 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
551
|
* and choose a schema compatibility policy that aligns with their application's needs.
|
|
412
552
|
*
|
|
413
|
-
* See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link
|
|
553
|
+
* See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link UntypedTreeView} for additional APIs that are in earlier stages of development.
|
|
414
554
|
*
|
|
415
555
|
* @privateRemarks
|
|
416
556
|
* From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.
|
|
@@ -462,9 +602,9 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
462
602
|
*
|
|
463
603
|
* When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},
|
|
464
604
|
* staged schema upgrades matching the configured policy are included in the target stored schema.
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
605
|
+
* Staged upgrades that are already enabled in the document are also included by default. Set
|
|
606
|
+
* {@link (StagedSchemaUpgradePolicy:interface).includeAlreadyEnabledUpgrades} to `false` when
|
|
607
|
+
* creating the policy to only include staged upgrades selected explicitly by the policy.
|
|
468
608
|
*
|
|
469
609
|
* @example Enabling a staged allowed type for documents, selected by a feature flag
|
|
470
610
|
*
|
|
@@ -536,15 +676,178 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
536
676
|
readonly schema: TSchema;
|
|
537
677
|
}
|
|
538
678
|
|
|
679
|
+
/**
|
|
680
|
+
* A discrepancy between a view schema and a document's stored schema.
|
|
681
|
+
*
|
|
682
|
+
* @remarks
|
|
683
|
+
* The `mismatch` property discriminates the different discrepancy shapes.
|
|
684
|
+
*
|
|
685
|
+
* @sealed @beta
|
|
686
|
+
*/
|
|
687
|
+
export type SchemaDiscrepancy =
|
|
688
|
+
| {
|
|
689
|
+
/**
|
|
690
|
+
* Indicates that a field allows different node types in the view and stored schemas.
|
|
691
|
+
*/
|
|
692
|
+
readonly mismatch: "allowedTypes";
|
|
693
|
+
/**
|
|
694
|
+
* The field with the discrepancy.
|
|
695
|
+
*
|
|
696
|
+
* `"root"` identifies the root field. Otherwise, `nodeType` identifies the containing
|
|
697
|
+
* node schema and `fieldKey` identifies its field. `fieldKey` is undefined for a map
|
|
698
|
+
* node's implicit field.
|
|
699
|
+
*/
|
|
700
|
+
readonly location:
|
|
701
|
+
| "root"
|
|
702
|
+
| {
|
|
703
|
+
readonly nodeType: string;
|
|
704
|
+
readonly fieldKey: string | undefined;
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* Non-staged node type identifiers allowed by the view schema but not the stored schema.
|
|
708
|
+
*/
|
|
709
|
+
readonly view: readonly string[];
|
|
710
|
+
/**
|
|
711
|
+
* Staged node type identifiers allowed by the view schema but not the stored schema.
|
|
712
|
+
*
|
|
713
|
+
* @remarks These types provide rollout context but do not cause the discrepancy.
|
|
714
|
+
*/
|
|
715
|
+
readonly stagedView?: readonly string[];
|
|
716
|
+
/**
|
|
717
|
+
* Node type identifiers allowed by the stored schema but not the view schema.
|
|
718
|
+
*/
|
|
719
|
+
readonly stored: readonly string[];
|
|
720
|
+
/**
|
|
721
|
+
* Whether the view field is a staged optional field.
|
|
722
|
+
*
|
|
723
|
+
* @remarks Omitted when false.
|
|
724
|
+
*/
|
|
725
|
+
readonly viewIsStagedOptional?: true;
|
|
726
|
+
}
|
|
727
|
+
| {
|
|
728
|
+
/**
|
|
729
|
+
* Indicates that a field has different field kinds in the view and stored schemas.
|
|
730
|
+
*/
|
|
731
|
+
readonly mismatch: "fieldKind";
|
|
732
|
+
/**
|
|
733
|
+
* The field with the discrepancy.
|
|
734
|
+
*
|
|
735
|
+
* `"root"` identifies the root field. Otherwise, `nodeType` identifies the containing
|
|
736
|
+
* node schema and `fieldKey` identifies its field. `fieldKey` is undefined for a map
|
|
737
|
+
* node's implicit field.
|
|
738
|
+
*/
|
|
739
|
+
readonly location:
|
|
740
|
+
| "root"
|
|
741
|
+
| {
|
|
742
|
+
readonly nodeType: string;
|
|
743
|
+
readonly fieldKey: string | undefined;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* The field kind required by the view schema.
|
|
747
|
+
*/
|
|
748
|
+
readonly view: string;
|
|
749
|
+
/**
|
|
750
|
+
* The field kind recorded in the stored schema.
|
|
751
|
+
*/
|
|
752
|
+
readonly stored: string;
|
|
753
|
+
/**
|
|
754
|
+
* Whether the view field is a staged optional field.
|
|
755
|
+
*
|
|
756
|
+
* @remarks Omitted when false.
|
|
757
|
+
*/
|
|
758
|
+
readonly viewIsStagedOptional?: true;
|
|
759
|
+
}
|
|
760
|
+
| {
|
|
761
|
+
/**
|
|
762
|
+
* Indicates that a leaf node accepts different value types in the view and stored schemas.
|
|
763
|
+
*/
|
|
764
|
+
readonly mismatch: "valueSchema";
|
|
765
|
+
/**
|
|
766
|
+
* The identifier of the leaf node schema with the discrepancy.
|
|
767
|
+
*/
|
|
768
|
+
readonly nodeType: string;
|
|
769
|
+
/**
|
|
770
|
+
* The value schema required by the view, or undefined when it does not constrain values.
|
|
771
|
+
*/
|
|
772
|
+
readonly view: string | undefined;
|
|
773
|
+
/**
|
|
774
|
+
* The value schema recorded in the stored schema, or undefined when it does not constrain values.
|
|
775
|
+
*/
|
|
776
|
+
readonly stored: string | undefined;
|
|
777
|
+
}
|
|
778
|
+
| {
|
|
779
|
+
/**
|
|
780
|
+
* Indicates that a node is represented by different node kinds in the view and stored schemas.
|
|
781
|
+
*/
|
|
782
|
+
readonly mismatch: "nodeKind";
|
|
783
|
+
/**
|
|
784
|
+
* The identifier of the node schema with the discrepancy.
|
|
785
|
+
*/
|
|
786
|
+
readonly nodeType: string;
|
|
787
|
+
/**
|
|
788
|
+
* The node kind required by the view schema.
|
|
789
|
+
*/
|
|
790
|
+
readonly view: string;
|
|
791
|
+
/**
|
|
792
|
+
* The node kind recorded in the stored schema.
|
|
793
|
+
*/
|
|
794
|
+
readonly stored: string;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* {@link SchemaCompatibilityStatus} with additional beta APIs.
|
|
799
|
+
*
|
|
800
|
+
* @sealed @beta
|
|
801
|
+
*/
|
|
802
|
+
export interface SchemaCompatibilityStatusBeta extends SchemaCompatibilityStatus {
|
|
803
|
+
/**
|
|
804
|
+
* Details about the schema discrepancies that prevent this view from accessing the tree.
|
|
805
|
+
*
|
|
806
|
+
* @remarks
|
|
807
|
+
* This property is undefined when {@link SchemaCompatibilityStatus.canView} is true and present
|
|
808
|
+
* when `canView` is false.
|
|
809
|
+
* It can include application-defined schema identifiers and field keys.
|
|
810
|
+
*
|
|
811
|
+
* @example Interpreting an allowed-types discrepancy
|
|
812
|
+
*
|
|
813
|
+
* If a document's stored schema allows `string` for `Todo.title`, but the view schema expects
|
|
814
|
+
* `number`, the discrepancy identifies the field and the type permitted by each schema:
|
|
815
|
+
*
|
|
816
|
+
* ```typescript
|
|
817
|
+
* const sf = new SchemaFactory("com.example");
|
|
818
|
+
* class Todo extends sf.object("Todo", {
|
|
819
|
+
* title: sf.number,
|
|
820
|
+
* }) {}
|
|
821
|
+
*
|
|
822
|
+
* const view = asBeta(tree.viewWith(new TreeViewConfiguration({ schema: Todo })));
|
|
823
|
+
* if (!view.compatibility.canView) {
|
|
824
|
+
* // [{
|
|
825
|
+
* // mismatch: "allowedTypes",
|
|
826
|
+
* // location: { nodeType: "com.example.Todo", fieldKey: "title" },
|
|
827
|
+
* // view: ["com.fluidframework.leaf.number"],
|
|
828
|
+
* // stored: ["com.fluidframework.leaf.string"],
|
|
829
|
+
* // }]
|
|
830
|
+
* console.error(view.compatibility.discrepancies);
|
|
831
|
+
* }
|
|
832
|
+
* ```
|
|
833
|
+
*/
|
|
834
|
+
readonly discrepancies: readonly SchemaDiscrepancy[] | undefined;
|
|
835
|
+
}
|
|
836
|
+
|
|
539
837
|
/**
|
|
540
838
|
* {@link TreeView} with additional beta APIs.
|
|
541
839
|
* @sealed @beta
|
|
542
840
|
*/
|
|
543
841
|
export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>
|
|
544
842
|
extends TreeView<TSchema>,
|
|
545
|
-
|
|
843
|
+
UntypedTreeView {
|
|
844
|
+
/**
|
|
845
|
+
* {@inheritDoc TreeView.compatibility}
|
|
846
|
+
*/
|
|
847
|
+
readonly compatibility: SchemaCompatibilityStatusBeta;
|
|
848
|
+
|
|
546
849
|
// Override the base branch method to return a typed view rather than merely a branch.
|
|
547
|
-
fork(): ReturnType<
|
|
850
|
+
fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewBeta<TSchema>;
|
|
548
851
|
|
|
549
852
|
/**
|
|
550
853
|
* Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.
|
|
@@ -622,7 +925,7 @@ export interface TreeViewAlpha<
|
|
|
622
925
|
TreeViewBeta<ReadSchema<TSchema>>,
|
|
623
926
|
"root" | "initialize" | "fork" | "runTransaction" | "runTransactionAsync"
|
|
624
927
|
>,
|
|
625
|
-
|
|
928
|
+
UntypedTreeViewAlpha {
|
|
626
929
|
get root(): ReadableField<TSchema>;
|
|
627
930
|
|
|
628
931
|
set root(newRoot: InsertableField<TSchema>);
|
|
@@ -634,20 +937,33 @@ export interface TreeViewAlpha<
|
|
|
634
937
|
* Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.
|
|
635
938
|
*
|
|
636
939
|
* Enables staged schema upgrades declared by {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy} when generating the initial stored schema.
|
|
637
|
-
* Once a staged schema upgrade has been enabled in a document's stored schema, loading that document
|
|
638
|
-
* with a view that does not include equivalent staged members in its construction-time policy will cause
|
|
639
|
-
* a subsequent `upgradeSchema` call to throw a `UsageError` because the stored schema already contains
|
|
640
|
-
* the upgraded members and the new target would narrow it.
|
|
641
940
|
*
|
|
642
941
|
* Applications should typically call this function before attaching a `SharedTree`.
|
|
643
942
|
* @param content - The content to initialize the tree with.
|
|
644
943
|
*/
|
|
645
944
|
initialize(content: InsertableField<TSchema>): void;
|
|
646
945
|
|
|
946
|
+
/**
|
|
947
|
+
* Checks whether a staged schema upgrade has been applied to the document's stored schema.
|
|
948
|
+
*
|
|
949
|
+
* @param upgrade - The upgrade token to check.
|
|
950
|
+
*
|
|
951
|
+
* @returns The {@link StagedUpgradeStatus} of the upgrade.
|
|
952
|
+
*
|
|
953
|
+
* @remarks
|
|
954
|
+
* Use this to determine whether a document has already been upgraded, for example when deciding
|
|
955
|
+
* whether to include an upgrade token in the view configuration after a feature flag rollback.
|
|
956
|
+
*
|
|
957
|
+
* Results are derived from this view's schema and the current stored schema.
|
|
958
|
+
* The full schema is checked even when the view is incompatible with the stored schema, so the
|
|
959
|
+
* result includes all locations declared by the view schema.
|
|
960
|
+
*/
|
|
961
|
+
isStagedUpgradeEnabled(upgrade: SchemaUpgrade): StagedUpgradeStatus;
|
|
962
|
+
|
|
647
963
|
readonly events: Listenable<TreeViewEvents & TreeBranchEvents>;
|
|
648
964
|
|
|
649
965
|
// Override the base fork method to return a TreeViewAlpha.
|
|
650
|
-
fork(): ReturnType<
|
|
966
|
+
fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewAlpha<TSchema>;
|
|
651
967
|
}
|
|
652
968
|
|
|
653
969
|
/**
|
|
@@ -744,7 +1060,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
744
1060
|
}
|
|
745
1061
|
|
|
746
1062
|
/**
|
|
747
|
-
* Events for {@link
|
|
1063
|
+
* Events for {@link UntypedTreeView}.
|
|
748
1064
|
* @sealed @alpha
|
|
749
1065
|
*/
|
|
750
1066
|
export interface TreeBranchEvents {
|
|
@@ -11,6 +11,14 @@ import type { SchemaUpgrade } from "./allowedTypes.js";
|
|
|
11
11
|
* @alpha
|
|
12
12
|
*/
|
|
13
13
|
export interface StagedSchemaUpgradePolicy {
|
|
14
|
+
/**
|
|
15
|
+
* Whether schema upgrades should include staged upgrades that are already enabled in the
|
|
16
|
+
* document's stored schema.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue `true`
|
|
19
|
+
*/
|
|
20
|
+
readonly includeAlreadyEnabledUpgrades?: boolean;
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* Determines whether to include staged allowed types in the resulting stored schema.
|
|
16
24
|
* @remarks
|