@fluidframework/tree 2.43.0 → 2.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/api-report/tree.alpha.api.md +73 -16
- package/api-report/tree.beta.api.md +9 -3
- package/api-report/tree.legacy.alpha.api.md +8 -2
- package/api-report/tree.legacy.public.api.md +8 -2
- package/api-report/tree.public.api.md +8 -2
- package/dist/alpha.d.ts +9 -0
- package/dist/core/forest/editableForest.d.ts +0 -2
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.d.ts +0 -4
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js +0 -4
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +0 -6
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/types.d.ts +0 -2
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +0 -8
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +0 -8
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -2
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js.map +1 -1
- package/dist/core/tree/cursor.d.ts +0 -2
- package/dist/core/tree/cursor.d.ts.map +1 -1
- package/dist/core/tree/cursor.js +0 -2
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/delta.d.ts +0 -2
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/types.d.ts +0 -4
- package/dist/core/tree/types.d.ts.map +1 -1
- package/dist/core/tree/types.js +0 -2
- package/dist/core/tree/types.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +0 -4
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -10
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +0 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -10
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -2
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +0 -6
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -12
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +0 -2
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +2 -6
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js +2 -2
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +8 -12
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +54 -46
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +6 -0
- 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 +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +16 -3
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +49 -17
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +1 -1
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +3 -4
- package/dist/simple-tree/api/customTree.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.map +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts +32 -8
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/jsonSchema.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +97 -3
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +75 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +5 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +2 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -4
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +12 -0
- 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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +5 -3
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.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/treeNodeSchema.d.ts +5 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js +4 -0
- package/dist/simple-tree/core/treeNodeSchema.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 +3 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +2 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js +5 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +5 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/index.d.ts +7 -0
- package/dist/simple-tree/node-kinds/record/index.d.ts.map +1 -0
- package/dist/simple-tree/node-kinds/record/index.js +13 -0
- package/dist/simple-tree/node-kinds/record/index.js.map +1 -0
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts +39 -0
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -0
- package/dist/simple-tree/node-kinds/record/recordNode.js +234 -0
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -0
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +70 -0
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js +30 -0
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -0
- package/dist/simple-tree/simpleSchema.d.ts +16 -1
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +4 -2
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +56 -32
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +7 -2
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +21 -7
- package/dist/tableSchema.js.map +1 -1
- package/dist/util/brandedMap.d.ts +0 -2
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/docs/main/compatibility.md +15 -1
- package/lib/alpha.d.ts +9 -0
- package/lib/core/forest/editableForest.d.ts +0 -2
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/forest/forest.d.ts +0 -4
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js +0 -4
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +0 -6
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/types.d.ts +0 -2
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +0 -8
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +0 -8
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -2
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js.map +1 -1
- package/lib/core/tree/cursor.d.ts +0 -2
- package/lib/core/tree/cursor.d.ts.map +1 -1
- package/lib/core/tree/cursor.js +0 -2
- package/lib/core/tree/cursor.js.map +1 -1
- package/lib/core/tree/delta.d.ts +0 -2
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/types.d.ts +0 -4
- package/lib/core/tree/types.d.ts.map +1 -1
- package/lib/core/tree/types.js +0 -2
- package/lib/core/tree/types.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +0 -4
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -10
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +0 -2
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -2
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -10
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -2
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +0 -6
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -12
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +0 -2
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +2 -6
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js +3 -3
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +8 -12
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +55 -47
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +6 -0
- 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 +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +16 -3
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +51 -19
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +1 -1
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +2 -3
- package/lib/simple-tree/api/customTree.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.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +32 -8
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/jsonSchema.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +97 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +77 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +5 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +2 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +5 -5
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +12 -0
- 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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +6 -4
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.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/treeNodeSchema.d.ts +5 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js +4 -0
- package/lib/simple-tree/core/treeNodeSchema.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 +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +2 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -0
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +5 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/index.d.ts +7 -0
- package/lib/simple-tree/node-kinds/record/index.d.ts.map +1 -0
- package/lib/simple-tree/node-kinds/record/index.js +7 -0
- package/lib/simple-tree/node-kinds/record/index.js.map +1 -0
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts +39 -0
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -0
- package/lib/simple-tree/node-kinds/record/recordNode.js +232 -0
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -0
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +70 -0
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +26 -0
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -0
- package/lib/simple-tree/simpleSchema.d.ts +16 -1
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +4 -2
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +58 -34
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +7 -2
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +22 -8
- package/lib/tableSchema.js.map +1 -1
- package/lib/util/brandedMap.d.ts +0 -2
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/package.json +34 -22
- package/src/core/forest/editableForest.ts +0 -2
- package/src/core/forest/forest.ts +0 -4
- package/src/core/rebase/changeRebaser.ts +0 -6
- package/src/core/rebase/types.ts +0 -2
- package/src/core/schema-stored/schema.ts +0 -8
- package/src/core/schema-view/view.ts +0 -2
- package/src/core/tree/cursor.ts +0 -2
- package/src/core/tree/delta.ts +0 -2
- package/src/core/tree/types.ts +0 -4
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +0 -4
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +0 -10
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +0 -2
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -10
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +0 -8
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +0 -12
- package/src/feature-libraries/sequence-field/types.ts +0 -2
- package/src/index.ts +9 -0
- package/src/jsonDomainSchema.ts +3 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/treeAlpha.ts +3 -1
- package/src/shared-tree-core/defaultResubmitMachine.ts +99 -52
- package/src/shared-tree-core/resubmitMachine.ts +7 -0
- package/src/shared-tree-core/sharedTreeCore.ts +18 -6
- package/src/simple-tree/api/configuration.ts +73 -19
- package/src/simple-tree/api/customTree.ts +3 -3
- package/src/simple-tree/api/index.ts +3 -0
- package/src/simple-tree/api/jsonSchema.ts +35 -8
- package/src/simple-tree/api/schemaFactory.ts +5 -13
- package/src/simple-tree/api/schemaFactoryAlpha.ts +268 -1
- package/src/simple-tree/api/schemaFactoryRecursive.ts +5 -1
- package/src/simple-tree/api/schemaFromSimple.ts +6 -0
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +16 -7
- package/src/simple-tree/api/treeBeta.ts +2 -2
- package/src/simple-tree/api/treeNodeApi.ts +2 -2
- package/src/simple-tree/api/typesUnsafe.ts +15 -0
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +14 -6
- package/src/simple-tree/core/index.ts +1 -0
- package/src/simple-tree/core/treeNodeSchema.ts +8 -4
- package/src/simple-tree/index.ts +11 -0
- package/src/simple-tree/node-kinds/index.ts +11 -0
- package/src/simple-tree/node-kinds/object/index.ts +5 -1
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -2
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -3
- package/src/simple-tree/node-kinds/record/index.ts +14 -0
- package/src/simple-tree/node-kinds/record/recordNode.ts +410 -0
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +136 -0
- package/src/simple-tree/simpleSchema.ts +19 -1
- package/src/simple-tree/toStoredSchema.ts +4 -2
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +83 -40
- package/src/tableSchema.ts +27 -8
- package/src/util/brandedMap.ts +0 -2
|
@@ -185,8 +185,6 @@ export const storedEmptyFieldSchema: TreeFieldStoredSchema = {
|
|
|
185
185
|
*/
|
|
186
186
|
export const identifierFieldKindIdentifier = "Identifier";
|
|
187
187
|
|
|
188
|
-
/**
|
|
189
|
-
*/
|
|
190
188
|
export abstract class TreeNodeStoredSchema {
|
|
191
189
|
protected _typeCheck!: MakeNominal;
|
|
192
190
|
|
|
@@ -213,8 +211,6 @@ export abstract class TreeNodeStoredSchema {
|
|
|
213
211
|
public abstract getFieldSchema(field: FieldKey): TreeFieldStoredSchema;
|
|
214
212
|
}
|
|
215
213
|
|
|
216
|
-
/**
|
|
217
|
-
*/
|
|
218
214
|
export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
|
|
219
215
|
/**
|
|
220
216
|
* @param objectNodeFields -
|
|
@@ -272,8 +268,6 @@ export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
272
268
|
}
|
|
273
269
|
}
|
|
274
270
|
|
|
275
|
-
/**
|
|
276
|
-
*/
|
|
277
271
|
export class MapNodeStoredSchema extends TreeNodeStoredSchema {
|
|
278
272
|
/**
|
|
279
273
|
* @param mapFields -
|
|
@@ -306,8 +300,6 @@ export class MapNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
306
300
|
}
|
|
307
301
|
}
|
|
308
302
|
|
|
309
|
-
/**
|
|
310
|
-
*/
|
|
311
303
|
export class LeafNodeStoredSchema extends TreeNodeStoredSchema {
|
|
312
304
|
/**
|
|
313
305
|
* @param leafValue -
|
|
@@ -9,8 +9,6 @@ import type { TreeNodeSchemaIdentifier, TreeStoredSchema } from "../schema-store
|
|
|
9
9
|
* APIs for applying `view schema` to documents.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
*/
|
|
14
12
|
export interface TreeAdapter {
|
|
15
13
|
readonly output: TreeNodeSchemaIdentifier;
|
|
16
14
|
readonly input: TreeNodeSchemaIdentifier;
|
package/src/core/tree/cursor.ts
CHANGED
package/src/core/tree/delta.ts
CHANGED
package/src/core/tree/types.ts
CHANGED
|
@@ -18,8 +18,6 @@ import type {
|
|
|
18
18
|
ValueSchema,
|
|
19
19
|
} from "../schema-stored/index.js";
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
*/
|
|
23
21
|
export type TreeType = TreeNodeSchemaIdentifier;
|
|
24
22
|
|
|
25
23
|
/**
|
|
@@ -43,8 +41,6 @@ export const EmptyKey: FieldKey = brand("");
|
|
|
43
41
|
*/
|
|
44
42
|
export const rootFieldKey: FieldKey = brand("rootFieldKey");
|
|
45
43
|
|
|
46
|
-
/**
|
|
47
|
-
*/
|
|
48
44
|
export const rootField = keyAsDetachedField(rootFieldKey);
|
|
49
45
|
|
|
50
46
|
/**
|
|
@@ -410,8 +410,6 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
/**
|
|
414
|
-
*/
|
|
415
413
|
export interface ValueFieldEditBuilder<TContent> {
|
|
416
414
|
/**
|
|
417
415
|
* Issues a change which replaces the current newContent of the field with `newContent`.
|
|
@@ -421,8 +419,6 @@ export interface ValueFieldEditBuilder<TContent> {
|
|
|
421
419
|
set(newContent: TContent): void;
|
|
422
420
|
}
|
|
423
421
|
|
|
424
|
-
/**
|
|
425
|
-
*/
|
|
426
422
|
export interface OptionalFieldEditBuilder<TContent> {
|
|
427
423
|
/**
|
|
428
424
|
* Issues a change which replaces the current newContent of the field with `newContent`
|
|
@@ -257,20 +257,10 @@ export const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> =
|
|
|
257
257
|
// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.
|
|
258
258
|
// TODO: ensure thy work in generated docs.
|
|
259
259
|
// TODO: add these comments to the rest of the cases below.
|
|
260
|
-
/**
|
|
261
|
-
*/
|
|
262
260
|
export interface Required extends FlexFieldKind<"Value", Multiplicity.Single> {}
|
|
263
|
-
/**
|
|
264
|
-
*/
|
|
265
261
|
export interface Optional extends FlexFieldKind<"Optional", Multiplicity.Optional> {}
|
|
266
|
-
/**
|
|
267
|
-
*/
|
|
268
262
|
export interface Sequence extends FlexFieldKind<"Sequence", Multiplicity.Sequence> {}
|
|
269
|
-
/**
|
|
270
|
-
*/
|
|
271
263
|
export interface Identifier extends FlexFieldKind<"Identifier", Multiplicity.Single> {}
|
|
272
|
-
/**
|
|
273
|
-
*/
|
|
274
264
|
export interface Forbidden
|
|
275
265
|
extends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}
|
|
276
266
|
|
|
@@ -216,19 +216,13 @@ export interface FieldEditor<TChangeset> {
|
|
|
216
216
|
*/
|
|
217
217
|
export type ToDelta = (child: NodeId) => DeltaFieldMap;
|
|
218
218
|
|
|
219
|
-
/**
|
|
220
|
-
*/
|
|
221
219
|
export type NodeChangeInverter = (change: NodeId) => NodeId;
|
|
222
220
|
|
|
223
|
-
/**
|
|
224
|
-
*/
|
|
225
221
|
export enum NodeAttachState {
|
|
226
222
|
Attached,
|
|
227
223
|
Detached,
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
/**
|
|
231
|
-
*/
|
|
232
226
|
export type NodeChangeRebaser = (
|
|
233
227
|
change: NodeId | undefined,
|
|
234
228
|
baseChange: NodeId | undefined,
|
|
@@ -239,15 +233,11 @@ export type NodeChangeRebaser = (
|
|
|
239
233
|
state?: NodeAttachState,
|
|
240
234
|
) => NodeId | undefined;
|
|
241
235
|
|
|
242
|
-
/**
|
|
243
|
-
*/
|
|
244
236
|
export type NodeChangeComposer = (
|
|
245
237
|
change1: NodeId | undefined,
|
|
246
238
|
change2: NodeId | undefined,
|
|
247
239
|
) => NodeId;
|
|
248
240
|
|
|
249
|
-
/**
|
|
250
|
-
*/
|
|
251
241
|
export type NodeChangePruner = (change: NodeId) => NodeId | undefined;
|
|
252
242
|
|
|
253
243
|
/**
|
|
@@ -2285,8 +2285,6 @@ function newCrossFieldTable<T>(): CrossFieldTable<T> {
|
|
|
2285
2285
|
};
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
|
-
/**
|
|
2289
|
-
*/
|
|
2290
2288
|
interface ConstraintState {
|
|
2291
2289
|
violationCount: number;
|
|
2292
2290
|
}
|
|
@@ -2913,8 +2911,6 @@ function buildModularChangesetFromNode(props: {
|
|
|
2913
2911
|
});
|
|
2914
2912
|
}
|
|
2915
2913
|
|
|
2916
|
-
/**
|
|
2917
|
-
*/
|
|
2918
2914
|
export interface FieldEditDescription {
|
|
2919
2915
|
type: "field";
|
|
2920
2916
|
field: FieldUpPath;
|
|
@@ -2923,16 +2919,12 @@ export interface FieldEditDescription {
|
|
|
2923
2919
|
revision: RevisionTag;
|
|
2924
2920
|
}
|
|
2925
2921
|
|
|
2926
|
-
/**
|
|
2927
|
-
*/
|
|
2928
2922
|
export interface GlobalEditDescription {
|
|
2929
2923
|
type: "global";
|
|
2930
2924
|
revision: RevisionTag;
|
|
2931
2925
|
builds?: ChangeAtomIdBTree<TreeChunk>;
|
|
2932
2926
|
}
|
|
2933
2927
|
|
|
2934
|
-
/**
|
|
2935
|
-
*/
|
|
2936
2928
|
export type EditDescription = FieldEditDescription | GlobalEditDescription;
|
|
2937
2929
|
|
|
2938
2930
|
function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {
|
|
@@ -17,8 +17,6 @@ import type { TreeChunk } from "../chunked-forest/index.js";
|
|
|
17
17
|
|
|
18
18
|
import type { CrossFieldTarget } from "./crossFieldQueries.js";
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
*/
|
|
22
20
|
export interface ModularChangeset extends HasFieldChanges {
|
|
23
21
|
/**
|
|
24
22
|
* The numerically highest `ChangesetLocalId` used in this changeset.
|
|
@@ -110,8 +108,6 @@ export interface FieldId {
|
|
|
110
108
|
readonly field: FieldKey;
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
/**
|
|
114
|
-
*/
|
|
115
111
|
export interface NodeExistsConstraint {
|
|
116
112
|
violated: boolean;
|
|
117
113
|
}
|
|
@@ -128,23 +124,15 @@ export interface NodeChangeset extends HasFieldChanges {
|
|
|
128
124
|
|
|
129
125
|
export type NodeId = ChangeAtomId;
|
|
130
126
|
|
|
131
|
-
/**
|
|
132
|
-
*/
|
|
133
127
|
export interface HasFieldChanges {
|
|
134
128
|
fieldChanges?: FieldChangeMap;
|
|
135
129
|
}
|
|
136
130
|
|
|
137
|
-
/**
|
|
138
|
-
*/
|
|
139
131
|
export type FieldChangeMap = Map<FieldKey, FieldChange>;
|
|
140
132
|
|
|
141
|
-
/**
|
|
142
|
-
*/
|
|
143
133
|
export interface FieldChange {
|
|
144
134
|
fieldKind: FieldKindIdentifier;
|
|
145
135
|
change: FieldChangeset;
|
|
146
136
|
}
|
|
147
137
|
|
|
148
|
-
/**
|
|
149
|
-
*/
|
|
150
138
|
export type FieldChangeset = Brand<unknown, "FieldChangeset">;
|
package/src/index.ts
CHANGED
|
@@ -130,6 +130,7 @@ export {
|
|
|
130
130
|
type FieldSchemaAlphaUnsafe,
|
|
131
131
|
type ArrayNodeCustomizableSchemaUnsafe,
|
|
132
132
|
type MapNodeCustomizableSchemaUnsafe,
|
|
133
|
+
type TreeRecordNodeUnsafe,
|
|
133
134
|
// System types (not in Internal types for various reasons, like doc links or cannot be named errors).
|
|
134
135
|
type typeSchemaSymbol,
|
|
135
136
|
type TreeNodeSchemaNonClass,
|
|
@@ -196,6 +197,8 @@ export {
|
|
|
196
197
|
type JsonRefPath,
|
|
197
198
|
type JsonSchemaType,
|
|
198
199
|
type JsonLeafSchemaType,
|
|
200
|
+
type JsonRecordNodeSchema,
|
|
201
|
+
type JsonStringKeyPatternProperties,
|
|
199
202
|
getJsonSchema,
|
|
200
203
|
type LazyItem,
|
|
201
204
|
type Unenforced,
|
|
@@ -209,6 +212,7 @@ export {
|
|
|
209
212
|
type SimpleArrayNodeSchema,
|
|
210
213
|
type SimpleObjectNodeSchema,
|
|
211
214
|
type SimpleObjectFieldSchema,
|
|
215
|
+
type SimpleRecordNodeSchema,
|
|
212
216
|
normalizeAllowedTypes,
|
|
213
217
|
getSimpleSchema,
|
|
214
218
|
type ReadonlyArrayNode,
|
|
@@ -249,6 +253,11 @@ export {
|
|
|
249
253
|
type ObjectFromSchemaRecord,
|
|
250
254
|
type ValidateRecursiveSchemaTemplate,
|
|
251
255
|
type FixRecursiveRecursionLimit,
|
|
256
|
+
RecordNodeSchema,
|
|
257
|
+
type RecordNodeCustomizableSchema,
|
|
258
|
+
type RecordNodeInsertableData,
|
|
259
|
+
type RecordNodePojoEmulationSchema,
|
|
260
|
+
type TreeRecordNode,
|
|
252
261
|
} from "./simple-tree/index.js";
|
|
253
262
|
export {
|
|
254
263
|
SharedTree,
|
package/src/jsonDomainSchema.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { SchemaFactory } from "./simple-tree/index.js";
|
|
6
|
+
import { SchemaFactory, SchemaFactoryAlpha } from "./simple-tree/index.js";
|
|
7
7
|
import type {
|
|
8
8
|
AllowedTypes,
|
|
9
9
|
FixRecursiveArraySchema,
|
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
// #endregion
|
|
23
23
|
} from "./simple-tree/index.js";
|
|
24
24
|
|
|
25
|
-
const sf = new
|
|
25
|
+
const sf = new SchemaFactoryAlpha("com.fluidframework.json");
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Utilities for storing JSON data in {@link TreeNode}s.
|
|
@@ -80,7 +80,7 @@ export namespace JsonAsTree {
|
|
|
80
80
|
* Do not use. Exists only as a workaround for {@link https://github.com/microsoft/TypeScript/issues/59550} and {@link https://github.com/microsoft/rushstack/issues/4429}.
|
|
81
81
|
* @system @alpha
|
|
82
82
|
*/
|
|
83
|
-
export const _APIExtractorWorkaroundObjectBase = sf.
|
|
83
|
+
export const _APIExtractorWorkaroundObjectBase = sf.recordRecursive("object", Tree);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Arbitrary JSON object as a {@link TreeNode}.
|
package/src/packageVersion.ts
CHANGED
|
@@ -592,6 +592,7 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
592
592
|
return undefined;
|
|
593
593
|
}
|
|
594
594
|
// Fall through
|
|
595
|
+
case NodeKind.Record:
|
|
595
596
|
case NodeKind.Object: {
|
|
596
597
|
let storedKey: string | number = propertyKey;
|
|
597
598
|
if (isObjectNodeSchema(schema)) {
|
|
@@ -643,7 +644,8 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
643
644
|
}
|
|
644
645
|
break;
|
|
645
646
|
}
|
|
646
|
-
case NodeKind.Map:
|
|
647
|
+
case NodeKind.Map:
|
|
648
|
+
case NodeKind.Record: {
|
|
647
649
|
for (const [key, flexField] of flexNode.fields) {
|
|
648
650
|
const childTreeNode = tryGetTreeNodeForField(flexField);
|
|
649
651
|
if (childTreeNode !== undefined) {
|
|
@@ -3,13 +3,25 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
assert,
|
|
8
|
+
DoublyLinkedList,
|
|
9
|
+
oob,
|
|
10
|
+
type ListNode,
|
|
11
|
+
type ListNodeRange,
|
|
12
|
+
} from "@fluidframework/core-utils/internal";
|
|
7
13
|
|
|
8
14
|
import type { GraphCommit, TaggedChange } from "../core/index.js";
|
|
9
15
|
import { disposeSymbol, hasSome } from "../util/index.js";
|
|
10
16
|
|
|
11
17
|
import type { ChangeEnricherReadonlyCheckout, ResubmitMachine } from "./index.js";
|
|
12
18
|
|
|
19
|
+
interface PendingChange<TChange> {
|
|
20
|
+
commit: GraphCommit<TChange>;
|
|
21
|
+
lastEnrichment: number;
|
|
22
|
+
}
|
|
23
|
+
type PendingChangeNode<TChange> = ListNode<PendingChange<TChange>>;
|
|
24
|
+
|
|
13
25
|
/**
|
|
14
26
|
* Default implementation of {@link ResubmitMachine}.
|
|
15
27
|
*/
|
|
@@ -17,24 +29,20 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
17
29
|
/**
|
|
18
30
|
* The list of commits (from oldest to most recent) that have been submitted but not sequenced.
|
|
19
31
|
*/
|
|
20
|
-
private inFlightQueue:
|
|
32
|
+
private readonly inFlightQueue: DoublyLinkedList<PendingChange<TChange>> =
|
|
33
|
+
new DoublyLinkedList();
|
|
21
34
|
|
|
22
35
|
/**
|
|
23
|
-
* The
|
|
36
|
+
* The range of in-flight commits that are currently being resubmitted.
|
|
37
|
+
* Defined only during the resubmit phase.
|
|
24
38
|
*/
|
|
25
|
-
private
|
|
39
|
+
private pendingResubmitRange: ListNodeRange<PendingChange<TChange>> | undefined;
|
|
26
40
|
|
|
27
41
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* All in-flight commits with an index inferior or equal to this number have stale enrichments.
|
|
31
|
-
*
|
|
32
|
-
* Is -1 when *any* of the following is true:
|
|
33
|
-
* - There are no in-flight commits (i.e., no local commits have been made or they have all been sequenced)
|
|
34
|
-
* - None of the in-flight commits have been rebased
|
|
35
|
-
* - In-flight commits that have been rebased have all had their enrichments updated
|
|
42
|
+
* The current enrichment version for in-flight commits.
|
|
43
|
+
* Incremented when a peer commit is sequenced.
|
|
36
44
|
*/
|
|
37
|
-
private
|
|
45
|
+
private currentEnrichment: number = 0;
|
|
38
46
|
|
|
39
47
|
public constructor(
|
|
40
48
|
/**
|
|
@@ -49,14 +57,31 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
49
57
|
) {}
|
|
50
58
|
|
|
51
59
|
public onCommitSubmitted(commit: GraphCommit<TChange>): void {
|
|
52
|
-
if (this.
|
|
53
|
-
const toResubmit = this.
|
|
60
|
+
if (this.pendingResubmitRange !== undefined) {
|
|
61
|
+
const toResubmit = this.pendingResubmitRange?.first;
|
|
54
62
|
assert(
|
|
55
|
-
toResubmit === commit,
|
|
63
|
+
toResubmit?.data.commit === commit,
|
|
56
64
|
0x981 /* Unexpected commit submitted during resubmit phase */,
|
|
57
65
|
);
|
|
66
|
+
// If we are not at the last commit to resubmit, advance the range to the next node.
|
|
67
|
+
// Otherwise, clear the resubmit range as we are done resubmitting.
|
|
68
|
+
if (toResubmit !== this.pendingResubmitRange.last) {
|
|
69
|
+
assert(toResubmit.next !== undefined, 0xbd6 /* must be more in the list */);
|
|
70
|
+
this.pendingResubmitRange.first = toResubmit.next;
|
|
71
|
+
} else {
|
|
72
|
+
this.pendingResubmitRange = undefined;
|
|
73
|
+
}
|
|
74
|
+
toResubmit.remove();
|
|
58
75
|
}
|
|
59
|
-
this.inFlightQueue.push(commit);
|
|
76
|
+
this.inFlightQueue.push({ commit, lastEnrichment: this.currentEnrichment });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public onCommitRollback(commit: GraphCommit<TChange>): void {
|
|
80
|
+
assert(
|
|
81
|
+
commit.revision === this.inFlightQueue.last?.data.commit.revision,
|
|
82
|
+
0xbd7 /* must rollback latest commit in the in flight queue */,
|
|
83
|
+
);
|
|
84
|
+
this.inFlightQueue.pop();
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
public prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void {
|
|
@@ -64,16 +89,33 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
64
89
|
!this.isInResubmitPhase,
|
|
65
90
|
0x957 /* Invalid resubmit phase start during incomplete resubmit phase */,
|
|
66
91
|
);
|
|
92
|
+
|
|
93
|
+
if (!hasSome(toResubmit)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
67
97
|
assert(
|
|
68
|
-
toResubmit.length
|
|
69
|
-
|
|
98
|
+
toResubmit.length <= this.inFlightQueue.length,
|
|
99
|
+
0xbd8 /* Unexpected resubmit of more commits than are in flight */,
|
|
70
100
|
);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
|
|
102
|
+
// Find the first in-flight commit to resubmit.
|
|
103
|
+
const first = this.inFlightQueue.find(
|
|
104
|
+
(v) => v.data.commit.revision === toResubmit[0].revision,
|
|
105
|
+
);
|
|
106
|
+
// Always resubmit to the end of all outstanding ops, but the list may grow during resubmit,
|
|
107
|
+
// so we must track the current end at the start of the phase.
|
|
108
|
+
const last = this.inFlightQueue.last;
|
|
109
|
+
assert(
|
|
110
|
+
first !== undefined && last !== undefined,
|
|
111
|
+
0xbd9 /* there must be inflight commits to resubmit */,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
this.pendingResubmitRange = { first, last };
|
|
115
|
+
// If any in-flight commits have stale enrichments, recompute them.
|
|
116
|
+
if (first.data.lastEnrichment < this.currentEnrichment) {
|
|
76
117
|
const checkout = this.tip.fork();
|
|
118
|
+
|
|
77
119
|
// Roll back the checkout to the state before the oldest commit
|
|
78
120
|
for (let iCommit = toResubmit.length - 1; iCommit >= 0; iCommit -= 1) {
|
|
79
121
|
const commit = toResubmit[iCommit] ?? oob();
|
|
@@ -83,32 +125,37 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
83
125
|
// forwards from an earlier fork instead of backwards.
|
|
84
126
|
checkout.applyTipChange(rollback);
|
|
85
127
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const enrichedChange = checkout.updateChangeEnrichments(
|
|
94
|
-
commit.change,
|
|
95
|
-
commit.revision,
|
|
128
|
+
|
|
129
|
+
// Update the enrichments of the stale commits in the in-flight queue.
|
|
130
|
+
let current: PendingChangeNode<TChange> | undefined = first;
|
|
131
|
+
for (const commit of toResubmit) {
|
|
132
|
+
assert(
|
|
133
|
+
current !== undefined,
|
|
134
|
+
0xbda /* there must be an inflight commit for each resubmit commit */,
|
|
96
135
|
);
|
|
97
|
-
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
136
|
+
current.data.commit = commit;
|
|
137
|
+
if (current.data.lastEnrichment < this.currentEnrichment) {
|
|
138
|
+
const enrichedChange = checkout.updateChangeEnrichments(
|
|
139
|
+
commit.change,
|
|
140
|
+
commit.revision,
|
|
141
|
+
);
|
|
142
|
+
const enrichedCommit = { ...commit, change: enrichedChange };
|
|
143
|
+
|
|
144
|
+
// Optimization: only apply the enriched change if the next commit also needs enrichment.
|
|
145
|
+
if (
|
|
146
|
+
current.next !== undefined &&
|
|
147
|
+
current.next.data.lastEnrichment < this.currentEnrichment
|
|
148
|
+
) {
|
|
149
|
+
checkout.applyTipChange(enrichedChange, commit.revision);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
current.data.commit = enrichedCommit;
|
|
153
|
+
current.data.lastEnrichment = this.currentEnrichment;
|
|
101
154
|
}
|
|
102
|
-
|
|
155
|
+
current = current.next;
|
|
103
156
|
}
|
|
104
157
|
checkout[disposeSymbol]();
|
|
105
|
-
// Whatever commits are left do not have stale enrichments
|
|
106
|
-
for (const commit of this.inFlightQueue) {
|
|
107
|
-
this.resubmitQueue.push(commit);
|
|
108
|
-
}
|
|
109
|
-
this.inFlightQueue.length = 0;
|
|
110
158
|
}
|
|
111
|
-
this.latestInFlightCommitWithStaleEnrichments = -1;
|
|
112
159
|
}
|
|
113
160
|
|
|
114
161
|
public peekNextCommit(): GraphCommit<TChange> {
|
|
@@ -116,12 +163,15 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
116
163
|
this.isInResubmitPhase,
|
|
117
164
|
0x982 /* No available commit to resubmit outside of resubmit phase */,
|
|
118
165
|
);
|
|
119
|
-
assert(
|
|
120
|
-
|
|
166
|
+
assert(
|
|
167
|
+
this.pendingResubmitRange !== undefined,
|
|
168
|
+
0xa87 /* Expected resubmit queue to be non-empty */,
|
|
169
|
+
);
|
|
170
|
+
return this.pendingResubmitRange.first.data.commit;
|
|
121
171
|
}
|
|
122
172
|
|
|
123
173
|
public get isInResubmitPhase(): boolean {
|
|
124
|
-
return this.
|
|
174
|
+
return this.pendingResubmitRange !== undefined;
|
|
125
175
|
}
|
|
126
176
|
|
|
127
177
|
public onSequencedCommitApplied(isLocal: boolean): void {
|
|
@@ -129,12 +179,9 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
129
179
|
// The oldest in-flight commit has been sequenced
|
|
130
180
|
assert(this.inFlightQueue.length > 0, 0x959 /* Sequencing of unknown local commit */);
|
|
131
181
|
this.inFlightQueue.shift();
|
|
132
|
-
if (this.latestInFlightCommitWithStaleEnrichments >= 0) {
|
|
133
|
-
this.latestInFlightCommitWithStaleEnrichments -= 1;
|
|
134
|
-
}
|
|
135
182
|
} else {
|
|
136
183
|
// A peer commit has been sequenced
|
|
137
|
-
this.
|
|
184
|
+
this.currentEnrichment++;
|
|
138
185
|
}
|
|
139
186
|
}
|
|
140
187
|
}
|
|
@@ -37,6 +37,13 @@ export interface ResubmitMachine<TChange> {
|
|
|
37
37
|
*/
|
|
38
38
|
onCommitSubmitted(commit: GraphCommit<TChange>): void;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Must be called on a commit after rollback, so it can be removed
|
|
42
|
+
* as it will never be (re)submitted.
|
|
43
|
+
* @param commit - The commit that was rolled back
|
|
44
|
+
*/
|
|
45
|
+
onCommitRollback(commit: GraphCommit<TChange>): void;
|
|
46
|
+
|
|
40
47
|
/**
|
|
41
48
|
* Must be called after a sequenced commit is applied.
|
|
42
49
|
* Note that this may be called multiples times in a row after a number of sequenced commits have been applied
|
|
@@ -397,14 +397,12 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
397
397
|
} = this.messageCodec.decode(this.serializer.decode(content), {
|
|
398
398
|
idCompressor: this.idCompressor,
|
|
399
399
|
});
|
|
400
|
-
const [commit] = this.editManager.findLocalCommit(revision);
|
|
401
400
|
// If a resubmit phase is not already in progress, then this must be the first commit of a new resubmit phase.
|
|
402
401
|
if (this.resubmitMachine.isInResubmitPhase === false) {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
);
|
|
402
|
+
const localCommits = this.editManager.getLocalCommits();
|
|
403
|
+
const revisionIndex = localCommits.findIndex((c) => c.revision === revision);
|
|
404
|
+
assert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);
|
|
405
|
+
const toResubmit = localCommits.slice(revisionIndex);
|
|
408
406
|
this.resubmitMachine.prepareForResubmit(toResubmit);
|
|
409
407
|
}
|
|
410
408
|
assert(
|
|
@@ -418,6 +416,20 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
418
416
|
const enrichedCommit = this.resubmitMachine.peekNextCommit();
|
|
419
417
|
this.submitCommit(enrichedCommit, localOpMetadata, true);
|
|
420
418
|
}
|
|
419
|
+
public rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {
|
|
420
|
+
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
421
|
+
const {
|
|
422
|
+
commit: { revision },
|
|
423
|
+
} = this.messageCodec.decode(this.serializer.decode(content), {
|
|
424
|
+
idCompressor: this.idCompressor,
|
|
425
|
+
});
|
|
426
|
+
const [commit] = this.editManager.findLocalCommit(revision);
|
|
427
|
+
const { parent } = commit;
|
|
428
|
+
assert(parent !== undefined, 0xbdc /* must have parent */);
|
|
429
|
+
const [precedingCommit] = this.editManager.findLocalCommit(parent.revision);
|
|
430
|
+
this.editManager.localBranch.removeAfter(precedingCommit);
|
|
431
|
+
this.resubmitMachine.onCommitRollback(commit);
|
|
432
|
+
}
|
|
421
433
|
|
|
422
434
|
public applyStashedOp(content: JsonCompatibleReadOnly): void {
|
|
423
435
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|