@fluidframework/tree 2.21.0 → 2.23.0-323641
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 +10 -0
- package/README.md +1 -0
- package/api-report/tree.alpha.api.md +29 -4
- package/api-report/tree.beta.api.md +29 -4
- package/api-report/tree.legacy.alpha.api.md +29 -4
- package/api-report/tree.legacy.public.api.md +29 -4
- package/api-report/tree.public.api.md +29 -4
- package/dist/alpha.d.ts +1 -0
- package/dist/beta.d.ts +1 -0
- package/dist/core/forest/editableForest.js +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +2 -5
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +16 -162
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +0 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- 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 +2 -4
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +16 -18
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +7 -3
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +1 -0
- package/dist/shared-tree/index.d.ts +1 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -7
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +9 -10
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +40 -39
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +84 -52
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +2 -2
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +9 -3
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +3 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +3 -2
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +11 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +64 -29
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +2 -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/sequenceIdUtils.d.ts +12 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +33 -30
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +62 -56
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -2
- 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/schemaFactory.d.ts +156 -63
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +179 -86
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +23 -2
- 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/index.d.ts +1 -1
- 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/schemaTypes.d.ts +2 -2
- package/dist/simple-tree/schemaTypes.js +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +1 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +16 -5
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +21 -12
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +1 -1
- package/dist/util/rangeMap.js +1 -1
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +16 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +29 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/beta.d.ts +1 -0
- package/lib/core/forest/editableForest.js +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +2 -5
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +17 -163
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +0 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- 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 +2 -4
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +17 -19
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +7 -3
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +1 -0
- package/lib/shared-tree/index.d.ts +1 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -3
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -5
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +40 -39
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +82 -50
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +2 -2
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +8 -2
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +3 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +4 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +11 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +65 -30
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +2 -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/sequenceIdUtils.d.ts +12 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +33 -30
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +61 -55
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -2
- 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/schemaFactory.d.ts +156 -63
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +178 -85
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +23 -2
- 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/index.d.ts +1 -1
- 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/schemaTypes.d.ts +2 -2
- package/lib/simple-tree/schemaTypes.js +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +16 -5
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +20 -11
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +1 -1
- package/lib/util/rangeMap.js +1 -1
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +16 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +27 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/forest/editableForest.ts +1 -1
- package/src/core/index.ts +0 -3
- package/src/core/tree/anchorSet.ts +38 -221
- package/src/core/tree/index.ts +0 -3
- package/src/core/tree/pathTree.ts +0 -13
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
- package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +18 -48
- package/src/feature-libraries/optional-field/optionalField.ts +10 -3
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
- package/src/index.ts +15 -12
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -19
- package/src/shared-tree/schematizingTreeView.ts +18 -16
- package/src/shared-tree/sharedTree.ts +208 -100
- package/src/shared-tree/treeApi.ts +10 -1
- package/src/shared-tree/treeCheckout.ts +11 -8
- package/src/shared-tree-core/editManager.ts +80 -43
- package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
- package/src/shared-tree-core/resubmitMachine.ts +2 -0
- package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
- package/src/shared-tree-core/sharedTreeCore.ts +88 -99
- package/src/simple-tree/api/index.ts +15 -0
- package/src/simple-tree/api/schemaFactory.ts +203 -89
- package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
- package/src/simple-tree/api/tree.ts +31 -6
- package/src/simple-tree/index.ts +12 -0
- package/src/simple-tree/schemaTypes.ts +2 -2
- package/src/treeFactory.ts +29 -11
- package/src/util/breakable.ts +1 -1
- package/src/util/index.ts +1 -0
- package/src/util/rangeMap.ts +1 -1
- package/src/util/utils.ts +32 -0
- package/dist/core/tree/visitPath.d.ts +0 -101
- package/dist/core/tree/visitPath.d.ts.map +0 -1
- package/dist/core/tree/visitPath.js +0 -7
- package/dist/core/tree/visitPath.js.map +0 -1
- package/dist/shared-tree/publicContracts.d.ts +0 -18
- package/dist/shared-tree/publicContracts.d.ts.map +0 -1
- package/dist/shared-tree/publicContracts.js +0 -24
- package/dist/shared-tree/publicContracts.js.map +0 -1
- package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
- package/lib/core/tree/visitPath.d.ts +0 -101
- package/lib/core/tree/visitPath.d.ts.map +0 -1
- package/lib/core/tree/visitPath.js +0 -6
- package/lib/core/tree/visitPath.js.map +0 -1
- package/lib/shared-tree/publicContracts.d.ts +0 -18
- package/lib/shared-tree/publicContracts.d.ts.map +0 -1
- package/lib/shared-tree/publicContracts.js +0 -21
- package/lib/shared-tree/publicContracts.js.map +0 -1
- package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
- package/src/core/tree/visitPath.ts +0 -124
- package/src/shared-tree/publicContracts.ts +0 -24
- /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
- /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
SummarySessionBranch,
|
|
32
32
|
} from "./editManagerFormat.js";
|
|
33
33
|
import {
|
|
34
|
-
|
|
34
|
+
getUpperBoundOfPreviousSequenceId,
|
|
35
35
|
equalSequenceIds,
|
|
36
36
|
maxSequenceId,
|
|
37
37
|
minSequenceId,
|
|
@@ -362,7 +362,7 @@ export class EditManager<
|
|
|
362
362
|
if (minimumBranchBaseSequenceId !== undefined) {
|
|
363
363
|
// If that branch is behind the minimum sequence id, we only want to evict commits older than it,
|
|
364
364
|
// even if those commits are behind the minimum sequence id
|
|
365
|
-
const sequenceIdBeforeMinimumBranchBase =
|
|
365
|
+
const sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(
|
|
366
366
|
minimumBranchBaseSequenceId,
|
|
367
367
|
);
|
|
368
368
|
trunkTailSequenceId = minSequenceId(
|
|
@@ -472,7 +472,7 @@ export class EditManager<
|
|
|
472
472
|
// `EditManager` would have to be amended in one of two ways:
|
|
473
473
|
// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.
|
|
474
474
|
// B) The contents of such a branch should be computed on demand based on the trunk.
|
|
475
|
-
// Note that option (A) would be a simple change to `
|
|
475
|
+
// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require
|
|
476
476
|
// rebasing trunk changes over the inverse of trunk changes.
|
|
477
477
|
assert(
|
|
478
478
|
this.localBranch.getHead() === this.trunk.getHead(),
|
|
@@ -646,24 +646,45 @@ export class EditManager<
|
|
|
646
646
|
return Math.max(max, localPath.length);
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
-
|
|
650
|
-
|
|
649
|
+
/* eslint-disable jsdoc/check-indentation */
|
|
650
|
+
/**
|
|
651
|
+
* Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:
|
|
652
|
+
* - They are not interleaved with messages from other DDSes in the container.
|
|
653
|
+
* - They are all part of the same batch, which entails:
|
|
654
|
+
* - They are contiguous in sequencing order.
|
|
655
|
+
* - They are all from the same client.
|
|
656
|
+
* - They are all based on the same reference sequence number.
|
|
657
|
+
* - They are not interleaved with messages from other clients.
|
|
658
|
+
*/
|
|
659
|
+
/* eslint-enable jsdoc/check-indentation */
|
|
660
|
+
public addSequencedChanges(
|
|
661
|
+
newCommits: readonly GraphCommit<TChangeset>[],
|
|
662
|
+
sessionId: SessionId,
|
|
651
663
|
sequenceNumber: SeqNumber,
|
|
652
664
|
referenceSequenceNumber: SeqNumber,
|
|
653
665
|
): void {
|
|
666
|
+
assert(newCommits.length > 0, "Expected at least one sequenced change");
|
|
654
667
|
assert(
|
|
655
668
|
sequenceNumber > this.minimumSequenceNumber,
|
|
656
669
|
0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,
|
|
657
670
|
);
|
|
658
|
-
|
|
659
671
|
assert(
|
|
660
672
|
sequenceNumber >= // This is ">=", not ">" because changes in the same batch will have the same sequence number
|
|
661
673
|
(this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),
|
|
662
674
|
0xa64 /* Attempted to sequence change with an outdated sequence number */,
|
|
663
675
|
);
|
|
664
676
|
|
|
677
|
+
// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the
|
|
678
|
+
// same sequence number, only the index in the batch needs to be incremented.
|
|
679
|
+
const getNextSequenceId = (sequenceId: SequenceId): SequenceId => {
|
|
680
|
+
return {
|
|
681
|
+
sequenceNumber: sequenceId.sequenceNumber,
|
|
682
|
+
indexInBatch: (sequenceId.indexInBatch ?? 0) + 1,
|
|
683
|
+
};
|
|
684
|
+
};
|
|
665
685
|
const commitsSequenceNumber = this.getBatch(sequenceNumber);
|
|
666
|
-
|
|
686
|
+
// The sequence id for the next commit to be processed in the bunch.
|
|
687
|
+
let nextSequenceId =
|
|
667
688
|
commitsSequenceNumber.length === 0
|
|
668
689
|
? {
|
|
669
690
|
sequenceNumber,
|
|
@@ -673,49 +694,65 @@ export class EditManager<
|
|
|
673
694
|
indexInBatch: commitsSequenceNumber.length,
|
|
674
695
|
};
|
|
675
696
|
|
|
676
|
-
|
|
677
|
-
|
|
697
|
+
// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto
|
|
698
|
+
// the trunk.
|
|
699
|
+
if (sessionId === this.localSessionId) {
|
|
700
|
+
for (const _ of newCommits) {
|
|
701
|
+
this.fastForwardNextLocalCommit(nextSequenceId);
|
|
702
|
+
nextSequenceId = getNextSequenceId(nextSequenceId);
|
|
703
|
+
}
|
|
704
|
+
return;
|
|
678
705
|
}
|
|
679
706
|
|
|
680
|
-
//
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
// If the branch is fully caught up and empty after being rebased, then push to the trunk directly
|
|
693
|
-
this.pushCommitToTrunk(sequenceId, newCommit);
|
|
694
|
-
peerLocalBranch.setHead(this.trunk.getHead());
|
|
695
|
-
} else {
|
|
696
|
-
// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
|
|
697
|
-
const { duration, output: newChangeFullyRebased } = measure(() =>
|
|
698
|
-
rebaseChange(
|
|
699
|
-
this.changeFamily.rebaser,
|
|
700
|
-
newCommit,
|
|
701
|
-
peerLocalBranch.getHead(),
|
|
702
|
-
this.trunk.getHead(),
|
|
703
|
-
this.mintRevisionTag,
|
|
704
|
-
),
|
|
707
|
+
// Remote changes, i.e., changes from remote clients are applied in three steps.
|
|
708
|
+
for (const newCommit of newCommits) {
|
|
709
|
+
// Step 1 - Recreate the peer remote client's local environment.
|
|
710
|
+
// Get the revision that the remote change is based on
|
|
711
|
+
const [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);
|
|
712
|
+
// Rebase that peer local branch over the part of the trunk up to the base revision
|
|
713
|
+
// This will be a no-op if the sending client has not advanced since the last time we received an edit from it
|
|
714
|
+
const peerLocalBranch = getOrCreate(
|
|
715
|
+
this.peerLocalBranches,
|
|
716
|
+
sessionId,
|
|
717
|
+
() =>
|
|
718
|
+
new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),
|
|
705
719
|
);
|
|
720
|
+
peerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);
|
|
706
721
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
722
|
+
// Step 2 - Append the change to the peer branch. Rebase the change to the tip of the trunk.
|
|
723
|
+
if (peerLocalBranch.getHead() === this.trunk.getHead()) {
|
|
724
|
+
// If the branch is fully caught up and empty after being rebased, then push to the trunk directly
|
|
725
|
+
this.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });
|
|
726
|
+
peerLocalBranch.setHead(this.trunk.getHead());
|
|
727
|
+
} else {
|
|
728
|
+
// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
|
|
729
|
+
const { duration, output: newChangeFullyRebased } = measure(() =>
|
|
730
|
+
rebaseChange(
|
|
731
|
+
this.changeFamily.rebaser,
|
|
732
|
+
newCommit,
|
|
733
|
+
peerLocalBranch.getHead(),
|
|
734
|
+
this.trunk.getHead(),
|
|
735
|
+
this.mintRevisionTag,
|
|
736
|
+
),
|
|
737
|
+
);
|
|
711
738
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
739
|
+
this.telemetryEventBatcher?.accumulateAndLog({
|
|
740
|
+
duration,
|
|
741
|
+
...newChangeFullyRebased.telemetryProperties,
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
peerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));
|
|
745
|
+
this.pushCommitToTrunk(nextSequenceId, {
|
|
746
|
+
...newCommit,
|
|
747
|
+
sessionId,
|
|
748
|
+
change: newChangeFullyRebased.change,
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
nextSequenceId = getNextSequenceId(nextSequenceId);
|
|
717
753
|
}
|
|
718
754
|
|
|
755
|
+
// Step 3 - Rebase the local branch over the updated trunk.
|
|
719
756
|
this.localBranch.rebaseOnto(this.trunk);
|
|
720
757
|
}
|
|
721
758
|
|
|
@@ -7,7 +7,6 @@ import { bufferToString } from "@fluid-internal/client-utils";
|
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
9
9
|
import type {
|
|
10
|
-
IGarbageCollectionData,
|
|
11
10
|
ISummaryTreeWithStats,
|
|
12
11
|
ITelemetryContext,
|
|
13
12
|
} from "@fluidframework/runtime-definitions/internal";
|
|
@@ -78,16 +77,6 @@ export class EditManagerSummarizer<TChangeset> implements Summarizable {
|
|
|
78
77
|
return createSingleBlobSummary(stringKey, dataString);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
public getGCData(fullGC?: boolean): IGarbageCollectionData {
|
|
82
|
-
// TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
|
|
83
|
-
// by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
|
|
84
|
-
// to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
|
|
85
|
-
// blob.
|
|
86
|
-
return {
|
|
87
|
-
gcNodes: {},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
80
|
public async load(
|
|
92
81
|
services: IChannelStorageService,
|
|
93
82
|
parse: SummaryElementParser,
|
|
@@ -39,6 +39,8 @@ export interface ResubmitMachine<TChange> {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Must be called after a sequenced commit is applied.
|
|
42
|
+
* Note that this may be called multiples times in a row after a number of sequenced commits have been applied
|
|
43
|
+
* (as opposed to always being called before the next sequenced commit is applied).
|
|
42
44
|
* @param isLocal - whether the sequenced commit was generated by the local session.
|
|
43
45
|
*/
|
|
44
46
|
onSequencedCommitApplied(isLocal: boolean): void;
|
|
@@ -3,25 +3,46 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
7
|
import { brand } from "../util/index.js";
|
|
7
8
|
|
|
8
9
|
import type { SequenceId } from "./editManagerFormat.js";
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Compares two sequenceIds. Returns a negative number if a \< b, a positive number if a \> b, and 0 if a === b.
|
|
13
|
+
* Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.
|
|
14
|
+
*/
|
|
10
15
|
export const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>
|
|
11
16
|
a.sequenceNumber !== b.sequenceNumber
|
|
12
17
|
? a.sequenceNumber - b.sequenceNumber
|
|
13
|
-
:
|
|
18
|
+
: a.indexInBatch === b.indexInBatch
|
|
19
|
+
? 0
|
|
20
|
+
: (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);
|
|
14
21
|
export const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>
|
|
15
22
|
sequenceIdComparator(a, b) === 0;
|
|
16
23
|
export const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>
|
|
17
24
|
sequenceIdComparator(a, b) < 0 ? a : b;
|
|
18
25
|
export const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>
|
|
19
26
|
sequenceIdComparator(a, b) > 0 ? a : b;
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.
|
|
29
|
+
* Some examples:
|
|
30
|
+
* 1. sequenceId = \{ sequenceNumber: 1, indexInBatch: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: 1 \}.
|
|
31
|
+
* 2. sequenceId = \{ sequenceNumber: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \}.
|
|
32
|
+
* The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.
|
|
33
|
+
*/
|
|
34
|
+
export const getUpperBoundOfPreviousSequenceId = (sequenceId: SequenceId): SequenceId => {
|
|
35
|
+
assert(
|
|
36
|
+
sequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch),
|
|
37
|
+
0xabc /* indexInBatch must not be infinity */,
|
|
38
|
+
);
|
|
39
|
+
return sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0
|
|
22
40
|
? {
|
|
41
|
+
sequenceNumber: brand(sequenceId.sequenceNumber - 1),
|
|
42
|
+
indexInBatch: Number.POSITIVE_INFINITY,
|
|
43
|
+
}
|
|
44
|
+
: {
|
|
23
45
|
sequenceNumber: brand(sequenceId.sequenceNumber),
|
|
24
46
|
indexInBatch: sequenceId.indexInBatch - 1,
|
|
25
|
-
}
|
|
26
|
-
: { sequenceNumber: brand(sequenceId.sequenceNumber - 1) };
|
|
47
|
+
};
|
|
27
48
|
};
|
|
@@ -4,24 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
IFluidDataStoreRuntime,
|
|
10
|
-
IChannelStorageService,
|
|
11
|
-
} from "@fluidframework/datastore-definitions/internal";
|
|
12
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
|
+
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
+
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
13
9
|
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
14
10
|
import type {
|
|
15
11
|
IExperimentalIncrementalSummaryContext,
|
|
16
|
-
|
|
12
|
+
IRuntimeMessageCollection,
|
|
17
13
|
ISummaryTreeWithStats,
|
|
18
14
|
ITelemetryContext,
|
|
19
15
|
} from "@fluidframework/runtime-definitions/internal";
|
|
20
16
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
21
|
-
import {
|
|
22
|
-
type IFluidSerializer,
|
|
23
|
-
SharedObject,
|
|
24
|
-
} from "@fluidframework/shared-object-base/internal";
|
|
17
|
+
import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
|
|
25
18
|
|
|
26
19
|
import type { ICodecOptions, IJsonCodec } from "../codec/index.js";
|
|
27
20
|
import {
|
|
@@ -39,7 +32,7 @@ import {
|
|
|
39
32
|
import {
|
|
40
33
|
type JsonCompatibleReadOnly,
|
|
41
34
|
brand,
|
|
42
|
-
Breakable,
|
|
35
|
+
type Breakable,
|
|
43
36
|
type WithBreakable,
|
|
44
37
|
throwIfBroken,
|
|
45
38
|
breakingClass,
|
|
@@ -57,6 +50,8 @@ import type { ResubmitMachine } from "./resubmitMachine.js";
|
|
|
57
50
|
import { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
|
|
58
51
|
import { BranchCommitEnricher } from "./branchCommitEnricher.js";
|
|
59
52
|
import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
|
|
53
|
+
import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
54
|
+
import type { IChannelView } from "../shared-tree/index.js";
|
|
60
55
|
|
|
61
56
|
// TODO: Organize this to be adjacent to persisted types.
|
|
62
57
|
const summarizablesTreeKey = "indexes";
|
|
@@ -75,11 +70,8 @@ export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
|
|
|
75
70
|
*/
|
|
76
71
|
@breakingClass
|
|
77
72
|
export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
78
|
-
extends SharedObject
|
|
79
73
|
implements WithBreakable
|
|
80
74
|
{
|
|
81
|
-
public readonly breaker: Breakable = new Breakable("Shared Tree");
|
|
82
|
-
|
|
83
75
|
private readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;
|
|
84
76
|
private readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];
|
|
85
77
|
/**
|
|
@@ -89,14 +81,6 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
89
81
|
*/
|
|
90
82
|
private detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;
|
|
91
83
|
|
|
92
|
-
/**
|
|
93
|
-
* Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
|
|
94
|
-
* If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
|
|
95
|
-
*/
|
|
96
|
-
public get editor(): TEditor {
|
|
97
|
-
return this.getLocalBranch().editor;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
84
|
/**
|
|
101
85
|
* Used to encode/decode messages sent to/received from the Fluid runtime.
|
|
102
86
|
*
|
|
@@ -113,12 +97,10 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
113
97
|
MessageEncodingContext
|
|
114
98
|
>;
|
|
115
99
|
|
|
116
|
-
private readonly idCompressor: IIdCompressor;
|
|
117
|
-
|
|
118
100
|
private readonly resubmitMachine: ResubmitMachine<TChange>;
|
|
119
|
-
|
|
101
|
+
public readonly commitEnricher: BranchCommitEnricher<TChange>;
|
|
120
102
|
|
|
121
|
-
|
|
103
|
+
public readonly mintRevisionTag: () => RevisionTag;
|
|
122
104
|
|
|
123
105
|
private readonly schemaAndPolicy: ClonableSchemaAndPolicy;
|
|
124
106
|
|
|
@@ -126,50 +108,44 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
126
108
|
* @param summarizables - Summarizers for all indexes used by this tree
|
|
127
109
|
* @param changeFamily - The change family
|
|
128
110
|
* @param editManager - The edit manager
|
|
129
|
-
* @param id - The id of the shared object
|
|
130
111
|
* @param runtime - The IFluidDataStoreRuntime which contains the shared object
|
|
131
|
-
* @param
|
|
132
|
-
*
|
|
112
|
+
* @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
|
|
113
|
+
* If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
|
|
133
114
|
*/
|
|
134
115
|
public constructor(
|
|
116
|
+
public readonly breaker: Breakable,
|
|
117
|
+
public readonly sharedObject: IChannelView & IFluidLoadable,
|
|
118
|
+
public readonly serializer: IFluidSerializer,
|
|
119
|
+
public readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
|
|
120
|
+
logger: ITelemetryBaseLogger | undefined,
|
|
135
121
|
summarizables: readonly Summarizable[],
|
|
136
122
|
changeFamily: ChangeFamily<TEditor, TChange>,
|
|
137
123
|
options: ICodecOptions,
|
|
138
124
|
formatOptions: ExplicitCoreCodecVersions,
|
|
139
|
-
|
|
140
|
-
id: string,
|
|
141
|
-
runtime: IFluidDataStoreRuntime,
|
|
142
|
-
attributes: IChannelAttributes,
|
|
143
|
-
telemetryContextPrefix: string,
|
|
125
|
+
private readonly idCompressor: IIdCompressor,
|
|
144
126
|
schema: TreeStoredSchemaRepository,
|
|
145
127
|
schemaPolicy: SchemaPolicy,
|
|
146
128
|
resubmitMachine?: ResubmitMachine<TChange>,
|
|
147
129
|
enricher?: ChangeEnricherReadonlyCheckout<TChange>,
|
|
130
|
+
public readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,
|
|
148
131
|
) {
|
|
149
|
-
super(id, runtime, attributes, telemetryContextPrefix);
|
|
150
|
-
|
|
151
132
|
this.schemaAndPolicy = {
|
|
152
133
|
schema,
|
|
153
134
|
policy: schemaPolicy,
|
|
154
135
|
};
|
|
155
136
|
|
|
156
137
|
const rebaseLogger = createChildLogger({
|
|
157
|
-
logger
|
|
138
|
+
logger,
|
|
158
139
|
namespace: "Rebase",
|
|
159
140
|
});
|
|
160
141
|
|
|
161
|
-
assert(
|
|
162
|
-
runtime.idCompressor !== undefined,
|
|
163
|
-
0x886 /* IdCompressor must be enabled to use SharedTree */,
|
|
164
|
-
);
|
|
165
|
-
this.idCompressor = runtime.idCompressor;
|
|
166
142
|
this.mintRevisionTag = () => this.idCompressor.generateCompressedId();
|
|
167
143
|
/**
|
|
168
144
|
* A random ID that uniquely identifies this client in the collab session.
|
|
169
145
|
* This is sent alongside every op to identify which client the op originated from.
|
|
170
146
|
* This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.
|
|
171
147
|
*/
|
|
172
|
-
const localSessionId =
|
|
148
|
+
const localSessionId = idCompressor.localSessionId;
|
|
173
149
|
this.editManager = new EditManager(
|
|
174
150
|
changeFamily,
|
|
175
151
|
localSessionId,
|
|
@@ -189,7 +165,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
189
165
|
}
|
|
190
166
|
});
|
|
191
167
|
|
|
192
|
-
const revisionTagCodec = new RevisionTagCodec(
|
|
168
|
+
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
193
169
|
const editManagerCodec = makeEditManagerCodec(
|
|
194
170
|
this.editManager.changeFamily.codecs,
|
|
195
171
|
revisionTagCodec,
|
|
@@ -212,7 +188,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
212
188
|
|
|
213
189
|
this.messageCodec = makeMessageCodec(
|
|
214
190
|
changeFamily.codecs,
|
|
215
|
-
new RevisionTagCodec(
|
|
191
|
+
new RevisionTagCodec(idCompressor),
|
|
216
192
|
options,
|
|
217
193
|
formatOptions.message,
|
|
218
194
|
);
|
|
@@ -231,7 +207,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
231
207
|
// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:
|
|
232
208
|
// We might want to not subclass it, or override/reimplement most of its functionality.
|
|
233
209
|
@throwIfBroken
|
|
234
|
-
|
|
210
|
+
public summarizeCore(
|
|
235
211
|
serializer: IFluidSerializer,
|
|
236
212
|
telemetryContext?: ITelemetryContext,
|
|
237
213
|
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
|
|
@@ -243,7 +219,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
243
219
|
summarizableBuilder.addWithStats(
|
|
244
220
|
s.key,
|
|
245
221
|
s.getAttachSummary(
|
|
246
|
-
(contents) => serializer.stringify(contents, this.handle),
|
|
222
|
+
(contents) => serializer.stringify(contents, this.sharedObject.handle),
|
|
247
223
|
undefined,
|
|
248
224
|
undefined,
|
|
249
225
|
telemetryContext,
|
|
@@ -256,7 +232,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
256
232
|
return builder.getSummaryTree();
|
|
257
233
|
}
|
|
258
234
|
|
|
259
|
-
|
|
235
|
+
public async loadCore(services: IChannelStorageService): Promise<void> {
|
|
260
236
|
assert(
|
|
261
237
|
this.editManager.localBranch.getHead() === this.editManager.getTrunkHead(),
|
|
262
238
|
0xaaa /* All local changes should be applied to the trunk before loading from summary */,
|
|
@@ -311,7 +287,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
311
287
|
isResubmit: boolean,
|
|
312
288
|
): void {
|
|
313
289
|
assert(
|
|
314
|
-
this.isAttached() === (this.detachedRevision === undefined),
|
|
290
|
+
this.sharedObject.isAttached() === (this.detachedRevision === undefined),
|
|
315
291
|
0x95a /* Detached revision should only be set when not attached */,
|
|
316
292
|
);
|
|
317
293
|
|
|
@@ -326,8 +302,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
326
302
|
if (this.detachedRevision !== undefined) {
|
|
327
303
|
const newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);
|
|
328
304
|
this.detachedRevision = newRevision;
|
|
329
|
-
this.editManager.
|
|
330
|
-
|
|
305
|
+
this.editManager.addSequencedChanges(
|
|
306
|
+
[enrichedCommit],
|
|
307
|
+
this.editManager.localSessionId,
|
|
331
308
|
newRevision,
|
|
332
309
|
this.detachedRevision,
|
|
333
310
|
);
|
|
@@ -352,42 +329,79 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
352
329
|
this.resubmitMachine.onCommitSubmitted(enrichedCommit);
|
|
353
330
|
}
|
|
354
331
|
|
|
355
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Process a message from the runtime.
|
|
334
|
+
* @deprecated - Use processMessagesCore to process a bunch of messages together.
|
|
335
|
+
*/
|
|
336
|
+
public processCore(
|
|
356
337
|
message: ISequencedDocumentMessage,
|
|
357
338
|
local: boolean,
|
|
358
339
|
localOpMetadata: unknown,
|
|
359
340
|
): void {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
341
|
+
this.processMessagesCore({
|
|
342
|
+
envelope: message,
|
|
343
|
+
local,
|
|
344
|
+
messagesContent: [
|
|
345
|
+
{
|
|
346
|
+
clientSequenceNumber: message.clientSequenceNumber,
|
|
347
|
+
contents: message.contents,
|
|
348
|
+
localOpMetadata,
|
|
349
|
+
},
|
|
350
|
+
],
|
|
363
351
|
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.
|
|
356
|
+
*/
|
|
357
|
+
public processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
|
|
358
|
+
const { envelope, local, messagesContent } = messagesCollection;
|
|
359
|
+
const commits: GraphCommit<TChange>[] = [];
|
|
360
|
+
let messagesSessionId: SessionId | undefined;
|
|
361
|
+
|
|
362
|
+
// Get a list of all the commits from the messages.
|
|
363
|
+
for (const messageContent of messagesContent) {
|
|
364
|
+
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
365
|
+
const { commit, sessionId } = this.messageCodec.decode(messageContent.contents, {
|
|
366
|
+
idCompressor: this.idCompressor,
|
|
367
|
+
});
|
|
368
|
+
commits.push(commit);
|
|
364
369
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
370
|
+
if (messagesSessionId !== undefined) {
|
|
371
|
+
assert(
|
|
372
|
+
messagesSessionId === sessionId,
|
|
373
|
+
"All messages in a bunch must have the same session ID",
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
messagesSessionId = sessionId;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
assert(messagesSessionId !== undefined, "Messages must have a session ID");
|
|
380
|
+
|
|
381
|
+
this.editManager.addSequencedChanges(
|
|
382
|
+
commits,
|
|
383
|
+
messagesSessionId,
|
|
384
|
+
brand(envelope.sequenceNumber),
|
|
385
|
+
brand(envelope.referenceSequenceNumber),
|
|
369
386
|
);
|
|
370
|
-
this.resubmitMachine.onSequencedCommitApplied(local);
|
|
371
387
|
|
|
372
|
-
|
|
388
|
+
// Update the resubmit machine for each commit applied.
|
|
389
|
+
for (const _ of messagesContent) {
|
|
390
|
+
this.resubmitMachine.onSequencedCommitApplied(local);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
this.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));
|
|
373
394
|
}
|
|
374
395
|
|
|
375
|
-
|
|
396
|
+
public getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
376
397
|
return this.editManager.localBranch;
|
|
377
398
|
}
|
|
378
399
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
protected override didAttach(): void {
|
|
382
|
-
if (this.detachedRevision !== undefined) {
|
|
383
|
-
this.detachedRevision = undefined;
|
|
384
|
-
}
|
|
400
|
+
public didAttach(): void {
|
|
401
|
+
this.detachedRevision = undefined;
|
|
385
402
|
}
|
|
386
403
|
|
|
387
|
-
|
|
388
|
-
content: JsonCompatibleReadOnly,
|
|
389
|
-
localOpMetadata: unknown,
|
|
390
|
-
): void {
|
|
404
|
+
public reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {
|
|
391
405
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
392
406
|
const {
|
|
393
407
|
commit: { revision },
|
|
@@ -416,31 +430,13 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
416
430
|
this.submitCommit(enrichedCommit, localOpMetadata, true);
|
|
417
431
|
}
|
|
418
432
|
|
|
419
|
-
|
|
433
|
+
public applyStashedOp(content: JsonCompatibleReadOnly): void {
|
|
420
434
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
421
435
|
const {
|
|
422
436
|
commit: { revision, change },
|
|
423
437
|
} = this.messageCodec.decode(content, { idCompressor: this.idCompressor });
|
|
424
438
|
this.editManager.localBranch.apply({ change, revision });
|
|
425
439
|
}
|
|
426
|
-
|
|
427
|
-
public override getGCData(fullGC?: boolean): IGarbageCollectionData {
|
|
428
|
-
const gcNodes: IGarbageCollectionData["gcNodes"] = super.getGCData(fullGC).gcNodes;
|
|
429
|
-
for (const s of this.summarizables) {
|
|
430
|
-
for (const [id, routes] of Object.entries(s.getGCData(fullGC).gcNodes)) {
|
|
431
|
-
gcNodes[id] ??= [];
|
|
432
|
-
for (const route of routes) {
|
|
433
|
-
// Non null asserting here because we are creating an array at gcNodes[id] if it is undefined
|
|
434
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
435
|
-
gcNodes[id]!.push(route);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return {
|
|
441
|
-
gcNodes,
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
440
|
}
|
|
445
441
|
|
|
446
442
|
function isClonableSchemaPolicy(
|
|
@@ -482,13 +478,6 @@ export interface Summarizable {
|
|
|
482
478
|
telemetryContext?: ITelemetryContext,
|
|
483
479
|
): Promise<ISummaryTreeWithStats>;
|
|
484
480
|
|
|
485
|
-
/**
|
|
486
|
-
* {@inheritDoc (ISharedObject:interface).getGCData}
|
|
487
|
-
*/
|
|
488
|
-
// TODO: Change this interface (and the one in ISharedObject, if necessary) to support "handles within handles".
|
|
489
|
-
// Consider the case of a document with history; the return value here currently grows unboundedly.
|
|
490
|
-
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
491
|
-
|
|
492
481
|
/**
|
|
493
482
|
* Allows the component to perform custom loading. The storage service is scoped to this component and therefore
|
|
494
483
|
* paths in this component will not collide with those in other components, even if they are the same string.
|
|
@@ -15,12 +15,14 @@ export {
|
|
|
15
15
|
type TreeViewAlpha,
|
|
16
16
|
type TreeBranch,
|
|
17
17
|
type TreeBranchEvents,
|
|
18
|
+
type ITreeAlpha,
|
|
18
19
|
asTreeViewAlpha,
|
|
19
20
|
} from "./tree.js";
|
|
20
21
|
export {
|
|
21
22
|
SchemaFactory,
|
|
22
23
|
type ScopedSchemaName,
|
|
23
24
|
type SchemaFactoryObjectOptions,
|
|
25
|
+
type schemaStatics,
|
|
24
26
|
} from "./schemaFactory.js";
|
|
25
27
|
export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
|
|
26
28
|
export type {
|
|
@@ -118,6 +120,19 @@ export {
|
|
|
118
120
|
comparePersistedSchema,
|
|
119
121
|
} from "./storedSchema.js";
|
|
120
122
|
|
|
123
|
+
export {
|
|
124
|
+
type TransactionConstraint,
|
|
125
|
+
type NodeInDocumentConstraint,
|
|
126
|
+
type RunTransactionParams,
|
|
127
|
+
type VoidTransactionCallbackStatus,
|
|
128
|
+
type TransactionCallbackStatus,
|
|
129
|
+
type TransactionResult,
|
|
130
|
+
type TransactionResultExt,
|
|
131
|
+
type TransactionResultSuccess,
|
|
132
|
+
type TransactionResultFailed,
|
|
133
|
+
rollback,
|
|
134
|
+
} from "./transactionTypes.js";
|
|
135
|
+
|
|
121
136
|
// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
|
|
122
137
|
// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
|
|
123
138
|
export {
|