@fluidframework/tree 2.10.0 → 2.12.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 +29 -0
- package/api-report/tree.alpha.api.md +49 -18
- package/api-report/tree.beta.api.md +6 -15
- package/api-report/tree.legacy.alpha.api.md +6 -15
- package/api-report/tree.legacy.public.api.md +6 -15
- package/api-report/tree.public.api.md +6 -15
- 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 +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -3
- 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 +13 -17
- 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/format.d.ts +0 -3
- package/dist/core/schema-stored/format.d.ts.map +1 -1
- package/dist/core/schema-stored/format.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +12 -10
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -5
- package/dist/core/schema-stored/schema.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/schema-view/index.d.ts +1 -1
- package/dist/core/schema-view/index.d.ts.map +1 -1
- package/dist/core/schema-view/index.js +1 -2
- package/dist/core/schema-view/index.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -7
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js +1 -12
- package/dist/core/schema-view/view.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/{lib/feature-libraries/chunked-forest → dist/core/tree}/chunk.d.ts +2 -1
- package/dist/core/tree/chunk.d.ts.map +1 -0
- package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
- package/dist/core/tree/chunk.js.map +1 -0
- 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 +2 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +6 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts +0 -5
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.d.ts +0 -5
- package/dist/core/tree/types.d.ts.map +1 -1
- package/dist/core/tree/types.js +0 -1
- package/dist/core/tree/types.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/basicChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -3
- 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/codec/chunkCodecUtilities.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +5 -5
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/dist/feature-libraries/default-schema/schemaChecker.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 +2 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +9 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +139 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +387 -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/modular-schema/discrepancies.d.ts +84 -24
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +5 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- 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/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- 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/feature-libraries/sequence-field/types.d.ts +0 -1
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -13
- 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 +2 -2
- 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/schematizeTree.d.ts +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +6 -6
- package/dist/shared-tree/schematizeTree.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 +35 -38
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +27 -6
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +146 -21
- 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 +59 -72
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +243 -188
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +29 -107
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +51 -195
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +24 -32
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +70 -53
- 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 +4 -4
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +5 -4
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +3 -10
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +14 -67
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +146 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -0
- package/dist/shared-tree-core/transaction.js +211 -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/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +5 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +14 -2
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +53 -3
- package/dist/simple-tree/api/customTree.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 +4 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +8 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +48 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +5 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -1
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +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 +93 -0
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -0
- package/dist/simple-tree/api/storedSchema.d.ts +4 -4
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +8 -21
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +5 -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/api/verboseTree.js +1 -1
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.d.ts +14 -9
- package/dist/simple-tree/api/view.d.ts.map +1 -1
- package/dist/simple-tree/api/view.js +129 -40
- package/dist/simple-tree/api/view.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 +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +0 -15
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -15
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +15 -5
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +18 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +4 -0
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +4 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +18 -13
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/util/brand.d.ts +0 -2
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +0 -1
- package/dist/util/brand.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 +6 -4
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +6 -3
- 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 +42 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +35 -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 +3 -3
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +3 -3
- 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 +13 -17
- 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/format.d.ts +0 -3
- package/lib/core/schema-stored/format.d.ts.map +1 -1
- package/lib/core/schema-stored/format.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +12 -10
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -5
- package/lib/core/schema-stored/schema.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/schema-view/index.d.ts +1 -1
- package/lib/core/schema-view/index.d.ts.map +1 -1
- package/lib/core/schema-view/index.js +1 -1
- package/lib/core/schema-view/index.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -7
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js +0 -11
- package/lib/core/schema-view/view.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/{dist/feature-libraries/chunked-forest → lib/core/tree}/chunk.d.ts +2 -1
- package/lib/core/tree/chunk.d.ts.map +1 -0
- package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
- package/lib/core/tree/chunk.js.map +1 -0
- 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 +2 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +2 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts +0 -5
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/types.d.ts +0 -5
- package/lib/core/tree/types.d.ts.map +1 -1
- package/lib/core/tree/types.js +0 -1
- package/lib/core/tree/types.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/basicChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -3
- 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/codec/chunkCodecUtilities.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +4 -4
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/lib/feature-libraries/default-schema/schemaChecker.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 +2 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +139 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +382 -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/modular-schema/discrepancies.d.ts +84 -24
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- 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/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- 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/feature-libraries/sequence-field/types.d.ts +0 -1
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/index.d.ts +6 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- 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 +2 -2
- 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/schematizeTree.d.ts +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +7 -7
- package/lib/shared-tree/schematizeTree.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 +12 -16
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +27 -6
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +135 -10
- 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 +59 -72
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +233 -177
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +29 -107
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +50 -193
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +24 -32
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +71 -54
- 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 +4 -4
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +3 -10
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +15 -68
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +146 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -0
- package/lib/shared-tree-core/transaction.js +206 -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/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +2 -2
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +5 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +14 -2
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +50 -2
- package/lib/simple-tree/api/customTree.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 +4 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +4 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +48 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +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 +89 -0
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -0
- package/lib/simple-tree/api/storedSchema.d.ts +4 -4
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +5 -18
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +5 -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/api/verboseTree.js +2 -2
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.d.ts +14 -9
- package/lib/simple-tree/api/view.d.ts.map +1 -1
- package/lib/simple-tree/api/view.js +131 -42
- package/lib/simple-tree/api/view.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 +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +0 -15
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -15
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +15 -5
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +16 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +4 -0
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +4 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +5 -5
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +19 -14
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/util/brand.d.ts +0 -2
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +0 -1
- package/lib/util/brand.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 -3
- 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 +42 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +30 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/forest/forest.ts +12 -1
- package/src/core/index.ts +13 -2
- package/src/core/rebase/utils.ts +28 -29
- package/src/core/revertible.ts +35 -1
- package/src/core/schema-stored/format.ts +0 -3
- package/src/core/schema-stored/schema.ts +13 -10
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -1
- package/src/core/schema-view/index.ts +0 -1
- package/src/core/schema-view/view.ts +0 -11
- package/src/core/tree/anchorSet.ts +2 -1
- package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
- package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
- package/src/core/tree/index.ts +9 -0
- package/src/core/tree/treeTextFormat.ts +0 -5
- package/src/core/tree/types.ts +0 -5
- package/src/core/tree/visitorUtils.ts +56 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +35 -8
- package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/index.ts +1 -1
- package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +7 -4
- package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
- package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
- package/src/feature-libraries/flex-tree/context.ts +1 -1
- package/src/feature-libraries/index.ts +22 -0
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +482 -0
- package/src/feature-libraries/indexing/index.ts +11 -0
- package/src/feature-libraries/indexing/types.ts +37 -0
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/index.ts +13 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- 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/feature-libraries/sequence-field/types.ts +0 -1
- package/src/index.ts +17 -35
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +1 -2
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +18 -28
- package/src/shared-tree/sharedTree.ts +216 -30
- package/src/shared-tree/sharedTreeChangeFamily.ts +5 -4
- package/src/shared-tree/treeCheckout.ts +341 -299
- package/src/shared-tree-core/branch.ts +80 -300
- package/src/shared-tree-core/branchCommitEnricher.ts +66 -62
- package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
- package/src/shared-tree-core/editManager.ts +4 -9
- package/src/shared-tree-core/index.ts +11 -3
- package/src/shared-tree-core/sharedTreeCore.ts +23 -79
- package/src/shared-tree-core/transaction.ts +310 -0
- package/src/shared-tree-core/transactionEnricher.ts +30 -24
- package/src/simple-tree/api/conciseTree.ts +2 -2
- package/src/simple-tree/api/create.ts +5 -1
- package/src/simple-tree/api/customTree.ts +69 -1
- package/src/simple-tree/api/identifierIndex.ts +64 -0
- package/src/simple-tree/api/index.ts +17 -2
- package/src/simple-tree/api/schemaFactory.ts +62 -1
- package/src/simple-tree/api/simpleSchema.ts +3 -1
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -18
- package/src/simple-tree/api/simpleTreeIndex.ts +233 -0
- package/src/simple-tree/api/storedSchema.ts +7 -22
- package/src/simple-tree/api/tree.ts +14 -5
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- 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 +10 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/objectNode.ts +45 -14
- package/src/simple-tree/objectNodeTypes.ts +5 -0
- package/src/simple-tree/schemaTypes.ts +7 -2
- package/src/simple-tree/toMapTree.ts +5 -5
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +4 -1
- package/src/util/typeCheck.ts +6 -3
- package/src/util/typeCheckTests.ts +11 -1
- package/src/util/utils.ts +64 -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/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/chunk.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/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/chunk.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
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { AdaptedViewSchema, type Adapters,
|
|
5
|
+
import { AdaptedViewSchema, type Adapters, type TreeStoredSchema } from "../../core/index.js";
|
|
6
6
|
import { type FullSchemaPolicy } from "../../feature-libraries/index.js";
|
|
7
|
+
import { type FieldSchema, type ImplicitFieldSchema } from "../schemaTypes.js";
|
|
8
|
+
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
7
9
|
/**
|
|
8
10
|
* A collection of View information for schema, including policy.
|
|
9
11
|
*/
|
|
10
12
|
export declare class ViewSchema {
|
|
11
13
|
readonly policy: FullSchemaPolicy;
|
|
12
14
|
readonly adapters: Adapters;
|
|
13
|
-
readonly schema: TreeStoredSchema;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Cached conversion of the view schema in the stored schema format.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
private readonly viewSchemaAsStored;
|
|
19
|
+
/**
|
|
20
|
+
* Normalized view schema (implicitly allowed view schema types are converted to their canonical form).
|
|
21
|
+
*/
|
|
22
|
+
readonly schema: FieldSchema;
|
|
23
|
+
/**
|
|
24
|
+
* @param viewSchema - Schema for the root field of this view.
|
|
25
|
+
*/
|
|
26
|
+
constructor(policy: FullSchemaPolicy, adapters: Adapters, viewSchema: ImplicitFieldSchema);
|
|
18
27
|
/**
|
|
19
28
|
* Determines the compatibility of a stored document
|
|
20
29
|
* (based on its stored schema) with a viewer (based on its view schema).
|
|
@@ -25,11 +34,7 @@ export declare class ViewSchema {
|
|
|
25
34
|
* TODO: this API violates the parse don't validate design philosophy.
|
|
26
35
|
* It should be wrapped with (or replaced by) a parse style API.
|
|
27
36
|
*/
|
|
28
|
-
checkCompatibility(stored: TreeStoredSchema):
|
|
29
|
-
read: Compatibility;
|
|
30
|
-
write: Compatibility;
|
|
31
|
-
writeAllowingStoredSchemaUpdates: Compatibility;
|
|
32
|
-
};
|
|
37
|
+
checkCompatibility(stored: TreeStoredSchema): Omit<SchemaCompatibilityStatus, "canInitialize">;
|
|
33
38
|
/**
|
|
34
39
|
* Compute a schema that `original` could be viewed as using adapters as needed.
|
|
35
40
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/view.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/view.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EAEjB,KAAK,QAAQ,EAGb,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEN,KAAK,gBAAgB,EAOrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH,qBAAa,UAAU;aAcL,MAAM,EAAE,gBAAgB;aACxB,QAAQ,EAAE,QAAQ;IAdnC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAmB;IACtD;;OAEG;IACH,SAAgB,MAAM,EAAE,WAAW,CAAC;IAEpC;;OAEG;gBAEc,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClC,UAAU,EAAE,mBAAmB;IAMhC;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAM,EAAE,gBAAgB,GACtB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IAkKnD;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB;IAiC7D;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;CAIjB"}
|
|
@@ -8,17 +8,21 @@ exports.ViewSchema = void 0;
|
|
|
8
8
|
const index_js_1 = require("../../core/index.js");
|
|
9
9
|
const index_js_2 = require("../../util/index.js");
|
|
10
10
|
const index_js_3 = require("../../feature-libraries/index.js");
|
|
11
|
+
const schemaTypes_js_1 = require("../schemaTypes.js");
|
|
12
|
+
const toStoredSchema_js_1 = require("../toStoredSchema.js");
|
|
13
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
11
14
|
/**
|
|
12
15
|
* A collection of View information for schema, including policy.
|
|
13
16
|
*/
|
|
14
17
|
class ViewSchema {
|
|
15
18
|
/**
|
|
16
|
-
* @param
|
|
19
|
+
* @param viewSchema - Schema for the root field of this view.
|
|
17
20
|
*/
|
|
18
|
-
constructor(policy, adapters,
|
|
21
|
+
constructor(policy, adapters, viewSchema) {
|
|
19
22
|
this.policy = policy;
|
|
20
23
|
this.adapters = adapters;
|
|
21
|
-
this.schema =
|
|
24
|
+
this.schema = (0, schemaTypes_js_1.normalizeFieldSchema)(viewSchema);
|
|
25
|
+
this.viewSchemaAsStored = (0, toStoredSchema_js_1.toStoredSchema)(this.schema);
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Determines the compatibility of a stored document
|
|
@@ -33,42 +37,127 @@ class ViewSchema {
|
|
|
33
37
|
checkCompatibility(stored) {
|
|
34
38
|
// TODO: support adapters
|
|
35
39
|
// const adapted = this.adaptRepo(stored);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
|
|
41
|
+
// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
|
|
42
|
+
// In the future, this would also include things like:
|
|
43
|
+
// - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
|
|
44
|
+
let canView = true;
|
|
45
|
+
// View schema allows a superset of documents that stored schema does, hence the document could be upgraded to use a persisted version
|
|
46
|
+
// of this view schema as its stored schema.
|
|
47
|
+
let canUpgrade = true;
|
|
48
|
+
const updateCompatibilityFromFieldDiscrepancy = (discrepancy) => {
|
|
49
|
+
switch (discrepancy.mismatch) {
|
|
50
|
+
case "allowedTypes": {
|
|
51
|
+
// Since we only track the symmetric difference between the allowed types in the view and
|
|
52
|
+
// stored schemas, it's sufficient to check if any extra allowed types still exist in the
|
|
53
|
+
// stored schema.
|
|
54
|
+
if (discrepancy.stored.some((identifier) => !(0, index_js_3.isNeverTree)(this.policy, stored, stored.nodeSchema.get(identifier)))) {
|
|
55
|
+
// Stored schema has extra allowed types that the view schema does not.
|
|
56
|
+
canUpgrade = false;
|
|
57
|
+
canView = false;
|
|
58
|
+
}
|
|
59
|
+
if (discrepancy.view.some((identifier) => !(0, index_js_3.isNeverTree)(this.policy, this.viewSchemaAsStored, this.viewSchemaAsStored.nodeSchema.get(identifier)))) {
|
|
60
|
+
// View schema has extra allowed types that the stored schema does not.
|
|
61
|
+
canView = false;
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "fieldKind": {
|
|
66
|
+
const result = (0, index_js_3.comparePosetElements)(discrepancy.stored, discrepancy.view, index_js_3.fieldRealizer);
|
|
67
|
+
if (result === index_js_3.PosetComparisonResult.Greater) {
|
|
68
|
+
// Stored schema is more relaxed than view schema.
|
|
69
|
+
canUpgrade = false;
|
|
70
|
+
if (discrepancy.view === index_js_3.FieldKinds.forbidden.identifier &&
|
|
71
|
+
discrepancy.identifier !== undefined &&
|
|
72
|
+
this.policy.allowUnknownOptionalFields(discrepancy.identifier)) {
|
|
73
|
+
// When the application has opted into it, we allow viewing documents which have additional
|
|
74
|
+
// optional fields in the stored schema that are not present in the view schema.
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
canView = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (result === index_js_3.PosetComparisonResult.Less) {
|
|
81
|
+
// View schema is more relaxed than stored schema.
|
|
82
|
+
canView = false;
|
|
83
|
+
}
|
|
84
|
+
if (result === index_js_3.PosetComparisonResult.Incomparable) {
|
|
85
|
+
canUpgrade = false;
|
|
86
|
+
canView = false;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case "valueSchema": {
|
|
91
|
+
canView = false;
|
|
92
|
+
canUpgrade = false;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
(0, internal_1.unreachableCase)(discrepancy);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
for (const discrepancy of (0, index_js_3.getAllowedContentDiscrepancies)(this.viewSchemaAsStored, stored)) {
|
|
100
|
+
if (!canView && !canUpgrade) {
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
switch (discrepancy.mismatch) {
|
|
104
|
+
case "nodeKind": {
|
|
105
|
+
const viewNodeSchema = this.viewSchemaAsStored.nodeSchema.get(discrepancy.identifier);
|
|
106
|
+
const storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);
|
|
107
|
+
// We conservatively do not allow node types to change.
|
|
108
|
+
// The only time this might be valid in the sense that the data canonically converts is converting an object node
|
|
109
|
+
// to a map node over the union of all the object fields' types.
|
|
110
|
+
if (discrepancy.stored === undefined) {
|
|
111
|
+
const viewIsNever = viewNodeSchema !== undefined
|
|
112
|
+
? (0, index_js_3.isNeverTree)(this.policy, this.viewSchemaAsStored, viewNodeSchema)
|
|
113
|
+
: true;
|
|
114
|
+
if (!viewIsNever) {
|
|
115
|
+
// View schema has added a node type that the stored schema doesn't know about.
|
|
116
|
+
canView = false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else if (discrepancy.view === undefined) {
|
|
120
|
+
const storedIsNever = storedNodeSchema !== undefined
|
|
121
|
+
? (0, index_js_3.isNeverTree)(this.policy, stored, storedNodeSchema)
|
|
122
|
+
: true;
|
|
123
|
+
if (!storedIsNever) {
|
|
124
|
+
// Stored schema has a node type that the view schema doesn't know about.
|
|
125
|
+
canUpgrade = false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// Node type exists in both schemas but has changed. We conservatively never allow this.
|
|
130
|
+
const storedIsNever = storedNodeSchema !== undefined
|
|
131
|
+
? (0, index_js_3.isNeverTree)(this.policy, stored, storedNodeSchema)
|
|
132
|
+
: true;
|
|
133
|
+
const viewIsNever = viewNodeSchema !== undefined
|
|
134
|
+
? (0, index_js_3.isNeverTree)(this.policy, this.viewSchemaAsStored, viewNodeSchema)
|
|
135
|
+
: true;
|
|
136
|
+
if (!storedIsNever || !viewIsNever) {
|
|
137
|
+
canView = false;
|
|
138
|
+
canUpgrade = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case "valueSchema":
|
|
144
|
+
case "allowedTypes":
|
|
145
|
+
case "fieldKind": {
|
|
146
|
+
updateCompatibilityFromFieldDiscrepancy(discrepancy);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "fields": {
|
|
150
|
+
discrepancy.differences.forEach(updateCompatibilityFromFieldDiscrepancy);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
// No default
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
canView,
|
|
158
|
+
canUpgrade,
|
|
159
|
+
isEquivalent: canView && canUpgrade,
|
|
160
|
+
};
|
|
72
161
|
}
|
|
73
162
|
/**
|
|
74
163
|
* Compute a schema that `original` could be viewed as using adapters as needed.
|
|
@@ -82,7 +171,7 @@ class ViewSchema {
|
|
|
82
171
|
// and its impossible for an adapter to be correctly implemented if its output type is never
|
|
83
172
|
// (unless its input is also never).
|
|
84
173
|
for (const adapter of this.adapters?.tree ?? []) {
|
|
85
|
-
if ((0, index_js_3.isNeverTree)(this.policy, this.
|
|
174
|
+
if ((0, index_js_3.isNeverTree)(this.policy, this.viewSchemaAsStored, this.viewSchemaAsStored.nodeSchema.get(adapter.output))) {
|
|
86
175
|
(0, index_js_2.fail)("tree adapter for stored adapter.output should not be never");
|
|
87
176
|
}
|
|
88
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/simple-tree/api/view.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAQ6B;AAC7B,kDAA2C;AAC3C,+DAI0C;AAE1C;;GAEG;AACH,MAAa,UAAU;IACtB;;OAEG;IACH,YACiB,MAAwB,EACxB,QAAkB,EAClB,MAAwB;QAFxB,WAAM,GAAN,MAAM,CAAkB;QACxB,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAAkB;IACtC,CAAC;IAEJ;;;;;;;;;OASG;IACI,kBAAkB,CAAC,MAAwB;QAKjD,yBAAyB;QACzB,0CAA0C;QAE1C,MAAM,IAAI,GAAG,IAAA,6BAAkB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;YAChE,CAAC,CAAC,wBAAa,CAAC,UAAU;YAC1B,CAAC,CAAC,yBAAyB;gBAC1B,qFAAqF;gBACrF,mCAAmC;gBACnC,wBAAa,CAAC,YAAY,CAAC;QAC7B,mEAAmE;QACnE,8CAA8C;QAC9C,MAAM,KAAK,GAAG,IAA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under the MIT License.\n */\n\nimport {\n\tAdaptedViewSchema,\n\ttype Adapters,\n\tCompatibility,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\tisNeverTree,\n} from \"../../feature-libraries/index.js\";\n\n/**\n * A collection of View information for schema, including policy.\n */\nexport class ViewSchema {\n\t/**\n\t * @param schema - Cached conversion of view schema in the stored schema format.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tpublic readonly schema: TreeStoredSchema,\n\t) {}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(stored: TreeStoredSchema): {\n\t\tread: Compatibility;\n\t\twrite: Compatibility;\n\t\twriteAllowingStoredSchemaUpdates: Compatibility;\n\t} {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\tconst read = allowsRepoSuperset(this.policy, stored, this.schema)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t// ? Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\t\t// TODO: Extract subset of adapters that are valid to use on stored\n\t\t// TODO: separate adapters from schema updates\n\t\tconst write = allowsRepoSuperset(this.policy, this.schema, stored)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, this.storedSchema, adapted.adaptedForViewSchema)\n\t\t\t\t// TODO: IThis assumes adapters are bidirectional.\n\t\t\t\t// Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\n\t\t// TODO: compute this properly (and maybe include the set of schema changes needed for it?).\n\t\t// Maybe updates would happen lazily when needed to store data?\n\t\t// When willingness to updates can avoid need for some adapters,\n\t\t// how should it be decided if the adapter should be used to avoid the update?\n\t\t// TODO: is this case actually bi-variant, making this correct if we did it for each schema independently?\n\t\tlet writeAllowingStoredSchemaUpdates =\n\t\t\t// TODO: This should consider just the updates needed\n\t\t\t// (ex: when view covers a subset of stored after stored has a update to that subset).\n\t\t\tallowsRepoSuperset(this.policy, stored, this.schema)\n\t\t\t\t? Compatibility.Compatible\n\t\t\t\t: // TODO: this assumes adapters can translate in both directions. In general this will not be true.\n\t\t\t\t\t// TODO: this also assumes that schema updates to the adapted repo would translate to\n\t\t\t\t\t// updates on the stored schema, which is also likely untrue.\n\t\t\t\t\t// // TODO: support adapters\n\t\t\t\t\t// allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t\t// ? Compatibility.RequiresAdapters // Requires schema updates. TODO: consider adapters that can update writes.\n\t\t\t\t\tCompatibility.Incompatible;\n\n\t\t// Since the above does not consider partial updates,\n\t\t// we can improve the tolerance a bit by considering the op-op update:\n\t\twriteAllowingStoredSchemaUpdates = Math.max(writeAllowingStoredSchemaUpdates, write);\n\n\t\treturn { read, write, writeAllowingStoredSchemaUpdates };\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug if they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (isNeverTree(this.policy, this.schema, this.schema.nodeSchema.get(adapter.output))) {\n\t\t\t\tfail(\"tree adapter for stored adapter.output should not be never\");\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/simple-tree/api/view.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAO6B;AAC7B,kDAA2C;AAC3C,+DAS0C;AAC1C,sDAI2B;AAC3B,4DAAsD;AACtD,kEAAsE;AAGtE;;GAEG;AACH,MAAa,UAAU;IAUtB;;OAEG;IACH,YACiB,MAAwB,EACxB,QAAkB,EAClC,UAA+B;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C,eAAe,CAAC;YACxD,UAAU,EAAE,IAAI,GAAG,EAAkD;SACrE,CAAC;QAEF,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC5C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC3C,CAAC;QAED,iEAAiE;QACjE,OAAO,IAAI,4BAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,QAA+B;QACjD,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,KAAK,GAAkC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrE,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,QAA8B;QAC/C,sDAAsD;QACtD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAhQD,gCAgQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAdaptedViewSchema,\n\ttype TreeNodeStoredSchema,\n\ttype Adapters,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\tFieldKinds,\n\ttype FullSchemaPolicy,\n\ttype FieldDiscrepancy,\n\tgetAllowedContentDiscrepancies,\n\tisNeverTree,\n\tPosetComparisonResult,\n\tfieldRealizer,\n\tcomparePosetElements,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tnormalizeFieldSchema,\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n} from \"../schemaTypes.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * A collection of View information for schema, including policy.\n */\nexport class ViewSchema {\n\t/**\n\t * Cached conversion of the view schema in the stored schema format.\n\t */\n\tprivate readonly viewSchemaAsStored: TreeStoredSchema;\n\t/**\n\t * Normalized view schema (implicitly allowed view schema types are converted to their canonical form).\n\t */\n\tpublic readonly schema: FieldSchema;\n\n\t/**\n\t * @param viewSchema - Schema for the root field of this view.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tviewSchema: ImplicitFieldSchema,\n\t) {\n\t\tthis.schema = normalizeFieldSchema(viewSchema);\n\t\tthis.viewSchemaAsStored = toStoredSchema(this.schema);\n\t}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(\n\t\tstored: TreeStoredSchema,\n\t): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\t// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy\n\t\t// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.\n\t\t// In the future, this would also include things like:\n\t\t// - fields with more allowed types in the stored schema than in the view schema have out-of-schema \"unknown content\" adapters\n\t\tlet canView = true;\n\t\t// View schema allows a superset of documents that stored schema does, hence the document could be upgraded to use a persisted version\n\t\t// of this view schema as its stored schema.\n\t\tlet canUpgrade = true;\n\n\t\tconst updateCompatibilityFromFieldDiscrepancy = (discrepancy: FieldDiscrepancy): void => {\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"allowedTypes\": {\n\t\t\t\t\t// Since we only track the symmetric difference between the allowed types in the view and\n\t\t\t\t\t// stored schemas, it's sufficient to check if any extra allowed types still exist in the\n\t\t\t\t\t// stored schema.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdiscrepancy.stored.some(\n\t\t\t\t\t\t\t(identifier) =>\n\t\t\t\t\t\t\t\t!isNeverTree(this.policy, stored, stored.nodeSchema.get(identifier)),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Stored schema has extra allowed types that the view schema does not.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tdiscrepancy.view.some(\n\t\t\t\t\t\t\t(identifier) =>\n\t\t\t\t\t\t\t\t!isNeverTree(\n\t\t\t\t\t\t\t\t\tthis.policy,\n\t\t\t\t\t\t\t\t\tthis.viewSchemaAsStored,\n\t\t\t\t\t\t\t\t\tthis.viewSchemaAsStored.nodeSchema.get(identifier),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// View schema has extra allowed types that the stored schema does not.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tconst result = comparePosetElements(\n\t\t\t\t\t\tdiscrepancy.stored,\n\t\t\t\t\t\tdiscrepancy.view,\n\t\t\t\t\t\tfieldRealizer,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (result === PosetComparisonResult.Greater) {\n\t\t\t\t\t\t// Stored schema is more relaxed than view schema.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdiscrepancy.view === FieldKinds.forbidden.identifier &&\n\t\t\t\t\t\t\tdiscrepancy.identifier !== undefined &&\n\t\t\t\t\t\t\tthis.policy.allowUnknownOptionalFields(discrepancy.identifier)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// When the application has opted into it, we allow viewing documents which have additional\n\t\t\t\t\t\t\t// optional fields in the stored schema that are not present in the view schema.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Less) {\n\t\t\t\t\t\t// View schema is more relaxed than stored schema.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Incomparable) {\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\": {\n\t\t\t\t\tcanView = false;\n\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(discrepancy);\n\t\t\t}\n\t\t};\n\n\t\tfor (const discrepancy of getAllowedContentDiscrepancies(\n\t\t\tthis.viewSchemaAsStored,\n\t\t\tstored,\n\t\t)) {\n\t\t\tif (!canView && !canUpgrade) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"nodeKind\": {\n\t\t\t\t\tconst viewNodeSchema = this.viewSchemaAsStored.nodeSchema.get(\n\t\t\t\t\t\tdiscrepancy.identifier,\n\t\t\t\t\t);\n\t\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);\n\t\t\t\t\t// We conservatively do not allow node types to change.\n\t\t\t\t\t// The only time this might be valid in the sense that the data canonically converts is converting an object node\n\t\t\t\t\t// to a map node over the union of all the object fields' types.\n\t\t\t\t\tif (discrepancy.stored === undefined) {\n\t\t\t\t\t\tconst viewIsNever =\n\t\t\t\t\t\t\tviewNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!viewIsNever) {\n\t\t\t\t\t\t\t// View schema has added a node type that the stored schema doesn't know about.\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (discrepancy.view === undefined) {\n\t\t\t\t\t\tconst storedIsNever =\n\t\t\t\t\t\t\tstoredNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, stored, storedNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!storedIsNever) {\n\t\t\t\t\t\t\t// Stored schema has a node type that the view schema doesn't know about.\n\t\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Node type exists in both schemas but has changed. We conservatively never allow this.\n\t\t\t\t\t\tconst storedIsNever =\n\t\t\t\t\t\t\tstoredNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, stored, storedNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tconst viewIsNever =\n\t\t\t\t\t\t\tviewNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!storedIsNever || !viewIsNever) {\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\":\n\t\t\t\tcase \"allowedTypes\":\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tupdateCompatibilityFromFieldDiscrepancy(discrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fields\": {\n\t\t\t\t\tdiscrepancy.differences.forEach(updateCompatibilityFromFieldDiscrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// No default\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent: canView && canUpgrade,\n\t\t};\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug if they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (\n\t\t\t\tisNeverTree(\n\t\t\t\t\tthis.policy,\n\t\t\t\t\tthis.viewSchemaAsStored,\n\t\t\t\t\tthis.viewSchemaAsStored.nodeSchema.get(adapter.output),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfail(\"tree adapter for stored adapter.output should not be never\");\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { isTreeNode, TreeNodeKernel, getKernel, tryGetTreeNodeSchema, type InnerNode, tryDisposeTreeNode, tryGetTreeNodeFromMapNode, getOrCreateInnerNode, } from "./treeNodeKernel.js";
|
|
5
|
+
export { isTreeNode, TreeNodeKernel, getKernel, tryGetTreeNodeSchema, type InnerNode, tryDisposeTreeNode, tryGetTreeNodeFromMapNode, getOrCreateInnerNode, treeNodeFromAnchor, } from "./treeNodeKernel.js";
|
|
6
6
|
export { type WithType, typeNameSymbol, typeSchemaSymbol } from "./withType.js";
|
|
7
7
|
export { type TreeChangeEvents, TreeNode, type Unhydrated, inPrototypeChain, type InternalTreeNode, privateToken, } from "./types.js";
|
|
8
8
|
export { type TreeNodeSchema, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, type TreeNodeSchemaBoth, } from "./treeNodeSchema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,KAAK,SAAS,EACd,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,KAAK,SAAS,EACd,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EACN,KAAK,gBAAgB,EACrB,QAAQ,EACR,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACN,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,GACjB,MAAM,yBAAyB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.UnhydratedContext = exports.tryUnhydratedFlexTreeNode = exports.UnhydratedTreeSequenceField = exports.UnhydratedFlexTreeNode = exports.getOrCreateNodeFromInnerNode = exports.SimpleContextSlot = exports.HydratedContext = exports.Context = exports.walkAllowedTypes = exports.getSimpleNodeSchemaFromInnerNode = exports.NodeKind = exports.privateToken = exports.inPrototypeChain = exports.TreeNode = exports.typeSchemaSymbol = exports.typeNameSymbol = exports.getOrCreateInnerNode = exports.tryGetTreeNodeFromMapNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeSchema = exports.getKernel = exports.TreeNodeKernel = exports.isTreeNode = void 0;
|
|
7
|
+
exports.UnhydratedContext = exports.tryUnhydratedFlexTreeNode = exports.UnhydratedTreeSequenceField = exports.UnhydratedFlexTreeNode = exports.getOrCreateNodeFromInnerNode = exports.SimpleContextSlot = exports.HydratedContext = exports.Context = exports.walkAllowedTypes = exports.getSimpleNodeSchemaFromInnerNode = exports.NodeKind = exports.privateToken = exports.inPrototypeChain = exports.TreeNode = exports.typeSchemaSymbol = exports.typeNameSymbol = exports.treeNodeFromAnchor = exports.getOrCreateInnerNode = exports.tryGetTreeNodeFromMapNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeSchema = exports.getKernel = exports.TreeNodeKernel = exports.isTreeNode = void 0;
|
|
8
8
|
var treeNodeKernel_js_1 = require("./treeNodeKernel.js");
|
|
9
9
|
Object.defineProperty(exports, "isTreeNode", { enumerable: true, get: function () { return treeNodeKernel_js_1.isTreeNode; } });
|
|
10
10
|
Object.defineProperty(exports, "TreeNodeKernel", { enumerable: true, get: function () { return treeNodeKernel_js_1.TreeNodeKernel; } });
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "tryGetTreeNodeSchema", { enumerable: true, get:
|
|
|
13
13
|
Object.defineProperty(exports, "tryDisposeTreeNode", { enumerable: true, get: function () { return treeNodeKernel_js_1.tryDisposeTreeNode; } });
|
|
14
14
|
Object.defineProperty(exports, "tryGetTreeNodeFromMapNode", { enumerable: true, get: function () { return treeNodeKernel_js_1.tryGetTreeNodeFromMapNode; } });
|
|
15
15
|
Object.defineProperty(exports, "getOrCreateInnerNode", { enumerable: true, get: function () { return treeNodeKernel_js_1.getOrCreateInnerNode; } });
|
|
16
|
+
Object.defineProperty(exports, "treeNodeFromAnchor", { enumerable: true, get: function () { return treeNodeKernel_js_1.treeNodeFromAnchor; } });
|
|
16
17
|
var withType_js_1 = require("./withType.js");
|
|
17
18
|
Object.defineProperty(exports, "typeNameSymbol", { enumerable: true, get: function () { return withType_js_1.typeNameSymbol; } });
|
|
18
19
|
Object.defineProperty(exports, "typeSchemaSymbol", { enumerable: true, get: function () { return withType_js_1.typeSchemaSymbol; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAU6B;AAT5B,+GAAA,UAAU,OAAA;AACV,mHAAA,cAAc,OAAA;AACd,8GAAA,SAAS,OAAA;AACT,yHAAA,oBAAoB,OAAA;AAEpB,uHAAA,kBAAkB,OAAA;AAClB,8HAAA,yBAAyB,OAAA;AACzB,yHAAA,oBAAoB,OAAA;AACpB,uHAAA,kBAAkB,OAAA;AAEnB,6CAAgF;AAAxD,6GAAA,cAAc,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AACxD,uCAOoB;AALnB,oGAAA,QAAQ,OAAA;AAER,4GAAA,gBAAgB,OAAA;AAEhB,wGAAA,YAAY,OAAA;AAEb,yDAO6B;AAL5B,6GAAA,QAAQ,OAAA;AAMT,uDAAsE;AAA7D,oIAAA,gCAAgC,OAAA;AACzC,iDAAuE;AAA9D,iHAAA,gBAAgB,OAAA;AACzB,2CAA2E;AAAlE,qGAAA,OAAO,OAAA;AAAE,6GAAA,eAAe,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AACpD,2DAAoE;AAA3D,kIAAA,4BAA4B,OAAA;AACrC,iEAKiC;AAJhC,+HAAA,sBAAsB,OAAA;AACtB,oIAAA,2BAA2B,OAAA;AAC3B,kIAAA,yBAAyB,OAAA;AACzB,0HAAA,iBAAiB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tisTreeNode,\n\tTreeNodeKernel,\n\tgetKernel,\n\ttryGetTreeNodeSchema,\n\ttype InnerNode,\n\ttryDisposeTreeNode,\n\ttryGetTreeNodeFromMapNode,\n\tgetOrCreateInnerNode,\n\ttreeNodeFromAnchor,\n} from \"./treeNodeKernel.js\";\nexport { type WithType, typeNameSymbol, typeSchemaSymbol } from \"./withType.js\";\nexport {\n\ttype TreeChangeEvents,\n\tTreeNode,\n\ttype Unhydrated,\n\tinPrototypeChain,\n\ttype InternalTreeNode,\n\tprivateToken,\n} from \"./types.js\";\nexport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype TreeNodeSchemaCore,\n\ttype TreeNodeSchemaBoth,\n} from \"./treeNodeSchema.js\";\nexport { getSimpleNodeSchemaFromInnerNode } from \"./schemaCaching.js\";\nexport { walkAllowedTypes, type SchemaVisitor } from \"./walkSchema.js\";\nexport { Context, HydratedContext, SimpleContextSlot } from \"./context.js\";\nexport { getOrCreateNodeFromInnerNode } from \"./getOrCreateNode.js\";\nexport {\n\tUnhydratedFlexTreeNode,\n\tUnhydratedTreeSequenceField,\n\ttryUnhydratedFlexTreeNode,\n\tUnhydratedContext,\n} from \"./unhydratedFlexTree.js\";\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { Listenable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import type { TreeNode, Unhydrated } from "./types.js";
|
|
7
|
-
import { type AnchorEvents, type AnchorNode, type AnchorSet, type UpPath } from "../../core/index.js";
|
|
7
|
+
import { type AnchorEvents, type AnchorNode, type AnchorSet, type TreeValue, type UpPath } from "../../core/index.js";
|
|
8
8
|
import { TreeStatus, type FlexTreeNode } from "../../feature-libraries/index.js";
|
|
9
9
|
import type { TreeNodeSchema } from "./treeNodeSchema.js";
|
|
10
10
|
import { type Context, type HydratedContext } from "./context.js";
|
|
@@ -159,5 +159,9 @@ export declare function getTreeNodeSchemaFromHydratedFlexNode(flexNode: FlexTree
|
|
|
159
159
|
* Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
|
|
160
160
|
*/
|
|
161
161
|
export declare function getOrCreateInnerNode(treeNode: TreeNode, allowFreed?: boolean): InnerNode;
|
|
162
|
+
/**
|
|
163
|
+
* Gets a tree node from an anchor node
|
|
164
|
+
*/
|
|
165
|
+
export declare function treeNodeFromAnchor(anchorNode: AnchorNode): TreeNode | TreeValue;
|
|
162
166
|
export {};
|
|
163
167
|
//# sourceMappingURL=treeNodeKernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeKernel.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"treeNodeKernel.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":"A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AAQ,GAAG,SAAS,CAW/E"}
|
|
@@ -16,12 +16,12 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
16
16
|
};
|
|
17
17
|
var _TreeNodeKernel_hydrationState, _TreeNodeKernel_unhydratedEvents;
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.getOrCreateInnerNode = exports.getTreeNodeSchemaFromHydratedFlexNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeFromMapNode = exports.proxySlot = exports.mapTreeNodeToProxy = exports.TreeNodeKernel = exports.tryGetTreeNodeSchema = exports.isTreeNode = exports.getKernel = void 0;
|
|
19
|
+
exports.treeNodeFromAnchor = exports.getOrCreateInnerNode = exports.getTreeNodeSchemaFromHydratedFlexNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeFromMapNode = exports.proxySlot = exports.mapTreeNodeToProxy = exports.TreeNodeKernel = exports.tryGetTreeNodeSchema = exports.isTreeNode = exports.getKernel = void 0;
|
|
20
20
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
21
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
22
|
+
const index_js_1 = require("../../core/index.js");
|
|
23
|
+
const index_js_2 = require("../../feature-libraries/index.js");
|
|
24
|
+
const index_js_3 = require("../../util/index.js");
|
|
25
25
|
// TODO: decide how to deal with dependencies on flex-tree implementation.
|
|
26
26
|
// eslint-disable-next-line import/no-internal-modules
|
|
27
27
|
const lazyNode_js_1 = require("../../feature-libraries/flex-tree/lazyNode.js");
|
|
@@ -107,7 +107,7 @@ class TreeNodeKernel {
|
|
|
107
107
|
* This means optimizations like skipping processing data in subtrees where no subtreeChanged events are subscribed to would be able to work,
|
|
108
108
|
* since the kernel does not unconditionally subscribe to those events (like a design which simply forwards all events would).
|
|
109
109
|
*/
|
|
110
|
-
_TreeNodeKernel_unhydratedEvents.set(this, new internal_1.Lazy((
|
|
110
|
+
_TreeNodeKernel_unhydratedEvents.set(this, new internal_1.Lazy((client_utils_1.createEmitter)));
|
|
111
111
|
(0, internal_1.assert)(!treeNodeToKernel.has(node), 0xa1a /* only one kernel per node can be made */);
|
|
112
112
|
treeNodeToKernel.set(node, this);
|
|
113
113
|
if (innerNode instanceof unhydratedFlexTree_js_1.UnhydratedFlexTreeNode) {
|
|
@@ -145,7 +145,7 @@ class TreeNodeKernel {
|
|
|
145
145
|
if (isHydrated(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f"))) {
|
|
146
146
|
// This can't be cached on this.#hydrated during hydration since initial tree is hydrated before the context is cached on the anchorSet.
|
|
147
147
|
return (__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f")?.anchorNode.anchorSet.slots.get(context_js_1.SimpleContextSlot) ??
|
|
148
|
-
(0,
|
|
148
|
+
(0, index_js_3.fail)("missing simple-tree context"));
|
|
149
149
|
}
|
|
150
150
|
return this.initialContext;
|
|
151
151
|
}
|
|
@@ -189,20 +189,20 @@ class TreeNodeKernel {
|
|
|
189
189
|
}
|
|
190
190
|
getStatus() {
|
|
191
191
|
if (this.disposed) {
|
|
192
|
-
return
|
|
192
|
+
return index_js_2.TreeStatus.Deleted;
|
|
193
193
|
}
|
|
194
194
|
if (!isHydrated(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f"))) {
|
|
195
|
-
return
|
|
195
|
+
return index_js_2.TreeStatus.New;
|
|
196
196
|
}
|
|
197
197
|
// TODO: Replace this check with the proper check against the cursor state when the cursor becomes part of the kernel
|
|
198
|
-
const flex = __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode.slots.get(
|
|
198
|
+
const flex = __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode.slots.get(index_js_2.flexTreeSlot);
|
|
199
199
|
if (flex !== undefined) {
|
|
200
|
-
(0, internal_1.assert)(flex instanceof
|
|
201
|
-
if (flex[
|
|
202
|
-
return
|
|
200
|
+
(0, internal_1.assert)(flex instanceof index_js_2.LazyEntity, 0x9b4 /* Unexpected flex node implementation */);
|
|
201
|
+
if (flex[index_js_2.isFreedSymbol]()) {
|
|
202
|
+
return index_js_2.TreeStatus.Deleted;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
return (0,
|
|
205
|
+
return (0, index_js_2.treeStatusFromAnchorCache)(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode);
|
|
206
206
|
}
|
|
207
207
|
get events() {
|
|
208
208
|
// Retrieve the correct events object based on whether this node is pre or post hydration.
|
|
@@ -243,14 +243,14 @@ class TreeNodeKernel {
|
|
|
243
243
|
// Marinated case -> cooked
|
|
244
244
|
const anchorNode = __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode;
|
|
245
245
|
// The proxy is bound to an anchor node, but it may or may not have an actual flex node yet
|
|
246
|
-
const flexNode = anchorNode.slots.get(
|
|
246
|
+
const flexNode = anchorNode.slots.get(index_js_2.flexTreeSlot);
|
|
247
247
|
if (flexNode !== undefined) {
|
|
248
248
|
// If the flex node already exists, use it...
|
|
249
249
|
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode = flexNode;
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
252
|
// ...otherwise, the flex node must be created
|
|
253
|
-
const context = anchorNode.anchorSet.slots.get(
|
|
253
|
+
const context = anchorNode.anchorSet.slots.get(index_js_2.ContextSlot) ?? (0, index_js_3.fail)("missing context");
|
|
254
254
|
const cursor = context.checkout.forest.allocateCursor("getFlexNode");
|
|
255
255
|
context.checkout.forest.moveCursorToPath(anchorNode, cursor);
|
|
256
256
|
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode = (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
@@ -258,7 +258,7 @@ class TreeNodeKernel {
|
|
|
258
258
|
// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode
|
|
259
259
|
anchorForgetters?.get(this.node)?.();
|
|
260
260
|
if (!allowFreed) {
|
|
261
|
-
(0,
|
|
261
|
+
(0, index_js_2.assertFlexTreeEntityNotFreed)(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
return __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode;
|
|
@@ -277,7 +277,7 @@ class TreeNodeKernel {
|
|
|
277
277
|
anchorProxy(anchors, path) {
|
|
278
278
|
(0, internal_1.assert)(!anchorForgetters.has(this.node), 0x91c /* Proxy anchor should not be set twice */);
|
|
279
279
|
const anchor = anchors.track(path);
|
|
280
|
-
const anchorNode = anchors.locate(anchor) ?? (0,
|
|
280
|
+
const anchorNode = anchors.locate(anchor) ?? (0, index_js_3.fail)("Expected anchor node to be present");
|
|
281
281
|
this.hydrate(anchorNode);
|
|
282
282
|
const forget = () => {
|
|
283
283
|
if (anchors.locate(anchor)) {
|
|
@@ -300,7 +300,7 @@ class TreeNodeKernel {
|
|
|
300
300
|
tryGetInnerNode() {
|
|
301
301
|
if (isHydrated(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f"))) {
|
|
302
302
|
return (__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode ??
|
|
303
|
-
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode.slots.get(
|
|
303
|
+
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode.slots.get(index_js_2.flexTreeSlot));
|
|
304
304
|
}
|
|
305
305
|
return __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode;
|
|
306
306
|
}
|
|
@@ -322,7 +322,7 @@ exports.mapTreeNodeToProxy = new WeakMap();
|
|
|
322
322
|
* For this to work, we have to require that there is at most a single view using a given AnchorSet.
|
|
323
323
|
* FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.
|
|
324
324
|
*/
|
|
325
|
-
exports.proxySlot = (0,
|
|
325
|
+
exports.proxySlot = (0, index_js_1.anchorSlot)();
|
|
326
326
|
/**
|
|
327
327
|
* Retrieves the node associated with the given MapTreeNode node if any.
|
|
328
328
|
*/
|
|
@@ -347,8 +347,8 @@ exports.tryDisposeTreeNode = tryDisposeTreeNode;
|
|
|
347
347
|
function getTreeNodeSchemaFromHydratedFlexNode(flexNode) {
|
|
348
348
|
(0, internal_1.assert)(flexNode.context.isHydrated(), 0xa56 /* getTreeNodeSchemaFromHydratedFlexNode only allows hydrated flex tree nodes */);
|
|
349
349
|
const context = flexNode.anchorNode.anchorSet.slots.get(context_js_1.SimpleContextSlot) ??
|
|
350
|
-
(0,
|
|
351
|
-
return context.schema.get(flexNode.schema) ?? (0,
|
|
350
|
+
(0, index_js_3.fail)("Missing SimpleContextSlot");
|
|
351
|
+
return context.schema.get(flexNode.schema) ?? (0, index_js_3.fail)("Missing schema");
|
|
352
352
|
}
|
|
353
353
|
exports.getTreeNodeSchemaFromHydratedFlexNode = getTreeNodeSchemaFromHydratedFlexNode;
|
|
354
354
|
/**
|
|
@@ -364,4 +364,35 @@ function getOrCreateInnerNode(treeNode, allowFreed = false) {
|
|
|
364
364
|
return kernel.getOrCreateInnerNode(allowFreed);
|
|
365
365
|
}
|
|
366
366
|
exports.getOrCreateInnerNode = getOrCreateInnerNode;
|
|
367
|
+
/**
|
|
368
|
+
* Gets a flex node from an anchor node
|
|
369
|
+
*/
|
|
370
|
+
function flexNodeFromAnchor(anchorNode) {
|
|
371
|
+
// the proxy is bound to an anchor node, but it may or may not have an actual flex node yet
|
|
372
|
+
const flexNode = anchorNode.slots.get(index_js_2.flexTreeSlot);
|
|
373
|
+
if (flexNode !== undefined) {
|
|
374
|
+
return flexNode; // If it does have a flex node, return it...
|
|
375
|
+
} // ...otherwise, the flex node must be created
|
|
376
|
+
const context = anchorNode.anchorSet.slots.get(index_js_2.ContextSlot) ?? (0, index_js_3.fail)("missing context");
|
|
377
|
+
const cursor = context.checkout.forest.allocateCursor("getFlexNode");
|
|
378
|
+
context.checkout.forest.moveCursorToPath(anchorNode, cursor);
|
|
379
|
+
const newFlexNode = (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
380
|
+
cursor.free();
|
|
381
|
+
return newFlexNode;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Gets a tree node from an anchor node
|
|
385
|
+
*/
|
|
386
|
+
function treeNodeFromAnchor(anchorNode) {
|
|
387
|
+
const cached = anchorNode.slots.get(exports.proxySlot);
|
|
388
|
+
if (cached !== undefined) {
|
|
389
|
+
return cached;
|
|
390
|
+
}
|
|
391
|
+
const flexNode = flexNodeFromAnchor(anchorNode);
|
|
392
|
+
const classSchema = getTreeNodeSchemaFromHydratedFlexNode(flexNode);
|
|
393
|
+
return typeof classSchema === "function"
|
|
394
|
+
? new classSchema(flexNode)
|
|
395
|
+
: classSchema.create(flexNode);
|
|
396
|
+
}
|
|
397
|
+
exports.treeNodeFromAnchor = treeNodeFromAnchor;
|
|
367
398
|
//# sourceMappingURL=treeNodeKernel.js.map
|