@fluidframework/tree 2.11.0 → 2.13.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 +140 -0
- package/api-report/tree.alpha.api.md +88 -12
- package/api-report/tree.beta.api.md +23 -11
- package/api-report/tree.legacy.alpha.api.md +23 -11
- package/api-report/tree.legacy.public.api.md +23 -11
- package/api-report/tree.public.api.md +23 -11
- package/dist/alpha.d.ts +11 -0
- package/dist/beta.d.ts +2 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +2 -9
- package/dist/core/rebase/utils.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-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/{feature-libraries/chunked-forest → 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/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +5 -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/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 +1 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- 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 +13 -13
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.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/index.d.ts +1 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- 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/fieldChangeHandler.d.ts +12 -5
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +24 -4
- package/dist/feature-libraries/optional-field/optionalField.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/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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +14 -5
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -14
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/shared-tree/index.d.ts +3 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -1
- 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 +10 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +51 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +31 -10
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +106 -15
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/transactionTypes.d.ts +105 -0
- package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
- package/dist/shared-tree/transactionTypes.js +13 -0
- package/dist/shared-tree/transactionTypes.js.map +1 -0
- package/dist/shared-tree/treeApi.d.ts +1 -25
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +4 -8
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +39 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +275 -128
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +13 -35
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +12 -77
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +2 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +4 -16
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +38 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +118 -6
- package/dist/shared-tree-core/transaction.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/index.d.ts +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +6 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/jsonSchema.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +65 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +10 -4
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +8 -2
- 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 +13 -10
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- 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/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +61 -0
- 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/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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +2 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -20
- 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/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +2 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +9 -4
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +19 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.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 +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -5
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +72 -42
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +161 -151
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/typeCheck.d.ts +0 -2
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +35 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +32 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +11 -0
- package/lib/beta.d.ts +2 -0
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +3 -10
- package/lib/core/rebase/utils.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-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/{feature-libraries/chunked-forest → 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/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -0
- 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/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 +1 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- 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 +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.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/index.d.ts +1 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +9 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- 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/fieldChangeHandler.d.ts +12 -5
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -4
- package/lib/feature-libraries/optional-field/optionalField.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/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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +14 -5
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -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 +10 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +56 -17
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +31 -10
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +107 -16
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionTypes.d.ts +105 -0
- package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
- package/lib/shared-tree/transactionTypes.js +10 -0
- package/lib/shared-tree/transactionTypes.js.map +1 -0
- package/lib/shared-tree/treeApi.d.ts +1 -25
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +1 -5
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +39 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +277 -130
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +13 -35
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -76
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +3 -3
- 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 +2 -9
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +4 -16
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +38 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +112 -1
- package/lib/shared-tree-core/transaction.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/index.d.ts +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +3 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/jsonSchema.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +65 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +9 -3
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +8 -2
- 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 +14 -11
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- 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/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +61 -0
- 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/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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +2 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- 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 +5 -20
- 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/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +9 -4
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +17 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.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 +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +72 -42
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +159 -146
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/typeCheck.d.ts +0 -2
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +35 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +29 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/index.ts +5 -1
- package/src/core/rebase/utils.ts +17 -20
- package/src/core/schema-stored/format.ts +0 -3
- package/src/core/schema-stored/schema.ts +13 -10
- package/src/core/schema-view/index.ts +0 -1
- package/src/core/schema-view/view.ts +0 -11
- package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
- package/src/core/tree/index.ts +8 -0
- package/src/core/tree/treeTextFormat.ts +0 -5
- package/src/core/tree/types.ts +0 -5
- 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 +2 -1
- 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 +4 -1
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
- package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
- package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
- package/src/feature-libraries/index.ts +13 -1
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +9 -9
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +13 -9
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
- package/src/feature-libraries/modular-schema/index.ts +14 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +124 -31
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +12 -0
- package/src/feature-libraries/optional-field/optionalField.ts +34 -5
- package/src/feature-libraries/sequence-field/types.ts +0 -1
- package/src/feature-libraries/sequence-field/utils.ts +18 -7
- package/src/index.ts +12 -29
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +13 -2
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +102 -23
- package/src/shared-tree/sharedTree.ts +181 -44
- package/src/shared-tree/transactionTypes.ts +125 -0
- package/src/shared-tree/treeApi.ts +1 -28
- package/src/shared-tree/treeCheckout.ts +358 -175
- package/src/shared-tree-core/branch.ts +29 -122
- package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
- package/src/shared-tree-core/editManager.ts +3 -8
- package/src/shared-tree-core/index.ts +2 -1
- package/src/shared-tree-core/sharedTreeCore.ts +8 -19
- package/src/shared-tree-core/transaction.ts +145 -0
- 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/index.ts +13 -2
- package/src/simple-tree/api/jsonSchema.ts +7 -0
- package/src/simple-tree/api/schemaFactory.ts +91 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
- package/src/simple-tree/api/simpleSchema.ts +9 -2
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
- package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
- package/src/simple-tree/api/storedSchema.ts +7 -22
- package/src/simple-tree/api/tree.ts +78 -0
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
- package/src/simple-tree/arrayNode.ts +7 -1
- package/src/simple-tree/core/treeNodeSchema.ts +51 -7
- package/src/simple-tree/index.ts +9 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/objectNode.ts +33 -3
- package/src/simple-tree/objectNodeTypes.ts +9 -1
- package/src/simple-tree/schemaTypes.ts +57 -3
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +3 -6
- package/src/util/rangeMap.ts +199 -189
- package/src/util/typeCheck.ts +0 -2
- package/src/util/utils.ts +73 -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/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
- package/dist/feature-libraries/memoizedIdRangeAllocator.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/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
- package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
|
@@ -27,8 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
31
|
-
exports.hasElement = exports.AnchorTreeIndex = exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.isFreedSymbol = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.getTreeContext = exports.Skip = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationErrors = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = void 0;
|
|
30
|
+
exports.createNodeKeyManager = exports.compareLocalNodeKeys = exports.makeFieldBatchCodec = exports.makeTreeChunker = exports.defaultChunkPolicy = exports.buildChunkedForest = exports.chunkFieldSingle = exports.chunkTree = exports.mapRootChanges = exports.posetLte = exports.comparePosetElements = exports.PosetComparisonResult = exports.fieldRealizer = exports.isNeverTree = exports.isRepoSuperset = exports.getAllowedContentDiscrepancies = exports.updateRefreshers = exports.EncodedModularChangeset = exports.ModularChangeFamily = exports.FieldKindWithEditor = exports.genericFieldKind = exports.allowsRepoSuperset = exports.FlexFieldKind = exports.CrossFieldTarget = exports.makeModularChangeCodecFamily = exports.ModularEditBuilder = exports.isNeverField = exports.SequenceField = exports.jsonableTreeFromForest = exports.jsonableTreeFromFieldCursor = exports.jsonableTreeFromCursor = exports.cursorForJsonableTreeField = exports.cursorForJsonableTreeNode = exports.stackTreeFieldCursor = exports.prefixFieldPath = exports.prefixPath = exports.stackTreeNodeCursor = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = exports.buildForest = exports.mapTreeFieldFromCursor = exports.mapTreeFromCursor = exports.cursorForMapTreeNode = exports.cursorForMapTreeField = exports.ForestSummarizer = exports.isTreeValue = exports.assertAllowedValue = exports.allowsValue = exports.toDownPath = void 0;
|
|
31
|
+
exports.hasElement = exports.AnchorTreeIndex = exports.makeMitigatedChangeFamily = exports.EncodedSchemaChange = exports.makeSchemaChangeCodecs = exports.DetachedFieldIndexSummarizer = exports.valueSchemaAllows = exports.TreeCompressionStrategy = exports.FlexTreeEntityKind = exports.indexForAt = exports.treeStatusFromAnchorCache = exports.LazyEntity = exports.isFreedSymbol = exports.getSchemaAndPolicy = exports.flexTreeSlot = exports.assertFlexTreeEntityNotFreed = exports.flexTreeMarker = exports.ContextSlot = exports.isFlexTreeNode = exports.Context = exports.TreeStatus = exports.getTreeContext = exports.Skip = exports.isFieldInSchema = exports.isNodeInSchema = exports.SchemaValidationErrors = exports.relevantRemovedRoots = exports.intoDelta = exports.fieldKindConfigurations = exports.fieldKinds = exports.defaultSchemaPolicy = exports.DefaultEditBuilder = exports.DefaultChangeFamily = exports.FieldKinds = exports.nodeKeyTreeIdentifier = exports.MockNodeKeyManager = exports.isStableNodeKey = void 0;
|
|
32
32
|
var editableTreeBinder_js_1 = require("./editableTreeBinder.js");
|
|
33
33
|
Object.defineProperty(exports, "toDownPath", { enumerable: true, get: function () { return editableTreeBinder_js_1.toDownPath; } });
|
|
34
34
|
var valueUtilities_js_1 = require("./valueUtilities.js");
|
|
@@ -42,8 +42,6 @@ Object.defineProperty(exports, "cursorForMapTreeField", { enumerable: true, get:
|
|
|
42
42
|
Object.defineProperty(exports, "cursorForMapTreeNode", { enumerable: true, get: function () { return mapTreeCursor_js_1.cursorForMapTreeNode; } });
|
|
43
43
|
Object.defineProperty(exports, "mapTreeFromCursor", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeFromCursor; } });
|
|
44
44
|
Object.defineProperty(exports, "mapTreeFieldFromCursor", { enumerable: true, get: function () { return mapTreeCursor_js_1.mapTreeFieldFromCursor; } });
|
|
45
|
-
var memoizedIdRangeAllocator_js_1 = require("./memoizedIdRangeAllocator.js");
|
|
46
|
-
Object.defineProperty(exports, "MemoizedIdRangeAllocator", { enumerable: true, get: function () { return memoizedIdRangeAllocator_js_1.MemoizedIdRangeAllocator; } });
|
|
47
45
|
var index_js_2 = require("./object-forest/index.js");
|
|
48
46
|
Object.defineProperty(exports, "buildForest", { enumerable: true, get: function () { return index_js_2.buildForest; } });
|
|
49
47
|
var index_js_3 = require("./schema-index/index.js");
|
|
@@ -79,6 +77,10 @@ Object.defineProperty(exports, "updateRefreshers", { enumerable: true, get: func
|
|
|
79
77
|
Object.defineProperty(exports, "getAllowedContentDiscrepancies", { enumerable: true, get: function () { return index_js_4.getAllowedContentDiscrepancies; } });
|
|
80
78
|
Object.defineProperty(exports, "isRepoSuperset", { enumerable: true, get: function () { return index_js_4.isRepoSuperset; } });
|
|
81
79
|
Object.defineProperty(exports, "isNeverTree", { enumerable: true, get: function () { return index_js_4.isNeverTree; } });
|
|
80
|
+
Object.defineProperty(exports, "fieldRealizer", { enumerable: true, get: function () { return index_js_4.fieldRealizer; } });
|
|
81
|
+
Object.defineProperty(exports, "PosetComparisonResult", { enumerable: true, get: function () { return index_js_4.PosetComparisonResult; } });
|
|
82
|
+
Object.defineProperty(exports, "comparePosetElements", { enumerable: true, get: function () { return index_js_4.comparePosetElements; } });
|
|
83
|
+
Object.defineProperty(exports, "posetLte", { enumerable: true, get: function () { return index_js_4.posetLte; } });
|
|
82
84
|
var deltaUtils_js_1 = require("./deltaUtils.js");
|
|
83
85
|
Object.defineProperty(exports, "mapRootChanges", { enumerable: true, get: function () { return deltaUtils_js_1.mapRootChanges; } });
|
|
84
86
|
var index_js_5 = require("./chunked-forest/index.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAGiC;AADhC,mHAAA,UAAU,OAAA;AAEX,yDAAmF;AAA1E,gHAAA,WAAW,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,OAAA;AAErD,sDAA6D;AAApD,4GAAA,gBAAgB,OAAA;AACzB,uDAK4B;AAJ3B,yHAAA,qBAAqB,OAAA;AACrB,wHAAA,oBAAoB,OAAA;AACpB,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AAEvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-libraries/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;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1B,qFAAiF;AAAxE,+IAAA,4BAA4B,OAAA;AAErC,oDAIiC;AAFhC,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AAGpB,uEAAuE;AAA9D,qIAAA,yBAAyB,OAAA;AAElC,iDAO6B;AAL5B,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype DownPath,\n\ttoDownPath,\n} from \"./editableTreeBinder.js\";\nexport { allowsValue, assertAllowedValue, isTreeValue } from \"./valueUtilities.js\";\n\nexport { ForestSummarizer } from \"./forest-summary/index.js\";\nexport {\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tmapTreeFromCursor,\n\tmapTreeFieldFromCursor,\n} from \"./mapTreeCursor.js\";\nexport { buildForest } from \"./object-forest/index.js\";\nexport { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from \"./schema-index/index.js\";\nexport {\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n\tprefixPath,\n\tprefixFieldPath,\n\ttype CursorWithNode,\n\tstackTreeFieldCursor,\n} from \"./treeCursorUtils.js\";\nexport {\n\tcursorForJsonableTreeNode,\n\tcursorForJsonableTreeField,\n\tjsonableTreeFromCursor,\n\tjsonableTreeFromFieldCursor,\n\tjsonableTreeFromForest,\n} from \"./treeTextCursor.js\";\n\n// Split this up into separate import and export for compatibility with API-Extractor.\nimport * as SequenceField from \"./sequence-field/index.js\";\nexport { SequenceField };\n\nexport {\n\tisNeverField,\n\tModularEditBuilder,\n\ttype FieldEditDescription as EditDescription,\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype FieldChangeMap,\n\ttype FieldChange,\n\ttype FieldChangeset,\n\ttype ToDelta,\n\ttype ModularChangeset,\n\tmakeModularChangeCodecFamily,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\ttype GenericChangeset,\n\tgenericFieldKind,\n\ttype HasFieldChanges,\n\ttype NodeExistsConstraint,\n\tFieldKindWithEditor,\n\tModularChangeFamily,\n\ttype RelevantRemovedRootsFromChild,\n\tEncodedModularChangeset,\n\tupdateRefreshers,\n\ttype NodeId,\n\ttype FieldChangeEncodingContext,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tgetAllowedContentDiscrepancies,\n\tisRepoSuperset,\n\ttype AllowedTypeDiscrepancy,\n\ttype FieldKindDiscrepancy,\n\ttype ValueSchemaDiscrepancy,\n\ttype FieldDiscrepancy,\n\ttype NodeDiscrepancy,\n\ttype NodeKindDiscrepancy,\n\ttype NodeFieldsDiscrepancy,\n\tisNeverTree,\n\ttype LinearExtension,\n\ttype Realizer,\n\tfieldRealizer,\n\tPosetComparisonResult,\n\tcomparePosetElements,\n\tposetLte,\n} from \"./modular-schema/index.js\";\n\nexport { mapRootChanges } from \"./deltaUtils.js\";\n\nexport {\n\ttype TreeChunk,\n\tchunkTree,\n\tchunkFieldSingle,\n\tbuildChunkedForest,\n\tdefaultChunkPolicy,\n\ttype FieldBatch,\n\ttype FieldBatchCodec,\n\tmakeTreeChunker,\n\tmakeFieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n} from \"./chunked-forest/index.js\";\n\nexport {\n\tcompareLocalNodeKeys,\n\tcreateNodeKeyManager,\n\tisStableNodeKey,\n\ttype LocalNodeKey,\n\tMockNodeKeyManager,\n\ttype NodeKeyManager,\n\tnodeKeyTreeIdentifier,\n\ttype StableNodeKey,\n} from \"./node-key/index.js\";\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tdefaultSchemaPolicy,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tSchemaValidationErrors,\n\tisNodeInSchema,\n\tisFieldInSchema,\n} from \"./default-schema/index.js\";\n\nexport {\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tSkip,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeEntity,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tgetTreeContext,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeNodeEvents,\n\ttype FlexTreeUnknownUnboxed,\n\tisFlexTreeNode,\n\tContextSlot,\n\t// Internal\n\tflexTreeMarker,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\tgetSchemaAndPolicy,\n\tisFreedSymbol,\n\tLazyEntity,\n\ttreeStatusFromAnchorCache,\n\tindexForAt,\n\tFlexTreeEntityKind,\n} from \"./flex-tree/index.js\";\n\nexport { TreeCompressionStrategy } from \"./treeCompressionUtils.js\";\n\nexport { valueSchemaAllows } from \"./valueUtilities.js\";\n\nexport { DetachedFieldIndexSummarizer } from \"./detachedFieldIndexSummarizer.js\";\n\nexport {\n\ttype SchemaChange,\n\tmakeSchemaChangeCodecs,\n\tEncodedSchemaChange,\n} from \"./schema-edits/index.js\";\n\nexport { makeMitigatedChangeFamily } from \"./mitigatedChangeFamily.js\";\n\nexport {\n\ttype KeyFinder,\n\tAnchorTreeIndex,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./indexing/index.js\";\n"]}
|
|
@@ -31,6 +31,7 @@ export declare class AnchorTreeIndex<TKey extends TreeIndexKey, TValue> implemen
|
|
|
31
31
|
private readonly indexer;
|
|
32
32
|
private readonly getValue;
|
|
33
33
|
private readonly checkTreeStatus;
|
|
34
|
+
private readonly isShallowIndex;
|
|
34
35
|
disposed: boolean;
|
|
35
36
|
/**
|
|
36
37
|
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
@@ -61,8 +62,10 @@ export declare class AnchorTreeIndex<TKey extends TreeIndexKey, TValue> implemen
|
|
|
61
62
|
* @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes
|
|
62
63
|
* so that the values returned from the index are more usable
|
|
63
64
|
* @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes
|
|
65
|
+
* @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.
|
|
66
|
+
* As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.
|
|
64
67
|
*/
|
|
65
|
-
constructor(forest: IForestSubscription, indexer: (schemaId: TreeNodeSchemaIdentifier) => KeyFinder<TKey> | undefined, getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined, checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined);
|
|
68
|
+
constructor(forest: IForestSubscription, indexer: (schemaId: TreeNodeSchemaIdentifier) => KeyFinder<TKey> | undefined, getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined, checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined, isShallowIndex?: boolean);
|
|
66
69
|
/**
|
|
67
70
|
* Creates an announced visitor that responds to edits to the forest and updates the index accordingly.
|
|
68
71
|
*/
|
|
@@ -106,6 +109,10 @@ export declare class AnchorTreeIndex<TKey extends TreeIndexKey, TValue> implemen
|
|
|
106
109
|
* Disposes this index and all the anchors it holds onto.
|
|
107
110
|
*/
|
|
108
111
|
[disposeSymbol](): void;
|
|
112
|
+
/**
|
|
113
|
+
* Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.
|
|
114
|
+
*/
|
|
115
|
+
private reIndexSpine;
|
|
109
116
|
private checkNotDisposed;
|
|
110
117
|
/**
|
|
111
118
|
* Given a cursor in node mode, indexes it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchorTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAEN,KAAK,UAAU,EAEf,KAAK,wBAAwB,EAG7B,KAAK,uBAAuB,EAE5B,KAAK,mBAAmB,EASxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,YAAY,IAAI,CAAC,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAE3F;;;;;;;GAOG;AACH,qBAAa,eAAe,CAAC,IAAI,SAAS,YAAY,EAAE,MAAM,CAC7D,YAAW,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"anchorTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAEN,KAAK,UAAU,EAEf,KAAK,wBAAwB,EAG7B,KAAK,uBAAuB,EAE5B,KAAK,mBAAmB,EASxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB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G,OAAO;IAK9B;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CASxB;IAED;;OAEG;IACK,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC;IAStC;;OAEG;IACK,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAU1C;;OAEG;IACK,OAAO,IAAI,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAU5C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAK5D;;OAEG;IACI,OAAO,CACb,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,IAAI,EAClF,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAUP;;;OAGG;IACK,UAAU,IAAI,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAU/C,OAAO,IAAI,IAAI;IAItB;;OAEG;IACI,CAAC,aAAa,CAAC,IAAI,IAAI;IAa9B;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,SAAS;IA6CjB;;OAEG;IACH,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACH,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAUxB;AAgBD;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAE7E"}
|
|
@@ -24,12 +24,15 @@ class AnchorTreeIndex {
|
|
|
24
24
|
* @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes
|
|
25
25
|
* so that the values returned from the index are more usable
|
|
26
26
|
* @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes
|
|
27
|
+
* @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.
|
|
28
|
+
* As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.
|
|
27
29
|
*/
|
|
28
|
-
constructor(forest, indexer, getValue, checkTreeStatus) {
|
|
30
|
+
constructor(forest, indexer, getValue, checkTreeStatus, isShallowIndex = false) {
|
|
29
31
|
this.forest = forest;
|
|
30
32
|
this.indexer = indexer;
|
|
31
33
|
this.getValue = getValue;
|
|
32
34
|
this.checkTreeStatus = checkTreeStatus;
|
|
35
|
+
this.isShallowIndex = isShallowIndex;
|
|
33
36
|
this.disposed = false;
|
|
34
37
|
/**
|
|
35
38
|
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
@@ -83,6 +86,14 @@ class AnchorTreeIndex {
|
|
|
83
86
|
this.indexField(detachedCursor);
|
|
84
87
|
detachedCursor.free();
|
|
85
88
|
},
|
|
89
|
+
afterAttach: () => {
|
|
90
|
+
(0, internal_1.assert)(parent !== undefined, 0xa99 /* must have a parent */);
|
|
91
|
+
this.reIndexSpine(parent);
|
|
92
|
+
},
|
|
93
|
+
afterDetach: () => {
|
|
94
|
+
(0, internal_1.assert)(parent !== undefined, 0xa9a /* must have a parent */);
|
|
95
|
+
this.reIndexSpine(parent);
|
|
96
|
+
},
|
|
86
97
|
// when a replace happens, the keys of previously indexed nodes could be changed so we must re-index them
|
|
87
98
|
afterReplace: () => {
|
|
88
99
|
(0, internal_1.assert)(parent !== undefined, 0xa8b /* must have a parent */);
|
|
@@ -90,9 +101,12 @@ class AnchorTreeIndex {
|
|
|
90
101
|
this.forest.moveCursorToPath(parent, cursor);
|
|
91
102
|
(0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0xa8c /* replace should happen in a node */);
|
|
92
103
|
cursor.exitNode();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
this.indexField(cursor);
|
|
105
|
+
if (!this.isShallowIndex) {
|
|
106
|
+
// we must also re-index the spine if the key finders allow for any value under a subtree to be the key
|
|
107
|
+
// this means that a replace can cause the key for any node up its spine to be changed
|
|
108
|
+
this.indexSpine(cursor);
|
|
109
|
+
}
|
|
96
110
|
cursor.clear();
|
|
97
111
|
},
|
|
98
112
|
// the methods below are used to keep track of the path that has been traversed by the visitor
|
|
@@ -229,6 +243,19 @@ class AnchorTreeIndex {
|
|
|
229
243
|
this.forest.deregisterAnnouncedVisitor(this.keyFinder);
|
|
230
244
|
this.disposed = true;
|
|
231
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.
|
|
248
|
+
*/
|
|
249
|
+
reIndexSpine(path) {
|
|
250
|
+
if (!this.isShallowIndex) {
|
|
251
|
+
const cursor = this.forest.allocateCursor();
|
|
252
|
+
this.forest.moveCursorToPath(path, cursor);
|
|
253
|
+
(0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0xa9b /* attach should happen in a node */);
|
|
254
|
+
cursor.exitNode();
|
|
255
|
+
this.indexSpine(cursor);
|
|
256
|
+
cursor.clear();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
232
259
|
checkNotDisposed(errorMessage) {
|
|
233
260
|
if (this.disposed) {
|
|
234
261
|
if (errorMessage !== undefined) {
|
|
@@ -294,7 +321,6 @@ class AnchorTreeIndex {
|
|
|
294
321
|
* Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.
|
|
295
322
|
*/
|
|
296
323
|
indexSpine(cursor) {
|
|
297
|
-
this.indexField(cursor);
|
|
298
324
|
if ((0, index_js_2.keyAsDetachedField)(cursor.getFieldKey()) !== index_js_2.rootField) {
|
|
299
325
|
cursor.exitField();
|
|
300
326
|
cursor.exitNode();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchorTreeInd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AAM,GAAG,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,iBAAM,EACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAC/B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,WAAqC;QAC7D,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,EAAE;YAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,UAAU,KAAK,qBAAU,CAAC,UAAU,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,SAAS,IAAI,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AA7XD,0CA6XC;AAED;;GAEG;AACH,SAAS,WAAW,CACnB,WAA8C,EAC9C,MAAqC;IAErC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAI,KAAmB;IAChD,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;AAC1B,CAAC;AAFD,gCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\tforEachNode,\n\ttype ITreeSubscriptionCursor,\n\tcreateAnnouncedVisitor,\n\ttype IForestSubscription,\n\ttype AnnouncedVisitor,\n\tCursorLocationType,\n\trootField,\n\ttype UpPath,\n\ttype ProtoNodes,\n\tkeyAsDetachedField,\n\tcompareUpPaths,\n\tTreeNavigationResult,\n} from \"../../core/index.js\";\nimport type { TreeIndex, TreeIndexKey, TreeIndexNodes } from \"./types.js\";\nimport { TreeStatus } from \"../flex-tree/index.js\";\n\n/**\n * A function that gets the value to index a node on, must be pure and functional.\n * The given cursor should point to the node that will be indexed.\n *\n * @returns a value the index will use as the key for the given node\n *\n * @remarks\n * This function does not own the cursor in any way, it walks the cursor to find the key the node is indexed on\n * but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function\n * and must be disposed elsewhere.\n */\nexport type KeyFinder<TKey extends TreeIndexKey> = (tree: ITreeSubscriptionCursor) => TKey;\n\n/**\n * An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.\n * A key can map to multiple nodes but each collection of nodes only results in a single value.\n *\n * @remarks\n * Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that\n * calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.\n */\nexport class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>\n\timplements TreeIndex<TKey, TValue>\n{\n\tpublic disposed = false;\n\t/**\n\t * Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not\n\t * need to be considered at all for this index. This allows us to skip subtrees that aren't relevant\n\t * as a performance optimization.\n\t */\n\tprivate readonly keyFinders = new Map<TreeNodeSchemaIdentifier, KeyFinder<TKey> | null>();\n\t/**\n\t * The actual index from keys to anchor nodes.\n\t */\n\tprivate readonly keyToNodes = new Map<TKey, AnchorNode[]>();\n\t/**\n\t * Maintained for efficient removal of anchor nodes from the index when updating their keys\n\t */\n\tprivate readonly nodeToKey = new Map<AnchorNode, TKey>();\n\t/**\n\t * Keeps track of anchors for disposal.\n\t */\n\tprivate readonly anchors = new Map<AnchorNode, Anchor[]>();\n\t/**\n\t * The key finder that is registered on the forest to keep this index updated, maintained\n\t * here for deregistration on disposal\n\t */\n\tprivate readonly keyFinder = this.acquireVisitor.bind(this);\n\n\t/**\n\t * @param forest - the forest that is being indexed\n\t * @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder\n\t * @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes\n\t * so that the values returned from the index are more usable\n\t * @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IForestSubscription,\n\t\tprivate readonly indexer: (\n\t\t\tschemaId: TreeNodeSchemaIdentifier,\n\t\t) => KeyFinder<TKey> | undefined,\n\t\tprivate readonly getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined,\n\t\tprivate readonly checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined,\n\t) {\n\t\tthis.forest.registerAnnouncedVisitor(this.keyFinder);\n\n\t\tconst detachedFieldKeys: FieldKey[] = [];\n\t\tconst detachedFieldsCursor = forest.getCursorAboveDetachedFields();\n\t\tforEachField(detachedFieldsCursor, (field) => {\n\t\t\tdetachedFieldKeys.push(field.getFieldKey());\n\t\t});\n\n\t\t// index all existing trees (this includes the primary document tree and all other detached/removed trees)\n\t\tfor (const fieldKey of detachedFieldKeys) {\n\t\t\tconst cursor = forest.allocateCursor();\n\t\t\tforest.tryMoveCursorToField({ fieldKey, parent: undefined }, cursor);\n\t\t\tthis.indexField(cursor);\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t/**\n\t * Creates an announced visitor that responds to edits to the forest and updates the index accordingly.\n\t */\n\tprivate acquireVisitor(): AnnouncedVisitor {\n\t\tthis.checkNotDisposed(\n\t\t\t\"visitor getter should be deregistered from the forest when index is disposed\",\n\t\t);\n\t\tlet parentField: FieldKey | undefined;\n\t\tlet parent: UpPath | undefined;\n\n\t\treturn createAnnouncedVisitor({\n\t\t\t// nodes (and their entire subtrees) are added to the index as soon as they are created\n\t\t\tafterCreate: (content: ProtoNodes, destination: FieldKey) => {\n\t\t\t\tconst detachedCursor = this.forest.allocateCursor();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.tryMoveCursorToField(\n\t\t\t\t\t\t{ fieldKey: destination, parent: undefined },\n\t\t\t\t\t\tdetachedCursor,\n\t\t\t\t\t) === TreeNavigationResult.Ok,\n\t\t\t\t\t0xa8a /* destination of created nodes must be a valid detached field */,\n\t\t\t\t);\n\t\t\t\tthis.indexField(detachedCursor);\n\t\t\t\tdetachedCursor.free();\n\t\t\t},\n\t\t\t// when a replace happens, the keys of previously indexed nodes could be changed so we must re-index them\n\t\t\tafterReplace: () => {\n\t\t\t\tassert(parent !== undefined, 0xa8b /* must have a parent */);\n\t\t\t\tconst cursor = this.forest.allocateCursor();\n\t\t\t\tthis.forest.moveCursorToPath(parent, cursor);\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t\t\t\t0xa8c /* replace should happen in a node */,\n\t\t\t\t);\n\t\t\t\tcursor.exitNode();\n\t\t\t\t// we must re-index the spine because the key finders allow for any value under a subtree to be the key\n\t\t\t\t// this means that a replace can cause the key for any node up its spine to be changed\n\t\t\t\tthis.indexSpine(cursor);\n\t\t\t\tcursor.clear();\n\t\t\t},\n\t\t\t// the methods below are used to keep track of the path that has been traversed by the visitor\n\t\t\t// this is required so that cursors can be moved to the correct location when index updates are required\n\t\t\tenterNode(index: number): void {\n\t\t\t\tassert(parentField !== undefined, 0xa8d /* must be in a field to enter node */);\n\n\t\t\t\tparent = {\n\t\t\t\t\tparent,\n\t\t\t\t\tparentField,\n\t\t\t\t\tparentIndex: index,\n\t\t\t\t};\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t\texitNode(index: number): void {\n\t\t\t\tassert(parent !== undefined, 0xa8e /* must have parent node */);\n\t\t\t\tconst temp = parent;\n\t\t\t\tparentField = temp.parentField;\n\t\t\t\tparent = temp.parent;\n\t\t\t},\n\t\t\tenterField: (key: FieldKey) => {\n\t\t\t\tparentField = key;\n\t\t\t},\n\t\t\texitField(key: FieldKey): void {\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Returns the value associated with the given key if it has been indexed\n\t */\n\tpublic get(key: TKey): TValue | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.getFilteredValue(this.keyToNodes.get(key));\n\t}\n\n\t/**\n\t * Returns true iff the key exists in the index\n\t */\n\tpublic has(key: TKey): boolean {\n\t\tthis.checkNotDisposed();\n\t\treturn this.get(key) !== undefined;\n\t}\n\n\t/**\n\t * Returns the number of values that are indexed\n\t */\n\tpublic get size(): number {\n\t\tthis.checkNotDisposed();\n\t\tlet s = 0;\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\ts += 1;\n\t\t\t}\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Returns all keys in the index\n\t */\n\tpublic *keys(): IterableIterator<TKey> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\tyield key;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of values in the index\n\t */\n\tpublic *values(): IterableIterator<TValue> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield filtered;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index\n\t */\n\tpublic *entries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield [key, filtered];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Applies the provided callback to each entry in the index.\n\t */\n\tpublic forEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: AnchorTreeIndex<TKey, TValue>) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tcallbackfn.call(thisArg, filtered, key, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.\n\t * This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.\n\t */\n\tpublic *allEntries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst value = this.getValue(nodes as unknown as TreeIndexNodes<AnchorNode>);\n\t\t\tif (value !== undefined) {\n\t\t\t\tyield [key, value];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis[disposeSymbol]();\n\t}\n\n\t/**\n\t * Disposes this index and all the anchors it holds onto.\n\t */\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\"index is already disposed\");\n\t\tfor (const anchors of this.anchors.values()) {\n\t\t\tfor (const anchor of anchors) {\n\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t}\n\t\t}\n\t\tthis.keyToNodes.clear();\n\t\tthis.anchors.clear();\n\t\tthis.forest.deregisterAnnouncedVisitor(this.keyFinder);\n\t\tthis.disposed = true;\n\t}\n\n\tprivate checkNotDisposed(errorMessage?: string): void {\n\t\tif (this.disposed) {\n\t\t\tif (errorMessage !== undefined) {\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\t\t\tassert(false, 0xa8f /* invalid operation on a disposed index */);\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in node mode, indexes it.\n\t */\n\tprivate indexNode(nodeCursor: ITreeSubscriptionCursor): void {\n\t\tconst keyFinder = getOrCreate(\n\t\t\tthis.keyFinders,\n\t\t\t// the node schema type to look up\n\t\t\tnodeCursor.type,\n\t\t\t// if the indexer does not return a key finder for this schema, we cache a null value to indicate the indexer\n\t\t\t// does not need to be called if this schema is encountered in the future\n\t\t\t(schema) => this.indexer(schema) ?? null,\n\t\t);\n\n\t\tif (keyFinder !== null) {\n\t\t\tconst expectedPath = nodeCursor.getPath();\n\t\t\tconst key = keyFinder(nodeCursor);\n\t\t\t// TODO: determine perf impact of this check, alternative is not doing it in which case (if the key finder is not pure and functional),\n\t\t\t// an error may be thrown further down the line if the structure of the nodes aren't expected or the contents of the index could be inaccurate\n\t\t\tif (!compareUpPaths(nodeCursor.getPath(), expectedPath)) {\n\t\t\t\tthrow new Error(\"key finder should be pure and functional\");\n\t\t\t}\n\t\t\tconst anchor = nodeCursor.buildAnchor();\n\t\t\tconst anchorNode = this.forest.anchors.locate(anchor) ?? fail(\"expected anchor node\");\n\n\t\t\t// check if this anchor node already exists in the index\n\t\t\tconst existingKey = this.nodeToKey.get(anchorNode);\n\t\t\tif (existingKey !== undefined) {\n\t\t\t\t// if the node already exists but has the same key, we return early\n\t\t\t\tif (existingKey === key) {\n\t\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\t// if the node has a different key, we remove the existing one first because it means the key had been detached\n\t\t\t\t\tthis.removeAnchor(anchorNode, existingKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgetOrCreate(this.keyToNodes, key, () => []).push(anchorNode);\n\t\t\tthis.nodeToKey.set(anchorNode, key);\n\n\t\t\tgetOrCreate(this.anchors, anchorNode, () => []).push(anchor);\n\t\t\t// when the anchor node is destroyed, delete it from the index\n\t\t\tanchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis.removeAnchor(anchorNode, key);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in field mode, recursively indexes all nodes under the field.\n\t */\n\tprivate indexField(fieldCursor: ITreeSubscriptionCursor): void {\n\t\tforEachNode(fieldCursor, (nodeCursor) => {\n\t\t\tthis.indexNode(nodeCursor);\n\n\t\t\tforEachField(nodeCursor, (f) => {\n\t\t\t\tthis.indexField(f);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.\n\t */\n\tprivate indexSpine(cursor: ITreeSubscriptionCursor): void {\n\t\tthis.indexField(cursor);\n\n\t\tif (keyAsDetachedField(cursor.getFieldKey()) !== rootField) {\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// return early if we're already at the root field\n\t\t\treturn;\n\t\t}\n\n\t\t// walk up the spine and index nodes until we reach the root\n\t\twhile (\n\t\t\tcursor.mode === CursorLocationType.Fields &&\n\t\t\tkeyAsDetachedField(cursor.getFieldKey()) !== rootField\n\t\t) {\n\t\t\tforEachNode(cursor, (nodeCursor) => {\n\t\t\t\tthis.indexNode(nodeCursor);\n\t\t\t});\n\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\t}\n\n\tprivate removeAnchor(anchorNode: AnchorNode, key: TKey): void {\n\t\tconst indexedNodes = this.keyToNodes.get(key);\n\t\tassert(\n\t\t\tindexedNodes !== undefined,\n\t\t\t0xa90 /* destroyed anchor node should be tracked by index */,\n\t\t);\n\t\tconst index = indexedNodes.indexOf(anchorNode);\n\t\tassert(index !== -1, 0xa91 /* destroyed anchor node should be tracked by index */);\n\t\tconst newNodes = filterNodes(indexedNodes, (n) => n !== anchorNode);\n\t\tif (newNodes !== undefined && newNodes.length > 0) {\n\t\t\tthis.keyToNodes.set(key, newNodes);\n\t\t} else {\n\t\t\tthis.keyToNodes.delete(key);\n\t\t}\n\t\tthis.nodeToKey.delete(anchorNode);\n\t\tassert(\n\t\t\tthis.anchors.delete(anchorNode),\n\t\t\t0xa92 /* destroyed anchor should be tracked by index */,\n\t\t);\n\t}\n\n\t/**\n\t * Filters out any anchor nodes that are detached and returns the value for the remaining nodes.\n\t */\n\tprivate getFilteredValue(anchorNodes: AnchorNode[] | undefined): TValue | undefined {\n\t\tconst attachedNodes = filterNodes(anchorNodes, (anchorNode) => {\n\t\t\tconst nodeStatus = this.checkTreeStatus(anchorNode);\n\t\t\treturn nodeStatus === TreeStatus.InDocument;\n\t\t});\n\n\t\tif (attachedNodes !== undefined && hasElement(attachedNodes)) {\n\t\t\treturn this.getValue(attachedNodes);\n\t\t}\n\t}\n}\n\n/**\n * Filters the given anchor nodes based on the given filter function.\n */\nfunction filterNodes(\n\tanchorNodes: readonly AnchorNode[] | undefined,\n\tfilter: (node: AnchorNode) => boolean,\n): AnchorNode[] | undefined {\n\tif (anchorNodes !== undefined) {\n\t\treturn anchorNodes.filter(filter);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.\n */\nexport function hasElement<T>(array: readonly T[]): array is TreeIndexNodes<T> {\n\treturn array.length >= 1;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"anchorTreeIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,kDAAuE;AACvE,kDAkB6B;AAE7B,oDAAmD;AAenD;;;;;;;GAOG;AACH,MAAa,eAAe;IA4B3B;;;;;;;;OAQG;IACH,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GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YACpD,OAAO,UAAU,KAAK,qBAAU,CAAC,UAAU,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,KAAK,SAAS,IAAI,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AA1ZD,0CA0ZC;AAED;;GAEG;AACH,SAAS,WAAW,CACnB,WAA8C,EAC9C,MAAqC;IAErC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAI,KAAmB;IAChD,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;AAC1B,CAAC;AAFD,gCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\ttype FieldKey,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\tforEachNode,\n\ttype ITreeSubscriptionCursor,\n\tcreateAnnouncedVisitor,\n\ttype IForestSubscription,\n\ttype AnnouncedVisitor,\n\tCursorLocationType,\n\trootField,\n\ttype UpPath,\n\ttype ProtoNodes,\n\tkeyAsDetachedField,\n\tcompareUpPaths,\n\tTreeNavigationResult,\n} from \"../../core/index.js\";\nimport type { TreeIndex, TreeIndexKey, TreeIndexNodes } from \"./types.js\";\nimport { TreeStatus } from \"../flex-tree/index.js\";\n\n/**\n * A function that gets the value to index a node on, must be pure and functional.\n * The given cursor should point to the node that will be indexed.\n *\n * @returns a value the index will use as the key for the given node\n *\n * @remarks\n * This function does not own the cursor in any way, it walks the cursor to find the key the node is indexed on\n * but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function\n * and must be disposed elsewhere.\n */\nexport type KeyFinder<TKey extends TreeIndexKey> = (tree: ITreeSubscriptionCursor) => TKey;\n\n/**\n * An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.\n * A key can map to multiple nodes but each collection of nodes only results in a single value.\n *\n * @remarks\n * Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that\n * calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.\n */\nexport class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>\n\timplements TreeIndex<TKey, TValue>\n{\n\tpublic disposed = false;\n\t/**\n\t * Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not\n\t * need to be considered at all for this index. This allows us to skip subtrees that aren't relevant\n\t * as a performance optimization.\n\t */\n\tprivate readonly keyFinders = new Map<TreeNodeSchemaIdentifier, KeyFinder<TKey> | null>();\n\t/**\n\t * The actual index from keys to anchor nodes.\n\t */\n\tprivate readonly keyToNodes = new Map<TKey, AnchorNode[]>();\n\t/**\n\t * Maintained for efficient removal of anchor nodes from the index when updating their keys\n\t */\n\tprivate readonly nodeToKey = new Map<AnchorNode, TKey>();\n\t/**\n\t * Keeps track of anchors for disposal.\n\t */\n\tprivate readonly anchors = new Map<AnchorNode, Anchor[]>();\n\t/**\n\t * The key finder that is registered on the forest to keep this index updated, maintained\n\t * here for deregistration on disposal\n\t */\n\tprivate readonly keyFinder = this.acquireVisitor.bind(this);\n\n\t/**\n\t * @param forest - the forest that is being indexed\n\t * @param indexer - a function that retrieves the key finder based on a given schema or undefined if the schema does not have an associated key finder\n\t * @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes\n\t * so that the values returned from the index are more usable\n\t * @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes\n\t * @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.\n\t * As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IForestSubscription,\n\t\tprivate readonly indexer: (\n\t\t\tschemaId: TreeNodeSchemaIdentifier,\n\t\t) => KeyFinder<TKey> | undefined,\n\t\tprivate readonly getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined,\n\t\tprivate readonly checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined,\n\t\tprivate readonly isShallowIndex = false,\n\t) {\n\t\tthis.forest.registerAnnouncedVisitor(this.keyFinder);\n\n\t\tconst detachedFieldKeys: FieldKey[] = [];\n\t\tconst detachedFieldsCursor = forest.getCursorAboveDetachedFields();\n\t\tforEachField(detachedFieldsCursor, (field) => {\n\t\t\tdetachedFieldKeys.push(field.getFieldKey());\n\t\t});\n\n\t\t// index all existing trees (this includes the primary document tree and all other detached/removed trees)\n\t\tfor (const fieldKey of detachedFieldKeys) {\n\t\t\tconst cursor = forest.allocateCursor();\n\t\t\tforest.tryMoveCursorToField({ fieldKey, parent: undefined }, cursor);\n\t\t\tthis.indexField(cursor);\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t/**\n\t * Creates an announced visitor that responds to edits to the forest and updates the index accordingly.\n\t */\n\tprivate acquireVisitor(): AnnouncedVisitor {\n\t\tthis.checkNotDisposed(\n\t\t\t\"visitor getter should be deregistered from the forest when index is disposed\",\n\t\t);\n\t\tlet parentField: FieldKey | undefined;\n\t\tlet parent: UpPath | undefined;\n\n\t\treturn createAnnouncedVisitor({\n\t\t\t// nodes (and their entire subtrees) are added to the index as soon as they are created\n\t\t\tafterCreate: (content: ProtoNodes, destination: FieldKey) => {\n\t\t\t\tconst detachedCursor = this.forest.allocateCursor();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.tryMoveCursorToField(\n\t\t\t\t\t\t{ fieldKey: destination, parent: undefined },\n\t\t\t\t\t\tdetachedCursor,\n\t\t\t\t\t) === TreeNavigationResult.Ok,\n\t\t\t\t\t0xa8a /* destination of created nodes must be a valid detached field */,\n\t\t\t\t);\n\t\t\t\tthis.indexField(detachedCursor);\n\t\t\t\tdetachedCursor.free();\n\t\t\t},\n\t\t\tafterAttach: () => {\n\t\t\t\tassert(parent !== undefined, 0xa99 /* must have a parent */);\n\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t},\n\t\t\tafterDetach: () => {\n\t\t\t\tassert(parent !== undefined, 0xa9a /* must have a parent */);\n\t\t\t\tthis.reIndexSpine(parent);\n\t\t\t},\n\t\t\t// when a replace happens, the keys of previously indexed nodes could be changed so we must re-index them\n\t\t\tafterReplace: () => {\n\t\t\t\tassert(parent !== undefined, 0xa8b /* must have a parent */);\n\t\t\t\tconst cursor = this.forest.allocateCursor();\n\t\t\t\tthis.forest.moveCursorToPath(parent, cursor);\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t\t\t\t0xa8c /* replace should happen in a node */,\n\t\t\t\t);\n\t\t\t\tcursor.exitNode();\n\t\t\t\tthis.indexField(cursor);\n\t\t\t\tif (!this.isShallowIndex) {\n\t\t\t\t\t// we must also re-index the spine if the key finders allow for any value under a subtree to be the key\n\t\t\t\t\t// this means that a replace can cause the key for any node up its spine to be changed\n\t\t\t\t\tthis.indexSpine(cursor);\n\t\t\t\t}\n\t\t\t\tcursor.clear();\n\t\t\t},\n\t\t\t// the methods below are used to keep track of the path that has been traversed by the visitor\n\t\t\t// this is required so that cursors can be moved to the correct location when index updates are required\n\t\t\tenterNode(index: number): void {\n\t\t\t\tassert(parentField !== undefined, 0xa8d /* must be in a field to enter node */);\n\n\t\t\t\tparent = {\n\t\t\t\t\tparent,\n\t\t\t\t\tparentField,\n\t\t\t\t\tparentIndex: index,\n\t\t\t\t};\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t\texitNode(index: number): void {\n\t\t\t\tassert(parent !== undefined, 0xa8e /* must have parent node */);\n\t\t\t\tconst temp = parent;\n\t\t\t\tparentField = temp.parentField;\n\t\t\t\tparent = temp.parent;\n\t\t\t},\n\t\t\tenterField: (key: FieldKey) => {\n\t\t\t\tparentField = key;\n\t\t\t},\n\t\t\texitField(key: FieldKey): void {\n\t\t\t\tparentField = undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Returns the value associated with the given key if it has been indexed\n\t */\n\tpublic get(key: TKey): TValue | undefined {\n\t\tthis.checkNotDisposed();\n\t\treturn this.getFilteredValue(this.keyToNodes.get(key));\n\t}\n\n\t/**\n\t * Returns true iff the key exists in the index\n\t */\n\tpublic has(key: TKey): boolean {\n\t\tthis.checkNotDisposed();\n\t\treturn this.get(key) !== undefined;\n\t}\n\n\t/**\n\t * Returns the number of values that are indexed\n\t */\n\tpublic get size(): number {\n\t\tthis.checkNotDisposed();\n\t\tlet s = 0;\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\ts += 1;\n\t\t\t}\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Returns all keys in the index\n\t */\n\tpublic *keys(): IterableIterator<TKey> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tif (this.getFilteredValue(nodes) !== undefined) {\n\t\t\t\tyield key;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of values in the index\n\t */\n\tpublic *values(): IterableIterator<TValue> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const nodes of this.keyToNodes.values()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield filtered;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index\n\t */\n\tpublic *entries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tyield [key, filtered];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Applies the provided callback to each entry in the index.\n\t */\n\tpublic forEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: AnchorTreeIndex<TKey, TValue>) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst filtered = this.getFilteredValue(nodes);\n\t\t\tif (filtered !== undefined) {\n\t\t\t\tcallbackfn.call(thisArg, filtered, key, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the index, including ones that are detached.\n\t * This function should only be used for testing purposes, it is not exposed as part of the public {@link TreeIndex} API.\n\t */\n\tpublic *allEntries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.checkNotDisposed();\n\t\tfor (const [key, nodes] of this.keyToNodes.entries()) {\n\t\t\tconst value = this.getValue(nodes as unknown as TreeIndexNodes<AnchorNode>);\n\t\t\tif (value !== undefined) {\n\t\t\t\tyield [key, value];\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis[disposeSymbol]();\n\t}\n\n\t/**\n\t * Disposes this index and all the anchors it holds onto.\n\t */\n\tpublic [disposeSymbol](): void {\n\t\tthis.checkNotDisposed(\"index is already disposed\");\n\t\tfor (const anchors of this.anchors.values()) {\n\t\t\tfor (const anchor of anchors) {\n\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t}\n\t\t}\n\t\tthis.keyToNodes.clear();\n\t\tthis.anchors.clear();\n\t\tthis.forest.deregisterAnnouncedVisitor(this.keyFinder);\n\t\tthis.disposed = true;\n\t}\n\n\t/**\n\t * Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.\n\t */\n\tprivate reIndexSpine(path: UpPath): void {\n\t\tif (!this.isShallowIndex) {\n\t\t\tconst cursor = this.forest.allocateCursor();\n\t\t\tthis.forest.moveCursorToPath(path, cursor);\n\t\t\tassert(\n\t\t\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t\t\t0xa9b /* attach should happen in a node */,\n\t\t\t);\n\t\t\tcursor.exitNode();\n\t\t\tthis.indexSpine(cursor);\n\t\t\tcursor.clear();\n\t\t}\n\t}\n\n\tprivate checkNotDisposed(errorMessage?: string): void {\n\t\tif (this.disposed) {\n\t\t\tif (errorMessage !== undefined) {\n\t\t\t\tthrow new Error(errorMessage);\n\t\t\t}\n\t\t\tassert(false, 0xa8f /* invalid operation on a disposed index */);\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in node mode, indexes it.\n\t */\n\tprivate indexNode(nodeCursor: ITreeSubscriptionCursor): void {\n\t\tconst keyFinder = getOrCreate(\n\t\t\tthis.keyFinders,\n\t\t\t// the node schema type to look up\n\t\t\tnodeCursor.type,\n\t\t\t// if the indexer does not return a key finder for this schema, we cache a null value to indicate the indexer\n\t\t\t// does not need to be called if this schema is encountered in the future\n\t\t\t(schema) => this.indexer(schema) ?? null,\n\t\t);\n\n\t\tif (keyFinder !== null) {\n\t\t\tconst expectedPath = nodeCursor.getPath();\n\t\t\tconst key = keyFinder(nodeCursor);\n\t\t\t// TODO: determine perf impact of this check, alternative is not doing it in which case (if the key finder is not pure and functional),\n\t\t\t// an error may be thrown further down the line if the structure of the nodes aren't expected or the contents of the index could be inaccurate\n\t\t\tif (!compareUpPaths(nodeCursor.getPath(), expectedPath)) {\n\t\t\t\tthrow new Error(\"key finder should be pure and functional\");\n\t\t\t}\n\t\t\tconst anchor = nodeCursor.buildAnchor();\n\t\t\tconst anchorNode = this.forest.anchors.locate(anchor) ?? fail(\"expected anchor node\");\n\n\t\t\t// check if this anchor node already exists in the index\n\t\t\tconst existingKey = this.nodeToKey.get(anchorNode);\n\t\t\tif (existingKey !== undefined) {\n\t\t\t\t// if the node already exists but has the same key, we return early\n\t\t\t\tif (existingKey === key) {\n\t\t\t\t\tthis.forest.forgetAnchor(anchor);\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\t// if the node has a different key, we remove the existing one first because it means the key had been detached\n\t\t\t\t\tthis.removeAnchor(anchorNode, existingKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgetOrCreate(this.keyToNodes, key, () => []).push(anchorNode);\n\t\t\tthis.nodeToKey.set(anchorNode, key);\n\n\t\t\tgetOrCreate(this.anchors, anchorNode, () => []).push(anchor);\n\t\t\t// when the anchor node is destroyed, delete it from the index\n\t\t\tanchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis.removeAnchor(anchorNode, key);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Given a cursor in field mode, recursively indexes all nodes under the field.\n\t */\n\tprivate indexField(fieldCursor: ITreeSubscriptionCursor): void {\n\t\tforEachNode(fieldCursor, (nodeCursor) => {\n\t\t\tthis.indexNode(nodeCursor);\n\n\t\t\tforEachField(nodeCursor, (f) => {\n\t\t\t\tthis.indexField(f);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.\n\t */\n\tprivate indexSpine(cursor: ITreeSubscriptionCursor): void {\n\t\tif (keyAsDetachedField(cursor.getFieldKey()) !== rootField) {\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// return early if we're already at the root field\n\t\t\treturn;\n\t\t}\n\n\t\t// walk up the spine and index nodes until we reach the root\n\t\twhile (\n\t\t\tcursor.mode === CursorLocationType.Fields &&\n\t\t\tkeyAsDetachedField(cursor.getFieldKey()) !== rootField\n\t\t) {\n\t\t\tforEachNode(cursor, (nodeCursor) => {\n\t\t\t\tthis.indexNode(nodeCursor);\n\t\t\t});\n\n\t\t\tcursor.exitField();\n\t\t\tcursor.exitNode();\n\t\t}\n\t}\n\n\tprivate removeAnchor(anchorNode: AnchorNode, key: TKey): void {\n\t\tconst indexedNodes = this.keyToNodes.get(key);\n\t\tassert(\n\t\t\tindexedNodes !== undefined,\n\t\t\t0xa90 /* destroyed anchor node should be tracked by index */,\n\t\t);\n\t\tconst index = indexedNodes.indexOf(anchorNode);\n\t\tassert(index !== -1, 0xa91 /* destroyed anchor node should be tracked by index */);\n\t\tconst newNodes = filterNodes(indexedNodes, (n) => n !== anchorNode);\n\t\tif (newNodes !== undefined && newNodes.length > 0) {\n\t\t\tthis.keyToNodes.set(key, newNodes);\n\t\t} else {\n\t\t\tthis.keyToNodes.delete(key);\n\t\t}\n\t\tthis.nodeToKey.delete(anchorNode);\n\t\tassert(\n\t\t\tthis.anchors.delete(anchorNode),\n\t\t\t0xa92 /* destroyed anchor should be tracked by index */,\n\t\t);\n\t}\n\n\t/**\n\t * Filters out any anchor nodes that are detached and returns the value for the remaining nodes.\n\t */\n\tprivate getFilteredValue(anchorNodes: AnchorNode[] | undefined): TValue | undefined {\n\t\tconst attachedNodes = filterNodes(anchorNodes, (anchorNode) => {\n\t\t\tconst nodeStatus = this.checkTreeStatus(anchorNode);\n\t\t\treturn nodeStatus === TreeStatus.InDocument;\n\t\t});\n\n\t\tif (attachedNodes !== undefined && hasElement(attachedNodes)) {\n\t\t\treturn this.getValue(attachedNodes);\n\t\t}\n\t}\n}\n\n/**\n * Filters the given anchor nodes based on the given filter function.\n */\nfunction filterNodes(\n\tanchorNodes: readonly AnchorNode[] | undefined,\n\tfilter: (node: AnchorNode) => boolean,\n): AnchorNode[] | undefined {\n\tif (anchorNodes !== undefined) {\n\t\treturn anchorNodes.filter(filter);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Checks that an array is of the type {@link TreeIndexNodes} and has at least one element.\n */\nexport function hasElement<T>(array: readonly T[]): array is TreeIndexNodes<T> {\n\treturn array.length >= 1;\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { ChangesetLocalId, RevisionTag } from "../../core/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { RangeMap, type RangeQueryResult } from "../../util/index.js";
|
|
7
7
|
import type { NodeId } from "./modularChangeTypes.js";
|
|
8
8
|
export type CrossFieldMap<T> = Map<RevisionTag | undefined, RangeMap<T>>;
|
|
9
9
|
export type CrossFieldQuerySet = CrossFieldMap<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossFieldQueries.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"crossFieldQueries.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,GAAG,CAAC,WAAW,GAAG,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAExD,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,EAAE,EAAE,gBAAgB,EACpB,KAAK,EAAE,MAAM,GACX,IAAI,CAEN;AAED,wBAAgB,kBAAkB,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12
12
|
exports.addCrossFieldQuery = addCrossFieldQuery;
|
|
13
13
|
function setInCrossFieldMap(map, revision, id, count, value) {
|
|
14
|
-
|
|
14
|
+
let rangeMap = map.get(revision);
|
|
15
|
+
if (rangeMap === undefined) {
|
|
16
|
+
rangeMap = new index_js_1.RangeMap();
|
|
17
|
+
map.set(revision, rangeMap);
|
|
18
|
+
}
|
|
19
|
+
rangeMap.set(id, count, value);
|
|
15
20
|
}
|
|
16
21
|
exports.setInCrossFieldMap = setInCrossFieldMap;
|
|
17
22
|
function getFirstFromCrossFieldMap(map, revision, id, count) {
|
|
18
|
-
|
|
23
|
+
const rangeMap = map.has(revision) ? map.get(revision) : new index_js_1.RangeMap();
|
|
24
|
+
return rangeMap.get(id, count);
|
|
19
25
|
}
|
|
20
26
|
exports.getFirstFromCrossFieldMap = getFirstFromCrossFieldMap;
|
|
21
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossFieldQueries.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"crossFieldQueries.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kDAAsE;AAMtE,SAAgB,kBAAkB,CACjC,GAAuB,EACvB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC;AAPD,gDAOC;AAED,SAAgB,kBAAkB,CACjC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa,EACb,KAAQ;IAER,IAAI,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC7B,CAAC;IACD,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC;AAbD,gDAaC;AAED,SAAgB,yBAAyB,CACxC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAiB,CAAC,CAAC,CAAC,IAAI,mBAAQ,EAAK,CAAC;IAC5F,OAAO,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC;AARD,8DAQC;AAED;GACG;AACH,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,2DAAM,CAAA;IACN,qEAAW,CAAA;AACZ,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangesetLocalId, RevisionTag } from \"../../core/index.js\";\nimport { RangeMap, type RangeQueryResult } from \"../../util/index.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\nexport type CrossFieldMap<T> = Map<RevisionTag | undefined, RangeMap<T>>;\nexport type CrossFieldQuerySet = CrossFieldMap<boolean>;\n\nexport function addCrossFieldQuery(\n\tset: CrossFieldQuerySet,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): void {\n\tsetInCrossFieldMap(set, revision, id, count, true);\n}\n\nexport function setInCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n\tvalue: T,\n): void {\n\tlet rangeMap = map.get(revision);\n\tif (rangeMap === undefined) {\n\t\trangeMap = new RangeMap();\n\t\tmap.set(revision, rangeMap);\n\t}\n\trangeMap.set(id, count, value);\n}\n\nexport function getFirstFromCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): RangeQueryResult<T> {\n\tconst rangeMap = map.has(revision) ? (map.get(revision) as RangeMap<T>) : new RangeMap<T>();\n\treturn rangeMap.get(id, count);\n}\n\n/**\n */\nexport enum CrossFieldTarget {\n\tSource,\n\tDestination,\n}\n\n/**\n * Used by {@link FieldChangeHandler} implementations for exchanging information across other fields\n * while rebasing, composing, or inverting a change.\n */\nexport interface CrossFieldManager<T = unknown> {\n\t/**\n\t * Returns the first data range associated with the key of `target`, `revision`, between `id` and `id + count`.\n\t * Calling this records a dependency for the current field on this key if `addDependency` is true.\n\t */\n\tget(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\taddDependency: boolean,\n\t): RangeQueryResult<T>;\n\n\t/**\n\t * Sets the range of keys to `newValue`.\n\t * If `invalidateDependents` is true, all fields which took a dependency on this key will be considered invalidated\n\t * and will be given a chance to address the new data in `amendCompose`, or a second pass of `rebase` or `invert` as appropriate.\n\t */\n\tset(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\tnewValue: T,\n\t\tinvalidateDependents: boolean,\n\t): void;\n\n\t/**\n\t * This must be called whenever a new node is moved into this field as part of the current rebase, compose, or invert.\n\t * Calling this for a node which was already in the field is tolerated.\n\t */\n\tonMoveIn(id: NodeId): void;\n\n\t/**\n\t * This must be called whenever a new cross field key is moved into this field as part of the current rebase or compose.\n\t * Calling this for a key which was already in the field is tolerated.\n\t */\n\tmoveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void;\n}\n"]}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type FieldKindIdentifier, type TreeStoredSchema, type ValueSchema } from "../../core/index.js";
|
|
5
|
+
import { type FieldKey, type FieldKindIdentifier, type TreeNodeSchemaIdentifier, type TreeStoredSchema, type ValueSchema } from "../../core/index.js";
|
|
6
6
|
/**
|
|
7
|
+
* Discriminated union (keyed on `mismatch`) of discrepancies between a view and stored schema.
|
|
7
8
|
* @remarks
|
|
8
9
|
*
|
|
9
10
|
* 1. FieldDiscrepancy
|
|
@@ -37,39 +38,64 @@ import { type FieldKindIdentifier, type TreeStoredSchema, type ValueSchema } fro
|
|
|
37
38
|
*/
|
|
38
39
|
export type Discrepancy = FieldDiscrepancy | NodeDiscrepancy;
|
|
39
40
|
export type NodeDiscrepancy = NodeKindDiscrepancy | NodeFieldsDiscrepancy;
|
|
41
|
+
/**
|
|
42
|
+
* A discrepancy in the declaration of a field.
|
|
43
|
+
*/
|
|
40
44
|
export type FieldDiscrepancy = AllowedTypeDiscrepancy | FieldKindDiscrepancy | ValueSchemaDiscrepancy;
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Information about where a field discrepancy is located within a collection of schema.
|
|
47
|
+
*/
|
|
48
|
+
export interface FieldDiscrepancyLocation {
|
|
49
|
+
/**
|
|
50
|
+
* The {@link TreeNodeSchemaIdentifier} that contains the discrepancy.
|
|
51
|
+
*
|
|
52
|
+
* Undefined iff the discrepancy is part of the root field schema.
|
|
53
|
+
*/
|
|
54
|
+
identifier: TreeNodeSchemaIdentifier | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The {@link FieldKey} for the field that contains the discrepancy.
|
|
57
|
+
* Undefined when:
|
|
58
|
+
* - the discrepancy is part of the root field schema
|
|
59
|
+
* - the discrepancy is for 'all fields' of a map node
|
|
60
|
+
*/
|
|
61
|
+
fieldKey: FieldKey | undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A discrepancy in the allowed types of a field.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* This reports the symmetric difference of allowed types in view/stored to enable more efficient checks for compatibility
|
|
68
|
+
*/
|
|
69
|
+
export interface AllowedTypeDiscrepancy extends FieldDiscrepancyLocation {
|
|
43
70
|
mismatch: "allowedTypes";
|
|
44
71
|
/**
|
|
45
|
-
* List of allowed type identifiers in viewed schema
|
|
72
|
+
* List of allowed type identifiers in viewed schema which are not allowed in stored schema
|
|
46
73
|
*/
|
|
47
|
-
view:
|
|
74
|
+
view: TreeNodeSchemaIdentifier[];
|
|
48
75
|
/**
|
|
49
|
-
* List of allowed type identifiers in stored schema
|
|
76
|
+
* List of allowed type identifiers in stored schema which are not allowed in view schema
|
|
50
77
|
*/
|
|
51
|
-
stored:
|
|
78
|
+
stored: TreeNodeSchemaIdentifier[];
|
|
52
79
|
}
|
|
53
|
-
export interface FieldKindDiscrepancy {
|
|
54
|
-
identifier: string | undefined;
|
|
80
|
+
export interface FieldKindDiscrepancy extends FieldDiscrepancyLocation {
|
|
55
81
|
mismatch: "fieldKind";
|
|
56
82
|
view: FieldKindIdentifier;
|
|
57
83
|
stored: FieldKindIdentifier;
|
|
58
84
|
}
|
|
59
85
|
export interface ValueSchemaDiscrepancy {
|
|
60
|
-
identifier:
|
|
86
|
+
identifier: TreeNodeSchemaIdentifier;
|
|
61
87
|
mismatch: "valueSchema";
|
|
62
88
|
view: ValueSchema | undefined;
|
|
63
89
|
stored: ValueSchema | undefined;
|
|
64
90
|
}
|
|
65
91
|
export interface NodeKindDiscrepancy {
|
|
66
|
-
identifier:
|
|
92
|
+
identifier: TreeNodeSchemaIdentifier;
|
|
67
93
|
mismatch: "nodeKind";
|
|
68
94
|
view: SchemaFactoryNodeKind | undefined;
|
|
69
95
|
stored: SchemaFactoryNodeKind | undefined;
|
|
70
96
|
}
|
|
71
97
|
export interface NodeFieldsDiscrepancy {
|
|
72
|
-
identifier:
|
|
98
|
+
identifier: TreeNodeSchemaIdentifier;
|
|
73
99
|
mismatch: "fields";
|
|
74
100
|
differences: FieldDiscrepancy[];
|
|
75
101
|
}
|
|
@@ -77,19 +103,13 @@ type SchemaFactoryNodeKind = "object" | "leaf" | "map";
|
|
|
77
103
|
/**
|
|
78
104
|
* Finds and reports discrepancies between a view schema and a stored schema.
|
|
79
105
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* consistent. Otherwise this difference is treated as `NodeKindDiscrepancy`
|
|
86
|
-
* - If a node schema with the same identifier exists in both view and stored, and their `SchemaFactoryNodeKind`
|
|
87
|
-
* are consistent, perform a exhaustive validation to identify all `FieldDiscrepancy`.
|
|
88
|
-
*
|
|
89
|
-
* 3. For each node schema in the stored, verify if it exists in the view. The overlapping parts were already
|
|
90
|
-
* addressed in the previous step.
|
|
106
|
+
* See documentation on {@link Discrepancy} for details of possible discrepancies.
|
|
107
|
+
* @remarks
|
|
108
|
+
* This function does not attempt to distinguish between equivalent representations of a node/field involving extraneous never trees.
|
|
109
|
+
* For example, a Forbidden field with allowed type set `[]` is equivalent to an optional field with allowed type set `[]`,
|
|
110
|
+
* as well as an optional field with an allowed type set containing only unconstructable types.
|
|
91
111
|
*
|
|
92
|
-
*
|
|
112
|
+
* It is up to the caller to determine whether such discrepancies matter.
|
|
93
113
|
*/
|
|
94
114
|
export declare function getAllowedContentDiscrepancies(view: TreeStoredSchema, stored: TreeStoredSchema): Iterable<Discrepancy>;
|
|
95
115
|
/**
|
|
@@ -110,5 +130,45 @@ export declare function getAllowedContentDiscrepancies(view: TreeStoredSchema, s
|
|
|
110
130
|
* validating internal fields.
|
|
111
131
|
*/
|
|
112
132
|
export declare function isRepoSuperset(view: TreeStoredSchema, stored: TreeStoredSchema): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* A linear extension of a partially-ordered set of `T`s. See:
|
|
135
|
+
* https://en.wikipedia.org/wiki/Linear_extension
|
|
136
|
+
*
|
|
137
|
+
* The linear extension is represented as a lookup from each poset element to its index in the linear extension.
|
|
138
|
+
*/
|
|
139
|
+
export type LinearExtension<T> = Map<T, number>;
|
|
140
|
+
/**
|
|
141
|
+
* A realizer for a partially-ordered set. See:
|
|
142
|
+
* https://en.wikipedia.org/wiki/Order_dimension
|
|
143
|
+
*/
|
|
144
|
+
export type Realizer<T> = LinearExtension<T>[];
|
|
145
|
+
/**
|
|
146
|
+
* A realizer for the partial order of field kind relaxability.
|
|
147
|
+
*
|
|
148
|
+
* It seems extremely likely that this partial order will remain dimension 2 over time (i.e. the set of allowed relaxations can be visualized
|
|
149
|
+
* with a [dominance drawing](https://en.wikipedia.org/wiki/Dominance_drawing)), so this strategy allows efficient comarison between field kinds
|
|
150
|
+
* without excessive casework.
|
|
151
|
+
*
|
|
152
|
+
* Hasse diagram for the partial order is shown below (lower fields can be relaxed to higher fields):
|
|
153
|
+
* ```
|
|
154
|
+
* sequence
|
|
155
|
+
* |
|
|
156
|
+
* optional
|
|
157
|
+
* | \
|
|
158
|
+
* required forbidden
|
|
159
|
+
* |
|
|
160
|
+
* identifier
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare const fieldRealizer: Realizer<FieldKindIdentifier>;
|
|
164
|
+
export declare const PosetComparisonResult: {
|
|
165
|
+
readonly Less: "<";
|
|
166
|
+
readonly Greater: ">";
|
|
167
|
+
readonly Equal: "=";
|
|
168
|
+
readonly Incomparable: "||";
|
|
169
|
+
};
|
|
170
|
+
type PosetComparisonResult = (typeof PosetComparisonResult)[keyof typeof PosetComparisonResult];
|
|
171
|
+
export declare function comparePosetElements<T>(a: T, b: T, realizer: Realizer<T>): PosetComparisonResult;
|
|
172
|
+
export declare function posetLte<T>(a: T, b: T, realizer: Realizer<T>): boolean;
|
|
113
173
|
export {};
|
|
114
174
|
//# sourceMappingURL=discrepancies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discrepancies.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/discrepancies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"discrepancies.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/discrepancies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,mBAAmB,EAMxB,KAAK,wBAAwB,EAE7B,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAC;AAO7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACzB,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;OAIG;IACH,UAAU,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB;IACvE,QAAQ,EAAE,cAAc,CAAC;IACzB;;OAEG;IACH,IAAI,EAAE,wBAAwB,EAAE,CAAC;IACjC;;OAEG;IACH,MAAM,EAAE,wBAAwB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;IACrE,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,mBAAmB,CAAC;CAC5B;AAED,MAAM,WAAW,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