@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
|
@@ -35,6 +35,14 @@ export interface MessageEncodingContext {
|
|
|
35
35
|
schema?: SchemaAndPolicy;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Context required for decoding a message. Unlike {@link MessageEncodingContext}, no schema is
|
|
40
|
+
* needed: message decoding is schema-agnostic.
|
|
41
|
+
*/
|
|
42
|
+
export interface MessageDecodingContext {
|
|
43
|
+
idCompressor: IIdCompressor;
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
/**
|
|
39
47
|
* Codec name used to identify the message codec, see {@link makeMessageCodecBuilder}.
|
|
40
48
|
*/
|
|
@@ -65,14 +73,16 @@ export function makeMessageCodecBuilder<TChangeset>(): VersionDispatchingCodecBu
|
|
|
65
73
|
DecodedMessage<TChangeset>,
|
|
66
74
|
MessageEncodingContext,
|
|
67
75
|
MessageFormatVersion | undefined,
|
|
68
|
-
typeof messageCodecName
|
|
76
|
+
typeof messageCodecName,
|
|
77
|
+
MessageDecodingContext
|
|
69
78
|
> {
|
|
70
79
|
// See MessageFormatVersion and its members for documentation on what changed in each version.
|
|
71
80
|
const versions: CodecVersion<
|
|
72
81
|
DecodedMessage<TChangeset>,
|
|
73
82
|
MessageEncodingContext,
|
|
74
83
|
MessageFormatVersion | undefined,
|
|
75
|
-
MessageCodecBuilderOptions<TChangeset
|
|
84
|
+
MessageCodecBuilderOptions<TChangeset>,
|
|
85
|
+
MessageDecodingContext
|
|
76
86
|
>[] = [
|
|
77
87
|
// The "undefined" wire format (no version field) is discontinued.
|
|
78
88
|
makeDiscontinuedCodecAndSchema(undefined, "2.73.0"),
|
|
@@ -95,12 +95,19 @@ export interface EnrichmentConfig<TChange> {
|
|
|
95
95
|
* Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.
|
|
96
96
|
*/
|
|
97
97
|
@breakingClass
|
|
98
|
-
export class SharedTreeCore<
|
|
98
|
+
export class SharedTreeCore<
|
|
99
|
+
TEditor extends ChangeFamilyEditor,
|
|
100
|
+
TChange,
|
|
101
|
+
TChangeProcessingContext,
|
|
102
|
+
>
|
|
99
103
|
extends VersionedSummarizer<SharedTreeSummaryFormatVersion>
|
|
100
104
|
implements WithBreakable, Summarizable
|
|
101
105
|
{
|
|
102
|
-
private readonly editManager: EditManager<TEditor, TChange,
|
|
103
|
-
private readonly summarizables: readonly [
|
|
106
|
+
private readonly editManager: EditManager<TEditor, TChange, TChangeProcessingContext>;
|
|
107
|
+
private readonly summarizables: readonly [
|
|
108
|
+
EditManagerSummarizer<TChange, TChangeProcessingContext>,
|
|
109
|
+
...Summarizable[],
|
|
110
|
+
];
|
|
104
111
|
/**
|
|
105
112
|
* The sequence number that this instance is at.
|
|
106
113
|
* This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.
|
|
@@ -147,7 +154,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
147
154
|
public readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
|
|
148
155
|
logger: ITelemetryBaseLogger | undefined,
|
|
149
156
|
summarizables: readonly Summarizable[],
|
|
150
|
-
protected readonly changeFamily: ChangeFamily<TEditor, TChange>,
|
|
157
|
+
protected readonly changeFamily: ChangeFamily<TEditor, TChange, TChangeProcessingContext>,
|
|
151
158
|
options: SharedTreeCoreOptionsInternal,
|
|
152
159
|
changeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,
|
|
153
160
|
changeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,
|
|
@@ -207,7 +214,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
207
214
|
options.minVersionForCollab,
|
|
208
215
|
this.schemaAndPolicy,
|
|
209
216
|
options.healUnresolvableIdentifiersOnDecode === true
|
|
210
|
-
? { sharedObjectId: sharedObject.id }
|
|
217
|
+
? { sharedObjectId: sharedObject.id, logger }
|
|
211
218
|
: undefined,
|
|
212
219
|
),
|
|
213
220
|
...summarizables,
|
|
@@ -519,7 +526,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
519
526
|
}
|
|
520
527
|
}
|
|
521
528
|
|
|
522
|
-
public getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
529
|
+
public getLocalBranch(): SharedTreeBranch<TEditor, TChange, TChangeProcessingContext> {
|
|
523
530
|
return this.editManager.getLocalBranch("main");
|
|
524
531
|
}
|
|
525
532
|
|
|
@@ -545,7 +552,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
545
552
|
this.editManager.addNewBranch(branchId, branchName);
|
|
546
553
|
}
|
|
547
554
|
|
|
548
|
-
public getSharedBranch(
|
|
555
|
+
public getSharedBranch(
|
|
556
|
+
branchId: BranchId,
|
|
557
|
+
): SharedTreeBranch<TEditor, TChange, TChangeProcessingContext> {
|
|
549
558
|
return this.editManager.getLocalBranch(branchId);
|
|
550
559
|
}
|
|
551
560
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
tagChange,
|
|
18
18
|
type ChangeFamilyEditor,
|
|
19
19
|
type GraphCommit,
|
|
20
|
+
type ProcessChangeFn,
|
|
20
21
|
type RevisionTag,
|
|
21
22
|
} from "../core/index.js";
|
|
22
23
|
import { getLast, getOrCreate } from "../util/index.js";
|
|
@@ -263,7 +264,7 @@ export enum ChangeProcessorApplicability {
|
|
|
263
264
|
* (see the conversion helpers in the `shared-tree` layer) so that its internal
|
|
264
265
|
* change representation does not leak into the public API.
|
|
265
266
|
*/
|
|
266
|
-
export interface ChangeProcessor<TChange> {
|
|
267
|
+
export interface ChangeProcessor<TChange, TChangeProcessingContext> {
|
|
267
268
|
/**
|
|
268
269
|
* Informs what context it should be invoked for.
|
|
269
270
|
*/
|
|
@@ -271,13 +272,13 @@ export interface ChangeProcessor<TChange> {
|
|
|
271
272
|
/**
|
|
272
273
|
* Processes the given change, returning a change with the same observable effect.
|
|
273
274
|
*/
|
|
274
|
-
readonly processChange:
|
|
275
|
+
readonly processChange: ProcessChangeFn<TChange, TChangeProcessingContext>;
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
/**
|
|
278
279
|
* Options for {@link Transactor.start | starting} a transaction.
|
|
279
280
|
*/
|
|
280
|
-
export interface SquashingTransactionOptions<TChange> {
|
|
281
|
+
export interface SquashingTransactionOptions<TChange, TChangeProcessingContext> {
|
|
281
282
|
/**
|
|
282
283
|
* An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started
|
|
283
284
|
* with this option is committed.
|
|
@@ -288,7 +289,7 @@ export interface SquashingTransactionOptions<TChange> {
|
|
|
288
289
|
* How often the processor is invoked across nested transactions is governed by its
|
|
289
290
|
* {@link ChangeProcessor.applicability | applicability}.
|
|
290
291
|
*/
|
|
291
|
-
readonly postProcessor?: ChangeProcessor<TChange>;
|
|
292
|
+
readonly postProcessor?: ChangeProcessor<TChange, TChangeProcessingContext>;
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
/**
|
|
@@ -300,8 +301,9 @@ export interface SquashingTransactionOptions<TChange> {
|
|
|
300
301
|
export class SquashingTransactionStack<
|
|
301
302
|
TEditor extends ChangeFamilyEditor,
|
|
302
303
|
TChange,
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
TChangeProcessingContext,
|
|
305
|
+
> extends TransactionStack<SquashingTransactionOptions<TChange, TChangeProcessingContext>> {
|
|
306
|
+
#transactionBranch?: SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>;
|
|
305
307
|
|
|
306
308
|
/**
|
|
307
309
|
* An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.
|
|
@@ -317,7 +319,7 @@ export class SquashingTransactionStack<
|
|
|
317
319
|
/**
|
|
318
320
|
* Get the "active branch" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.
|
|
319
321
|
*/
|
|
320
|
-
public get activeBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
322
|
+
public get activeBranch(): SharedTreeBranch<TEditor, TChange, TChangeProcessingContext> {
|
|
321
323
|
return this.#transactionBranch ?? this.branch;
|
|
322
324
|
}
|
|
323
325
|
|
|
@@ -326,10 +328,16 @@ export class SquashingTransactionStack<
|
|
|
326
328
|
* @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.
|
|
327
329
|
* In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.
|
|
328
330
|
*/
|
|
329
|
-
public get activeBranchEvents(): Listenable<
|
|
331
|
+
public get activeBranchEvents(): Listenable<
|
|
332
|
+
SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>
|
|
333
|
+
> {
|
|
330
334
|
const off = (
|
|
331
|
-
eventName: keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
332
|
-
listener: SharedTreeBranchEvents<
|
|
335
|
+
eventName: keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>,
|
|
336
|
+
listener: SharedTreeBranchEvents<
|
|
337
|
+
TEditor,
|
|
338
|
+
TChange,
|
|
339
|
+
TChangeProcessingContext
|
|
340
|
+
>[typeof eventName],
|
|
333
341
|
): void => {
|
|
334
342
|
this.activeBranch.events.off(eventName, listener);
|
|
335
343
|
const listeners = this.#activeBranchEvents.get(eventName);
|
|
@@ -349,9 +357,13 @@ export class SquashingTransactionStack<
|
|
|
349
357
|
};
|
|
350
358
|
}
|
|
351
359
|
readonly #activeBranchEvents = new Map<
|
|
352
|
-
keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
360
|
+
keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>,
|
|
353
361
|
Set<
|
|
354
|
-
SharedTreeBranchEvents<
|
|
362
|
+
SharedTreeBranchEvents<
|
|
363
|
+
TEditor,
|
|
364
|
+
TChange,
|
|
365
|
+
TChangeProcessingContext
|
|
366
|
+
>[keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>]
|
|
355
367
|
>
|
|
356
368
|
>();
|
|
357
369
|
|
|
@@ -365,20 +377,23 @@ export class SquashingTransactionStack<
|
|
|
365
377
|
* options rather than baked into this stack, so different transactions may supply different post-processors (or none).
|
|
366
378
|
*/
|
|
367
379
|
public constructor(
|
|
368
|
-
public readonly branch: SharedTreeBranch<TEditor, TChange>,
|
|
380
|
+
public readonly branch: SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>,
|
|
369
381
|
mintRevisionTag: () => RevisionTag,
|
|
370
382
|
onPush?: () => OnPopWithViewUpdate<TChange> | void,
|
|
371
383
|
) {
|
|
372
384
|
// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to
|
|
373
385
|
// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it
|
|
374
386
|
// commits, or `undefined` when none should be applied.
|
|
375
|
-
const postProcessorStack: (
|
|
387
|
+
const postProcessorStack: (
|
|
388
|
+
| ChangeProcessor<TChange, TChangeProcessingContext>
|
|
389
|
+
| undefined
|
|
390
|
+
)[] = [];
|
|
376
391
|
// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).
|
|
377
392
|
// A processor with "outermost" applicability that is already active in an enclosing transaction resolves to
|
|
378
393
|
// `undefined` so that it is only applied once (at the outermost transaction that supplied it).
|
|
379
394
|
const resolvePostProcessor = (
|
|
380
|
-
requested: ChangeProcessor<TChange> | undefined,
|
|
381
|
-
): ChangeProcessor<TChange> | undefined => {
|
|
395
|
+
requested: ChangeProcessor<TChange, TChangeProcessingContext> | undefined,
|
|
396
|
+
): ChangeProcessor<TChange, TChangeProcessingContext> | undefined => {
|
|
382
397
|
if (
|
|
383
398
|
requested?.applicability === ChangeProcessorApplicability.IfOutermost &&
|
|
384
399
|
postProcessorStack.includes(requested)
|
|
@@ -391,12 +406,13 @@ export class SquashingTransactionStack<
|
|
|
391
406
|
super(
|
|
392
407
|
// Invoked when an outer transaction starts
|
|
393
408
|
(
|
|
394
|
-
startOptions?: SquashingTransactionOptions<TChange>,
|
|
395
|
-
): Callbacks<SquashingTransactionOptions<TChange>> => {
|
|
409
|
+
startOptions?: SquashingTransactionOptions<TChange, TChangeProcessingContext>,
|
|
410
|
+
): Callbacks<SquashingTransactionOptions<TChange, TChangeProcessingContext>> => {
|
|
396
411
|
postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
|
|
397
412
|
// Keep track of the commit that each transaction was on when it started
|
|
398
413
|
const startHead = this.activeBranch.getHead();
|
|
399
|
-
const
|
|
414
|
+
const changeFamily = this.branch.changeFamily;
|
|
415
|
+
const rebaser = changeFamily.rebaser;
|
|
400
416
|
const outerOnPop = onPush?.();
|
|
401
417
|
let transactionRevision: RevisionTag | undefined;
|
|
402
418
|
const transactionBranch = this.branch.fork(
|
|
@@ -462,7 +478,9 @@ export class SquashingTransactionStack<
|
|
|
462
478
|
// Apply this transaction's post-processor (if any) to the squashed change (for example, to
|
|
463
479
|
// "minimize" it so that it contains no extraneous information).
|
|
464
480
|
const change =
|
|
465
|
-
postProcessor === undefined
|
|
481
|
+
postProcessor === undefined
|
|
482
|
+
? squash
|
|
483
|
+
: changeFamily.buildProcessor(postProcessor.processChange)(squash);
|
|
466
484
|
|
|
467
485
|
if (change !== squash) {
|
|
468
486
|
// The post-processor produced a change that differs from the
|
|
@@ -524,9 +542,9 @@ export class SquashingTransactionStack<
|
|
|
524
542
|
outerOnPop?.(result, viewUpdate);
|
|
525
543
|
};
|
|
526
544
|
// Invoked when a nested transaction begins
|
|
527
|
-
const onNestedTransactionPush: OnPush<
|
|
528
|
-
|
|
529
|
-
) => {
|
|
545
|
+
const onNestedTransactionPush: OnPush<
|
|
546
|
+
SquashingTransactionOptions<TChange, TChangeProcessingContext>
|
|
547
|
+
> = (nestedStartOptions) => {
|
|
530
548
|
postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
|
|
531
549
|
const nestedStartHead = this.activeBranch.getHead();
|
|
532
550
|
const nestedOuterOnPop = onPush?.();
|
|
@@ -558,7 +576,9 @@ export class SquashingTransactionStack<
|
|
|
558
576
|
0xd07 /* Expected transaction revision in the presence of transaction steps */,
|
|
559
577
|
);
|
|
560
578
|
const squash = rebaser.compose(nestedSteps);
|
|
561
|
-
const processedSquash =
|
|
579
|
+
const processedSquash = changeFamily.buildProcessor(
|
|
580
|
+
nestedPostProcessor.processChange,
|
|
581
|
+
)(squash);
|
|
562
582
|
// Roll back the transaction branch to the nested start head and apply the
|
|
563
583
|
// processed change if it differs from the original change.
|
|
564
584
|
if (processedSquash !== squash) {
|
|
@@ -586,7 +606,9 @@ export class SquashingTransactionStack<
|
|
|
586
606
|
|
|
587
607
|
/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
|
|
588
608
|
private setTransactionBranch(
|
|
589
|
-
transactionBranch:
|
|
609
|
+
transactionBranch:
|
|
610
|
+
| SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>
|
|
611
|
+
| undefined,
|
|
590
612
|
): void {
|
|
591
613
|
const oldActiveBranch = this.activeBranch;
|
|
592
614
|
this.#transactionBranch = transactionBranch;
|
|
@@ -103,6 +103,21 @@ export function eraseSchemaDetails<TNode, ExtraSchemaProperties = unknown>(): <
|
|
|
103
103
|
* const square = Square.create(10);
|
|
104
104
|
* assert.equal(square.area, 100);
|
|
105
105
|
* ```
|
|
106
|
+
* @remarks
|
|
107
|
+
* Care must be taken to avoid subclass members colliding with internal members of the schema.
|
|
108
|
+
* This is mainly a problem when using the output from {@link eraseSchemaDetailsSubclassable} to type a class returned to third party code which can subclass it.
|
|
109
|
+
* This pattern mainly occurs when writing generic schema factory functions which generate a schema from some parameters and return it to third party code which can subclass it.
|
|
110
|
+
*
|
|
111
|
+
* For example if the schema has a field or method named `size` (from a field, like in the `Square` example, or otherwise),
|
|
112
|
+
* then a subclass should not define a member named `size` as it will collide with the internal field.
|
|
113
|
+
*
|
|
114
|
+
* In practice, this risk can be mitigated by doing one of:
|
|
115
|
+
* 1. Using JavaScript private properties
|
|
116
|
+
* 2. Use non exported symbols for the properties
|
|
117
|
+
* 3. Use a naming convention for internal properties which you document the subclasses must not use.
|
|
118
|
+
* 4. Documenting the specific internal properties keys as not to be used by subclasses.
|
|
119
|
+
* 5. Subclass the returned class and declaring uninitialized readonly private properties to protect them (`private readonly size!: unknown;`).
|
|
120
|
+
* 6. Include the properties in `TNode` or `ExtraSchemaProperties`. This can use readonly erased types (like unknown) if desired.
|
|
106
121
|
* @privateRemarks
|
|
107
122
|
* See "example" test for an executable version of this example.
|
|
108
123
|
* @alpha
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type FieldSchema,
|
|
17
17
|
type FieldSchemaAlpha,
|
|
18
18
|
} from "../fieldSchema.js";
|
|
19
|
-
import type { LeafSchema } from "../leafNodeSchema.js";
|
|
19
|
+
import type { LeafSchema, StringSchema } from "../leafNodeSchema.js";
|
|
20
20
|
import {
|
|
21
21
|
stringSchema,
|
|
22
22
|
numberSchema,
|
|
@@ -252,7 +252,7 @@ export const schemaStatics = {
|
|
|
252
252
|
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
253
253
|
): FieldSchemaAlpha<
|
|
254
254
|
FieldKind.Identifier,
|
|
255
|
-
|
|
255
|
+
StringSchema,
|
|
256
256
|
TCustomMetadata,
|
|
257
257
|
FieldPropsAlpha<TCustomMetadata>
|
|
258
258
|
> => {
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type ImplicitAllowedTypes,
|
|
26
26
|
type TreeNodeFromImplicitAllowedTypes,
|
|
27
27
|
normalizeAllowedTypes,
|
|
28
|
+
type TreeNodeKernel,
|
|
28
29
|
} from "../core/index.js";
|
|
29
30
|
import { type ImplicitFieldSchema, FieldSchema } from "../fieldSchema.js";
|
|
30
31
|
import { tryGetTreeNodeForField } from "../getTreeNodeForField.js";
|
|
@@ -115,6 +116,10 @@ export interface ArrayNodeRemoveOp {
|
|
|
115
116
|
* `"remove"` and the destination array's delta contains an `"insert"` — they cannot be
|
|
116
117
|
* correlated without additional bookkeeping on the caller's side.
|
|
117
118
|
*
|
|
119
|
+
* The operations cover the complete array: trailing elements that were not changed are included
|
|
120
|
+
* in a final `"retain"` op. Applying every operation therefore consumes the entire pre-edit array
|
|
121
|
+
* and produces the entire post-edit array.
|
|
122
|
+
*
|
|
118
123
|
* @sealed @alpha
|
|
119
124
|
*/
|
|
120
125
|
export type ArrayNodeDeltaOp = ArrayNodeRetainOp | ArrayNodeInsertOp | ArrayNodeRemoveOp;
|
|
@@ -296,7 +301,13 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
296
301
|
// unavailable rather than receiving stale marks from only the first batch.
|
|
297
302
|
// TODO: Once the eventing stack is rewritten to walk the composed delta at
|
|
298
303
|
// flush time, `marks` will always be defined. Remove the `undefined` fallback.
|
|
299
|
-
const delta =
|
|
304
|
+
const delta =
|
|
305
|
+
marks === undefined
|
|
306
|
+
? undefined
|
|
307
|
+
: deltaMarksToArrayOpsWithRetain(marks, getArrayLength(kernel), (count) => ({
|
|
308
|
+
type: "retain",
|
|
309
|
+
count,
|
|
310
|
+
}));
|
|
300
311
|
listener({ delta });
|
|
301
312
|
});
|
|
302
313
|
} else {
|
|
@@ -314,7 +325,17 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
314
325
|
return kernel.events.on("childrenChangedAfterBatch", ({ fieldMarks }) => {
|
|
315
326
|
const marks = fieldMarks.get(EmptyKey);
|
|
316
327
|
const delta =
|
|
317
|
-
marks === undefined
|
|
328
|
+
marks === undefined
|
|
329
|
+
? undefined
|
|
330
|
+
: deltaMarksToArrayOpsWithRetain(
|
|
331
|
+
marks,
|
|
332
|
+
getArrayLength(kernel),
|
|
333
|
+
(count, subtreeChanged) => ({
|
|
334
|
+
type: "retain",
|
|
335
|
+
count,
|
|
336
|
+
subtreeChanged,
|
|
337
|
+
}),
|
|
338
|
+
);
|
|
318
339
|
(listener as (data: { readonly delta: typeof delta }) => void)({ delta });
|
|
319
340
|
});
|
|
320
341
|
}
|
|
@@ -351,73 +372,68 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
351
372
|
};
|
|
352
373
|
|
|
353
374
|
/**
|
|
354
|
-
* Converts
|
|
355
|
-
*
|
|
375
|
+
* Converts internal {@link DeltaMark}s for an array's sequence field into sequential array delta
|
|
376
|
+
* operations.
|
|
377
|
+
*
|
|
378
|
+
* @remarks
|
|
379
|
+
* Each mark describes a contiguous run:
|
|
380
|
+
* - A mark with only `count` becomes a retain.
|
|
381
|
+
* - A mark with only `attach` becomes an insert.
|
|
382
|
+
* - A mark with only `detach` becomes a remove.
|
|
383
|
+
* - A mark with both `attach` and `detach` becomes a remove followed by an insert.
|
|
356
384
|
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* - A mark with only `detach` → `"remove"` (elements removed)
|
|
361
|
-
* - A mark with both `attach` and `detach` → `"remove"` + `"insert"`
|
|
385
|
+
* Internal mark arrays may omit an unchanged suffix. The returned operations always cover the
|
|
386
|
+
* complete array, so this function uses the array's post-edit length to append a trailing retain
|
|
387
|
+
* when needed.
|
|
362
388
|
*
|
|
363
389
|
* @param marks - The low-level delta marks for the array's sequence field.
|
|
390
|
+
* @param postEditLength - The array's length after the edit.
|
|
391
|
+
* @param buildRetainOp - Builds a retain operation. Its second argument indicates whether the
|
|
392
|
+
* retained element's subtree changed; it is `false` for a synthesized trailing retain.
|
|
364
393
|
*
|
|
365
394
|
* @privateRemarks
|
|
366
395
|
* The case where both `attach` and `detach` are set is unreachable today: the sequence-field
|
|
367
|
-
* encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
|
|
396
|
+
* encoder never emits such marks for array (`EmptyKey`) fields. It is handled defensively.
|
|
368
397
|
*/
|
|
369
|
-
export function
|
|
370
|
-
|
|
398
|
+
export function deltaMarksToArrayOpsWithRetain<TRetain extends ArrayNodeRetainOp>(
|
|
399
|
+
marks: readonly DeltaMark[],
|
|
400
|
+
postEditLength: number,
|
|
401
|
+
buildRetainOp: (count: number, subtreeChanged: boolean) => TRetain,
|
|
402
|
+
): (TRetain | ArrayNodeInsertOp | ArrayNodeRemoveOp)[] {
|
|
403
|
+
const ops: (TRetain | ArrayNodeInsertOp | ArrayNodeRemoveOp)[] = [];
|
|
404
|
+
let processedLength = 0;
|
|
371
405
|
for (const mark of marks) {
|
|
372
406
|
if (mark.detach !== undefined) {
|
|
373
407
|
ops.push({ type: "remove", count: mark.count });
|
|
374
408
|
}
|
|
375
409
|
if (mark.attach !== undefined) {
|
|
376
410
|
ops.push({ type: "insert", count: mark.count });
|
|
411
|
+
processedLength += mark.count;
|
|
377
412
|
} else if (mark.detach === undefined) {
|
|
378
|
-
//
|
|
379
|
-
ops.push(
|
|
413
|
+
// When `fields` is set, `count` is guaranteed to be 1 (DeltaMark invariant).
|
|
414
|
+
ops.push(buildRetainOp(mark.count, mark.fields !== undefined));
|
|
415
|
+
processedLength += mark.count;
|
|
380
416
|
}
|
|
381
417
|
}
|
|
418
|
+
// DeltaMark arrays are allowed to omit the trailing retain, while our user facing array equivalents are not, so add it if necessary.
|
|
419
|
+
assert(
|
|
420
|
+
processedLength <= postEditLength,
|
|
421
|
+
0xd19 /* Array delta exceeds post-edit array length */,
|
|
422
|
+
);
|
|
423
|
+
if (processedLength < postEditLength) {
|
|
424
|
+
ops.push(buildRetainOp(postEditLength - processedLength, false));
|
|
425
|
+
}
|
|
382
426
|
return ops;
|
|
383
427
|
}
|
|
384
428
|
|
|
385
429
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* Same conversion rules as {@link deltaMarksToArrayOps}, but retain ops additionally carry a
|
|
391
|
-
* {@link ArrayNodeTreeChangedRetainOp.subtreeChanged} flag derived from whether the mark has
|
|
392
|
-
* a `fields` property (indicating a descendant changed).
|
|
393
|
-
*
|
|
394
|
-
* @param marks - The low-level delta marks for the array's sequence field.
|
|
395
|
-
*
|
|
396
|
-
* @privateRemarks
|
|
397
|
-
* The case where both `attach` and `detach` are set is unreachable today: the sequence-field
|
|
398
|
-
* encoder never emits such marks for array (EmptyKey) fields. It is handled defensively.
|
|
430
|
+
* Returns the length of the `EmptyKey` field under the provided node kernel.
|
|
431
|
+
* @remarks
|
|
432
|
+
* Use this with the kernel of an array node to get the current length of the array.
|
|
433
|
+
* This is the same as `.length` on the array node, but is usable without having to get (and possible create) the node and narrow to the proper type to access that.
|
|
399
434
|
*/
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
): ArrayNodeTreeChangedDeltaOp[] {
|
|
403
|
-
const ops: ArrayNodeTreeChangedDeltaOp[] = [];
|
|
404
|
-
for (const mark of marks) {
|
|
405
|
-
if (mark.detach !== undefined) {
|
|
406
|
-
ops.push({ type: "remove", count: mark.count });
|
|
407
|
-
}
|
|
408
|
-
if (mark.attach !== undefined) {
|
|
409
|
-
ops.push({ type: "insert", count: mark.count });
|
|
410
|
-
} else if (mark.detach === undefined) {
|
|
411
|
-
// Retain: elements were not added or removed (but may have deep changes).
|
|
412
|
-
// When `fields` is set, `count` is guaranteed to be 1 (DeltaMark invariant).
|
|
413
|
-
ops.push({
|
|
414
|
-
type: "retain",
|
|
415
|
-
count: mark.count,
|
|
416
|
-
subtreeChanged: mark.fields !== undefined,
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return ops;
|
|
435
|
+
function getArrayLength(arrayNodeKernel: TreeNodeKernel): number {
|
|
436
|
+
return arrayNodeKernel.getInnerNode().getBoxed(EmptyKey).length;
|
|
421
437
|
}
|
|
422
438
|
|
|
423
439
|
/**
|
|
@@ -9,8 +9,12 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
|
9
9
|
import { markEager } from "./flexList.js";
|
|
10
10
|
import { tryGetTreeNodeSchema } from "./treeNodeKernel.js";
|
|
11
11
|
import { NodeKind, type TreeNodeSchemaClass } from "./treeNodeSchema.js";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import type {
|
|
13
|
+
WithType,
|
|
14
|
+
// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.
|
|
15
|
+
typeNameSymbol,
|
|
16
|
+
typeSchemaSymbol,
|
|
17
|
+
} from "./withType.js";
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
|
|
@@ -72,22 +76,21 @@ export abstract class TreeNode implements WithType {
|
|
|
72
76
|
* someone could manually (or via Intellisense auto-implement completion, or in response to a type error)
|
|
73
77
|
* make an object literal with the [type] field and pass it off as a node: this private brand prevents that.
|
|
74
78
|
*/
|
|
75
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
79
|
+
// eslint-disable-next-line no-unused-private-class-members -- Exists for type checking sideeffect. See private remarks above.
|
|
76
80
|
readonly #brand!: unknown;
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
|
-
* Adds a
|
|
80
|
-
* @privateRemarks
|
|
81
|
-
* Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.
|
|
83
|
+
* Adds a schema identifier brand for stronger and more efficient type checking.
|
|
84
|
+
* @privateRemarks Subclasses provide more specific values to distinguish otherwise type-compatible nodes.
|
|
82
85
|
* @deprecated Use {@link typeSchemaSymbol} instead.
|
|
83
86
|
*/
|
|
84
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
87
|
+
// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.
|
|
85
88
|
public abstract get [typeNameSymbol](): string;
|
|
86
89
|
|
|
87
90
|
/**
|
|
88
|
-
*
|
|
91
|
+
* {@inheritDoc typeSchemaSymbol}
|
|
89
92
|
* @privateRemarks
|
|
90
|
-
* Subclasses provide more specific
|
|
93
|
+
* Subclasses provide more specific values for this to get strong typing of otherwise type compatible nodes.
|
|
91
94
|
*/
|
|
92
95
|
public abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;
|
|
93
96
|
|
|
@@ -152,7 +155,7 @@ export const privateToken = {};
|
|
|
152
155
|
* @param base - prototype to search for
|
|
153
156
|
* @returns true iff `base` is in the prototype chain starting at `derived`.
|
|
154
157
|
*/
|
|
155
|
-
// eslint-disable-next-line @rushstack/no-new-null
|
|
158
|
+
// eslint-disable-next-line @rushstack/no-new-null -- getPrototypeOf uses null.
|
|
156
159
|
export function inPrototypeChain(derived: object | null, base: object): boolean {
|
|
157
160
|
let checking = derived;
|
|
158
161
|
while (checking !== null) {
|
|
@@ -11,17 +11,14 @@ import type { TreeNode } from "./treeNode.js";
|
|
|
11
11
|
import type { NodeKind, TreeNodeSchemaClass } from "./treeNodeSchema.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* An internal brand to improve compiler performance.
|
|
15
15
|
* For more information about the type, use `Tree.schema(theNode)` instead.
|
|
16
16
|
* @remarks
|
|
17
|
-
* This symbol mainly exists on nodes to allow TypeScript to provide more accurate type checking.
|
|
18
17
|
* `Tree.is` and `Tree.schema` provide a superset of this information in more friendly ways.
|
|
19
|
-
*
|
|
20
|
-
* This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected.
|
|
21
|
-
* Instead construct a real node of the desired type using its constructor.
|
|
22
18
|
* @privateRemarks
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* The identifier of a {@link TreeNode}'s schema.
|
|
20
|
+
* This allows the type checker to distinguish different node types more efficiently than via {@link typeSchemaSymbol}.
|
|
21
|
+
* @deprecated External code should use `Tree.schema(theNode)` for schema related runtime data access. For type narrowing, use {@link WithType} instead of the symbols directly.
|
|
25
22
|
* @system @public
|
|
26
23
|
*/
|
|
27
24
|
export const typeNameSymbol: unique symbol = Symbol("TreeNode Type");
|
|
@@ -97,6 +94,13 @@ export const contentSchemaSymbol: unique symbol = Symbol("SharedTree Schema");
|
|
|
97
94
|
* }
|
|
98
95
|
* }
|
|
99
96
|
* ```
|
|
97
|
+
* @privateRemarks
|
|
98
|
+
* The properties of this are implemented as getters rather than instance properties as that is the easiest way to make them non-enumerable,
|
|
99
|
+
* and also saves memory and time as they only have to be setup on the prototype.
|
|
100
|
+
* These being non-enumerable inherited properties minimizes impact on users,
|
|
101
|
+
* hiding them from things like `Reflect.ownKeys`, Object spread, `Object.getOwnPropertyDescriptors`, and `for...in` loops.
|
|
102
|
+
* How we declare them here actually doesn't impact that,
|
|
103
|
+
* but is a good way to communicate to users and internal devs that these should be implemented as inherited getters to accomplish the above.
|
|
100
104
|
* @sealed @public
|
|
101
105
|
*/
|
|
102
106
|
export interface WithType<
|
|
@@ -106,6 +110,15 @@ export interface WithType<
|
|
|
106
110
|
> {
|
|
107
111
|
/**
|
|
108
112
|
* Type symbol, marking a type in a way to increase type safety via strong type checking.
|
|
113
|
+
*
|
|
114
|
+
* Use `Tree.schema(theNode)` for schema related runtime data access. For type narrowing, use `WithType` instead of the symbols directly.
|
|
115
|
+
* @remarks
|
|
116
|
+
* This should be redundant with {@link typeSchemaSymbol}, but is kept for improved compiler performance.
|
|
117
|
+
* If we just rely on {@link typeSchemaSymbol}, the compiler has to work much harder to distinguish schema in unions,
|
|
118
|
+
* which can cause large schema unions to hit "error TS2859: Excessive complexity comparing types".
|
|
119
|
+
*
|
|
120
|
+
* This property is not intended for any use other than helping the compiler distinguish schema types,
|
|
121
|
+
* and should not be referenced in any code other than internal to the tree package.
|
|
109
122
|
* @deprecated Use {@link typeSchemaSymbol} instead.
|
|
110
123
|
*/
|
|
111
124
|
get [typeNameSymbol](): TName;
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -100,7 +100,6 @@ export {
|
|
|
100
100
|
type ArrayNodeRetainOp,
|
|
101
101
|
type ArrayNodeTreeChangedDeltaOp,
|
|
102
102
|
type ArrayNodeTreeChangedRetainOp,
|
|
103
|
-
deltaMarksToArrayOps,
|
|
104
103
|
type NodeChangedData,
|
|
105
104
|
type NodeChangedDataAlpha,
|
|
106
105
|
type NodeChangedDataDelta,
|
|
@@ -328,6 +327,6 @@ export {
|
|
|
328
327
|
handleSchema,
|
|
329
328
|
nullSchema,
|
|
330
329
|
} from "./leafNodeSchema.js";
|
|
331
|
-
export type { LeafSchema } from "./leafNodeSchema.js";
|
|
330
|
+
export type { LeafSchema, StringSchema } from "./leafNodeSchema.js";
|
|
332
331
|
export { getUnhydratedContext } from "./createContext.js";
|
|
333
332
|
export { type TreeSchema, createTreeSchema } from "./treeSchema.js";
|
|
@@ -125,7 +125,12 @@ export interface LeafSchema<Name extends string, T extends TreeLeafValue>
|
|
|
125
125
|
> {}
|
|
126
126
|
|
|
127
127
|
// Leaf schema shared between all SchemaFactory instances.
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
|
+
* A {@link LeafSchema} for a `string`.
|
|
130
|
+
* @system @sealed @alpha
|
|
131
|
+
*/
|
|
132
|
+
export type StringSchema = LeafSchema<"string", string> & SimpleLeafNodeSchema;
|
|
133
|
+
export const stringSchema: StringSchema = makeLeaf("string", ValueSchema.String);
|
|
129
134
|
export const numberSchema = makeLeaf("number", ValueSchema.Number);
|
|
130
135
|
export const booleanSchema = makeLeaf("boolean", ValueSchema.Boolean);
|
|
131
136
|
export const nullSchema = makeLeaf("null", ValueSchema.Null);
|