@fluidframework/tree 2.12.0 → 2.20.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 +154 -0
- package/api-report/tree.alpha.api.md +108 -22
- package/api-report/tree.beta.api.md +31 -15
- package/api-report/tree.legacy.alpha.api.md +31 -15
- package/api-report/tree.legacy.public.api.md +31 -15
- package/api-report/tree.public.api.md +31 -15
- package/assertTagging.config.mjs +14 -0
- package/dist/alpha.d.ts +14 -0
- package/dist/beta.d.ts +2 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +5 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +5 -4
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +29 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +22 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/delta.d.ts +21 -26
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +1 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -14
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +1 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +82 -80
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- 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/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +13 -0
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +0 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +186 -216
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +24 -4
- package/dist/feature-libraries/optional-field/optionalField.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.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +4 -4
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +50 -9
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +4 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/package.json +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/shared-tree/index.d.ts +3 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -3
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +10 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +43 -0
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +44 -21
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +41 -35
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/transactionTypes.d.ts +105 -0
- package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
- package/dist/shared-tree/transactionTypes.js +13 -0
- package/dist/shared-tree/transactionTypes.js.map +1 -0
- package/dist/shared-tree/treeApi.d.ts +1 -25
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +4 -8
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +4 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +142 -23
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
- 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 +21 -12
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +5 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +5 -1
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +13 -10
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +60 -0
- 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/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +3 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +2 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +2 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +2 -2
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +47 -1
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +10 -0
- package/dist/util/bTreeUtils.d.ts.map +1 -0
- package/dist/util/bTreeUtils.js +52 -0
- package/dist/util/bTreeUtils.js.map +1 -0
- package/dist/util/idAllocator.d.ts +0 -2
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +0 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +3 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +7 -5
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +95 -43
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +202 -148
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +26 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +17 -2
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +14 -0
- package/lib/beta.d.ts +2 -0
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +2 -2
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +2 -2
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +5 -4
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +26 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +20 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/delta.d.ts +21 -26
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +1 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -12
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +82 -80
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- 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/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +13 -0
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +0 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +0 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +158 -186
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -4
- package/lib/feature-libraries/optional-field/optionalField.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.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +4 -4
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +50 -9
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +4 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +27 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +3 -2
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +10 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +46 -3
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +44 -21
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +40 -34
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionTypes.d.ts +105 -0
- package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
- package/lib/shared-tree/transactionTypes.js +10 -0
- package/lib/shared-tree/transactionTypes.js.map +1 -0
- package/lib/shared-tree/treeApi.d.ts +1 -25
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +1 -5
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +4 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +143 -24
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
- 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 +21 -12
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +5 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +5 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +14 -11
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +60 -0
- 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/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +3 -2
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- 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/leafNodeSchema.d.ts +5 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +2 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +2 -2
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +47 -1
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +10 -0
- package/lib/util/bTreeUtils.d.ts.map +1 -0
- package/lib/util/bTreeUtils.js +47 -0
- package/lib/util/bTreeUtils.js.map +1 -0
- package/lib/util/idAllocator.d.ts +0 -2
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +0 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +3 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +3 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +95 -43
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +200 -144
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +26 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +15 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/core/index.ts +5 -2
- package/src/core/rebase/index.ts +5 -0
- package/src/core/rebase/types.ts +33 -5
- package/src/core/rebase/utils.ts +27 -0
- package/src/core/tree/delta.ts +21 -26
- package/src/core/tree/deltaUtil.ts +1 -16
- package/src/core/tree/index.ts +0 -2
- package/src/core/tree/visitDelta.ts +108 -97
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
- package/src/feature-libraries/deltaUtils.ts +13 -0
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
- package/src/feature-libraries/index.ts +0 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +33 -9
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -4
- package/src/feature-libraries/modular-schema/index.ts +3 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +254 -248
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -26
- package/src/feature-libraries/optional-field/optionalField.ts +37 -8
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/rebase.ts +9 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
- package/src/feature-libraries/sequence-field/utils.ts +54 -11
- package/src/feature-libraries/treeCursorUtils.ts +6 -1
- package/src/index.ts +45 -6
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +16 -3
- package/src/shared-tree/schematizingTreeView.ts +91 -2
- package/src/shared-tree/sharedTree.ts +69 -44
- package/src/shared-tree/transactionTypes.ts +125 -0
- package/src/shared-tree/treeApi.ts +1 -28
- package/src/shared-tree/treeCheckout.ts +166 -25
- package/src/shared-tree-core/sharedTreeCore.ts +1 -1
- package/src/simple-tree/api/index.ts +1 -0
- package/src/simple-tree/api/jsonSchema.ts +7 -0
- package/src/simple-tree/api/schemaFactory.ts +33 -6
- package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
- package/src/simple-tree/api/simpleSchema.ts +6 -1
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
- package/src/simple-tree/api/tree.ts +76 -4
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
- package/src/simple-tree/arrayNode.ts +8 -2
- package/src/simple-tree/core/treeNodeSchema.ts +51 -7
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/objectNode.ts +7 -1
- package/src/simple-tree/objectNodeTypes.ts +4 -1
- package/src/simple-tree/schemaTypes.ts +50 -1
- package/src/simple-tree/toMapTree.ts +1 -1
- package/src/util/bTreeUtils.ts +60 -0
- package/src/util/idAllocator.ts +0 -2
- package/src/util/index.ts +5 -6
- package/src/util/rangeMap.ts +259 -184
- package/src/util/utils.ts +57 -4
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
- package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
- package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
- package/lib/package.json +0 -3
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
package/src/core/tree/index.ts
CHANGED
|
@@ -105,6 +105,8 @@ export function visitDelta(
|
|
|
105
105
|
rootDestructions,
|
|
106
106
|
};
|
|
107
107
|
processBuilds(delta.build, detachConfig, visitor);
|
|
108
|
+
processGlobal(delta.global, detachConfig, visitor);
|
|
109
|
+
processRename(delta.rename, detachConfig);
|
|
108
110
|
visitFieldMarks(delta.fields, visitor, detachConfig);
|
|
109
111
|
fixedPointVisitOfRoots(visitor, detachPassRoots, detachConfig);
|
|
110
112
|
transferRoots(
|
|
@@ -420,52 +422,32 @@ function visitNode(
|
|
|
420
422
|
* (because we want to wait until we are sure content to attach is available as a root)
|
|
421
423
|
*/
|
|
422
424
|
function detachPass(
|
|
423
|
-
|
|
425
|
+
fieldChanges: Delta.FieldChanges,
|
|
424
426
|
visitor: DeltaVisitor,
|
|
425
427
|
config: PassConfig,
|
|
426
428
|
): void {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
// the revision is updated for any refresher data included in the delta that is used
|
|
437
|
-
config.detachedFieldIndex.updateLatestRevision(id, config.latestRevision);
|
|
438
|
-
config.detachPassRoots.set(root, fields);
|
|
439
|
-
config.attachPassRoots.set(root, fields);
|
|
429
|
+
let index = 0;
|
|
430
|
+
for (const mark of fieldChanges) {
|
|
431
|
+
if (mark.fields !== undefined) {
|
|
432
|
+
assert(
|
|
433
|
+
mark.attach === undefined || mark.detach !== undefined,
|
|
434
|
+
0x7d0 /* Invalid nested changes on an additive mark */,
|
|
435
|
+
);
|
|
436
|
+
visitNode(index, mark.fields, visitor, config);
|
|
440
437
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
if (mark.fields !== undefined) {
|
|
449
|
-
assert(
|
|
450
|
-
mark.attach === undefined || mark.detach !== undefined,
|
|
451
|
-
0x7d0 /* Invalid nested changes on an additive mark */,
|
|
452
|
-
);
|
|
453
|
-
visitNode(index, mark.fields, visitor, config);
|
|
454
|
-
}
|
|
455
|
-
if (isDetachMark(mark)) {
|
|
456
|
-
for (let i = 0; i < mark.count; i += 1) {
|
|
457
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
458
|
-
const id = offsetDetachId(mark.detach!, i);
|
|
459
|
-
const root = config.detachedFieldIndex.createEntry(id, config.latestRevision);
|
|
460
|
-
if (mark.fields !== undefined) {
|
|
461
|
-
config.attachPassRoots.set(root, mark.fields);
|
|
462
|
-
}
|
|
463
|
-
const field = config.detachedFieldIndex.toFieldKey(root);
|
|
464
|
-
visitor.detach({ start: index, end: index + 1 }, field);
|
|
438
|
+
if (isDetachMark(mark)) {
|
|
439
|
+
for (let i = 0; i < mark.count; i += 1) {
|
|
440
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
441
|
+
const id = offsetDetachId(mark.detach!, i);
|
|
442
|
+
const root = config.detachedFieldIndex.createEntry(id, config.latestRevision);
|
|
443
|
+
if (mark.fields !== undefined) {
|
|
444
|
+
config.attachPassRoots.set(root, mark.fields);
|
|
465
445
|
}
|
|
466
|
-
|
|
467
|
-
index
|
|
446
|
+
const field = config.detachedFieldIndex.toFieldKey(root);
|
|
447
|
+
visitor.detach({ start: index, end: index + 1 }, field);
|
|
468
448
|
}
|
|
449
|
+
} else if (!isAttachMark(mark)) {
|
|
450
|
+
index += mark.count;
|
|
469
451
|
}
|
|
470
452
|
}
|
|
471
453
|
}
|
|
@@ -499,6 +481,37 @@ function processBuilds(
|
|
|
499
481
|
}
|
|
500
482
|
}
|
|
501
483
|
|
|
484
|
+
function processGlobal(
|
|
485
|
+
global: readonly Delta.DetachedNodeChanges[] | undefined,
|
|
486
|
+
config: PassConfig,
|
|
487
|
+
visitor: DeltaVisitor,
|
|
488
|
+
): void {
|
|
489
|
+
if (global !== undefined) {
|
|
490
|
+
for (const { id, fields } of global) {
|
|
491
|
+
let root = config.detachedFieldIndex.tryGetEntry(id);
|
|
492
|
+
if (root === undefined) {
|
|
493
|
+
const tree = tryGetFromNestedMap(config.refreshers, id.major, id.minor);
|
|
494
|
+
assert(tree !== undefined, 0x928 /* refresher data not found */);
|
|
495
|
+
buildTrees(id, [tree], config.detachedFieldIndex, config.latestRevision, visitor);
|
|
496
|
+
root = config.detachedFieldIndex.getEntry(id);
|
|
497
|
+
}
|
|
498
|
+
// the revision is updated for any refresher data included in the delta that is used
|
|
499
|
+
config.detachedFieldIndex.updateLatestRevision(id, config.latestRevision);
|
|
500
|
+
config.detachPassRoots.set(root, fields);
|
|
501
|
+
config.attachPassRoots.set(root, fields);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function processRename(
|
|
507
|
+
rename: readonly Delta.DetachedNodeRename[] | undefined,
|
|
508
|
+
config: PassConfig,
|
|
509
|
+
): void {
|
|
510
|
+
if (rename !== undefined) {
|
|
511
|
+
config.rootTransfers.push(...rename);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
502
515
|
function collectDestroys(
|
|
503
516
|
destroys: readonly Delta.DetachedNodeDestruction[] | undefined,
|
|
504
517
|
config: PassConfig,
|
|
@@ -515,69 +528,67 @@ function collectDestroys(
|
|
|
515
528
|
* - Collects detached roots (from replaces) that need an attach pass
|
|
516
529
|
*/
|
|
517
530
|
function attachPass(
|
|
518
|
-
|
|
531
|
+
fieldChanges: Delta.FieldChanges,
|
|
519
532
|
visitor: DeltaVisitor,
|
|
520
533
|
config: PassConfig,
|
|
521
534
|
): void {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
config.attachPassRoots.set(rootDestination, mark.fields);
|
|
563
|
-
}
|
|
564
|
-
} else {
|
|
565
|
-
// This a simple attach
|
|
566
|
-
visitor.attach(sourceField, 1, offsetIndex);
|
|
567
|
-
}
|
|
568
|
-
config.detachedFieldIndex.deleteEntry(offsetAttachId);
|
|
569
|
-
const fields = config.attachPassRoots.get(sourceRoot);
|
|
570
|
-
if (fields !== undefined) {
|
|
571
|
-
config.attachPassRoots.delete(sourceRoot);
|
|
572
|
-
visitNode(offsetIndex, fields, visitor, config);
|
|
535
|
+
let index = 0;
|
|
536
|
+
for (const mark of fieldChanges) {
|
|
537
|
+
if (isAttachMark(mark) || isReplaceMark(mark)) {
|
|
538
|
+
for (let i = 0; i < mark.count; i += 1) {
|
|
539
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
540
|
+
const offsetAttachId = offsetDetachId(mark.attach!, i);
|
|
541
|
+
let sourceRoot = config.detachedFieldIndex.tryGetEntry(offsetAttachId);
|
|
542
|
+
if (sourceRoot === undefined) {
|
|
543
|
+
const tree = tryGetFromNestedMap(
|
|
544
|
+
config.refreshers,
|
|
545
|
+
offsetAttachId.major,
|
|
546
|
+
offsetAttachId.minor,
|
|
547
|
+
);
|
|
548
|
+
assert(tree !== undefined, 0x92a /* refresher data not found */);
|
|
549
|
+
buildTrees(
|
|
550
|
+
offsetAttachId,
|
|
551
|
+
[tree],
|
|
552
|
+
config.detachedFieldIndex,
|
|
553
|
+
config.latestRevision,
|
|
554
|
+
visitor,
|
|
555
|
+
);
|
|
556
|
+
sourceRoot = config.detachedFieldIndex.getEntry(offsetAttachId);
|
|
557
|
+
}
|
|
558
|
+
const sourceField = config.detachedFieldIndex.toFieldKey(sourceRoot);
|
|
559
|
+
const offsetIndex = index + i;
|
|
560
|
+
if (isReplaceMark(mark)) {
|
|
561
|
+
const rootDestination = config.detachedFieldIndex.createEntry(
|
|
562
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
563
|
+
offsetDetachId(mark.detach!, i),
|
|
564
|
+
config.latestRevision,
|
|
565
|
+
);
|
|
566
|
+
const destinationField = config.detachedFieldIndex.toFieldKey(rootDestination);
|
|
567
|
+
visitor.replace(
|
|
568
|
+
sourceField,
|
|
569
|
+
{ start: offsetIndex, end: offsetIndex + 1 },
|
|
570
|
+
destinationField,
|
|
571
|
+
);
|
|
572
|
+
// We may need to do a second pass on the detached nodes
|
|
573
|
+
if (mark.fields !== undefined) {
|
|
574
|
+
config.attachPassRoots.set(rootDestination, mark.fields);
|
|
573
575
|
}
|
|
576
|
+
} else {
|
|
577
|
+
// This a simple attach
|
|
578
|
+
visitor.attach(sourceField, 1, offsetIndex);
|
|
579
|
+
}
|
|
580
|
+
config.detachedFieldIndex.deleteEntry(offsetAttachId);
|
|
581
|
+
const fields = config.attachPassRoots.get(sourceRoot);
|
|
582
|
+
if (fields !== undefined) {
|
|
583
|
+
config.attachPassRoots.delete(sourceRoot);
|
|
584
|
+
visitNode(offsetIndex, fields, visitor, config);
|
|
574
585
|
}
|
|
575
|
-
} else if (!isDetachMark(mark) && mark.fields !== undefined) {
|
|
576
|
-
visitNode(index, mark.fields, visitor, config);
|
|
577
|
-
}
|
|
578
|
-
if (!isDetachMark(mark)) {
|
|
579
|
-
index += mark.count;
|
|
580
586
|
}
|
|
587
|
+
} else if (!isDetachMark(mark) && mark.fields !== undefined) {
|
|
588
|
+
visitNode(index, mark.fields, visitor, config);
|
|
589
|
+
}
|
|
590
|
+
if (!isDetachMark(mark)) {
|
|
591
|
+
index += mark.count;
|
|
581
592
|
}
|
|
582
593
|
}
|
|
583
594
|
}
|
|
@@ -160,8 +160,17 @@ export interface IDefaultEditBuilder {
|
|
|
160
160
|
destinationIndex: number,
|
|
161
161
|
): void;
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Add a constraint that the node at the given path must exist.
|
|
165
|
+
* @param path - The path to the node that must exist.
|
|
166
|
+
*/
|
|
164
167
|
addNodeExistsConstraint(path: UpPath): void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Add a constraint that the node at the given path must exist when reverting a change.
|
|
171
|
+
* @param path - The path to the node that must exist when reverting a change.
|
|
172
|
+
*/
|
|
173
|
+
addNodeExistsConstraintOnRevert(path: UpPath): void;
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
/**
|
|
@@ -191,6 +200,10 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
191
200
|
this.modularBuilder.addNodeExistsConstraint(path, this.mintRevisionTag());
|
|
192
201
|
}
|
|
193
202
|
|
|
203
|
+
public addNodeExistsConstraintOnRevert(path: UpPath): void {
|
|
204
|
+
this.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());
|
|
205
|
+
}
|
|
206
|
+
|
|
194
207
|
public valueField(field: FieldUpPath): ValueFieldEditBuilder<ITreeCursorSynchronous> {
|
|
195
208
|
return {
|
|
196
209
|
set: (newContent: ITreeCursorSynchronous): void => {
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
import {
|
|
7
7
|
type ChangeAtomId,
|
|
8
8
|
type DeltaDetachedNodeId,
|
|
9
|
-
type DeltaFieldChanges,
|
|
10
9
|
type FieldKindIdentifier,
|
|
11
10
|
forbiddenFieldKindIdentifier,
|
|
12
11
|
Multiplicity,
|
|
13
12
|
} from "../../core/index.js";
|
|
14
13
|
import { fail } from "../../util/index.js";
|
|
15
14
|
import {
|
|
15
|
+
type FieldChangeDelta,
|
|
16
16
|
type FieldChangeHandler,
|
|
17
17
|
type FieldEditor,
|
|
18
18
|
type FieldKindConfiguration,
|
|
@@ -43,7 +43,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
|
|
|
43
43
|
}),
|
|
44
44
|
codecsFactory: () => noChangeCodecFamily,
|
|
45
45
|
editor: { buildChildChange: (index, change) => fail("Child changes not supported") },
|
|
46
|
-
intoDelta: (change, deltaFromChild: ToDelta):
|
|
46
|
+
intoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),
|
|
47
47
|
relevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],
|
|
48
48
|
isEmpty: (change: 0) => true,
|
|
49
49
|
getNestedChanges: (change: 0) => [],
|
|
@@ -39,5 +39,18 @@ export function mapRootChanges<TIn, TOut>(
|
|
|
39
39
|
trees: trees.map(func),
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
|
+
if (root.global !== undefined) {
|
|
43
|
+
out.global = root.global.map(({ id, fields }) => ({
|
|
44
|
+
id,
|
|
45
|
+
fields,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
if (root.rename !== undefined) {
|
|
49
|
+
out.rename = root.rename.map(({ count, oldId, newId }) => ({
|
|
50
|
+
count,
|
|
51
|
+
oldId,
|
|
52
|
+
newId,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
42
55
|
return out;
|
|
43
56
|
}
|
|
@@ -150,12 +150,7 @@ export class ForestSummarizer implements Summarizable {
|
|
|
150
150
|
id: buildId,
|
|
151
151
|
trees: nodeCursors,
|
|
152
152
|
});
|
|
153
|
-
fieldChanges.push([
|
|
154
|
-
fieldKey,
|
|
155
|
-
{
|
|
156
|
-
local: [{ count: nodeCursors.length, attach: buildId }],
|
|
157
|
-
},
|
|
158
|
-
]);
|
|
153
|
+
fieldChanges.push([fieldKey, [{ count: nodeCursors.length, attach: buildId }]]);
|
|
159
154
|
}
|
|
160
155
|
|
|
161
156
|
assert(this.forest.isEmpty, 0x797 /* forest must be empty */);
|
|
@@ -16,7 +16,6 @@ export {
|
|
|
16
16
|
mapTreeFromCursor,
|
|
17
17
|
mapTreeFieldFromCursor,
|
|
18
18
|
} from "./mapTreeCursor.js";
|
|
19
|
-
export { MemoizedIdRangeAllocator, type IdRange } from "./memoizedIdRangeAllocator.js";
|
|
20
19
|
export { buildForest } from "./object-forest/index.js";
|
|
21
20
|
export { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from "./schema-index/index.js";
|
|
22
21
|
export {
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "../../util/index.js";
|
|
6
|
+
import type {
|
|
7
|
+
ChangeAtomId,
|
|
8
|
+
ChangeAtomIdRangeMap,
|
|
9
|
+
ChangesetLocalId,
|
|
10
|
+
RevisionTag,
|
|
11
|
+
} from "../../core/index.js";
|
|
12
|
+
import type { RangeQueryResult } from "../../util/index.js";
|
|
14
13
|
import type { NodeId } from "./modularChangeTypes.js";
|
|
15
14
|
|
|
16
|
-
export type CrossFieldMap<T> =
|
|
15
|
+
export type CrossFieldMap<T> = ChangeAtomIdRangeMap<T>;
|
|
17
16
|
export type CrossFieldQuerySet = CrossFieldMap<boolean>;
|
|
18
17
|
|
|
19
18
|
export function addCrossFieldQuery(
|
|
@@ -32,7 +31,7 @@ export function setInCrossFieldMap<T>(
|
|
|
32
31
|
count: number,
|
|
33
32
|
value: T,
|
|
34
33
|
): void {
|
|
35
|
-
|
|
34
|
+
map.set({ revision, localId: id }, count, value);
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export function getFirstFromCrossFieldMap<T>(
|
|
@@ -40,8 +39,8 @@ export function getFirstFromCrossFieldMap<T>(
|
|
|
40
39
|
revision: RevisionTag | undefined,
|
|
41
40
|
id: ChangesetLocalId,
|
|
42
41
|
count: number,
|
|
43
|
-
): RangeQueryResult<T> {
|
|
44
|
-
return
|
|
42
|
+
): RangeQueryResult<ChangeAtomId, T> {
|
|
43
|
+
return map.getFirst({ revision, localId: id }, count);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
@@ -66,7 +65,7 @@ export interface CrossFieldManager<T = unknown> {
|
|
|
66
65
|
id: ChangesetLocalId,
|
|
67
66
|
count: number,
|
|
68
67
|
addDependency: boolean,
|
|
69
|
-
): RangeQueryResult<T>;
|
|
68
|
+
): RangeQueryResult<ChangeAtomId, T>;
|
|
70
69
|
|
|
71
70
|
/**
|
|
72
71
|
* Sets the range of keys to `newValue`.
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
import type { ICodecFamily, IJsonCodec } from "../../codec/index.js";
|
|
7
7
|
import type {
|
|
8
8
|
ChangeEncodingContext,
|
|
9
|
+
DeltaDetachedNodeChanges,
|
|
9
10
|
DeltaDetachedNodeId,
|
|
11
|
+
DeltaDetachedNodeRename,
|
|
10
12
|
DeltaFieldChanges,
|
|
11
13
|
DeltaFieldMap,
|
|
12
14
|
EncodedRevisionTag,
|
|
@@ -14,12 +16,35 @@ import type {
|
|
|
14
16
|
RevisionTag,
|
|
15
17
|
} from "../../core/index.js";
|
|
16
18
|
import type { IdAllocator, Invariant } from "../../util/index.js";
|
|
17
|
-
import type { MemoizedIdRangeAllocator } from "../memoizedIdRangeAllocator.js";
|
|
18
19
|
|
|
19
20
|
import type { CrossFieldManager } from "./crossFieldQueries.js";
|
|
20
21
|
import type { CrossFieldKeyRange, NodeId } from "./modularChangeTypes.js";
|
|
21
22
|
import type { EncodedNodeChangeset } from "./modularChangeFormat.js";
|
|
22
23
|
|
|
24
|
+
export type NestedChangesIndices = [
|
|
25
|
+
NodeId,
|
|
26
|
+
number | undefined /* inputIndex */,
|
|
27
|
+
number | undefined /* outputIndex */,
|
|
28
|
+
][];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The return value of calling {@link FieldChangeHandler.intoDelta}.
|
|
32
|
+
*/
|
|
33
|
+
export interface FieldChangeDelta {
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritdoc DeltaFieldChanges}
|
|
36
|
+
*/
|
|
37
|
+
readonly local?: DeltaFieldChanges;
|
|
38
|
+
/**
|
|
39
|
+
* {@inheritdoc DeltaRoot.global}
|
|
40
|
+
*/
|
|
41
|
+
readonly global?: readonly DeltaDetachedNodeChanges[];
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritdoc DeltaRoot.rename}
|
|
44
|
+
*/
|
|
45
|
+
readonly rename?: readonly DeltaDetachedNodeRename[];
|
|
46
|
+
}
|
|
47
|
+
|
|
23
48
|
/**
|
|
24
49
|
* Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to
|
|
25
50
|
* implement a unified ChangeFamily supporting documents with multiple field kinds.
|
|
@@ -39,11 +64,7 @@ export interface FieldChangeHandler<
|
|
|
39
64
|
>,
|
|
40
65
|
) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;
|
|
41
66
|
readonly editor: TEditor;
|
|
42
|
-
intoDelta(
|
|
43
|
-
change: TChangeset,
|
|
44
|
-
deltaFromChild: ToDelta,
|
|
45
|
-
idAllocator: MemoizedIdRangeAllocator,
|
|
46
|
-
): DeltaFieldChanges;
|
|
67
|
+
intoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;
|
|
47
68
|
/**
|
|
48
69
|
* Returns the set of removed roots that should be in memory for the given change to be applied.
|
|
49
70
|
* A removed root is relevant if any of the following is true:
|
|
@@ -75,13 +96,16 @@ export interface FieldChangeHandler<
|
|
|
75
96
|
* @param change - The field change to get the child changes from.
|
|
76
97
|
*
|
|
77
98
|
* @returns The set of `NodeId`s that correspond to nested changes in the given `change`.
|
|
78
|
-
* Each `NodeId` is associated with the
|
|
79
|
-
*
|
|
99
|
+
* Each `NodeId` is associated with the following:
|
|
100
|
+
* - index of the node in the field in the input context of the changeset (or `undefined` if the node is not
|
|
101
|
+
* attached in the input context).
|
|
102
|
+
* - index of the node in the field in the output context of the changeset (or `undefined` if the node is not
|
|
103
|
+
* attached in the output context).
|
|
80
104
|
* For all returned entries where the index is defined,
|
|
81
105
|
* the indices are are ordered from smallest to largest (with no duplicates).
|
|
82
106
|
* The returned array is owned by the caller.
|
|
83
107
|
*/
|
|
84
|
-
getNestedChanges(change: TChangeset):
|
|
108
|
+
getNestedChanges(change: TChangeset): NestedChangesIndices;
|
|
85
109
|
|
|
86
110
|
/**
|
|
87
111
|
* @returns A list of all cross-field keys contained in the change.
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
type DeltaDetachedNodeId,
|
|
8
|
-
type DeltaFieldChanges,
|
|
9
8
|
type DeltaMark,
|
|
10
9
|
type RevisionMetadataSource,
|
|
11
10
|
Multiplicity,
|
|
@@ -16,7 +15,9 @@ import { type IdAllocator, fail } from "../../util/index.js";
|
|
|
16
15
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
17
16
|
import type { CrossFieldManager } from "./crossFieldQueries.js";
|
|
18
17
|
import type {
|
|
18
|
+
FieldChangeDelta,
|
|
19
19
|
FieldChangeHandler,
|
|
20
|
+
NestedChangesIndices,
|
|
20
21
|
NodeChangeComposer,
|
|
21
22
|
NodeChangePruner,
|
|
22
23
|
NodeChangeRebaser,
|
|
@@ -46,7 +47,7 @@ export const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {
|
|
|
46
47
|
return newGenericChangeset([[index, change]]);
|
|
47
48
|
},
|
|
48
49
|
},
|
|
49
|
-
intoDelta: (change: GenericChangeset, deltaFromChild: ToDelta):
|
|
50
|
+
intoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {
|
|
50
51
|
let nodeIndex = 0;
|
|
51
52
|
const markList: DeltaMark[] = [];
|
|
52
53
|
for (const [index, nodeChange] of change.entries()) {
|
|
@@ -82,8 +83,9 @@ function compose(
|
|
|
82
83
|
return composed;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
function getNestedChanges(change: GenericChangeset):
|
|
86
|
-
|
|
86
|
+
function getNestedChanges(change: GenericChangeset): NestedChangesIndices {
|
|
87
|
+
// For generic changeset, the indices in the input and output contexts are the same.
|
|
88
|
+
return change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
function rebaseGenericChange(
|
|
@@ -29,6 +29,7 @@ export { FlexFieldKind, type FullSchemaPolicy } from "./fieldKind.js";
|
|
|
29
29
|
export { FieldKindWithEditor } from "./fieldKindWithEditor.js";
|
|
30
30
|
export {
|
|
31
31
|
type FieldChangeHandler,
|
|
32
|
+
type FieldChangeDelta,
|
|
32
33
|
type FieldChangeRebaser,
|
|
33
34
|
type FieldEditor,
|
|
34
35
|
type NodeChangeComposer,
|
|
@@ -41,8 +42,10 @@ export {
|
|
|
41
42
|
type ToDelta,
|
|
42
43
|
NodeAttachState,
|
|
43
44
|
type FieldChangeEncodingContext,
|
|
45
|
+
type NestedChangesIndices,
|
|
44
46
|
} from "./fieldChangeHandler.js";
|
|
45
47
|
export type {
|
|
48
|
+
CrossFieldKey,
|
|
46
49
|
CrossFieldKeyRange,
|
|
47
50
|
FieldChange,
|
|
48
51
|
FieldChangeMap,
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
brand,
|
|
33
33
|
fail,
|
|
34
34
|
idAllocatorFromMaxId,
|
|
35
|
+
newTupleBTree,
|
|
35
36
|
} from "../../util/index.js";
|
|
36
37
|
import {
|
|
37
38
|
type FieldBatchCodec,
|
|
@@ -55,17 +56,17 @@ import {
|
|
|
55
56
|
type EncodedNodeChangeset,
|
|
56
57
|
type EncodedRevisionInfo,
|
|
57
58
|
} from "./modularChangeFormat.js";
|
|
58
|
-
import
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
import {
|
|
60
|
+
newCrossFieldKeyTable,
|
|
61
|
+
type ChangeAtomIdBTree,
|
|
62
|
+
type FieldChangeMap,
|
|
63
|
+
type FieldChangeset,
|
|
64
|
+
type FieldId,
|
|
65
|
+
type ModularChangeset,
|
|
66
|
+
type NodeChangeset,
|
|
67
|
+
type NodeId,
|
|
66
68
|
} from "./modularChangeTypes.js";
|
|
67
69
|
import type { FieldChangeEncodingContext, FieldChangeHandler } from "./fieldChangeHandler.js";
|
|
68
|
-
import { newCrossFieldKeyTable, newTupleBTree } from "./modularChangeFamily.js";
|
|
69
70
|
|
|
70
71
|
export function makeModularChangeCodecFamily(
|
|
71
72
|
fieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration>,
|
|
@@ -276,8 +277,8 @@ function makeModularChangeCodec(
|
|
|
276
277
|
fieldChangeset,
|
|
277
278
|
);
|
|
278
279
|
|
|
279
|
-
for (const
|
|
280
|
-
decoded.crossFieldKeys.set(
|
|
280
|
+
for (const { key, count } of crossFieldKeys) {
|
|
281
|
+
decoded.crossFieldKeys.set(key, count, fieldId);
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
const fieldKey: FieldKey = brand<FieldKey>(field.fieldKey);
|