@fluidframework/tree 2.113.1 → 2.115.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 +289 -0
- package/api-report/tree.alpha.api.md +127 -39
- package/dist/core/change-family/changeFamily.d.ts +15 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts +2 -3
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -2
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/change-family/index.d.ts +1 -1
- package/dist/core/change-family/index.d.ts.map +1 -1
- package/dist/core/change-family/index.js.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +110 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +47 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/tree/delta.d.ts +62 -16
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +7 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +32 -46
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- 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.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +2 -4
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +2 -2
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +8 -3
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +98 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.js +10 -0
- package/dist/feature-libraries/comparison-forest/index.js.map +1 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +18 -6
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +77 -72
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- 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/genericFieldKindCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/invert.js +159 -0
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +53 -406
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +205 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.js +49 -0
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.d.ts +15 -0
- package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +64 -1
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/serializedChange.d.ts +2 -2
- package/dist/shared-tree/serializedChange.d.ts.map +1 -1
- package/dist/shared-tree/serializedChange.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +11 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +9 -7
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +57 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -2
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +13 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +59 -13
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +24 -9
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +7 -0
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +4 -4
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -0
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -14
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +8 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +10 -10
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +6 -3
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -3
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +6 -7
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +48 -49
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +5 -6
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +2 -4
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +20 -7
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js +4 -7
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +6 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +91 -10
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +26 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +2 -2
- package/dist/text/codePointUtils.js +2 -2
- package/dist/text/codePointUtils.js.map +1 -1
- package/dist/text/index.d.ts +3 -3
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -4
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +30 -18
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +44 -23
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +180 -82
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +164 -84
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +48 -25
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +24 -19
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.d.ts +49 -0
- package/dist/treeDataStore.d.ts.map +1 -0
- package/dist/treeDataStore.js +57 -0
- package/dist/treeDataStore.js.map +1 -0
- package/dist/treeFactory.d.ts +8 -3
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +6 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/compressedIds.d.ts +22 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +22 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +15 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts +2 -3
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -2
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/change-family/index.d.ts +1 -1
- package/lib/core/change-family/index.d.ts.map +1 -1
- package/lib/core/change-family/index.js.map +1 -1
- package/lib/core/index.d.ts +4 -3
- 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/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +110 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +46 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/tree/delta.d.ts +62 -16
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +7 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +7 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- 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.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +2 -4
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +2 -2
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +94 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.js +6 -0
- package/lib/feature-libraries/comparison-forest/index.js.map +1 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +16 -4
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- 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/genericFieldKindCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/invert.js +155 -0
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +16 -367
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +192 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.js +45 -0
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.d.ts +15 -0
- package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +62 -1
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/serializedChange.d.ts +2 -2
- package/lib/shared-tree/serializedChange.d.ts.map +1 -1
- package/lib/shared-tree/serializedChange.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +11 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -8
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +55 -0
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +3 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +13 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +61 -15
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +24 -9
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +7 -0
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +4 -4
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -0
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -14
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +8 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +10 -10
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +6 -3
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +6 -7
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +46 -46
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +5 -6
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +2 -4
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +20 -7
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js +4 -7
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +6 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +93 -12
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +27 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +2 -2
- package/lib/text/codePointUtils.js +2 -2
- package/lib/text/codePointUtils.js.map +1 -1
- package/lib/text/index.d.ts +3 -3
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +3 -3
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +30 -18
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +41 -22
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +180 -82
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +165 -86
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +48 -25
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +25 -20
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/treeDataStore.d.ts +49 -0
- package/lib/treeDataStore.d.ts.map +1 -0
- package/lib/treeDataStore.js +52 -0
- package/lib/treeDataStore.js.map +1 -0
- package/lib/treeFactory.d.ts +8 -3
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +5 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/compressedIds.d.ts +22 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +22 -1
- package/lib/util/compressedIds.js.map +1 -1
- package/package.json +32 -24
- package/src/core/change-family/changeFamily.ts +32 -4
- package/src/core/change-family/editBuilder.ts +1 -2
- package/src/core/change-family/index.ts +2 -0
- package/src/core/index.ts +11 -6
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +113 -0
- package/src/core/tree/delta.ts +62 -16
- package/src/core/tree/detachedFieldIndex.ts +7 -38
- package/src/core/tree/index.ts +2 -0
- package/src/core/tree/visitorUtils.ts +3 -17
- package/src/entrypoints/alpha.ts +9 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -14
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +11 -1
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +140 -0
- package/src/feature-libraries/comparison-forest/index.ts +6 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +20 -6
- package/src/feature-libraries/default-schema/index.ts +1 -0
- package/src/feature-libraries/default-schema/noChangeCodecs.ts +11 -3
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +33 -5
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -3
- package/src/feature-libraries/index.ts +5 -0
- package/src/feature-libraries/mitigatedChangeFamily.ts +21 -3
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -1
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +9 -4
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/invert.ts +338 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +3 -5
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +16 -13
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +3 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +45 -644
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +340 -0
- package/src/feature-libraries/modular-schema/prune.ts +69 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +4 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +6 -3
- package/src/feature-libraries/treeTextCursor.ts +66 -1
- package/src/index.ts +11 -4
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/serializedChange.ts +2 -2
- package/src/shared-tree/sharedTree.ts +40 -15
- package/src/shared-tree/sharedTreeChangeCodecs.ts +11 -3
- package/src/shared-tree/sharedTreeChangeFamily.ts +77 -2
- package/src/shared-tree/transactionMinimize.ts +7 -3
- package/src/shared-tree/transactionPostProcessor.ts +5 -1
- package/src/shared-tree/treeCheckout.ts +136 -30
- package/src/shared-tree-core/branch.ts +41 -12
- package/src/shared-tree-core/editManager.ts +46 -25
- package/src/shared-tree-core/editManagerCodecs.ts +9 -21
- package/src/shared-tree-core/editManagerCodecsCommons.ts +14 -2
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +18 -21
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +18 -20
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -6
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -2
- package/src/shared-tree-core/messageCodecs.ts +12 -2
- package/src/shared-tree-core/sharedTreeCore.ts +16 -7
- package/src/shared-tree-core/transaction.ts +47 -25
- package/src/simple-tree/api/eraseSchemaDetails.ts +15 -0
- package/src/simple-tree/api/index.ts +0 -1
- package/src/simple-tree/api/schemaStatics.ts +2 -2
- package/src/simple-tree/api/treeNodeApi.ts +64 -48
- package/src/simple-tree/core/treeNode.ts +13 -10
- package/src/simple-tree/core/withType.ts +20 -7
- package/src/simple-tree/index.ts +1 -2
- package/src/simple-tree/leafNodeSchema.ts +6 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +130 -16
- package/src/simple-tree/node-kinds/map/mapNode.ts +137 -5
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
- package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
- package/src/text/README.md +1 -1
- package/src/text/codePointUtils.ts +2 -2
- package/src/text/index.ts +3 -3
- package/src/text/textDomain.ts +50 -27
- package/src/text/textDomainFormatted.ts +384 -163
- package/src/text/textDomainFormattedDefault.ts +32 -32
- package/src/treeDataStore.ts +125 -0
- package/src/treeFactory.ts +11 -3
- package/src/util/compressedIds.ts +36 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"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AAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,IAAI,oCAA4B,CAAC;IACvC,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,kCAA0B,CAAC,KAAK,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,IAAW,KAAK;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,kCAA0B,CAAC;QACrD,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YACrF,qHAAqH;YACrH,IAAI,IAAI,CAAC,KAAK,CAAC,uBAAuB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;gBAC7C,MAAM,CACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,wDAAwD,CAC9D,CAAC;gBACF,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, getOrCreate, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = shape.treeShape.mayContainCompressedIds ? idCompressor : undefined;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, [...this.values]);\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * Maximum topLevelLength value (exclusive) for which {@link TreeShape.withTopLevelLength}\n * caches the resulting {@link ChunkShape}. Values at or above this threshold always\n * create a new instance to prevent unbounded cache growth.\n *\n * @remarks\n * This value is an estimation of the general size needed to cover current workflows,\n * not a researched constant, and is safe to tune as workloads change.\n *\n * Raising this value captures more chunk sizes in the cache, at the cost of\n * each `TreeShape` retaining up to `chunkShapeCacheLimit - 1` cached entries for the\n * lifetime of the shape. Lowering it reduces memory held per `TreeShape` but forces\n * small chunks, where the relative cost of rebuilding `positions` is highest, to pay\n * the construction cost on every call.\n */\nconst chunkShapeCacheLimit = 8;\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t/**\n\t * Information about every node in this shape.\n\t * The root is first, and all indexes it uses to refer to other nodes are indexes into this array.\n\t * Beyond that the ordering is an implementation detail of this shape.\n\t * @remarks\n\t * Use of this in contexts where there might be multiple top-level nodes requires some additional care.\n\t * For example {@link Cursor} derives each node's actual position info from this shared\n\t * array plus the node's top-level index within the chunk.\n\t */\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t * Whether chunks using this shape (including any descendant leaf within it) may contain values compressed by the {@link UniformChunk.idCompressor}.\n\t *\n\t * @remarks\n\t * For string leaf nodes, this can be explicitly set to `true` to indicate that the value may be a compressed id\n\t * stored as a number that needs to be decompressed back to a string.\n\t * For non-leaf nodes, this is automatically derived from whether any child shapes have it set.\n\t */\n\tpublic readonly mayContainCompressedIds: boolean;\n\n\t/**\n\t * Cache for ChunkShape instances created by {@link withTopLevelLength}.\n\t * `topLevelLength` is always a positive integer (enforced by the {@link ChunkShape} constructor),\n\t * so the cache only ever holds entries for values in `1..chunkShapeCacheLimit - 1` to prevent unbounded growth.\n\t */\n\tprivate readonly chunkShapeCache: Map<number, ChunkShape> = new Map();\n\n\t/**\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeCompressedIdLeaf - whether the value may have been compressed by the {@link UniformChunk.idCompressor}.\n\t * Can only be explicitly set to `true` on string leaf nodes; otherwise this constructor asserts.\n\t * For non-leaf nodes, {@link TreeShape.mayContainCompressedIds} is automatically derived from child shapes.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tmaybeCompressedIdLeaf: boolean = false,\n\t) {\n\t\tassert(\n\t\t\thasValue === false || fieldsArray.length === 0,\n\t\t\t0xcef /* only non-leaf can have fields */,\n\t\t);\n\t\tif (maybeCompressedIdLeaf) {\n\t\t\tassert(\n\t\t\t\thasValue && type === \"com.fluidframework.leaf.string\",\n\t\t\t\t0xcf0 /* only strings can opt into maybeCompressedIdLeaf */,\n\t\t\t);\n\t\t}\n\t\t// For non-leaf nodes, derive from whether any child shapes contain compressed ids.\n\t\tthis.mayContainCompressedIds =\n\t\t\tmaybeCompressedIdLeaf || fieldsArray.some(([, shape]) => shape.mayContainCompressedIds);\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// TODO: either dedupe instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.type === other.type &&\n\t\t\tthis.hasValue === other.hasValue &&\n\t\t\tthis.mayContainCompressedIds === other.mayContainCompressedIds\n\t\t);\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\tif (topLevelLength < chunkShapeCacheLimit) {\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.chunkShapeCache,\n\t\t\t\ttopLevelLength,\n\t\t\t\t() => new ChunkShape(this, topLevelLength),\n\t\t\t);\n\t\t}\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * @remarks\n * Paired with a value array, this lets a {@link UniformChunk} be traversed like a tree by an\n * {@link ITreeCursorSynchronous}. The {@link Cursor} derives each node's position info from the\n * shared {@link TreeShape.positions} plus the node's top-level index.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree. The nodes are considered in depth first pre order\n\t * traversal, so a parent is the first node in its subtree (before its children) with offset 0\n\t * @param key - field key\n\t * @param indexOfParentField - index to this shape in the parent's array of fields\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within one top-level tree of a {@link TreeShape}.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - The parent node's {@link NodePositionInfo} or `undefined` for a root.\n\t * @param parentField - The {@link FieldKey} of the field this node occupies within its parent.\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - Which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of this node's parent in {@link TreeShape.positions}\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param topLevelLength - Number of siblings in this node's field. For a root this is unused\n\t * @param valueOffset - Offset of this node's value within one top-level tree's slice of the chunk's flat `values` array;\n\t * only valid when `shape.hasValue` (otherwise it's where the value would have gone, and should not be used to read a value).\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * @remarks\n * Tracks a flat `positionIndex` and derives each node's position info from the shape's shared\n * {@link TreeShape.positions} plus the node's top-level index.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\n\t/** Position info for the current node, or `undefined` when in root field. */\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t/** Which top-level node of the chunk the current position is within. Valid when nodePositionInfo !== undefined. */\n\tprivate topLevelIndex: number = 0;\n\n\t// Cached constants for faster access.\n\t/** The chunk's shape. */\n\tprivate readonly shape: ChunkShape;\n\t/** The chunk's per-tree shape (shape of each top-level tree). */\n\tprivate readonly treeShape: TreeShape;\n\t/** Number of positions in one top-level tree (treeShape.positions.length). */\n\tprivate readonly nodeLength: number;\n\t/** Number of values per top-level node (treeShape.valuesPerTopLevelNode). */\n\tprivate readonly stride: number;\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.treeShape = this.shape.treeShape;\n\t\tthis.nodeLength = this.treeShape.positions.length;\n\t\tthis.stride = this.treeShape.valuesPerTopLevelNode;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t *\n\t * @param positionIndex - flat position index of the newly selected node. This is NOT an index\n\t * within a field, and is not bounds checked.\n\t *\n\t * @remarks\n\t * Decomposes the index into {@link Cursor.topLevelIndex} and {@link Cursor.nodePositionInfo}.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.positionIndex = positionIndex;\n\t\tif (positionIndex === 0) {\n\t\t\tthis.nodePositionInfo = undefined;\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t\treturn;\n\t\t}\n\t\tconst decoded = this.decodePosition(positionIndex);\n\t\tthis.topLevelIndex = decoded.topLevelIndex;\n\t\tthis.nodePositionInfo = decoded.info;\n\t}\n\n\t/**\n\t * Decode a flat `positionIndex` into its components.\n\t *\n\t * @param positionIndex - flat position index of the node to decode. Must be greater than 0;\n\t * @returns the node's index within {@link TreeShape.positions} (`withinTree`), which top-level\n\t * tree holds it (`topLevelIndex`), and the corresponding shared {@link NodePositionInfo} (`info`).\n\t */\n\tprivate decodePosition(positionIndex: number): {\n\t\twithinTree: number;\n\t\ttopLevelIndex: number;\n\t\tinfo: NodePositionInfo;\n\t} {\n\t\tconst offset = positionIndex - 1;\n\t\t// Find the node's index within treeShape.positions, then which top-level tree holds it.\n\t\tconst withinTree = offset % this.nodeLength; // remainder\n\t\tconst topLevelIndex = (offset - withinTree) / this.nodeLength; // quotient\n\t\tconst info = this.treeShape.positions[withinTree] ?? oob();\n\t\treturn { withinTree, topLevelIndex, info };\n\t}\n\n\t/**\n\t * Build a standalone {@link UpPath} for the node at `positionIndex`. O(depth) allocation.\n\t *\n\t * @remarks\n\t * walks the shared per-tree {@link TreeShape.positions} and applies the top-level index\n\t * at each level. Mirrors how the `BasicChunk` cursor allocates paths.\n\t */\n\tprivate materializePath(positionIndex: number): UpPath | undefined {\n\t\tif (positionIndex === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst { withinTree, topLevelIndex, info } = this.decodePosition(positionIndex);\n\t\tif (info.parent === undefined) {\n\t\t\t// Top-level node: its parent is the (prefixed) chunk root.\n\t\t\treturn { parent: undefined, parentField: info.parentField, parentIndex: topLevelIndex };\n\t\t}\n\t\treturn {\n\t\t\tparent: this.materializePath(\n\t\t\t\tpositionIndex - withinTree + (info.indexOfParentPosition ?? oob()),\n\t\t\t),\n\t\t\tparentField: info.parentField,\n\t\t\tparentIndex: info.parentIndex,\n\t\t};\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(0xb09 /* not in a field */);\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" root-field marker at position 0, then stride by one top-level tree (nodeLength).\n\t\tthis.moveToPosition(1 + childIndex * this.nodeLength);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.materializePath(this.positionIndex),\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tthis.nodeInfo(CursorLocationType.Nodes); // assert: in nodes mode at a node\n\t\treturn prefixPath(prefix, this.materializePath(this.positionIndex));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\treturn info.parent === undefined ? this.topLevelIndex : info.parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\t/**\n\t * Number of nodes in `info`'s field including `info` itself.\n\t *\n\t * @remarks\n\t * For top-level nodes this is the chunk's `topLevelLength`, read from the chunk\n\t * rather than the node, so the shared per-tree {@link TreeShape.positions} stays independent of\n\t * chunk length; the root entry's own `topLevelLength` field is unused. Nested nodes use the\n\t * field length stored on the node.\n\t */\n\tprivate siblingCount(info: NodePositionInfo): number {\n\t\treturn info.parent === undefined ? this.shape.topLevelLength : info.topLevelLength;\n\t}\n\n\tpublic get chunkLength(): number {\n\t\treturn this.siblingCount(this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + this.fieldIndex;\n\t\tif (index >= 0 && index < this.siblingCount(info)) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = this.fieldIndex + 1;\n\t\tif (index === this.siblingCount(info)) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst withinTree = this.positionIndex - 1 - this.topLevelIndex * this.nodeLength;\n\t\t// Top-level nodes (no parent) exit to the root field at position 0;\n\t\t// nested nodes' parent is `indexOfParentPosition` within the same top-level instance.\n\t\tthis.indexOfField = info.indexOfParentField ?? 0;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition === undefined\n\t\t\t\t? 0\n\t\t\t\t: this.positionIndex - withinTree + info.indexOfParentPosition,\n\t\t);\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tif (info.shape.hasValue) {\n\t\t\tconst value = this.chunk.values[info.valueOffset + this.topLevelIndex * this.stride];\n\t\t\t// If mayContainCompressedIds is set, check if the value is a number (i.e. a compressed ID that needs decompression).\n\t\t\tif (info.shape.mayContainCompressedIds && typeof value === \"number\") {\n\t\t\t\tconst idCompressor = this.chunk.idCompressor;\n\t\t\t\tassert(\n\t\t\t\t\tidCompressor !== undefined,\n\t\t\t\t\t0xcf1 /* chunk required idCompressor but did not provide it */,\n\t\t\t\t);\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGvF,OAAO,EAWN,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEvF;;;;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CAAC;IACvC,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,kCAA0B,CAAC,KAAK,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,IAAW,KAAK;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,kCAA0B,CAAC;QACrD,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YACrF,qHAAqH;YACrH,IAAI,IAAI,CAAC,KAAK,CAAC,uBAAuB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;gBAC7C,MAAM,CACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,wDAAwD,CAC9D,CAAC;gBACF,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, getOrCreate, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = shape.treeShape.mayContainCompressedIds ? idCompressor : undefined;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, [...this.values]);\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * Maximum topLevelLength value (exclusive) for which {@link TreeShape.withTopLevelLength}\n * caches the resulting {@link ChunkShape}. Values at or above this threshold always\n * create a new instance to prevent unbounded cache growth.\n *\n * @remarks\n * This value is an estimation of the general size needed to cover current workflows,\n * not a researched constant, and is safe to tune as workloads change.\n *\n * Raising this value captures more chunk sizes in the cache, at the cost of\n * each `TreeShape` retaining up to `chunkShapeCacheLimit - 1` cached entries for the\n * lifetime of the shape. Lowering it reduces memory held per `TreeShape` but forces\n * small chunks, where the relative cost of rebuilding `positions` is highest, to pay\n * the construction cost on every call.\n */\nconst chunkShapeCacheLimit = 8;\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t/**\n\t * Information about every node in this shape.\n\t * The root is first, and all indexes it uses to refer to other nodes are indexes into this array.\n\t * Beyond that the ordering is an implementation detail of this shape.\n\t * @remarks\n\t * Use of this in contexts where there might be multiple top-level nodes requires some additional care.\n\t * For example {@link Cursor} derives each node's actual position info from this shared\n\t * array plus the node's top-level index within the chunk.\n\t */\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t * Whether chunks using this shape (including any descendant leaf within it) may contain values compressed by the {@link UniformChunk.idCompressor}.\n\t *\n\t * @remarks\n\t * For string leaf nodes, this can be explicitly set to `true` to indicate that the value may be a compressed id\n\t * stored as a number that needs to be decompressed back to a string.\n\t * For non-leaf nodes, this is automatically derived from whether any child shapes have it set.\n\t */\n\tpublic readonly mayContainCompressedIds: boolean;\n\n\t/**\n\t * Cache for ChunkShape instances created by {@link withTopLevelLength}.\n\t * `topLevelLength` is always a positive integer (enforced by the {@link ChunkShape} constructor),\n\t * so the cache only ever holds entries for values in `1..chunkShapeCacheLimit - 1` to prevent unbounded growth.\n\t */\n\tprivate readonly chunkShapeCache: Map<number, ChunkShape> = new Map();\n\n\t/**\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeCompressedIdLeaf - whether the value may have been compressed by the {@link UniformChunk.idCompressor}.\n\t * Can only be explicitly set to `true` on string leaf nodes; otherwise this constructor asserts.\n\t * For non-leaf nodes, {@link TreeShape.mayContainCompressedIds} is automatically derived from child shapes.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tmaybeCompressedIdLeaf: boolean = false,\n\t) {\n\t\tassert(\n\t\t\thasValue === false || fieldsArray.length === 0,\n\t\t\t0xcef /* only non-leaf can have fields */,\n\t\t);\n\t\tif (maybeCompressedIdLeaf) {\n\t\t\tassert(\n\t\t\t\thasValue && type === \"com.fluidframework.leaf.string\",\n\t\t\t\t0xcf0 /* only strings can opt into maybeCompressedIdLeaf */,\n\t\t\t);\n\t\t}\n\t\t// For non-leaf nodes, derive from whether any child shapes contain compressed ids.\n\t\tthis.mayContainCompressedIds =\n\t\t\tmaybeCompressedIdLeaf || fieldsArray.some(([, shape]) => shape.mayContainCompressedIds);\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// Shapes are commonly shared (e.g. all chunks from one chunker reference the same instance), so\n\t\t// short-circuit on reference identity to avoid the full structural walk in the common case.\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// A given type usually only has one shape, so check it next to speed up the false case.\n\t\tif (this.type !== other.type) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// TODO: either dedupe instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.hasValue === other.hasValue &&\n\t\t\tthis.mayContainCompressedIds === other.mayContainCompressedIds\n\t\t);\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\tif (topLevelLength < chunkShapeCacheLimit) {\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.chunkShapeCache,\n\t\t\t\ttopLevelLength,\n\t\t\t\t() => new ChunkShape(this, topLevelLength),\n\t\t\t);\n\t\t}\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * @remarks\n * Paired with a value array, this lets a {@link UniformChunk} be traversed like a tree by an\n * {@link ITreeCursorSynchronous}. The {@link Cursor} derives each node's position info from the\n * shared {@link TreeShape.positions} plus the node's top-level index.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree. The nodes are considered in depth first pre order\n\t * traversal, so a parent is the first node in its subtree (before its children) with offset 0\n\t * @param key - field key\n\t * @param indexOfParentField - index to this shape in the parent's array of fields\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within one top-level tree of a {@link TreeShape}.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - The parent node's {@link NodePositionInfo} or `undefined` for a root.\n\t * @param parentField - The {@link FieldKey} of the field this node occupies within its parent.\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - Which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of this node's parent in {@link TreeShape.positions}\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param topLevelLength - Number of siblings in this node's field. For a root this is unused\n\t * @param valueOffset - Offset of this node's value within one top-level tree's slice of the chunk's flat `values` array;\n\t * only valid when `shape.hasValue` (otherwise it's where the value would have gone, and should not be used to read a value).\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * @remarks\n * Tracks a flat `positionIndex` and derives each node's position info from the shape's shared\n * {@link TreeShape.positions} plus the node's top-level index.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\n\t/** Position info for the current node, or `undefined` when in root field. */\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t/** Which top-level node of the chunk the current position is within. Valid when nodePositionInfo !== undefined. */\n\tprivate topLevelIndex: number = 0;\n\n\t// Cached constants for faster access.\n\t/** The chunk's shape. */\n\tprivate readonly shape: ChunkShape;\n\t/** The chunk's per-tree shape (shape of each top-level tree). */\n\tprivate readonly treeShape: TreeShape;\n\t/** Number of positions in one top-level tree (treeShape.positions.length). */\n\tprivate readonly nodeLength: number;\n\t/** Number of values per top-level node (treeShape.valuesPerTopLevelNode). */\n\tprivate readonly stride: number;\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.treeShape = this.shape.treeShape;\n\t\tthis.nodeLength = this.treeShape.positions.length;\n\t\tthis.stride = this.treeShape.valuesPerTopLevelNode;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t *\n\t * @param positionIndex - flat position index of the newly selected node. This is NOT an index\n\t * within a field, and is not bounds checked.\n\t *\n\t * @remarks\n\t * Decomposes the index into {@link Cursor.topLevelIndex} and {@link Cursor.nodePositionInfo}.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.positionIndex = positionIndex;\n\t\tif (positionIndex === 0) {\n\t\t\tthis.nodePositionInfo = undefined;\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t\treturn;\n\t\t}\n\t\tconst decoded = this.decodePosition(positionIndex);\n\t\tthis.topLevelIndex = decoded.topLevelIndex;\n\t\tthis.nodePositionInfo = decoded.info;\n\t}\n\n\t/**\n\t * Decode a flat `positionIndex` into its components.\n\t *\n\t * @param positionIndex - flat position index of the node to decode. Must be greater than 0;\n\t * @returns the node's index within {@link TreeShape.positions} (`withinTree`), which top-level\n\t * tree holds it (`topLevelIndex`), and the corresponding shared {@link NodePositionInfo} (`info`).\n\t */\n\tprivate decodePosition(positionIndex: number): {\n\t\twithinTree: number;\n\t\ttopLevelIndex: number;\n\t\tinfo: NodePositionInfo;\n\t} {\n\t\tconst offset = positionIndex - 1;\n\t\t// Find the node's index within treeShape.positions, then which top-level tree holds it.\n\t\tconst withinTree = offset % this.nodeLength; // remainder\n\t\tconst topLevelIndex = (offset - withinTree) / this.nodeLength; // quotient\n\t\tconst info = this.treeShape.positions[withinTree] ?? oob();\n\t\treturn { withinTree, topLevelIndex, info };\n\t}\n\n\t/**\n\t * Build a standalone {@link UpPath} for the node at `positionIndex`. O(depth) allocation.\n\t *\n\t * @remarks\n\t * walks the shared per-tree {@link TreeShape.positions} and applies the top-level index\n\t * at each level. Mirrors how the `BasicChunk` cursor allocates paths.\n\t */\n\tprivate materializePath(positionIndex: number): UpPath | undefined {\n\t\tif (positionIndex === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst { withinTree, topLevelIndex, info } = this.decodePosition(positionIndex);\n\t\tif (info.parent === undefined) {\n\t\t\t// Top-level node: its parent is the (prefixed) chunk root.\n\t\t\treturn { parent: undefined, parentField: info.parentField, parentIndex: topLevelIndex };\n\t\t}\n\t\treturn {\n\t\t\tparent: this.materializePath(\n\t\t\t\tpositionIndex - withinTree + (info.indexOfParentPosition ?? oob()),\n\t\t\t),\n\t\t\tparentField: info.parentField,\n\t\t\tparentIndex: info.parentIndex,\n\t\t};\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(0xb09 /* not in a field */);\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" root-field marker at position 0, then stride by one top-level tree (nodeLength).\n\t\tthis.moveToPosition(1 + childIndex * this.nodeLength);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.materializePath(this.positionIndex),\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tthis.nodeInfo(CursorLocationType.Nodes); // assert: in nodes mode at a node\n\t\treturn prefixPath(prefix, this.materializePath(this.positionIndex));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\treturn info.parent === undefined ? this.topLevelIndex : info.parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\t/**\n\t * Number of nodes in `info`'s field including `info` itself.\n\t *\n\t * @remarks\n\t * For top-level nodes this is the chunk's `topLevelLength`, read from the chunk\n\t * rather than the node, so the shared per-tree {@link TreeShape.positions} stays independent of\n\t * chunk length; the root entry's own `topLevelLength` field is unused. Nested nodes use the\n\t * field length stored on the node.\n\t */\n\tprivate siblingCount(info: NodePositionInfo): number {\n\t\treturn info.parent === undefined ? this.shape.topLevelLength : info.topLevelLength;\n\t}\n\n\tpublic get chunkLength(): number {\n\t\treturn this.siblingCount(this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + this.fieldIndex;\n\t\tif (index >= 0 && index < this.siblingCount(info)) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = this.fieldIndex + 1;\n\t\tif (index === this.siblingCount(info)) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst withinTree = this.positionIndex - 1 - this.topLevelIndex * this.nodeLength;\n\t\t// Top-level nodes (no parent) exit to the root field at position 0;\n\t\t// nested nodes' parent is `indexOfParentPosition` within the same top-level instance.\n\t\tthis.indexOfField = info.indexOfParentField ?? 0;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition === undefined\n\t\t\t\t? 0\n\t\t\t\t: this.positionIndex - withinTree + info.indexOfParentPosition,\n\t\t);\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tif (info.shape.hasValue) {\n\t\t\tconst value = this.chunk.values[info.valueOffset + this.topLevelIndex * this.stride];\n\t\t\t// If mayContainCompressedIds is set, check if the value is a number (i.e. a compressed ID that needs decompression).\n\t\t\tif (info.shape.mayContainCompressedIds && typeof value === \"number\") {\n\t\t\t\tconst idCompressor = this.chunk.idCompressor;\n\t\t\t\tassert(\n\t\t\t\t\tidCompressor !== undefined,\n\t\t\t\t\t0xcf1 /* chunk required idCompressor but did not provide it */,\n\t\t\t\t);\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { Listenable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type Anchor, type AnchorSet, type AnnouncedVisitor, type DeltaVisitor, type FieldAnchor, type ForestEvents, type IEditableForest, type ITreeCursorSynchronous, type ITreeSubscriptionCursor, type TreeChunk, type TreeNavigationResult, type TreeStoredSchemaSubscription, type UpPath } from "../../core/index.js";
|
|
7
|
+
import type { Breakable } from "../../util/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* An {@link IEditableForest} which wraps two other forests: a `main` forest and a `reference` forest.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* All read operations are delegated to `main`, so from the outside a `ComparisonForest` behaves exactly like its `main` forest.
|
|
13
|
+
*
|
|
14
|
+
* When a delta is applied (via {@link IEditableForest.acquireVisitor}), the delta is applied to both `main` and `reference`.
|
|
15
|
+
* Once the visitor is freed, the full contents of both forests (including all detached/removed fields) are compared,
|
|
16
|
+
* and an error is thrown if they differ.
|
|
17
|
+
*
|
|
18
|
+
* This is a testing/debugging aid: it allows validating that a forest implementation (for example the optimized `ChunkedForest`)
|
|
19
|
+
* produces the same results as a simpler reference implementation (for example the `ObjectForest`) for every delta that is applied.
|
|
20
|
+
*
|
|
21
|
+
* @privateRemarks
|
|
22
|
+
* This forest is intentionally expensive: it maintains two full copies of the data and re-reads and
|
|
23
|
+
* structurally compares all of their contents after every delta.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ComparisonForest implements IEditableForest {
|
|
26
|
+
readonly main: IEditableForest;
|
|
27
|
+
readonly reference: IEditableForest;
|
|
28
|
+
/**
|
|
29
|
+
* @param main - The forest whose behavior is under test.
|
|
30
|
+
* All reads are delegated to this forest, and it is the source of truth for anchors and events.
|
|
31
|
+
* @param reference - The forest to compare against.
|
|
32
|
+
* This forest receives all the same deltas as `main`, and its contents are asserted to match `main` after each delta.
|
|
33
|
+
*/
|
|
34
|
+
constructor(main: IEditableForest, reference: IEditableForest);
|
|
35
|
+
private assertValid;
|
|
36
|
+
get events(): Listenable<ForestEvents>;
|
|
37
|
+
get anchors(): AnchorSet;
|
|
38
|
+
get isEmpty(): boolean;
|
|
39
|
+
clone(schema: TreeStoredSchemaSubscription, breaker?: Breakable): ComparisonForest;
|
|
40
|
+
chunkField(cursor: ITreeCursorSynchronous): TreeChunk[];
|
|
41
|
+
allocateCursor(source?: string): ITreeSubscriptionCursor;
|
|
42
|
+
forgetAnchor(anchor: Anchor): void;
|
|
43
|
+
tryMoveCursorToNode(destination: Anchor, cursorToMove: ITreeSubscriptionCursor): TreeNavigationResult;
|
|
44
|
+
tryMoveCursorToField(destination: FieldAnchor, cursorToMove: ITreeSubscriptionCursor): TreeNavigationResult;
|
|
45
|
+
moveCursorToPath(destination: UpPath, cursorToMove: ITreeSubscriptionCursor): void;
|
|
46
|
+
getCursorAboveDetachedFields(): ITreeCursorSynchronous;
|
|
47
|
+
registerAnnouncedVisitor(visitor: () => AnnouncedVisitor): void;
|
|
48
|
+
deregisterAnnouncedVisitor(visitor: () => AnnouncedVisitor): void;
|
|
49
|
+
acquireVisitor(): DeltaVisitor;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=comparisonForest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparisonForest.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/comparison-forest/comparisonForest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACN,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,MAAM,EAGX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,YAAW,eAAe;aAQtC,IAAI,EAAE,eAAe;aACrB,SAAS,EAAE,eAAe;IAR3C;;;;;OAKG;gBAEc,IAAI,EAAE,eAAe,EACrB,SAAS,EAAE,eAAe;IAK3C,OAAO,CAAC,WAAW;IAInB,IAAW,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,CAE5C;IAED,IAAW,OAAO,IAAI,SAAS,CAE9B;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,KAAK,CAAC,MAAM,EAAE,4BAA4B,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,gBAAgB;IAQlF,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,EAAE;IAIvD,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,uBAAuB;IAMxD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIlC,mBAAmB,CACzB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,uBAAuB,GACnC,oBAAoB;IAIhB,oBAAoB,CAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,uBAAuB,GACnC,oBAAoB;IAIhB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,uBAAuB,GAAG,IAAI;IAIlF,4BAA4B,IAAI,sBAAsB;IAItD,wBAAwB,CAAC,OAAO,EAAE,MAAM,gBAAgB,GAAG,IAAI;IAI/D,0BAA0B,CAAC,OAAO,EAAE,MAAM,gBAAgB,GAAG,IAAI;IAIjE,cAAc,IAAI,YAAY;CAYrC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { combineVisitors, createAnnouncedVisitor, } from "../../core/index.js";
|
|
6
|
+
import { assertForestsEqual } from "../treeTextCursor.js";
|
|
7
|
+
/**
|
|
8
|
+
* An {@link IEditableForest} which wraps two other forests: a `main` forest and a `reference` forest.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* All read operations are delegated to `main`, so from the outside a `ComparisonForest` behaves exactly like its `main` forest.
|
|
12
|
+
*
|
|
13
|
+
* When a delta is applied (via {@link IEditableForest.acquireVisitor}), the delta is applied to both `main` and `reference`.
|
|
14
|
+
* Once the visitor is freed, the full contents of both forests (including all detached/removed fields) are compared,
|
|
15
|
+
* and an error is thrown if they differ.
|
|
16
|
+
*
|
|
17
|
+
* This is a testing/debugging aid: it allows validating that a forest implementation (for example the optimized `ChunkedForest`)
|
|
18
|
+
* produces the same results as a simpler reference implementation (for example the `ObjectForest`) for every delta that is applied.
|
|
19
|
+
*
|
|
20
|
+
* @privateRemarks
|
|
21
|
+
* This forest is intentionally expensive: it maintains two full copies of the data and re-reads and
|
|
22
|
+
* structurally compares all of their contents after every delta.
|
|
23
|
+
*/
|
|
24
|
+
export class ComparisonForest {
|
|
25
|
+
/**
|
|
26
|
+
* @param main - The forest whose behavior is under test.
|
|
27
|
+
* All reads are delegated to this forest, and it is the source of truth for anchors and events.
|
|
28
|
+
* @param reference - The forest to compare against.
|
|
29
|
+
* This forest receives all the same deltas as `main`, and its contents are asserted to match `main` after each delta.
|
|
30
|
+
*/
|
|
31
|
+
constructor(main, reference) {
|
|
32
|
+
this.main = main;
|
|
33
|
+
this.reference = reference;
|
|
34
|
+
this.assertValid();
|
|
35
|
+
}
|
|
36
|
+
assertValid() {
|
|
37
|
+
assertForestsEqual(this.main, this.reference);
|
|
38
|
+
}
|
|
39
|
+
get events() {
|
|
40
|
+
return this.main.events;
|
|
41
|
+
}
|
|
42
|
+
get anchors() {
|
|
43
|
+
return this.main.anchors;
|
|
44
|
+
}
|
|
45
|
+
get isEmpty() {
|
|
46
|
+
return this.main.isEmpty;
|
|
47
|
+
}
|
|
48
|
+
clone(schema, breaker) {
|
|
49
|
+
this.assertValid();
|
|
50
|
+
return new ComparisonForest(this.main.clone(schema, breaker), this.reference.clone(schema, breaker));
|
|
51
|
+
}
|
|
52
|
+
chunkField(cursor) {
|
|
53
|
+
return this.main.chunkField(cursor);
|
|
54
|
+
}
|
|
55
|
+
allocateCursor(source) {
|
|
56
|
+
// Currently we just use the cursor from "main", but we could use "reference" or a custom cursor ensuring both match in behavior.
|
|
57
|
+
// TODO: Add a custom combined cursor type which validates two cursors match, and use it here.
|
|
58
|
+
return this.main.allocateCursor(source);
|
|
59
|
+
}
|
|
60
|
+
forgetAnchor(anchor) {
|
|
61
|
+
this.main.forgetAnchor(anchor);
|
|
62
|
+
}
|
|
63
|
+
tryMoveCursorToNode(destination, cursorToMove) {
|
|
64
|
+
return this.main.tryMoveCursorToNode(destination, cursorToMove);
|
|
65
|
+
}
|
|
66
|
+
tryMoveCursorToField(destination, cursorToMove) {
|
|
67
|
+
return this.main.tryMoveCursorToField(destination, cursorToMove);
|
|
68
|
+
}
|
|
69
|
+
moveCursorToPath(destination, cursorToMove) {
|
|
70
|
+
this.main.moveCursorToPath(destination, cursorToMove);
|
|
71
|
+
}
|
|
72
|
+
getCursorAboveDetachedFields() {
|
|
73
|
+
return this.main.getCursorAboveDetachedFields();
|
|
74
|
+
}
|
|
75
|
+
registerAnnouncedVisitor(visitor) {
|
|
76
|
+
this.main.registerAnnouncedVisitor(visitor);
|
|
77
|
+
}
|
|
78
|
+
deregisterAnnouncedVisitor(visitor) {
|
|
79
|
+
this.main.deregisterAnnouncedVisitor(visitor);
|
|
80
|
+
}
|
|
81
|
+
acquireVisitor() {
|
|
82
|
+
this.assertValid();
|
|
83
|
+
const main = this.main;
|
|
84
|
+
const reference = this.reference;
|
|
85
|
+
const mainVisitor = main.acquireVisitor();
|
|
86
|
+
const referenceVisitor = reference.acquireVisitor();
|
|
87
|
+
// A visitor which does nothing except assert the two forests match once the delta has been fully applied to both.
|
|
88
|
+
const comparisonVisitor = createAnnouncedVisitor({
|
|
89
|
+
free: () => this.assertValid(),
|
|
90
|
+
});
|
|
91
|
+
return combineVisitors([mainVisitor, referenceVisitor, comparisonVisitor]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=comparisonForest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparisonForest.js","sourceRoot":"","sources":["../../../src/feature-libraries/comparison-forest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;IAC5E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorSet,\n\ttype AnnouncedVisitor,\n\ttype DeltaVisitor,\n\ttype FieldAnchor,\n\ttype ForestEvents,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeChunk,\n\ttype TreeNavigationResult,\n\ttype TreeStoredSchemaSubscription,\n\ttype UpPath,\n\tcombineVisitors,\n\tcreateAnnouncedVisitor,\n} from \"../../core/index.js\";\nimport type { Breakable } from \"../../util/index.js\";\n\nimport { assertForestsEqual } from \"../treeTextCursor.js\";\n\n/**\n * An {@link IEditableForest} which wraps two other forests: a `main` forest and a `reference` forest.\n *\n * @remarks\n * All read operations are delegated to `main`, so from the outside a `ComparisonForest` behaves exactly like its `main` forest.\n *\n * When a delta is applied (via {@link IEditableForest.acquireVisitor}), the delta is applied to both `main` and `reference`.\n * Once the visitor is freed, the full contents of both forests (including all detached/removed fields) are compared,\n * and an error is thrown if they differ.\n *\n * This is a testing/debugging aid: it allows validating that a forest implementation (for example the optimized `ChunkedForest`)\n * produces the same results as a simpler reference implementation (for example the `ObjectForest`) for every delta that is applied.\n *\n * @privateRemarks\n * This forest is intentionally expensive: it maintains two full copies of the data and re-reads and\n * structurally compares all of their contents after every delta.\n */\nexport class ComparisonForest implements IEditableForest {\n\t/**\n\t * @param main - The forest whose behavior is under test.\n\t * All reads are delegated to this forest, and it is the source of truth for anchors and events.\n\t * @param reference - The forest to compare against.\n\t * This forest receives all the same deltas as `main`, and its contents are asserted to match `main` after each delta.\n\t */\n\tpublic constructor(\n\t\tpublic readonly main: IEditableForest,\n\t\tpublic readonly reference: IEditableForest,\n\t) {\n\t\tthis.assertValid();\n\t}\n\n\tprivate assertValid(): void {\n\t\tassertForestsEqual(this.main, this.reference);\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.main.events;\n\t}\n\n\tpublic get anchors(): AnchorSet {\n\t\treturn this.main.anchors;\n\t}\n\n\tpublic get isEmpty(): boolean {\n\t\treturn this.main.isEmpty;\n\t}\n\n\tpublic clone(schema: TreeStoredSchemaSubscription, breaker?: Breakable): ComparisonForest {\n\t\tthis.assertValid();\n\t\treturn new ComparisonForest(\n\t\t\tthis.main.clone(schema, breaker),\n\t\t\tthis.reference.clone(schema, breaker),\n\t\t);\n\t}\n\n\tpublic chunkField(cursor: ITreeCursorSynchronous): TreeChunk[] {\n\t\treturn this.main.chunkField(cursor);\n\t}\n\n\tpublic allocateCursor(source?: string): ITreeSubscriptionCursor {\n\t\t// Currently we just use the cursor from \"main\", but we could use \"reference\" or a custom cursor ensuring both match in behavior.\n\t\t// TODO: Add a custom combined cursor type which validates two cursors match, and use it here.\n\t\treturn this.main.allocateCursor(source);\n\t}\n\n\tpublic forgetAnchor(anchor: Anchor): void {\n\t\tthis.main.forgetAnchor(anchor);\n\t}\n\n\tpublic tryMoveCursorToNode(\n\t\tdestination: Anchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.main.tryMoveCursorToNode(destination, cursorToMove);\n\t}\n\n\tpublic tryMoveCursorToField(\n\t\tdestination: FieldAnchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.main.tryMoveCursorToField(destination, cursorToMove);\n\t}\n\n\tpublic moveCursorToPath(destination: UpPath, cursorToMove: ITreeSubscriptionCursor): void {\n\t\tthis.main.moveCursorToPath(destination, cursorToMove);\n\t}\n\n\tpublic getCursorAboveDetachedFields(): ITreeCursorSynchronous {\n\t\treturn this.main.getCursorAboveDetachedFields();\n\t}\n\n\tpublic registerAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.main.registerAnnouncedVisitor(visitor);\n\t}\n\n\tpublic deregisterAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.main.deregisterAnnouncedVisitor(visitor);\n\t}\n\n\tpublic acquireVisitor(): DeltaVisitor {\n\t\tthis.assertValid();\n\t\tconst main = this.main;\n\t\tconst reference = this.reference;\n\t\tconst mainVisitor = main.acquireVisitor();\n\t\tconst referenceVisitor = reference.acquireVisitor();\n\t\t// A visitor which does nothing except assert the two forests match once the delta has been fully applied to both.\n\t\tconst comparisonVisitor = createAnnouncedVisitor({\n\t\t\tfree: () => this.assertValid(),\n\t\t});\n\t\treturn combineVisitors([mainVisitor, referenceVisitor, comparisonVisitor]);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/comparison-forest/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/comparison-forest/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ComparisonForest } from \"./comparisonForest.js\";\n"]}
|
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { CodecWriteOptions, ICodecFamily } from "../../codec/index.js";
|
|
6
|
-
import { type ChangeEncodingContext, type ChangeFamily, type ChangeFamilyEditor, type ChangeRebaser, type DeltaDetachedNodeId, type DeltaRoot, type FieldUpPath, type NormalizedFieldUpPath, type NormalizedUpPath, type RevisionTag, type TaggedChange, type TreeChunk, type UpPath } from "../../core/index.js";
|
|
7
|
-
import { type ModularChangeset } from "../modular-schema/index.js";
|
|
6
|
+
import { type ChangeEncodingContext, type ChangeDecodingContext, type ChangeFamily, type ChangeFamilyEditor, type ChangeRebaser, type DeltaDetachedNodeId, type DeltaRoot, type FieldUpPath, type NormalizedFieldUpPath, type NormalizedUpPath, type RevisionTag, type TaggedChange, type TreeChunk, type UpPath, type ProcessChangeFn } from "../../core/index.js";
|
|
7
|
+
import { ModularChangeFamily, type ModularChangeset } from "../modular-schema/index.js";
|
|
8
8
|
export type DefaultChangeset = ModularChangeset;
|
|
9
|
+
export type DefaultChangeProcessingContext = ModularChangeFamily;
|
|
9
10
|
/**
|
|
10
11
|
* Implementation of {@link ChangeFamily} based on the default set of supported field kinds.
|
|
11
12
|
*
|
|
12
13
|
* @sealed
|
|
13
14
|
*/
|
|
14
|
-
export declare class DefaultChangeFamily implements ChangeFamily<DefaultEditBuilder, DefaultChangeset> {
|
|
15
|
+
export declare class DefaultChangeFamily implements ChangeFamily<DefaultEditBuilder, DefaultChangeset, DefaultChangeProcessingContext> {
|
|
15
16
|
private readonly modularFamily;
|
|
16
|
-
constructor(codecs: ICodecFamily<ModularChangeset, ChangeEncodingContext>, codecOptions: CodecWriteOptions);
|
|
17
|
+
constructor(codecs: ICodecFamily<ModularChangeset, ChangeEncodingContext, ChangeDecodingContext>, codecOptions: CodecWriteOptions);
|
|
17
18
|
get rebaser(): ChangeRebaser<DefaultChangeset>;
|
|
18
|
-
get codecs(): ICodecFamily<DefaultChangeset, ChangeEncodingContext>;
|
|
19
|
+
get codecs(): ICodecFamily<DefaultChangeset, ChangeEncodingContext, ChangeDecodingContext>;
|
|
19
20
|
buildEditor(mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void): DefaultEditBuilder;
|
|
21
|
+
buildProcessor(processFn: ProcessChangeFn<DefaultChangeset, DefaultChangeProcessingContext>): (change: DefaultChangeset) => DefaultChangeset;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* @param change - The change to convert into a delta.
|
|
@@ -110,7 +112,7 @@ export interface IDefaultEditBuilder<TContent = TreeChunk> {
|
|
|
110
112
|
export declare class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuilder {
|
|
111
113
|
private readonly mintRevisionTag;
|
|
112
114
|
private readonly modularBuilder;
|
|
113
|
-
constructor(
|
|
115
|
+
constructor(rebaser: ChangeRebaser<DefaultChangeset>, mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void, codecOptions: CodecWriteOptions);
|
|
114
116
|
enterTransaction(): void;
|
|
115
117
|
exitTransaction(): void;
|
|
116
118
|
addNodeExistsConstraint(path: UpPath): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EAGX,MAAM,qBAAqB,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"defaultEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,E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MAAM,GAAG,IAAI;IAInD,qBAAqB,IAAI,IAAI;IAI7B,6BAA6B,IAAI,IAAI;IAIrC,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,qBAAqB,CAAC,SAAS,CAAC;IA8BhE,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAwCtE,IAAI,CACV,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,WAAW,EAC7B,SAAS,EAAE,MAAM,GACf,IAAI;IA0HA,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,wBAAwB,CAAC,SAAS,CAAC;CAsC7E;AAED,MAAM,WAAW,qBAAqB,CAAC,QAAQ;IAC9C;;;OAGG;IACH,GAAG,CAAC,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB,CAAC,QAAQ;IACjD;;;;OAIG;IACH,GAAG,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAClE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAC;IAElD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/C"}
|
|
@@ -26,7 +26,10 @@ export class DefaultChangeFamily {
|
|
|
26
26
|
return this.modularFamily.codecs;
|
|
27
27
|
}
|
|
28
28
|
buildEditor(mintRevisionTag, changeReceiver) {
|
|
29
|
-
return new DefaultEditBuilder(this, mintRevisionTag, changeReceiver, this.modularFamily.codecOptions);
|
|
29
|
+
return new DefaultEditBuilder(this.modularFamily.rebaser, mintRevisionTag, changeReceiver, this.modularFamily.codecOptions);
|
|
30
|
+
}
|
|
31
|
+
buildProcessor(processFn) {
|
|
32
|
+
return this.modularFamily.buildProcessor(processFn);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
@@ -57,9 +60,9 @@ export function relevantRemovedRoots(change) {
|
|
|
57
60
|
* @sealed
|
|
58
61
|
*/
|
|
59
62
|
export class DefaultEditBuilder {
|
|
60
|
-
constructor(
|
|
63
|
+
constructor(rebaser, mintRevisionTag, changeReceiver, codecOptions) {
|
|
61
64
|
this.mintRevisionTag = mintRevisionTag;
|
|
62
|
-
this.modularBuilder = new ModularEditBuilder(
|
|
65
|
+
this.modularBuilder = new ModularEditBuilder(rebaser, fieldKinds, changeReceiver, codecOptions);
|
|
63
66
|
}
|
|
64
67
|
enterTransaction() {
|
|
65
68
|
this.modularBuilder.enterTransaction();
|