@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
|
@@ -171,6 +171,141 @@ export type ScopedSchemaName<
|
|
|
171
171
|
> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
|
|
172
172
|
// > = `${TScope extends undefined ? "" : `${TScope}.`}${TName}`;
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.
|
|
176
|
+
* @privateRemarks
|
|
177
|
+
* We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.
|
|
178
|
+
* As a workaround, we have this type as a third place which can be linked.
|
|
179
|
+
* @system @sealed @public
|
|
180
|
+
*/
|
|
181
|
+
export const schemaStatics = {
|
|
182
|
+
/**
|
|
183
|
+
* {@link TreeNodeSchema} for holding a JavaScript `string`.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
187
|
+
*
|
|
188
|
+
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
189
|
+
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
190
|
+
* @privateRemarks
|
|
191
|
+
* TODO:
|
|
192
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
193
|
+
* We should validate and/or normalize them when inserting content.
|
|
194
|
+
*/
|
|
195
|
+
string: stringSchema,
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* {@link TreeNodeSchema} for holding a JavaScript `number`.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
|
|
202
|
+
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
203
|
+
* - `-0` may be converted to `0` in some cases.
|
|
204
|
+
*
|
|
205
|
+
* These limitations match the limitations of JSON.
|
|
206
|
+
* @privateRemarks
|
|
207
|
+
* TODO:
|
|
208
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
209
|
+
* We should validate and/or normalize them when inserting content.
|
|
210
|
+
*/
|
|
211
|
+
number: numberSchema,
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* {@link TreeNodeSchema} for holding a boolean.
|
|
215
|
+
*/
|
|
216
|
+
boolean: booleanSchema,
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* {@link TreeNodeSchema} for JavaScript `null`.
|
|
220
|
+
*
|
|
221
|
+
* @remarks
|
|
222
|
+
* There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.
|
|
223
|
+
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
224
|
+
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
225
|
+
*/
|
|
226
|
+
null: nullSchema,
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
230
|
+
*/
|
|
231
|
+
handle: handleSchema,
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* {@link AllowedTypes} for holding any of the leaf types.
|
|
235
|
+
*/
|
|
236
|
+
leaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Make a field optional instead of the default, which is required.
|
|
240
|
+
*
|
|
241
|
+
* @param t - The types allowed under the field.
|
|
242
|
+
* @param props - Optional properties to associate with the field.
|
|
243
|
+
*
|
|
244
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
245
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
246
|
+
*/
|
|
247
|
+
optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
248
|
+
t: T,
|
|
249
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
250
|
+
): FieldSchema<FieldKind.Optional, T, TCustomMetadata> => {
|
|
251
|
+
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
252
|
+
return undefined;
|
|
253
|
+
});
|
|
254
|
+
return createFieldSchema(FieldKind.Optional, t, {
|
|
255
|
+
defaultProvider: defaultOptionalProvider,
|
|
256
|
+
...props,
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Make a field explicitly required.
|
|
262
|
+
*
|
|
263
|
+
* @param t - The types allowed under the field.
|
|
264
|
+
* @param props - Optional properties to associate with the field.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
268
|
+
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
269
|
+
*
|
|
270
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
271
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
272
|
+
*/
|
|
273
|
+
required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
274
|
+
t: T,
|
|
275
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
276
|
+
): FieldSchema<FieldKind.Required, T, TCustomMetadata> => {
|
|
277
|
+
return createFieldSchema(FieldKind.Required, t, props);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* {@link schemaStatics.optional} except tweaked to work better for recursive types.
|
|
282
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
283
|
+
* @remarks
|
|
284
|
+
* This version of {@link schemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
285
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
286
|
+
*/
|
|
287
|
+
optionalRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
|
|
288
|
+
t: T,
|
|
289
|
+
props?: Omit<FieldProps, "defaultProvider">,
|
|
290
|
+
): FieldSchemaUnsafe<FieldKind.Optional, T> => {
|
|
291
|
+
return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* {@link schemaStatics.required} except tweaked to work better for recursive types.
|
|
296
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
297
|
+
* @remarks
|
|
298
|
+
* This version of {@link schemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
299
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
300
|
+
*/
|
|
301
|
+
requiredRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
|
|
302
|
+
t: T,
|
|
303
|
+
props?: Omit<FieldProps, "defaultProvider">,
|
|
304
|
+
): FieldSchemaUnsafe<FieldKind.Required, T> => {
|
|
305
|
+
return createFieldSchemaUnsafe(FieldKind.Required, t, props);
|
|
306
|
+
},
|
|
307
|
+
} as const;
|
|
308
|
+
|
|
174
309
|
// TODO:
|
|
175
310
|
// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
|
|
176
311
|
// API-Extractor requires such links to be qualified with the class, so it can't work.
|
|
@@ -263,6 +398,8 @@ export type ScopedSchemaName<
|
|
|
263
398
|
*
|
|
264
399
|
* Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.
|
|
265
400
|
*
|
|
401
|
+
* @see {@link SchemaFactoryAlpha}
|
|
402
|
+
*
|
|
266
403
|
* @sealed @public
|
|
267
404
|
*/
|
|
268
405
|
export class SchemaFactory<
|
|
@@ -326,56 +463,65 @@ export class SchemaFactory<
|
|
|
326
463
|
}
|
|
327
464
|
|
|
328
465
|
/**
|
|
329
|
-
* {@
|
|
330
|
-
*
|
|
331
|
-
* @remarks
|
|
332
|
-
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
333
|
-
*
|
|
334
|
-
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
335
|
-
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
336
|
-
* @privateRemarks
|
|
337
|
-
* TODO:
|
|
338
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
339
|
-
* We should validate and/or normalize them when inserting content.
|
|
466
|
+
* {@inheritDoc schemaStatics.string}
|
|
340
467
|
*/
|
|
341
468
|
public readonly string = stringSchema;
|
|
342
469
|
|
|
343
470
|
/**
|
|
344
|
-
* {@
|
|
345
|
-
*
|
|
346
|
-
* @remarks
|
|
347
|
-
* The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
|
|
348
|
-
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
349
|
-
* - `-0` may be converted to `0` in some cases.
|
|
350
|
-
*
|
|
351
|
-
* These limitations match the limitations of JSON.
|
|
352
|
-
* @privateRemarks
|
|
353
|
-
* TODO:
|
|
354
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
355
|
-
* We should validate and/or normalize them when inserting content.
|
|
471
|
+
* {@inheritDoc schemaStatics.number}
|
|
356
472
|
*/
|
|
357
473
|
public readonly number = numberSchema;
|
|
358
474
|
|
|
359
475
|
/**
|
|
360
|
-
* {@
|
|
476
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
361
477
|
*/
|
|
362
478
|
public readonly boolean = booleanSchema;
|
|
363
479
|
|
|
364
480
|
/**
|
|
365
|
-
* {@
|
|
366
|
-
*
|
|
367
|
-
* @remarks
|
|
368
|
-
* There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
|
|
369
|
-
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
370
|
-
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
481
|
+
* {@inheritDoc schemaStatics.null}
|
|
371
482
|
*/
|
|
372
483
|
public readonly null = nullSchema;
|
|
373
484
|
|
|
374
485
|
/**
|
|
375
|
-
* {@
|
|
486
|
+
* {@inheritDoc schemaStatics.handle}
|
|
376
487
|
*/
|
|
377
488
|
public readonly handle = handleSchema;
|
|
378
489
|
|
|
490
|
+
/**
|
|
491
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
492
|
+
*/
|
|
493
|
+
public readonly leaves = schemaStatics.leaves;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* {@inheritDoc schemaStatics.string}
|
|
497
|
+
*/
|
|
498
|
+
public static readonly string = stringSchema;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* {@inheritDoc schemaStatics.number}
|
|
502
|
+
*/
|
|
503
|
+
public static readonly number = numberSchema;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
507
|
+
*/
|
|
508
|
+
public static readonly boolean = booleanSchema;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* {@inheritDoc schemaStatics.null}
|
|
512
|
+
*/
|
|
513
|
+
public static readonly null = nullSchema;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* {@inheritDoc schemaStatics.handle}
|
|
517
|
+
*/
|
|
518
|
+
public static readonly handle = handleSchema;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
522
|
+
*/
|
|
523
|
+
public static readonly leaves = schemaStatics.leaves;
|
|
524
|
+
|
|
379
525
|
/**
|
|
380
526
|
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
381
527
|
*
|
|
@@ -694,74 +840,44 @@ export class SchemaFactory<
|
|
|
694
840
|
}
|
|
695
841
|
|
|
696
842
|
/**
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
* @param t - The types allowed under the field.
|
|
700
|
-
* @param props - Optional properties to associate with the field.
|
|
701
|
-
*
|
|
702
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
703
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
843
|
+
* {@inheritDoc schemaStatics.optional}
|
|
704
844
|
*/
|
|
705
|
-
public optional
|
|
706
|
-
t: T,
|
|
707
|
-
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
708
|
-
): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {
|
|
709
|
-
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
710
|
-
return undefined;
|
|
711
|
-
});
|
|
712
|
-
return createFieldSchema(FieldKind.Optional, t, {
|
|
713
|
-
defaultProvider: defaultOptionalProvider,
|
|
714
|
-
...props,
|
|
715
|
-
});
|
|
716
|
-
}
|
|
845
|
+
public readonly optional = schemaStatics.optional;
|
|
717
846
|
|
|
718
847
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
* @param t - The types allowed under the field.
|
|
722
|
-
* @param props - Optional properties to associate with the field.
|
|
723
|
-
*
|
|
724
|
-
* @remarks
|
|
725
|
-
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
726
|
-
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
727
|
-
*
|
|
728
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
729
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
848
|
+
* {@inheritDoc schemaStatics.required}
|
|
730
849
|
*/
|
|
731
|
-
public required
|
|
732
|
-
t: T,
|
|
733
|
-
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
734
|
-
): FieldSchema<FieldKind.Required, T, TCustomMetadata> {
|
|
735
|
-
return createFieldSchema(FieldKind.Required, t, props);
|
|
736
|
-
}
|
|
850
|
+
public readonly required = schemaStatics.required;
|
|
737
851
|
|
|
738
852
|
/**
|
|
739
|
-
* {@
|
|
740
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
741
|
-
* @remarks
|
|
742
|
-
* This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
743
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
853
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
744
854
|
*/
|
|
745
|
-
public optionalRecursive
|
|
746
|
-
t: T,
|
|
747
|
-
props?: Omit<FieldProps, "defaultProvider">,
|
|
748
|
-
): FieldSchemaUnsafe<FieldKind.Optional, T> {
|
|
749
|
-
return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
|
|
750
|
-
}
|
|
855
|
+
public readonly optionalRecursive = schemaStatics.optionalRecursive;
|
|
751
856
|
|
|
752
857
|
/**
|
|
753
|
-
* {@
|
|
754
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
755
|
-
* @remarks
|
|
756
|
-
* This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
757
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
858
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
758
859
|
*/
|
|
759
|
-
public requiredRecursive
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
860
|
+
public readonly requiredRecursive = schemaStatics.requiredRecursive;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* {@inheritDoc schemaStatics.optional}
|
|
864
|
+
*/
|
|
865
|
+
public static readonly optional = schemaStatics.optional;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* {@inheritDoc schemaStatics.required}
|
|
869
|
+
*/
|
|
870
|
+
public static readonly required = schemaStatics.required;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
874
|
+
*/
|
|
875
|
+
public static readonly optionalRecursive = schemaStatics.optionalRecursive;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
879
|
+
*/
|
|
880
|
+
public static readonly requiredRecursive = schemaStatics.requiredRecursive;
|
|
765
881
|
|
|
766
882
|
/**
|
|
767
883
|
* A special field which holds a unique identifier for an object node.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { TreeNode } from "../
|
|
6
|
+
import type { TreeNode } from "../core/index.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A special object that signifies when a SharedTree {@link RunTransaction | transaction} should "roll back".
|
|
@@ -13,11 +13,6 @@ import type {
|
|
|
13
13
|
} from "../../core/index.js";
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
-
RunTransactionParams,
|
|
17
|
-
VoidTransactionCallbackStatus,
|
|
18
|
-
TransactionCallbackStatus,
|
|
19
|
-
TransactionResult,
|
|
20
|
-
TransactionResultExt,
|
|
21
16
|
// This is referenced by doc comments.
|
|
22
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
23
18
|
TreeAlpha,
|
|
@@ -42,6 +37,15 @@ import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
|
42
37
|
import { fail, getOrCreate } from "../../util/index.js";
|
|
43
38
|
import type { MakeNominal } from "../../util/index.js";
|
|
44
39
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
40
|
+
import type { VerboseTree } from "./verboseTree.js";
|
|
41
|
+
import type { SimpleTreeSchema } from "./simpleSchema.js";
|
|
42
|
+
import type {
|
|
43
|
+
RunTransactionParams,
|
|
44
|
+
TransactionCallbackStatus,
|
|
45
|
+
TransactionResult,
|
|
46
|
+
TransactionResultExt,
|
|
47
|
+
VoidTransactionCallbackStatus,
|
|
48
|
+
} from "./transactionTypes.js";
|
|
45
49
|
/**
|
|
46
50
|
* A tree from which a {@link TreeView} can be created.
|
|
47
51
|
*
|
|
@@ -52,7 +56,6 @@ import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
|
52
56
|
* Maybe rename "exportJsonSchema" to align on "concise" terminology.
|
|
53
57
|
* Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
|
|
54
58
|
* Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).
|
|
55
|
-
* Some of these APIs are on ISharedTree and can get moved here.
|
|
56
59
|
* @system @sealed @public
|
|
57
60
|
*/
|
|
58
61
|
export interface ViewableTree {
|
|
@@ -101,6 +104,28 @@ export interface ViewableTree {
|
|
|
101
104
|
*/
|
|
102
105
|
export interface ITree extends ViewableTree, IFluidLoadable {}
|
|
103
106
|
|
|
107
|
+
/**
|
|
108
|
+
* {@link ITree} extended with some alpha APIs.
|
|
109
|
+
* @privateRemarks
|
|
110
|
+
* TODO: Promote this to alpha.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export interface ITreeAlpha extends ITree {
|
|
114
|
+
/**
|
|
115
|
+
* Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
|
|
116
|
+
* @remarks
|
|
117
|
+
* This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).
|
|
118
|
+
*/
|
|
119
|
+
exportVerbose(): VerboseTree | undefined;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.
|
|
123
|
+
* @remarks
|
|
124
|
+
* To get the schema using property keys, use {@link getSimpleSchema} on the view schema.
|
|
125
|
+
*/
|
|
126
|
+
exportSimpleSchema(): SimpleTreeSchema;
|
|
127
|
+
}
|
|
128
|
+
|
|
104
129
|
/**
|
|
105
130
|
* Options when constructing a tree view.
|
|
106
131
|
* @public
|
|
@@ -467,6 +492,10 @@ export interface TreeBranch extends IDisposable {
|
|
|
467
492
|
* Doing that would however complicate trivial "hello world" style example slightly, as well as be a breaking API change.
|
|
468
493
|
* It also seems more complex to handle invalidation with that pattern.
|
|
469
494
|
* Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.
|
|
495
|
+
*
|
|
496
|
+
* @see {@link TreeViewAlpha}
|
|
497
|
+
* @see {@link asTreeViewAlpha}
|
|
498
|
+
*
|
|
470
499
|
* @sealed @public
|
|
471
500
|
*/
|
|
472
501
|
export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
import type { TreeValue } from "../../core/index.js";
|
|
7
7
|
import type { FlexTreeNode } from "../../feature-libraries/index.js";
|
|
8
8
|
import { fail } from "../../util/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type InnerNode,
|
|
11
|
+
unhydratedFlexTreeNodeToTreeNode,
|
|
12
|
+
proxySlot,
|
|
13
|
+
} from "./treeNodeKernel.js";
|
|
10
14
|
import { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
|
|
11
15
|
import type { TreeNode, InternalTreeNode } from "./types.js";
|
|
12
16
|
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
@@ -20,7 +24,7 @@ import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
|
20
24
|
export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | TreeValue {
|
|
21
25
|
const cached =
|
|
22
26
|
flexNode instanceof UnhydratedFlexTreeNode
|
|
23
|
-
?
|
|
27
|
+
? unhydratedFlexTreeNodeToTreeNode.get(flexNode)
|
|
24
28
|
: flexNode.anchorNode.slots.get(proxySlot);
|
|
25
29
|
|
|
26
30
|
if (cached !== undefined) {
|
|
@@ -146,7 +146,7 @@ export class TreeNodeKernel {
|
|
|
146
146
|
|
|
147
147
|
if (innerNode instanceof UnhydratedFlexTreeNode) {
|
|
148
148
|
// Unhydrated case
|
|
149
|
-
|
|
149
|
+
unhydratedFlexTreeNodeToTreeNodeInternal.set(innerNode, node);
|
|
150
150
|
// Register for change events from the unhydrated flex node.
|
|
151
151
|
// These will be fired if the unhydrated node is edited, and will also be forwarded later to the hydrated node.
|
|
152
152
|
this.#hydrationState = {
|
|
@@ -158,7 +158,7 @@ export class TreeNodeKernel {
|
|
|
158
158
|
|
|
159
159
|
let n: UnhydratedFlexTreeNode | undefined = innerNode;
|
|
160
160
|
while (n !== undefined) {
|
|
161
|
-
const treeNode =
|
|
161
|
+
const treeNode = unhydratedFlexTreeNodeToTreeNodeInternal.get(n);
|
|
162
162
|
if (treeNode !== undefined) {
|
|
163
163
|
const kernel = getKernel(treeNode);
|
|
164
164
|
kernel.#unhydratedEvents.value.emit("subtreeChangedAfterBatch");
|
|
@@ -200,7 +200,7 @@ export class TreeNodeKernel {
|
|
|
200
200
|
private hydrate(anchorNode: AnchorNode): void {
|
|
201
201
|
assert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);
|
|
202
202
|
assert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);
|
|
203
|
-
|
|
203
|
+
unhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);
|
|
204
204
|
this.#hydrationState = this.createHydratedState(anchorNode);
|
|
205
205
|
|
|
206
206
|
// If needed, register forwarding emitters for events from before hydration
|
|
@@ -389,9 +389,20 @@ type KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;
|
|
|
389
389
|
export type InnerNode = FlexTreeNode | UnhydratedFlexTreeNode;
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
|
-
* {@
|
|
392
|
+
* Associates a given {@link UnhydratedFlexTreeNode} with a {@link TreeNode}.
|
|
393
393
|
*/
|
|
394
|
-
|
|
394
|
+
const unhydratedFlexTreeNodeToTreeNodeInternal = new WeakMap<
|
|
395
|
+
UnhydratedFlexTreeNode,
|
|
396
|
+
TreeNode
|
|
397
|
+
>();
|
|
398
|
+
/**
|
|
399
|
+
* Retrieves the {@link TreeNode} associated with the given {@link UnhydratedFlexTreeNode} if any.
|
|
400
|
+
*/
|
|
401
|
+
export const unhydratedFlexTreeNodeToTreeNode =
|
|
402
|
+
unhydratedFlexTreeNodeToTreeNodeInternal as Pick<
|
|
403
|
+
WeakMap<UnhydratedFlexTreeNode, TreeNode>,
|
|
404
|
+
"get"
|
|
405
|
+
>;
|
|
395
406
|
|
|
396
407
|
/**
|
|
397
408
|
* An anchor slot which associates an anchor with its corresponding TreeNode, if there is one.
|
|
@@ -401,15 +412,6 @@ export const mapTreeNodeToProxy = new WeakMap<UnhydratedFlexTreeNode, TreeNode>(
|
|
|
401
412
|
*/
|
|
402
413
|
export const proxySlot = anchorSlot<TreeNode>();
|
|
403
414
|
|
|
404
|
-
/**
|
|
405
|
-
* Retrieves the node associated with the given MapTreeNode node if any.
|
|
406
|
-
*/
|
|
407
|
-
export function tryGetTreeNodeFromMapNode(
|
|
408
|
-
flexNode: UnhydratedFlexTreeNode,
|
|
409
|
-
): TreeNode | undefined {
|
|
410
|
-
return mapTreeNodeToProxy.get(flexNode);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
415
|
export function tryDisposeTreeNode(anchorNode: AnchorNode): void {
|
|
414
416
|
const treeNode = anchorNode.slots.get(proxySlot);
|
|
415
417
|
if (treeNode !== undefined) {
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -124,6 +124,18 @@ export {
|
|
|
124
124
|
type CustomTreeNode,
|
|
125
125
|
type CustomTreeValue,
|
|
126
126
|
tryStoredSchemaAsArray,
|
|
127
|
+
type schemaStatics,
|
|
128
|
+
type ITreeAlpha,
|
|
129
|
+
type TransactionConstraint,
|
|
130
|
+
type NodeInDocumentConstraint,
|
|
131
|
+
type RunTransactionParams,
|
|
132
|
+
type VoidTransactionCallbackStatus,
|
|
133
|
+
type TransactionCallbackStatus,
|
|
134
|
+
type TransactionResult,
|
|
135
|
+
type TransactionResultExt,
|
|
136
|
+
type TransactionResultSuccess,
|
|
137
|
+
type TransactionResultFailed,
|
|
138
|
+
rollback,
|
|
127
139
|
} from "./api/index.js";
|
|
128
140
|
export {
|
|
129
141
|
type NodeFromSchema,
|
|
@@ -24,9 +24,9 @@ import { type Mutable, fail, isReadonlyArray } from "../util/index.js";
|
|
|
24
24
|
import {
|
|
25
25
|
getKernel,
|
|
26
26
|
type TreeNode,
|
|
27
|
-
tryGetTreeNodeFromMapNode,
|
|
28
27
|
getOrCreateNodeFromInnerNode,
|
|
29
28
|
tryUnhydratedFlexTreeNode,
|
|
29
|
+
unhydratedFlexTreeNodeToTreeNode,
|
|
30
30
|
} from "./core/index.js";
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -146,7 +146,7 @@ function walkMapTree(
|
|
|
146
146
|
const [p, m] = next;
|
|
147
147
|
const mapTreeNode = tryUnhydratedFlexTreeNode(m);
|
|
148
148
|
if (mapTreeNode !== undefined) {
|
|
149
|
-
const treeNode =
|
|
149
|
+
const treeNode = unhydratedFlexTreeNodeToTreeNode.get(mapTreeNode);
|
|
150
150
|
if (treeNode !== undefined) {
|
|
151
151
|
onVisitTreeNode(p, treeNode);
|
|
152
152
|
}
|
|
@@ -281,7 +281,7 @@ export let createFieldSchema: <
|
|
|
281
281
|
* including functionality that does not have to be kept consistent across versions or deterministic.
|
|
282
282
|
*
|
|
283
283
|
* This can include policy for how to use this schema for "view" purposes, and well as how to expose editing APIs.
|
|
284
|
-
* Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link
|
|
284
|
+
* Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link schemaStatics.optional}.
|
|
285
285
|
* @privateRemarks
|
|
286
286
|
* Public access to the constructor is removed to prevent creating expressible but unsupported (or not stable) configurations.
|
|
287
287
|
* {@link createFieldSchema} can be used internally to create instances.
|
|
@@ -822,7 +822,7 @@ export type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boole
|
|
|
822
822
|
/**
|
|
823
823
|
* Value that may be stored as a leaf node.
|
|
824
824
|
* @remarks
|
|
825
|
-
* Some limitations apply, see the documentation for {@link
|
|
825
|
+
* Some limitations apply, see the documentation for {@link schemaStatics.number} and {@link schemaStatics.string} for those restrictions.
|
|
826
826
|
* @public
|
|
827
827
|
*/
|
|
828
828
|
// eslint-disable-next-line @rushstack/no-new-null
|
package/src/treeFactory.ts
CHANGED
|
@@ -15,25 +15,43 @@ import {
|
|
|
15
15
|
createSharedObjectKind,
|
|
16
16
|
} from "@fluidframework/shared-object-base/internal";
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
|
|
18
|
+
import {
|
|
19
|
+
SharedTree as SharedTreeImpl,
|
|
20
|
+
type SharedTreeOptions,
|
|
21
|
+
type SharedTreeOptionsInternal,
|
|
22
|
+
} from "./shared-tree/index.js";
|
|
20
23
|
import type { ITree } from "./simple-tree/index.js";
|
|
21
24
|
|
|
25
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
29
|
+
* @alpha
|
|
30
|
+
* @legacy
|
|
31
|
+
*/
|
|
32
|
+
export const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
36
|
+
* @alpha
|
|
37
|
+
* @legacy
|
|
38
|
+
*/
|
|
39
|
+
export const SharedTreeAttributes: IChannelAttributes = {
|
|
40
|
+
type: SharedTreeFactoryType,
|
|
41
|
+
snapshotFormatVersion: "0.0.0",
|
|
42
|
+
packageVersion: pkgVersion,
|
|
43
|
+
};
|
|
44
|
+
|
|
22
45
|
/**
|
|
23
46
|
* A channel factory that creates an {@link ITree}.
|
|
24
47
|
*/
|
|
25
48
|
export class TreeFactory implements IChannelFactory<ITree> {
|
|
26
|
-
public static
|
|
27
|
-
public
|
|
28
|
-
type: this.Type,
|
|
29
|
-
snapshotFormatVersion: "0.0.0",
|
|
30
|
-
packageVersion: pkgVersion,
|
|
31
|
-
};
|
|
49
|
+
public static Type: string = SharedTreeFactoryType;
|
|
50
|
+
public readonly type: string = SharedTreeFactoryType;
|
|
32
51
|
|
|
33
|
-
public readonly
|
|
34
|
-
public readonly attributes: IChannelAttributes = TreeFactory.attributes;
|
|
52
|
+
public readonly attributes: IChannelAttributes = SharedTreeAttributes;
|
|
35
53
|
|
|
36
|
-
public constructor(private readonly options:
|
|
54
|
+
public constructor(private readonly options: SharedTreeOptionsInternal) {}
|
|
37
55
|
|
|
38
56
|
public async load(
|
|
39
57
|
runtime: IFluidDataStoreRuntime,
|
package/src/util/breakable.ts
CHANGED
|
@@ -47,7 +47,7 @@ export class Breakable {
|
|
|
47
47
|
* @privateRemarks
|
|
48
48
|
* If there is a use-case, this should be made public.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
public rethrowCaught(brokenBy: unknown): never {
|
|
51
51
|
if (brokenBy instanceof Error) {
|
|
52
52
|
this.break(brokenBy);
|
|
53
53
|
}
|