@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
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase, oob } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type {
|
|
8
|
-
IIdCompressor,
|
|
9
8
|
OpSpaceCompressedId,
|
|
10
9
|
SessionSpaceCompressedId,
|
|
11
10
|
} from "@fluidframework/id-compressor";
|
|
@@ -17,7 +16,12 @@ import type {
|
|
|
17
16
|
Value,
|
|
18
17
|
TreeChunk,
|
|
19
18
|
} from "../../../core/index.js";
|
|
20
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
assertValidIndex,
|
|
21
|
+
brand,
|
|
22
|
+
decompressIdentifierIfNeeded,
|
|
23
|
+
type IdDecodingContext,
|
|
24
|
+
} from "../../../util/index.js";
|
|
21
25
|
import { BasicChunk } from "../basicChunk.js";
|
|
22
26
|
import { emptyChunk } from "../emptyChunk.js";
|
|
23
27
|
import { SequenceChunk } from "../sequenceChunk.js";
|
|
@@ -55,31 +59,6 @@ import {
|
|
|
55
59
|
supportsIncrementalEncoding,
|
|
56
60
|
} from "./format/index.js";
|
|
57
61
|
|
|
58
|
-
/**
|
|
59
|
-
* Context for decoding identifiers.
|
|
60
|
-
* @remarks
|
|
61
|
-
* See {@link FieldBatchDecodingContext} for the production implementation of this.
|
|
62
|
-
*
|
|
63
|
-
* This intentionally avoids exposing anything which depends on the underlying id-compressor's session ID to avoid confusion with the session ID of the compressor which encoded the data.
|
|
64
|
-
* If the session ID of the encoder which encoded the data is known, that information is baked into `resolveEncodedId`.
|
|
65
|
-
*/
|
|
66
|
-
export interface IdDecodingContext {
|
|
67
|
-
/**
|
|
68
|
-
* Compressor which can decompress session-space identifiers from {@link resolveEncodedId} as needed.
|
|
69
|
-
*/
|
|
70
|
-
readonly idCompressor: Pick<IIdCompressor, "decompress">;
|
|
71
|
-
/**
|
|
72
|
-
* Resolves an encoded op-space identifier to either a session-space ID
|
|
73
|
-
* (which {@link idCompressor} can decompress if needed)
|
|
74
|
-
* or a string (which passes through unchanged).
|
|
75
|
-
* @remarks
|
|
76
|
-
* In contexts where non-final identifiers can't be supported (where no originator session is available),
|
|
77
|
-
* if a non-final identifier is encountered, this may throw or perform a data healing workaround.
|
|
78
|
-
* See {@link FieldBatchDecodingContext.forOp} and {@link FieldBatchDecodingContext.forSummary} for details.
|
|
79
|
-
*/
|
|
80
|
-
readonly resolveEncodedId: (id: OpSpaceCompressedId) => SessionSpaceCompressedId | string;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
62
|
/**
|
|
84
63
|
* Decode `chunk` into a TreeChunk.
|
|
85
64
|
*/
|
|
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
|
|
8
8
|
import type { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
|
|
9
9
|
import type { TreeChunk } from "../../../core/index.js";
|
|
10
|
-
import type { BrandedType } from "../../../util/index.js";
|
|
10
|
+
import type { BrandedType, IdDecodingContext } from "../../../util/index.js";
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
type ChunkDecoder,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
getChecked,
|
|
16
16
|
readStream,
|
|
17
17
|
} from "./chunkCodecUtilities.js";
|
|
18
|
-
import type { IdDecodingContext } from "./chunkDecoding.js";
|
|
19
18
|
import type { IncrementalDecoder } from "./codecs.js";
|
|
20
19
|
import type { EncodedFieldBatchGeneric, IdentifierOrIndex } from "./format/index.js";
|
|
21
20
|
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import type {
|
|
8
|
-
IIdCompressor,
|
|
9
|
-
OpSpaceCompressedId,
|
|
10
|
-
SessionId,
|
|
11
|
-
SessionSpaceCompressedId,
|
|
12
|
-
} from "@fluidframework/id-compressor";
|
|
7
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
13
8
|
import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
|
|
14
9
|
import type { TSchema } from "@sinclair/typebox";
|
|
15
10
|
|
|
@@ -29,13 +24,14 @@ import {
|
|
|
29
24
|
} from "../../../core/index.js";
|
|
30
25
|
import {
|
|
31
26
|
brandedNumberType,
|
|
32
|
-
|
|
27
|
+
IdDecodingContext,
|
|
33
28
|
type Brand,
|
|
34
|
-
type
|
|
29
|
+
type IdDecoderOptionsOriginatorless,
|
|
30
|
+
type IdDecoderOptionsWithOriginator,
|
|
35
31
|
} from "../../../util/index.js";
|
|
36
32
|
import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
|
|
37
33
|
|
|
38
|
-
import { decode
|
|
34
|
+
import { decode } from "./chunkDecoding.js";
|
|
39
35
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
40
36
|
import {
|
|
41
37
|
EncodedFieldBatchV1,
|
|
@@ -148,26 +144,18 @@ export interface FieldBatchEncodingContext {
|
|
|
148
144
|
* op-style and summary-style decoding is load-bearing (different invariants
|
|
149
145
|
* apply, and bugs in this area are typically the result of conflating them).
|
|
150
146
|
*/
|
|
151
|
-
export class FieldBatchDecodingContext
|
|
147
|
+
export class FieldBatchDecodingContext extends IdDecodingContext {
|
|
152
148
|
private constructor(
|
|
153
|
-
|
|
154
|
-
* Used internally to prevent the use of this decoder in incremental chunks if it has a session id (which would be wrong in those chunks).
|
|
155
|
-
*/
|
|
156
|
-
private readonly hasOriginatorSessionId: boolean,
|
|
157
|
-
|
|
158
|
-
public readonly idCompressor: Pick<IIdCompressor, "decompress">,
|
|
159
|
-
|
|
160
|
-
public readonly resolveEncodedId: (
|
|
161
|
-
id: OpSpaceCompressedId,
|
|
162
|
-
) => SessionSpaceCompressedId | string,
|
|
163
|
-
|
|
149
|
+
private readonly options: IdDecoderOptionsOriginatorless | IdDecoderOptionsWithOriginator,
|
|
164
150
|
/**
|
|
165
151
|
* Decoder for incremental fields. Defined when the encoded batch contains
|
|
166
152
|
* incremental chunks. Only populated on summary-style contexts; op-style
|
|
167
153
|
* contexts always have this undefined.
|
|
168
154
|
*/
|
|
169
155
|
public readonly incrementalDecoder?: IncrementalDecoder,
|
|
170
|
-
) {
|
|
156
|
+
) {
|
|
157
|
+
super(options);
|
|
158
|
+
}
|
|
171
159
|
|
|
172
160
|
/**
|
|
173
161
|
* Construct a decode context for an op.
|
|
@@ -178,14 +166,8 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
|
|
|
178
166
|
* not a recoverable state, so the resolver throws rather than synthesizing
|
|
179
167
|
* a UUID. Incremental decoding is not used for ops.
|
|
180
168
|
*/
|
|
181
|
-
public static forOp(
|
|
182
|
-
|
|
183
|
-
readonly originatorId: SessionId;
|
|
184
|
-
}): FieldBatchDecodingContext {
|
|
185
|
-
const { idCompressor, originatorId } = opts;
|
|
186
|
-
return new FieldBatchDecodingContext(true, idCompressor, (id) =>
|
|
187
|
-
idCompressor.normalizeToSessionSpace(id, originatorId),
|
|
188
|
-
);
|
|
169
|
+
public static forOp(options: IdDecoderOptionsWithOriginator): FieldBatchDecodingContext {
|
|
170
|
+
return new FieldBatchDecodingContext(options);
|
|
189
171
|
}
|
|
190
172
|
|
|
191
173
|
/**
|
|
@@ -204,14 +186,10 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
|
|
|
204
186
|
* `withIncrementalDecoder` has logic to guard against cases which expect session-relative identifiers in incremental chunks,
|
|
205
187
|
* as does the encoding-side assert in the {@link EncoderContext}.
|
|
206
188
|
*/
|
|
207
|
-
public static forSummary(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const { idCompressor, healing } = opts;
|
|
212
|
-
return new FieldBatchDecodingContext(false, idCompressor, (id) =>
|
|
213
|
-
forceDecodeEncodedIdWithoutSession(id, idCompressor, healing),
|
|
214
|
-
);
|
|
189
|
+
public static forSummary(
|
|
190
|
+
options: IdDecoderOptionsOriginatorless | IdDecoderOptionsWithOriginator,
|
|
191
|
+
): FieldBatchDecodingContext {
|
|
192
|
+
return new FieldBatchDecodingContext(options);
|
|
215
193
|
}
|
|
216
194
|
|
|
217
195
|
/**
|
|
@@ -231,12 +209,7 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
|
|
|
231
209
|
!this.hasOriginatorSessionId,
|
|
232
210
|
0xd0c /* withIncrementalDecoder can only be called on contexts without an originator session ID */,
|
|
233
211
|
);
|
|
234
|
-
return new FieldBatchDecodingContext(
|
|
235
|
-
false,
|
|
236
|
-
this.idCompressor,
|
|
237
|
-
this.resolveEncodedId,
|
|
238
|
-
incrementalDecoder,
|
|
239
|
-
);
|
|
212
|
+
return new FieldBatchDecodingContext(this.options, incrementalDecoder);
|
|
240
213
|
}
|
|
241
214
|
}
|
|
242
215
|
|
|
@@ -38,7 +38,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
|
|
|
38
38
|
compose: (change1: 0, change2: 0) => 0,
|
|
39
39
|
invert: (changes: 0) => 0,
|
|
40
40
|
rebase: (change: 0, over: 0) => 0,
|
|
41
|
-
|
|
41
|
+
filterEdits: (changes: 0) => 0,
|
|
42
42
|
}),
|
|
43
43
|
codecsFactory: () => noChangeCodecFamily,
|
|
44
44
|
editor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },
|
|
@@ -93,6 +93,7 @@ export {
|
|
|
93
93
|
isNeverTree,
|
|
94
94
|
DefaultRevisionReplacer,
|
|
95
95
|
ModularChangeFormatVersion,
|
|
96
|
+
minimizeModularChangeset,
|
|
96
97
|
} from "./modular-schema/index.js";
|
|
97
98
|
|
|
98
99
|
export { mapRootChanges } from "./deltaUtils.js";
|
|
@@ -149,6 +150,7 @@ export {
|
|
|
149
150
|
|
|
150
151
|
export {
|
|
151
152
|
SchemaValidationError,
|
|
153
|
+
type SchemaValidationErrorContext,
|
|
152
154
|
isNodeInSchema,
|
|
153
155
|
isFieldInSchema,
|
|
154
156
|
throwOutOfSchema,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ICodecFamily, JsonCodecPart } from "../../codec/index.js";
|
|
7
7
|
import type {
|
|
8
|
+
ChangeAtomId,
|
|
8
9
|
ChangeEncodingContext,
|
|
9
10
|
DeltaDetachedNodeChanges,
|
|
10
11
|
DeltaDetachedNodeId,
|
|
@@ -16,7 +17,7 @@ import type {
|
|
|
16
17
|
RevisionTag,
|
|
17
18
|
RevisionTagSchema,
|
|
18
19
|
} from "../../core/index.js";
|
|
19
|
-
import type { IdAllocator, Invariant } from "../../util/index.js";
|
|
20
|
+
import type { IdAllocator, Invariant, RangeQueryResult } from "../../util/index.js";
|
|
20
21
|
|
|
21
22
|
import type { CrossFieldManager } from "./crossFieldQueries.js";
|
|
22
23
|
import type { EncodedNodeChangeset } from "./modularChangeFormatV1.js";
|
|
@@ -167,10 +168,53 @@ export interface FieldChangeRebaser<TChangeset> {
|
|
|
167
168
|
replaceRevisions(change: TChangeset, replacer: RevisionReplacer): TChangeset;
|
|
168
169
|
|
|
169
170
|
/**
|
|
170
|
-
* Returns a copy of the given changeset with
|
|
171
|
-
*
|
|
171
|
+
* Returns a copy of the given changeset with edits removed as specified.
|
|
172
|
+
* @param change - The change to filter edits from
|
|
173
|
+
* @param filterDetach - This should be called for each range of detaches in the changeset,
|
|
174
|
+
* and the detach should be preserved, removed, or converted to a non-move detach as specified.
|
|
175
|
+
* If the returned result does not cover the entire detach range, the remainder should be queried again.
|
|
176
|
+
* @param filterDetach - This should be called for each range of attaches in the changeset,
|
|
177
|
+
* and the attach should be preserved, removed, or converted to a non-move attach as specified.
|
|
178
|
+
* If the returned result does not cover the entire detach range, the remainder should be queried again.
|
|
179
|
+
* @param preserveOtherEdits - Whether edits other than attaches and detaches (e.g. root renames),
|
|
180
|
+
* should be preserved or removed.
|
|
172
181
|
*/
|
|
173
|
-
|
|
182
|
+
filterEdits(
|
|
183
|
+
change: TChangeset,
|
|
184
|
+
options: {
|
|
185
|
+
filterDetach: EditFilterFunc;
|
|
186
|
+
filterAttach: EditFilterFunc;
|
|
187
|
+
preserveOtherEdits: boolean;
|
|
188
|
+
},
|
|
189
|
+
): TChangeset;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type EditFilterFunc = (
|
|
193
|
+
id: ChangeAtomId,
|
|
194
|
+
count: number,
|
|
195
|
+
endpoint?: ChangeAtomId,
|
|
196
|
+
) => RangeQueryResult<EditFilterStatus>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Used to describe what should be done with a particular attach or detach during `filterEdits`.
|
|
200
|
+
*/
|
|
201
|
+
export enum EditFilterStatus {
|
|
202
|
+
/**
|
|
203
|
+
* The edit should be removed from the filtered changeset.
|
|
204
|
+
*/
|
|
205
|
+
Remove,
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The edit should be preserved in the filtered changeset.
|
|
209
|
+
*/
|
|
210
|
+
Preserve,
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* This should only be used for an attach or detach which is part of a move.
|
|
214
|
+
* The edit should be preserved, but should be adjusted, if necessary,
|
|
215
|
+
* to reflect that the other endpoint of the move has been filtered out.
|
|
216
|
+
*/
|
|
217
|
+
PreserveWithoutMove,
|
|
174
218
|
}
|
|
175
219
|
|
|
176
220
|
/**
|
|
@@ -181,13 +225,13 @@ export function referenceFreeFieldChangeRebaser<TChangeset>(data: {
|
|
|
181
225
|
compose: (change1: TChangeset, change2: TChangeset) => TChangeset;
|
|
182
226
|
invert: (change: TChangeset) => TChangeset;
|
|
183
227
|
rebase: (change: TChangeset, over: TChangeset) => TChangeset;
|
|
184
|
-
|
|
228
|
+
filterEdits: FieldChangeRebaser<TChangeset>["filterEdits"];
|
|
185
229
|
}): FieldChangeRebaser<TChangeset> {
|
|
186
230
|
return isolatedFieldChangeRebaser({
|
|
187
231
|
compose: (change1, change2, _composeChild, _genId) => data.compose(change1, change2),
|
|
188
232
|
invert: (change, _invertChild, _genId) => data.invert(change),
|
|
189
233
|
rebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over),
|
|
190
|
-
|
|
234
|
+
filterEdits: (change, options) => data.filterEdits(change, options),
|
|
191
235
|
});
|
|
192
236
|
}
|
|
193
237
|
|
|
@@ -195,7 +239,7 @@ export function isolatedFieldChangeRebaser<TChangeset>(data: {
|
|
|
195
239
|
compose: FieldChangeRebaser<TChangeset>["compose"];
|
|
196
240
|
invert: FieldChangeRebaser<TChangeset>["invert"];
|
|
197
241
|
rebase: FieldChangeRebaser<TChangeset>["rebase"];
|
|
198
|
-
|
|
242
|
+
filterEdits: FieldChangeRebaser<TChangeset>["filterEdits"];
|
|
199
243
|
}): FieldChangeRebaser<TChangeset> {
|
|
200
244
|
return {
|
|
201
245
|
...data,
|
|
@@ -40,7 +40,7 @@ export const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {
|
|
|
40
40
|
rebase: rebaseGenericChange,
|
|
41
41
|
prune: pruneGenericChange,
|
|
42
42
|
replaceRevisions,
|
|
43
|
-
|
|
43
|
+
filterEdits: (change: GenericChangeset): GenericChangeset => change,
|
|
44
44
|
},
|
|
45
45
|
codecsFactory: makeGenericChangeCodec,
|
|
46
46
|
editor: {
|
|
@@ -29,10 +29,14 @@ export {
|
|
|
29
29
|
export { EncodedModularChangesetV2 } from "./modularChangeFormatV2.js";
|
|
30
30
|
export { FlexFieldKind, type FullSchemaPolicy } from "./fieldKind.js";
|
|
31
31
|
export {
|
|
32
|
+
type EditFilterFunc,
|
|
33
|
+
EditFilterStatus,
|
|
32
34
|
type FieldChangeHandler,
|
|
33
35
|
type FieldChangeDelta,
|
|
36
|
+
type FieldChangeEncodingContext,
|
|
34
37
|
type FieldChangeRebaser,
|
|
35
38
|
type FieldEditor,
|
|
39
|
+
type NestedChangesIndices,
|
|
36
40
|
type NodeChangeComposer,
|
|
37
41
|
type NodeChangeInverter,
|
|
38
42
|
type NodeChangeRebaser,
|
|
@@ -42,8 +46,6 @@ export {
|
|
|
42
46
|
type RelevantRemovedRootsFromChild,
|
|
43
47
|
type ToDelta,
|
|
44
48
|
NodeAttachState,
|
|
45
|
-
type FieldChangeEncodingContext,
|
|
46
|
-
type NestedChangesIndices,
|
|
47
49
|
} from "./fieldChangeHandler.js";
|
|
48
50
|
export type {
|
|
49
51
|
CrossFieldKey,
|
|
@@ -83,3 +85,4 @@ export type {
|
|
|
83
85
|
FieldKindConfigurationEntry,
|
|
84
86
|
} from "./fieldKindConfiguration.js";
|
|
85
87
|
export { DefaultRevisionReplacer } from "./defaultRevisionReplacer.js";
|
|
88
|
+
export { minimizeModularChangeset } from "./minimizeModularChange.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FieldKindIdentifier } from "../../core/index.js";
|
|
7
|
+
|
|
8
|
+
import type { FlexFieldKind } from "./fieldKind.js";
|
|
9
|
+
import type { ModularChangeset } from "./modularChangeTypes.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* "Minimizes" a {@link ModularChangeset} so that it contains no extraneous
|
|
13
|
+
* information, i.e. no new content that isn't observable from document tree
|
|
14
|
+
* and no edits without net observed effect on the document tree.
|
|
15
|
+
* @remarks
|
|
16
|
+
* "Extraneous information" includes, for example, data for nodes that were both created and removed within the same
|
|
17
|
+
* transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering
|
|
18
|
+
* its observable effect.
|
|
19
|
+
*
|
|
20
|
+
* This is the eventual home of the minimization algorithm, colocated with {@link ModularChangeFamily} so it can use its
|
|
21
|
+
* internals. It is currently a no-op that returns the change unchanged; a real implementation will be provided in a
|
|
22
|
+
* future change.
|
|
23
|
+
*
|
|
24
|
+
* @param change - The change to minimize.
|
|
25
|
+
* @param fieldKinds - The field kinds to delegate to when computing the change's delta.
|
|
26
|
+
*/
|
|
27
|
+
export function minimizeModularChangeset(
|
|
28
|
+
change: ModularChangeset,
|
|
29
|
+
fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
30
|
+
): ModularChangeset {
|
|
31
|
+
// TODO: Actually minimize the change. For now this is a no-op that returns the change unchanged.
|
|
32
|
+
return change;
|
|
33
|
+
}
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
setInCrossFieldMap,
|
|
83
83
|
} from "./crossFieldQueries.js";
|
|
84
84
|
import {
|
|
85
|
+
EditFilterStatus,
|
|
85
86
|
type FieldChangeHandler,
|
|
86
87
|
NodeAttachState,
|
|
87
88
|
type RebaseRevisionMetadata,
|
|
@@ -1739,11 +1740,25 @@ export class ModularChangeFamily
|
|
|
1739
1740
|
const handler = getChangeHandler(this.fieldKinds, change.fieldKind);
|
|
1740
1741
|
return {
|
|
1741
1742
|
fieldKind: change.fieldKind,
|
|
1742
|
-
change: brand(
|
|
1743
|
+
change: brand(
|
|
1744
|
+
handler.rebaser.filterEdits(change.change, {
|
|
1745
|
+
filterDetach: removeAllEditsFilter,
|
|
1746
|
+
filterAttach: removeAllEditsFilter,
|
|
1747
|
+
preserveOtherEdits: false,
|
|
1748
|
+
}),
|
|
1749
|
+
),
|
|
1743
1750
|
};
|
|
1744
1751
|
}
|
|
1745
1752
|
}
|
|
1746
1753
|
|
|
1754
|
+
function removeAllEditsFilter(
|
|
1755
|
+
_id: ChangeAtomId,
|
|
1756
|
+
count: number,
|
|
1757
|
+
_endpointId?: ChangeAtomId,
|
|
1758
|
+
): RangeQueryResult<EditFilterStatus> {
|
|
1759
|
+
return { value: EditFilterStatus.Remove, length: count };
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1747
1762
|
function replaceCrossFieldKeyTableRevisions(
|
|
1748
1763
|
table: CrossFieldKeyTable,
|
|
1749
1764
|
replacer: RevisionReplacer,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
requiredIdentifier,
|
|
36
36
|
} from "../fieldKindIdentifiers.js";
|
|
37
37
|
import {
|
|
38
|
+
EditFilterStatus,
|
|
38
39
|
type FieldChangeHandler,
|
|
39
40
|
type FieldChangeRebaser,
|
|
40
41
|
type FieldEditor,
|
|
@@ -48,6 +49,7 @@ import {
|
|
|
48
49
|
type NestedChangesIndices,
|
|
49
50
|
type FieldChangeDelta,
|
|
50
51
|
FlexFieldKind,
|
|
52
|
+
type EditFilterFunc,
|
|
51
53
|
} from "../modular-schema/index.js";
|
|
52
54
|
|
|
53
55
|
import type {
|
|
@@ -466,9 +468,7 @@ export const optionalChangeRebaser: FieldChangeRebaser<OptionalChangeset> = {
|
|
|
466
468
|
return updated;
|
|
467
469
|
},
|
|
468
470
|
|
|
469
|
-
|
|
470
|
-
return { childChanges: change.childChanges, moves: [] };
|
|
471
|
-
},
|
|
471
|
+
filterEdits,
|
|
472
472
|
};
|
|
473
473
|
|
|
474
474
|
function replaceReplaceRevisions(
|
|
@@ -814,3 +814,43 @@ export const optional: Optional = new FlexFieldKind(
|
|
|
814
814
|
]),
|
|
815
815
|
},
|
|
816
816
|
);
|
|
817
|
+
|
|
818
|
+
function filterEdits(
|
|
819
|
+
change: OptionalChangeset,
|
|
820
|
+
options: {
|
|
821
|
+
filterDetach: EditFilterFunc;
|
|
822
|
+
filterAttach: EditFilterFunc;
|
|
823
|
+
preserveOtherEdits: boolean;
|
|
824
|
+
},
|
|
825
|
+
): OptionalChangeset {
|
|
826
|
+
const filtered: Mutable<OptionalChangeset> = { ...change };
|
|
827
|
+
if (filtered.valueReplace !== undefined) {
|
|
828
|
+
if (isReplaceEffectful(filtered.valueReplace)) {
|
|
829
|
+
const detachId = getEffectfulDst(filtered.valueReplace);
|
|
830
|
+
const detachResult =
|
|
831
|
+
detachId === undefined ? undefined : options.filterDetach(detachId, 1).value;
|
|
832
|
+
|
|
833
|
+
const attachId = filtered.valueReplace.src;
|
|
834
|
+
const attachResult =
|
|
835
|
+
attachId === undefined ? undefined : options.filterAttach(attachId, 1).value;
|
|
836
|
+
|
|
837
|
+
if (detachResult === EditFilterStatus.Remove) {
|
|
838
|
+
assert(
|
|
839
|
+
attachId === undefined || attachResult === EditFilterStatus.Remove,
|
|
840
|
+
"Cannot remove detach without also removing attach",
|
|
841
|
+
);
|
|
842
|
+
|
|
843
|
+
delete filtered.valueReplace;
|
|
844
|
+
} else if (attachResult === EditFilterStatus.Remove) {
|
|
845
|
+
delete filtered.valueReplace.src;
|
|
846
|
+
}
|
|
847
|
+
} else if (!options.preserveOtherEdits) {
|
|
848
|
+
delete filtered.valueReplace;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if (!options.preserveOtherEdits) {
|
|
853
|
+
filtered.moves = [];
|
|
854
|
+
}
|
|
855
|
+
return filtered;
|
|
856
|
+
}
|
|
@@ -32,13 +32,82 @@ export enum SchemaValidationError {
|
|
|
32
32
|
Node_MissingSchema,
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Additional context about a schema validation error.
|
|
37
|
+
* @remarks
|
|
38
|
+
* Not all fields are populated for every error type — only those relevant to the specific error.
|
|
39
|
+
*/
|
|
40
|
+
export interface SchemaValidationErrorContext {
|
|
41
|
+
/**
|
|
42
|
+
* The type identifier of the node that failed validation.
|
|
43
|
+
*/
|
|
44
|
+
readonly nodeType?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The set of type identifiers allowed in the field, if applicable.
|
|
47
|
+
*/
|
|
48
|
+
readonly allowedTypes?: ReadonlySet<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Field keys on the node that were not recognized by its schema.
|
|
51
|
+
*/
|
|
52
|
+
readonly unexpectedFields?: ReadonlySet<string>;
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
/**
|
|
36
56
|
* Throws a UsageError indicating a tree is out of schema.
|
|
37
57
|
*/
|
|
38
|
-
export function throwOutOfSchema(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
export function throwOutOfSchema(
|
|
59
|
+
maybeError: SchemaValidationError,
|
|
60
|
+
context?: SchemaValidationErrorContext,
|
|
61
|
+
): never {
|
|
62
|
+
throw new UsageError(formatSchemaValidationError(maybeError, context));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Not exported: internal helper used by throwOutOfSchema.
|
|
66
|
+
function formatSchemaValidationError(
|
|
67
|
+
error: SchemaValidationError,
|
|
68
|
+
context: SchemaValidationErrorContext | undefined,
|
|
69
|
+
): string {
|
|
70
|
+
switch (error) {
|
|
71
|
+
case SchemaValidationError.Field_NodeTypeNotAllowed: {
|
|
72
|
+
const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
|
|
73
|
+
const allowedDesc =
|
|
74
|
+
context?.allowedTypes === undefined
|
|
75
|
+
? "unknown"
|
|
76
|
+
: `[${[...context.allowedTypes].map((t) => `"${t}"`).join(", ")}]`;
|
|
77
|
+
return (
|
|
78
|
+
`Tree does not conform to schema. ` +
|
|
79
|
+
`A node of type ${nodeDesc} is not allowed in this field. Allowed types: ${allowedDesc}. ` +
|
|
80
|
+
`If using a staged allowed type, the stored schema has not been upgraded to include this type yet. ` +
|
|
81
|
+
`Either upgrade the schema to enable the staged type or avoid inserting content of this type until the schema is upgraded.`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
case SchemaValidationError.Node_MissingSchema: {
|
|
85
|
+
const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
|
|
86
|
+
return (
|
|
87
|
+
`Tree does not conform to schema. ` +
|
|
88
|
+
`No schema definition was found for node type ${nodeDesc}. ` +
|
|
89
|
+
`Ensure the node's type is included in the schema and that the stored schema has been upgraded if needed.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
case SchemaValidationError.ObjectNode_FieldNotInSchema: {
|
|
93
|
+
const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
|
|
94
|
+
const fieldsDesc =
|
|
95
|
+
context?.unexpectedFields === undefined || context.unexpectedFields.size === 0
|
|
96
|
+
? undefined
|
|
97
|
+
: `[${[...context.unexpectedFields].map((f) => `"${f}"`).join(", ")}]`;
|
|
98
|
+
const fieldsPart =
|
|
99
|
+
fieldsDesc === undefined
|
|
100
|
+
? "The node has fields that are not defined in its schema."
|
|
101
|
+
: `Unexpected fields: ${fieldsDesc}.`;
|
|
102
|
+
return (
|
|
103
|
+
`Tree does not conform to schema. ` +
|
|
104
|
+
`A node of type ${nodeDesc} has fields not defined in its schema. ${fieldsPart}`
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
default: {
|
|
108
|
+
return `Tree does not conform to schema: ${SchemaValidationError[error]}.`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
42
111
|
}
|
|
43
112
|
|
|
44
113
|
type NotUndefined = number | string | boolean | bigint | symbol | object;
|
|
@@ -53,12 +122,14 @@ type NotUndefined = number | string | boolean | bigint | symbol | object;
|
|
|
53
122
|
export function isNodeInSchema<T extends NotUndefined>(
|
|
54
123
|
node: MinimalMapTreeNodeView,
|
|
55
124
|
schemaAndPolicy: SchemaAndPolicy,
|
|
56
|
-
onError: (error: SchemaValidationError) => T,
|
|
125
|
+
onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
|
|
57
126
|
): T | undefined {
|
|
58
127
|
// Validate the schema declared by the node exists
|
|
59
128
|
const schema = schemaAndPolicy.schema.nodeSchema.get(node.type);
|
|
60
129
|
if (schema === undefined) {
|
|
61
|
-
return onError(SchemaValidationError.Node_MissingSchema
|
|
130
|
+
return onError(SchemaValidationError.Node_MissingSchema, {
|
|
131
|
+
nodeType: node.type,
|
|
132
|
+
});
|
|
62
133
|
}
|
|
63
134
|
|
|
64
135
|
// Validate the node is well formed according to its schema
|
|
@@ -95,7 +166,10 @@ export function isNodeInSchema<T extends NotUndefined>(
|
|
|
95
166
|
// Code using this with a stored schema derived from a view schema rather than the document can be problematic because it may be missing unknown fields that the actual document has.
|
|
96
167
|
// Other schema evolution features like "staged" allowed types will likely cause similar issues elsewhere in this checker.
|
|
97
168
|
if (uncheckedFieldsFromNode.size > 0) {
|
|
98
|
-
return onError(SchemaValidationError.ObjectNode_FieldNotInSchema
|
|
169
|
+
return onError(SchemaValidationError.ObjectNode_FieldNotInSchema, {
|
|
170
|
+
nodeType: node.type,
|
|
171
|
+
unexpectedFields: uncheckedFieldsFromNode,
|
|
172
|
+
});
|
|
99
173
|
}
|
|
100
174
|
} else if (schema instanceof MapNodeStoredSchema) {
|
|
101
175
|
for (const [_key, field] of node.fields) {
|
|
@@ -128,7 +202,7 @@ export function isFieldInSchema<T extends NotUndefined>(
|
|
|
128
202
|
childNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,
|
|
129
203
|
schema: TreeFieldStoredSchema,
|
|
130
204
|
schemaAndPolicy: SchemaAndPolicy,
|
|
131
|
-
onError: (error: SchemaValidationError) => T,
|
|
205
|
+
onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
|
|
132
206
|
): T | undefined {
|
|
133
207
|
// Validate that the field kind is handled by the schema policy
|
|
134
208
|
const kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);
|
|
@@ -147,7 +221,10 @@ export function isFieldInSchema<T extends NotUndefined>(
|
|
|
147
221
|
for (const node of childNodes) {
|
|
148
222
|
// Validate the type declared by the node is allowed in this field
|
|
149
223
|
if (schema.types !== undefined && !schema.types.has(node.type)) {
|
|
150
|
-
return onError(SchemaValidationError.Field_NodeTypeNotAllowed
|
|
224
|
+
return onError(SchemaValidationError.Field_NodeTypeNotAllowed, {
|
|
225
|
+
nodeType: node.type,
|
|
226
|
+
allowedTypes: schema.types,
|
|
227
|
+
});
|
|
151
228
|
}
|
|
152
229
|
|
|
153
230
|
// Validate the node complies with the type it declares to be.
|