@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
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
appendDebugMessage,
|
|
8
|
+
unreachableCase,
|
|
9
|
+
fail,
|
|
10
|
+
} from "@fluidframework/core-utils/internal";
|
|
11
|
+
import type {
|
|
12
|
+
ITelemetryBaseProperties,
|
|
13
|
+
TelemetryBaseEventPropertyType,
|
|
14
|
+
} from "@fluidframework/core-interfaces";
|
|
15
|
+
import { tagSchemaArtifacts, UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
16
|
|
|
9
17
|
import {
|
|
10
18
|
type TreeFieldStoredSchema,
|
|
@@ -13,6 +21,7 @@ import {
|
|
|
13
21
|
MapNodeStoredSchema,
|
|
14
22
|
Multiplicity,
|
|
15
23
|
type SchemaAndPolicy,
|
|
24
|
+
ValueSchema,
|
|
16
25
|
} from "../core/index.js";
|
|
17
26
|
import { iterableHasSome, mapIterable } from "../util/index.js";
|
|
18
27
|
|
|
@@ -33,83 +42,137 @@ export enum SchemaValidationError {
|
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* Not all fields are populated for every error type — only those relevant to the specific error.
|
|
45
|
+
* Information about a schema validation error.
|
|
39
46
|
*/
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
readonly nodeType?: string;
|
|
45
|
-
/**
|
|
46
|
-
* The set of type identifiers allowed in the field, if applicable.
|
|
47
|
-
*/
|
|
48
|
-
readonly allowedTypes?: ReadonlySet<string>;
|
|
49
|
-
/**
|
|
50
|
-
* Field keys on the node that were not recognized by its schema.
|
|
51
|
-
*/
|
|
52
|
-
readonly unexpectedFields?: ReadonlySet<string>;
|
|
47
|
+
export interface SchemaValidationErrorDetails {
|
|
48
|
+
readonly error: SchemaValidationError;
|
|
49
|
+
readonly path: readonly (string | number)[];
|
|
50
|
+
readonly telemetryProperties?: ITelemetryBaseProperties;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
/**
|
|
56
54
|
* Throws a UsageError indicating a tree is out of schema.
|
|
57
55
|
*/
|
|
58
|
-
export function throwOutOfSchema(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
|
|
56
|
+
export function throwOutOfSchema(details: SchemaValidationErrorDetails): never {
|
|
57
|
+
const message = `Tree does not conform to schema. ${getSchemaValidationErrorMessage(details.error)}`;
|
|
58
|
+
throw new UsageError(
|
|
59
|
+
appendDebugMessage(message, () => getSchemaValidationDebugMessage(details)),
|
|
60
|
+
{
|
|
61
|
+
...tagSchemaArtifacts({
|
|
62
|
+
schemaValidationError: SchemaValidationError[details.error],
|
|
63
|
+
schemaValidationPath: JSON.stringify(details.path),
|
|
64
|
+
}),
|
|
65
|
+
...details.telemetryProperties,
|
|
66
|
+
},
|
|
67
|
+
);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
function getTelemetryProperty(
|
|
71
|
+
details: SchemaValidationErrorDetails,
|
|
72
|
+
key: string,
|
|
73
|
+
): TelemetryBaseEventPropertyType {
|
|
74
|
+
const property = details.telemetryProperties?.[key];
|
|
75
|
+
return typeof property === "object" ? property.value : property;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function getSchemaValidationDebugMessage(details: SchemaValidationErrorDetails): string {
|
|
79
|
+
const path = details.path.length === 0 ? "" : ` at path ${JSON.stringify(details.path)}`;
|
|
80
|
+
const nodeType = getTelemetryProperty(details, "nodeType");
|
|
81
|
+
const fieldKind = getTelemetryProperty(details, "fieldKind");
|
|
82
|
+
const childCount = getTelemetryProperty(details, "childCount");
|
|
83
|
+
switch (details.error) {
|
|
84
|
+
case SchemaValidationError.Field_KindNotInSchemaPolicy: {
|
|
85
|
+
return `Field kind ${JSON.stringify(fieldKind)} is not supported by the schema policy${path}.`;
|
|
86
|
+
}
|
|
87
|
+
case SchemaValidationError.Field_MissingRequiredChild: {
|
|
88
|
+
return `A required field of kind ${JSON.stringify(fieldKind)} must contain exactly one child, but found ${childCount}${path}.`;
|
|
89
|
+
}
|
|
90
|
+
case SchemaValidationError.Field_MultipleChildrenNotAllowed: {
|
|
91
|
+
return `A field of kind ${JSON.stringify(fieldKind)} allows at most one child, but found ${childCount}${path}.`;
|
|
92
|
+
}
|
|
93
|
+
case SchemaValidationError.Field_ChildInForbiddenField: {
|
|
94
|
+
return `A forbidden field of kind ${JSON.stringify(fieldKind)} must be empty, but found ${childCount} ${childCount === 1 ? "child" : "children"}${path}.`;
|
|
95
|
+
}
|
|
71
96
|
case SchemaValidationError.Field_NodeTypeNotAllowed: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
return `A node of type ${JSON.stringify(nodeType)} is not allowed in this field${path}. Allowed types: ${getTelemetryProperty(details, "allowedTypes")}. If using a staged allowed type, upgrade the stored schema before inserting this content.`;
|
|
98
|
+
}
|
|
99
|
+
case SchemaValidationError.LeafNode_InvalidValue: {
|
|
100
|
+
return `Leaf node ${JSON.stringify(nodeType)} requires a value matching ${JSON.stringify(getTelemetryProperty(details, "expectedValueType"))}, but found ${JSON.stringify(getTelemetryProperty(details, "actualValueType"))}${path}.`;
|
|
101
|
+
}
|
|
102
|
+
case SchemaValidationError.LeafNode_FieldsNotAllowed: {
|
|
103
|
+
return `Leaf node ${JSON.stringify(nodeType)} must not contain fields${path}. Unexpected fields: ${getTelemetryProperty(details, "unexpectedFields")}.`;
|
|
104
|
+
}
|
|
105
|
+
case SchemaValidationError.ObjectNode_FieldNotInSchema: {
|
|
106
|
+
return `A node of type ${JSON.stringify(nodeType)} has fields not defined in its schema${path}. Unexpected fields: ${getTelemetryProperty(details, "unexpectedFields")}.`;
|
|
107
|
+
}
|
|
108
|
+
case SchemaValidationError.NonLeafNode_ValueNotAllowed: {
|
|
109
|
+
return `Non-leaf node ${JSON.stringify(nodeType)} must not have a value, but found ${JSON.stringify(getTelemetryProperty(details, "actualValueType"))}${path}.`;
|
|
83
110
|
}
|
|
84
111
|
case SchemaValidationError.Node_MissingSchema: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
return `No schema definition was found for node type ${JSON.stringify(nodeType)}${path}. Ensure the node's type is included in the schema and that the stored schema has been upgraded if needed.`;
|
|
113
|
+
}
|
|
114
|
+
default: {
|
|
115
|
+
return unreachableCase(details.error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getSchemaValidationErrorMessage(error: SchemaValidationError): string {
|
|
121
|
+
switch (error) {
|
|
122
|
+
case SchemaValidationError.Field_KindNotInSchemaPolicy: {
|
|
123
|
+
return "The field kind is not supported by the schema policy.";
|
|
124
|
+
}
|
|
125
|
+
case SchemaValidationError.Field_MissingRequiredChild: {
|
|
126
|
+
return "A required field is missing its child.";
|
|
127
|
+
}
|
|
128
|
+
case SchemaValidationError.Field_MultipleChildrenNotAllowed: {
|
|
129
|
+
return "A field contains more children than its kind allows.";
|
|
130
|
+
}
|
|
131
|
+
case SchemaValidationError.Field_ChildInForbiddenField: {
|
|
132
|
+
return "A forbidden field contains children.";
|
|
133
|
+
}
|
|
134
|
+
case SchemaValidationError.Field_NodeTypeNotAllowed: {
|
|
135
|
+
return "A node type is not allowed in its field.";
|
|
136
|
+
}
|
|
137
|
+
case SchemaValidationError.LeafNode_InvalidValue: {
|
|
138
|
+
return "A leaf node value does not match its schema.";
|
|
139
|
+
}
|
|
140
|
+
case SchemaValidationError.LeafNode_FieldsNotAllowed: {
|
|
141
|
+
return "A leaf node contains fields.";
|
|
91
142
|
}
|
|
92
143
|
case SchemaValidationError.ObjectNode_FieldNotInSchema: {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
? "The node has fields that are not defined in its schema."
|
|
101
|
-
: `Unexpected fields: ${fieldsDesc}.`;
|
|
102
|
-
return (
|
|
103
|
-
`Tree does not conform to schema. ` +
|
|
104
|
-
`A node of type ${nodeDesc} has fields not defined in its schema. ${fieldsPart}`
|
|
105
|
-
);
|
|
144
|
+
return "An object node contains fields not defined in its schema.";
|
|
145
|
+
}
|
|
146
|
+
case SchemaValidationError.NonLeafNode_ValueNotAllowed: {
|
|
147
|
+
return "A non-leaf node contains a value.";
|
|
148
|
+
}
|
|
149
|
+
case SchemaValidationError.Node_MissingSchema: {
|
|
150
|
+
return "The node type has no schema definition.";
|
|
106
151
|
}
|
|
107
152
|
default: {
|
|
108
|
-
return
|
|
153
|
+
return unreachableCase(error);
|
|
109
154
|
}
|
|
110
155
|
}
|
|
111
156
|
}
|
|
112
157
|
|
|
158
|
+
function schemaValidationError(
|
|
159
|
+
error: SchemaValidationError,
|
|
160
|
+
telemetryProperties?: ITelemetryBaseProperties,
|
|
161
|
+
): SchemaValidationErrorDetails {
|
|
162
|
+
return { error, path: [], telemetryProperties };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function prependPath<T extends NotUndefined>(
|
|
166
|
+
onError: (details: SchemaValidationErrorDetails) => T,
|
|
167
|
+
segment: string | number,
|
|
168
|
+
): (details: SchemaValidationErrorDetails) => T {
|
|
169
|
+
return (details) => onError({ ...details, path: [segment, ...details.path] });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function getValueType(value: unknown): string {
|
|
173
|
+
return value === null ? "null" : typeof value;
|
|
174
|
+
}
|
|
175
|
+
|
|
113
176
|
type NotUndefined = number | string | boolean | bigint | symbol | object;
|
|
114
177
|
|
|
115
178
|
/**
|
|
@@ -122,28 +185,52 @@ type NotUndefined = number | string | boolean | bigint | symbol | object;
|
|
|
122
185
|
export function isNodeInSchema<T extends NotUndefined>(
|
|
123
186
|
node: MinimalMapTreeNodeView,
|
|
124
187
|
schemaAndPolicy: SchemaAndPolicy,
|
|
125
|
-
onError: (
|
|
188
|
+
onError: (details: SchemaValidationErrorDetails) => T,
|
|
126
189
|
): T | undefined {
|
|
127
190
|
// Validate the schema declared by the node exists
|
|
128
191
|
const schema = schemaAndPolicy.schema.nodeSchema.get(node.type);
|
|
129
192
|
if (schema === undefined) {
|
|
130
|
-
return onError(
|
|
131
|
-
|
|
132
|
-
|
|
193
|
+
return onError(
|
|
194
|
+
schemaValidationError(
|
|
195
|
+
SchemaValidationError.Node_MissingSchema,
|
|
196
|
+
tagSchemaArtifacts({ nodeType: node.type }),
|
|
197
|
+
),
|
|
198
|
+
);
|
|
133
199
|
}
|
|
134
200
|
|
|
135
201
|
// Validate the node is well formed according to its schema
|
|
136
202
|
|
|
137
203
|
if (schema instanceof LeafNodeStoredSchema) {
|
|
138
204
|
if (iterableHasSome(node.fields)) {
|
|
139
|
-
|
|
205
|
+
const unexpectedFields = [...mapIterable(node.fields, ([key]) => key)].sort();
|
|
206
|
+
return onError(
|
|
207
|
+
schemaValidationError(SchemaValidationError.LeafNode_FieldsNotAllowed, {
|
|
208
|
+
...tagSchemaArtifacts({
|
|
209
|
+
nodeType: node.type,
|
|
210
|
+
unexpectedFields: JSON.stringify(unexpectedFields),
|
|
211
|
+
}),
|
|
212
|
+
}),
|
|
213
|
+
);
|
|
140
214
|
}
|
|
141
215
|
if (!allowsValue(schema.leafValue, node.value)) {
|
|
142
|
-
return onError(
|
|
216
|
+
return onError(
|
|
217
|
+
schemaValidationError(SchemaValidationError.LeafNode_InvalidValue, {
|
|
218
|
+
...tagSchemaArtifacts({
|
|
219
|
+
nodeType: node.type,
|
|
220
|
+
expectedValueType: ValueSchema[schema.leafValue],
|
|
221
|
+
}),
|
|
222
|
+
actualValueType: getValueType(node.value),
|
|
223
|
+
}),
|
|
224
|
+
);
|
|
143
225
|
}
|
|
144
226
|
} else {
|
|
145
227
|
if (node.value !== undefined) {
|
|
146
|
-
return onError(
|
|
228
|
+
return onError(
|
|
229
|
+
schemaValidationError(SchemaValidationError.NonLeafNode_ValueNotAllowed, {
|
|
230
|
+
...tagSchemaArtifacts({ nodeType: node.type }),
|
|
231
|
+
actualValueType: getValueType(node.value),
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
147
234
|
}
|
|
148
235
|
|
|
149
236
|
if (schema instanceof ObjectNodeStoredSchema) {
|
|
@@ -154,7 +241,7 @@ export function isNodeInSchema<T extends NotUndefined>(
|
|
|
154
241
|
nodeField,
|
|
155
242
|
fieldSchema,
|
|
156
243
|
schemaAndPolicy,
|
|
157
|
-
onError,
|
|
244
|
+
prependPath(onError, fieldKey),
|
|
158
245
|
);
|
|
159
246
|
if (fieldInSchemaResult !== undefined) {
|
|
160
247
|
return fieldInSchemaResult;
|
|
@@ -166,18 +253,22 @@ export function isNodeInSchema<T extends NotUndefined>(
|
|
|
166
253
|
// Code using this with a stored schema derived from a view schema rather than the document can be problematic because it may be missing unknown fields that the actual document has.
|
|
167
254
|
// Other schema evolution features like "staged" allowed types will likely cause similar issues elsewhere in this checker.
|
|
168
255
|
if (uncheckedFieldsFromNode.size > 0) {
|
|
169
|
-
return onError(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
256
|
+
return onError(
|
|
257
|
+
schemaValidationError(SchemaValidationError.ObjectNode_FieldNotInSchema, {
|
|
258
|
+
...tagSchemaArtifacts({
|
|
259
|
+
nodeType: node.type,
|
|
260
|
+
unexpectedFields: JSON.stringify([...uncheckedFieldsFromNode].sort()),
|
|
261
|
+
}),
|
|
262
|
+
}),
|
|
263
|
+
);
|
|
173
264
|
}
|
|
174
265
|
} else if (schema instanceof MapNodeStoredSchema) {
|
|
175
|
-
for (const [
|
|
266
|
+
for (const [key, field] of node.fields) {
|
|
176
267
|
const fieldInSchemaResult = isFieldInSchema(
|
|
177
268
|
field,
|
|
178
269
|
schema.mapFields,
|
|
179
270
|
schemaAndPolicy,
|
|
180
|
-
onError,
|
|
271
|
+
prependPath(onError, key),
|
|
181
272
|
);
|
|
182
273
|
if (fieldInSchemaResult !== undefined) {
|
|
183
274
|
return fieldInSchemaResult;
|
|
@@ -202,36 +293,61 @@ export function isFieldInSchema<T extends NotUndefined>(
|
|
|
202
293
|
childNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,
|
|
203
294
|
schema: TreeFieldStoredSchema,
|
|
204
295
|
schemaAndPolicy: SchemaAndPolicy,
|
|
205
|
-
onError: (
|
|
296
|
+
onError: (details: SchemaValidationErrorDetails) => T,
|
|
206
297
|
): T | undefined {
|
|
207
298
|
// Validate that the field kind is handled by the schema policy
|
|
208
299
|
const kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);
|
|
209
300
|
if (kind === undefined) {
|
|
210
|
-
return onError(
|
|
301
|
+
return onError(
|
|
302
|
+
schemaValidationError(
|
|
303
|
+
SchemaValidationError.Field_KindNotInSchemaPolicy,
|
|
304
|
+
tagSchemaArtifacts({ fieldKind: schema.kind }),
|
|
305
|
+
),
|
|
306
|
+
);
|
|
211
307
|
}
|
|
212
308
|
|
|
213
309
|
// Validate that the field doesn't contain more nodes than its type supports
|
|
214
310
|
{
|
|
215
311
|
const multiplicityCheck = compliesWithMultiplicity(childNodes.length, kind.multiplicity);
|
|
216
312
|
if (multiplicityCheck !== undefined) {
|
|
217
|
-
return onError(
|
|
313
|
+
return onError(
|
|
314
|
+
schemaValidationError(multiplicityCheck, {
|
|
315
|
+
...tagSchemaArtifacts({ fieldKind: schema.kind }),
|
|
316
|
+
childCount: childNodes.length,
|
|
317
|
+
}),
|
|
318
|
+
);
|
|
218
319
|
}
|
|
219
320
|
}
|
|
220
321
|
|
|
322
|
+
let index = 0;
|
|
221
323
|
for (const node of childNodes) {
|
|
222
324
|
// Validate the type declared by the node is allowed in this field
|
|
223
325
|
if (schema.types !== undefined && !schema.types.has(node.type)) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
326
|
+
const allowedTypes = [...schema.types].sort();
|
|
327
|
+
return prependPath(
|
|
328
|
+
onError,
|
|
329
|
+
index,
|
|
330
|
+
)(
|
|
331
|
+
schemaValidationError(
|
|
332
|
+
SchemaValidationError.Field_NodeTypeNotAllowed,
|
|
333
|
+
tagSchemaArtifacts({
|
|
334
|
+
nodeType: node.type,
|
|
335
|
+
allowedTypes: JSON.stringify(allowedTypes),
|
|
336
|
+
}),
|
|
337
|
+
),
|
|
338
|
+
);
|
|
228
339
|
}
|
|
229
340
|
|
|
230
341
|
// Validate the node complies with the type it declares to be.
|
|
231
|
-
const nodeInSchemaResult = isNodeInSchema(
|
|
342
|
+
const nodeInSchemaResult = isNodeInSchema(
|
|
343
|
+
node,
|
|
344
|
+
schemaAndPolicy,
|
|
345
|
+
prependPath(onError, index),
|
|
346
|
+
);
|
|
232
347
|
if (nodeInSchemaResult !== undefined) {
|
|
233
348
|
return nodeInSchemaResult;
|
|
234
349
|
}
|
|
350
|
+
index += 1;
|
|
235
351
|
}
|
|
236
352
|
|
|
237
353
|
return undefined;
|
package/src/index.ts
CHANGED
|
@@ -18,10 +18,13 @@ export {
|
|
|
18
18
|
type RemoteChangeMetadata,
|
|
19
19
|
type ChangeMetadata,
|
|
20
20
|
type LabelTree,
|
|
21
|
+
type CustomMetadataTree,
|
|
21
22
|
type TransactionLabels,
|
|
22
23
|
type RevertibleFactory,
|
|
23
24
|
type RevertibleAlphaFactory,
|
|
24
25
|
type RevertibleAlpha,
|
|
26
|
+
type RevertOptionsAlpha,
|
|
27
|
+
type RevertToOptionsAlpha,
|
|
25
28
|
} from "./core/index.js";
|
|
26
29
|
|
|
27
30
|
import type {
|
|
@@ -91,6 +94,7 @@ export {
|
|
|
91
94
|
} from "./shared-tree/index.js";
|
|
92
95
|
|
|
93
96
|
export {
|
|
97
|
+
type CommitRevision,
|
|
94
98
|
TreeArrayNode,
|
|
95
99
|
type TreeArrayNodeAlpha,
|
|
96
100
|
type Unhydrated,
|
|
@@ -133,6 +137,8 @@ export {
|
|
|
133
137
|
type TreeNodeFromImplicitAllowedTypes,
|
|
134
138
|
type TreeNodeSchemaClass,
|
|
135
139
|
type SchemaCompatibilityStatus,
|
|
140
|
+
type SchemaCompatibilityStatusBeta,
|
|
141
|
+
type SchemaDiscrepancy,
|
|
136
142
|
type FieldProps,
|
|
137
143
|
type FieldPropsAlpha,
|
|
138
144
|
normalizeFieldSchema,
|
|
@@ -194,6 +200,7 @@ export {
|
|
|
194
200
|
singletonSchema,
|
|
195
201
|
type UnsafeUnknownSchema,
|
|
196
202
|
type TreeViewAlpha,
|
|
203
|
+
type StagedUpgradeStatus,
|
|
197
204
|
type TreeViewBeta,
|
|
198
205
|
type InsertableField,
|
|
199
206
|
type Insertable,
|
|
@@ -269,10 +276,14 @@ export {
|
|
|
269
276
|
type ReadonlyArrayNode,
|
|
270
277
|
type InsertableTreeNodeFromAllowedTypes,
|
|
271
278
|
type Input,
|
|
279
|
+
type UntypedTreeView,
|
|
272
280
|
type TreeBranch,
|
|
273
281
|
type TreeBranchAlpha,
|
|
282
|
+
type UntypedTreeViewAlpha,
|
|
274
283
|
type TreeBranchEvents,
|
|
275
284
|
asTreeViewAlpha,
|
|
285
|
+
type TreeBranchCommitMetadata,
|
|
286
|
+
type TreeBranchHistory,
|
|
276
287
|
type NodeSchemaOptions,
|
|
277
288
|
type NodeSchemaOptionsAlpha,
|
|
278
289
|
type NodeSchemaMetadata,
|
package/src/packageVersion.ts
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
8
|
+
|
|
9
|
+
import type { GraphCommit, CustomMetadataTree } from "../core/index.js";
|
|
10
|
+
import { flattenCustomMetadata } from "../core/index.js";
|
|
11
|
+
import { BranchCommitCounter, type SharedTreeBranch } from "../shared-tree-core/index.js";
|
|
12
|
+
import type { TreeBranchCommitMetadata, TreeBranchHistory } from "../simple-tree/index.js";
|
|
13
|
+
import type { JsonCompatibleReadOnlyObject } from "../util/index.js";
|
|
14
|
+
|
|
15
|
+
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
16
|
+
import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A lazily constructed implementation of {@link TreeBranchCommitMetadata} that wraps a {@link GraphCommit}.
|
|
20
|
+
*/
|
|
21
|
+
class LazyTreeBranchCommitMetadata implements TreeBranchCommitMetadata {
|
|
22
|
+
public readonly revision: string;
|
|
23
|
+
private parentCache?: {
|
|
24
|
+
readonly prior: GraphCommit<SharedTreeChange>;
|
|
25
|
+
readonly cached: TreeBranchCommitMetadata;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
public constructor(
|
|
29
|
+
private readonly commit: GraphCommit<SharedTreeChange>,
|
|
30
|
+
private readonly idCompressor: IIdCompressor,
|
|
31
|
+
) {
|
|
32
|
+
assert(
|
|
33
|
+
commit.revision !== "root",
|
|
34
|
+
0xd34 /* Cannot construct metadata for the root commit */,
|
|
35
|
+
);
|
|
36
|
+
this.revision = idCompressor.decompress(commit.revision);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public get custom(): JsonCompatibleReadOnlyObject | undefined {
|
|
40
|
+
return flattenCustomMetadata(this.commit.customMetadata);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public get customTree(): CustomMetadataTree | undefined {
|
|
44
|
+
return this.commit.customMetadata;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public getParent(): TreeBranchCommitMetadata | undefined {
|
|
48
|
+
// The parent of the commit may change over time due to trunk trimming.
|
|
49
|
+
if (this.commit.parent !== this.parentCache?.prior) {
|
|
50
|
+
const { parent } = this.commit;
|
|
51
|
+
this.parentCache =
|
|
52
|
+
parent === undefined || parent.revision === "root"
|
|
53
|
+
? undefined
|
|
54
|
+
: {
|
|
55
|
+
prior: parent,
|
|
56
|
+
cached: new LazyTreeBranchCommitMetadata(parent, this.idCompressor),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return this.parentCache?.cached;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A default implementation of {@link TreeBranchHistory} that wraps a {@link SharedTreeBranch}.
|
|
65
|
+
*/
|
|
66
|
+
export class DefaultTreeBranchHistory implements TreeBranchHistory {
|
|
67
|
+
private readonly commitCounter: BranchCommitCounter<
|
|
68
|
+
SharedTreeEditBuilder,
|
|
69
|
+
SharedTreeChange,
|
|
70
|
+
unknown
|
|
71
|
+
>;
|
|
72
|
+
|
|
73
|
+
public constructor(
|
|
74
|
+
private readonly branch: SharedTreeBranch<
|
|
75
|
+
SharedTreeEditBuilder,
|
|
76
|
+
SharedTreeChange,
|
|
77
|
+
unknown
|
|
78
|
+
>,
|
|
79
|
+
private readonly idCompressor: IIdCompressor,
|
|
80
|
+
) {
|
|
81
|
+
this.commitCounter = new BranchCommitCounter(branch);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public dispose(): void {
|
|
85
|
+
this.commitCounter.dispose();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public get length(): number {
|
|
89
|
+
return this.commitCounter.count;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public getHead(): TreeBranchCommitMetadata | undefined {
|
|
93
|
+
const head = this.branch.getHead();
|
|
94
|
+
if (head.revision === "root") {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return new LazyTreeBranchCommitMetadata(head, this.idCompressor);
|
|
98
|
+
}
|
|
99
|
+
}
|