@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,6 +10,7 @@ import type { TSchema } from "@sinclair/typebox";
|
|
|
10
10
|
import { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from "../core/index.js";
|
|
11
11
|
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
12
12
|
|
|
13
|
+
import { EncodedCustomMetadataTree } from "./customMetadataFormat.js";
|
|
13
14
|
import { MessageFormatVersion } from "./messageFormat.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -29,6 +30,12 @@ export interface Message {
|
|
|
29
30
|
*/
|
|
30
31
|
readonly changeset: JsonCompatibleReadOnly;
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Arbitrary, application-defined metadata to persist alongside the commit in this message.
|
|
35
|
+
* @remarks Only written at {@link MessageFormatVersion.v7} and later.
|
|
36
|
+
*/
|
|
37
|
+
readonly customMetadata?: EncodedCustomMetadataTree;
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* The version of the message. This controls how the message is encoded.
|
|
34
41
|
*
|
|
@@ -40,16 +47,25 @@ export interface Message {
|
|
|
40
47
|
| typeof MessageFormatVersion.v2
|
|
41
48
|
| typeof MessageFormatVersion.v3
|
|
42
49
|
| typeof MessageFormatVersion.v4
|
|
43
|
-
| typeof MessageFormatVersion.v6
|
|
50
|
+
| typeof MessageFormatVersion.v6
|
|
51
|
+
| typeof MessageFormatVersion.v7;
|
|
44
52
|
}
|
|
45
53
|
|
|
54
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
46
55
|
// Return type is intentionally derived.
|
|
47
|
-
//
|
|
48
|
-
|
|
56
|
+
// Unlike the summary formats, this schema does not set `additionalProperties: false`: the op envelope
|
|
57
|
+
// has always tolerated unknown properties, and tightening it could reject ops from other versions.
|
|
58
|
+
export const Message = <ChangeSchema extends TSchema>(
|
|
59
|
+
tChange: ChangeSchema,
|
|
60
|
+
includeCustomMetadata: boolean,
|
|
61
|
+
) =>
|
|
49
62
|
Type.Object({
|
|
50
63
|
revision: RevisionTagSchema,
|
|
51
64
|
originatorId: SessionIdSchema,
|
|
52
65
|
changeset: tChange,
|
|
66
|
+
...(includeCustomMetadata
|
|
67
|
+
? { customMetadata: Type.Optional(EncodedCustomMetadataTree) }
|
|
68
|
+
: {}),
|
|
53
69
|
version: Type.Optional(
|
|
54
70
|
Type.Union([
|
|
55
71
|
Type.Literal(MessageFormatVersion.v1),
|
|
@@ -57,6 +73,8 @@ export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
|
|
|
57
73
|
Type.Literal(MessageFormatVersion.v3),
|
|
58
74
|
Type.Literal(MessageFormatVersion.v4),
|
|
59
75
|
Type.Literal(MessageFormatVersion.v6),
|
|
76
|
+
Type.Literal(MessageFormatVersion.v7),
|
|
60
77
|
]),
|
|
61
78
|
),
|
|
62
79
|
});
|
|
80
|
+
/* eslint-enable @typescript-eslint/explicit-function-return-type */
|
|
@@ -11,6 +11,7 @@ import { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from "../
|
|
|
11
11
|
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
12
12
|
|
|
13
13
|
import type { EncodedBranchId } from "./branch.js";
|
|
14
|
+
import { EncodedCustomMetadataTree } from "./customMetadataFormat.js";
|
|
14
15
|
import { MessageFormatVersion } from "./messageFormat.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -41,6 +42,12 @@ export interface Message {
|
|
|
41
42
|
*/
|
|
42
43
|
readonly branchName?: string;
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Arbitrary, application-defined metadata to persist alongside the commit in this message.
|
|
47
|
+
* @remarks See {@link GraphCommit.customMetadata}.
|
|
48
|
+
*/
|
|
49
|
+
readonly customMetadata?: EncodedCustomMetadataTree;
|
|
50
|
+
|
|
44
51
|
/**
|
|
45
52
|
* The version of the message format.
|
|
46
53
|
*/
|
|
@@ -56,5 +63,6 @@ export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
|
|
|
56
63
|
changeset: Type.Optional(tChange),
|
|
57
64
|
branchId: Type.Optional(Type.Number()),
|
|
58
65
|
branchName: Type.Optional(Type.String()),
|
|
66
|
+
customMetadata: Type.Optional(EncodedCustomMetadataTree),
|
|
59
67
|
version: Type.Literal(MessageFormatVersion.vSharedBranches),
|
|
60
68
|
});
|
|
@@ -30,6 +30,7 @@ import type { CodecWriteOptions, DependentFormatVersion, IJsonCodec } from "../c
|
|
|
30
30
|
import {
|
|
31
31
|
type ChangeFamily,
|
|
32
32
|
type ChangeFamilyEditor,
|
|
33
|
+
CommitKind,
|
|
33
34
|
type GraphCommit,
|
|
34
35
|
replaceChange,
|
|
35
36
|
type RevisionTag,
|
|
@@ -669,10 +670,12 @@ export class SharedTreeCore<
|
|
|
669
670
|
switch (type) {
|
|
670
671
|
case "commit": {
|
|
671
672
|
const {
|
|
672
|
-
commit: { revision, change },
|
|
673
|
+
commit: { revision, change, customMetadata },
|
|
673
674
|
branchId,
|
|
674
675
|
} = message;
|
|
675
|
-
this.editManager
|
|
676
|
+
this.editManager
|
|
677
|
+
.getLocalBranch(branchId)
|
|
678
|
+
.apply({ change, revision }, CommitKind.Default, customMetadata);
|
|
676
679
|
break;
|
|
677
680
|
}
|
|
678
681
|
case "branch": {
|
|
@@ -15,15 +15,25 @@ import {
|
|
|
15
15
|
mintCommit,
|
|
16
16
|
rebaseBranch,
|
|
17
17
|
tagChange,
|
|
18
|
+
CommitKind,
|
|
18
19
|
type ChangeFamilyEditor,
|
|
20
|
+
type CustomMetadataTree,
|
|
19
21
|
type GraphCommit,
|
|
20
22
|
type ProcessChangeFn,
|
|
21
23
|
type RevisionTag,
|
|
22
24
|
} from "../core/index.js";
|
|
23
|
-
import { getLast, getOrCreate } from "../util/index.js";
|
|
25
|
+
import { getLast, getOrCreate, type JsonCompatibleReadOnlyObject } from "../util/index.js";
|
|
24
26
|
|
|
25
27
|
import type { SharedTreeBranch, SharedTreeBranchEvents } from "./branch.js";
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A {@link CustomMetadataTree} under construction.
|
|
31
|
+
*/
|
|
32
|
+
interface MutableCustomMetadataTree {
|
|
33
|
+
metadata: JsonCompatibleReadOnlyObject | undefined;
|
|
34
|
+
children: MutableCustomMetadataTree[];
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
/**
|
|
28
38
|
* Describes the result of a transaction.
|
|
29
39
|
* Transactions may either succeed and commit, or fail and abort.
|
|
@@ -290,6 +300,15 @@ export interface SquashingTransactionOptions<TChange, TChangeProcessingContext>
|
|
|
290
300
|
* {@link ChangeProcessor.applicability | applicability}.
|
|
291
301
|
*/
|
|
292
302
|
readonly postProcessor?: ChangeProcessor<TChange, TChangeProcessingContext>;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Arbitrary, application-defined metadata to attach to the commit that this transaction produces.
|
|
306
|
+
*
|
|
307
|
+
* @remarks
|
|
308
|
+
* Each transaction in the stack contributes a node to the resulting {@link CustomMetadataTree}. If
|
|
309
|
+
* the transaction produces no commit, the metadata is discarded.
|
|
310
|
+
*/
|
|
311
|
+
readonly customMetadata?: JsonCompatibleReadOnlyObject;
|
|
293
312
|
}
|
|
294
313
|
|
|
295
314
|
/**
|
|
@@ -409,6 +428,15 @@ export class SquashingTransactionStack<
|
|
|
409
428
|
startOptions?: SquashingTransactionOptions<TChange, TChangeProcessingContext>,
|
|
410
429
|
): Callbacks<SquashingTransactionOptions<TChange, TChangeProcessingContext>> => {
|
|
411
430
|
postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
|
|
431
|
+
// Each transaction in the stack contributes a node to a tree mirroring the nesting, which is
|
|
432
|
+
// attached to the single commit they produce. `openMetadataNode` is the innermost open node.
|
|
433
|
+
const rootMetadataNode: MutableCustomMetadataTree = {
|
|
434
|
+
metadata: startOptions?.customMetadata,
|
|
435
|
+
children: [],
|
|
436
|
+
};
|
|
437
|
+
let openMetadataNode = rootMetadataNode;
|
|
438
|
+
const hasCustomMetadata = (node: CustomMetadataTree): boolean =>
|
|
439
|
+
node.metadata !== undefined || node.children.some(hasCustomMetadata);
|
|
412
440
|
// Keep track of the commit that each transaction was on when it started
|
|
413
441
|
const startHead = this.activeBranch.getHead();
|
|
414
442
|
const changeFamily = this.branch.changeFamily;
|
|
@@ -490,19 +518,31 @@ export class SquashingTransactionStack<
|
|
|
490
518
|
// change in their place so that the view fully reflects the modified
|
|
491
519
|
// `change`.
|
|
492
520
|
transactionBranch.removeAfter(startHead);
|
|
493
|
-
transactionBranch.apply(
|
|
521
|
+
transactionBranch.apply(
|
|
522
|
+
tagChange(change, transactionRevision),
|
|
523
|
+
CommitKind.Default,
|
|
524
|
+
undefined,
|
|
525
|
+
);
|
|
494
526
|
}
|
|
495
527
|
|
|
528
|
+
const customMetadata = hasCustomMetadata(rootMetadataNode)
|
|
529
|
+
? rootMetadataNode
|
|
530
|
+
: undefined;
|
|
496
531
|
if (targetPath.length === 0) {
|
|
497
532
|
// No changes were made on the original branch since the transaction began
|
|
498
533
|
// The transaction commit can be applied directly
|
|
499
|
-
this.branch.apply(
|
|
534
|
+
this.branch.apply(
|
|
535
|
+
tagChange(change, transactionRevision),
|
|
536
|
+
CommitKind.Default,
|
|
537
|
+
customMetadata,
|
|
538
|
+
);
|
|
500
539
|
// The view is already up-to-date so there's nothing more to do
|
|
501
540
|
} else {
|
|
502
541
|
// Some changes were made on `branch` since the transaction began
|
|
503
542
|
const unrebasedHead = mintCommit(startHead, {
|
|
504
543
|
change,
|
|
505
544
|
revision: transactionRevision,
|
|
545
|
+
customMetadata,
|
|
506
546
|
});
|
|
507
547
|
// We need to rebase the transaction commit on top of the new changes
|
|
508
548
|
const rebased = rebaseBranch(
|
|
@@ -515,7 +555,7 @@ export class SquashingTransactionStack<
|
|
|
515
555
|
rebased.newSourceHead.revision === transactionRevision,
|
|
516
556
|
0xcd0 /* The transaction commit should be rebased to the tip */,
|
|
517
557
|
);
|
|
518
|
-
this.branch.apply(rebased.newSourceHead);
|
|
558
|
+
this.branch.apply(rebased.newSourceHead, CommitKind.Default, customMetadata);
|
|
519
559
|
viewUpdate = rebased.sourceChange;
|
|
520
560
|
}
|
|
521
561
|
} else {
|
|
@@ -546,6 +586,13 @@ export class SquashingTransactionStack<
|
|
|
546
586
|
SquashingTransactionOptions<TChange, TChangeProcessingContext>
|
|
547
587
|
> = (nestedStartOptions) => {
|
|
548
588
|
postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
|
|
589
|
+
const nestedMetadataNode: MutableCustomMetadataTree = {
|
|
590
|
+
metadata: nestedStartOptions?.customMetadata,
|
|
591
|
+
children: [],
|
|
592
|
+
};
|
|
593
|
+
const metadataParent = openMetadataNode;
|
|
594
|
+
metadataParent.children.push(nestedMetadataNode);
|
|
595
|
+
openMetadataNode = nestedMetadataNode;
|
|
549
596
|
const nestedStartHead = this.activeBranch.getHead();
|
|
550
597
|
const nestedOuterOnPop = onPush?.();
|
|
551
598
|
transactionBranch.editor.enterTransaction();
|
|
@@ -553,9 +600,12 @@ export class SquashingTransactionStack<
|
|
|
553
600
|
// Invoked when a nested transaction ends
|
|
554
601
|
onPop: (result) => {
|
|
555
602
|
const nestedPostProcessor = postProcessorStack.pop();
|
|
603
|
+
openMetadataNode = metadataParent;
|
|
556
604
|
transactionBranch.editor.exitTransaction();
|
|
557
605
|
switch (result) {
|
|
558
606
|
case TransactionResult.Abort: {
|
|
607
|
+
// The aborted transaction contributed nothing; its node is necessarily the last child.
|
|
608
|
+
metadataParent.children.pop();
|
|
559
609
|
// When a transaction is aborted, roll back all the transaction's changes on the current branch
|
|
560
610
|
transactionBranch.removeAfter(nestedStartHead);
|
|
561
611
|
break;
|
|
@@ -585,6 +635,8 @@ export class SquashingTransactionStack<
|
|
|
585
635
|
transactionBranch.removeAfter(nestedStartHead);
|
|
586
636
|
transactionBranch.apply(
|
|
587
637
|
tagChange(processedSquash, transactionRevision),
|
|
638
|
+
CommitKind.Default,
|
|
639
|
+
undefined,
|
|
588
640
|
);
|
|
589
641
|
}
|
|
590
642
|
}
|
|
@@ -158,22 +158,22 @@ export interface ITreeViewConfiguration<
|
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* Property-bag configuration for {@link TreeViewConfigurationAlpha} construction.
|
|
161
|
+
* @input
|
|
161
162
|
* @alpha
|
|
162
163
|
*/
|
|
163
164
|
export interface ITreeViewConfigurationAlpha<
|
|
164
165
|
TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
|
|
165
166
|
> extends ITreeViewConfiguration<TSchema> {
|
|
166
167
|
/**
|
|
167
|
-
* Policy for generating stored schema from the view schema.
|
|
168
|
+
* Policy for generating stored schema from the view schema during staged schema upgrades.
|
|
168
169
|
*
|
|
169
170
|
* @remarks
|
|
170
|
-
* If omitted or `undefined`, defaults to {@link StagedSchemaUpgradePolicyFactory.restrictive}
|
|
171
|
-
* which does not enable any staged schema upgrades.
|
|
172
|
-
*
|
|
173
171
|
* If provided, this policy is used when generating stored schema to include in documents via
|
|
174
172
|
* `initialize` / `upgradeSchema` as well as in {@link snapshotSchemaCompatibility} to validate
|
|
175
173
|
* the compatibility of such documents.
|
|
176
174
|
*
|
|
175
|
+
* @defaultValue {@link StagedSchemaUpgradePolicyFactory.restrictive}
|
|
176
|
+
*
|
|
177
177
|
* @example Enabling specific staged upgrades
|
|
178
178
|
* ```typescript
|
|
179
179
|
* const config = new TreeViewConfigurationAlpha({
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
NodeKind,
|
|
28
28
|
normalizeAndEvaluateAnnotatedAllowedTypes,
|
|
29
29
|
type AnnotatedAllowedType,
|
|
30
|
+
type SchemaUpgrade,
|
|
30
31
|
type TreeNodeSchema,
|
|
31
32
|
} from "../core/index.js";
|
|
32
33
|
import {
|
|
@@ -48,6 +49,25 @@ import type { TreeSchema } from "../treeSchema.js";
|
|
|
48
49
|
|
|
49
50
|
import { tryStoredSchemaAsArray } from "./customTree.js";
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Collects upgrade location data during a schema walk.
|
|
54
|
+
* @remarks Called for each staged type or staged optional field encountered.
|
|
55
|
+
*/
|
|
56
|
+
export interface UpgradeLocationCollector {
|
|
57
|
+
/**
|
|
58
|
+
* Record a staged allowed type location.
|
|
59
|
+
* @param upgrade - The upgrade token guarding this type.
|
|
60
|
+
* @param isEnabled - Whether this type is present in stored schema.
|
|
61
|
+
*/
|
|
62
|
+
allowedType(upgrade: SchemaUpgrade, isEnabled: boolean): void;
|
|
63
|
+
/**
|
|
64
|
+
* Record a staged optional field location.
|
|
65
|
+
* @param upgrade - The upgrade token guarding this field.
|
|
66
|
+
* @param isEnabled - Whether the stored field is already optional.
|
|
67
|
+
*/
|
|
68
|
+
optionalField(upgrade: SchemaUpgrade, isEnabled: boolean): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
/**
|
|
52
72
|
* Discriminated union (keyed on `mismatch`) of discrepancies between a view and stored schema which
|
|
53
73
|
* make it possible for content matching the stored schema to be incompatible with the view schema.
|
|
@@ -79,6 +99,11 @@ export interface FieldDiscrepancyLocation {
|
|
|
79
99
|
* - the discrepancy is for 'all fields' of a map node
|
|
80
100
|
*/
|
|
81
101
|
readonly fieldKey: FieldKey | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the view field is a staged optional field.
|
|
104
|
+
* Omitted when false.
|
|
105
|
+
*/
|
|
106
|
+
readonly viewIsStagedOptional?: true;
|
|
82
107
|
}
|
|
83
108
|
|
|
84
109
|
/**
|
|
@@ -94,6 +119,13 @@ export interface AllowedTypeDiscrepancy extends FieldDiscrepancyLocation {
|
|
|
94
119
|
* (excluding {@link SchemaStaticsBeta.staged | staged} schema) which are not allowed in stored schema.
|
|
95
120
|
*/
|
|
96
121
|
readonly view: readonly AnnotatedAllowedType<TreeNodeSchema>[];
|
|
122
|
+
/**
|
|
123
|
+
* Staged allowed types in the view schema which are not allowed in stored schema.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* These types do not cause the discrepancy and are omitted when there are none.
|
|
127
|
+
*/
|
|
128
|
+
readonly stagedView?: readonly AnnotatedAllowedType<TreeNodeSchema>[];
|
|
97
129
|
/**
|
|
98
130
|
* Allowed type identifiers in stored schema which are not allowed in view schema
|
|
99
131
|
* (including the view schema's {@link SchemaStaticsBeta.staged | staged} schema).
|
|
@@ -174,15 +206,25 @@ function doesNodeKindMatchStoredNodeKind(
|
|
|
174
206
|
|
|
175
207
|
/**
|
|
176
208
|
* Finds and reports discrepancies between a view schema and a stored schema which make "canView" false.
|
|
209
|
+
*
|
|
210
|
+
* Optionally collects upgrade location information for staged schema upgrades during the same walk.
|
|
211
|
+
*
|
|
177
212
|
* @remarks
|
|
178
213
|
* See documentation on {@link Discrepancy} and its subtypes for details of possible discrepancies.
|
|
179
214
|
*/
|
|
180
215
|
export function* getDiscrepanciesInAllowedContent(
|
|
181
216
|
view: TreeSchema,
|
|
182
217
|
stored: TreeStoredSchema,
|
|
218
|
+
upgradeCollector?: UpgradeLocationCollector,
|
|
183
219
|
): Iterable<Discrepancy> {
|
|
184
220
|
// check root field discrepancies
|
|
185
|
-
yield* getFieldDiscrepancies(
|
|
221
|
+
yield* getFieldDiscrepancies(
|
|
222
|
+
view.root,
|
|
223
|
+
stored.rootFieldSchema,
|
|
224
|
+
undefined,
|
|
225
|
+
undefined,
|
|
226
|
+
upgradeCollector,
|
|
227
|
+
);
|
|
186
228
|
|
|
187
229
|
// Check all of the stored nodes, including their fields for discrepancies.
|
|
188
230
|
for (const [identifier, storedSchema] of stored.nodeSchema) {
|
|
@@ -190,7 +232,7 @@ export function* getDiscrepanciesInAllowedContent(
|
|
|
190
232
|
|
|
191
233
|
// if the view schema has a node that's also in the stored schema, check it.
|
|
192
234
|
if (viewSchema !== undefined) {
|
|
193
|
-
yield* getNodeDiscrepancies(identifier, viewSchema, storedSchema);
|
|
235
|
+
yield* getNodeDiscrepancies(identifier, viewSchema, storedSchema, upgradeCollector);
|
|
194
236
|
}
|
|
195
237
|
// Note that nodes that are missing in the view schema are only a problem if other stored schema nodes actually reference them which will produce its own discrepancy, so we can rely on that to produce any needed discrepancies.
|
|
196
238
|
}
|
|
@@ -200,6 +242,7 @@ function* getNodeDiscrepancies(
|
|
|
200
242
|
identifier: TreeNodeSchemaIdentifier,
|
|
201
243
|
view: TreeNodeSchema,
|
|
202
244
|
stored: TreeNodeStoredSchema,
|
|
245
|
+
upgradeCollector?: UpgradeLocationCollector,
|
|
203
246
|
): Iterable<Discrepancy> {
|
|
204
247
|
if (!doesNodeKindMatchStoredNodeKind(view.kind, getStoredNodeSchemaType(stored))) {
|
|
205
248
|
yield {
|
|
@@ -221,6 +264,7 @@ function* getNodeDiscrepancies(
|
|
|
221
264
|
identifier,
|
|
222
265
|
view,
|
|
223
266
|
stored as ObjectNodeStoredSchema,
|
|
267
|
+
upgradeCollector,
|
|
224
268
|
);
|
|
225
269
|
break;
|
|
226
270
|
}
|
|
@@ -246,6 +290,8 @@ function* getNodeDiscrepancies(
|
|
|
246
290
|
arrayStoredSchema,
|
|
247
291
|
brand(view.identifier),
|
|
248
292
|
EmptyKey,
|
|
293
|
+
false,
|
|
294
|
+
upgradeCollector,
|
|
249
295
|
);
|
|
250
296
|
|
|
251
297
|
break;
|
|
@@ -261,6 +307,7 @@ function* getNodeDiscrepancies(
|
|
|
261
307
|
(stored as MapNodeStoredSchema).mapFields,
|
|
262
308
|
identifier,
|
|
263
309
|
undefined,
|
|
310
|
+
upgradeCollector,
|
|
264
311
|
);
|
|
265
312
|
break;
|
|
266
313
|
}
|
|
@@ -275,6 +322,7 @@ function* getNodeDiscrepancies(
|
|
|
275
322
|
(stored as MapNodeStoredSchema).mapFields,
|
|
276
323
|
identifier,
|
|
277
324
|
undefined,
|
|
325
|
+
upgradeCollector,
|
|
278
326
|
);
|
|
279
327
|
break;
|
|
280
328
|
}
|
|
@@ -308,7 +356,7 @@ function* getNodeDiscrepancies(
|
|
|
308
356
|
export function findExtraAllowedTypes(
|
|
309
357
|
viewAllowedTypes: readonly AnnotatedAllowedType<TreeNodeSchema>[],
|
|
310
358
|
storedAllowedTypes: TreeTypeSet,
|
|
311
|
-
): Pick<AllowedTypeDiscrepancy, "view" | "stored"> {
|
|
359
|
+
): Pick<AllowedTypeDiscrepancy, "view" | "stagedView" | "stored"> {
|
|
312
360
|
const viewNodeSchemaIdentifiers = new Set(
|
|
313
361
|
viewAllowedTypes.map((value) => value.type.identifier),
|
|
314
362
|
);
|
|
@@ -322,10 +370,19 @@ export function findExtraAllowedTypes(
|
|
|
322
370
|
!storedAllowedTypes.has(brand(value.type.identifier)) &&
|
|
323
371
|
value.metadata.stagedSchemaUpgrade === undefined,
|
|
324
372
|
);
|
|
373
|
+
const stagedView = viewAllowedTypes.filter(
|
|
374
|
+
(value) =>
|
|
375
|
+
!storedAllowedTypes.has(brand(value.type.identifier)) &&
|
|
376
|
+
value.metadata.stagedSchemaUpgrade !== undefined,
|
|
377
|
+
);
|
|
325
378
|
const stored = [...storedAllowedTypes].filter(
|
|
326
379
|
(value) => !viewNodeSchemaIdentifiers.has(value),
|
|
327
380
|
);
|
|
328
|
-
return {
|
|
381
|
+
return {
|
|
382
|
+
view,
|
|
383
|
+
...(stagedView.length === 0 ? {} : { stagedView }),
|
|
384
|
+
stored,
|
|
385
|
+
};
|
|
329
386
|
}
|
|
330
387
|
|
|
331
388
|
/**
|
|
@@ -346,16 +403,28 @@ function* getFieldDiscrepancies(
|
|
|
346
403
|
stored: TreeFieldStoredSchema,
|
|
347
404
|
identifier: TreeNodeSchemaIdentifier | undefined,
|
|
348
405
|
fieldKey: FieldKey | undefined,
|
|
406
|
+
upgradeCollector?: UpgradeLocationCollector,
|
|
349
407
|
): Iterable<FieldDiscrepancy> {
|
|
350
408
|
assert(
|
|
351
409
|
view instanceof FieldSchemaAlpha,
|
|
352
410
|
0xbee /* all field schema should be FieldSchemaAlpha */,
|
|
353
411
|
);
|
|
412
|
+
|
|
413
|
+
// Collect staged-optional upgrade location if present.
|
|
414
|
+
if (upgradeCollector !== undefined && view.isStagedOptional !== false) {
|
|
415
|
+
upgradeCollector.optionalField(
|
|
416
|
+
view.isStagedOptional,
|
|
417
|
+
stored.kind === FieldKinds.optional.identifier,
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
|
|
354
421
|
yield* getAllowedTypeDiscrepancies(
|
|
355
422
|
view.allowedTypesFull.evaluate().types,
|
|
356
423
|
stored.types,
|
|
357
424
|
identifier,
|
|
358
425
|
fieldKey,
|
|
426
|
+
view.isStagedOptional !== false,
|
|
427
|
+
upgradeCollector,
|
|
359
428
|
);
|
|
360
429
|
|
|
361
430
|
const viewKind =
|
|
@@ -375,6 +444,7 @@ function* getFieldDiscrepancies(
|
|
|
375
444
|
mismatch: "fieldKind",
|
|
376
445
|
view: viewKind.identifier,
|
|
377
446
|
stored: stored.kind,
|
|
447
|
+
...(view.isStagedOptional === false ? {} : { viewIsStagedOptional: true }),
|
|
378
448
|
} satisfies FieldKindDiscrepancy;
|
|
379
449
|
}
|
|
380
450
|
}
|
|
@@ -396,7 +466,21 @@ function* getAllowedTypeDiscrepancies(
|
|
|
396
466
|
stored: TreeTypeSet,
|
|
397
467
|
identifier: TreeNodeSchemaIdentifier | undefined,
|
|
398
468
|
fieldKey: FieldKey | undefined,
|
|
469
|
+
viewIsStagedOptional: boolean,
|
|
470
|
+
upgradeCollector?: UpgradeLocationCollector,
|
|
399
471
|
): Iterable<FieldDiscrepancy> {
|
|
472
|
+
// Collect staged allowed type upgrade locations if present.
|
|
473
|
+
if (upgradeCollector !== undefined) {
|
|
474
|
+
for (const allowedType of view) {
|
|
475
|
+
if (allowedType.metadata.stagedSchemaUpgrade !== undefined) {
|
|
476
|
+
upgradeCollector.allowedType(
|
|
477
|
+
allowedType.metadata.stagedSchemaUpgrade,
|
|
478
|
+
stored.has(brand(allowedType.type.identifier)),
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
400
484
|
const discrepancies = findExtraAllowedTypes(view, stored);
|
|
401
485
|
if (discrepancies.view.length > 0 || discrepancies.stored.length > 0) {
|
|
402
486
|
yield {
|
|
@@ -404,6 +488,7 @@ function* getAllowedTypeDiscrepancies(
|
|
|
404
488
|
identifier,
|
|
405
489
|
fieldKey,
|
|
406
490
|
mismatch: "allowedTypes",
|
|
491
|
+
...(viewIsStagedOptional ? { viewIsStagedOptional: true } : {}),
|
|
407
492
|
} satisfies AllowedTypeDiscrepancy;
|
|
408
493
|
}
|
|
409
494
|
}
|
|
@@ -424,6 +509,7 @@ function* computeObjectNodeDiscrepancies(
|
|
|
424
509
|
identifier: TreeNodeSchemaIdentifier,
|
|
425
510
|
view: ObjectNodeSchemaPrivate,
|
|
426
511
|
stored: ObjectNodeStoredSchema,
|
|
512
|
+
upgradeCollector?: UpgradeLocationCollector,
|
|
427
513
|
): Iterable<FieldDiscrepancy> {
|
|
428
514
|
/**
|
|
429
515
|
* Similar to the logic used for tracking discrepancies between two node schemas, we will identify
|
|
@@ -453,9 +539,18 @@ function* computeObjectNodeDiscrepancies(
|
|
|
453
539
|
mismatch: "fieldKind",
|
|
454
540
|
view: viewKind.identifier,
|
|
455
541
|
stored: storedEmptyFieldSchema.kind,
|
|
542
|
+
...(fieldSchema instanceof FieldSchemaAlpha && fieldSchema.isStagedOptional !== false
|
|
543
|
+
? { viewIsStagedOptional: true }
|
|
544
|
+
: {}),
|
|
456
545
|
} satisfies FieldKindDiscrepancy;
|
|
457
546
|
} else {
|
|
458
|
-
yield* getFieldDiscrepancies(
|
|
547
|
+
yield* getFieldDiscrepancies(
|
|
548
|
+
fieldSchema,
|
|
549
|
+
storedSchema,
|
|
550
|
+
identifier,
|
|
551
|
+
fieldKey,
|
|
552
|
+
upgradeCollector,
|
|
553
|
+
);
|
|
459
554
|
}
|
|
460
555
|
}
|
|
461
556
|
|
|
@@ -13,16 +13,23 @@ export {
|
|
|
13
13
|
TreeViewConfigurationAlpha,
|
|
14
14
|
} from "./configuration.js";
|
|
15
15
|
export type {
|
|
16
|
+
CommitRevision,
|
|
16
17
|
ITree,
|
|
17
18
|
TreeView,
|
|
18
19
|
ViewableTree,
|
|
19
20
|
TreeViewEvents,
|
|
20
21
|
SchemaCompatibilityStatus,
|
|
22
|
+
SchemaCompatibilityStatusBeta,
|
|
23
|
+
SchemaDiscrepancy,
|
|
21
24
|
TreeViewAlpha,
|
|
22
25
|
TreeViewBeta,
|
|
26
|
+
UntypedTreeView,
|
|
23
27
|
TreeBranch,
|
|
24
28
|
TreeBranchAlpha,
|
|
29
|
+
UntypedTreeViewAlpha,
|
|
25
30
|
TreeBranchEvents,
|
|
31
|
+
TreeBranchCommitMetadata,
|
|
32
|
+
TreeBranchHistory,
|
|
26
33
|
TreeContextAlpha,
|
|
27
34
|
ITreeAlpha,
|
|
28
35
|
} from "./tree.js";
|
|
@@ -100,7 +107,11 @@ export {
|
|
|
100
107
|
export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
|
|
101
108
|
export { getJsonSchema } from "./getJsonSchema.js";
|
|
102
109
|
export { getSimpleSchema } from "./getSimpleSchema.js";
|
|
103
|
-
export {
|
|
110
|
+
export {
|
|
111
|
+
checkSchemaCompatibility,
|
|
112
|
+
getSchemaIncompatibilityDetails,
|
|
113
|
+
} from "./schemaCompatibilityTester.js";
|
|
114
|
+
export { type StagedUpgradeStatus } from "./schemaCompatibilityTester.js";
|
|
104
115
|
export type {
|
|
105
116
|
Unenforced,
|
|
106
117
|
FieldSchemaAlphaUnsafe,
|