@fluidframework/tree 2.74.0 → 2.81.0-374083
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 +18 -0
- package/api-report/tree.alpha.api.md +63 -9
- package/dist/alpha.d.ts +9 -0
- package/dist/codec/codec.d.ts +31 -3
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +10 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +2 -2
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +80 -22
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +137 -15
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -2
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/change-family/changeFamily.d.ts +4 -1
- 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/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 +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +42 -3
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +52 -10
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +5 -12
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +33 -11
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -3
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +4 -4
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +7 -2
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +21 -56
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js +6 -6
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +4 -5
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -6
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +11 -41
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +5 -4
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/mapTree.js +1 -1
- package/dist/core/tree/mapTree.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +11 -3
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +14 -2
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/sparseTree.d.ts.map +1 -1
- package/dist/core/tree/sparseTree.js +1 -0
- package/dist/core/tree/sparseTree.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js +5 -9
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +3 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +58 -18
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +16 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.js +30 -0
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +4 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +9 -7
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +19 -11
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +103 -44
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +251 -77
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +22 -3
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +2 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +5 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +132 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +9 -6
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +21 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts +1 -0
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +6 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +6 -0
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +44 -15
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +5 -4
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +15 -8
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +6 -6
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +1 -0
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +12 -3
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +12 -9
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +59 -0
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +22 -53
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -13
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +7 -5
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +12 -8
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +32 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +409 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +31 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +393 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- 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 +32 -288
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +60 -26
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1519 -615
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/{lib/feature-libraries/modular-schema/modularChangeFormat.d.ts → dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts} +5 -6
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +7 -7
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +21 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +59 -13
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +7 -5
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +2 -2
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.js +1 -2
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +223 -450
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +14 -2
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +7 -21
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +28 -70
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts +2 -2
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +2 -5
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -12
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +11 -6
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +91 -263
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +1 -3
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +67 -168
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +10 -87
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +120 -119
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +35 -43
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +365 -179
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -60
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +20 -112
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +148 -318
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +7 -7
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +2 -2
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
- package/dist/feature-libraries/valueUtilities.js +16 -8
- package/dist/feature-libraries/valueUtilities.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +4 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +3 -8
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +58 -44
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +9 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +72 -44
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +10 -8
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +5 -3
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +29 -18
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +35 -29
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +21 -23
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +11 -10
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +93 -25
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +6 -3
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +13 -6
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +21 -15
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +18 -5
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +2 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +12 -0
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +2 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +3 -3
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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 +2 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +17 -5
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +2 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +12 -0
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +9 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js +4 -4
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +13 -9
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +25 -8
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +65 -30
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/transactionEnricher.d.ts +2 -2
- package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/transactionEnricher.js +3 -3
- package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
- package/dist/simple-tree/api/configuration.js +1 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +13 -9
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +21 -17
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +12 -8
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +18 -9
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +10 -5
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +19 -15
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +10 -10
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +297 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -3
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +17 -4
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +3 -1
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +21 -13
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +14 -9
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +12 -5
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +79 -23
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +4 -4
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.js +2 -1
- package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +9 -6
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +22 -20
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -1
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +21 -22
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +6 -5
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +184 -126
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +9 -5
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +31 -13
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/text/index.d.ts +6 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +10 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/textDomain.d.ts +138 -0
- package/dist/text/textDomain.d.ts.map +1 -0
- package/dist/text/textDomain.js +121 -0
- package/dist/text/textDomain.js.map +1 -0
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +17 -3
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +12 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +15 -19
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/breakable.js +7 -9
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +1 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +13 -13
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/rangeMap.d.ts +24 -12
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +46 -6
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +16 -15
- package/dist/util/utils.js.map +1 -1
- package/docs/user-facing/merge-semantics.md +3 -2
- package/eslint.config.mts +5 -48
- package/lib/alpha.d.ts +9 -0
- package/lib/codec/codec.d.ts +31 -3
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +10 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +2 -2
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +80 -22
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +138 -15
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +4 -1
- 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/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 +3 -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/changeRebaser.d.ts +42 -3
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +2 -2
- 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 +52 -10
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +3 -10
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +33 -11
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -3
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +4 -4
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +7 -2
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +23 -58
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.js +4 -4
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +4 -5
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -6
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +12 -39
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +2 -2
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/mapTree.js +1 -1
- package/lib/core/tree/mapTree.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +11 -3
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +12 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/sparseTree.d.ts.map +1 -1
- package/lib/core/tree/sparseTree.js +1 -0
- package/lib/core/tree/sparseTree.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js +5 -9
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +3 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +58 -18
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +16 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.js +24 -0
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +9 -7
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +19 -11
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +103 -44
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +249 -78
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +22 -3
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +2 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +2 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +128 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +9 -6
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +21 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts +1 -0
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +5 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +6 -0
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +45 -16
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +5 -4
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +5 -4
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +6 -6
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js +2 -1
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +12 -3
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +12 -9
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +55 -0
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +22 -53
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +8 -14
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +7 -5
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +5 -3
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +32 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +402 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +27 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +389 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- 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 +34 -290
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +60 -26
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1441 -546
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/{dist/feature-libraries/modular-schema/modularChangeFormat.d.ts → lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts} +5 -6
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/{modularChangeFormat.js → modularChangeFormatV1.js} +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +112 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +18 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +29 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +59 -13
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +7 -5
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +2 -2
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.js +1 -1
- package/lib/feature-libraries/optional-field/index.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +223 -448
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +15 -3
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +7 -21
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +30 -68
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts +2 -2
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +2 -2
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +0 -10
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +11 -6
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +93 -265
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +0 -1
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +69 -170
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +9 -81
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +122 -121
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +36 -44
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +356 -174
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -61
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +20 -112
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +144 -311
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +7 -7
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +2 -2
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
- package/lib/feature-libraries/valueUtilities.js +16 -8
- package/lib/feature-libraries/valueUtilities.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +4 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +3 -8
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +61 -47
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +9 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +41 -13
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +10 -8
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -4
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +30 -19
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +35 -29
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +21 -23
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +11 -10
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +97 -29
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +6 -3
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +13 -6
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +2 -2
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +21 -15
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +16 -4
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +2 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +12 -0
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +2 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +3 -3
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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 +2 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +15 -4
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +2 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +12 -0
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +9 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js +4 -4
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +13 -9
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +25 -8
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +67 -32
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/transactionEnricher.d.ts +2 -2
- package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/transactionEnricher.js +3 -3
- package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
- package/lib/simple-tree/api/configuration.js +1 -1
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +13 -9
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +21 -17
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- 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/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +12 -8
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +18 -9
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +10 -5
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +19 -15
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +10 -10
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +270 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +4 -7
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +17 -4
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +3 -1
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +21 -13
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +14 -9
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +12 -5
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +78 -23
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +4 -4
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
- package/lib/simple-tree/getTreeNodeForField.js +2 -1
- package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +9 -6
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -21
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js +2 -2
- package/lib/simple-tree/node-kinds/common.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +22 -23
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +6 -5
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +184 -125
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +9 -5
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +28 -11
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/text/index.d.ts +6 -0
- package/lib/text/index.d.ts.map +1 -0
- package/lib/text/index.js +6 -0
- package/lib/text/index.js.map +1 -0
- package/lib/text/textDomain.d.ts +138 -0
- package/lib/text/textDomain.d.ts.map +1 -0
- package/lib/text/textDomain.js +118 -0
- package/lib/text/textDomain.js.map +1 -0
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +18 -4
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +12 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +16 -20
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/breakable.js +7 -9
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +1 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +13 -13
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/rangeMap.d.ts +24 -12
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +44 -5
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +16 -15
- package/lib/util/utils.js.map +1 -1
- package/package.json +33 -33
- package/src/codec/codec.ts +48 -8
- package/src/codec/index.ts +4 -1
- package/src/codec/versioned/codec.ts +340 -22
- package/src/codec/versioned/index.ts +3 -1
- package/src/core/change-family/changeFamily.ts +5 -0
- package/src/core/change-family/index.ts +1 -0
- package/src/core/index.ts +8 -3
- package/src/core/rebase/changeRebaser.ts +46 -7
- package/src/core/rebase/index.ts +4 -1
- package/src/core/rebase/types.ts +71 -39
- package/src/core/rebase/utils.ts +42 -14
- package/src/core/schema-stored/schema.ts +3 -3
- package/src/core/tree/anchorSet.ts +4 -4
- package/src/core/tree/detachedFieldIndex.ts +29 -74
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +4 -8
- package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -7
- package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -9
- package/src/core/tree/detachedFieldIndexCodecs.ts +21 -64
- package/src/core/tree/index.ts +3 -2
- package/src/core/tree/mapTree.ts +1 -1
- package/src/core/tree/pathTree.ts +16 -4
- package/src/core/tree/sparseTree.ts +1 -0
- package/src/core/tree/treeTextFormat.ts +5 -9
- package/src/core/tree/visitDelta.ts +6 -2
- package/src/core/tree/visitorUtils.ts +55 -19
- package/src/feature-libraries/changeAtomIdBTree.ts +56 -0
- package/src/feature-libraries/chunked-forest/basicChunk.ts +8 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +7 -4
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +19 -11
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -5
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +442 -139
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +24 -6
- package/src/feature-libraries/default-schema/index.ts +17 -5
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +188 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +41 -9
- package/src/feature-libraries/deltaUtils.ts +6 -1
- package/src/feature-libraries/flex-tree/context.ts +17 -0
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
- package/src/feature-libraries/flex-tree/lazyField.ts +72 -30
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +3 -1
- package/src/feature-libraries/index.ts +32 -13
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +5 -5
- package/src/feature-libraries/mapTreeCursor.ts +2 -1
- package/src/feature-libraries/mitigatedChangeFamily.ts +14 -7
- package/src/feature-libraries/modular-schema/comparison.ts +12 -9
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +70 -0
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +35 -64
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +11 -25
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +20 -16
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +912 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +89 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +760 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +52 -523
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2756 -884
- package/src/feature-libraries/modular-schema/{modularChangeFormat.ts → modularChangeFormatV1.ts} +5 -4
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +34 -0
- package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +62 -0
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +70 -14
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +1 -1
- package/src/feature-libraries/object-forest/objectForest.ts +7 -5
- package/src/feature-libraries/optional-field/index.ts +1 -3
- package/src/feature-libraries/optional-field/optionalField.ts +320 -576
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
- package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +18 -3
- package/src/feature-libraries/schema-index/codec.ts +30 -90
- package/src/feature-libraries/schema-index/index.ts +2 -4
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +0 -17
- package/src/feature-libraries/schemaChecker.ts +11 -6
- package/src/feature-libraries/sequence-field/compose.ts +147 -526
- package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
- package/src/feature-libraries/sequence-field/index.ts +0 -9
- package/src/feature-libraries/sequence-field/invert.ts +103 -227
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +11 -192
- package/src/feature-libraries/sequence-field/rebase.ts +182 -210
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +54 -80
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +648 -220
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -68
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +25 -132
- package/src/feature-libraries/sequence-field/types.ts +34 -64
- package/src/feature-libraries/sequence-field/utils.ts +171 -366
- package/src/feature-libraries/treeCursorUtils.ts +7 -7
- package/src/feature-libraries/treeTextCursor.ts +2 -2
- package/src/feature-libraries/valueUtilities.ts +16 -8
- package/src/index.ts +11 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -2
- package/src/shared-tree/schematizeTree.ts +21 -8
- package/src/shared-tree/schematizingTreeView.ts +79 -83
- package/src/shared-tree/sharedTree.ts +50 -17
- package/src/shared-tree/sharedTreeChangeCodecs.ts +14 -9
- package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -2
- package/src/shared-tree/sharedTreeChangeFamily.ts +44 -24
- package/src/shared-tree/sharedTreeEditBuilder.ts +48 -13
- package/src/shared-tree/treeAlpha.ts +60 -51
- package/src/shared-tree/treeCheckout.ts +160 -73
- package/src/shared-tree-core/branch.ts +21 -6
- package/src/shared-tree-core/branchCommitEnricher.ts +3 -8
- package/src/shared-tree-core/editManager.ts +43 -29
- package/src/shared-tree-core/editManagerCodecs.ts +19 -4
- package/src/shared-tree-core/editManagerFormatCommons.ts +12 -0
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +5 -1
- package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
- package/src/shared-tree-core/index.ts +2 -0
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +18 -4
- package/src/shared-tree-core/messageFormat.ts +12 -1
- package/src/shared-tree-core/messageFormatV1ToV4.ts +18 -2
- package/src/shared-tree-core/sequenceIdUtils.ts +4 -4
- package/src/shared-tree-core/sharedTreeCore.ts +15 -8
- package/src/shared-tree-core/transaction.ts +115 -56
- package/src/shared-tree-core/transactionEnricher.ts +5 -6
- package/src/simple-tree/api/configuration.ts +1 -1
- package/src/simple-tree/api/customTree.ts +14 -10
- package/src/simple-tree/api/discrepancies.ts +23 -17
- package/src/simple-tree/api/index.ts +5 -0
- package/src/simple-tree/api/schemaFactory.ts +11 -7
- package/src/simple-tree/api/schemaFactoryAlpha.ts +1 -1
- package/src/simple-tree/api/schemaFactoryBeta.ts +1 -1
- package/src/simple-tree/api/schemaFromSimple.ts +18 -9
- package/src/simple-tree/api/simpleSchemaCodec.ts +10 -5
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +21 -17
- package/src/simple-tree/api/simpleTreeIndex.ts +8 -8
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +501 -0
- package/src/simple-tree/api/storedSchema.ts +10 -7
- package/src/simple-tree/api/transactionTypes.ts +19 -4
- package/src/simple-tree/api/tree.ts +3 -1
- package/src/simple-tree/api/treeNodeApi.ts +21 -13
- package/src/simple-tree/api/verboseTree.ts +14 -9
- package/src/simple-tree/core/treeNodeKernel.ts +12 -5
- package/src/simple-tree/core/unhydratedFlexTree.ts +109 -53
- package/src/simple-tree/fieldSchema.ts +6 -4
- package/src/simple-tree/getTreeNodeForField.ts +2 -1
- package/src/simple-tree/index.ts +7 -1
- package/src/simple-tree/leafNodeSchema.ts +8 -5
- package/src/simple-tree/node-kinds/array/arrayNode.ts +32 -30
- package/src/simple-tree/node-kinds/common.ts +2 -5
- package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
- package/src/simple-tree/node-kinds/object/objectNode.ts +29 -30
- package/src/simple-tree/node-kinds/record/recordNode.ts +12 -12
- package/src/simple-tree/prepareForInsertion.ts +343 -201
- package/src/simple-tree/toStoredSchema.ts +9 -5
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +43 -15
- package/src/text/README.md +8 -0
- package/src/text/index.ts +6 -0
- package/src/text/textDomain.ts +199 -0
- package/src/treeFactory.ts +20 -5
- package/src/util/bTreeUtils.ts +34 -23
- package/src/util/breakable.ts +9 -9
- package/src/util/idAllocator.ts +1 -2
- package/src/util/index.ts +3 -0
- package/src/util/nestedMap.ts +13 -15
- package/src/util/rangeMap.ts +72 -18
- package/src/util/utils.ts +14 -13
- package/.eslintrc.cjs +0 -140
- package/assertTagging.config.mjs +0 -14
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/docs/main/sequence-field/move-composition.md +0 -46
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +0 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAA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H,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;gBAC1E,IAAI,mBAAmB,EAAE,CAAC;oBACzB,QAAQ,CAAC,MAAM,CAAC,+BAA+B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClE,CAAC;qBAAM,CAAC;oBACP,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC1D,CAAC;gBACD,MAAM;YACP,CAAC;YACD;gBACC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { anchorSlot, rootFieldKey } from \"../core/index.js\";\nimport {\n\ttype NodeIdentifierManager,\n\tdefaultSchemaPolicy,\n\tcursorForMapTreeField,\n\tTreeStatus,\n\tContext,\n\tcombineChunks,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeUnknownUnboxed,\n\tFieldKinds,\n\ttype FlexTreeRequiredField,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\ttryGetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tSchemaCompatibilityTester,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tgetInnerNode,\n\tgetKernel,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype RunTransactionParams,\n\ttype TransactionConstraint,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n\tprepareForInsertionContextless,\n\ttype FieldSchema,\n\ttryDisposeTreeNode,\n\tFieldSchemaAlpha,\n\tTreeViewConfigurationAlpha,\n\ttoInitialSchema,\n\ttoUpgradeSchema,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\tdisposeSymbol,\n\ttype JsonCompatibleReadOnly,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { canInitialize, initialize, initializerFromChunk } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport type { TreeBranchAlpha } from \"../simple-tree/index.js\";\n\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeViewAlpha<TRootSchema>, WithBreakable\n{\n\t/**\n\t * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate flexTreeContext: Context | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();\n\n\tprivate readonly viewSchema: SchemaCompatibilityTester;\n\n\t/**\n\t * Events to unregister upon flex-tree view disposal.\n\t */\n\tprivate readonly flexTreeViewUnregisterCallbacks = new Set<() => void>();\n\n\t/**\n\t * Events to unregister upon disposal.\n\t */\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\t/**\n\t * Hydration work deferred until Context has been created.\n\t */\n\tprivate pendingHydration?: () => void;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\tpublic readonly breaker: Breakable;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.breaker = checkout.breaker;\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\n\t\tconst configAlpha = new TreeViewConfigurationAlpha({ schema: config.schema });\n\n\t\tthis.viewSchema = new SchemaCompatibilityTester(configAlpha);\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic applyChange(change: JsonCompatibleReadOnly): void {\n\t\tthis.checkout.applySerializedChange(change);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst schema = toInitialSchema(this.config.schema);\n\t\t\t// This has to be the contextless version, since when \"initialize\" is called (right after this),\n\t\t\t// it will do a schema change which would dispose of the current context (see inside `update`).\n\t\t\t// Thus using the current context (if any) would hydrate nodes then\n\t\t\t// immediately dispose them instead of having them actually be useable after initialize.\n\t\t\t// For this to work,\n\t\t\t// the hydration must be deferred until after the content is inserted into the tree and the final schema change is done (for required roots),\n\t\t\t// but before any user event could could run.\n\t\t\tconst mapTree = prepareForInsertionContextless(\n\t\t\t\tcontent as InsertableContent | undefined,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\t{\n\t\t\t\t\tschema,\n\t\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t\t},\n\t\t\t\tthis,\n\t\t\t\tschema.rootFieldSchema,\n\t\t\t\t(batches, doHydration) => {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.pendingHydration === undefined,\n\t\t\t\t\t\t0xc74 /* pendingHydration already set */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.pendingHydration = () => {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tbatches.length <= 1,\n\t\t\t\t\t\t\t0xc75 /* initialize should at most one hydration batch */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor (const batch of batches) {\n\t\t\t\t\t\t\tdoHydration(batch, {\n\t\t\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t\t\t\tparentField: rootFieldKey,\n\t\t\t\t\t\t\t\tparentIndex: 0,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tthis.checkout.transaction.start();\n\n\t\t\tinitialize(\n\t\t\t\tthis.checkout,\n\t\t\t\tschema,\n\t\t\t\tinitializerFromChunk(this.checkout, () => {\n\t\t\t\t\t// This must be done after initial schema is set!\n\t\t\t\t\treturn combineChunks(\n\t\t\t\t\t\tthis.checkout.forest.chunkField(\n\t\t\t\t\t\t\tcursorForMapTreeField(mapTree === undefined ? [] : [mapTree]),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t);\n\t\t\tthis.checkout.transaction.commit();\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema cannot be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tconst newSchema = toUpgradeSchema(this.viewSchema.viewSchema.root);\n\t\tthis.runSchemaEdit(() => this.checkout.updateSchema(newSchema));\n\t}\n\n\t/**\n\t * Gets the flex-tree context. Throws when disposed or out of schema.\n\t */\n\tpublic getFlexTreeContext(): Context {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.flexTreeContext !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.flexTreeContext;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraint[] = [],\n\t\t): void => {\n\t\t\taddConstraintsToTransaction(this.checkout, constraintsOnRevert, constraints);\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value !== undefined\n\t\t\t\t? { success: false, value: value as TFailureValue }\n\t\t\t\t: { success: false };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value !== undefined\n\t\t\t? { success: true, value: value as TSuccessValue }\n\t\t\t: { success: true };\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeFlexView();\n\n\t\tconst compatibility = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\tthis.currentCompatibility = {\n\t\t\t...compatibility,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\n\t\tconst anchors = this.checkout.forest.anchors;\n\t\tconst slots = anchors.slots;\n\n\t\tif (compatibility.canView) {\n\t\t\tthis.flexTreeContext = new Context(\n\t\t\t\tdefaultSchemaPolicy,\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t);\n\t\t\tassert(!slots.has(SimpleContextSlot), 0xa47 /* extra simple tree context */);\n\t\t\tassert(\n\t\t\t\tthis.rootFieldSchema instanceof FieldSchemaAlpha,\n\t\t\t\t0xbfa /* all field schema should be FieldSchemaAlpha */,\n\t\t\t);\n\t\t\tslots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(\n\t\t\t\t\tthis.flexTreeContext,\n\t\t\t\t\tHydratedContext.schemaMapFromRootSchema(\n\t\t\t\t\t\tthis.rootFieldSchema.allowedTypesFull.evaluate(),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\t// Trigger \"rootChanged\" events if the root changes in the future.\n\t\t\t{\n\t\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t\t// this.root.on(????)\n\t\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\".\n\t\t\t\t// Ideally these events would be just events for changes within the root.\n\t\t\t\t// TODO: provide a better event: this.view.flexTree.on(????) and/or integrate with with the normal event code paths.\n\n\t\t\t\t// Track what the root was before to be able to detect changes.\n\t\t\t\t// This uses the flex tree root to avoid demanding the simple-tree TreeNode when it might not be hydrated yet.\n\t\t\t\tlet lastRoot: FlexTreeUnknownUnboxed | undefined = (\n\t\t\t\t\tthis.flexTreeContext.root as FlexTreeOptionalField\n\t\t\t\t).content;\n\n\t\t\t\tthis.flexTreeViewUnregisterCallbacks.add(\n\t\t\t\t\tthis.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\t\t\tif (!this.midUpgrade && lastRoot !== this.flexRoot.content) {\n\t\t\t\t\t\t\tlastRoot = this.flexRoot.content;\n\t\t\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.flexTreeViewUnregisterCallbacks.add(\n\t\t\t// Will dispose the old view (if there is one) when its no longer valid, and create a new one if appropriate.\n\t\t\tthis.checkout.storedSchema.events.on(\"afterSchemaChange\", () => this.update()),\n\t\t);\n\n\t\tif (!this.midUpgrade) {\n\t\t\tassert(\n\t\t\t\tthis.pendingHydration === undefined,\n\t\t\t\t0xc76 /* no nodes should be pending hydration when triggering events that could access nodes */,\n\t\t\t);\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\t// Ensure hydration is flushed before events run which could access nodes.\n\t\tthis.pendingHydration?.();\n\t\tthis.pendingHydration = undefined;\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeFlexView(): void {\n\t\tconst anchors = this.checkout.forest.anchors;\n\t\tif (this.flexTreeContext !== undefined) {\n\t\t\t// Cleanup any TreeNodes cached in the AnchorSet when disposing the flex-tree which they wrap.\n\t\t\tfor (const anchorNode of anchors) {\n\t\t\t\ttryDisposeTreeNode(anchorNode);\n\t\t\t}\n\n\t\t\tthis.flexTreeContext[disposeSymbol]();\n\t\t\tthis.flexTreeContext = undefined;\n\t\t}\n\t\tthis.flexTreeViewUnregisterCallbacks.forEach((unregister) => unregister());\n\t\tthis.flexTreeViewUnregisterCallbacks.clear();\n\t\tanchors.slots.delete(SimpleContextSlot);\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeFlexView();\n\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\tthis.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (!this.checkout.isSharedBranch && !this.checkout.disposed) {\n\t\t\t// All non-shared branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tprivate get flexRoot(): FlexTreeOptionalField | FlexTreeRequiredField {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getFlexTreeContext();\n\t\tassert(\n\t\t\tview.root.is(FieldKinds.optional) ||\n\t\t\t\tview.root.is(FieldKinds.required) ||\n\t\t\t\tview.root.is(FieldKinds.identifier),\n\t\t\t0xc77 /* unexpected root field kind */,\n\t\t);\n\t\treturn view.root;\n\t}\n\n\tpublic get root(): ReadableField<TRootSchema> {\n\t\treturn tryGetTreeNodeForField(this.flexRoot) as ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getFlexTreeContext();\n\t\tsetField(\n\t\t\tview.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t\tthis.checkout.storedSchema.rootFieldSchema,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranchAlpha[\"fork\"]> &\n\t\tSchematizingSimpleTreeView<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranchAlpha, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranchAlpha): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nexport function getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\n}\n\n/**\n * Adds constraints to a `checkout`'s pending transaction.\n *\n * @param checkout - The checkout's who's transaction will have the constraints added to it.\n * @param constraintsOnRevert - If true, use {@link ISharedTreeEditor.addNodeExistsConstraintOnRevert}.\n * @param constraints - The constraints to add to the transaction.\n *\n * @see {@link RunTransactionParams.preconditions}.\n */\nexport function addConstraintsToTransaction(\n\tcheckout: ITreeCheckout,\n\tconstraintsOnRevert: boolean,\n\tconstraints: readonly TransactionConstraint[] = [],\n): void {\n\tfor (const constraint of constraints) {\n\t\tswitch (constraint.type) {\n\t\t\tcase \"nodeInDocument\": {\n\t\t\t\tconst node = getInnerNode(constraint.node);\n\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tassert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);\n\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\tcheckout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t} else {\n\t\t\t\t\tcheckout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(constraint.type);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OA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EAAE,CAAC;oBAC3D,MAAM,IAAI,UAAU,CACnB,iDAAiD,UAAU,iEAAiE,UAAU,EAAE,CACxI,CAAC;gBACH,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;gBAC1E,IAAI,mBAAmB,EAAE,CAAC;oBACzB,QAAQ,CAAC,MAAM,CAAC,+BAA+B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClE,CAAC;qBAAM,CAAC;oBACP,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC1D,CAAC;gBACD,MAAM;YACP,CAAC;YACD,KAAK,UAAU,CAAC,CAAC,CAAC;gBACjB,IAAI,mBAAmB,EAAE,CAAC;oBACzB,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,CAAC;gBACjD,CAAC;qBAAM,CAAC;oBACP,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;gBACzC,CAAC;gBACD,MAAM;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,eAAe,CAAC,cAAc,CAAC,CAAC;YACjC,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { anchorSlot, rootFieldKey } from \"../core/index.js\";\nimport {\n\ttype NodeIdentifierManager,\n\tdefaultSchemaPolicy,\n\tTreeStatus,\n\tContext,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeUnknownUnboxed,\n\tFieldKinds,\n\ttype FlexTreeRequiredField,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\ttryGetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tSchemaCompatibilityTester,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tgetInnerNode,\n\tgetKernel,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype RunTransactionParams,\n\ttype TransactionConstraintAlpha,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n\tprepareForInsertionContextless,\n\ttype FieldSchema,\n\ttryDisposeTreeNode,\n\tFieldSchemaAlpha,\n\tTreeViewConfigurationAlpha,\n\ttoInitialSchema,\n\ttoUpgradeSchema,\n\ttype TreeBranchAlpha,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\tdisposeSymbol,\n\thasSingle,\n\ttype JsonCompatibleReadOnly,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { canInitialize, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeViewAlpha<TRootSchema>, WithBreakable\n{\n\t/**\n\t * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate flexTreeContext: Context | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();\n\n\tprivate readonly viewSchema: SchemaCompatibilityTester;\n\n\t/**\n\t * Events to unregister upon flex-tree view disposal.\n\t */\n\tprivate readonly flexTreeViewUnregisterCallbacks = new Set<() => void>();\n\n\t/**\n\t * Events to unregister upon disposal.\n\t */\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\tpublic readonly breaker: Breakable;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.breaker = checkout.breaker;\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\n\t\tconst configAlpha = new TreeViewConfigurationAlpha({ schema: config.schema });\n\n\t\tthis.viewSchema = new SchemaCompatibilityTester(configAlpha);\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic applyChange(change: JsonCompatibleReadOnly): void {\n\t\tthis.checkout.applySerializedChange(change);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst schema = toInitialSchema(this.config.schema);\n\t\t\tthis.checkout.transaction.start();\n\t\t\tinitialize(this.checkout, schema, () => {\n\t\t\t\tconst preparedContent = prepareForInsertionContextless(\n\t\t\t\t\tcontent as InsertableContent | undefined,\n\t\t\t\t\tthis.rootFieldSchema,\n\t\t\t\t\t{\n\t\t\t\t\t\tschema,\n\t\t\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t\t\t},\n\t\t\t\t\tthis,\n\t\t\t\t\tschema.rootFieldSchema,\n\t\t\t\t);\n\n\t\t\t\tif (preparedContent.rootsLocations.length === 0) {\n\t\t\t\t\t// If there's no content to attach, no work is needed\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst field = { field: rootFieldKey, parent: undefined };\n\t\t\t\tassert(\n\t\t\t\t\tthis.checkout.storedSchema.rootFieldSchema.kind === FieldKinds.optional.identifier,\n\t\t\t\t\t\"initializerFromChunk only supports optional roots\",\n\t\t\t\t);\n\n\t\t\t\tassert(\n\t\t\t\t\thasSingle(preparedContent.rootsLocations) &&\n\t\t\t\t\t\tpreparedContent.rootsLocations[0].count === 1,\n\t\t\t\t\t\"Expected one root\",\n\t\t\t\t);\n\t\t\t\tconst fieldEditor = this.checkout.editor.optionalField(field);\n\t\t\t\tfieldEditor.attach(preparedContent.rootsLocations[0].field, true);\n\n\t\t\t\treturn preparedContent;\n\t\t\t})?.finalize([...this.getFlexTreeContext().root]);\n\n\t\t\t// TODO:CM\n\t\t\t// initialize(\n\t\t\t// \tthis.checkout,\n\t\t\t// \tschema,\n\t\t\t// \tinitializerFromChunk(this.checkout, () => {\n\t\t\t// \t\t// This must be done after initial schema is set!\n\t\t\t// \t\treturn combineChunks(\n\t\t\t// \t\t\tthis.checkout.forest.chunkField(\n\t\t\t// \t\t\t\tcursorForMapTreeField(mapTree === undefined ? [] : [mapTree]),\n\t\t\t// \t\t\t),\n\t\t\t// \t\t);\n\t\t\t// \t}),\n\t\t\t// );\n\t\t\tthis.checkout.transaction.commit();\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema cannot be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tconst newSchema = toUpgradeSchema(this.viewSchema.viewSchema.root);\n\t\tthis.runSchemaEdit(() => this.checkout.updateSchema(newSchema));\n\t}\n\n\t/**\n\t * Gets the flex-tree context. Throws when disposed or out of schema.\n\t */\n\tpublic getFlexTreeContext(): Context {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.flexTreeContext !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.flexTreeContext;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraintAlpha[] = [],\n\t\t): void => {\n\t\t\taddConstraintsToTransaction(this.checkout, constraintsOnRevert, constraints);\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value === undefined\n\t\t\t\t? { success: false }\n\t\t\t\t: { success: false, value: value as TFailureValue };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value === undefined\n\t\t\t? { success: true }\n\t\t\t: { success: true, value: value as TSuccessValue };\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeFlexView();\n\n\t\tconst compatibility = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\tthis.currentCompatibility = {\n\t\t\t...compatibility,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\n\t\tconst anchors = this.checkout.forest.anchors;\n\t\tconst slots = anchors.slots;\n\n\t\tif (compatibility.canView) {\n\t\t\tthis.flexTreeContext = new Context(\n\t\t\t\tdefaultSchemaPolicy,\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t);\n\t\t\tassert(!slots.has(SimpleContextSlot), 0xa47 /* extra simple tree context */);\n\t\t\tassert(\n\t\t\t\tthis.rootFieldSchema instanceof FieldSchemaAlpha,\n\t\t\t\t0xbfa /* all field schema should be FieldSchemaAlpha */,\n\t\t\t);\n\t\t\tslots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(\n\t\t\t\t\tthis.flexTreeContext,\n\t\t\t\t\tHydratedContext.schemaMapFromRootSchema(\n\t\t\t\t\t\tthis.rootFieldSchema.allowedTypesFull.evaluate(),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\t// Trigger \"rootChanged\" events if the root changes in the future.\n\t\t\t{\n\t\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t\t// this.root.on(????)\n\t\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\".\n\t\t\t\t// Ideally these events would be just events for changes within the root.\n\t\t\t\t// TODO: provide a better event: this.view.flexTree.on(????) and/or integrate with with the normal event code paths.\n\n\t\t\t\t// Track what the root was before to be able to detect changes.\n\t\t\t\t// This uses the flex tree root to avoid demanding the simple-tree TreeNode when it might not be hydrated yet.\n\t\t\t\tlet lastRoot: FlexTreeUnknownUnboxed | undefined = this.flexRoot.content;\n\n\t\t\t\tthis.flexTreeViewUnregisterCallbacks.add(\n\t\t\t\t\tthis.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\t\t\tif (!this.midUpgrade && lastRoot !== this.flexRoot.content) {\n\t\t\t\t\t\t\tlastRoot = this.flexRoot.content;\n\t\t\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.flexTreeViewUnregisterCallbacks.add(\n\t\t\t// Will dispose the old view (if there is one) when its no longer valid, and create a new one if appropriate.\n\t\t\tthis.checkout.storedSchema.events.on(\"afterSchemaChange\", () => this.update()),\n\t\t);\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeFlexView(): void {\n\t\tconst anchors = this.checkout.forest.anchors;\n\t\tif (this.flexTreeContext !== undefined) {\n\t\t\t// Cleanup any TreeNodes cached in the AnchorSet when disposing the flex-tree which they wrap.\n\t\t\tfor (const anchorNode of anchors) {\n\t\t\t\ttryDisposeTreeNode(anchorNode);\n\t\t\t}\n\n\t\t\tthis.flexTreeContext[disposeSymbol]();\n\t\t\tthis.flexTreeContext = undefined;\n\t\t}\n\t\tfor (const unregister of this.flexTreeViewUnregisterCallbacks) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.flexTreeViewUnregisterCallbacks.clear();\n\t\tanchors.slots.delete(SimpleContextSlot);\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeFlexView();\n\t\tfor (const unregister of this.unregisterCallbacks) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (!this.checkout.isSharedBranch && !this.checkout.disposed) {\n\t\t\t// All non-shared branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tprivate get flexRoot(): FlexTreeOptionalField | FlexTreeRequiredField {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getFlexTreeContext();\n\t\tassert(\n\t\t\tview.root.is(FieldKinds.optional) ||\n\t\t\t\tview.root.is(FieldKinds.required) ||\n\t\t\t\tview.root.is(FieldKinds.identifier),\n\t\t\t0xc77 /* unexpected root field kind */,\n\t\t);\n\t\treturn view.root;\n\t}\n\n\tpublic get root(): ReadableField<TRootSchema> {\n\t\treturn tryGetTreeNodeForField(this.flexRoot) as ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getFlexTreeContext();\n\t\tsetField(\n\t\t\tview.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t\tthis.checkout.storedSchema.rootFieldSchema,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranchAlpha[\"fork\"]> &\n\t\tSchematizingSimpleTreeView<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranchAlpha, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranchAlpha): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nexport function getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\n}\n\n/**\n * Adds constraints to a `checkout`'s pending transaction.\n *\n * @param checkout - The checkout's who's transaction will have the constraints added to it.\n * @param constraintsOnRevert - If true, use {@link IIdBasedSharedTreeEditor.addNodeExistsConstraintOnRevert}.\n * @param constraints - The constraints to add to the transaction.\n *\n * @see {@link RunTransactionParams.preconditions}.\n */\nexport function addConstraintsToTransaction(\n\tcheckout: ITreeCheckout,\n\tconstraintsOnRevert: boolean,\n\tconstraints: readonly TransactionConstraintAlpha[] = [],\n): void {\n\tfor (const constraint of constraints) {\n\t\tconst constraintType = constraint.type;\n\t\tswitch (constraintType) {\n\t\t\tcase \"nodeInDocument\": {\n\t\t\t\tconst node = getInnerNode(constraint.node);\n\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tassert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);\n\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\tcheckout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t} else {\n\t\t\t\t\tcheckout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"noChange\": {\n\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\tcheckout.editor.addNoChangeConstraintOnRevert();\n\t\t\t\t} else {\n\t\t\t\t\tcheckout.editor.addNoChangeConstraint();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(constraintType);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { type BranchId, type ClonableSchemaAndPolicy, type SharedTreeCoreOptions
|
|
|
15
15
|
import { type ITree, type ImplicitFieldSchema, type ReadSchema, type SimpleTreeSchema, type TreeView, type TreeViewAlpha, type TreeViewConfiguration, type UnsafeUnknownSchema, type VerboseTree, type ITreeAlpha, type SchemaType } from "../simple-tree/index.js";
|
|
16
16
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
17
17
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
18
|
-
import type {
|
|
18
|
+
import type { IdBasedSharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
19
19
|
import { type TreeCheckout, type BranchableTree } from "./treeCheckout.js";
|
|
20
20
|
import { type Breakable, type JsonCompatible } from "../util/index.js";
|
|
21
21
|
import { type SharedTreeChangeFormatVersion } from "./sharedTreeChangeCodecs.js";
|
|
@@ -77,7 +77,7 @@ export type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFlu
|
|
|
77
77
|
*
|
|
78
78
|
* TODO: detail compatibility requirements.
|
|
79
79
|
*/
|
|
80
|
-
export declare class SharedTreeKernel extends SharedTreeCore<
|
|
80
|
+
export declare class SharedTreeKernel extends SharedTreeCore<IdBasedSharedTreeEditBuilder, SharedTreeChange> implements SharedKernel {
|
|
81
81
|
private readonly logger;
|
|
82
82
|
readonly checkout: TreeCheckout;
|
|
83
83
|
get storedSchema(): TreeStoredSchemaRepository;
|
|
@@ -102,7 +102,7 @@ export declare class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuild
|
|
|
102
102
|
private checkoutBranch;
|
|
103
103
|
loadCore(services: IChannelStorageService): Promise<void>;
|
|
104
104
|
didAttach(): void;
|
|
105
|
-
applyStashedOp(...args: Parameters<SharedTreeCore<
|
|
105
|
+
applyStashedOp(...args: Parameters<SharedTreeCore<IdBasedSharedTreeEditBuilder, SharedTreeChange>["applyStashedOp"]>): void;
|
|
106
106
|
protected submitCommit(branchId: BranchId, commit: GraphCommit<SharedTreeChange>, schemaAndPolicy: ClonableSchemaAndPolicy, isResubmit: boolean): void;
|
|
107
107
|
onDisconnect(): void;
|
|
108
108
|
}
|
|
@@ -170,6 +170,12 @@ export interface SharedTreeOptions extends SharedTreeOptionsBeta, Partial<CodecW
|
|
|
170
170
|
* Defaults to false.
|
|
171
171
|
*/
|
|
172
172
|
readonly enableSharedBranches?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Experimental feature flag to enable the ability to edit detached roots.
|
|
175
|
+
* This feature is not yet complete and should not be used in production.
|
|
176
|
+
* Defaults to false.
|
|
177
|
+
*/
|
|
178
|
+
readonly enableDetachedRootEditing?: boolean;
|
|
173
179
|
/**
|
|
174
180
|
* Returns whether a node / field should be incrementally encoded.
|
|
175
181
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAItB,KAAK,aAAa,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,YAAY,EAOjB,KAAK,gBAAgB,EACrB,0BAA0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,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAC7C;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CACtD;AAED,MAAM,WAAW,yBAChB,SAAQ,iBAAiB,EACxB,OAAO,CAAC,6BAA6B,CAAC;IACvC,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,cAAc,EAAE,uBAAuB,CAAC;CACxC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU,CAAC,YAAY,CAAC;CAAG;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,YAG/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,YAY/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,YAGpC,CAAC;AAaF;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,aAAa,EAC3B,yBAAyB,EAAE,yBAAyB,GAClD,eAAe,CAOjB;AAED,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,yBAAyB,CAcxE,CAAC"}
|
|
@@ -43,8 +43,10 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
43
43
|
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
44
44
|
import { UsageError, } from "@fluidframework/telemetry-utils/internal";
|
|
45
45
|
import { DependentFormatVersion, FluidClientVersion, FormatValidatorNoOp, } from "../codec/index.js";
|
|
46
|
-
import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, RevisionTagCodec, TreeStoredSchemaRepository,
|
|
47
|
-
import { DetachedFieldIndexSummarizer, FieldKinds, ForestSummarizer, SchemaSummarizer, TreeCompressionStrategy, buildChunkedForest, buildForest, defaultIncrementalEncodingPolicy, defaultSchemaPolicy, getCodecTreeForFieldBatchFormat, getCodecTreeForForestFormat,
|
|
46
|
+
import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, RevisionTagCodec, TreeStoredSchemaRepository, detachedFieldIndexCodecBuilder, makeDetachedFieldIndex, moveToDetachedField, } from "../core/index.js";
|
|
47
|
+
import { DetachedFieldIndexSummarizer, FieldKinds, ForestSummarizer, SchemaSummarizer, TreeCompressionStrategy, buildChunkedForest, buildForest, defaultIncrementalEncodingPolicy, defaultSchemaPolicy, getCodecTreeForFieldBatchFormat, getCodecTreeForForestFormat, jsonableTreeFromFieldCursor, makeFieldBatchCodec, makeMitigatedChangeFamily, makeSchemaCodec, makeTreeChunker, } from "../feature-libraries/index.js";
|
|
48
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
49
|
+
import { schemaCodecBuilder } from "../feature-libraries/schema-index/index.js";
|
|
48
50
|
import { clientVersionToEditManagerFormatVersion, clientVersionToMessageFormatVersion, getCodecTreeForEditManagerFormatWithChange, getCodecTreeForMessageFormatWithChange, MessageFormatVersion, SharedTreeCore, EditManagerFormatVersion, } from "../shared-tree-core/index.js";
|
|
49
51
|
import { NodeKind, tryStoredSchemaAsArray, FieldKind, } from "../simple-tree/index.js";
|
|
50
52
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -167,10 +169,10 @@ let SharedTreeKernel = (() => {
|
|
|
167
169
|
}
|
|
168
170
|
});
|
|
169
171
|
checkout.events.on("beforeBatch", (event) => {
|
|
170
|
-
if (event.type === "append" &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
if (event.type === "append" &&
|
|
173
|
+
this.sharedObject.isAttached() &&
|
|
174
|
+
checkout.transaction.isInProgress()) {
|
|
175
|
+
enricher.addTransactionCommits(event.newCommits);
|
|
174
176
|
}
|
|
175
177
|
});
|
|
176
178
|
}
|
|
@@ -306,6 +308,7 @@ export function getBranch(treeOrView) {
|
|
|
306
308
|
* Once an entry is defined and used in production, it cannot be changed.
|
|
307
309
|
* This is because the format for SharedTree changes are not explicitly versioned.
|
|
308
310
|
*/
|
|
311
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- intentional comparison
|
|
309
312
|
export const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([
|
|
310
313
|
[
|
|
311
314
|
brand(EditManagerFormatVersion.v3),
|
|
@@ -319,6 +322,14 @@ export const changeFormatVersionForEditManager = DependentFormatVersion.fromPair
|
|
|
319
322
|
brand(EditManagerFormatVersion.vSharedBranches),
|
|
320
323
|
brand(4),
|
|
321
324
|
],
|
|
325
|
+
[
|
|
326
|
+
brand(EditManagerFormatVersion.v6),
|
|
327
|
+
brand(5),
|
|
328
|
+
],
|
|
329
|
+
[
|
|
330
|
+
brand(EditManagerFormatVersion.vDetachedRoots),
|
|
331
|
+
brand(101),
|
|
332
|
+
],
|
|
322
333
|
]);
|
|
323
334
|
/**
|
|
324
335
|
* Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.
|
|
@@ -339,6 +350,14 @@ export const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([
|
|
|
339
350
|
brand(MessageFormatVersion.vSharedBranches),
|
|
340
351
|
brand(4),
|
|
341
352
|
],
|
|
353
|
+
[
|
|
354
|
+
brand(MessageFormatVersion.v6),
|
|
355
|
+
brand(5),
|
|
356
|
+
],
|
|
357
|
+
[
|
|
358
|
+
brand(MessageFormatVersion.vDetachedRoots),
|
|
359
|
+
brand(101),
|
|
360
|
+
],
|
|
342
361
|
]);
|
|
343
362
|
function getCodecTreeForEditManagerFormat(clientVersion) {
|
|
344
363
|
const change = changeFormatVersionForEditManager.lookup(clientVersionToEditManagerFormatVersion(clientVersion));
|
|
@@ -353,8 +372,8 @@ function getCodecTreeForMessageFormat(clientVersion) {
|
|
|
353
372
|
export function getCodecTreeForSharedTreeFormat(clientVersion) {
|
|
354
373
|
const children = [];
|
|
355
374
|
children.push(getCodecTreeForForestFormat(clientVersion));
|
|
356
|
-
children.push(
|
|
357
|
-
children.push(
|
|
375
|
+
children.push(schemaCodecBuilder.getCodecTree(clientVersion));
|
|
376
|
+
children.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));
|
|
358
377
|
children.push(getCodecTreeForEditManagerFormat(clientVersion));
|
|
359
378
|
children.push(getCodecTreeForMessageFormat(clientVersion));
|
|
360
379
|
children.push(getCodecTreeForFieldBatchFormat(clientVersion));
|
|
@@ -412,6 +431,10 @@ export const defaultSharedTreeOptions = {
|
|
|
412
431
|
editManagerFormatSelector: clientVersionToEditManagerFormatVersion,
|
|
413
432
|
messageFormatSelector: clientVersionToMessageFormatVersion,
|
|
414
433
|
enableSharedBranches: false,
|
|
434
|
+
writeVersionOverrides: new Map(),
|
|
435
|
+
allowPossiblyIncompatibleWriteVersionOverrides: false,
|
|
436
|
+
enableDetachedRootEditing: false,
|
|
437
|
+
canMakeDetachedRootEdits: false,
|
|
415
438
|
};
|
|
416
439
|
/**
|
|
417
440
|
* Build the allowed types for a Stored Schema.
|
|
@@ -431,21 +454,26 @@ function buildSimpleAllowedTypeAttributesForStoredSchema(types) {
|
|
|
431
454
|
function exportSimpleFieldSchemaStored(schema) {
|
|
432
455
|
let kind;
|
|
433
456
|
switch (schema.kind) {
|
|
434
|
-
case FieldKinds.identifier.identifier:
|
|
457
|
+
case FieldKinds.identifier.identifier: {
|
|
435
458
|
kind = FieldKind.Identifier;
|
|
436
459
|
break;
|
|
437
|
-
|
|
460
|
+
}
|
|
461
|
+
case FieldKinds.optional.identifier: {
|
|
438
462
|
kind = FieldKind.Optional;
|
|
439
463
|
break;
|
|
440
|
-
|
|
464
|
+
}
|
|
465
|
+
case FieldKinds.required.identifier: {
|
|
441
466
|
kind = FieldKind.Required;
|
|
442
467
|
break;
|
|
443
|
-
|
|
468
|
+
}
|
|
469
|
+
case FieldKinds.forbidden.identifier: {
|
|
444
470
|
kind = FieldKind.Optional;
|
|
445
471
|
assert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);
|
|
446
472
|
break;
|
|
447
|
-
|
|
473
|
+
}
|
|
474
|
+
default: {
|
|
448
475
|
fail(0xaca /* invalid field kind */);
|
|
476
|
+
}
|
|
449
477
|
}
|
|
450
478
|
return {
|
|
451
479
|
kind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AASnE,OAAO,EACN,UAAU,GAEV,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAIhB,0BAA0B,EAG1B,uCAAuC,EACvC,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,4BAA4B,EAC5B,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,gCAAgC,EAChC,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,eAAe,GAEf,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEN,uCAAuC,EACvC,mCAAmC,EAEnC,0CAA0C,EAC1C,sCAAsC,EAEtC,oBAAoB,EACpB,cAAc,EACd,wBAAwB,GACxB,MAAM,8BAA8B,CA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AO;YACN,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,MAAM,CAAC,SAAS;YAC1B,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tgetCodecTreeForDetachedFieldIndexFormat,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForFieldBatchFormat,\n\tgetCodecTreeForForestFormat,\n\tgetCodecTreeForSchemaFormat,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport type { FormatV1 } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype BranchId,\n\tclientVersionToEditManagerFormatVersion,\n\tclientVersionToMessageFormatVersion,\n\ttype ClonableSchemaAndPolicy,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\ttype SharedTreeCoreOptionsInternal,\n\tMessageFormatVersion,\n\tSharedTreeCore,\n\tEditManagerFormatVersion,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n\ttype SchemaType,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport {\n\tbrand,\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\ttype SharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options: Required<SharedTreeOptionsInternal> = {\n\t\t\t...defaultSharedTreeOptions,\n\t\t\t...optionsParam,\n\t\t};\n\t\tif (options.minVersionForCollab < FluidClientVersion.v2_0) {\n\t\t\tthrow new UsageError(\"SharedTree requires minVersionForCollab of at least 2.0.0\");\n\t\t}\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(\n\t\t\tremovedRoots,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tundefined,\n\t\t\tchangeEnricher,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t\tconst enricher = this.getCommitEnricher(branchId);\n\t\tcheckout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.startTransaction();\n\t\t\t}\n\t\t});\n\n\t\tcheckout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.sharedObject.isAttached()) {\n\t\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t\tenricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.branch();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tconst enricher = new SharedTreeReadonlyChangeEnricher(\n\t\t\tcheckout.forest,\n\t\t\tcheckout.storedSchema,\n\t\t\tcheckout.removedRoots,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(branchId, enricher);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(\n\tstoredSchema: TreeStoredSchema,\n): SimpleTreeSchema<SchemaType.Stored> {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec({\n\t\t...options,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t});\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.vSharedBranches),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.vSharedBranches),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n]);\n\nfunction getCodecTreeForEditManagerFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForEditManager.lookup(\n\t\tclientVersionToEditManagerFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForMessage.lookup(\n\t\tclientVersionToMessageFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tchildren.push(getCodecTreeForForestFormat(clientVersion));\n\tchildren.push(getCodecTreeForSchemaFormat(clientVersion));\n\tchildren.push(getCodecTreeForDetachedFieldIndexFormat(clientVersion));\n\tchildren.push(getCodecTreeForEditManagerFormat(clientVersion));\n\tchildren.push(getCodecTreeForMessageFormat(clientVersion));\n\tchildren.push(getCodecTreeForFieldBatchFormat(clientVersion));\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion: undefined, // SharedTree does not have a version of its own.\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions;\n\n/**\n * Configuration options for SharedTree with alpha features.\n * @alpha @input\n */\nexport interface SharedTreeOptions\n\textends SharedTreeOptionsBeta,\n\t\tPartial<CodecWriteOptions>,\n\t\tPartial<SharedTreeFormatOptions> {\n\t/**\n\t * Experimental feature flag to enable shared branches.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableSharedBranches?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n\nexport interface SharedTreeOptionsInternal\n\textends SharedTreeOptions,\n\t\tPartial<SharedTreeCoreOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n}\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n\teditManagerFormatSelector: clientVersionToEditManagerFormatVersion,\n\tmessageFormatSelector: clientVersionToMessageFormatVersion,\n\tenableSharedBranches: false,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes<SchemaType.Stored>> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes<SchemaType.Stored>>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(\n\tschema: TreeFieldStoredSchema,\n): SimpleFieldSchema<SchemaType.Stored> {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(0xaca /* invalid field kind */);\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`\n * field on SimpleNodeSchema is not persisted.\n */\nfunction exportSimpleNodeSchemaStored(\n\tschema: TreeNodeStoredSchema,\n): SimpleNodeSchema<SchemaType.Stored> {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema<SchemaType.Stored>>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn {\n\t\t\tkind: NodeKind.Object,\n\t\t\tfields,\n\t\t\tallowUnknownOptionalFields: undefined,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AASnE,OAAO,EACN,UAAU,GAEV,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAIhB,0BAA0B,EAG1B,8BAA8B,EAC9B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,4BAA4B,EAC5B,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,kBA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cesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tdetachedFieldIndexCodecBuilder,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForFieldBatchFormat,\n\tgetCodecTreeForForestFormat,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { schemaCodecBuilder, type FormatV1 } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype BranchId,\n\tclientVersionToEditManagerFormatVersion,\n\tclientVersionToMessageFormatVersion,\n\ttype ClonableSchemaAndPolicy,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\ttype SharedTreeCoreOptionsInternal,\n\tMessageFormatVersion,\n\tSharedTreeCore,\n\tEditManagerFormatVersion,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n\ttype SchemaType,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { IdBasedSharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport {\n\tbrand,\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\ttype SharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<IdBasedSharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options: Required<SharedTreeOptionsInternal> = {\n\t\t\t...defaultSharedTreeOptions,\n\t\t\t...optionsParam,\n\t\t};\n\t\tif (options.minVersionForCollab < FluidClientVersion.v2_0) {\n\t\t\tthrow new UsageError(\"SharedTree requires minVersionForCollab of at least 2.0.0\");\n\t\t}\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(\n\t\t\tremovedRoots,\n\t\t\toptions.minVersionForCollab,\n\t\t);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tundefined,\n\t\t\tchangeEnricher,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t\tconst enricher = this.getCommitEnricher(branchId);\n\t\tcheckout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.startTransaction();\n\t\t\t}\n\t\t});\n\n\t\tcheckout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (\n\t\t\t\tevent.type === \"append\" &&\n\t\t\t\tthis.sharedObject.isAttached() &&\n\t\t\t\tcheckout.transaction.isInProgress()\n\t\t\t) {\n\t\t\t\tenricher.addTransactionCommits(event.newCommits);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.branch();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tconst enricher = new SharedTreeReadonlyChangeEnricher(\n\t\t\tcheckout.forest,\n\t\t\tcheckout.storedSchema,\n\t\t\tcheckout.removedRoots,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(branchId, enricher);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<IdBasedSharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(\n\tstoredSchema: TreeStoredSchema,\n): SimpleTreeSchema<SchemaType.Stored> {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec({\n\t\t...options,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t});\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- intentional comparison\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.vSharedBranches),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v6),\n\t\tbrand<SharedTreeChangeFormatVersion>(5),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.vDetachedRoots),\n\t\tbrand<SharedTreeChangeFormatVersion>(101),\n\t],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.vSharedBranches),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v6),\n\t\tbrand<SharedTreeChangeFormatVersion>(5),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.vDetachedRoots),\n\t\tbrand<SharedTreeChangeFormatVersion>(101),\n\t],\n]);\n\nfunction getCodecTreeForEditManagerFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForEditManager.lookup(\n\t\tclientVersionToEditManagerFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForMessage.lookup(\n\t\tclientVersionToMessageFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tchildren.push(getCodecTreeForForestFormat(clientVersion));\n\tchildren.push(schemaCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));\n\tchildren.push(getCodecTreeForEditManagerFormat(clientVersion));\n\tchildren.push(getCodecTreeForMessageFormat(clientVersion));\n\tchildren.push(getCodecTreeForFieldBatchFormat(clientVersion));\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion: undefined, // SharedTree does not have a version of its own.\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions;\n\n/**\n * Configuration options for SharedTree with alpha features.\n * @alpha @input\n */\nexport interface SharedTreeOptions\n\textends SharedTreeOptionsBeta,\n\t\tPartial<CodecWriteOptions>,\n\t\tPartial<SharedTreeFormatOptions> {\n\t/**\n\t * Experimental feature flag to enable shared branches.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableSharedBranches?: boolean;\n\t/**\n\t * Experimental feature flag to enable the ability to edit detached roots.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableDetachedRootEditing?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n\nexport interface SharedTreeOptionsInternal\n\textends SharedTreeOptions,\n\t\tPartial<SharedTreeCoreOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n}\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n\teditManagerFormatSelector: clientVersionToEditManagerFormatVersion,\n\tmessageFormatSelector: clientVersionToMessageFormatVersion,\n\tenableSharedBranches: false,\n\twriteVersionOverrides: new Map(),\n\tallowPossiblyIncompatibleWriteVersionOverrides: false,\n\tenableDetachedRootEditing: false,\n\tcanMakeDetachedRootEdits: false,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes<SchemaType.Stored>> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes<SchemaType.Stored>>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(\n\tschema: TreeFieldStoredSchema,\n): SimpleFieldSchema<SchemaType.Stored> {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier: {\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.forbidden.identifier: {\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tfail(0xaca /* invalid field kind */);\n\t\t}\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`\n * field on SimpleNodeSchema is not persisted.\n */\nfunction exportSimpleNodeSchemaStored(\n\tschema: TreeNodeStoredSchema,\n): SimpleNodeSchema<SchemaType.Stored> {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema<SchemaType.Stored>>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn {\n\t\t\tkind: NodeKind.Object,\n\t\t\tfields,\n\t\t\tallowUnknownOptionalFields: undefined,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
|
|
@@ -13,7 +13,7 @@ interface ChangeFormatDependencies {
|
|
|
13
13
|
readonly modularChange: ModularChangeFormatVersion;
|
|
14
14
|
readonly schemaChange: SchemaFormatVersion;
|
|
15
15
|
}
|
|
16
|
-
export type SharedTreeChangeFormatVersion = Brand<3 | 4, "SharedTreeChangeFormatVersion">;
|
|
16
|
+
export type SharedTreeChangeFormatVersion = Brand<3 | 4 | 5 | 101, "SharedTreeChangeFormatVersion">;
|
|
17
17
|
/**
|
|
18
18
|
* Defines for each SharedTree change format the corresponding dependent formats to use.
|
|
19
19
|
* This is an arbitrary mapping that is injected in the SharedTree change codec.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeChangeCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAGtB,KAAK,YAAY,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,qBAAqB,EAC1B,mBAAmB,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAMrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,KAAK,EAGV,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAE1F,wBAAgB,+BAA+B,CAC9C,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC/E,OAAO,EAAE,iBAAiB,GACxB,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAqBvD;AAED,UAAU,wBAAwB;IACjC,QAAQ,CAAC,aAAa,EAAE,0BAA0B,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC3C;AAED,MAAM,MAAM,6BAA6B,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3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