@fluidframework/tree 2.10.0 → 2.11.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 +25 -0
- package/api-report/tree.alpha.api.md +47 -16
- package/api-report/tree.beta.api.md +5 -14
- package/api-report/tree.legacy.alpha.api.md +5 -14
- package/api-report/tree.legacy.public.api.md +5 -14
- package/api-report/tree.public.api.md +5 -14
- package/dist/alpha.d.ts +9 -0
- package/dist/core/forest/forest.d.ts +10 -2
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +11 -8
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/revertible.d.ts +30 -1
- package/dist/core/revertible.d.ts.map +1 -1
- package/dist/core/revertible.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js +5 -5
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +2 -2
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +21 -21
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +25 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +29 -1
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +24 -14
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +2 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -0
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +361 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
- package/dist/feature-libraries/indexing/index.d.ts +7 -0
- package/dist/feature-libraries/indexing/index.d.ts.map +1 -0
- package/dist/feature-libraries/indexing/index.js +11 -0
- package/dist/feature-libraries/indexing/index.js.map +1 -0
- package/dist/feature-libraries/indexing/types.d.ts +32 -0
- package/dist/feature-libraries/indexing/types.d.ts.map +1 -0
- package/dist/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
- package/dist/feature-libraries/indexing/types.js.map +1 -0
- package/dist/feature-libraries/object-forest/objectForest.d.ts +5 -2
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +21 -11
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +2 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +3 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +7 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +31 -30
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +56 -20
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +3 -3
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +28 -64
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +152 -129
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +25 -81
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +72 -151
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +19 -33
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +73 -54
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +2 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +1 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +4 -3
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +11 -52
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +108 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -0
- package/dist/shared-tree-core/transaction.js +99 -0
- package/dist/shared-tree-core/transaction.js.map +1 -0
- package/dist/shared-tree-core/transactionEnricher.d.ts +8 -13
- package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/transactionEnricher.js +41 -21
- package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +21 -0
- package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -0
- package/dist/simple-tree/api/identifierIndex.js +45 -0
- package/dist/simple-tree/api/identifierIndex.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +2 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +5 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +9 -7
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +65 -0
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
- package/dist/simple-tree/api/simpleTreeIndex.js +91 -0
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -0
- package/dist/simple-tree/api/tree.d.ts +4 -5
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +6 -2
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +53 -22
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +2 -2
- package/dist/simple-tree/core/unhydratedFlexTree.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 +4 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +7 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/index.d.ts +1 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +5 -4
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +6 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/typeCheckTests.d.ts +14 -2
- package/dist/util/typeCheckTests.d.ts.map +1 -1
- package/dist/util/typeCheckTests.js.map +1 -1
- package/dist/util/utils.d.ts +29 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +13 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +9 -0
- package/lib/core/forest/forest.d.ts +10 -2
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +11 -8
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/revertible.d.ts +30 -1
- package/lib/core/revertible.d.ts.map +1 -1
- package/lib/core/revertible.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +2 -2
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +1 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
- package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +25 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +27 -0
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -8
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -3
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -0
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -0
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +356 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
- package/lib/feature-libraries/indexing/index.d.ts +7 -0
- package/lib/feature-libraries/indexing/index.d.ts.map +1 -0
- package/lib/{events → feature-libraries/indexing}/index.js +1 -1
- package/lib/feature-libraries/indexing/index.js.map +1 -0
- package/lib/feature-libraries/indexing/types.d.ts +32 -0
- package/lib/feature-libraries/indexing/types.d.ts.map +1 -0
- package/lib/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
- package/lib/feature-libraries/indexing/types.js.map +1 -0
- package/lib/feature-libraries/object-forest/objectForest.d.ts +5 -2
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +15 -5
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +4 -4
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +7 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +2 -2
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +37 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +5 -5
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +28 -64
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +140 -116
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +25 -81
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +72 -151
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +19 -33
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +74 -55
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +3 -2
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +1 -1
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +1 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +1 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +12 -53
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +108 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -0
- package/lib/shared-tree-core/transaction.js +95 -0
- package/lib/shared-tree-core/transaction.js.map +1 -0
- package/lib/shared-tree-core/transactionEnricher.d.ts +8 -13
- package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/transactionEnricher.js +41 -21
- package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +21 -0
- package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -0
- package/lib/simple-tree/api/identifierIndex.js +41 -0
- package/lib/simple-tree/api/identifierIndex.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +2 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +11 -9
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +65 -0
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
- package/lib/simple-tree/api/simpleTreeIndex.js +87 -0
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -0
- package/lib/simple-tree/api/tree.d.ts +4 -5
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.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 +6 -2
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +31 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.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/objectNode.d.ts +7 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +5 -5
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/index.d.ts +1 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +6 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/typeCheckTests.d.ts +14 -2
- package/lib/util/typeCheckTests.d.ts.map +1 -1
- package/lib/util/typeCheckTests.js.map +1 -1
- package/lib/util/utils.d.ts +29 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +9 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/core/forest/forest.ts +12 -1
- package/src/core/index.ts +8 -1
- package/src/core/rebase/utils.ts +12 -10
- package/src/core/revertible.ts +35 -1
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -1
- package/src/core/tree/anchorSet.ts +2 -1
- package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
- package/src/core/tree/index.ts +1 -0
- package/src/core/tree/visitorUtils.ts +56 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +33 -7
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -3
- package/src/feature-libraries/flex-tree/context.ts +1 -1
- package/src/feature-libraries/index.ts +9 -0
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +453 -0
- package/src/feature-libraries/indexing/index.ts +11 -0
- package/src/feature-libraries/indexing/types.ts +37 -0
- package/src/feature-libraries/object-forest/objectForest.ts +22 -4
- package/src/feature-libraries/sequence-field/invert.ts +4 -4
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +4 -4
- package/src/index.ts +16 -6
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +0 -2
- package/src/shared-tree/schematizingTreeView.ts +7 -7
- package/src/shared-tree/sharedTree.ts +60 -6
- package/src/shared-tree/sharedTreeChangeFamily.ts +5 -4
- package/src/shared-tree/treeCheckout.ts +186 -193
- package/src/shared-tree-core/branch.ts +93 -220
- package/src/shared-tree-core/branchCommitEnricher.ts +69 -64
- package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
- package/src/shared-tree-core/editManager.ts +1 -1
- package/src/shared-tree-core/index.ts +9 -2
- package/src/shared-tree-core/sharedTreeCore.ts +17 -62
- package/src/shared-tree-core/transaction.ts +165 -0
- package/src/shared-tree-core/transactionEnricher.ts +30 -24
- package/src/simple-tree/api/identifierIndex.ts +64 -0
- package/src/simple-tree/api/index.ts +5 -0
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -18
- package/src/simple-tree/api/simpleTreeIndex.ts +231 -0
- package/src/simple-tree/api/tree.ts +8 -5
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/core/index.ts +1 -0
- package/src/simple-tree/core/treeNodeKernel.ts +37 -2
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -1
- package/src/simple-tree/index.ts +4 -0
- package/src/simple-tree/objectNode.ts +19 -12
- package/src/simple-tree/toMapTree.ts +5 -5
- package/src/util/index.ts +3 -1
- package/src/util/typeCheck.ts +6 -1
- package/src/util/typeCheckTests.ts +11 -1
- package/src/util/utils.ts +38 -0
- package/dist/events/emitter.d.ts +0 -139
- package/dist/events/emitter.d.ts.map +0 -1
- package/dist/events/emitter.js +0 -165
- package/dist/events/emitter.js.map +0 -1
- package/dist/events/index.d.ts +0 -7
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/index.js +0 -11
- package/dist/events/index.js.map +0 -1
- package/dist/events/interop.d.ts +0 -30
- package/dist/events/interop.d.ts.map +0 -1
- package/dist/events/interop.js.map +0 -1
- package/dist/events/listeners.d.ts +0 -76
- package/dist/events/listeners.d.ts.map +0 -1
- package/dist/events/listeners.js +0 -7
- package/dist/events/listeners.js.map +0 -1
- package/dist/shared-tree-core/transactionStack.d.ts +0 -29
- package/dist/shared-tree-core/transactionStack.d.ts.map +0 -1
- package/dist/shared-tree-core/transactionStack.js +0 -41
- package/dist/shared-tree-core/transactionStack.js.map +0 -1
- package/dist/util/transactionResult.d.ts +0 -19
- package/dist/util/transactionResult.d.ts.map +0 -1
- package/dist/util/transactionResult.js +0 -23
- package/dist/util/transactionResult.js.map +0 -1
- package/lib/events/emitter.d.ts +0 -139
- package/lib/events/emitter.d.ts.map +0 -1
- package/lib/events/emitter.js +0 -160
- package/lib/events/emitter.js.map +0 -1
- package/lib/events/index.d.ts +0 -7
- package/lib/events/index.d.ts.map +0 -1
- package/lib/events/index.js.map +0 -1
- package/lib/events/interop.d.ts +0 -30
- package/lib/events/interop.d.ts.map +0 -1
- package/lib/events/interop.js.map +0 -1
- package/lib/events/listeners.d.ts +0 -76
- package/lib/events/listeners.d.ts.map +0 -1
- package/lib/events/listeners.js +0 -6
- package/lib/events/listeners.js.map +0 -1
- package/lib/shared-tree-core/transactionStack.d.ts +0 -29
- package/lib/shared-tree-core/transactionStack.d.ts.map +0 -1
- package/lib/shared-tree-core/transactionStack.js +0 -37
- package/lib/shared-tree-core/transactionStack.js.map +0 -1
- package/lib/util/transactionResult.d.ts +0 -19
- package/lib/util/transactionResult.d.ts.map +0 -1
- package/lib/util/transactionResult.js +0 -20
- package/lib/util/transactionResult.js.map +0 -1
- package/src/events/README.md +0 -3
- package/src/events/emitter.ts +0 -256
- package/src/events/index.ts +0 -19
- package/src/events/interop.ts +0 -38
- package/src/events/listeners.ts +0 -80
- package/src/shared-tree-core/transactionStack.ts +0 -45
- package/src/util/transactionResult.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,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,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,CAAC,wBAAa,CAAC,EAAE,CAAC;QACzB,CAAC;QACD,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAChF,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACjF,CAAC;IAED,IAAW,IAAI;QACd,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,8BAAmB,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AAzFD,0BAyFC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC7B,MAAoB,EACpB,QAAuB,EACvB,cAA8B;IAE9B,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAND,wCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n} from \"../../core/index.js\";\nimport type { Listenable } from \"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,kDAM6B;AAE7B,kDAAsE;AAItE,mDAAwE;AACxE,iDAA2C;AA8C3C;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,GAAW,CAAC;AAEjD;;;;GAIG;AACH,MAAa,OAAO;IAOnB;;;;OAIG;IACH,YACiB,YAA0B,EAC1B,QAAuB,EACvB,cAA8B;QAF9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;QACvB,mBAAc,GAAd,cAAc,CAAgB;QAd/B,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QACzC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QAGjD,aAAQ,GAAG,KAAK,CAAC;QAYxB,IAAI,CAAC,eAAe,GAAG;YACtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACnD,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,CAAC,CAAC;SACF,CAAC;QAEF,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,mBAAW,CAAC,EACpD,KAAK,CAAC,kDAAkD,CACxD,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,mBAAW,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEM,UAAU;QAChB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnC,CAAC;IA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oCAAoC,CAAC,CAAC;IACjF,CAAC;IAED,IAAW,IAAI;QACd,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,8BAAmB,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AAzFD,0BAyFC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC7B,MAAoB,EACpB,QAAuB,EACvB,cAA8B;IAE9B,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAND,wCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n} from \"../../core/index.js\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeKeyManager } from \"../node-key/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport { type LazyEntity, prepareForEditSymbol } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext extends FlexTreeContext {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n\n\treadonly nodeKeyManager: NodeKeyManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t * @param checkout - The checkout.\n\t * @param nodeKeyManager - An object which handles node key generation and conversion\n\t */\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn true;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget[prepareForEditSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\tconst field = makeField(this, this.schema.rootFieldSchema.kind, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n\n/**\n * A simple API for a Forest to interact with the tree.\n *\n * @param forest - the Forest\n * @param editor - an editor that makes changes to the forest.\n * @param nodeKeyManager - an object which handles node key generation and conversion.\n * @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n */\nexport function getTreeContext(\n\tschema: SchemaPolicy,\n\tcheckout: ITreeCheckout,\n\tnodeKeyManager: NodeKeyManager,\n): Context {\n\treturn new Context(schema, checkout, nodeKeyManager);\n}\n"]}
|
|
@@ -24,4 +24,5 @@ export { valueSchemaAllows } from "./valueUtilities.js";
|
|
|
24
24
|
export { DetachedFieldIndexSummarizer } from "./detachedFieldIndexSummarizer.js";
|
|
25
25
|
export { type SchemaChange, makeSchemaChangeCodecs, EncodedSchemaChange, } from "./schema-edits/index.js";
|
|
26
26
|
export { makeMitigatedChangeFamily } from "./mitigatedChangeFamily.js";
|
|
27
|
+
export { type KeyFinder, AnchorTreeIndex, hasElement, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./indexing/index.js";
|
|
27
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,QAAQ,EACb,UAAU,GACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACN,qBAAqB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object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.nodeKeyTreeIdentifier = exports.MockNodeKeyManager = exports.isStableNodeKey = exports.createNodeKeyManager = exports.compareLocalNodeKeys = exports.makeFieldBatchCodec = exports.makeTreeChunker = exports.defaultChunkPolicy = exports.buildChunkedForest = exports.chunkFieldSingle = exports.chunkTree = exports.mapRootChanges = exports.isNeverTree = exports.isRepoSuperset = exports.getAllowedContentDiscrepancies = exports.updateRefreshers = exports.EncodedModularChangeset = exports.ModularChangeFamily = exports.FieldKindWithEditor = exports.genericFieldKind = exports.allowsRepoSuperset = exports.FlexFieldKind = exports.CrossFieldTarget = exports.makeModularChangeCodecFamily = exports.ModularEditBuilder = exports.isNeverField = exports.SequenceField = exports.jsonableTreeFromForest = exports.jsonableTreeFromFieldCursor = exports.jsonableTreeFromCursor = exports.cursorForJsonableTreeField = exports.cursorForJsonableTreeNode = exports.stackTreeFieldCursor = exports.prefixFieldPath = exports.prefixPath = exports.stackTreeNodeCursor = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = exports.buildForest = exports.MemoizedIdRangeAllocator = exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeNode = exports.cursorForMapTreeField = exports.ForestSummarizer = exports.isTreeValue = exports.assertAllowedValue = exports.allowsValue = exports.toDownPath = void 0;
|
|
31
|
-
exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.isFreedSymbol = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.getTreeContext = exports.Skip = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationErrors = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = void 0;
|
|
31
|
+
exports.hasElement = exports.AnchorTreeIndex = exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.isFreedSymbol = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.getTreeContext = exports.Skip = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationErrors = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = void 0;
|
|
32
32
|
var editableTreeBinder_js_1 = require("./editableTreeBinder.js");
|
|
33
33
|
Object.defineProperty(exports, "toDownPath", { enumerable: true, get: function () { return editableTreeBinder_js_1.toDownPath; } });
|
|
34
34
|
var valueUtilities_js_1 = require("./valueUtilities.js");
|
|
@@ -134,4 +134,7 @@ Object.defineProperty(exports, "makeSchemaChangeCodecs", { enumerable: true, get
|
|
|
134
134
|
Object.defineProperty(exports, "EncodedSchemaChange", { enumerable: true, get: function () { return index_js_9.EncodedSchemaChange; } });
|
|
135
135
|
var mitigatedChangeFamily_js_1 = require("./mitigatedChangeFamily.js");
|
|
136
136
|
Object.defineProperty(exports, "makeMitigatedChangeFamily", { enumerable: true, get: function () { return mitigatedChangeFamily_js_1.makeMitigatedChangeFamily; } });
|
|
137
|
+
var index_js_10 = require("./indexing/index.js");
|
|
138
|
+
Object.defineProperty(exports, "AnchorTreeIndex", { enumerable: true, get: function () { return index_js_10.AnchorTreeIndex; } });
|
|
139
|
+
Object.defineProperty(exports, "hasElement", { enumerable: true, get: function () { return index_js_10.hasElement; } });
|
|
137
140
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAGiC;AADhC,mHAAA,UAAU,OAAA;AAEX,yDAAmF;AAA1E,gHAAA,WAAW,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,OAAA;AAErD,sDAA6D;AAApD,4GAAA,gBAAgB,OAAA;AACzB,uDAK4B;AAJ3B,yHAAA,qBAAqB,OAAA;AACrB,wHAAA,oBAAoB,OAAA;AACpB,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AAEvB,6EAAuF;AAA9E,uIAAA,wBAAwB,OAAA;AACjC,qDAAuD;AAA9C,uGAAA,WAAW,OAAA;AACpB,oDAA8F;AAArF,4GAAA,gBAAgB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,2GAAA,eAAe,OAAA;AAC5D,2DAO8B;AAN7B,yHAAA,mBAAmB,OAAA;AAEnB,gHAAA,UAAU,OAAA;AACV,qHAAA,eAAe,OAAA;AAEf,0HAAA,oBAAoB,OAAA;AAErB,yDAM6B;AAL5B,8HAAA,yBAAyB,OAAA;AACzB,+HAAA,0BAA0B,OAAA;AAC1B,2HAAA,sBAAsB,OAAA;AACtB,gIAAA,2BAA2B,OAAA;AAC3B,2HAAA,sBAAsB,OAAA;AAGvB,sFAAsF;AACtF,yEAA2D;AAClD,sCAAa;AAEtB,sDAsCmC;AArClC,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAUlB,wHAAA,4BAA4B,OAAA;AAM5B,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AAEb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b,sGAAA,UAAU,OAAA;AACV,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,8GAAA,kBAAkB,OAAA;AAGnB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAEhC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,qFAAiF;AAAxE,+IAAA,4BAA4B,OAAA;AAErC,oDAIiC;AAFhC,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AAGpB,uEAAuE;AAA9D,qIAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype DownPath,\n\ttoDownPath,\n} from \"./editableTreeBinder.js\";\nexport { allowsValue, assertAllowedValue, isTreeValue } from \"./valueUtilities.js\";\n\nexport { ForestSummarizer } from \"./forest-summary/index.js\";\nexport {\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tmapTreeFromCursor,\n\tmapTreeFieldFromCursor,\n} from \"./mapTreeCursor.js\";\nexport { MemoizedIdRangeAllocator, type IdRange } from \"./memoizedIdRangeAllocator.js\";\nexport { buildForest } from \"./object-forest/index.js\";\nexport { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from \"./schema-index/index.js\";\nexport {\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n\tprefixPath,\n\tprefixFieldPath,\n\ttype CursorWithNode,\n\tstackTreeFieldCursor,\n} from \"./treeCursorUtils.js\";\nexport {\n\tcursorForJsonableTreeNode,\n\tcursorForJsonableTreeField,\n\tjsonableTreeFromCursor,\n\tjsonableTreeFromFieldCursor,\n\tjsonableTreeFromForest,\n} from \"./treeTextCursor.js\";\n\n// Split this up into separate import and export for compatibility with API-Extractor.\nimport * as SequenceField from \"./sequence-field/index.js\";\nexport { SequenceField };\n\nexport {\n\tisNeverField,\n\tModularEditBuilder,\n\ttype FieldEditDescription as EditDescription,\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype FieldChangeMap,\n\ttype FieldChange,\n\ttype FieldChangeset,\n\ttype ToDelta,\n\ttype ModularChangeset,\n\tmakeModularChangeCodecFamily,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\ttype GenericChangeset,\n\tgenericFieldKind,\n\ttype HasFieldChanges,\n\ttype NodeExistsConstraint,\n\tFieldKindWithEditor,\n\tModularChangeFamily,\n\ttype RelevantRemovedRootsFromChild,\n\tEncodedModularChangeset,\n\tupdateRefreshers,\n\ttype NodeId,\n\ttype FieldChangeEncodingContext,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tgetAllowedContentDiscrepancies,\n\tisRepoSuperset,\n\tisNeverTree,\n} from \"./modular-schema/index.js\";\n\nexport { mapRootChanges } from \"./deltaUtils.js\";\n\nexport {\n\ttype TreeChunk,\n\tchunkTree,\n\tchunkFieldSingle,\n\tbuildChunkedForest,\n\tdefaultChunkPolicy,\n\ttype FieldBatch,\n\ttype FieldBatchCodec,\n\tmakeTreeChunker,\n\tmakeFieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n} from \"./chunked-forest/index.js\";\n\nexport {\n\tcompareLocalNodeKeys,\n\tcreateNodeKeyManager,\n\tisStableNodeKey,\n\ttype LocalNodeKey,\n\tMockNodeKeyManager,\n\ttype NodeKeyManager,\n\tnodeKeyTreeIdentifier,\n\ttype StableNodeKey,\n} from \"./node-key/index.js\";\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tdefaultSchemaPolicy,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tSchemaValidationErrors,\n\tisNodeInSchema,\n\tisFieldInSchema,\n} from \"./default-schema/index.js\";\n\nexport {\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tSkip,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeEntity,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tgetTreeContext,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeNodeEvents,\n\ttype FlexTreeUnknownUnboxed,\n\tisFlexTreeNode,\n\tContextSlot,\n\t// Internal\n\tflexTreeMarker,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\tgetSchemaAndPolicy,\n\tisFreedSymbol,\n\tLazyEntity,\n\ttreeStatusFromAnchorCache,\n\tindexForAt,\n\tFlexTreeEntityKind,\n} from \"./flex-tree/index.js\";\n\nexport { TreeCompressionStrategy } from \"./treeCompressionUtils.js\";\n\nexport { valueSchemaAllows } from \"./valueUtilities.js\";\n\nexport { DetachedFieldIndexSummarizer } from \"./detachedFieldIndexSummarizer.js\";\n\nexport {\n\ttype SchemaChange,\n\tmakeSchemaChangeCodecs,\n\tEncodedSchemaChange,\n} from \"./schema-edits/index.js\";\n\nexport { makeMitigatedChangeFamily } from \"./mitigatedChangeFamily.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAGiC;AADhC,mHAAA,UAAU,OAAA;AAEX,yDAAmF;AAA1E,gHAAA,WAAW,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,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GAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype DownPath,\n\ttoDownPath,\n} from \"./editableTreeBinder.js\";\nexport { allowsValue, assertAllowedValue, isTreeValue } from \"./valueUtilities.js\";\n\nexport { ForestSummarizer } from \"./forest-summary/index.js\";\nexport {\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tmapTreeFromCursor,\n\tmapTreeFieldFromCursor,\n} from \"./mapTreeCursor.js\";\nexport { MemoizedIdRangeAllocator, type IdRange } from \"./memoizedIdRangeAllocator.js\";\nexport { buildForest } from \"./object-forest/index.js\";\nexport { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from \"./schema-index/index.js\";\nexport {\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n\tprefixPath,\n\tprefixFieldPath,\n\ttype CursorWithNode,\n\tstackTreeFieldCursor,\n} from \"./treeCursorUtils.js\";\nexport {\n\tcursorForJsonableTreeNode,\n\tcursorForJsonableTreeField,\n\tjsonableTreeFromCursor,\n\tjsonableTreeFromFieldCursor,\n\tjsonableTreeFromForest,\n} from \"./treeTextCursor.js\";\n\n// Split this up into separate import and export for compatibility with API-Extractor.\nimport * as SequenceField from \"./sequence-field/index.js\";\nexport { SequenceField };\n\nexport {\n\tisNeverField,\n\tModularEditBuilder,\n\ttype FieldEditDescription as EditDescription,\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype FieldChangeMap,\n\ttype FieldChange,\n\ttype FieldChangeset,\n\ttype ToDelta,\n\ttype ModularChangeset,\n\tmakeModularChangeCodecFamily,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\ttype GenericChangeset,\n\tgenericFieldKind,\n\ttype HasFieldChanges,\n\ttype NodeExistsConstraint,\n\tFieldKindWithEditor,\n\tModularChangeFamily,\n\ttype RelevantRemovedRootsFromChild,\n\tEncodedModularChangeset,\n\tupdateRefreshers,\n\ttype NodeId,\n\ttype FieldChangeEncodingContext,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tgetAllowedContentDiscrepancies,\n\tisRepoSuperset,\n\tisNeverTree,\n} from \"./modular-schema/index.js\";\n\nexport { mapRootChanges } from \"./deltaUtils.js\";\n\nexport {\n\ttype TreeChunk,\n\tchunkTree,\n\tchunkFieldSingle,\n\tbuildChunkedForest,\n\tdefaultChunkPolicy,\n\ttype FieldBatch,\n\ttype FieldBatchCodec,\n\tmakeTreeChunker,\n\tmakeFieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n} from \"./chunked-forest/index.js\";\n\nexport {\n\tcompareLocalNodeKeys,\n\tcreateNodeKeyManager,\n\tisStableNodeKey,\n\ttype LocalNodeKey,\n\tMockNodeKeyManager,\n\ttype NodeKeyManager,\n\tnodeKeyTreeIdentifier,\n\ttype StableNodeKey,\n} from \"./node-key/index.js\";\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tdefaultSchemaPolicy,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tSchemaValidationErrors,\n\tisNodeInSchema,\n\tisFieldInSchema,\n} from \"./default-schema/index.js\";\n\nexport {\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tSkip,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeEntity,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tgetTreeContext,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeNodeEvents,\n\ttype FlexTreeUnknownUnboxed,\n\tisFlexTreeNode,\n\tContextSlot,\n\t// Internal\n\tflexTreeMarker,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\tgetSchemaAndPolicy,\n\tisFreedSymbol,\n\tLazyEntity,\n\ttreeStatusFromAnchorCache,\n\tindexForAt,\n\tFlexTreeEntityKind,\n} from \"./flex-tree/index.js\";\n\nexport { TreeCompressionStrategy } from \"./treeCompressionUtils.js\";\n\nexport { valueSchemaAllows } from \"./valueUtilities.js\";\n\nexport { DetachedFieldIndexSummarizer } from \"./detachedFieldIndexSummarizer.js\";\n\nexport {\n\ttype SchemaChange,\n\tmakeSchemaChangeCodecs,\n\tEncodedSchemaChange,\n} from \"./schema-edits/index.js\";\n\nexport { makeMitigatedChangeFamily } from \"./mitigatedChangeFamily.js\";\n\nexport {\n\ttype KeyFinder,\n\tAnchorTreeIndex,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./indexing/index.js\";\n"]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { disposeSymbol } from "../../util/index.js";
|
|
6
|
+
import { type AnchorNode, type TreeNodeSchemaIdentifier, type ITreeSubscriptionCursor, type IForestSubscription } from "../../core/index.js";
|
|
7
|
+
import type { TreeIndex, TreeIndexKey, TreeIndexNodes } from "./types.js";
|
|
8
|
+
import { TreeStatus } from "../flex-tree/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* A function that gets the value to index a node on, must be pure and functional.
|
|
11
|
+
* The given cursor should point to the node that will be indexed.
|
|
12
|
+
*
|
|
13
|
+
* @returns a value the index will use as the key for the given node
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This function does not own the cursor in any way, it walks the cursor to find the key the node is indexed on
|
|
17
|
+
* but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function
|
|
18
|
+
* and must be disposed elsewhere.
|
|
19
|
+
*/
|
|
20
|
+
export type KeyFinder<TKey extends TreeIndexKey> = (tree: ITreeSubscriptionCursor) => TKey;
|
|
21
|
+
/**
|
|
22
|
+
* An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.
|
|
23
|
+
* A key can map to multiple nodes but each collection of nodes only results in a single value.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that
|
|
27
|
+
* calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.
|
|
28
|
+
*/
|
|
29
|
+
export declare class AnchorTreeIndex<TKey extends TreeIndexKey, TValue> implements TreeIndex<TKey, TValue> {
|
|
30
|
+
private readonly forest;
|
|
31
|
+
private readonly indexer;
|
|
32
|
+
private readonly getValue;
|
|
33
|
+
private readonly checkTreeStatus;
|
|
34
|
+
disposed: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
37
|
+
* need to be considered at all for this index. This allows us to skip subtrees that aren't relevant
|
|
38
|
+
* as a performance optimization.
|
|
39
|
+
*/
|
|
40
|
+
private readonly keyFinders;
|
|
41
|
+
/**
|
|
42
|
+
* The actual index from keys to anchor nodes.
|
|
43
|
+
*/
|
|
44
|
+
private readonly keyToNodes;
|
|
45
|
+
/**
|
|
46
|
+
* Maintained for efficient removal of anchor nodes from the index when updating their keys
|
|
47
|
+
*/
|
|
48
|
+
private readonly nodeToKey;
|
|
49
|
+
/**
|
|
50
|
+
* Keeps track of anchors for disposal.
|
|
51
|
+
*/
|
|
52
|
+
private readonly anchors;
|
|
53
|
+
/**
|
|
54
|
+
* The key finder that is registered on the forest to keep this index updated, maintained
|
|
55
|
+
* here for deregistration on disposal
|
|
56
|
+
*/
|
|
57
|
+
private readonly keyFinder;
|
|
58
|
+
/**
|
|
59
|
+
* @param forest - the forest that is being indexed
|
|
60
|
+
* @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder
|
|
61
|
+
* @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes
|
|
62
|
+
* so that the values returned from the index are more usable
|
|
63
|
+
* @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes
|
|
64
|
+
*/
|
|
65
|
+
constructor(forest: IForestSubscription, indexer: (schemaId: TreeNodeSchemaIdentifier) => KeyFinder<TKey> | undefined, getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined, checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined);
|
|
66
|
+
/**
|
|
67
|
+
* Creates an announced visitor that responds to edits to the forest and updates the index accordingly.
|
|
68
|
+
*/
|
|
69
|
+
private acquireVisitor;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the value associated with the given key if it has been indexed
|
|
72
|
+
*/
|
|
73
|
+
get(key: TKey): TValue | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Returns true iff the key exists in the index
|
|
76
|
+
*/
|
|
77
|
+
has(key: TKey): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the number of values that are indexed
|
|
80
|
+
*/
|
|
81
|
+
get size(): number;
|
|
82
|
+
/**
|
|
83
|
+
* Returns all keys in the index
|
|
84
|
+
*/
|
|
85
|
+
keys(): IterableIterator<TKey>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns an iterable of values in the index
|
|
88
|
+
*/
|
|
89
|
+
values(): IterableIterator<TValue>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns an iterable of key, value pairs for every entry in the index
|
|
92
|
+
*/
|
|
93
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
94
|
+
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
95
|
+
/**
|
|
96
|
+
* Applies the provided callback to each entry in the index.
|
|
97
|
+
*/
|
|
98
|
+
forEach(callbackfn: (value: TValue, key: TKey, map: AnchorTreeIndex<TKey, TValue>) => void, thisArg?: unknown): void;
|
|
99
|
+
/**
|
|
100
|
+
* Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.
|
|
101
|
+
* This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.
|
|
102
|
+
*/
|
|
103
|
+
allEntries(): IterableIterator<[TKey, TValue]>;
|
|
104
|
+
dispose(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Disposes this index and all the anchors it holds onto.
|
|
107
|
+
*/
|
|
108
|
+
[disposeSymbol](): void;
|
|
109
|
+
private checkNotDisposed;
|
|
110
|
+
/**
|
|
111
|
+
* Given a cursor in node mode, indexes it.
|
|
112
|
+
*/
|
|
113
|
+
private indexNode;
|
|
114
|
+
/**
|
|
115
|
+
* Given a cursor in field mode, recursively indexes all nodes under the field.
|
|
116
|
+
*/
|
|
117
|
+
private indexField;
|
|
118
|
+
/**
|
|
119
|
+
* Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.
|
|
120
|
+
*/
|
|
121
|
+
private indexSpine;
|
|
122
|
+
private removeAnchor;
|
|
123
|
+
/**
|
|
124
|
+
* Filters out any anchor nodes that are detached and returns the value for the remaining nodes.
|
|
125
|
+
*/
|
|
126
|
+
private getFilteredValue;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.
|
|
130
|
+
*/
|
|
131
|
+
export declare function hasElement<T>(array: readonly T[]): array is TreeIndexNodes<T>;
|
|
132
|
+
//# sourceMappingURL=anchorTreeIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchorTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-lib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AU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAE7E"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.hasElement = exports.AnchorTreeIndex = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const index_js_1 = require("../../util/index.js");
|
|
10
|
+
const index_js_2 = require("../../core/index.js");
|
|
11
|
+
const index_js_3 = require("../flex-tree/index.js");
|
|
12
|
+
/**
|
|
13
|
+
* An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.
|
|
14
|
+
* A key can map to multiple nodes but each collection of nodes only results in a single value.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that
|
|
18
|
+
* calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.
|
|
19
|
+
*/
|
|
20
|
+
class AnchorTreeIndex {
|
|
21
|
+
/**
|
|
22
|
+
* @param forest - the forest that is being indexed
|
|
23
|
+
* @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder
|
|
24
|
+
* @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes
|
|
25
|
+
* so that the values returned from the index are more usable
|
|
26
|
+
* @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes
|
|
27
|
+
*/
|
|
28
|
+
constructor(forest, indexer, getValue, checkTreeStatus) {
|
|
29
|
+
this.forest = forest;
|
|
30
|
+
this.indexer = indexer;
|
|
31
|
+
this.getValue = getValue;
|
|
32
|
+
this.checkTreeStatus = checkTreeStatus;
|
|
33
|
+
this.disposed = false;
|
|
34
|
+
/**
|
|
35
|
+
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
36
|
+
* need to be considered at all for this index. This allows us to skip subtrees that aren't relevant
|
|
37
|
+
* as a performance optimization.
|
|
38
|
+
*/
|
|
39
|
+
this.keyFinders = new Map();
|
|
40
|
+
/**
|
|
41
|
+
* The actual index from keys to anchor nodes.
|
|
42
|
+
*/
|
|
43
|
+
this.keyToNodes = new Map();
|
|
44
|
+
/**
|
|
45
|
+
* Maintained for efficient removal of anchor nodes from the index when updating their keys
|
|
46
|
+
*/
|
|
47
|
+
this.nodeToKey = new Map();
|
|
48
|
+
/**
|
|
49
|
+
* Keeps track of anchors for disposal.
|
|
50
|
+
*/
|
|
51
|
+
this.anchors = new Map();
|
|
52
|
+
/**
|
|
53
|
+
* The key finder that is registered on the forest to keep this index updated, maintained
|
|
54
|
+
* here for deregistration on disposal
|
|
55
|
+
*/
|
|
56
|
+
this.keyFinder = this.acquireVisitor.bind(this);
|
|
57
|
+
this.forest.registerAnnouncedVisitor(this.keyFinder);
|
|
58
|
+
const detachedFieldKeys = [];
|
|
59
|
+
const detachedFieldsCursor = forest.getCursorAboveDetachedFields();
|
|
60
|
+
(0, index_js_2.forEachField)(detachedFieldsCursor, (field) => {
|
|
61
|
+
detachedFieldKeys.push(field.getFieldKey());
|
|
62
|
+
});
|
|
63
|
+
// index all existing trees (this includes the primary document tree and all other detached/removed trees)
|
|
64
|
+
for (const fieldKey of detachedFieldKeys) {
|
|
65
|
+
const cursor = forest.allocateCursor();
|
|
66
|
+
forest.tryMoveCursorToField({ fieldKey, parent: undefined }, cursor);
|
|
67
|
+
this.indexField(cursor);
|
|
68
|
+
cursor.free();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates an announced visitor that responds to edits to the forest and updates the index accordingly.
|
|
73
|
+
*/
|
|
74
|
+
acquireVisitor() {
|
|
75
|
+
this.checkNotDisposed("visitor getter should be deregistered from the forest when index is disposed");
|
|
76
|
+
let parentField;
|
|
77
|
+
let parent;
|
|
78
|
+
return (0, index_js_2.createAnnouncedVisitor)({
|
|
79
|
+
// nodes (and their entire subtrees) are added to the index as soon as they are created
|
|
80
|
+
afterCreate: (content, destination) => {
|
|
81
|
+
const detachedCursor = this.forest.allocateCursor();
|
|
82
|
+
(0, internal_1.assert)(this.forest.tryMoveCursorToField({ fieldKey: destination, parent: undefined }, detachedCursor) === 1 /* TreeNavigationResult.Ok */, 0xa8a /* destination of created nodes must be a valid detached field */);
|
|
83
|
+
this.indexField(detachedCursor);
|
|
84
|
+
detachedCursor.free();
|
|
85
|
+
},
|
|
86
|
+
// when a replace happens, the keys of previously indexed nodes could be changed so we must re-index them
|
|
87
|
+
afterReplace: () => {
|
|
88
|
+
(0, internal_1.assert)(parent !== undefined, 0xa8b /* must have a parent */);
|
|
89
|
+
const cursor = this.forest.allocateCursor();
|
|
90
|
+
this.forest.moveCursorToPath(parent, cursor);
|
|
91
|
+
(0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0xa8c /* replace should happen in a node */);
|
|
92
|
+
cursor.exitNode();
|
|
93
|
+
// we must re-index the spine because the key finders allow for any value under a subtree to be the key
|
|
94
|
+
// this means that a replace can cause the key for any node up its spine to be changed
|
|
95
|
+
this.indexSpine(cursor);
|
|
96
|
+
cursor.clear();
|
|
97
|
+
},
|
|
98
|
+
// the methods below are used to keep track of the path that has been traversed by the visitor
|
|
99
|
+
// this is required so that cursors can be moved to the correct location when index updates are required
|
|
100
|
+
enterNode(index) {
|
|
101
|
+
(0, internal_1.assert)(parentField !== undefined, 0xa8d /* must be in a field to enter node */);
|
|
102
|
+
parent = {
|
|
103
|
+
parent,
|
|
104
|
+
parentField,
|
|
105
|
+
parentIndex: index,
|
|
106
|
+
};
|
|
107
|
+
parentField = undefined;
|
|
108
|
+
},
|
|
109
|
+
exitNode(index) {
|
|
110
|
+
(0, internal_1.assert)(parent !== undefined, 0xa8e /* must have parent node */);
|
|
111
|
+
const temp = parent;
|
|
112
|
+
parentField = temp.parentField;
|
|
113
|
+
parent = temp.parent;
|
|
114
|
+
},
|
|
115
|
+
enterField: (key) => {
|
|
116
|
+
parentField = key;
|
|
117
|
+
},
|
|
118
|
+
exitField(key) {
|
|
119
|
+
parentField = undefined;
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns the value associated with the given key if it has been indexed
|
|
125
|
+
*/
|
|
126
|
+
get(key) {
|
|
127
|
+
this.checkNotDisposed();
|
|
128
|
+
return this.getFilteredValue(this.keyToNodes.get(key));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Returns true iff the key exists in the index
|
|
132
|
+
*/
|
|
133
|
+
has(key) {
|
|
134
|
+
this.checkNotDisposed();
|
|
135
|
+
return this.get(key) !== undefined;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the number of values that are indexed
|
|
139
|
+
*/
|
|
140
|
+
get size() {
|
|
141
|
+
this.checkNotDisposed();
|
|
142
|
+
let s = 0;
|
|
143
|
+
for (const nodes of this.keyToNodes.values()) {
|
|
144
|
+
if (this.getFilteredValue(nodes) !== undefined) {
|
|
145
|
+
s += 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return s;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns all keys in the index
|
|
152
|
+
*/
|
|
153
|
+
*keys() {
|
|
154
|
+
this.checkNotDisposed();
|
|
155
|
+
for (const [key, nodes] of this.keyToNodes.entries()) {
|
|
156
|
+
if (this.getFilteredValue(nodes) !== undefined) {
|
|
157
|
+
yield key;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns an iterable of values in the index
|
|
163
|
+
*/
|
|
164
|
+
*values() {
|
|
165
|
+
this.checkNotDisposed();
|
|
166
|
+
for (const nodes of this.keyToNodes.values()) {
|
|
167
|
+
const filtered = this.getFilteredValue(nodes);
|
|
168
|
+
if (filtered !== undefined) {
|
|
169
|
+
yield filtered;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Returns an iterable of key, value pairs for every entry in the index
|
|
175
|
+
*/
|
|
176
|
+
*entries() {
|
|
177
|
+
this.checkNotDisposed();
|
|
178
|
+
for (const [key, nodes] of this.keyToNodes.entries()) {
|
|
179
|
+
const filtered = this.getFilteredValue(nodes);
|
|
180
|
+
if (filtered !== undefined) {
|
|
181
|
+
yield [key, filtered];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
[Symbol.iterator]() {
|
|
186
|
+
this.checkNotDisposed();
|
|
187
|
+
return this.entries();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Applies the provided callback to each entry in the index.
|
|
191
|
+
*/
|
|
192
|
+
forEach(callbackfn, thisArg) {
|
|
193
|
+
this.checkNotDisposed();
|
|
194
|
+
for (const [key, nodes] of this.keyToNodes.entries()) {
|
|
195
|
+
const filtered = this.getFilteredValue(nodes);
|
|
196
|
+
if (filtered !== undefined) {
|
|
197
|
+
callbackfn.call(thisArg, filtered, key, this);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.
|
|
203
|
+
* This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.
|
|
204
|
+
*/
|
|
205
|
+
*allEntries() {
|
|
206
|
+
this.checkNotDisposed();
|
|
207
|
+
for (const [key, nodes] of this.keyToNodes.entries()) {
|
|
208
|
+
const value = this.getValue(nodes);
|
|
209
|
+
if (value !== undefined) {
|
|
210
|
+
yield [key, value];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
dispose() {
|
|
215
|
+
this[index_js_1.disposeSymbol]();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Disposes this index and all the anchors it holds onto.
|
|
219
|
+
*/
|
|
220
|
+
[index_js_1.disposeSymbol]() {
|
|
221
|
+
this.checkNotDisposed("index is already disposed");
|
|
222
|
+
for (const anchors of this.anchors.values()) {
|
|
223
|
+
for (const anchor of anchors) {
|
|
224
|
+
this.forest.forgetAnchor(anchor);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.keyToNodes.clear();
|
|
228
|
+
this.anchors.clear();
|
|
229
|
+
this.forest.deregisterAnnouncedVisitor(this.keyFinder);
|
|
230
|
+
this.disposed = true;
|
|
231
|
+
}
|
|
232
|
+
checkNotDisposed(errorMessage) {
|
|
233
|
+
if (this.disposed) {
|
|
234
|
+
if (errorMessage !== undefined) {
|
|
235
|
+
throw new Error(errorMessage);
|
|
236
|
+
}
|
|
237
|
+
(0, internal_1.assert)(false, 0xa8f /* invalid operation on a disposed index */);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Given a cursor in node mode, indexes it.
|
|
242
|
+
*/
|
|
243
|
+
indexNode(nodeCursor) {
|
|
244
|
+
const keyFinder = (0, index_js_1.getOrCreate)(this.keyFinders,
|
|
245
|
+
// the node schema type to look up
|
|
246
|
+
nodeCursor.type,
|
|
247
|
+
// if the indexer does not return a key finder for this schema, we cache a null value to indicate the indexer
|
|
248
|
+
// does not need to be called if this schema is encountered in the future
|
|
249
|
+
(schema) => this.indexer(schema) ?? null);
|
|
250
|
+
if (keyFinder !== null) {
|
|
251
|
+
const expectedPath = nodeCursor.getPath();
|
|
252
|
+
const key = keyFinder(nodeCursor);
|
|
253
|
+
// TODO: determine perf impact of this check, alternative is not doing it in which case (if the key finder is not pure and functional),
|
|
254
|
+
// an error may be thrown further down the line if the structure of the nodes aren't expected or the contents of the index could be inaccurate
|
|
255
|
+
if (!(0, index_js_2.compareUpPaths)(nodeCursor.getPath(), expectedPath)) {
|
|
256
|
+
throw new Error("key finder should be pure and functional");
|
|
257
|
+
}
|
|
258
|
+
const anchor = nodeCursor.buildAnchor();
|
|
259
|
+
const anchorNode = this.forest.anchors.locate(anchor) ?? (0, index_js_1.fail)("expected anchor node");
|
|
260
|
+
// check if this anchor node already exists in the index
|
|
261
|
+
const existingKey = this.nodeToKey.get(anchorNode);
|
|
262
|
+
if (existingKey !== undefined) {
|
|
263
|
+
// if the node already exists but has the same key, we return early
|
|
264
|
+
if (existingKey === key) {
|
|
265
|
+
this.forest.forgetAnchor(anchor);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
// if the node has a different key, we remove the existing one first because it means the key had been detached
|
|
270
|
+
this.removeAnchor(anchorNode, existingKey);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
(0, index_js_1.getOrCreate)(this.keyToNodes, key, () => []).push(anchorNode);
|
|
274
|
+
this.nodeToKey.set(anchorNode, key);
|
|
275
|
+
(0, index_js_1.getOrCreate)(this.anchors, anchorNode, () => []).push(anchor);
|
|
276
|
+
// when the anchor node is destroyed, delete it from the index
|
|
277
|
+
anchorNode.events.on("afterDestroy", () => {
|
|
278
|
+
this.removeAnchor(anchorNode, key);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Given a cursor in field mode, recursively indexes all nodes under the field.
|
|
284
|
+
*/
|
|
285
|
+
indexField(fieldCursor) {
|
|
286
|
+
(0, index_js_2.forEachNode)(fieldCursor, (nodeCursor) => {
|
|
287
|
+
this.indexNode(nodeCursor);
|
|
288
|
+
(0, index_js_2.forEachField)(nodeCursor, (f) => {
|
|
289
|
+
this.indexField(f);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.
|
|
295
|
+
*/
|
|
296
|
+
indexSpine(cursor) {
|
|
297
|
+
this.indexField(cursor);
|
|
298
|
+
if ((0, index_js_2.keyAsDetachedField)(cursor.getFieldKey()) !== index_js_2.rootField) {
|
|
299
|
+
cursor.exitField();
|
|
300
|
+
cursor.exitNode();
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// return early if we're already at the root field
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
// walk up the spine and index nodes until we reach the root
|
|
307
|
+
while (cursor.mode === 1 /* CursorLocationType.Fields */ &&
|
|
308
|
+
(0, index_js_2.keyAsDetachedField)(cursor.getFieldKey()) !== index_js_2.rootField) {
|
|
309
|
+
(0, index_js_2.forEachNode)(cursor, (nodeCursor) => {
|
|
310
|
+
this.indexNode(nodeCursor);
|
|
311
|
+
});
|
|
312
|
+
cursor.exitField();
|
|
313
|
+
cursor.exitNode();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
removeAnchor(anchorNode, key) {
|
|
317
|
+
const indexedNodes = this.keyToNodes.get(key);
|
|
318
|
+
(0, internal_1.assert)(indexedNodes !== undefined, 0xa90 /* destroyed anchor node should be tracked by index */);
|
|
319
|
+
const index = indexedNodes.indexOf(anchorNode);
|
|
320
|
+
(0, internal_1.assert)(index !== -1, 0xa91 /* destroyed anchor node should be tracked by index */);
|
|
321
|
+
const newNodes = filterNodes(indexedNodes, (n) => n !== anchorNode);
|
|
322
|
+
if (newNodes !== undefined && newNodes.length > 0) {
|
|
323
|
+
this.keyToNodes.set(key, newNodes);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
this.keyToNodes.delete(key);
|
|
327
|
+
}
|
|
328
|
+
this.nodeToKey.delete(anchorNode);
|
|
329
|
+
(0, internal_1.assert)(this.anchors.delete(anchorNode), 0xa92 /* destroyed anchor should be tracked by index */);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Filters out any anchor nodes that are detached and returns the value for the remaining nodes.
|
|
333
|
+
*/
|
|
334
|
+
getFilteredValue(anchorNodes) {
|
|
335
|
+
const attachedNodes = filterNodes(anchorNodes, (anchorNode) => {
|
|
336
|
+
const nodeStatus = this.checkTreeStatus(anchorNode);
|
|
337
|
+
return nodeStatus === index_js_3.TreeStatus.InDocument;
|
|
338
|
+
});
|
|
339
|
+
if (attachedNodes !== undefined && hasElement(attachedNodes)) {
|
|
340
|
+
return this.getValue(attachedNodes);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
exports.AnchorTreeIndex = AnchorTreeIndex;
|
|
345
|
+
/**
|
|
346
|
+
* Filters the given anchor nodes based on the given filter function.
|
|
347
|
+
*/
|
|
348
|
+
function filterNodes(anchorNodes, filter) {
|
|
349
|
+
if (anchorNodes !== undefined) {
|
|
350
|
+
return anchorNodes.filter(filter);
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.
|
|
356
|
+
*/
|
|
357
|
+
function hasElement(array) {
|
|
358
|
+
return array.length >= 1;
|
|
359
|
+
}
|
|
360
|
+
exports.hasElement = hasElement;
|
|
361
|
+
//# sourceMappingURL=anchorTreeIndex.js.map
|