@fluidframework/tree 2.74.0-370705 → 2.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +1 -16
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +29 -0
- package/api-report/tree.alpha.api.md +39 -17
- package/assertTagging.config.mjs +1 -1
- package/dist/alpha.d.ts +7 -0
- package/dist/codec/codec.d.ts +63 -20
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +50 -24
- 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 +1 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/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 +5 -8
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +37 -8
- 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 +1 -3
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +27 -5
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +1 -16
- 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 +10 -28
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +4 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +5 -5
- 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 +3 -4
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +1 -8
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +12 -65
- 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/detachedFieldIndexFormatCommon.d.ts +4 -4
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -2
- package/dist/core/tree/detachedFieldIndexFormatCommon.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 +4 -5
- 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 +3 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +2 -14
- 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/feature-libraries/changeAtomIdBTree.d.ts +10 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.js +16 -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 +1 -8
- 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 +1 -4
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -6
- 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 +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/format.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 +54 -93
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +81 -245
- 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 +6 -5
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -2
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -5
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +8 -7
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +6 -15
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts +0 -1
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +1 -6
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +0 -9
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +0 -6
- 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 +7 -8
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +16 -47
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +8 -2
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +13 -11
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +18 -9
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/{format.js → formatCommon.js} +9 -6
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -0
- package/dist/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV1.js +11 -0
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +51 -0
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/formatV2.js +11 -0
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +1 -2
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +3 -5
- package/dist/feature-libraries/forest-summary/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.js +43 -0
- package/dist/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js +14 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.js +21 -0
- package/dist/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js +23 -45
- package/dist/feature-libraries/forest-summary/summaryTypes.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 +10 -12
- 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 +0 -1
- 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 +13 -10
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +7 -4
- 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 +52 -20
- 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 +13 -7
- package/dist/feature-libraries/modular-schema/genericFieldKind.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 +7 -7
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +41 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +263 -336
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +7 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +8 -390
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +24 -11
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +27 -55
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +622 -1433
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +3 -4
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +14 -48
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +10 -21
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +18 -48
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -24
- 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.js +4 -4
- 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 +2 -1
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +26 -5
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +447 -218
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
- 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 +28 -57
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- 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 +15 -4
- 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/formatV1.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +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 +7 -6
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +264 -84
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
- 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 +3 -2
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +3 -1
- 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 +169 -66
- 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 +56 -4
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +93 -8
- 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 +127 -113
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +50 -0
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
- 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 +49 -27
- 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 +2 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +187 -358
- 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 +62 -20
- 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 +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +115 -17
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +59 -30
- 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 +24 -15
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +334 -127
- 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 +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -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/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -1
- package/dist/shared-tree/independentView.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 +1 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +9 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +56 -41
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -9
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +57 -50
- 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 +11 -11
- 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 +23 -24
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +7 -14
- 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 +17 -12
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +85 -66
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +5 -4
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +7 -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 +10 -10
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +0 -4
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +13 -16
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +9 -44
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +8 -8
- 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 +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +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 +3 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +2 -3
- 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 +0 -4
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +15 -19
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +10 -50
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +9 -8
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +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 +0 -1
- 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/shared-tree-core/versionedSummarizer.d.ts +6 -1
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +4 -3
- package/dist/shared-tree-core/versionedSummarizer.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/eraseSchemaDetails.d.ts +89 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js +97 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +5 -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/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 +15 -11
- 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/storedSchema.d.ts +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +3 -5
- 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 +15 -2
- 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/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -0
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +6 -3
- 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 +28 -74
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +1 -1
- package/dist/simple-tree/createContext.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 +5 -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 +18 -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.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +4 -7
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +47 -54
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +125 -183
- 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 +12 -8
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +11 -29
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +3 -14
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +2 -2
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +2 -12
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.js +1 -1
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.d.ts +49 -0
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +47 -1
- package/dist/util/brand.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 +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +1 -1
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/rangeMap.d.ts +12 -24
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +6 -46
- 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/main/sequence-field/move-composition.md +46 -0
- package/eslint.config.mts +83 -0
- package/lib/alpha.d.ts +7 -0
- package/lib/codec/codec.d.ts +63 -20
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +44 -18
- 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 +1 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/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 +37 -8
- 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 +27 -5
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +0 -13
- 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 +10 -28
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +4 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +6 -6
- 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 +3 -4
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +1 -8
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +14 -67
- 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/detachedFieldIndexFormatCommon.d.ts +4 -4
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +3 -3
- package/lib/core/tree/detachedFieldIndexFormatCommon.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 +3 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +1 -12
- 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/feature-libraries/changeAtomIdBTree.d.ts +10 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.js +11 -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 +2 -9
- 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 +1 -4
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -6
- 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 +20 -12
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +5 -5
- package/lib/feature-libraries/chunked-forest/codec/format.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 +54 -93
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +82 -243
- 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 +6 -5
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -2
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -2
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +8 -7
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +6 -15
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts +0 -1
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +1 -5
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +0 -9
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +0 -6
- 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 +7 -8
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +17 -48
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +8 -2
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +12 -11
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +19 -10
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/{format.js → formatCommon.js} +8 -6
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -0
- package/lib/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV1.js +8 -0
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +51 -0
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/formatV2.js +8 -0
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +1 -2
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +1 -2
- package/lib/feature-libraries/forest-summary/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.js +40 -0
- package/lib/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js +11 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.js +18 -0
- package/lib/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.js +20 -43
- package/lib/feature-libraries/forest-summary/summaryTypes.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 +1 -2
- 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 +13 -10
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +5 -3
- 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 +52 -20
- 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 +14 -8
- package/lib/feature-libraries/modular-schema/genericFieldKind.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 -4
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +41 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +248 -334
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +7 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +10 -392
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +24 -11
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +27 -55
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +549 -1352
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +3 -4
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +14 -48
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +10 -21
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +18 -48
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +2 -20
- 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.js +4 -4
- 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 +26 -5
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +445 -218
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
- 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 +26 -55
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- 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 +16 -5
- 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 +29 -67
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +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 +7 -6
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +266 -86
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
- 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 +3 -2
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +1 -0
- 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 +171 -68
- 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 +56 -4
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +87 -7
- 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 +129 -115
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +46 -0
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
- 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 +50 -28
- 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 +2 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +183 -350
- 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 +63 -21
- 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 +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +115 -17
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +59 -30
- 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 +24 -15
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +327 -123
- 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 +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -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/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +2 -2
- package/lib/shared-tree/independentView.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 +2 -3
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +9 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +59 -44
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -9
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +26 -19
- 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 +11 -11
- 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 +24 -25
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +6 -12
- 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 +17 -12
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +89 -70
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +5 -4
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +7 -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 +10 -10
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +0 -4
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +13 -15
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +9 -44
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +9 -9
- 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 +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +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 +3 -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 +0 -4
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +15 -18
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +10 -50
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +9 -8
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +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 +0 -1
- 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/shared-tree-core/versionedSummarizer.d.ts +6 -1
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +4 -3
- package/lib/shared-tree-core/versionedSummarizer.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/eraseSchemaDetails.d.ts +89 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js +92 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- 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/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 +15 -11
- 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/storedSchema.d.ts +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +5 -9
- 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 +15 -2
- 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/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -0
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +6 -3
- 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 +28 -73
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +1 -1
- package/lib/simple-tree/createContext.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 +19 -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.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +4 -7
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +47 -54
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +124 -183
- 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 +12 -8
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +9 -26
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +3 -14
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +3 -3
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +3 -13
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.js +1 -1
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/brand.d.ts +49 -0
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +44 -0
- package/lib/util/brand.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 +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +1 -1
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/rangeMap.d.ts +12 -24
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +5 -44
- 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 -32
- package/src/codec/codec.ts +82 -26
- 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 +0 -5
- package/src/core/change-family/index.ts +0 -1
- package/src/core/index.ts +4 -6
- package/src/core/rebase/changeRebaser.ts +41 -12
- package/src/core/rebase/index.ts +2 -2
- package/src/core/rebase/types.ts +32 -26
- package/src/core/rebase/utils.ts +10 -34
- package/src/core/schema-stored/schema.ts +8 -10
- package/src/core/tree/anchorSet.ts +3 -4
- package/src/core/tree/detachedFieldIndex.ts +14 -91
- 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/detachedFieldIndexFormatCommon.ts +4 -7
- package/src/core/tree/index.ts +2 -3
- package/src/core/tree/mapTree.ts +1 -1
- package/src/core/tree/pathTree.ts +4 -16
- package/src/core/tree/sparseTree.ts +1 -0
- package/src/core/tree/treeTextFormat.ts +5 -9
- package/src/feature-libraries/changeAtomIdBTree.ts +24 -0
- package/src/feature-libraries/chunked-forest/basicChunk.ts +2 -8
- package/src/feature-libraries/chunked-forest/chunkTree.ts +1 -6
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +5 -5
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +7 -4
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +20 -11
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
- package/src/feature-libraries/chunked-forest/codec/format.ts +6 -9
- 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 +163 -403
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +9 -7
- package/src/feature-libraries/default-schema/index.ts +5 -17
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +15 -35
- package/src/feature-libraries/deltaUtils.ts +1 -6
- package/src/feature-libraries/flex-tree/context.ts +0 -17
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -7
- package/src/feature-libraries/flex-tree/lazyField.ts +31 -74
- package/src/feature-libraries/forest-summary/codec.ts +25 -13
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +37 -12
- package/src/feature-libraries/forest-summary/{format.ts → formatCommon.ts} +10 -11
- package/src/feature-libraries/forest-summary/formatV1.ts +12 -0
- package/src/feature-libraries/forest-summary/formatV2.ts +12 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +18 -21
- package/src/feature-libraries/forest-summary/index.ts +1 -2
- package/src/feature-libraries/forest-summary/summaryFormatCommon.ts +41 -0
- package/src/feature-libraries/forest-summary/summaryFormatV1ToV2.ts +11 -0
- package/src/feature-libraries/forest-summary/summaryFormatV3.ts +18 -0
- package/src/feature-libraries/forest-summary/summaryTypes.ts +26 -46
- package/src/feature-libraries/index.ts +18 -27
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +5 -5
- package/src/feature-libraries/mapTreeCursor.ts +1 -2
- package/src/feature-libraries/mitigatedChangeFamily.ts +12 -9
- package/src/feature-libraries/modular-schema/comparison.ts +14 -10
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +44 -142
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +70 -0
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +58 -40
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +23 -13
- package/src/feature-libraries/modular-schema/index.ts +18 -21
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +543 -572
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +44 -745
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +37 -51
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +862 -2636
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +3 -4
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +17 -45
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +18 -97
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +1 -1
- package/src/feature-libraries/object-forest/objectForest.ts +4 -4
- package/src/feature-libraries/optional-field/index.ts +3 -1
- package/src/feature-libraries/optional-field/optionalField.ts +566 -321
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +38 -24
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +35 -89
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +19 -5
- package/src/feature-libraries/schema-index/codec.ts +30 -92
- 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 +527 -138
- package/src/feature-libraries/sequence-field/helperTypes.ts +19 -34
- package/src/feature-libraries/sequence-field/index.ts +9 -0
- package/src/feature-libraries/sequence-field/invert.ts +229 -103
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +198 -9
- package/src/feature-libraries/sequence-field/rebase.ts +218 -175
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +57 -0
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +76 -59
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -0
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +228 -643
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +70 -56
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +27 -25
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +135 -22
- package/src/feature-libraries/sequence-field/types.ts +64 -34
- package/src/feature-libraries/sequence-field/utils.ts +382 -150
- 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 +7 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +1 -2
- package/src/shared-tree/index.ts +2 -3
- package/src/shared-tree/schematizeTree.ts +8 -21
- package/src/shared-tree/schematizingTreeView.ts +96 -63
- package/src/shared-tree/sharedTree.ts +29 -29
- package/src/shared-tree/sharedTreeChangeCodecs.ts +12 -15
- package/src/shared-tree/sharedTreeChangeEnricher.ts +4 -4
- package/src/shared-tree/sharedTreeChangeFamily.ts +34 -34
- package/src/shared-tree/sharedTreeEditBuilder.ts +9 -39
- package/src/shared-tree/treeAlpha.ts +60 -51
- package/src/shared-tree/treeCheckout.ts +158 -132
- package/src/shared-tree-core/branch.ts +10 -11
- package/src/shared-tree-core/branchCommitEnricher.ts +3 -8
- package/src/shared-tree-core/editManager.ts +3 -17
- package/src/shared-tree-core/editManagerCodecs.ts +13 -18
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +1 -1
- package/src/shared-tree-core/editManagerFormatCommons.ts +12 -15
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
- package/src/shared-tree-core/index.ts +3 -2
- package/src/shared-tree-core/messageCodecV1ToV4.ts +1 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +15 -21
- package/src/shared-tree-core/messageFormat.ts +12 -15
- package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -2
- package/src/shared-tree-core/sequenceIdUtils.ts +4 -4
- package/src/shared-tree-core/sharedTreeCore.ts +12 -11
- package/src/shared-tree-core/transaction.ts +115 -56
- package/src/shared-tree-core/transactionEnricher.ts +5 -6
- package/src/shared-tree-core/versionedSummarizer.ts +10 -3
- 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/eraseSchemaDetails.ts +123 -0
- package/src/simple-tree/api/index.ts +6 -0
- package/src/simple-tree/api/schemaFactory.ts +11 -7
- 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 +17 -13
- package/src/simple-tree/api/simpleTreeIndex.ts +8 -8
- package/src/simple-tree/api/storedSchema.ts +12 -9
- package/src/simple-tree/api/transactionTypes.ts +19 -4
- package/src/simple-tree/api/tree.ts +16 -1
- package/src/simple-tree/api/treeNodeApi.ts +21 -13
- package/src/simple-tree/api/verboseTree.ts +14 -9
- package/src/simple-tree/core/treeNode.ts +1 -0
- package/src/simple-tree/core/treeNodeKernel.ts +6 -3
- package/src/simple-tree/core/unhydratedFlexTree.ts +58 -104
- package/src/simple-tree/createContext.ts +4 -1
- package/src/simple-tree/fieldSchema.ts +4 -6
- package/src/simple-tree/getTreeNodeForField.ts +2 -1
- package/src/simple-tree/index.ts +5 -2
- package/src/simple-tree/leafNodeSchema.ts +8 -5
- package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -30
- package/src/simple-tree/node-kinds/common.ts +5 -2
- package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
- package/src/simple-tree/node-kinds/object/objectNode.ts +28 -29
- package/src/simple-tree/node-kinds/record/recordNode.ts +11 -13
- package/src/simple-tree/prepareForInsertion.ts +200 -343
- package/src/simple-tree/toStoredSchema.ts +12 -8
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +14 -42
- package/src/tableSchema.ts +13 -18
- package/src/treeFactory.ts +5 -14
- package/src/util/bTreeUtils.ts +1 -1
- package/src/util/brand.ts +61 -0
- package/src/util/breakable.ts +9 -9
- package/src/util/idAllocator.ts +1 -2
- package/src/util/index.ts +3 -3
- package/src/util/nestedMap.ts +1 -3
- package/src/util/rangeMap.ts +18 -72
- package/src/util/utils.ts +14 -13
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -126
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
- package/dist/feature-libraries/forest-summary/format.d.ts.map +0 -1
- package/dist/feature-libraries/forest-summary/format.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -31
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -57
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -122
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
- package/lib/feature-libraries/forest-summary/format.d.ts.map +0 -1
- package/lib/feature-libraries/forest-summary/format.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -27
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -53
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +0 -180
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +0 -45
- package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +0 -94
|
@@ -67,8 +67,9 @@ export const treeNodeApi = {
|
|
|
67
67
|
case "treeChanged": {
|
|
68
68
|
return kernel.events.on("subtreeChangedAfterBatch", () => listener({}));
|
|
69
69
|
}
|
|
70
|
-
default:
|
|
70
|
+
default: {
|
|
71
71
|
throw new UsageError(`No event named ${JSON.stringify(eventName)}.`);
|
|
72
|
+
}
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
status(node) {
|
|
@@ -97,12 +98,15 @@ export const treeNodeApi = {
|
|
|
97
98
|
*/
|
|
98
99
|
export function tryGetSchema(value) {
|
|
99
100
|
switch (typeof value) {
|
|
100
|
-
case "string":
|
|
101
|
+
case "string": {
|
|
101
102
|
return stringSchema;
|
|
102
|
-
|
|
103
|
+
}
|
|
104
|
+
case "number": {
|
|
103
105
|
return numberSchema;
|
|
104
|
-
|
|
106
|
+
}
|
|
107
|
+
case "boolean": {
|
|
105
108
|
return booleanSchema;
|
|
109
|
+
}
|
|
106
110
|
case "object": {
|
|
107
111
|
if (isTreeNode(value)) {
|
|
108
112
|
// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.
|
|
@@ -115,8 +119,9 @@ export function tryGetSchema(value) {
|
|
|
115
119
|
return handleSchema;
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
|
-
default:
|
|
122
|
+
default: {
|
|
119
123
|
return undefined;
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
127
|
export function getIdentifierFromNode(node, compression) {
|
|
@@ -127,8 +132,9 @@ export function getIdentifierFromNode(node, compression) {
|
|
|
127
132
|
const flexNode = getInnerNode(node);
|
|
128
133
|
const identifierFieldKeys = schema.identifierFieldKeys;
|
|
129
134
|
switch (identifierFieldKeys.length) {
|
|
130
|
-
case 0:
|
|
135
|
+
case 0: {
|
|
131
136
|
return undefined;
|
|
137
|
+
}
|
|
132
138
|
case 1: {
|
|
133
139
|
const key = identifierFieldKeys[0] ?? oob();
|
|
134
140
|
const identifierField = flexNode.tryGetField(key);
|
|
@@ -140,9 +146,9 @@ export function getIdentifierFromNode(node, compression) {
|
|
|
140
146
|
case "preferCompressed": {
|
|
141
147
|
if (context.isHydrated()) {
|
|
142
148
|
const localNodeKey = context.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);
|
|
143
|
-
return localNodeKey
|
|
144
|
-
?
|
|
145
|
-
:
|
|
149
|
+
return localNodeKey === undefined
|
|
150
|
+
? identifierValue
|
|
151
|
+
: extractFromOpaque(localNodeKey);
|
|
146
152
|
}
|
|
147
153
|
else {
|
|
148
154
|
return identifierValue;
|
|
@@ -151,7 +157,7 @@ export function getIdentifierFromNode(node, compression) {
|
|
|
151
157
|
case "compressed": {
|
|
152
158
|
if (context.isHydrated()) {
|
|
153
159
|
const localNodeKey = context.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);
|
|
154
|
-
return localNodeKey
|
|
160
|
+
return localNodeKey === undefined ? undefined : extractFromOpaque(localNodeKey);
|
|
155
161
|
}
|
|
156
162
|
else {
|
|
157
163
|
return undefined;
|
|
@@ -160,12 +166,14 @@ export function getIdentifierFromNode(node, compression) {
|
|
|
160
166
|
case "uncompressed": {
|
|
161
167
|
return identifierValue;
|
|
162
168
|
}
|
|
163
|
-
default:
|
|
169
|
+
default: {
|
|
164
170
|
unreachableCase(compression);
|
|
171
|
+
}
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
|
-
default:
|
|
168
|
-
throw new UsageError("
|
|
174
|
+
default: {
|
|
175
|
+
throw new UsageError("The node has more than one identifier. Retrieve identifiers individually via their fields instead.");
|
|
176
|
+
}
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
179
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,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yright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport { type ImplicitFieldSchema, FieldSchema } from \"../fieldSchema.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype TreeLeafValue,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../core/index.js\";\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport { tryGetTreeNodeForField } from \"../getTreeNodeForField.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t *\n\t * @see {@link (TreeAlpha:interface).child}\n\t * @see {@link (TreeAlpha:interface).children}\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).evaluateSet().has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0:\n\t\t\treturn undefined;\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = tryGetTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined\n\t\t\t\t\t\t\t? extractFromOpaque(localNodeKey)\n\t\t\t\t\t\t\t: identifierValue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : undefined;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tthrow new UsageError(\n\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t);\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEzF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAmB,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAA4B,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C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AAM,CAAC,GAAG,KAAK,QAAQ,EACnC,KAAK,CAAC,wDAAwD,CAC9D,CAAC;QACF,OAAO,WAAW,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,6GAA6G;IAC7G,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK,CAAC,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC5F,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAC1C,MAAsB,EACtB,SAA0B;IAE1B,iHAAiH;IACjH,gFAAgF;IAChF,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAA2C,CAAC;IAElE,cAAc;IACd,iEAAiE;IACjE,uGAAuG;IACvG,6IAA6I;IAC7I,iEAAiE;IACjE,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,WAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport { type ImplicitFieldSchema, FieldSchema } from \"../fieldSchema.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype TreeLeafValue,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../core/index.js\";\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport { tryGetTreeNodeForField } from \"../getTreeNodeForField.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t *\n\t * @see {@link (TreeAlpha:interface).child}\n\t * @see {@link (TreeAlpha:interface).children}\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t\t}\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).evaluateSet().has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\": {\n\t\t\treturn stringSchema;\n\t\t}\n\t\tcase \"number\": {\n\t\t\treturn numberSchema;\n\t\t}\n\t\tcase \"boolean\": {\n\t\t\treturn booleanSchema;\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0: {\n\t\t\treturn undefined;\n\t\t}\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = tryGetTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined\n\t\t\t\t\t\t\t? identifierValue\n\t\t\t\t\t\t\t: extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey === undefined ? undefined : extractFromOpaque(localNodeKey);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The node has more than one identifier. Retrieve identifiers individually via their fields instead.\",\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verboseTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,EAMN,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AAe/E,OAAO,EAMN,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,YAAY,IAC3C,eAAe,CAAC,OAAO,CAAC,GACxB,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,GACpC,OAAO,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,YAAY;IACtD;;;;;;OAMG;IACH,IAAI,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tD;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,MAAM,EACH,WAAW,CAAC,OAAO,CAAC,EAAE,GACtB;QACA,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;KACnC,CAAC;CACL;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,mBAAmB,GAC1B,sBAAsB,CAoDxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,sBAAsB,GAC7B,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,WAAW,EAAE,EACnB,OAAO,EAAE,sBAAsB,GAC7B,sBAAsB,CAMxB;AAsFD;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,mBAAmB,GAC1B,WAAW,CAUb;AA2BD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAC1C,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,WAAW,CAAC,CAAC,CAAC,CAEhB"}
|
|
@@ -22,9 +22,8 @@ export function applySchemaToParserOptions(schema, options) {
|
|
|
22
22
|
};
|
|
23
23
|
const context = getUnhydratedContext(schema);
|
|
24
24
|
return {
|
|
25
|
-
keyConverter: config.keys
|
|
26
|
-
?
|
|
27
|
-
: {
|
|
25
|
+
keyConverter: config.keys === KeyEncodingOptions.usePropertyKeys
|
|
26
|
+
? {
|
|
28
27
|
encode: (type, key) => {
|
|
29
28
|
// translate stored key into property key.
|
|
30
29
|
const simpleNodeSchema = context.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);
|
|
@@ -55,7 +54,8 @@ export function applySchemaToParserOptions(schema, options) {
|
|
|
55
54
|
}
|
|
56
55
|
return brand(inputKey);
|
|
57
56
|
},
|
|
58
|
-
}
|
|
57
|
+
}
|
|
58
|
+
: undefined,
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -81,13 +81,16 @@ function verboseTreeAdapter(options) {
|
|
|
81
81
|
},
|
|
82
82
|
type: (node) => {
|
|
83
83
|
switch (typeof node) {
|
|
84
|
-
case "number":
|
|
84
|
+
case "number": {
|
|
85
85
|
return brand(numberSchema.identifier);
|
|
86
|
-
|
|
86
|
+
}
|
|
87
|
+
case "string": {
|
|
87
88
|
return brand(stringSchema.identifier);
|
|
88
|
-
|
|
89
|
+
}
|
|
90
|
+
case "boolean": {
|
|
89
91
|
return brand(booleanSchema.identifier);
|
|
90
|
-
|
|
92
|
+
}
|
|
93
|
+
default: {
|
|
91
94
|
if (node === null) {
|
|
92
95
|
return brand(nullSchema.identifier);
|
|
93
96
|
}
|
|
@@ -95,6 +98,7 @@ function verboseTreeAdapter(options) {
|
|
|
95
98
|
return brand(handleSchema.identifier);
|
|
96
99
|
}
|
|
97
100
|
return brand(node.type);
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
},
|
|
100
104
|
keysFromNode: (node) => {
|
|
@@ -116,8 +120,9 @@ function verboseTreeAdapter(options) {
|
|
|
116
120
|
}
|
|
117
121
|
return inputKeys.map((k) => converter.parse(node.type, k));
|
|
118
122
|
}
|
|
119
|
-
default:
|
|
123
|
+
default: {
|
|
120
124
|
return [];
|
|
125
|
+
}
|
|
121
126
|
}
|
|
122
127
|
},
|
|
123
128
|
getFieldFromNode: (node, key) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAA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AC,uCAAuC,CAAC,CAAC;IACtF,IAAI,UAAU,YAAY,oBAAoB,EAAE,CAAC;QAChD,OAAO,MAAuB,CAAC;IAChC,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAqC;KAC7C,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAiB,EACjB,QAA4B;IAE5B,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAmB,CAAC;AACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tkeyAsDetachedField,\n\tLeafNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { Context, TreeLeafValue, TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport {\n\tcustomFromCursor,\n\tKeyEncodingOptions,\n\treplaceHandles,\n\tunknownTypeError,\n\ttype CustomTreeNode,\n\ttype HandleConverter,\n\ttype SchemalessParseOptions,\n\ttype TreeEncodingOptions,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)\n * replicating the behavior of simple-tree ArrayNodes.\n * @alpha\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions(\n\tschema: ImplicitFieldSchema,\n\toptions: TreeEncodingOptions,\n): SchemalessParseOptions {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tkeys: KeyEncodingOptions.usePropertyKeys,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tkeyConverter:\n\t\t\tconfig.keys !== KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);\n\t\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn key;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? unknownTypeError(type);\n\t\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\t\tconst info = simpleNodeSchema.flexKeyMap.get(inputKey);\n\t\t\t\t\t\t\t\tif (info === undefined) {\n\t\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\t`Failed to parse VerboseTree due to unexpected key ${JSON.stringify(inputKey)} on type ${JSON.stringify(type)}.`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose(\n\tdata: VerboseTree,\n\toptions: SchemalessParseOptions,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose(\n\tdata: VerboseTree[],\n\toptions: SchemalessParseOptions,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter(options: SchemalessParseOptions): CursorAdapter<VerboseTree> {\n\treturn {\n\t\tvalue: (node: VerboseTree) => {\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (node: VerboseTree) => {\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn brand(numberSchema.identifier);\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn brand(stringSchema.identifier);\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn brand(booleanSchema.identifier);\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn brand(nullSchema.identifier);\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn brand(handleSchema.identifier);\n\t\t\t\t\t}\n\t\t\t\t\treturn brand(node.type);\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (node: VerboseTree): readonly FieldKey[] => {\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (node: VerboseTree, key: FieldKey): readonly VerboseTree[] => {\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor(\n\treader: ITreeCursor,\n\tcontext: Context,\n\toptions: TreeEncodingOptions,\n): VerboseTree {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tkeys: KeyEncodingOptions.usePropertyKeys,\n\t\t...options,\n\t};\n\n\tconst storedSchemaMap = context.flexContext.schema.nodeSchema;\n\tconst schemaMap = context.schema;\n\n\treturn verboseFromCursorInner(reader, config, storedSchemaMap, schemaMap);\n}\n\nfunction verboseFromCursorInner(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tstoredSchema: ReadonlyMap<string, TreeNodeStoredSchema>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree {\n\tconst fields = customFromCursor(\n\t\treader,\n\t\toptions,\n\t\tstoredSchema,\n\t\tschema,\n\t\tverboseFromCursorInner,\n\t);\n\tconst nodeSchema =\n\t\tstoredSchema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as TreeLeafValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<VerboseTree>,\n\t};\n}\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * A strongly types version of {@link replaceHandles}.\n * @alpha\n */\nexport function replaceVerboseTreeHandles<T>(\n\ttree: VerboseTree,\n\treplacer: HandleConverter<T>,\n): VerboseTree<T> {\n\treturn replaceHandles(tree, replacer) as VerboseTree<T>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,GAKpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EACN,WAAW,EACX,oBAAoB,EACpB,mBAAmB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GAKhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAkE3D;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,MAA2B,EAC3B,OAA4B;IAE5B,MAAM,MAAM,GAAkC;QAC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AAE,CAAC;QACX,CAAC;KACD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAChC,MAAmB,EACnB,OAAgB,EAChB,OAA4B;IAE5B,MAAM,MAAM,GAAkC;QAC7C,IAAI,EAAE,kBAAkB,CAAC,eAAe;QACxC,GAAG,OAAO;KACV,CAAC;IAEF,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC;IAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAEjC,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,sBAAsB,CAC9B,MAAmB,EACnB,OAAsC,EACtC,YAAuD,EACvD,MAA2C;IAE3C,MAAM,MAAM,GAAG,gBAAgB,CAC9B,MAAM,EACN,OAAO,EACP,YAAY,EACZ,MAAM,EACN,sBAAsB,CACtB,CAAC;IACF,MAAM,UAAU,GACf,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACtF,IAAI,UAAU,YAAY,oBAAoB,EAAE,CAAC;QAChD,OAAO,MAAuB,CAAC;IAChC,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAqC;KAC7C,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAiB,EACjB,QAA4B;IAE5B,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAmB,CAAC;AACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tkeyAsDetachedField,\n\tLeafNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { Context, TreeLeafValue, TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport {\n\tcustomFromCursor,\n\tKeyEncodingOptions,\n\treplaceHandles,\n\tunknownTypeError,\n\ttype CustomTreeNode,\n\ttype HandleConverter,\n\ttype SchemalessParseOptions,\n\ttype TreeEncodingOptions,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)\n * replicating the behavior of simple-tree ArrayNodes.\n * @alpha\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions(\n\tschema: ImplicitFieldSchema,\n\toptions: TreeEncodingOptions,\n): SchemalessParseOptions {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tkeys: KeyEncodingOptions.usePropertyKeys,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tkeyConverter:\n\t\t\tconfig.keys === KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? {\n\t\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);\n\t\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn key;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? unknownTypeError(type);\n\t\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\t\tconst info = simpleNodeSchema.flexKeyMap.get(inputKey);\n\t\t\t\t\t\t\t\tif (info === undefined) {\n\t\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t\t`Failed to parse VerboseTree due to unexpected key ${JSON.stringify(inputKey)} on type ${JSON.stringify(type)}.`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose(\n\tdata: VerboseTree,\n\toptions: SchemalessParseOptions,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose(\n\tdata: VerboseTree[],\n\toptions: SchemalessParseOptions,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter(options: SchemalessParseOptions): CursorAdapter<VerboseTree> {\n\treturn {\n\t\tvalue: (node: VerboseTree) => {\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (node: VerboseTree) => {\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\": {\n\t\t\t\t\treturn brand(numberSchema.identifier);\n\t\t\t\t}\n\t\t\t\tcase \"string\": {\n\t\t\t\t\treturn brand(stringSchema.identifier);\n\t\t\t\t}\n\t\t\t\tcase \"boolean\": {\n\t\t\t\t\treturn brand(booleanSchema.identifier);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn brand(nullSchema.identifier);\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn brand(handleSchema.identifier);\n\t\t\t\t\t}\n\t\t\t\t\treturn brand(node.type);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (node: VerboseTree): readonly FieldKey[] => {\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (node: VerboseTree, key: FieldKey): readonly VerboseTree[] => {\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor(\n\treader: ITreeCursor,\n\tcontext: Context,\n\toptions: TreeEncodingOptions,\n): VerboseTree {\n\tconst config: Required<TreeEncodingOptions> = {\n\t\tkeys: KeyEncodingOptions.usePropertyKeys,\n\t\t...options,\n\t};\n\n\tconst storedSchemaMap = context.flexContext.schema.nodeSchema;\n\tconst schemaMap = context.schema;\n\n\treturn verboseFromCursorInner(reader, config, storedSchemaMap, schemaMap);\n}\n\nfunction verboseFromCursorInner(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tstoredSchema: ReadonlyMap<string, TreeNodeStoredSchema>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree {\n\tconst fields = customFromCursor(\n\t\treader,\n\t\toptions,\n\t\tstoredSchema,\n\t\tschema,\n\t\tverboseFromCursorInner,\n\t);\n\tconst nodeSchema =\n\t\tstoredSchema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as TreeLeafValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<VerboseTree>,\n\t};\n}\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * A strongly types version of {@link replaceHandles}.\n * @alpha\n */\nexport function replaceVerboseTreeHandles<T>(\n\ttree: VerboseTree,\n\treplacer: HandleConverter<T>,\n): VerboseTree<T> {\n\treturn replaceHandles(tree, replacer) as VerboseTree<T>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNode.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNode.ts"],"names":[],"mappings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I,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAS9E"}
|
|
@@ -87,6 +87,7 @@ export class TreeNode {
|
|
|
87
87
|
* someone could manually (or via Intellisense auto-implement completion, or in response to a type error)
|
|
88
88
|
* make an object literal with the [type] field and pass it off as a node: this private brand prevents that.
|
|
89
89
|
*/
|
|
90
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
90
91
|
_TreeNode_brand.set(this, void 0);
|
|
91
92
|
if (token !== privateToken) {
|
|
92
93
|
throw new UsageError("TreeNodes must extend schema classes created by SchemaFactory");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNode.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAA4B,MAAM,qBAAqB,CAAC;AACzE,kDAAkD;AAClD,OAAO,EAAiB,cAAc,EAAyB,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAgB,QAAQ;IAmEtB,MAAM,CAAC,mCAAC,MAAM,CAAC,WAAW,EAAC,CAA8B,KAAc;QAC7E,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,CAAC,WAAW,IAAI,MAAM,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,YAAsB,KAAc;QArFpC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACM,kCAAiB;QA4DzB,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YAC5B,MAAM,IAAI,UAAU,CAAC,+DAA+D,CAAC,CAAC;QACvF,CAAC;IACF,CAAC;CACD;AACD,gJAAgJ;AAChJ,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,kDAAkD;AAClD,MAAM,UAAU,gBAAgB,CAAC,OAAsB,EAAE,IAAY;IACpE,IAAI,QAAQ,GAAG,OAAO,CAAC;IACvB,OAAO,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import-x/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes extend.\n *\n * This type can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * There are three ways to get instances of TreeNode:\n *\n * 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.\n * This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.\n *\n * 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.\n * Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.\n * There are also higher level APIs which wrap these, including {@link (TreeBeta:interface).create}, {@link (TreeBeta:interface).clone},\n * and import APIs like {@link (TreeBeta:interface).importConcise}, {@link (TreeAlpha:interface).importVerbose}, and {@link (TreeAlpha:interface).importCompressed}.\n *\n * 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.\n * These APIs internally call the constructor with the provided value (typically behaving like {@link (TreeAlpha:interface).create}), so it's really just a special case of the above option.\n * Note that when constructing nodes, sometimes implicit construction is not allowed\n * (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):\n * in such cases, explicit construction must be used.\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import-x/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNode);\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeNode.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNode.ts"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,MAAM,UAAU,gBAAgB,CAAC,OAAsB,EAAE,IAAY;IACpE,IAAI,QAAQ,GAAG,OAAO,CAAC;IACvB,OAAO,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import-x/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes extend.\n *\n * This type can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * There are three ways to get instances of TreeNode:\n *\n * 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.\n * This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.\n *\n * 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.\n * Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.\n * There are also higher level APIs which wrap these, including {@link (TreeBeta:interface).create}, {@link (TreeBeta:interface).clone},\n * and import APIs like {@link (TreeBeta:interface).importConcise}, {@link (TreeAlpha:interface).importVerbose}, and {@link (TreeAlpha:interface).importCompressed}.\n *\n * 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.\n * These APIs internally call the constructor with the provided value (typically behaving like {@link (TreeAlpha:interface).create}), so it's really just a special case of the above option.\n * Note that when constructing nodes, sometimes implicit construction is not allowed\n * (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):\n * in such cases, explicit construction must be used.\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\t// eslint-disable-next-line no-unused-private-class-members\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import-x/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNode);\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeKernel.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAgB,UAAU,EAAO,MAAM,0CAA0C,CAAC;AAS9F,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,UAAU,EAEf,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAIN,UAAU,EAEV,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,QA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BAAoB,CAKpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,oDAAyB,CAAC;AAEzD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAO/D;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAGrF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAU3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAG1D;AAmBD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAQ/E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAQlF;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,2DAAgC,CAAC"}
|
|
@@ -370,13 +370,16 @@ class KernelEventBuffer {
|
|
|
370
370
|
_KernelEventBuffer_disposed = new WeakMap(), _KernelEventBuffer_disposeOnFlushListener = new WeakMap(), _KernelEventBuffer_events = new WeakMap(), _KernelEventBuffer_eventSource = new WeakMap(), _KernelEventBuffer_disposeSourceListeners = new WeakMap(), _KernelEventBuffer_childrenChangedBuffer = new WeakMap(), _KernelEventBuffer_subTreeChangedBuffer = new WeakMap(), _KernelEventBuffer_instances = new WeakSet(), _KernelEventBuffer_emit = function _KernelEventBuffer_emit(eventName, arg) {
|
|
371
371
|
__classPrivateFieldGet(this, _KernelEventBuffer_instances, "m", _KernelEventBuffer_assertNotDisposed).call(this);
|
|
372
372
|
switch (eventName) {
|
|
373
|
-
case "childrenChangedAfterBatch":
|
|
373
|
+
case "childrenChangedAfterBatch": {
|
|
374
374
|
assert(arg !== undefined, 0xc50 /* childrenChangedAfterBatch should have arg */);
|
|
375
375
|
return __classPrivateFieldGet(this, _KernelEventBuffer_instances, "m", _KernelEventBuffer_handleChildrenChangedAfterBatch).call(this, arg.changedFields);
|
|
376
|
-
|
|
376
|
+
}
|
|
377
|
+
case "subtreeChangedAfterBatch": {
|
|
377
378
|
return __classPrivateFieldGet(this, _KernelEventBuffer_instances, "m", _KernelEventBuffer_handleSubtreeChangedAfterBatch).call(this);
|
|
378
|
-
|
|
379
|
+
}
|
|
380
|
+
default: {
|
|
379
381
|
unreachableCase(eventName);
|
|
382
|
+
}
|
|
380
383
|
}
|
|
381
384
|
}, _KernelEventBuffer_handleChildrenChangedAfterBatch = function _KernelEventBuffer_handleChildrenChangedAfterBatch(changedFields) {
|
|
382
385
|
if (bufferTreeEvents) {
|