@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
|
@@ -10,9 +10,9 @@ import type {
|
|
|
10
10
|
Listenable,
|
|
11
11
|
} from "@fluidframework/core-interfaces/internal";
|
|
12
12
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
13
|
-
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
13
|
+
import { tagSchemaArtifacts, UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
14
14
|
|
|
15
|
-
import { anchorSlot, rootFieldKey } from "../core/index.js";
|
|
15
|
+
import { anchorSlot, rootFieldKey, type RevertToOptionsAlpha } from "../core/index.js";
|
|
16
16
|
import {
|
|
17
17
|
type NodeIdentifierManager,
|
|
18
18
|
defaultSchemaPolicy,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "../feature-libraries/index.js";
|
|
28
28
|
import {
|
|
29
29
|
type ImplicitFieldSchema,
|
|
30
|
-
type
|
|
30
|
+
type SchemaCompatibilityStatusBeta,
|
|
31
31
|
type TreeView,
|
|
32
32
|
type TreeViewEvents,
|
|
33
33
|
tryGetTreeNodeForField,
|
|
@@ -58,8 +58,11 @@ import {
|
|
|
58
58
|
TreeViewConfigurationAlpha,
|
|
59
59
|
toInitialSchema,
|
|
60
60
|
toUpgradeSchema,
|
|
61
|
-
type
|
|
61
|
+
type TreeBranchHistory,
|
|
62
|
+
type UntypedTreeViewAlpha,
|
|
62
63
|
type TreeSchema,
|
|
64
|
+
type SchemaUpgrade,
|
|
65
|
+
type StagedUpgradeStatus,
|
|
63
66
|
} from "../simple-tree/index.js";
|
|
64
67
|
import {
|
|
65
68
|
type Breakable,
|
|
@@ -78,6 +81,27 @@ import type { TreeCheckout } from "./treeCheckout.js";
|
|
|
78
81
|
*/
|
|
79
82
|
export const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();
|
|
80
83
|
|
|
84
|
+
function throwIfSchemaIsIncompatible(compatibility: SchemaCompatibilityStatusBeta): void {
|
|
85
|
+
if (compatibility.canView) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const resolution = compatibility.canInitialize
|
|
90
|
+
? "The document is uninitialized; call TreeView.initialize() before reading or writing TreeView.root."
|
|
91
|
+
: compatibility.canUpgrade
|
|
92
|
+
? "The stored schema can be upgraded; call TreeView.upgradeSchema() before reading or writing TreeView.root."
|
|
93
|
+
: "The schemas cannot be upgraded automatically. Use a compatible view schema or explicitly migrate the document schema and data.";
|
|
94
|
+
throw new UsageError(
|
|
95
|
+
`TreeView.root is unavailable because the view schema is incompatible with the stored schema. ${resolution}`,
|
|
96
|
+
tagSchemaArtifacts({
|
|
97
|
+
schemaIncompatibilityDetails:
|
|
98
|
+
compatibility.discrepancies === undefined
|
|
99
|
+
? undefined
|
|
100
|
+
: JSON.stringify(compatibility.discrepancies),
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
81
105
|
/**
|
|
82
106
|
* Implementation of TreeView wrapping a FlexTreeView.
|
|
83
107
|
*/
|
|
@@ -94,9 +118,14 @@ export class SchematizingSimpleTreeView<
|
|
|
94
118
|
private flexTreeContext: Context | undefined;
|
|
95
119
|
|
|
96
120
|
/**
|
|
97
|
-
* Undefined
|
|
121
|
+
* Undefined if and only if uninitialized or disposed.
|
|
98
122
|
*/
|
|
99
|
-
private currentCompatibility:
|
|
123
|
+
private currentCompatibility: SchemaCompatibilityStatusBeta | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Cached map of upgrade statuses, computed alongside compatibility.
|
|
126
|
+
* @remarks Undefined if and only if uninitialized or disposed.
|
|
127
|
+
*/
|
|
128
|
+
private currentEnabledUpgrades: ReadonlyMap<SchemaUpgrade, StagedUpgradeStatus> | undefined;
|
|
100
129
|
public readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &
|
|
101
130
|
IEmitter<TreeViewEvents & TreeBranchEvents> &
|
|
102
131
|
HasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();
|
|
@@ -154,9 +183,7 @@ export class SchematizingSimpleTreeView<
|
|
|
154
183
|
const stagedUpgradePolicy =
|
|
155
184
|
config instanceof TreeViewConfigurationAlpha ? config.stagedUpgradePolicy : undefined;
|
|
156
185
|
const configAlpha = new TreeViewConfigurationAlpha({
|
|
157
|
-
|
|
158
|
-
enableSchemaValidation: config.enableSchemaValidation,
|
|
159
|
-
preventAmbiguity: config.preventAmbiguity,
|
|
186
|
+
...config,
|
|
160
187
|
stagedUpgradePolicy,
|
|
161
188
|
});
|
|
162
189
|
this.stagedUpgradePolicy = configAlpha.stagedUpgradePolicy;
|
|
@@ -169,7 +196,9 @@ export class SchematizingSimpleTreeView<
|
|
|
169
196
|
canUpgrade: true,
|
|
170
197
|
isEquivalent: false,
|
|
171
198
|
canInitialize: true,
|
|
199
|
+
discrepancies: undefined,
|
|
172
200
|
};
|
|
201
|
+
this.currentEnabledUpgrades = new Map();
|
|
173
202
|
this.update();
|
|
174
203
|
|
|
175
204
|
this.unregisterCallbacks.add(
|
|
@@ -180,7 +209,11 @@ export class SchematizingSimpleTreeView<
|
|
|
180
209
|
);
|
|
181
210
|
}
|
|
182
211
|
|
|
183
|
-
public isBranch(): this is
|
|
212
|
+
public isBranch(): this is UntypedTreeViewAlpha {
|
|
213
|
+
return this.isView();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public isView(): this is UntypedTreeViewAlpha {
|
|
184
217
|
return true;
|
|
185
218
|
}
|
|
186
219
|
|
|
@@ -265,7 +298,7 @@ export class SchematizingSimpleTreeView<
|
|
|
265
298
|
public upgradeSchema(): void {
|
|
266
299
|
this.ensureUndisposed();
|
|
267
300
|
|
|
268
|
-
const newSchema = toUpgradeSchema(this.viewSchema.root, this.
|
|
301
|
+
const newSchema = toUpgradeSchema(this.viewSchema.root, this.effectiveUpgradePolicy);
|
|
269
302
|
const storedSchema = this.checkout.storedSchema.clone();
|
|
270
303
|
if (!allowsRepoSuperset(defaultSchemaPolicy, storedSchema, newSchema)) {
|
|
271
304
|
throw new UsageError(
|
|
@@ -280,6 +313,35 @@ export class SchematizingSimpleTreeView<
|
|
|
280
313
|
this.runSchemaEdit(() => this.checkout.updateSchema(newSchema));
|
|
281
314
|
}
|
|
282
315
|
|
|
316
|
+
public isStagedUpgradeEnabled(upgrade: SchemaUpgrade): StagedUpgradeStatus {
|
|
317
|
+
if (!this.currentEnabledUpgrades) {
|
|
318
|
+
this.failDisposed();
|
|
319
|
+
}
|
|
320
|
+
return this.currentEnabledUpgrades.get(upgrade) ?? "disabled";
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
private get effectiveUpgradePolicy(): StagedSchemaUpgradePolicy {
|
|
324
|
+
const configuredPolicy = this.stagedUpgradePolicy;
|
|
325
|
+
if (configuredPolicy.includeAlreadyEnabledUpgrades === false) {
|
|
326
|
+
return configuredPolicy;
|
|
327
|
+
}
|
|
328
|
+
const enabledUpgrades = this.currentEnabledUpgrades;
|
|
329
|
+
assert(
|
|
330
|
+
enabledUpgrades !== undefined,
|
|
331
|
+
0xd3e /* Enabled upgrades must be available for an active view */,
|
|
332
|
+
);
|
|
333
|
+
if (enabledUpgrades.size === 0) {
|
|
334
|
+
return configuredPolicy;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
includeStaged: (upgrade) =>
|
|
339
|
+
configuredPolicy.includeStaged(upgrade) || enabledUpgrades.has(upgrade),
|
|
340
|
+
includeStagedOptional: (upgrade) =>
|
|
341
|
+
configuredPolicy.includeStagedOptional(upgrade) || enabledUpgrades.has(upgrade),
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
283
345
|
/**
|
|
284
346
|
* Gets the flex-tree context. Throws when disposed or out of schema.
|
|
285
347
|
*/
|
|
@@ -437,12 +499,16 @@ export class SchematizingSimpleTreeView<
|
|
|
437
499
|
}
|
|
438
500
|
}
|
|
439
501
|
|
|
440
|
-
|
|
441
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Computes the current schema compatibility status and updates the cached enabled upgrades.
|
|
504
|
+
*/
|
|
505
|
+
private computeCompatibility(): SchemaCompatibilityStatusBeta {
|
|
506
|
+
const { enabledUpgrades, ...compatibility } = checkSchemaCompatibility(
|
|
442
507
|
this.viewSchema,
|
|
443
508
|
this.checkout.storedSchema,
|
|
444
509
|
this.stagedUpgradePolicy,
|
|
445
510
|
);
|
|
511
|
+
this.currentEnabledUpgrades = enabledUpgrades;
|
|
446
512
|
return {
|
|
447
513
|
...compatibility,
|
|
448
514
|
canInitialize: canInitialize(this.checkout),
|
|
@@ -481,7 +547,7 @@ export class SchematizingSimpleTreeView<
|
|
|
481
547
|
anchors.slots.delete(SimpleContextSlot);
|
|
482
548
|
}
|
|
483
549
|
|
|
484
|
-
public get compatibility():
|
|
550
|
+
public get compatibility(): SchemaCompatibilityStatusBeta {
|
|
485
551
|
if (!this.currentCompatibility) {
|
|
486
552
|
this.failDisposed();
|
|
487
553
|
}
|
|
@@ -496,6 +562,7 @@ export class SchematizingSimpleTreeView<
|
|
|
496
562
|
}
|
|
497
563
|
this.checkout.forest.anchors.slots.delete(ViewSlot);
|
|
498
564
|
this.currentCompatibility = undefined;
|
|
565
|
+
this.currentEnabledUpgrades = undefined;
|
|
499
566
|
this.onDispose?.();
|
|
500
567
|
if (!this.checkout.isSharedBranch && !this.checkout.disposed) {
|
|
501
568
|
// All non-shared branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.
|
|
@@ -505,11 +572,7 @@ export class SchematizingSimpleTreeView<
|
|
|
505
572
|
|
|
506
573
|
private get flexRoot(): FlexTreeOptionalField | FlexTreeRequiredField {
|
|
507
574
|
this.breaker.use();
|
|
508
|
-
|
|
509
|
-
throw new UsageError(
|
|
510
|
-
"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.",
|
|
511
|
-
);
|
|
512
|
-
}
|
|
575
|
+
throwIfSchemaIsIncompatible(this.compatibility);
|
|
513
576
|
const view = this.getFlexTreeContext();
|
|
514
577
|
assert(
|
|
515
578
|
view.root.is(FieldKinds.optional) ||
|
|
@@ -526,11 +589,7 @@ export class SchematizingSimpleTreeView<
|
|
|
526
589
|
|
|
527
590
|
public set root(newRoot: InsertableField<TRootSchema>) {
|
|
528
591
|
this.breaker.use();
|
|
529
|
-
|
|
530
|
-
throw new UsageError(
|
|
531
|
-
"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.",
|
|
532
|
-
);
|
|
533
|
-
}
|
|
592
|
+
throwIfSchemaIsIncompatible(this.compatibility);
|
|
534
593
|
const view = this.getFlexTreeContext();
|
|
535
594
|
setField(
|
|
536
595
|
view.root,
|
|
@@ -542,28 +601,40 @@ export class SchematizingSimpleTreeView<
|
|
|
542
601
|
|
|
543
602
|
// #region Branching
|
|
544
603
|
|
|
545
|
-
public fork(): ReturnType<
|
|
604
|
+
public fork(): ReturnType<UntypedTreeViewAlpha["fork"]> &
|
|
546
605
|
SchematizingSimpleTreeView<TRootSchema> {
|
|
547
606
|
return this.checkout.fork().viewWith(this.config);
|
|
548
607
|
}
|
|
549
608
|
|
|
550
|
-
public
|
|
609
|
+
public rewindTo(revision: string): void {
|
|
610
|
+
this.checkout.rewindTo(revision);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
public revertTo(revision: string, options?: RevertToOptionsAlpha): void {
|
|
614
|
+
this.checkout.revertTo(revision, options);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
public merge(context: UntypedTreeViewAlpha, disposeMerged = true): void {
|
|
551
618
|
this.checkout.merge(context, disposeMerged);
|
|
552
619
|
}
|
|
553
620
|
|
|
554
|
-
public rebaseOnto(context:
|
|
621
|
+
public rebaseOnto(context: UntypedTreeViewAlpha): void {
|
|
555
622
|
this.checkout.rebaseOnto(context);
|
|
556
623
|
}
|
|
557
624
|
|
|
558
|
-
public isMissingEditsFrom(context:
|
|
625
|
+
public isMissingEditsFrom(context: UntypedTreeViewAlpha): boolean {
|
|
559
626
|
return this.checkout.isMissingEditsFrom(context);
|
|
560
627
|
}
|
|
561
628
|
|
|
562
629
|
public computeNetChangeIfRebasedOnto(
|
|
563
|
-
context:
|
|
630
|
+
context: UntypedTreeViewAlpha,
|
|
564
631
|
): JsonCompatibleReadOnly | undefined {
|
|
565
632
|
return this.checkout.computeNetChangeIfRebasedOnto(context);
|
|
566
633
|
}
|
|
567
634
|
|
|
568
635
|
// #endregion Branching
|
|
636
|
+
|
|
637
|
+
public get branchHistory(): TreeBranchHistory {
|
|
638
|
+
return this.checkout.branchHistory;
|
|
639
|
+
}
|
|
569
640
|
}
|
|
@@ -524,6 +524,7 @@ export const changeFormatVersionForEditManager = DependentFormatVersion.fromPair
|
|
|
524
524
|
[EditManagerFormatVersion.v4, SharedTreeChangeFormatVersion.v4],
|
|
525
525
|
[EditManagerFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],
|
|
526
526
|
[EditManagerFormatVersion.v6, SharedTreeChangeFormatVersion.v5],
|
|
527
|
+
[EditManagerFormatVersion.v7, SharedTreeChangeFormatVersion.v5],
|
|
527
528
|
]);
|
|
528
529
|
|
|
529
530
|
/**
|
|
@@ -540,6 +541,7 @@ export const changeFormatVersionForMessage = DependentFormatVersion.fromPairs<
|
|
|
540
541
|
[MessageFormatVersion.v4, SharedTreeChangeFormatVersion.v4],
|
|
541
542
|
[MessageFormatVersion.vSharedBranches, SharedTreeChangeFormatVersion.v4],
|
|
542
543
|
[MessageFormatVersion.v6, SharedTreeChangeFormatVersion.v5],
|
|
544
|
+
[MessageFormatVersion.v7, SharedTreeChangeFormatVersion.v5],
|
|
543
545
|
]);
|
|
544
546
|
|
|
545
547
|
function getCodecTreeForEditManagerFormat(
|
|
@@ -659,8 +661,9 @@ export interface SharedTreeOptions
|
|
|
659
661
|
* @remarks
|
|
660
662
|
* By default, SharedTree evicts trunk commits once all peers have acknowledged them (i.e. once they
|
|
661
663
|
* are outside the collaboration window), and they are not otherwise retained (e.g. by revertibles or
|
|
662
|
-
* local branches), to bound memory usage
|
|
663
|
-
*
|
|
664
|
+
* local branches), to bound memory usage and document size.
|
|
665
|
+
* As long as this flag is enabled, trunk commits are retained - this increases memory usage and document size
|
|
666
|
+
* over time and should be used with care.
|
|
664
667
|
*/
|
|
665
668
|
readonly retainHistory?: boolean;
|
|
666
669
|
|
package/src/shared-tree/tree.ts
CHANGED
|
@@ -58,7 +58,7 @@ export const Tree: Tree = {
|
|
|
58
58
|
...treeNodeApi,
|
|
59
59
|
|
|
60
60
|
// Note: the implementation details of `createRunTransaction` are deprecated.
|
|
61
|
-
// We have introduced replacement `@alpha` APIs on `
|
|
61
|
+
// We have introduced replacement `@alpha` APIs on `UntypedTreeView`, but until they are `@public`, we can't reasonably deprecated this.
|
|
62
62
|
// Once they have been promoted to public, we can deprecate this API.
|
|
63
63
|
runTransaction: createRunTransaction(),
|
|
64
64
|
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
type TreeEncodingOptions,
|
|
59
59
|
type VerboseTree,
|
|
60
60
|
extractPersistedSchema,
|
|
61
|
-
type
|
|
61
|
+
type UntypedTreeView,
|
|
62
62
|
TreeViewConfigurationAlpha,
|
|
63
63
|
getStoredKey,
|
|
64
64
|
getPropertyKeyFromStoredKey,
|
|
@@ -84,7 +84,6 @@ import {
|
|
|
84
84
|
type TreeContextAlpha,
|
|
85
85
|
type TreeNodeSchema,
|
|
86
86
|
getUnhydratedContext,
|
|
87
|
-
type TreeBranchAlpha,
|
|
88
87
|
} from "../simple-tree/index.js";
|
|
89
88
|
import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js";
|
|
90
89
|
|
|
@@ -96,22 +95,22 @@ const identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined =>
|
|
|
96
95
|
return getIdentifierFromNode(node, "uncompressed");
|
|
97
96
|
};
|
|
98
97
|
|
|
99
|
-
identifier.shorten = (
|
|
98
|
+
identifier.shorten = (view: UntypedTreeView, nodeIdentifier: string): number | undefined => {
|
|
100
99
|
assert(
|
|
101
|
-
|
|
100
|
+
view instanceof SchematizingSimpleTreeView,
|
|
102
101
|
0xcac /* Unexpected branch implementation */,
|
|
103
102
|
);
|
|
104
|
-
const { nodeKeyManager } =
|
|
103
|
+
const { nodeKeyManager } = view;
|
|
105
104
|
const localNodeKey = nodeKeyManager.tryLocalizeNodeIdentifier(nodeIdentifier);
|
|
106
105
|
return localNodeKey === undefined ? undefined : extractFromOpaque(localNodeKey);
|
|
107
106
|
};
|
|
108
107
|
|
|
109
|
-
identifier.lengthen = (
|
|
108
|
+
identifier.lengthen = (view: UntypedTreeView, nodeIdentifier: number): string => {
|
|
110
109
|
assert(
|
|
111
|
-
|
|
110
|
+
view instanceof SchematizingSimpleTreeView,
|
|
112
111
|
0xcad /* Unexpected branch implementation */,
|
|
113
112
|
);
|
|
114
|
-
const { nodeKeyManager } =
|
|
113
|
+
const { nodeKeyManager } = view;
|
|
115
114
|
const local = brand<LocalNodeIdentifier>(nodeIdentifier as SessionSpaceCompressedId);
|
|
116
115
|
return nodeKeyManager.stabilizeNodeIdentifier(local);
|
|
117
116
|
};
|
|
@@ -121,8 +120,8 @@ identifier.getShort = (node: TreeNode): number | undefined => {
|
|
|
121
120
|
return typeof shortIdentifier === "number" ? shortIdentifier : undefined;
|
|
122
121
|
};
|
|
123
122
|
|
|
124
|
-
identifier.create = (
|
|
125
|
-
const nodeKeyManager = (
|
|
123
|
+
identifier.create = (view: UntypedTreeView): string => {
|
|
124
|
+
const nodeKeyManager = (view as SchematizingSimpleTreeView<ImplicitFieldSchema>)
|
|
126
125
|
.nodeKeyManager;
|
|
127
126
|
return nodeKeyManager.stabilizeNodeIdentifier(nodeKeyManager.generateLocalNodeIdentifier());
|
|
128
127
|
};
|
|
@@ -154,7 +153,7 @@ export interface TreeIdentifierUtils {
|
|
|
154
153
|
(node: TreeNode): string | undefined;
|
|
155
154
|
|
|
156
155
|
/**
|
|
157
|
-
* Returns the shortened identifier as a number given a UUID known by the id compressor on the
|
|
156
|
+
* Returns the shortened identifier as a number given a UUID known by the id compressor on the view.
|
|
158
157
|
* @remarks
|
|
159
158
|
* If the given string is not a valid identifier and/or was not generated by the SharedTree, this will return `undefined`.
|
|
160
159
|
*
|
|
@@ -163,10 +162,10 @@ export interface TreeIdentifierUtils {
|
|
|
163
162
|
* This method is the inverse of {@link TreeIdentifierUtils.lengthen}.
|
|
164
163
|
* If you shorten an identifier and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.
|
|
165
164
|
*
|
|
166
|
-
* @param
|
|
165
|
+
* @param view - The view of the SharedTree that will perform the compression.
|
|
167
166
|
* @param nodeIdentifier - the stable identifier to be shortened.
|
|
168
167
|
*/
|
|
169
|
-
shorten(
|
|
168
|
+
shorten(view: UntypedTreeView, nodeIdentifier: string): number | undefined;
|
|
170
169
|
|
|
171
170
|
/**
|
|
172
171
|
* Returns the stable id as a string if the identifier is decompressible and known by the id compressor.
|
|
@@ -176,10 +175,10 @@ export interface TreeIdentifierUtils {
|
|
|
176
175
|
* This method is the inverse of {@link TreeIdentifierUtils.shorten}.
|
|
177
176
|
* If you lengthen an identifier and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.
|
|
178
177
|
*
|
|
179
|
-
* @param
|
|
178
|
+
* @param view - The view of the SharedTree that will perform the decompression.
|
|
180
179
|
* @param nodeIdentifier - The local identifier to be lengthened.
|
|
181
180
|
*/
|
|
182
|
-
lengthen(
|
|
181
|
+
lengthen(view: UntypedTreeView, nodeIdentifier: number): string;
|
|
183
182
|
|
|
184
183
|
/**
|
|
185
184
|
* Returns the {@link TreeIdentifierUtils.shorten | shortened} form of the identifier {@link SchemaFactory.identifier | identifier} for the given node.
|
|
@@ -206,9 +205,9 @@ export interface TreeIdentifierUtils {
|
|
|
206
205
|
* @remarks
|
|
207
206
|
* The returned UUID string can be {@link TreeIdentifierUtils.shorten | shortened} for high-performance scenarios.
|
|
208
207
|
*
|
|
209
|
-
* @param
|
|
208
|
+
* @param view - The view of the SharedTree that will generate and manage the identifier.
|
|
210
209
|
*/
|
|
211
|
-
create(
|
|
210
|
+
create(view: UntypedTreeView): string;
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
/**
|
|
@@ -253,19 +252,6 @@ export interface TreeAlpha {
|
|
|
253
252
|
listener: NoInfer<TreeChangeEventsAlpha<TNode>[K]>,
|
|
254
253
|
): () => void;
|
|
255
254
|
|
|
256
|
-
/**
|
|
257
|
-
* Retrieve the {@link TreeBranch | branch}, if any, for the given node.
|
|
258
|
-
* @param node - The node to query
|
|
259
|
-
* @remarks If the node has already been inserted into the tree, this will return the branch associated with that node's {@link TreeView | view}.
|
|
260
|
-
* Otherwise, it will return `undefined` (because the node has not yet been inserted and is therefore not part of a branch or view).
|
|
261
|
-
*
|
|
262
|
-
* This does not fork a new branch, but rather retrieves the _existing_ branch for the node.
|
|
263
|
-
* To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.
|
|
264
|
-
*
|
|
265
|
-
* @deprecated To obtain a {@link TreeBranchAlpha | branch }, use `TreeAlpha.context(node)` to obtain a {@link TreeContextAlpha | context} and then check {@link TreeContextAlpha.isBranch | isBranch()}.
|
|
266
|
-
*/
|
|
267
|
-
branch(node: TreeNode): TreeBranchAlpha | undefined;
|
|
268
|
-
|
|
269
255
|
/**
|
|
270
256
|
* Retrieve the {@link TreeContextAlpha | context} for the given node.
|
|
271
257
|
* @param node - The node to query
|
|
@@ -842,13 +828,9 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
842
828
|
},
|
|
843
829
|
|
|
844
830
|
context(node: TreeNode): TreeContextAlpha {
|
|
845
|
-
return this.branch(node) ?? UnhydratedTreeContext.instance;
|
|
846
|
-
},
|
|
847
|
-
|
|
848
|
-
branch(node: TreeNode): TreeBranchAlpha | undefined {
|
|
849
831
|
const kernel = getKernel(node);
|
|
850
832
|
if (!kernel.isHydrated()) {
|
|
851
|
-
return
|
|
833
|
+
return UnhydratedTreeContext.instance;
|
|
852
834
|
}
|
|
853
835
|
const view = kernel.anchorNode.anchorSet.slots.get(ViewSlot);
|
|
854
836
|
assert(
|