@fluidframework/tree 2.20.0 → 2.22.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 +14 -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 +35 -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 +1 -151
- 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 +11 -12
- 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/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +1 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -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 +1 -0
- package/dist/shared-tree/index.d.ts +1 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -4
- 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 +39 -39
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +81 -55
- 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.js +1 -1
- 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/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 +25 -30
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +20 -49
- 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 +158 -63
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +181 -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 +27 -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/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -2
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -6
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +10 -13
- package/dist/simple-tree/core/treeNodeKernel.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/proxies.js +1 -1
- package/dist/simple-tree/proxies.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/rangeMap.d.ts +11 -2
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +36 -8
- package/dist/util/rangeMap.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 +1 -151
- 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 +11 -12
- 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/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +2 -2
- package/lib/feature-libraries/treeCursorUtils.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 +4 -1
- 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 +1 -0
- package/lib/shared-tree/index.d.ts +1 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -2
- 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 +39 -39
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +79 -53
- 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.js +2 -2
- 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/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 +25 -30
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +19 -48
- 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 +158 -63
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +180 -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 +27 -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/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +2 -2
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -6
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +9 -11
- package/lib/simple-tree/core/treeNodeKernel.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/proxies.js +2 -2
- package/lib/simple-tree/proxies.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/rangeMap.d.ts +11 -2
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +36 -8
- package/lib/util/rangeMap.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 +4 -197
- 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 +9 -42
- 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/feature-libraries/treeCursorUtils.ts +4 -2
- package/src/index.ts +15 -10
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -14
- package/src/shared-tree/schematizingTreeView.ts +18 -16
- package/src/shared-tree/sharedTree.ts +203 -103
- package/src/shared-tree/treeApi.ts +10 -1
- package/src/shared-tree/treeCheckout.ts +11 -8
- package/src/shared-tree-core/editManager.ts +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
- package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
- package/src/shared-tree-core/sharedTreeCore.ts +30 -87
- package/src/simple-tree/api/index.ts +15 -0
- package/src/simple-tree/api/schemaFactory.ts +205 -89
- package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
- package/src/simple-tree/api/tree.ts +35 -6
- package/src/simple-tree/core/getOrCreateNode.ts +6 -2
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +16 -14
- package/src/simple-tree/index.ts +12 -0
- package/src/simple-tree/proxies.ts +2 -2
- package/src/simple-tree/schemaTypes.ts +2 -2
- package/src/treeFactory.ts +29 -11
- package/src/util/breakable.ts +1 -1
- package/src/util/rangeMap.ts +36 -7
- 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/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/transactionTypes.d.ts.map +0 -1
- package/src/core/tree/visitPath.ts +0 -124
- /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
- /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, oob, debugAssert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
CursorLocationType,
|
|
@@ -147,7 +147,9 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
public getFieldKey(): FieldKey {
|
|
150
|
-
|
|
150
|
+
debugAssert(() =>
|
|
151
|
+
this.mode === CursorLocationType.Fields ? true : "must be in fields mode",
|
|
152
|
+
);
|
|
151
153
|
return this.siblings[this.index] as FieldKey;
|
|
152
154
|
}
|
|
153
155
|
|
package/src/index.ts
CHANGED
|
@@ -61,10 +61,7 @@ export {
|
|
|
61
61
|
type SharedTreeFormatOptions,
|
|
62
62
|
SharedTreeFormatVersion,
|
|
63
63
|
Tree,
|
|
64
|
-
type TransactionConstraint,
|
|
65
|
-
type NodeInDocumentConstraint,
|
|
66
64
|
type RunTransaction,
|
|
67
|
-
rollback,
|
|
68
65
|
type ForestOptions,
|
|
69
66
|
getBranch,
|
|
70
67
|
type BranchableTree,
|
|
@@ -73,16 +70,10 @@ export {
|
|
|
73
70
|
type ViewContent,
|
|
74
71
|
TreeAlpha,
|
|
75
72
|
independentView,
|
|
76
|
-
type RunTransactionParams,
|
|
77
|
-
type VoidTransactionCallbackStatus,
|
|
78
|
-
type TransactionCallbackStatus,
|
|
79
|
-
type TransactionResult,
|
|
80
|
-
type TransactionResultExt,
|
|
81
|
-
type TransactionResultSuccess,
|
|
82
|
-
type TransactionResultFailed,
|
|
83
73
|
ForestTypeOptimized,
|
|
84
74
|
ForestTypeExpensiveDebug,
|
|
85
75
|
ForestTypeReference,
|
|
76
|
+
type IChannelView,
|
|
86
77
|
} from "./shared-tree/index.js";
|
|
87
78
|
|
|
88
79
|
export {
|
|
@@ -214,10 +205,24 @@ export {
|
|
|
214
205
|
asTreeViewAlpha,
|
|
215
206
|
type NodeSchemaOptions,
|
|
216
207
|
type NodeSchemaMetadata,
|
|
208
|
+
type schemaStatics,
|
|
209
|
+
type ITreeAlpha,
|
|
210
|
+
type TransactionConstraint,
|
|
211
|
+
type NodeInDocumentConstraint,
|
|
212
|
+
type RunTransactionParams,
|
|
213
|
+
type VoidTransactionCallbackStatus,
|
|
214
|
+
type TransactionCallbackStatus,
|
|
215
|
+
type TransactionResult,
|
|
216
|
+
type TransactionResultExt,
|
|
217
|
+
type TransactionResultSuccess,
|
|
218
|
+
type TransactionResultFailed,
|
|
219
|
+
rollback,
|
|
217
220
|
} from "./simple-tree/index.js";
|
|
218
221
|
export {
|
|
219
222
|
SharedTree,
|
|
220
223
|
configuredSharedTree,
|
|
224
|
+
SharedTreeAttributes,
|
|
225
|
+
SharedTreeFactoryType,
|
|
221
226
|
} from "./treeFactory.js";
|
|
222
227
|
|
|
223
228
|
export {
|
package/src/packageVersion.ts
CHANGED
package/src/shared-tree/index.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
type ISharedTree,
|
|
8
|
-
|
|
8
|
+
type ITreePrivate,
|
|
9
|
+
type SharedTreeOptionsInternal,
|
|
9
10
|
type SharedTreeOptions,
|
|
10
11
|
SharedTree,
|
|
11
12
|
getBranch,
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
ForestTypeOptimized,
|
|
21
22
|
ForestTypeExpensiveDebug,
|
|
22
23
|
ForestTypeReference,
|
|
24
|
+
type IChannelView,
|
|
23
25
|
} from "./sharedTree.js";
|
|
24
26
|
|
|
25
27
|
export {
|
|
@@ -46,19 +48,6 @@ export {
|
|
|
46
48
|
type RunTransaction,
|
|
47
49
|
} from "./treeApi.js";
|
|
48
50
|
|
|
49
|
-
export {
|
|
50
|
-
type TransactionConstraint,
|
|
51
|
-
type NodeInDocumentConstraint,
|
|
52
|
-
type RunTransactionParams,
|
|
53
|
-
type VoidTransactionCallbackStatus,
|
|
54
|
-
type TransactionCallbackStatus,
|
|
55
|
-
type TransactionResult,
|
|
56
|
-
type TransactionResultExt,
|
|
57
|
-
type TransactionResultSuccess,
|
|
58
|
-
type TransactionResultFailed,
|
|
59
|
-
rollback,
|
|
60
|
-
} from "./transactionTypes.js";
|
|
61
|
-
|
|
62
51
|
export { TreeAlpha } from "./treeApiAlpha.js";
|
|
63
52
|
|
|
64
53
|
export {
|
|
@@ -46,26 +46,27 @@ import {
|
|
|
46
46
|
type TreeBranchEvents,
|
|
47
47
|
getOrCreateInnerNode,
|
|
48
48
|
getKernel,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
import {
|
|
49
|
+
type VoidTransactionCallbackStatus,
|
|
50
|
+
type TransactionCallbackStatus,
|
|
51
|
+
type TransactionResult,
|
|
52
|
+
type TransactionResultExt,
|
|
53
|
+
type RunTransactionParams,
|
|
54
|
+
type TransactionConstraint,
|
|
56
55
|
HydratedContext,
|
|
57
56
|
SimpleContextSlot,
|
|
58
57
|
areImplicitFieldSchemaEqual,
|
|
59
58
|
createUnknownOptionalFieldPolicy,
|
|
60
59
|
} from "../simple-tree/index.js";
|
|
61
|
-
import
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} from "./
|
|
60
|
+
import {
|
|
61
|
+
type Breakable,
|
|
62
|
+
breakingClass,
|
|
63
|
+
disposeSymbol,
|
|
64
|
+
type WithBreakable,
|
|
65
|
+
} from "../util/index.js";
|
|
66
|
+
|
|
67
|
+
import { canInitialize, ensureSchema, initialize } from "./schematizeTree.js";
|
|
68
|
+
import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
|
|
69
|
+
import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
|
|
@@ -111,14 +112,15 @@ export class SchematizingSimpleTreeView<
|
|
|
111
112
|
private midUpgrade = false;
|
|
112
113
|
|
|
113
114
|
private readonly rootFieldSchema: FieldSchema;
|
|
115
|
+
public readonly breaker: Breakable;
|
|
114
116
|
|
|
115
117
|
public constructor(
|
|
116
118
|
public readonly checkout: TreeCheckout,
|
|
117
119
|
public readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,
|
|
118
120
|
public readonly nodeKeyManager: NodeKeyManager,
|
|
119
|
-
public readonly breaker: Breakable = new Breakable("SchematizingSimpleTreeView"),
|
|
120
121
|
private readonly onDispose?: () => void,
|
|
121
122
|
) {
|
|
123
|
+
this.breaker = checkout.breaker;
|
|
122
124
|
if (checkout.forest.anchors.slots.has(ViewSlot)) {
|
|
123
125
|
throw new UsageError("Cannot create a second tree view from the same checkout");
|
|
124
126
|
}
|
|
@@ -4,16 +4,33 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
ErasedType,
|
|
9
|
+
IFluidHandle,
|
|
10
|
+
IFluidLoadable,
|
|
11
|
+
} from "@fluidframework/core-interfaces/internal";
|
|
8
12
|
import type {
|
|
9
13
|
IChannelAttributes,
|
|
10
|
-
IChannelFactory,
|
|
11
14
|
IFluidDataStoreRuntime,
|
|
12
|
-
IChannelServices,
|
|
13
15
|
IChannelStorageService,
|
|
16
|
+
IChannel,
|
|
14
17
|
} from "@fluidframework/datastore-definitions/internal";
|
|
15
|
-
import
|
|
16
|
-
|
|
18
|
+
import {
|
|
19
|
+
SharedObject,
|
|
20
|
+
type IFluidSerializer,
|
|
21
|
+
type ISharedObject,
|
|
22
|
+
} from "@fluidframework/shared-object-base/internal";
|
|
23
|
+
import {
|
|
24
|
+
UsageError,
|
|
25
|
+
type ITelemetryLoggerExt,
|
|
26
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
27
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
28
|
+
import type {
|
|
29
|
+
ITelemetryContext,
|
|
30
|
+
IExperimentalIncrementalSummaryContext,
|
|
31
|
+
ISummaryTreeWithStats,
|
|
32
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
33
|
+
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
17
34
|
|
|
18
35
|
import { type ICodecOptions, noopValidator } from "../codec/index.js";
|
|
19
36
|
import {
|
|
@@ -74,6 +91,7 @@ import {
|
|
|
74
91
|
FieldKind,
|
|
75
92
|
type CustomTreeNode,
|
|
76
93
|
type CustomTreeValue,
|
|
94
|
+
type ITreeAlpha,
|
|
77
95
|
} from "../simple-tree/index.js";
|
|
78
96
|
|
|
79
97
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -82,11 +100,16 @@ import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
|
|
|
82
100
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
83
101
|
import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
84
102
|
import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
|
|
85
|
-
import {
|
|
86
|
-
|
|
103
|
+
import {
|
|
104
|
+
Breakable,
|
|
105
|
+
breakingClass,
|
|
106
|
+
fail,
|
|
107
|
+
throwIfBroken,
|
|
108
|
+
type WithBreakable,
|
|
109
|
+
} from "../util/index.js";
|
|
87
110
|
|
|
88
111
|
/**
|
|
89
|
-
* Copy of data from an {@link
|
|
112
|
+
* Copy of data from an {@link ITreePrivate} at some point in time.
|
|
90
113
|
* @remarks
|
|
91
114
|
* This is unrelated to Fluids concept of "snapshots".
|
|
92
115
|
*/
|
|
@@ -110,30 +133,26 @@ export interface SharedTreeContentSnapshot {
|
|
|
110
133
|
}
|
|
111
134
|
|
|
112
135
|
/**
|
|
113
|
-
*
|
|
136
|
+
* Information about a Fluid channel.
|
|
137
|
+
* @privateRemarks
|
|
138
|
+
* This is distinct from {@link IChannel} as it omits the APIs used by the runtime to manage the channel and instead only has things which are useful (and safe) to expose to users of the channel.
|
|
114
139
|
* @internal
|
|
115
140
|
*/
|
|
116
|
-
export
|
|
117
|
-
/**
|
|
118
|
-
* Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
|
|
119
|
-
* @privateRemarks
|
|
120
|
-
* TODO:
|
|
121
|
-
* This should probably get promoted to a public API on ITree eventually.
|
|
122
|
-
*/
|
|
123
|
-
exportVerbose(): VerboseTree | undefined;
|
|
141
|
+
export type IChannelView = Pick<IChannel, "id" | "attributes" | "isAttached">;
|
|
124
142
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
exportSimpleSchema(): SimpleTreeSchema;
|
|
131
|
-
}
|
|
143
|
+
/**
|
|
144
|
+
* {@link ITree} extended with some non-public APIs.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export interface ITreeInternal extends IChannelView, ITreeAlpha {}
|
|
132
148
|
|
|
133
149
|
/**
|
|
134
150
|
* {@link ITreeInternal} extended with some non-exported APIs.
|
|
151
|
+
* @remarks
|
|
152
|
+
* This allows access to the tree content using the internal data model used at the storage and "flex" layers,
|
|
153
|
+
* and should only be needed for testing and debugging this package's internals.
|
|
135
154
|
*/
|
|
136
|
-
export interface
|
|
155
|
+
export interface ITreePrivate extends ITreeInternal {
|
|
137
156
|
/**
|
|
138
157
|
* Provides a copy of the current content of the tree.
|
|
139
158
|
* This can be useful for inspecting the tree when no suitable view schema is available.
|
|
@@ -144,6 +163,13 @@ export interface ISharedTree extends ISharedObject, ITreeInternal {
|
|
|
144
163
|
contentSnapshot(): SharedTreeContentSnapshot;
|
|
145
164
|
}
|
|
146
165
|
|
|
166
|
+
/**
|
|
167
|
+
* {@link ITreePrivate} extended with ISharedObject.
|
|
168
|
+
* @remarks
|
|
169
|
+
* This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.
|
|
170
|
+
*/
|
|
171
|
+
export interface ISharedTree extends ISharedObject, ITreePrivate {}
|
|
172
|
+
|
|
147
173
|
/**
|
|
148
174
|
* Has an entry for each codec which writes an explicit version into its data.
|
|
149
175
|
*
|
|
@@ -187,20 +213,20 @@ function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
|
|
|
187
213
|
}
|
|
188
214
|
|
|
189
215
|
/**
|
|
190
|
-
* Shared
|
|
191
|
-
*
|
|
192
|
-
* TODO: detail compatibility requirements.
|
|
216
|
+
* Shared object wrapping {@link SharedTreeKernel}.
|
|
193
217
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
218
|
+
export class SharedTree extends SharedObject implements ISharedTree, WithBreakable {
|
|
219
|
+
public readonly breaker: Breakable = new Breakable("Shared Tree");
|
|
220
|
+
|
|
221
|
+
public get checkout(): TreeCheckout {
|
|
222
|
+
return this.kernel.checkout;
|
|
223
|
+
}
|
|
200
224
|
public get storedSchema(): TreeStoredSchemaRepository {
|
|
201
225
|
return this.checkout.storedSchema;
|
|
202
226
|
}
|
|
203
227
|
|
|
228
|
+
private readonly kernel: SharedTreeKernel;
|
|
229
|
+
|
|
204
230
|
public constructor(
|
|
205
231
|
id: string,
|
|
206
232
|
runtime: IFluidDataStoreRuntime,
|
|
@@ -208,23 +234,132 @@ export class SharedTree
|
|
|
208
234
|
optionsParam: SharedTreeOptionsInternal,
|
|
209
235
|
telemetryContextPrefix: string = "fluid_sharedTree_",
|
|
210
236
|
) {
|
|
237
|
+
super(id, runtime, attributes, telemetryContextPrefix);
|
|
211
238
|
if (runtime.idCompressor === undefined) {
|
|
212
239
|
throw new UsageError("IdCompressor must be enabled to use SharedTree");
|
|
213
240
|
}
|
|
241
|
+
this.kernel = new SharedTreeKernel(
|
|
242
|
+
this.breaker,
|
|
243
|
+
this,
|
|
244
|
+
this.serializer,
|
|
245
|
+
(content, localOpMetadata) => this.submitLocalMessage(content, localOpMetadata),
|
|
246
|
+
() => this.deltaManager.lastSequenceNumber,
|
|
247
|
+
this.logger,
|
|
248
|
+
runtime.idCompressor,
|
|
249
|
+
optionsParam,
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
public get editor(): SharedTreeEditBuilder {
|
|
254
|
+
return this.kernel.getEditor();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public summarizeCore(
|
|
258
|
+
serializer: IFluidSerializer,
|
|
259
|
+
telemetryContext?: ITelemetryContext,
|
|
260
|
+
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
|
|
261
|
+
): ISummaryTreeWithStats {
|
|
262
|
+
return this.kernel.summarizeCore(serializer, telemetryContext, incrementalSummaryContext);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
protected processCore(
|
|
266
|
+
message: ISequencedDocumentMessage,
|
|
267
|
+
local: boolean,
|
|
268
|
+
localOpMetadata: unknown,
|
|
269
|
+
): void {
|
|
270
|
+
this.kernel.processCore(message, local, localOpMetadata);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
protected onDisconnect(): void {}
|
|
274
|
+
|
|
275
|
+
public exportVerbose(): VerboseTree | undefined {
|
|
276
|
+
return this.kernel.exportVerbose();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
public exportSimpleSchema(): SimpleTreeSchema {
|
|
280
|
+
return this.kernel.exportSimpleSchema();
|
|
281
|
+
}
|
|
214
282
|
|
|
283
|
+
public contentSnapshot(): SharedTreeContentSnapshot {
|
|
284
|
+
return this.kernel.contentSnapshot();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// For the new TreeViewAlpha API
|
|
288
|
+
public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
289
|
+
config: TreeViewConfiguration<ReadSchema<TRoot>>,
|
|
290
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;
|
|
291
|
+
|
|
292
|
+
// For the old TreeView API
|
|
293
|
+
public viewWith<TRoot extends ImplicitFieldSchema>(
|
|
294
|
+
config: TreeViewConfiguration<TRoot>,
|
|
295
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;
|
|
296
|
+
|
|
297
|
+
public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
298
|
+
config: TreeViewConfiguration<ReadSchema<TRoot>>,
|
|
299
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {
|
|
300
|
+
return this.kernel.viewWith(config);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
protected override async loadCore(services: IChannelStorageService): Promise<void> {
|
|
304
|
+
await this.kernel.loadCore(services);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
protected override didAttach(): void {
|
|
308
|
+
this.kernel.didAttach();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
protected override applyStashedOp(
|
|
312
|
+
...args: Parameters<
|
|
313
|
+
SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["applyStashedOp"]
|
|
314
|
+
>
|
|
315
|
+
): void {
|
|
316
|
+
this.kernel.applyStashedOp(...args);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
protected override reSubmitCore(
|
|
320
|
+
...args: Parameters<
|
|
321
|
+
SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["reSubmitCore"]
|
|
322
|
+
>
|
|
323
|
+
): void {
|
|
324
|
+
this.kernel.reSubmitCore(...args);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.
|
|
330
|
+
*
|
|
331
|
+
* TODO: detail compatibility requirements.
|
|
332
|
+
*/
|
|
333
|
+
@breakingClass
|
|
334
|
+
class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange> {
|
|
335
|
+
public readonly checkout: TreeCheckout;
|
|
336
|
+
public get storedSchema(): TreeStoredSchemaRepository {
|
|
337
|
+
return this.checkout.storedSchema;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
public constructor(
|
|
341
|
+
breaker: Breakable,
|
|
342
|
+
sharedObject: IChannelView & IFluidLoadable,
|
|
343
|
+
serializer: IFluidSerializer,
|
|
344
|
+
submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
|
|
345
|
+
lastSequenceNumber: () => number | undefined,
|
|
346
|
+
logger: ITelemetryLoggerExt | undefined,
|
|
347
|
+
idCompressor: IIdCompressor,
|
|
348
|
+
optionsParam: SharedTreeOptionsInternal,
|
|
349
|
+
) {
|
|
215
350
|
const options = { ...defaultSharedTreeOptions, ...optionsParam };
|
|
216
351
|
const codecVersions = getCodecVersions(options.formatVersion);
|
|
217
352
|
const schema = new TreeStoredSchemaRepository();
|
|
218
|
-
const forest = buildConfiguredForest(options.forest, schema,
|
|
219
|
-
const revisionTagCodec = new RevisionTagCodec(
|
|
353
|
+
const forest = buildConfiguredForest(options.forest, schema, idCompressor);
|
|
354
|
+
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
220
355
|
const removedRoots = makeDetachedFieldIndex(
|
|
221
356
|
"repair",
|
|
222
357
|
revisionTagCodec,
|
|
223
|
-
|
|
358
|
+
idCompressor,
|
|
224
359
|
options,
|
|
225
360
|
);
|
|
226
|
-
const schemaSummarizer = new SchemaSummarizer(
|
|
227
|
-
getCurrentSeq:
|
|
361
|
+
const schemaSummarizer = new SchemaSummarizer(schema, options, {
|
|
362
|
+
getCurrentSeq: lastSequenceNumber,
|
|
228
363
|
});
|
|
229
364
|
const fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);
|
|
230
365
|
|
|
@@ -234,8 +369,8 @@ export class SharedTree
|
|
|
234
369
|
policy: defaultSchemaPolicy,
|
|
235
370
|
},
|
|
236
371
|
encodeType: options.treeEncodeType,
|
|
237
|
-
originatorId:
|
|
238
|
-
idCompressor
|
|
372
|
+
originatorId: idCompressor.localSessionId,
|
|
373
|
+
idCompressor,
|
|
239
374
|
};
|
|
240
375
|
const forestSummarizer = new ForestSummarizer(
|
|
241
376
|
forest,
|
|
@@ -243,7 +378,7 @@ export class SharedTree
|
|
|
243
378
|
fieldBatchCodec,
|
|
244
379
|
encoderContext,
|
|
245
380
|
options,
|
|
246
|
-
|
|
381
|
+
idCompressor,
|
|
247
382
|
);
|
|
248
383
|
const removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);
|
|
249
384
|
const innerChangeFamily = new SharedTreeChangeFamily(
|
|
@@ -251,7 +386,7 @@ export class SharedTree
|
|
|
251
386
|
fieldBatchCodec,
|
|
252
387
|
options,
|
|
253
388
|
options.treeEncodeType,
|
|
254
|
-
|
|
389
|
+
idCompressor,
|
|
255
390
|
);
|
|
256
391
|
const changeFamily = makeMitigatedChangeFamily(
|
|
257
392
|
innerChangeFamily,
|
|
@@ -277,14 +412,16 @@ export class SharedTree
|
|
|
277
412
|
);
|
|
278
413
|
const changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);
|
|
279
414
|
super(
|
|
415
|
+
breaker,
|
|
416
|
+
sharedObject,
|
|
417
|
+
serializer,
|
|
418
|
+
submitLocalMessage,
|
|
419
|
+
logger,
|
|
280
420
|
[schemaSummarizer, forestSummarizer, removedRootsSummarizer],
|
|
281
421
|
changeFamily,
|
|
282
422
|
options,
|
|
283
423
|
codecVersions,
|
|
284
|
-
|
|
285
|
-
runtime,
|
|
286
|
-
attributes,
|
|
287
|
-
telemetryContextPrefix,
|
|
424
|
+
idCompressor,
|
|
288
425
|
schema,
|
|
289
426
|
defaultSchemaPolicy,
|
|
290
427
|
new DefaultResubmitMachine(
|
|
@@ -295,44 +432,39 @@ export class SharedTree
|
|
|
295
432
|
changeEnricher,
|
|
296
433
|
);
|
|
297
434
|
const localBranch = this.getLocalBranch();
|
|
298
|
-
this.checkout = createTreeCheckout(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
logger: this.logger,
|
|
311
|
-
breaker: this.breaker,
|
|
312
|
-
disposeForksAfterTransaction: options.disposeForksAfterTransaction,
|
|
313
|
-
},
|
|
314
|
-
);
|
|
435
|
+
this.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {
|
|
436
|
+
branch: localBranch,
|
|
437
|
+
changeFamily,
|
|
438
|
+
schema,
|
|
439
|
+
forest,
|
|
440
|
+
fieldBatchCodec,
|
|
441
|
+
removedRoots,
|
|
442
|
+
chunkCompressionStrategy: options.treeEncodeType,
|
|
443
|
+
logger,
|
|
444
|
+
breaker: this.breaker,
|
|
445
|
+
disposeForksAfterTransaction: options.disposeForksAfterTransaction,
|
|
446
|
+
});
|
|
315
447
|
|
|
316
448
|
this.checkout.transaction.events.on("started", () => {
|
|
317
|
-
if (
|
|
449
|
+
if (sharedObject.isAttached()) {
|
|
318
450
|
// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.
|
|
319
451
|
this.commitEnricher.startTransaction();
|
|
320
452
|
}
|
|
321
453
|
});
|
|
322
454
|
this.checkout.transaction.events.on("aborting", () => {
|
|
323
|
-
if (
|
|
455
|
+
if (sharedObject.isAttached()) {
|
|
324
456
|
// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.
|
|
325
457
|
this.commitEnricher.abortTransaction();
|
|
326
458
|
}
|
|
327
459
|
});
|
|
328
460
|
this.checkout.transaction.events.on("committing", () => {
|
|
329
|
-
if (
|
|
461
|
+
if (sharedObject.isAttached()) {
|
|
330
462
|
// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.
|
|
331
463
|
this.commitEnricher.commitTransaction();
|
|
332
464
|
}
|
|
333
465
|
});
|
|
334
466
|
this.checkout.events.on("beforeBatch", (event) => {
|
|
335
|
-
if (event.type === "append" &&
|
|
467
|
+
if (event.type === "append" && sharedObject.isAttached()) {
|
|
336
468
|
if (this.checkout.transaction.isInProgress()) {
|
|
337
469
|
this.commitEnricher.addTransactionCommits(event.newCommits);
|
|
338
470
|
}
|
|
@@ -401,12 +533,12 @@ export class SharedTree
|
|
|
401
533
|
TreeView<ReadSchema<TRoot>>;
|
|
402
534
|
}
|
|
403
535
|
|
|
404
|
-
|
|
536
|
+
public override async loadCore(services: IChannelStorageService): Promise<void> {
|
|
405
537
|
await super.loadCore(services);
|
|
406
538
|
this.checkout.load();
|
|
407
539
|
}
|
|
408
540
|
|
|
409
|
-
|
|
541
|
+
public override didAttach(): void {
|
|
410
542
|
if (this.checkout.transaction.isInProgress()) {
|
|
411
543
|
// Attaching during a transaction is not currently supported.
|
|
412
544
|
// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.
|
|
@@ -417,7 +549,7 @@ export class SharedTree
|
|
|
417
549
|
super.didAttach();
|
|
418
550
|
}
|
|
419
551
|
|
|
420
|
-
|
|
552
|
+
public override applyStashedOp(
|
|
421
553
|
...args: Parameters<
|
|
422
554
|
SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>["applyStashedOp"]
|
|
423
555
|
>
|
|
@@ -641,38 +773,6 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
641
773
|
disposeForksAfterTransaction: true,
|
|
642
774
|
};
|
|
643
775
|
|
|
644
|
-
/**
|
|
645
|
-
* A channel factory that creates {@link ISharedTree}s.
|
|
646
|
-
*/
|
|
647
|
-
export class SharedTreeFactory implements IChannelFactory<ISharedTree> {
|
|
648
|
-
public readonly type: string = "https://graph.microsoft.com/types/tree";
|
|
649
|
-
|
|
650
|
-
public readonly attributes: IChannelAttributes = {
|
|
651
|
-
type: this.type,
|
|
652
|
-
snapshotFormatVersion: "0.0.0",
|
|
653
|
-
packageVersion: "0.0.0",
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
public constructor(private readonly options: SharedTreeOptionsInternal = {}) {}
|
|
657
|
-
|
|
658
|
-
public async load(
|
|
659
|
-
runtime: IFluidDataStoreRuntime,
|
|
660
|
-
id: string,
|
|
661
|
-
services: IChannelServices,
|
|
662
|
-
channelAttributes: Readonly<IChannelAttributes>,
|
|
663
|
-
): Promise<SharedTree> {
|
|
664
|
-
const tree = new SharedTree(id, runtime, channelAttributes, this.options);
|
|
665
|
-
await tree.load(services);
|
|
666
|
-
return tree;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
public create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {
|
|
670
|
-
const tree = new SharedTree(id, runtime, this.attributes, this.options);
|
|
671
|
-
tree.initializeLocal();
|
|
672
|
-
return tree;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
776
|
function verboseFromCursor(
|
|
677
777
|
reader: ITreeCursor,
|
|
678
778
|
schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,
|
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
type TreeView,
|
|
15
15
|
getOrCreateInnerNode,
|
|
16
16
|
treeNodeApi,
|
|
17
|
+
rollback,
|
|
18
|
+
type TransactionConstraint,
|
|
17
19
|
} from "../simple-tree/index.js";
|
|
18
20
|
|
|
19
21
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
20
22
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
21
23
|
import { getCheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
|
|
22
|
-
import { rollback, type TransactionConstraint } from "./transactionTypes.js";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* A function which runs a transaction in a SharedTree.
|
|
@@ -394,6 +395,7 @@ function createRunTransaction(): RunTransaction {
|
|
|
394
395
|
* Run the given transaction.
|
|
395
396
|
* @remarks
|
|
396
397
|
* This API is not publicly exported but is exported outside of this module so that test code may unit test the `Tree.runTransaction` function directly without being restricted to its public API overloads.
|
|
398
|
+
* @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to edit content in the error case.
|
|
397
399
|
*/
|
|
398
400
|
export function runTransaction<
|
|
399
401
|
TNode extends TreeNode,
|
|
@@ -427,6 +429,10 @@ export function runTransaction<
|
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Run the given transaction.
|
|
434
|
+
* @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to editing content in the error case.
|
|
435
|
+
*/
|
|
430
436
|
function runTransactionInCheckout<TResult>(
|
|
431
437
|
checkout: ITreeCheckout,
|
|
432
438
|
transaction: () => TResult | typeof rollback,
|
|
@@ -450,11 +456,14 @@ function runTransactionInCheckout<TResult>(
|
|
|
450
456
|
unreachableCase(constraint.type);
|
|
451
457
|
}
|
|
452
458
|
}
|
|
459
|
+
|
|
453
460
|
let result: ReturnType<typeof transaction>;
|
|
454
461
|
try {
|
|
455
462
|
result = transaction();
|
|
456
463
|
} catch (error) {
|
|
457
464
|
// If the transaction has an unhandled error, abort and rollback the transaction but continue to propagate the error.
|
|
465
|
+
// This might try and modify the tree or trigger events while things are in an inconsistent state.
|
|
466
|
+
// It is up to the user of runTransaction to ensure that does not cause problems (and they have no robust way to do that, which is why its deprecated).
|
|
458
467
|
checkout.transaction.abort();
|
|
459
468
|
throw error;
|
|
460
469
|
}
|