@fluidframework/tree 2.62.0 → 2.63.0-359286
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/.eslintrc.cjs +4 -0
- package/api-report/tree.alpha.api.md +31 -5
- package/api-report/tree.beta.api.md +26 -0
- package/api-report/tree.legacy.beta.api.md +26 -0
- package/dist/alpha.d.ts +4 -3
- package/dist/beta.d.ts +3 -0
- package/dist/codec/codec.d.ts +32 -0
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +32 -1
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +3 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +5 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -6
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +5 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +3 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +5 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -5
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +4 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +5 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +1 -0
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +3 -1
- package/dist/feature-libraries/forest-summary/index.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +5 -5
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +7 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/index.js +2 -1
- package/dist/feature-libraries/schema-edits/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +9 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +2 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +5 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +2 -1
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/legacy.d.ts +3 -0
- 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/serializableDomainSchema.d.ts +12 -16
- package/dist/serializableDomainSchema.d.ts.map +1 -1
- package/dist/serializableDomainSchema.js +8 -8
- package/dist/serializableDomainSchema.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 +4 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +18 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +122 -8
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +31 -18
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +53 -73
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.js +8 -4
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +7 -4
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +42 -11
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +6 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +7 -4
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +44 -23
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +9 -18
- package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +6 -4
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +12 -13
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +11 -44
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +55 -0
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +12 -2
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +6 -0
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +3 -2
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +3 -2
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/util/brand.d.ts +1 -1
- package/dist/util/brand.js.map +1 -1
- package/docs/main/compatibility.md +8 -0
- package/lib/alpha.d.ts +4 -3
- package/lib/beta.d.ts +3 -0
- package/lib/codec/codec.d.ts +32 -0
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +28 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/schema-stored/index.d.ts +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +5 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -6
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +3 -0
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -0
- package/lib/core/tree/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -0
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +17 -4
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +4 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -0
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +1 -0
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +1 -0
- package/lib/feature-libraries/forest-summary/index.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +5 -5
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +5 -5
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/index.js +1 -1
- package/lib/feature-libraries/schema-edits/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +2 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +3 -0
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +1 -1
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/legacy.d.ts +3 -0
- 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/serializableDomainSchema.d.ts +12 -16
- package/lib/serializableDomainSchema.d.ts.map +1 -1
- package/lib/serializableDomainSchema.js +9 -9
- package/lib/serializableDomainSchema.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 +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +18 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +126 -13
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +30 -18
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +55 -75
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.js +8 -4
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +7 -4
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +40 -10
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +7 -4
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +42 -22
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +9 -18
- package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +6 -4
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +13 -14
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +12 -45
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +56 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +12 -2
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +7 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +3 -2
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +3 -2
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/util/brand.d.ts +1 -1
- package/lib/util/brand.js.map +1 -1
- package/package.json +21 -21
- package/src/codec/codec.ts +60 -0
- package/src/codec/index.ts +3 -0
- package/src/core/index.ts +3 -0
- package/src/core/schema-stored/index.ts +1 -0
- package/src/core/schema-stored/schema.ts +5 -6
- package/src/core/tree/detachedFieldIndexCodecs.ts +9 -0
- package/src/core/tree/index.ts +6 -0
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +6 -1
- package/src/feature-libraries/chunked-forest/codec/format.ts +2 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +2 -1
- package/src/feature-libraries/chunked-forest/index.ts +2 -0
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +29 -5
- package/src/feature-libraries/default-schema/index.ts +2 -0
- package/src/feature-libraries/forest-summary/codec.ts +7 -0
- package/src/feature-libraries/forest-summary/index.ts +1 -0
- package/src/feature-libraries/index.ts +12 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -1
- package/src/feature-libraries/schema-edits/index.ts +5 -1
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +17 -1
- package/src/feature-libraries/schema-index/codec.ts +5 -0
- package/src/feature-libraries/schema-index/index.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +12 -11
- package/src/shared-tree/index.ts +6 -0
- package/src/shared-tree/sharedTree.ts +151 -11
- package/src/shared-tree/sharedTreeChangeCodecs.ts +68 -30
- package/src/shared-tree/treeCheckout.ts +1 -1
- package/src/shared-tree-core/defaultResubmitMachine.ts +77 -120
- package/src/shared-tree-core/editManager.ts +10 -4
- package/src/shared-tree-core/editManagerCodecs.ts +62 -9
- package/src/shared-tree-core/index.ts +12 -1
- package/src/shared-tree-core/messageCodecs.ts +70 -27
- package/src/shared-tree-core/resubmitMachine.ts +12 -20
- package/src/shared-tree-core/sharedTreeCore.ts +26 -18
- package/src/simple-tree/api/schemaFactoryAlpha.ts +16 -296
- package/src/simple-tree/api/schemaFactoryBeta.ts +269 -1
- package/src/simple-tree/api/treeBeta.ts +36 -1
- package/src/simple-tree/api/typesUnsafe.ts +1 -1
- package/src/simple-tree/core/treeNode.ts +3 -2
- package/src/simple-tree/core/treeNodeKernel.ts +1 -1
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -2
- package/src/util/brand.ts +1 -1
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import {
|
|
8
|
+
type CodecTree,
|
|
7
9
|
DiscriminatedUnionDispatcher,
|
|
10
|
+
type FormatVersion,
|
|
8
11
|
type ICodecFamily,
|
|
9
12
|
type ICodecOptions,
|
|
10
13
|
type IJsonCodec,
|
|
@@ -13,12 +16,21 @@ import {
|
|
|
13
16
|
} from "../codec/index.js";
|
|
14
17
|
import type { ChangeEncodingContext, TreeStoredSchema } from "../core/index.js";
|
|
15
18
|
import {
|
|
19
|
+
type ModularChangeFormatVersion,
|
|
16
20
|
type ModularChangeset,
|
|
17
21
|
type SchemaChange,
|
|
22
|
+
type SchemaChangeFormatVersion,
|
|
18
23
|
defaultSchemaPolicy,
|
|
24
|
+
getCodecTreeForModularChangeFormat,
|
|
25
|
+
getCodecTreeForSchemaChangeFormat,
|
|
19
26
|
makeSchemaChangeCodecs,
|
|
20
27
|
} from "../feature-libraries/index.js";
|
|
21
|
-
import
|
|
28
|
+
import {
|
|
29
|
+
brand,
|
|
30
|
+
type Brand,
|
|
31
|
+
type JsonCompatibleReadOnly,
|
|
32
|
+
type Mutable,
|
|
33
|
+
} from "../util/index.js";
|
|
22
34
|
|
|
23
35
|
import {
|
|
24
36
|
EncodedSharedTreeChange,
|
|
@@ -31,40 +43,66 @@ export function makeSharedTreeChangeCodecFamily(
|
|
|
31
43
|
options: ICodecOptions,
|
|
32
44
|
): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {
|
|
33
45
|
const schemaChangeCodecs = makeSchemaChangeCodecs(options);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
|
|
46
|
+
const versions: [
|
|
47
|
+
FormatVersion,
|
|
48
|
+
IJsonCodec<
|
|
49
|
+
SharedTreeChange,
|
|
50
|
+
EncodedSharedTreeChange,
|
|
51
|
+
EncodedSharedTreeChange,
|
|
52
|
+
ChangeEncodingContext
|
|
53
|
+
>,
|
|
54
|
+
][] = Array.from(dependenciesForChangeFormat.entries()).map(
|
|
55
|
+
([format, { modularChange, schemaChange }]) => [
|
|
56
|
+
format,
|
|
45
57
|
makeSharedTreeChangeCodec(
|
|
46
|
-
modularChangeCodecFamily.resolve(
|
|
47
|
-
schemaChangeCodecs.resolve(
|
|
58
|
+
modularChangeCodecFamily.resolve(modularChange).json,
|
|
59
|
+
schemaChangeCodecs.resolve(schemaChange).json,
|
|
48
60
|
options,
|
|
49
61
|
),
|
|
50
62
|
],
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
);
|
|
64
|
+
return makeCodecFamily(versions);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface ChangeFormatDependencies {
|
|
68
|
+
readonly modularChange: ModularChangeFormatVersion;
|
|
69
|
+
readonly schemaChange: SchemaChangeFormatVersion;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type SharedTreeChangeFormatVersion = Brand<
|
|
73
|
+
1 | 2 | 3 | 4,
|
|
74
|
+
"SharedTreeChangeFormatVersion"
|
|
75
|
+
>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Defines for each SharedTree change format the corresponding dependent formats to use.
|
|
79
|
+
* This is an arbitrary mapping that is injected in the SharedTree change codec.
|
|
80
|
+
* Once an entry is defined and used in production, it cannot be changed.
|
|
81
|
+
* This is because the format for the dependent formats are not explicitly versioned.
|
|
82
|
+
*/
|
|
83
|
+
export const dependenciesForChangeFormat: Map<
|
|
84
|
+
SharedTreeChangeFormatVersion,
|
|
85
|
+
ChangeFormatDependencies
|
|
86
|
+
> = new Map([
|
|
87
|
+
[brand(1), { modularChange: brand(1), schemaChange: brand(1) }],
|
|
88
|
+
[brand(2), { modularChange: brand(2), schemaChange: brand(1) }],
|
|
89
|
+
[brand(3), { modularChange: brand(3), schemaChange: brand(1) }],
|
|
90
|
+
[brand(4), { modularChange: brand(4), schemaChange: brand(1) }],
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
export function getCodecTreeForChangeFormat(
|
|
94
|
+
version: SharedTreeChangeFormatVersion,
|
|
95
|
+
): CodecTree {
|
|
96
|
+
const { modularChange, schemaChange } =
|
|
97
|
+
dependenciesForChangeFormat.get(version) ?? fail("Unknown change format");
|
|
98
|
+
return {
|
|
99
|
+
name: "SharedTreeChange",
|
|
100
|
+
version,
|
|
101
|
+
children: [
|
|
102
|
+
getCodecTreeForModularChangeFormat(modularChange),
|
|
103
|
+
getCodecTreeForSchemaChangeFormat(schemaChange),
|
|
66
104
|
],
|
|
67
|
-
|
|
105
|
+
};
|
|
68
106
|
}
|
|
69
107
|
|
|
70
108
|
function makeSharedTreeChangeCodec(
|
|
@@ -1024,7 +1024,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
1024
1024
|
// #region Commit Validation
|
|
1025
1025
|
|
|
1026
1026
|
/** Used to maintain the contract of {@link onCommitValid}(). */
|
|
1027
|
-
#validatedCommits = new WeakMap<
|
|
1027
|
+
readonly #validatedCommits = new WeakMap<
|
|
1028
1028
|
GraphCommit<SharedTreeChange>,
|
|
1029
1029
|
((commit: GraphCommit<SharedTreeChange>) => void)[] | true
|
|
1030
1030
|
>();
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
assert,
|
|
8
|
-
DoublyLinkedList,
|
|
9
|
-
oob,
|
|
10
|
-
type ListNode,
|
|
11
|
-
type ListNodeRange,
|
|
12
|
-
} from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, fail, oob } from "@fluidframework/core-utils/internal";
|
|
13
7
|
|
|
14
|
-
import type { GraphCommit, TaggedChange } from "../core/index.js";
|
|
15
|
-
import { disposeSymbol
|
|
8
|
+
import type { GraphCommit, RevisionTag, TaggedChange } from "../core/index.js";
|
|
9
|
+
import { disposeSymbol } from "../util/index.js";
|
|
16
10
|
|
|
17
11
|
import type { ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
|
|
18
12
|
import type { ResubmitMachine } from "./resubmitMachine.js";
|
|
@@ -21,23 +15,15 @@ interface PendingChange<TChange> {
|
|
|
21
15
|
commit: GraphCommit<TChange>;
|
|
22
16
|
lastEnrichment: number;
|
|
23
17
|
}
|
|
24
|
-
type PendingChangeNode<TChange> = ListNode<PendingChange<TChange>>;
|
|
25
18
|
|
|
26
19
|
/**
|
|
27
20
|
* Default implementation of {@link ResubmitMachine}.
|
|
28
21
|
*/
|
|
29
22
|
export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange> {
|
|
30
23
|
/**
|
|
31
|
-
*
|
|
24
|
+
* Maps from revision of submitted commit to the pending change for that commit.
|
|
32
25
|
*/
|
|
33
|
-
private readonly
|
|
34
|
-
new DoublyLinkedList();
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The range of in-flight commits that are currently being resubmitted.
|
|
38
|
-
* Defined only during the resubmit phase.
|
|
39
|
-
*/
|
|
40
|
-
private pendingResubmitRange: ListNodeRange<PendingChange<TChange>> | undefined;
|
|
26
|
+
private readonly pendingChanges: Map<RevisionTag, PendingChange<TChange>> = new Map();
|
|
41
27
|
|
|
42
28
|
/**
|
|
43
29
|
* The current enrichment version for in-flight commits.
|
|
@@ -58,130 +44,101 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
58
44
|
) {}
|
|
59
45
|
|
|
60
46
|
public onCommitSubmitted(commit: GraphCommit<TChange>): void {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
0x981 /* Unexpected commit submitted during resubmit phase */,
|
|
66
|
-
);
|
|
67
|
-
// If we are not at the last commit to resubmit, advance the range to the next node.
|
|
68
|
-
// Otherwise, clear the resubmit range as we are done resubmitting.
|
|
69
|
-
if (toResubmit !== this.pendingResubmitRange.last) {
|
|
70
|
-
assert(toResubmit.next !== undefined, 0xbd6 /* must be more in the list */);
|
|
71
|
-
this.pendingResubmitRange.first = toResubmit.next;
|
|
72
|
-
} else {
|
|
73
|
-
this.pendingResubmitRange = undefined;
|
|
74
|
-
}
|
|
75
|
-
toResubmit.remove();
|
|
76
|
-
}
|
|
77
|
-
this.inFlightQueue.push({ commit, lastEnrichment: this.currentEnrichment });
|
|
47
|
+
this.pendingChanges.set(commit.revision, {
|
|
48
|
+
commit,
|
|
49
|
+
lastEnrichment: this.currentEnrichment,
|
|
50
|
+
});
|
|
78
51
|
}
|
|
79
52
|
|
|
80
53
|
public onCommitRollback(commit: GraphCommit<TChange>): void {
|
|
81
|
-
|
|
82
|
-
commit.revision === this.inFlightQueue.last?.data.commit.revision,
|
|
83
|
-
0xbd7 /* must rollback latest commit in the in flight queue */,
|
|
84
|
-
);
|
|
85
|
-
this.inFlightQueue.pop();
|
|
54
|
+
this.pendingChanges.delete(commit.revision);
|
|
86
55
|
}
|
|
87
56
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
private updateEnrichments(
|
|
58
|
+
revision: RevisionTag,
|
|
59
|
+
getLocalCommits: () => readonly GraphCommit<TChange>[],
|
|
60
|
+
): void {
|
|
61
|
+
const pendingChange = this.pendingChanges.get(revision);
|
|
62
|
+
if (
|
|
63
|
+
pendingChange === undefined ||
|
|
64
|
+
pendingChange.lastEnrichment === this.currentEnrichment
|
|
65
|
+
) {
|
|
66
|
+
// The first commit to resubmit has a valid enrichment, so all pending commits must be valid.
|
|
95
67
|
return;
|
|
96
68
|
}
|
|
97
69
|
|
|
70
|
+
const localCommits = getLocalCommits();
|
|
98
71
|
assert(
|
|
99
|
-
|
|
100
|
-
|
|
72
|
+
localCommits[0]?.revision === revision,
|
|
73
|
+
"Expected local commits to start with specified revision",
|
|
101
74
|
);
|
|
102
75
|
|
|
103
|
-
//
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
76
|
+
// Some in-flight commits have stale enrichments, so we recompute them.
|
|
77
|
+
const checkout = this.tip.fork();
|
|
78
|
+
|
|
79
|
+
// Roll back the checkout to the state before the oldest commit
|
|
80
|
+
for (let iCommit = localCommits.length - 1; iCommit >= 0; iCommit -= 1) {
|
|
81
|
+
const commit = localCommits[iCommit] ?? oob();
|
|
82
|
+
const rollback = this.makeRollback(commit);
|
|
83
|
+
// WARNING: it's not currently possible to roll back past a schema change (see AB#7265).
|
|
84
|
+
// Either we have to make it possible to do so, or this logic will have to change to work
|
|
85
|
+
// forwards from an earlier fork instead of backwards.
|
|
86
|
+
checkout.applyTipChange(rollback);
|
|
87
|
+
}
|
|
114
88
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const commit = toResubmit[iCommit] ?? oob();
|
|
123
|
-
const rollback = this.makeRollback(commit);
|
|
124
|
-
// WARNING: it's not currently possible to roll back past a schema change (see AB#7265).
|
|
125
|
-
// Either we have to make it possible to do so, or this logic will have to change to work
|
|
126
|
-
// forwards from an earlier fork instead of backwards.
|
|
127
|
-
checkout.applyTipChange(rollback);
|
|
128
|
-
}
|
|
89
|
+
// Update the enrichments of the stale commits.
|
|
90
|
+
for (const [iCommit, commit] of localCommits.entries()) {
|
|
91
|
+
const current = this.getPendingChange(commit.revision);
|
|
92
|
+
assert(
|
|
93
|
+
current !== undefined,
|
|
94
|
+
0xbda /* there must be an inflight commit for each resubmit commit */,
|
|
95
|
+
);
|
|
129
96
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
current !== undefined,
|
|
135
|
-
0xbda /* there must be an inflight commit for each resubmit commit */,
|
|
97
|
+
if (current.lastEnrichment < this.currentEnrichment) {
|
|
98
|
+
const enrichedChange = checkout.updateChangeEnrichments(
|
|
99
|
+
commit.change,
|
|
100
|
+
commit.revision,
|
|
136
101
|
);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
current.next !== undefined &&
|
|
148
|
-
current.next.data.lastEnrichment < this.currentEnrichment
|
|
149
|
-
) {
|
|
150
|
-
checkout.applyTipChange(enrichedChange, commit.revision);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
current.data.commit = enrichedCommit;
|
|
154
|
-
current.data.lastEnrichment = this.currentEnrichment;
|
|
102
|
+
const enrichedCommit = { ...commit, change: enrichedChange };
|
|
103
|
+
|
|
104
|
+
// Optimization: only apply the enriched change if the next commit also needs enrichment.
|
|
105
|
+
const nextCommit = localCommits[iCommit + 1];
|
|
106
|
+
if (
|
|
107
|
+
nextCommit !== undefined &&
|
|
108
|
+
this.getPendingChange(nextCommit.revision).lastEnrichment < this.currentEnrichment
|
|
109
|
+
) {
|
|
110
|
+
checkout.applyTipChange(enrichedChange, commit.revision);
|
|
155
111
|
}
|
|
156
|
-
|
|
112
|
+
|
|
113
|
+
current.commit = enrichedCommit;
|
|
114
|
+
current.lastEnrichment = this.currentEnrichment;
|
|
157
115
|
}
|
|
158
|
-
checkout[disposeSymbol]();
|
|
159
116
|
}
|
|
117
|
+
checkout[disposeSymbol]();
|
|
160
118
|
}
|
|
161
119
|
|
|
162
|
-
public
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
0xa87 /* Expected resubmit queue to be non-empty */,
|
|
170
|
-
);
|
|
171
|
-
return this.pendingResubmitRange.first.data.commit;
|
|
120
|
+
public getEnrichedCommit(
|
|
121
|
+
revision: RevisionTag,
|
|
122
|
+
getLocalCommitsSince: () => readonly GraphCommit<TChange>[],
|
|
123
|
+
): GraphCommit<TChange> | undefined {
|
|
124
|
+
this.updateEnrichments(revision, getLocalCommitsSince);
|
|
125
|
+
const pendingChange = this.pendingChanges.get(revision);
|
|
126
|
+
return pendingChange?.commit;
|
|
172
127
|
}
|
|
173
128
|
|
|
174
|
-
|
|
175
|
-
return
|
|
129
|
+
private getPendingChange(revision: RevisionTag): PendingChange<TChange> {
|
|
130
|
+
return (
|
|
131
|
+
this.pendingChanges.get(revision) ?? fail("No pending change stored for this revision")
|
|
132
|
+
);
|
|
176
133
|
}
|
|
177
134
|
|
|
178
|
-
public onSequencedCommitApplied(isLocal: boolean): void {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// A peer commit has been sequenced
|
|
135
|
+
public onSequencedCommitApplied(revision: RevisionTag, isLocal: boolean): void {
|
|
136
|
+
// We no longer need to track enrichment for the commit with this revision.
|
|
137
|
+
// Note that we may have a commit for this revision even if this is not a local change,
|
|
138
|
+
// as this client and another peer may have merged the same commit from a shared branch.
|
|
139
|
+
this.pendingChanges.delete(revision);
|
|
140
|
+
if (!isLocal) {
|
|
141
|
+
// A peer commit has been sequenced, invalidating the enrichment of our in-flight commits.
|
|
185
142
|
this.currentEnrichment++;
|
|
186
143
|
}
|
|
187
144
|
}
|
|
@@ -750,8 +750,8 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {
|
|
|
750
750
|
// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto
|
|
751
751
|
// the trunk.
|
|
752
752
|
if (areLocalCommits) {
|
|
753
|
-
for (const
|
|
754
|
-
this.sequenceLocalCommit(nextSequenceId, sessionId, onSequenceLocalCommit);
|
|
753
|
+
for (const { revision } of newCommits) {
|
|
754
|
+
this.sequenceLocalCommit(revision, nextSequenceId, sessionId, onSequenceLocalCommit);
|
|
755
755
|
nextSequenceId = getNextSequenceId(nextSequenceId);
|
|
756
756
|
}
|
|
757
757
|
return;
|
|
@@ -900,10 +900,17 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {
|
|
|
900
900
|
* Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.
|
|
901
901
|
*/
|
|
902
902
|
private sequenceLocalCommit(
|
|
903
|
+
revision: RevisionTag,
|
|
903
904
|
sequenceId: SequenceId,
|
|
904
905
|
sessionId: SessionId,
|
|
905
906
|
onSequenceLocalCommit: OnSequenceCommit<TChangeset>,
|
|
906
|
-
):
|
|
907
|
+
): void {
|
|
908
|
+
if (this.commitMetadata.has(revision)) {
|
|
909
|
+
// This can happen if the commit came from a shared branch and was concurrently merged by another client.
|
|
910
|
+
// In this case, the newly sequenced commit is redundant and should therefore be ignored.
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
|
|
907
914
|
// First, push the local commit to the trunk.
|
|
908
915
|
// We are mutating our `localCommits` cache here,but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.
|
|
909
916
|
const firstLocalCommit = this.localCommits.shift();
|
|
@@ -915,7 +922,6 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset> {
|
|
|
915
922
|
const prevSequenceId = this.getCommitSequenceId(this.trunk.getHead().revision);
|
|
916
923
|
this.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, sessionId);
|
|
917
924
|
onSequenceLocalCommit(firstLocalCommit, sequenceId, prevSequenceId);
|
|
918
|
-
return firstLocalCommit;
|
|
919
925
|
}
|
|
920
926
|
|
|
921
927
|
/**
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
|
+
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
8
|
|
|
8
9
|
import {
|
|
10
|
+
type CodecTree,
|
|
11
|
+
type DependentFormatVersion,
|
|
12
|
+
type FormatVersion,
|
|
9
13
|
type ICodecFamily,
|
|
10
14
|
type ICodecOptions,
|
|
11
15
|
type IJsonCodec,
|
|
@@ -18,7 +22,7 @@ import type {
|
|
|
18
22
|
RevisionTag,
|
|
19
23
|
SchemaAndPolicy,
|
|
20
24
|
} from "../core/index.js";
|
|
21
|
-
import type
|
|
25
|
+
import { brand, type Brand, type JsonCompatibleReadOnly } from "../util/index.js";
|
|
22
26
|
|
|
23
27
|
import type { SummaryData } from "./editManager.js";
|
|
24
28
|
import { makeV1CodecWithVersion } from "./editManagerCodecsV1toV4.js";
|
|
@@ -31,6 +35,7 @@ export interface EditManagerEncodingContext {
|
|
|
31
35
|
|
|
32
36
|
export function makeEditManagerCodec<TChangeset>(
|
|
33
37
|
changeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,
|
|
38
|
+
dependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,
|
|
34
39
|
revisionTagCodec: IJsonCodec<
|
|
35
40
|
RevisionTag,
|
|
36
41
|
EncodedRevisionTag,
|
|
@@ -45,12 +50,18 @@ export function makeEditManagerCodec<TChangeset>(
|
|
|
45
50
|
JsonCompatibleReadOnly,
|
|
46
51
|
EditManagerEncodingContext
|
|
47
52
|
> {
|
|
48
|
-
const family = makeEditManagerCodecs(
|
|
53
|
+
const family = makeEditManagerCodecs(
|
|
54
|
+
changeCodecs,
|
|
55
|
+
dependentChangeFormatVersion,
|
|
56
|
+
revisionTagCodec,
|
|
57
|
+
options,
|
|
58
|
+
);
|
|
49
59
|
return makeVersionDispatchingCodec(family, { ...options, writeVersion });
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
export function makeEditManagerCodecs<TChangeset>(
|
|
53
63
|
changeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,
|
|
64
|
+
dependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>,
|
|
54
65
|
revisionTagCodec: IJsonCodec<
|
|
55
66
|
RevisionTag,
|
|
56
67
|
EncodedRevisionTag,
|
|
@@ -59,11 +70,53 @@ export function makeEditManagerCodecs<TChangeset>(
|
|
|
59
70
|
>,
|
|
60
71
|
options: ICodecOptions,
|
|
61
72
|
): ICodecFamily<SummaryData<TChangeset>, EditManagerEncodingContext> {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
const registry: [
|
|
74
|
+
FormatVersion,
|
|
75
|
+
IJsonCodec<
|
|
76
|
+
SummaryData<TChangeset>,
|
|
77
|
+
JsonCompatibleReadOnly,
|
|
78
|
+
JsonCompatibleReadOnly,
|
|
79
|
+
EditManagerEncodingContext
|
|
80
|
+
>,
|
|
81
|
+
][] = Array.from(editManagerFormatVersions, (version) => {
|
|
82
|
+
const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));
|
|
83
|
+
switch (version) {
|
|
84
|
+
case 1:
|
|
85
|
+
case 2:
|
|
86
|
+
case 3:
|
|
87
|
+
case 4:
|
|
88
|
+
return [
|
|
89
|
+
version,
|
|
90
|
+
makeV1CodecWithVersion(changeCodec, revisionTagCodec, options, version),
|
|
91
|
+
];
|
|
92
|
+
case 5:
|
|
93
|
+
return [
|
|
94
|
+
version,
|
|
95
|
+
makeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),
|
|
96
|
+
];
|
|
97
|
+
default:
|
|
98
|
+
unreachableCase(version);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return makeCodecFamily(registry);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type EditManagerFormatVersion = Brand<1 | 2 | 3 | 4 | 5, "EditManagerFormatVersion">;
|
|
105
|
+
export const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set([
|
|
106
|
+
brand(1),
|
|
107
|
+
brand(2),
|
|
108
|
+
brand(3),
|
|
109
|
+
brand(4),
|
|
110
|
+
brand(5),
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
export function getCodecTreeForEditManagerFormatWithChange(
|
|
114
|
+
version: EditManagerFormatVersion,
|
|
115
|
+
changeFormat: CodecTree,
|
|
116
|
+
): CodecTree {
|
|
117
|
+
return {
|
|
118
|
+
name: "EditManager",
|
|
119
|
+
version,
|
|
120
|
+
children: [changeFormat],
|
|
121
|
+
};
|
|
69
122
|
}
|
|
@@ -39,7 +39,12 @@ export {
|
|
|
39
39
|
NoOpChangeEnricher,
|
|
40
40
|
} from "./changeEnricher.js";
|
|
41
41
|
|
|
42
|
-
export {
|
|
42
|
+
export {
|
|
43
|
+
makeEditManagerCodec,
|
|
44
|
+
getCodecTreeForEditManagerFormatWithChange,
|
|
45
|
+
type EditManagerFormatVersion,
|
|
46
|
+
editManagerFormatVersions,
|
|
47
|
+
} from "./editManagerCodecs.js";
|
|
43
48
|
export { EditManagerSummarizer } from "./editManagerSummarizer.js";
|
|
44
49
|
export {
|
|
45
50
|
EditManager,
|
|
@@ -54,3 +59,9 @@ export type {
|
|
|
54
59
|
SummarySessionBranch,
|
|
55
60
|
EncodedCommit,
|
|
56
61
|
} from "./editManagerFormatCommons.js";
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
type MessageFormatVersion,
|
|
65
|
+
messageFormatVersions,
|
|
66
|
+
getCodecTreeForMessageFormatWithChange,
|
|
67
|
+
} from "./messageCodecs.js";
|