@fluidframework/tree 2.111.0 → 2.113.0-411909
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 +145 -0
- package/api-report/tree.alpha.api.md +71 -7
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.beta.api.md +1 -1
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/componentApi.d.ts +198 -0
- package/dist/componentApi.d.ts.map +1 -0
- package/dist/componentApi.js +138 -0
- package/dist/componentApi.js.map +1 -0
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +5 -2
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -16
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +39 -7
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +22 -2
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +4 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +8 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +26 -3
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.d.ts +22 -3
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +48 -5
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts +12 -0
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/filterEdits.js +111 -0
- package/dist/feature-libraries/sequence-field/filterEdits.js.map +1 -0
- package/dist/feature-libraries/sequence-field/markQueue.d.ts +8 -3
- package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js +22 -8
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +2 -6
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +7 -6
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +2 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +17 -4
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +11 -5
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +3 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +9 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +29 -14
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/serializedChange.d.ts +41 -0
- package/dist/shared-tree/serializedChange.d.ts.map +1 -0
- package/dist/shared-tree/serializedChange.js +87 -0
- package/dist/shared-tree/serializedChange.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +13 -0
- 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/sharedTreeChangeFamily.d.ts +7 -0
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts +35 -0
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/dist/shared-tree/transactionMinimize.js +65 -0
- package/dist/shared-tree/transactionMinimize.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +3 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +36 -62
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +6 -3
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +35 -14
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +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/messageFormat.d.ts +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -1
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageTypes.d.ts +1 -0
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +24 -11
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +16 -2
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +32 -2
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +3 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +13 -25
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +34 -45
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +1 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +1 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +80 -3
- 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/api/typesUnsafe.d.ts +2 -2
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +72 -6
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +25 -1
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +5 -6
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +9 -0
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +11 -27
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +25 -33
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/treeFactory.js +1 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +16 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +9 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/compressedIds.d.ts +69 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +32 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +16 -3
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/nestedSet.d.ts +1 -1
- package/dist/util/nestedSet.d.ts.map +1 -1
- package/dist/util/nestedSet.js.map +1 -1
- package/dist/util/utils.d.ts +0 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -15
- package/dist/util/utils.js.map +1 -1
- package/docs/main/runtime-schema-upgrade.md +208 -0
- package/lib/componentApi.d.ts +198 -0
- package/lib/componentApi.d.ts.map +1 -0
- package/lib/componentApi.js +135 -0
- package/lib/componentApi.js.map +1 -0
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -17
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +39 -7
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +21 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +2 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +9 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +27 -4
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/schemaChecker.d.ts +22 -3
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +48 -5
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts +12 -0
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/filterEdits.js +107 -0
- package/lib/feature-libraries/sequence-field/filterEdits.js.map +1 -0
- package/lib/feature-libraries/sequence-field/markQueue.d.ts +8 -3
- package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js +22 -9
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +2 -6
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +7 -6
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +2 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +17 -4
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +9 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -0
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +9 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +31 -16
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/serializedChange.d.ts +41 -0
- package/lib/shared-tree/serializedChange.d.ts.map +1 -0
- package/lib/shared-tree/serializedChange.js +84 -0
- package/lib/shared-tree/serializedChange.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +13 -0
- 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/sharedTreeChangeFamily.d.ts +7 -0
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts +35 -0
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
- package/lib/shared-tree/transactionMinimize.js +62 -0
- package/lib/shared-tree/transactionMinimize.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +3 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +18 -44
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +6 -3
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +36 -15
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +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/messageFormat.d.ts +1 -1
- package/lib/shared-tree-core/messageFormat.js +1 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageTypes.d.ts +1 -0
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +25 -12
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +16 -2
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +32 -2
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +4 -2
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -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 +13 -25
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +32 -43
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -3
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -3
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +80 -3
- 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/api/typesUnsafe.d.ts +2 -2
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +72 -6
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +24 -0
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -3
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +9 -0
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +11 -27
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +24 -33
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/treeFactory.js +1 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +16 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +9 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.d.ts +69 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +30 -0
- package/lib/util/compressedIds.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +17 -4
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/nestedSet.d.ts +1 -1
- package/lib/util/nestedSet.d.ts.map +1 -1
- package/lib/util/nestedSet.js.map +1 -1
- package/lib/util/utils.d.ts +0 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -13
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/componentApi.ts +354 -0
- package/src/entrypoints/alpha.ts +6 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -27
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -44
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/index.ts +2 -0
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +51 -7
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +5 -2
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +16 -1
- package/src/feature-libraries/optional-field/optionalField.ts +43 -3
- package/src/feature-libraries/schemaChecker.ts +86 -9
- package/src/feature-libraries/sequence-field/filterEdits.ts +143 -0
- package/src/feature-libraries/sequence-field/markQueue.ts +28 -11
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -7
- package/src/feature-libraries/sequence-field/sequenceFieldChangeRebaser.ts +3 -5
- package/src/index.ts +6 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +35 -5
- package/src/shared-tree/index.ts +3 -0
- package/src/shared-tree/schematizingTreeView.ts +52 -20
- package/src/shared-tree/serializedChange.ts +127 -0
- package/src/shared-tree/sharedTree.ts +16 -0
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
- package/src/shared-tree/transactionMinimize.ts +74 -0
- package/src/shared-tree/treeCheckout.ts +42 -57
- package/src/shared-tree-core/editManager.ts +42 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
- package/src/shared-tree-core/messageFormat.ts +1 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
- package/src/shared-tree-core/messageTypes.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +33 -10
- package/src/shared-tree-core/transaction.ts +19 -2
- package/src/simple-tree/api/configuration.ts +40 -2
- package/src/simple-tree/api/index.ts +2 -1
- package/src/simple-tree/api/schemaCompatibilityTester.ts +41 -49
- package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
- package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -3
- package/src/simple-tree/api/storedSchema.ts +2 -3
- package/src/simple-tree/api/tree.ts +82 -3
- package/src/simple-tree/api/typesUnsafe.ts +2 -1
- package/src/simple-tree/core/index.ts +2 -1
- package/src/simple-tree/core/toStored.ts +95 -8
- package/src/simple-tree/index.ts +4 -3
- package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
- package/src/simple-tree/prepareForInsertion.ts +12 -0
- package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
- package/src/simple-tree/toStoredSchema.ts +44 -39
- package/src/treeFactory.ts +1 -1
- package/src/util/breakable.ts +8 -1
- package/src/util/compressedIds.ts +90 -2
- package/src/util/index.ts +3 -1
- package/src/util/nestedMap.ts +21 -4
- package/src/util/nestedSet.ts +1 -1
- package/src/util/utils.ts +0 -18
|
@@ -464,6 +464,17 @@ export class SquashingTransactionStack<
|
|
|
464
464
|
const change =
|
|
465
465
|
postProcessor === undefined ? squash : postProcessor.processChange(squash);
|
|
466
466
|
|
|
467
|
+
if (change !== squash) {
|
|
468
|
+
// The post-processor produced a change that differs from the
|
|
469
|
+
// one that was applied to the view as the transaction's edits
|
|
470
|
+
// were made. Roll back the transaction's changes on the transaction
|
|
471
|
+
// branch (which rolls back the view) and apply the post-processed
|
|
472
|
+
// change in their place so that the view fully reflects the modified
|
|
473
|
+
// `change`.
|
|
474
|
+
transactionBranch.removeAfter(startHead);
|
|
475
|
+
transactionBranch.apply(tagChange(change, transactionRevision));
|
|
476
|
+
}
|
|
477
|
+
|
|
467
478
|
if (targetPath.length === 0) {
|
|
468
479
|
// No changes were made on the original branch since the transaction began
|
|
469
480
|
// The transaction commit can be applied directly
|
|
@@ -548,8 +559,14 @@ export class SquashingTransactionStack<
|
|
|
548
559
|
);
|
|
549
560
|
const squash = rebaser.compose(nestedSteps);
|
|
550
561
|
const processedSquash = nestedPostProcessor.processChange(squash);
|
|
551
|
-
|
|
552
|
-
|
|
562
|
+
// Roll back the transaction branch to the nested start head and apply the
|
|
563
|
+
// processed change if it differs from the original change.
|
|
564
|
+
if (processedSquash !== squash) {
|
|
565
|
+
transactionBranch.removeAfter(nestedStartHead);
|
|
566
|
+
transactionBranch.apply(
|
|
567
|
+
tagChange(processedSquash, transactionRevision),
|
|
568
|
+
);
|
|
569
|
+
}
|
|
553
570
|
}
|
|
554
571
|
}
|
|
555
572
|
break;
|
|
@@ -11,6 +11,7 @@ import type { MakeNominal } from "../../util/index.js";
|
|
|
11
11
|
import {
|
|
12
12
|
type AllowedTypesFullEvaluated,
|
|
13
13
|
NodeKind,
|
|
14
|
+
StagedSchemaUpgradePolicy,
|
|
14
15
|
type TreeNodeSchema,
|
|
15
16
|
} from "../core/index.js";
|
|
16
17
|
import { type FieldSchemaAlpha, type ImplicitFieldSchema, FieldKind } from "../fieldSchema.js";
|
|
@@ -155,6 +156,35 @@ export interface ITreeViewConfiguration<
|
|
|
155
156
|
readonly schema: TSchema;
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Property-bag configuration for {@link TreeViewConfigurationAlpha} construction.
|
|
161
|
+
* @alpha
|
|
162
|
+
*/
|
|
163
|
+
export interface ITreeViewConfigurationAlpha<
|
|
164
|
+
TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
|
|
165
|
+
> extends ITreeViewConfiguration<TSchema> {
|
|
166
|
+
/**
|
|
167
|
+
* Policy for generating stored schema from the view schema.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* If omitted or `undefined`, defaults to {@link StagedSchemaUpgradePolicyFactory.restrictive}
|
|
171
|
+
* which does not enable any staged schema upgrades.
|
|
172
|
+
*
|
|
173
|
+
* If provided, this policy is used when generating stored schema to include in documents via
|
|
174
|
+
* `initialize` / `upgradeSchema` as well as in {@link snapshotSchemaCompatibility} to validate
|
|
175
|
+
* the compatibility of such documents.
|
|
176
|
+
*
|
|
177
|
+
* @example Enabling specific staged upgrades
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const config = new TreeViewConfigurationAlpha({
|
|
180
|
+
* schema: MySchema,
|
|
181
|
+
* stagedUpgradePolicy: StagedSchemaUpgradePolicy.enabledStagedUpgrades(myUpgrade),
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
readonly stagedUpgradePolicy?: StagedSchemaUpgradePolicy;
|
|
186
|
+
}
|
|
187
|
+
|
|
158
188
|
/**
|
|
159
189
|
* Configuration for {@link ViewableTree.viewWith}.
|
|
160
190
|
* @sealed @public
|
|
@@ -252,14 +282,22 @@ export class TreeViewConfigurationAlpha<
|
|
|
252
282
|
SimpleNodeSchema<SchemaType.View> & TreeNodeSchema
|
|
253
283
|
>;
|
|
254
284
|
|
|
255
|
-
|
|
285
|
+
/**
|
|
286
|
+
* {@inheritDoc ITreeViewConfigurationAlpha.stagedUpgradePolicy}
|
|
287
|
+
*/
|
|
288
|
+
public readonly stagedUpgradePolicy: StagedSchemaUpgradePolicy;
|
|
289
|
+
|
|
290
|
+
public constructor(props: ITreeViewConfigurationAlpha<TSchema>) {
|
|
256
291
|
super(props);
|
|
257
292
|
const treeSchema = createTreeSchema(this.schema);
|
|
258
293
|
this.root = treeSchema.root;
|
|
259
294
|
this.definitions = treeSchema.definitions;
|
|
260
295
|
|
|
296
|
+
this.stagedUpgradePolicy =
|
|
297
|
+
props.stagedUpgradePolicy ?? StagedSchemaUpgradePolicy.restrictive;
|
|
298
|
+
|
|
261
299
|
// Eagerly perform these conversions to surface errors sooner.
|
|
262
|
-
toInitialSchema(this.root);
|
|
300
|
+
toInitialSchema(this.root, this.stagedUpgradePolicy);
|
|
263
301
|
transformSimpleSchema(treeSchema, toUnhydratedSchema);
|
|
264
302
|
}
|
|
265
303
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export type {
|
|
7
7
|
ITreeViewConfiguration,
|
|
8
8
|
ITreeConfigurationOptions,
|
|
9
|
+
ITreeViewConfigurationAlpha,
|
|
9
10
|
} from "./configuration.js";
|
|
10
11
|
export {
|
|
11
12
|
TreeViewConfiguration,
|
|
@@ -100,7 +101,7 @@ export {
|
|
|
100
101
|
export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
|
|
101
102
|
export { getJsonSchema } from "./getJsonSchema.js";
|
|
102
103
|
export { getSimpleSchema } from "./getSimpleSchema.js";
|
|
103
|
-
export {
|
|
104
|
+
export { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
|
|
104
105
|
export type {
|
|
105
106
|
Unenforced,
|
|
106
107
|
FieldSchemaAlphaUnsafe,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { TreeStoredSchema } from "../../core/index.js";
|
|
7
|
+
import type { SchemaUpgrade, StagedSchemaUpgradePolicy } from "../core/index.js";
|
|
7
8
|
import { allowsRepoSuperset, defaultSchemaPolicy } from "../../feature-libraries/index.js";
|
|
8
9
|
import { toUpgradeSchema } from "../toStoredSchema.js";
|
|
9
10
|
import type { TreeSchema } from "../treeSchema.js";
|
|
@@ -12,58 +13,49 @@ import { getDiscrepanciesInAllowedContent } from "./discrepancies.js";
|
|
|
12
13
|
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Determines the compatibility of a stored document (based on its stored schema) with a viewer (based on its view schema).
|
|
17
|
+
*
|
|
18
|
+
* Adapters can be provided to handle differences between the two schema.
|
|
19
|
+
* Adapters should only use to types in the `view` SchemaRepository.
|
|
20
|
+
*
|
|
21
|
+
* TODO: this API violates the parse don't validate design philosophy.
|
|
22
|
+
* It should be wrapped with (or replaced by) a parse style API.
|
|
23
|
+
*
|
|
24
|
+
* @param viewSchema - Schema for the view
|
|
25
|
+
* @param stored - The stored schema to check compatibility against
|
|
26
|
+
* @param stagedSchemaUpgrades - Staged schema upgrades enabled for this view, or explicit stored-schema generation options
|
|
18
27
|
*/
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
public checkCompatibility(
|
|
38
|
-
stored: TreeStoredSchema,
|
|
39
|
-
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
40
|
-
// The public API surface assumes defaultSchemaPolicy
|
|
41
|
-
const policy = defaultSchemaPolicy;
|
|
42
|
-
|
|
43
|
-
// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
|
|
44
|
-
// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
|
|
45
|
-
// In the future, this would also include things like:
|
|
46
|
-
// - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
|
|
47
|
-
let canView = true;
|
|
48
|
-
|
|
49
|
-
for (const _discrepancy of getDiscrepanciesInAllowedContent(this.viewSchema, stored)) {
|
|
50
|
-
canView = false;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
28
|
+
export function checkSchemaCompatibility(
|
|
29
|
+
viewSchema: TreeSchema,
|
|
30
|
+
stored: TreeStoredSchema,
|
|
31
|
+
stagedSchemaUpgrades?: Iterable<SchemaUpgrade> | StagedSchemaUpgradePolicy,
|
|
32
|
+
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
33
|
+
// The public API surface assumes defaultSchemaPolicy
|
|
34
|
+
const policy = defaultSchemaPolicy;
|
|
35
|
+
|
|
36
|
+
// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
|
|
37
|
+
// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
|
|
38
|
+
// In the future, this would also include things like:
|
|
39
|
+
// - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
|
|
40
|
+
let canView = true;
|
|
41
|
+
|
|
42
|
+
for (const _discrepancy of getDiscrepanciesInAllowedContent(viewSchema, stored)) {
|
|
43
|
+
canView = false;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
53
46
|
|
|
54
|
-
|
|
47
|
+
const wouldUpgradeTo = toUpgradeSchema(viewSchema.root, stagedSchemaUpgrades);
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
const canUpgrade = allowsRepoSuperset(policy, stored, wouldUpgradeTo);
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
// If true, then upgrading has no effect on what can be stored in the document.
|
|
52
|
+
// TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.
|
|
53
|
+
const isEquivalent =
|
|
54
|
+
canView && canUpgrade && allowsRepoSuperset(policy, wouldUpgradeTo, stored);
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
56
|
+
return {
|
|
57
|
+
canView,
|
|
58
|
+
canUpgrade,
|
|
59
|
+
isEquivalent,
|
|
60
|
+
};
|
|
69
61
|
}
|
|
@@ -80,6 +80,8 @@ import type {
|
|
|
80
80
|
* Values should be preferred over generator functions when possible, as they are simpler and more efficient.
|
|
81
81
|
* Generator functions should be used when the default value needs to be dynamic or when it is not possible to provide a value directly.
|
|
82
82
|
*
|
|
83
|
+
* See {@link SchemaStaticsAlpha.withDefault} for the primary API that uses this type.
|
|
84
|
+
*
|
|
83
85
|
* @example
|
|
84
86
|
* ```typescript
|
|
85
87
|
* // Provide a value directly
|
|
@@ -102,27 +104,63 @@ export type NodeProvider<T> = T | (() => T);
|
|
|
102
104
|
*/
|
|
103
105
|
export interface SchemaStaticsAlpha {
|
|
104
106
|
/**
|
|
105
|
-
* Creates a field schema with a default value.
|
|
106
|
-
*
|
|
107
|
+
* Creates a field schema with a default value.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Fields with defaults are optional in constructors, allowing them to be omitted when creating new nodes.
|
|
111
|
+
* This works with both {@link SchemaStatics.required | required} and {@link SchemaStatics.optional | optional} fields:
|
|
112
|
+
*
|
|
113
|
+
* - **Required fields with defaults**: The field is always present in the tree, but can be omitted from the constructor.
|
|
114
|
+
* The default value is used when the field is not provided.
|
|
115
|
+
*
|
|
116
|
+
* - **Optional fields with defaults**: Optional fields already default to `undefined`, but `withDefault` lets you
|
|
117
|
+
* specify a different default value.
|
|
118
|
+
*
|
|
119
|
+
* The default value can be provided in two ways (see {@link NodeProvider}):
|
|
120
|
+
*
|
|
121
|
+
* 1. **A value**: The value is deep-copied for each use, ensuring independence between instances.
|
|
122
|
+
* Prefer this when the default is a fixed value.
|
|
123
|
+
*
|
|
124
|
+
* 2. **A generator function**: A function called each time a default is needed. Use this for dynamic defaults
|
|
125
|
+
* (e.g., timestamps, UUIDs) or when explicit control over value creation is required.
|
|
126
|
+
*
|
|
127
|
+
* Defaults are evaluated eagerly during node construction.
|
|
128
|
+
*
|
|
129
|
+
* For recursive schemas, use {@link SchemaStaticsAlpha.withDefaultRecursive} instead.
|
|
130
|
+
*
|
|
131
|
+
* See the {@link https://fluidframework.com/docs/data-structures/tree/schema-definition/default-field-values | Default Field Values documentation}
|
|
132
|
+
* for a comprehensive guide with additional examples.
|
|
107
133
|
*
|
|
108
134
|
* @param fieldSchema - The field schema to add a default to (e.g., `factory.required(factory.string)` or `factory.optional(factory.number)`)
|
|
109
135
|
* @param defaultValue - A {@link NodeProvider} specifying the default value.
|
|
110
136
|
*
|
|
111
137
|
* @example
|
|
138
|
+
* A schema with a mix of required, defaulted, and dynamic fields:
|
|
112
139
|
* ```typescript
|
|
113
|
-
* const
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* //
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
140
|
+
* const factory = new SchemaFactoryAlpha("example");
|
|
141
|
+
*
|
|
142
|
+
* class Task extends factory.objectAlpha("Task", {
|
|
143
|
+
* // No default — must always be provided in the constructor
|
|
144
|
+
* title: factory.required(factory.string),
|
|
145
|
+
*
|
|
146
|
+
* // Required field with a static default
|
|
147
|
+
* status: factory.withDefault(factory.required(factory.string), "todo"),
|
|
148
|
+
*
|
|
149
|
+
* // Optional field with a custom default (instead of `undefined`)
|
|
150
|
+
* priority: factory.withDefault(factory.optional(factory.number), 0),
|
|
151
|
+
*
|
|
152
|
+
* // Dynamic default using a generator function
|
|
153
|
+
* createdAt: factory.withDefault(factory.required(factory.number), () => Date.now()),
|
|
154
|
+
* }) {}
|
|
155
|
+
*
|
|
156
|
+
* // Only `title` is required in the constructor; the rest use their defaults
|
|
157
|
+
* const task = new Task({ title: "Write docs" });
|
|
158
|
+
* // task.status === "todo"
|
|
159
|
+
* // task.priority === 0
|
|
160
|
+
* // task.createdAt is set to the current timestamp
|
|
161
|
+
*
|
|
162
|
+
* // Defaults can be overridden by providing explicit values
|
|
163
|
+
* const urgentTask = new Task({ title: "Fix bug", status: "in-progress", priority: 1 });
|
|
126
164
|
* ```
|
|
127
165
|
*
|
|
128
166
|
* @privateRemarks
|
|
@@ -208,6 +246,9 @@ export interface SchemaStaticsAlpha {
|
|
|
208
246
|
* @remarks
|
|
209
247
|
* This version of {@link SchemaStaticsAlpha.withDefault} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
210
248
|
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
249
|
+
*
|
|
250
|
+
* See the {@link https://fluidframework.com/docs/data-structures/tree/schema-definition/default-field-values#recursive-types | Default Field Values — Recursive Types documentation}
|
|
251
|
+
* for usage examples and guidance on avoiding infinite recursion with recursive defaults.
|
|
211
252
|
*/
|
|
212
253
|
withDefaultRecursive: <
|
|
213
254
|
Kind extends FieldKind,
|
|
@@ -94,9 +94,6 @@ export interface SchemaStaticsBeta {
|
|
|
94
94
|
* A full code example of the schema migration process can be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.
|
|
95
95
|
*
|
|
96
96
|
* @privateRemarks
|
|
97
|
-
* TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very
|
|
98
|
-
* user friendly and should be improved, particularly in the case of staged allowed types
|
|
99
|
-
*
|
|
100
97
|
* TODO: AB#45711: Update the docs above when recursive type support is added.
|
|
101
98
|
*/
|
|
102
99
|
readonly staged: <const T extends LazyItem<TreeNodeSchema>>(
|
|
@@ -13,7 +13,7 @@ import { toInitialSchema } from "../toStoredSchema.js";
|
|
|
13
13
|
import { createTreeSchema } from "../treeSchema.js";
|
|
14
14
|
|
|
15
15
|
import { TreeViewConfigurationAlpha, TreeViewConfiguration } from "./configuration.js";
|
|
16
|
-
import {
|
|
16
|
+
import { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
|
|
17
17
|
import { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
|
|
18
18
|
import {
|
|
19
19
|
decodeSchemaCompatibilitySnapshot,
|
|
@@ -78,8 +78,7 @@ export function checkCompatibility(
|
|
|
78
78
|
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
79
79
|
const viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });
|
|
80
80
|
const stored = toInitialSchema(viewWhichCreatedStoredSchema.schema);
|
|
81
|
-
|
|
82
|
-
return tester.checkCompatibility(stored);
|
|
81
|
+
return checkSchemaCompatibility(viewAsAlpha, stored);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
/**
|
|
@@ -13,7 +13,7 @@ import { normalizeFieldSchema, type ImplicitFieldSchema } from "../fieldSchema.j
|
|
|
13
13
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
14
14
|
|
|
15
15
|
import { TreeViewConfigurationAlpha } from "./configuration.js";
|
|
16
|
-
import {
|
|
16
|
+
import { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
|
|
17
17
|
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -104,6 +104,5 @@ export function comparePersistedSchema(
|
|
|
104
104
|
const config = new TreeViewConfigurationAlpha({
|
|
105
105
|
schema: normalizeFieldSchema(view),
|
|
106
106
|
});
|
|
107
|
-
|
|
108
|
-
return viewSchema.checkCompatibility(stored);
|
|
107
|
+
return checkSchemaCompatibility(config, stored);
|
|
109
108
|
}
|
|
@@ -112,8 +112,20 @@ export interface ITreeAlpha extends ITree {
|
|
|
112
112
|
/**
|
|
113
113
|
* Creates a fork of the current state of the main branch.
|
|
114
114
|
* This new branch will be shared with and editable by all clients.
|
|
115
|
+
* @param name - Optional name for the new branch.
|
|
116
|
+
* This name is not guaranteed to be unique.
|
|
117
|
+
* (Maximum {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length | length}: 1024)
|
|
118
|
+
* @returns The ID of the new branch, which can be used to {@link ITreeAlpha.viewSharedBranchWith | view} the branch.
|
|
115
119
|
*/
|
|
116
|
-
createSharedBranch(): string;
|
|
120
|
+
createSharedBranch(name?: string): string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the name, if any, of the shared branch with the given ID.
|
|
124
|
+
* @param branchId - The ID of the shared branch to retrieve the name of.
|
|
125
|
+
* @returns The name of the shared branch, or `undefined` if the branch has no assigned name.
|
|
126
|
+
* @throws if the branch with the given ID does not exist.
|
|
127
|
+
*/
|
|
128
|
+
getSharedBranchName(branchId: string): string | undefined;
|
|
117
129
|
|
|
118
130
|
/**
|
|
119
131
|
* Returns a list of all shared branches that currently exist on this tree.
|
|
@@ -376,6 +388,16 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
|
376
388
|
* @throws UsageError if the branches are unrelated.
|
|
377
389
|
*/
|
|
378
390
|
isMissingEditsFrom(branch: TreeBranch): boolean;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Computes the net change that would result if this branch were {@link TreeBranch.rebaseOnto | rebased onto} the given branch.
|
|
394
|
+
* Note that this method does not actually perform the rebase and therefore has no effect on this branch.
|
|
395
|
+
*
|
|
396
|
+
* @param branch - The branch that would be rebased onto.
|
|
397
|
+
* @returns The net change that would result if this branch were rebased onto the given branch,
|
|
398
|
+
* or `undefined` if rebasing would have no impact.
|
|
399
|
+
*/
|
|
400
|
+
computeNetChangeIfRebasedOnto(branch: TreeBranch): JsonCompatibleReadOnly | undefined;
|
|
379
401
|
}
|
|
380
402
|
|
|
381
403
|
/**
|
|
@@ -422,7 +444,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
422
444
|
/**
|
|
423
445
|
* Description of the current compatibility status between the view schema and stored schema.
|
|
424
446
|
* @remarks
|
|
425
|
-
* {@link TreeViewEvents.schemaChanged} is fired when the compatibility status changes.
|
|
447
|
+
* {@link TreeViewEvents.schemaChanged} is fired when the compatibility status of the document's stored schema changes.
|
|
426
448
|
* See {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution} for more guidance on how to change schema while maintaining compatibility.
|
|
427
449
|
* Use {@link snapshotSchemaCompatibility} to write tests to validate that this compatibility behaves as desired across schema changes.
|
|
428
450
|
*/
|
|
@@ -437,6 +459,44 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
437
459
|
*
|
|
438
460
|
* It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.
|
|
439
461
|
* {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.
|
|
462
|
+
*
|
|
463
|
+
* When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},
|
|
464
|
+
* staged schema upgrades matching the configured policy are included in the target stored schema.
|
|
465
|
+
* Once a staged schema upgrade has been enabled in a document's stored schema, loading that document
|
|
466
|
+
* with a view that does not include equivalent staged members in its construction-time policy will cause
|
|
467
|
+
* `upgradeSchema` to throw a `UsageError` because the requested target would narrow the stored schema.
|
|
468
|
+
*
|
|
469
|
+
* @example Enabling a staged allowed type for documents, selected by a feature flag
|
|
470
|
+
*
|
|
471
|
+
* ```typescript
|
|
472
|
+
* const sf = new SchemaFactoryBeta("my-app");
|
|
473
|
+
*
|
|
474
|
+
* class TaskItem extends sf.object("TaskItem", { title: sf.string }) {}
|
|
475
|
+
* class ChecklistItem extends sf.object("ChecklistItem", { text: sf.string }) {}
|
|
476
|
+
*
|
|
477
|
+
* // `staged` wraps ChecklistItem so it can be enabled at runtime.
|
|
478
|
+
* const stagedChecklist = SchemaFactoryBeta.staged(ChecklistItem);
|
|
479
|
+
* const checklistUpgrade = stagedChecklist.metadata.stagedSchemaUpgrade;
|
|
480
|
+
*
|
|
481
|
+
* class AppSchema extends sf.object("AppSchema", {
|
|
482
|
+
* items: sf.array([TaskItem, stagedChecklist]),
|
|
483
|
+
* }) {}
|
|
484
|
+
*
|
|
485
|
+
* // Feature flag controls whether the upgrade is enabled for this session.
|
|
486
|
+
* const policy = featureFlags.enableChecklist
|
|
487
|
+
* ? StagedSchemaUpgradePolicy.enabledStagedUpgrades(checklistUpgrade)
|
|
488
|
+
* : undefined;
|
|
489
|
+
*
|
|
490
|
+
* const view = tree.viewWith(
|
|
491
|
+
* new TreeViewConfigurationAlpha({ schema: AppSchema, stagedUpgradePolicy: policy }),
|
|
492
|
+
* );
|
|
493
|
+
*
|
|
494
|
+
* if (view.compatibility.canUpgrade) {
|
|
495
|
+
* // Writes the staged type into the document's stored schema.
|
|
496
|
+
* view.upgradeSchema();
|
|
497
|
+
* }
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
440
500
|
* @privateRemarks
|
|
441
501
|
* In the future, more upgrade options could be provided here.
|
|
442
502
|
* Some options that could be added:
|
|
@@ -454,8 +514,12 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
454
514
|
/**
|
|
455
515
|
* Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.
|
|
456
516
|
*
|
|
517
|
+
* @remarks
|
|
457
518
|
* Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.
|
|
458
519
|
*
|
|
520
|
+
* When using {@link TreeViewConfigurationAlpha} with a {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy},
|
|
521
|
+
* staged schema upgrades matching the configured policy are included in the initial stored schema.
|
|
522
|
+
*
|
|
459
523
|
* Applications should typically call this function before attaching a `SharedTree`.
|
|
460
524
|
* @param content - The content to initialize the tree with.
|
|
461
525
|
*/
|
|
@@ -563,6 +627,21 @@ export interface TreeViewAlpha<
|
|
|
563
627
|
|
|
564
628
|
set root(newRoot: InsertableField<TSchema>);
|
|
565
629
|
|
|
630
|
+
/**
|
|
631
|
+
* Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.
|
|
632
|
+
*
|
|
633
|
+
* @remarks
|
|
634
|
+
* Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.
|
|
635
|
+
*
|
|
636
|
+
* Enables staged schema upgrades declared by {@link ITreeViewConfigurationAlpha.stagedUpgradePolicy} when generating the initial stored schema.
|
|
637
|
+
* Once a staged schema upgrade has been enabled in a document's stored schema, loading that document
|
|
638
|
+
* with a view that does not include equivalent staged members in its construction-time policy will cause
|
|
639
|
+
* a subsequent `upgradeSchema` call to throw a `UsageError` because the stored schema already contains
|
|
640
|
+
* the upgraded members and the new target would narrow it.
|
|
641
|
+
*
|
|
642
|
+
* Applications should typically call this function before attaching a `SharedTree`.
|
|
643
|
+
* @param content - The content to initialize the tree with.
|
|
644
|
+
*/
|
|
566
645
|
initialize(content: InsertableField<TSchema>): void;
|
|
567
646
|
|
|
568
647
|
readonly events: Listenable<TreeViewEvents & TreeBranchEvents>;
|
|
@@ -578,7 +657,7 @@ export interface TreeViewAlpha<
|
|
|
578
657
|
* See SharedTree's README for more information about choosing a compatibility policy.
|
|
579
658
|
*
|
|
580
659
|
* @privateRemarks
|
|
581
|
-
* See {@link
|
|
660
|
+
* See {@link checkSchemaCompatibility} for the implementation of this compatibility checking.
|
|
582
661
|
*
|
|
583
662
|
* @sealed @public
|
|
584
663
|
*/
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
TreeLeafValue,
|
|
22
22
|
FlexListToUnion,
|
|
23
23
|
LazyItem,
|
|
24
|
+
NumberKeys,
|
|
24
25
|
AnnotatedAllowedType,
|
|
25
26
|
AnnotatedAllowedTypes,
|
|
26
27
|
} from "../core/index.js";
|
|
@@ -260,7 +261,7 @@ export namespace System_Unsafe {
|
|
|
260
261
|
>
|
|
261
262
|
? InsertableTypedNodeUnsafe<TSchema>
|
|
262
263
|
: never;
|
|
263
|
-
}[
|
|
264
|
+
}[NumberKeys<TList>];
|
|
264
265
|
|
|
265
266
|
/**
|
|
266
267
|
* {@link Unenforced} version of {@link InsertableTypedNode}.
|
|
@@ -115,7 +115,8 @@ export {
|
|
|
115
115
|
export type { SimpleNodeSchemaBase } from "./simpleNodeSchemaBase.js";
|
|
116
116
|
export {
|
|
117
117
|
type StoredSchemaGenerationOptions,
|
|
118
|
-
|
|
118
|
+
StagedSchemaUpgradePolicy,
|
|
119
|
+
type StagedSchemaUpgradePolicyFactory,
|
|
119
120
|
ExpectStored,
|
|
120
121
|
type SimpleSchemaTransformationOptions,
|
|
121
122
|
Unchanged,
|