@fluidframework/tree 2.71.0 → 2.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -40
- package/api-report/tree.alpha.api.md +44 -48
- package/api-report/tree.beta.api.md +42 -0
- package/api-report/tree.legacy.beta.api.md +42 -0
- package/dist/alpha.d.ts +12 -8
- package/dist/api.d.ts +6 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2 -11
- package/dist/api.js.map +1 -1
- package/dist/beta.d.ts +7 -0
- package/dist/codec/codec.d.ts +23 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +23 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +7 -2
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +24 -1
- 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 -1
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js +2 -2
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +18 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +6 -7
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +31 -8
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
- package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/external-utilities/typeboxValidator.js +1 -1
- package/dist/external-utilities/typeboxValidator.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.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 +1 -0
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +39 -21
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +13 -4
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -2
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +54 -74
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -3
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -8
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +15 -4
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/format.d.ts +9 -2
- package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/format.js +11 -4
- package/dist/feature-libraries/forest-summary/format.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +3 -1
- package/dist/feature-libraries/forest-summary/index.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +6 -5
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +9 -8
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +1 -2
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +1 -3
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +3 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.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/index.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +24 -18
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
- package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
- package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
- package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
- package/dist/feature-libraries/schemaChecker.js.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +7 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +22 -15
- 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 +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +12 -60
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +68 -159
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +10 -11
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +4 -2
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +42 -18
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +40 -1
- 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 +4 -4
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
- package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +5 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +12 -3
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -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/messageCodecV5.d.ts +2 -1
- package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +49 -21
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +48 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
- package/dist/shared-tree-core/messageFormat.js +53 -0
- package/dist/shared-tree-core/messageFormat.js.map +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +3 -3
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +2 -0
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +10 -0
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +2 -2
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +8 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +13 -4
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
- package/dist/simple-tree/api/simpleSchemaCodec.js +290 -0
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
- package/dist/simple-tree/api/storedSchema.d.ts +2 -2
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +8 -6
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +3 -3
- package/dist/simple-tree/api/tree.js +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
- package/dist/simple-tree/core/allowedTypes.js +2 -2
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +3 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +3 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +12 -5
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +26 -10
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -1
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +1 -2
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +1 -8
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +12 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +14 -50
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +2 -6
- 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 +4 -12
- 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 +3 -7
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +25 -5
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
- package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
- package/dist/simple-tree/toStoredSchema.d.ts +20 -8
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +27 -22
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +22 -52
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +141 -277
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts +3 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +26 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/arrayUtilities.d.ts +45 -0
- package/dist/util/arrayUtilities.d.ts.map +1 -0
- package/dist/util/arrayUtilities.js +76 -0
- package/dist/util/arrayUtilities.js.map +1 -0
- package/dist/util/brand.d.ts +31 -2
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +28 -2
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.d.ts +3 -1
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +8 -2
- package/dist/util/index.js.map +1 -1
- package/lib/alpha.d.ts +12 -8
- package/lib/api.d.ts +6 -2
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +2 -13
- package/lib/api.js.map +1 -1
- package/lib/beta.d.ts +7 -0
- package/lib/codec/codec.d.ts +23 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +23 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- 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 +7 -2
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +22 -0
- 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/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/schema-stored/index.d.ts +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +1 -1
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +18 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +6 -7
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +31 -8
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
- package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/external-utilities/typeboxValidator.js +1 -1
- package/lib/external-utilities/typeboxValidator.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.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 +2 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +42 -23
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +5 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +12 -3
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +56 -76
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -3
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -3
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +16 -5
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/format.d.ts +9 -2
- package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/format.js +9 -2
- package/lib/feature-libraries/forest-summary/format.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +1 -0
- package/lib/feature-libraries/forest-summary/index.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +6 -5
- 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/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +1 -2
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +0 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.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/index.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +26 -20
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
- package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js +2 -2
- package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
- package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js +2 -2
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
- package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
- package/lib/feature-libraries/schemaChecker.js.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +7 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +11 -4
- 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 +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +12 -60
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +70 -161
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +5 -6
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +5 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +1 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +39 -17
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +39 -0
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
- package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +5 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +4 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -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/messageCodecV5.d.ts +2 -1
- package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +46 -20
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +48 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
- package/lib/shared-tree-core/messageFormat.js +50 -0
- package/lib/shared-tree-core/messageFormat.js.map +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +3 -3
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +2 -0
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +10 -0
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +2 -2
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +14 -5
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
- package/lib/simple-tree/api/simpleSchemaCodec.js +262 -0
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
- package/lib/simple-tree/api/storedSchema.d.ts +2 -2
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +5 -3
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +3 -3
- package/lib/simple-tree/api/tree.js +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
- package/lib/simple-tree/core/allowedTypes.js +2 -2
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +3 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +2 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +12 -5
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +25 -9
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -1
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +1 -2
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +2 -9
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +1 -2
- 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 +17 -53
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +5 -9
- 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 +6 -14
- 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 +6 -10
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +25 -5
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
- package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
- package/lib/simple-tree/toStoredSchema.d.ts +20 -8
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +28 -24
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +22 -52
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +143 -279
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts +3 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +23 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/arrayUtilities.d.ts +45 -0
- package/lib/util/arrayUtilities.d.ts.map +1 -0
- package/lib/util/arrayUtilities.js +69 -0
- package/lib/util/arrayUtilities.js.map +1 -0
- package/lib/util/brand.d.ts +31 -2
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +26 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/brandedMap.d.ts +3 -1
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -1
- package/lib/util/index.js.map +1 -1
- package/package.json +24 -24
- package/src/api.ts +22 -11
- package/src/codec/codec.ts +25 -3
- package/src/codec/index.ts +1 -0
- package/src/codec/versioned/codec.ts +40 -2
- package/src/codec/versioned/index.ts +1 -0
- package/src/core/index.ts +1 -2
- package/src/core/schema-stored/index.ts +1 -2
- package/src/core/schema-stored/schema.ts +22 -8
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
- package/src/core/tree/detachedFieldIndexCodecs.ts +40 -11
- package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
- package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
- package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
- package/src/core/tree/index.ts +2 -4
- package/src/external-utilities/typeboxValidator.ts +1 -1
- package/src/feature-libraries/README.md +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +65 -27
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +9 -4
- package/src/feature-libraries/chunked-forest/codec/format.ts +26 -5
- package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
- package/src/feature-libraries/chunked-forest/index.ts +1 -2
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +88 -103
- package/src/feature-libraries/default-schema/index.ts +1 -9
- package/src/feature-libraries/forest-summary/codec.ts +24 -9
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
- package/src/feature-libraries/forest-summary/format.ts +25 -9
- package/src/feature-libraries/forest-summary/index.ts +2 -1
- package/src/feature-libraries/index.ts +8 -7
- package/src/feature-libraries/modular-schema/comparison.ts +2 -3
- package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
- package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
- package/src/feature-libraries/modular-schema/index.ts +0 -1
- package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
- package/src/feature-libraries/object-forest/objectForest.ts +2 -6
- package/src/feature-libraries/optional-field/index.ts +1 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
- package/src/feature-libraries/schema-edits/index.ts +0 -1
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
- package/src/feature-libraries/schema-index/codec.ts +41 -22
- package/src/feature-libraries/schema-index/formatV1.ts +2 -2
- package/src/feature-libraries/schema-index/formatV2.ts +2 -2
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
- package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
- package/src/index.ts +6 -2
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +16 -5
- package/src/shared-tree/index.ts +0 -1
- package/src/shared-tree/sharedTree.ts +92 -222
- package/src/shared-tree/sharedTreeChangeCodecs.ts +14 -13
- package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
- package/src/shared-tree/treeAlpha.ts +6 -5
- package/src/shared-tree/treeCheckout.ts +1 -3
- package/src/shared-tree-core/editManagerCodecs.ts +69 -20
- package/src/shared-tree-core/editManagerFormatCommons.ts +46 -0
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
- package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
- package/src/shared-tree-core/index.ts +15 -5
- package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
- package/src/shared-tree-core/messageCodecV5.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +77 -28
- package/src/shared-tree-core/messageFormat.ts +58 -0
- package/src/shared-tree-core/sharedTreeCore.ts +11 -13
- package/src/simple-tree/api/configuration.ts +17 -4
- package/src/simple-tree/api/discrepancies.ts +2 -2
- package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
- package/src/simple-tree/api/index.ts +11 -2
- package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
- package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
- package/src/simple-tree/api/schemaFromSimple.ts +20 -9
- package/src/simple-tree/api/simpleSchemaCodec.ts +361 -0
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
- package/src/simple-tree/api/storedSchema.ts +8 -5
- package/src/simple-tree/api/tree.ts +3 -3
- package/src/simple-tree/api/typesUnsafe.ts +6 -6
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
- package/src/simple-tree/core/allowedTypes.ts +4 -4
- package/src/simple-tree/core/index.ts +3 -1
- package/src/simple-tree/core/toStored.ts +42 -18
- package/src/simple-tree/core/treeNode.ts +2 -2
- package/src/simple-tree/core/treeNodeSchema.ts +1 -7
- package/src/simple-tree/core/treeNodeValid.ts +0 -2
- package/src/simple-tree/fieldSchema.ts +2 -11
- package/src/simple-tree/index.ts +11 -2
- package/src/simple-tree/leafNodeSchema.ts +1 -2
- package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -77
- package/src/simple-tree/node-kinds/map/mapNode.ts +3 -17
- package/src/simple-tree/node-kinds/object/objectNode.ts +5 -20
- package/src/simple-tree/node-kinds/record/recordNode.ts +4 -18
- package/src/simple-tree/simpleSchema.ts +27 -5
- package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
- package/src/simple-tree/toStoredSchema.ts +54 -38
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
- package/src/tableSchema.ts +110 -331
- package/src/treeFactory.ts +33 -1
- package/src/util/arrayUtilities.ts +88 -0
- package/src/util/brand.ts +40 -2
- package/src/util/brandedMap.ts +3 -1
- package/src/util/index.ts +7 -0
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
- package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
- package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
- package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { fail } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { DiscriminatedUnionDispatcher, makeCodecFamily, withSchemaValidation, } from "../codec/index.js";
|
|
7
|
+
import { SchemaFormatVersion, } from "../core/index.js";
|
|
7
8
|
import { defaultSchemaPolicy, getCodecTreeForModularChangeFormat, getCodecTreeForSchemaChangeFormat, makeSchemaChangeCodecs, } from "../feature-libraries/index.js";
|
|
8
9
|
import { brand, } from "../util/index.js";
|
|
9
10
|
import { EncodedSharedTreeChange, } from "./sharedTreeChangeFormat.js";
|
|
@@ -22,19 +23,17 @@ export function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily, option
|
|
|
22
23
|
* This is because the format for the dependent formats are not explicitly versioned.
|
|
23
24
|
*/
|
|
24
25
|
export const dependenciesForChangeFormat = new Map([
|
|
25
|
-
[brand(
|
|
26
|
-
[brand(
|
|
27
|
-
[brand(3), { modularChange: brand(3), schemaChange: brand(1) }],
|
|
28
|
-
[brand(4), { modularChange: brand(4), schemaChange: brand(1) }],
|
|
26
|
+
[brand(3), { modularChange: brand(3), schemaChange: brand(SchemaFormatVersion.v1) }],
|
|
27
|
+
[brand(4), { modularChange: brand(4), schemaChange: brand(SchemaFormatVersion.v1) }],
|
|
29
28
|
]);
|
|
30
|
-
export function getCodecTreeForChangeFormat(version) {
|
|
29
|
+
export function getCodecTreeForChangeFormat(version, clientVersion) {
|
|
31
30
|
const { modularChange, schemaChange } = dependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);
|
|
32
31
|
return {
|
|
33
32
|
name: "SharedTreeChange",
|
|
34
33
|
version,
|
|
35
34
|
children: [
|
|
36
35
|
getCodecTreeForModularChangeFormat(modularChange),
|
|
37
|
-
getCodecTreeForSchemaChangeFormat(schemaChange),
|
|
36
|
+
getCodecTreeForSchemaChangeFormat(schemaChange, clientVersion),
|
|
38
37
|
],
|
|
39
38
|
};
|
|
40
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-t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SAAS;wBAC1B,CAAC,CAAC;4BACA,MAAM,EACL,OAAO,CAAC,MAAM,KAAK,SAAS;gCAC3B,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;gCACvB,CAAC,CAAC,mBAAmB;4BACvB,MAAM,EAAE,aAAa;yBACrB;wBACF,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE;4BAC1D,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,MAAM,EAAE,eAAe;4BACvB,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC1B,CAAC;qBACF,CAAC,CAAC;gBACJ,CAAC;qBAAM,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC;wBACZ,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;qBAC3D,CAAC,CAAC;oBACH,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,MAAM,OAAO,GAAyC,EAAE,CAAC;YACzD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC;KACD,EACD,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDiscriminatedUnionDispatcher,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\tSchemaFormatVersion,\n\ttype TreeStoredSchema,\n} from \"../core/index.js\";\nimport {\n\ttype ModularChangeFormatVersion,\n\ttype ModularChangeset,\n\ttype SchemaChange,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForModularChangeFormat,\n\tgetCodecTreeForSchemaChangeFormat,\n\tmakeSchemaChangeCodecs,\n} from \"../feature-libraries/index.js\";\nimport {\n\tbrand,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n} from \"../util/index.js\";\n\nimport {\n\tEncodedSharedTreeChange,\n\ttype EncodedSharedTreeInnerChange,\n} from \"./sharedTreeChangeFormat.js\";\nimport type { SharedTreeChange, SharedTreeInnerChange } from \"./sharedTreeChangeTypes.js\";\n\nexport function makeSharedTreeChangeCodecFamily(\n\tmodularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>,\n\toptions: CodecWriteOptions,\n): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {\n\tconst schemaChangeCodecs = makeSchemaChangeCodecs(options);\n\tconst versions: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tEncodedSharedTreeChange,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t][] = Array.from(dependenciesForChangeFormat.entries()).map(\n\t\t([format, { modularChange, schemaChange }]) => [\n\t\t\tformat,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(modularChange).json,\n\t\t\t\tschemaChangeCodecs.resolve(schemaChange).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t);\n\treturn makeCodecFamily(versions);\n}\n\ninterface ChangeFormatDependencies {\n\treadonly modularChange: ModularChangeFormatVersion;\n\treadonly schemaChange: SchemaFormatVersion;\n}\n\nexport type SharedTreeChangeFormatVersion = Brand<3 | 4, \"SharedTreeChangeFormatVersion\">;\n\n/**\n * Defines for each SharedTree change format the corresponding dependent formats to use.\n * This is an arbitrary mapping that is injected in the SharedTree change codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for the dependent formats are not explicitly versioned.\n */\nexport const dependenciesForChangeFormat: Map<\n\tSharedTreeChangeFormatVersion,\n\tChangeFormatDependencies\n> = new Map([\n\t[brand(3), { modularChange: brand(3), schemaChange: brand(SchemaFormatVersion.v1) }],\n\t[brand(4), { modularChange: brand(4), schemaChange: brand(SchemaFormatVersion.v1) }],\n]);\n\nexport function getCodecTreeForChangeFormat(\n\tversion: SharedTreeChangeFormatVersion,\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst { modularChange, schemaChange } =\n\t\tdependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);\n\treturn {\n\t\tname: \"SharedTreeChange\",\n\t\tversion,\n\t\tchildren: [\n\t\t\tgetCodecTreeForModularChangeFormat(modularChange),\n\t\t\tgetCodecTreeForSchemaChangeFormat(schemaChange, clientVersion),\n\t\t],\n\t};\n}\n\nfunction makeSharedTreeChangeCodec(\n\tmodularChangeCodec: IJsonCodec<\n\t\tModularChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\tschemaChangeCodec: IJsonCodec<SchemaChange>,\n\tcodecOptions: ICodecOptions,\n): IJsonCodec<\n\tSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tChangeEncodingContext\n> {\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncodedSharedTreeInnerChange,\n\t\t[context: ChangeEncodingContext],\n\t\tSharedTreeInnerChange\n\t>({\n\t\tdata(encoded, context): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tinnerChange: modularChangeCodec.decode(encoded, context),\n\t\t\t};\n\t\t},\n\t\tschema(encoded): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"schema\",\n\t\t\t\tinnerChange: schemaChangeCodec.decode(encoded),\n\t\t\t};\n\t\t},\n\t});\n\n\treturn withSchemaValidation(\n\t\tEncodedSharedTreeChange,\n\t\t{\n\t\t\tencode: (change, context) => {\n\t\t\t\tconst changes: EncodedSharedTreeInnerChange[] = [];\n\t\t\t\tlet updatedSchema: TreeStoredSchema | undefined;\n\t\t\t\tfor (const decodedChange of change.changes) {\n\t\t\t\t\tif (decodedChange.type === \"data\") {\n\t\t\t\t\t\tconst schemaAndPolicy =\n\t\t\t\t\t\t\tupdatedSchema !== undefined\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tpolicy:\n\t\t\t\t\t\t\t\t\t\t\tcontext.schema !== undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? context.schema.policy\n\t\t\t\t\t\t\t\t\t\t\t\t: defaultSchemaPolicy,\n\t\t\t\t\t\t\t\t\t\tschema: updatedSchema,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: context.schema;\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tdata: modularChangeCodec.encode(decodedChange.innerChange, {\n\t\t\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\t\t\tschema: schemaAndPolicy,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (decodedChange.type === \"schema\") {\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tschema: schemaChangeCodec.encode(decodedChange.innerChange),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdatedSchema = decodedChange.innerChange.schema.new;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn changes;\n\t\t\t},\n\t\t\tdecode: (encodedChange, context) => {\n\t\t\t\tconst changes: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\t\t\tfor (const subChange of encodedChange) {\n\t\t\t\t\tchanges.push(decoderLibrary.dispatch(subChange, context));\n\t\t\t\t}\n\t\t\t\treturn { changes };\n\t\t\t},\n\t\t},\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
6
|
-
import type {
|
|
6
|
+
import type { CodecWriteOptions, ICodecFamily } from "../codec/index.js";
|
|
7
7
|
import { type ChangeEncodingContext, type ChangeFamily, type ChangeRebaser, type DeltaDetachedNodeId, type RevisionMetadataSource, type RevisionTag, type RevisionTagCodec, type TaggedChange } from "../core/index.js";
|
|
8
8
|
import { type FieldBatchCodec, type ModularChangeset, type TreeChunk, type TreeCompressionStrategyPrivate } from "../feature-libraries/index.js";
|
|
9
9
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
@@ -18,7 +18,7 @@ export declare class SharedTreeChangeFamily implements ChangeFamily<SharedTreeEd
|
|
|
18
18
|
static readonly emptyChange: SharedTreeChange;
|
|
19
19
|
readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;
|
|
20
20
|
private readonly modularChangeFamily;
|
|
21
|
-
constructor(revisionTagCodec: RevisionTagCodec, fieldBatchCodec: FieldBatchCodec, codecOptions:
|
|
21
|
+
constructor(revisionTagCodec: RevisionTagCodec, fieldBatchCodec: FieldBatchCodec, codecOptions: CodecWriteOptions, chunkCompressionStrategy?: TreeCompressionStrategyPrivate, idCompressor?: IIdCompressor | undefined);
|
|
22
22
|
buildEditor(mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<SharedTreeChange>) => void): SharedTreeEditBuilder;
|
|
23
23
|
compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange;
|
|
24
24
|
invert(change: TaggedChange<SharedTreeChange>, isRollback: boolean, revision: RevisionTag): SharedTreeChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeChangeFamily.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sharedTreeChangeFamily.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,8BAA8B,EAInC,MAAM,+BAA+B,CAAC;AAUvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,sBACZ,YACC,YAAY,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,E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BAAmB,CAC5B,QAAuC;QAEvC,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,EAAE,CAAC;YACV,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecFamily, ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategyPrivate,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: ICodecOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategyPrivate,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAInE,OAAO,EASN,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,mBAAmB,EAInB,uBAAuB,EACvB,UAAU,EACV,4BAA4B,GAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGN,cAAc,EACd,SAAS,EACT,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAE9E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+G;IAC/G,6FAA6F;IAC7F,mHAAmH;IACnH,8EAA8E;IAC9E,uDAAuD;IACvD,mEAAmE;IACnE,kHAAkH;IAClH,4CAA4C;IAC5C,sGAAsG;IACtG,mHAAmH;IACnH,mGAAmG;IAEnG,kFAAkF;IAClF,MAAM,aAAa,GAA+C,IAAI,GAAG,EAAE,CAAC;IAC5E,SAAS,0BAA0B,CAAC,EAAuB;QAC1D,cAAc,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IACD,QAAQ,CAAC,CAAC,mBAAmB,CAC5B,QAAuC;QAEvC,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,EAAE,CAAC;YACV,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecWriteOptions, ICodecFamily } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategyPrivate,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: CodecWriteOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategyPrivate,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
|
|
@@ -142,7 +142,7 @@ export interface TreeAlpha {
|
|
|
142
142
|
* @remarks
|
|
143
143
|
* This currently does not support input containing
|
|
144
144
|
* {@link ObjectSchemaOptions.allowUnknownOptionalFields| unknown optional fields} but does support
|
|
145
|
-
* {@link
|
|
145
|
+
* {@link SchemaStaticsBeta.staged | staged} allowed types.
|
|
146
146
|
* Non-empty default values for fields are currently not supported (must be provided in the input).
|
|
147
147
|
* The content will be validated against the schema and an error will be thrown if out of schema.
|
|
148
148
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeAlpha.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAGN,QAAQ,EACR,KAAK,UAAU,EAMf,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAIxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEhB,KAAK,UAAU,EAiBf,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAKhB,KAAK,cAAc,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAEtB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"treeAlpha.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAGN,QAAQ,EACR,KAAK,UAAU,EAMf,KAAK,mBAAmB,EAC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AC,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gBAAgB,CAAC,OAAO,SAAS,cAAc,EAAE,QAAQ,SAAS,eAAe,CAAC,OAAO,CAAC,EACzF,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GACf,QAAQ,CAAC;CACZ;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,OAAO;IAC1C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;CACjC;AA4JD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,SAkUvB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { asIndex, getKernel, TreeNode, TreeBeta, tryGetSchema, createFromCursor,
|
|
|
9
9
|
import { brand, extractFromOpaque } from "../util/index.js";
|
|
10
10
|
import { FluidClientVersion, FormatValidatorNoOp, } from "../codec/index.js";
|
|
11
11
|
import { EmptyKey } from "../core/index.js";
|
|
12
|
-
import { cursorForMapTreeField, defaultSchemaPolicy, isTreeValue, makeFieldBatchCodec, mapTreeFromCursor, TreeCompressionStrategy,
|
|
12
|
+
import { cursorForMapTreeField, defaultSchemaPolicy, isTreeValue, makeFieldBatchCodec, mapTreeFromCursor, TreeCompressionStrategy, withObservation, } from "../feature-libraries/index.js";
|
|
13
13
|
import { independentInitializedView } from "./independentView.js";
|
|
14
14
|
import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
|
|
15
15
|
import { isFluidHandle } from "@fluidframework/runtime-utils";
|
|
@@ -229,8 +229,10 @@ export const TreeAlpha = {
|
|
|
229
229
|
},
|
|
230
230
|
exportCompressed(node, options) {
|
|
231
231
|
const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
|
|
232
|
-
const
|
|
233
|
-
|
|
232
|
+
const codec = makeFieldBatchCodec({
|
|
233
|
+
jsonValidator: FormatValidatorNoOp,
|
|
234
|
+
minVersionForCollab: options.minVersionForCollab,
|
|
235
|
+
});
|
|
234
236
|
const cursor = borrowFieldCursorFromTreeNodeOrValue(node);
|
|
235
237
|
const batch = [cursor];
|
|
236
238
|
// If none provided, create a compressor which will not compress anything.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeAlpha.js","sourceRoot":"","sources":["../../src/shared-tree/treeAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,eAAe,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAItE,OAAO,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EAER,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EAMpB,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAGjB,sBAAsB,EAEtB,0BAA0B,EAC1B,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,qBAAqB,EACrB,gCAAgC,EAChC,4BAA4B,EAC5B,mCAAmC,EACnC,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAIlB,aAAa,EACb,aAAa,EACb,+BAA+B,EAC/B,mBAAmB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAuB,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,kBAAkB,EAGlB,mBAAmB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAA8C,MAAM,kBAAkB,CAAC;AACxF,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EAGvB,yCAAyC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,KAAK,CAAC,yCAAyC,CAC/C,CAAC;wBACF,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;oBAC3C,CAAC;gBACF,CAAC;gBACD,MAAM;YACP,CAAC;YACD,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACnE,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;QACF,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,gBAAgB,CACf,MAAe,EACf,IAAW;QAEX,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACvE,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,EAAE;gBACjD,YAAY,EAAE,KAAK;gBACnB,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM,CAAC,UAAU;aACxB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC;AAEF;;;;GAIG;AACH,SAAS,oCAAoC,CAC5C,IAA0C;IAE1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;IACrD,sDAAsD;IACtD,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tdebugAssert,\n\tfail,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport { createIdCompressor } from \"@fluidframework/id-compressor/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tasIndex,\n\tgetKernel,\n\tTreeNode,\n\ttype Unhydrated,\n\tTreeBeta,\n\ttryGetSchema,\n\tcreateFromCursor,\n\tFieldKind,\n\tnormalizeFieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype InsertableField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeLeafValue,\n\ttype UnsafeUnknownSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\ttype TreeEncodingOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\ttype TreeBranch,\n\tTreeViewConfigurationAlpha,\n\tgetStoredKey,\n\tgetPropertyKeyFromStoredKey,\n\ttreeNodeApi,\n\tgetIdentifierFromNode,\n\tunhydratedFlexTreeFromInsertable,\n\tgetOrCreateNodeFromInnerNode,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tgetInnerNode,\n\tNodeKind,\n\ttryGetTreeNodeForField,\n\tisObjectNodeSchema,\n\tisTreeNode,\n\ttoInitialSchema,\n\tconvertField,\n\ttoUnhydratedSchema,\n\ttype TreeParsingOptions,\n\ttype NodeChangedData,\n\ttype ConciseTree,\n\timportConcise,\n\texportConcise,\n\tborrowCursorFromTreeNodeOrValue,\n\tcontentSchemaSymbol,\n\ttype TreeNodeSchema,\n} from \"../simple-tree/index.js\";\nimport { brand, extractFromOpaque, type JsonCompatible } from \"../util/index.js\";\nimport {\n\tFluidClientVersion,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\tFormatValidatorNoOp,\n} from \"../codec/index.js\";\nimport { EmptyKey, type FieldKey, type ITreeCursorSynchronous } from \"../core/index.js\";\nimport {\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tisTreeValue,\n\tmakeFieldBatchCodec,\n\tmapTreeFromCursor,\n\tTreeCompressionStrategy,\n\ttype FieldBatch,\n\ttype FieldBatchEncodingContext,\n\tfluidVersionToFieldBatchCodecWriteVersion,\n\ttype LocalNodeIdentifier,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeNode,\n\ttype Observer,\n\twithObservation,\n} from \"../feature-libraries/index.js\";\nimport type { TreeBranchAlpha } from \"../simple-tree/index.js\";\nimport { independentInitializedView, type ViewContent } from \"./independentView.js\";\nimport { SchematizingSimpleTreeView, ViewSlot } from \"./schematizingTreeView.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils\";\n\nconst identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined => {\n\tconst nodeIdentifier = getIdentifierFromNode(node, \"uncompressed\");\n\tif (typeof nodeIdentifier === \"number\") {\n\t\tthrow new TypeError(\"identifier should be uncompressed.\");\n\t}\n\treturn nodeIdentifier;\n};\n\nidentifier.shorten = (branch: TreeBranch, nodeIdentifier: string): number | undefined => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\tconst localNodeKey = nodeKeyManager.tryLocalizeNodeIdentifier(nodeIdentifier);\n\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : undefined;\n};\n\nidentifier.lengthen = (branch: TreeBranch, nodeIdentifier: number): string => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\treturn nodeKeyManager.stabilizeNodeIdentifier(\n\t\tnodeIdentifier as unknown as LocalNodeIdentifier,\n\t);\n};\n\nidentifier.getShort = (node: TreeNode): number | undefined => {\n\tconst shortIdentifier = getIdentifierFromNode(node, \"compressed\");\n\treturn typeof shortIdentifier === \"number\" ? shortIdentifier : undefined;\n};\n\nidentifier.create = (branch: TreeBranch): string => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\treturn nodeKeyManager.stabilizeNodeIdentifier(nodeKeyManager.generateLocalNodeIdentifier());\n};\n\nObject.freeze(identifier);\n\n/**\n * A utility interface for retrieving or converting node identifiers.\n *\n * @remarks\n * This provides methods to:\n *\n * - Retrieve long or short identifiers from nodes\n *\n * - Convert between long identifiers and short identifiers\n *\n * - Generates long identifiers\n *\n * @alpha @sealed\n */\nexport interface TreeIdentifierUtils {\n\t/**\n\t * Returns the contents of a node's {@link SchemaFactory.identifier} field as a stable identifier.\n\t * If the identifier field does not exist, returns undefined.\n\t *\n\t * @param node - The TreeNode you want to get the identifier from,\n\t */\n\t(node: TreeNode): string | undefined;\n\n\t/**\n\t * Returns the shortened identifier as a number given long identifier known by the id compressor on the branch if possible.\n\t * Otherwise, it will return the original string identifier provided.\n\t * If the id does not exist, or is unknown by the id compressor, it returns undefined.\n\t *\n\t * This method is the inverse of {@link TreeIdentifierUtils.lengthen}. If you shorten an identifier\n\t * and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.\n\t *\n\t * @param branch - TreeBranch from where you get the idCompressor to do the decompression.\n\t * @param nodeIdentifier - the stable identifier that needs to be shortened.\n\t */\n\tshorten(branch: TreeBranch, nodeIdentifier: string): number | undefined;\n\n\t/**\n\t * Returns the stable id as a string if the identifier is decompressible and known by the id compressor. Otherwise, it will throw an error.\n\t *\n\t * This method is the inverse of {@link TreeIdentifierUtils.shorten}. If you lengthen an identifier\n\t * and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.\n\t *\n\t * @param branch - TreeBranch from where you want to get the id compressor to do the decompression.\n\t * @param nodeIdentifier - The local identifier that needs to be expanded.\n\t */\n\tlengthen(branch: TreeBranch, nodeIdentifier: number): string;\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 undefined.\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\tgetShort(node: TreeNode): number | undefined;\n\n\t/**\n\t * Creates and returns a long identifier.\n\t * The long identifier is a compressible, stable identifier generated by the tree's ID compressor.\n\t *\n\t * @param branch - TreeBranch from where you want to get the id compressor to generate the identifier from.\n\t */\n\tcreate(branch: TreeBranch): string;\n}\n\n/**\n * Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.\n * @remarks\n * Use via the {@link (TreeAlpha:variable)} singleton.\n *\n * The unhydrated node creation APIs in this interface do not support {@link ObjectSchemaOptions.allowUnknownOptionalFields | unknown optional fields}.\n * This is because unknown optional fields still must have a schema: its just that the schema may come from the document's stored schema.\n * Unhydrated nodes created via this interface are not associated with any document, so there is nowhere for them to get schema for unknown optional fields.\n * Note that {@link (TreeBeta:interface).clone} can create an unhydrated node with unknown optional fields, as it uses the source node's stored schema (if any).\n *\n * Export APIs in this interface include {@link ObjectSchemaOptions.allowUnknownOptionalFields | unknown optional fields}\n * if they are using {@link KeyEncodingOptions.allStoredKeys}.\n *\n * @privateRemarks\n * TODO:\n * There should be a way to provide a source for defaulted identifiers for unhydrated node creation, either via these APIs or some way to add them to its output later.\n * If an option were added to these APIs, it could also be used to enable unknown optional fields.\n *\n * @system @sealed @alpha\n */\nexport interface TreeAlpha {\n\t/**\n\t * Retrieve the {@link TreeBranch | branch}, if any, for the given node.\n\t * @param node - The node to query\n\t * @remarks If the node has already been inserted into the tree, this will return the branch associated with that node's {@link TreeView | view}.\n\t * Otherwise, it will return `undefined` (because the node has not yet been inserted and is therefore not part of a branch or view).\n\t *\n\t * This does not fork a new branch, but rather retrieves the _existing_ branch for the node.\n\t * To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.\n\t */\n\tbranch(node: TreeNode): TreeBranchAlpha | undefined;\n\n\t/**\n\t * Construct tree content that is compatible with the field defined by the provided `schema`.\n\t * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n\t * @param data - The data used to construct the field content.\n\t * @remarks\n\t * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.\n\t * This function exists as a generalization that can be used in other cases as well,\n\t * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.\n\t */\n\tcreate<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: InsertableField<TSchema>,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).importConcise}\n\t */\n\timportConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: ConciseTree | undefined,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).(exportConcise:1)}\n\t * @privateRemarks Note: this was retained on this interface because {@link (TreeAlpha:interface).importConcise} exists.\n\t * It should be removed if/when that is removed from this interface.\n\t */\n\texportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).(exportConcise:2)}\n\t * @privateRemarks Note: this was retained on this interface because {@link (TreeAlpha:interface).importConcise} exists.\n\t * It should be removed if/when that is removed from this interface.\n\t */\n\texportConcise(\n\t\tnode: TreeNode | TreeLeafValue | undefined,\n\t\toptions?: TreeEncodingOptions,\n\t): ConciseTree | undefined;\n\n\t/**\n\t * Construct tree content compatible with a field defined by the provided `schema`.\n\t * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n\t * @param data - The data used to construct the field content. See {@link (TreeAlpha:interface).(exportVerbose:1)}.\n\t * @remarks\n\t * This currently does not support input containing\n\t * {@link ObjectSchemaOptions.allowUnknownOptionalFields| unknown optional fields} but does support\n\t * {@link SchemaStaticsAlpha.staged | staged} allowed types.\n\t * Non-empty default values for fields are currently not supported (must be provided in the input).\n\t * The content will be validated against the schema and an error will be thrown if out of schema.\n\t */\n\timportVerbose<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tdata: VerboseTree | undefined,\n\t\toptions?: TreeParsingOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\n\t/**\n\t * Copy a snapshot of the current version of a TreeNode into a JSON compatible plain old JavaScript Object (except for {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}).\n\t * Uses the {@link VerboseTree} format, with an explicit type on every node.\n\t *\n\t * @remarks\n\t * There are several cases this may be preferred to {@link (TreeBeta:interface).(exportConcise:1)}:\n\t *\n\t * 1. When not using {@link ITreeConfigurationOptions.preventAmbiguity} (or when using `useStableFieldKeys`), `exportConcise` can produce ambiguous data (the type may be unclear on some nodes).\n\t * `exportVerbose` will always be unambiguous and thus lossless.\n\t *\n\t * 2. When the data might be interpreted without access to the exact same view schema. In such cases, the types may be unknowable if not included.\n\t *\n\t * 3. When easy access to the type is desired.\n\t */\n\texportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;\n\n\t/**\n\t * Export the content of the provided `tree` in a compressed JSON compatible format.\n\t * @remarks\n\t * If an `idCompressor` is provided, it will be used to compress identifiers and thus will be needed to decompress the data.\n\t *\n\t * Always uses \"stored\" keys.\n\t * See {@link KeyEncodingOptions.allStoredKeys} for details.\n\t * @privateRemarks\n\t * TODO: It is currently not clear how to work with the idCompressors correctly in the package API.\n\t * Better APIs should probably be provided as there is currently no way to associate an un-hydrated tree with an idCompressor,\n\t * Nor get the correct idCompressor from a subtree to use when exporting it.\n\t * Additionally using `createIdCompressor` to make an idCompressor is `@legacy` and thus not intended for use in this API surface.\n\t * It would probably make more sense if we provided a way to get an idCompressor from the context of a node,\n\t * which could be optional (and settable if missing) for un0hydrated nodes and required for hydrated ones.\n\t * Add in a stable public API for creating idCompressors, and a way to get them from a tree (without view schema), and that should address the anticipated use-cases.\n\t */\n\texportCompressed(\n\t\ttree: TreeNode | TreeLeafValue,\n\t\toptions: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, \"minVersionForCollab\">,\n\t): JsonCompatible<IFluidHandle>;\n\n\t/**\n\t * Import data encoded by {@link (TreeAlpha:interface).exportCompressed}.\n\t *\n\t * @param schema - Schema with which the data must be compatible. This compatibility is not verified and must be ensured by the caller.\n\t * @param compressedData - Data compressed by {@link (TreeAlpha:interface).exportCompressed}.\n\t * @param options - If {@link (TreeAlpha:interface).exportCompressed} was given an `idCompressor`, it must be provided here.\n\t *\n\t * @remarks\n\t * If the data could have been encoded with a different schema, consider encoding the schema along side it using {@link extractPersistedSchema} and loading the data using {@link independentView}.\n\t *\n\t * @privateRemarks\n\t * This API could be improved:\n\t *\n\t * 1. It could validate that the schema is compatible, and return or throw an error in the invalid case (maybe add a \"try\" version).\n\t *\n\t * 2. A \"try\" version of this could return an error if the data isn't in a supported format (as determined by version and/or JasonValidator).\n\t *\n\t * 3. Requiring the caller provide a JsonValidator isn't the most friendly API. It might be practical to provide a default.\n\t */\n\timportCompressed<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tcompressedData: JsonCompatible<IFluidHandle>,\n\t\toptions: { idCompressor?: IIdCompressor } & ICodecOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\n\t/**\n\t * APIs for creating, converting, and retrieving identifiers.\n\t */\n\treadonly identifier: TreeIdentifierUtils;\n\n\t/**\n\t * The key of the given node under its parent.\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 * If `node` is the root node, this returns undefined.\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t */\n\tkey2(node: TreeNode): string | number | undefined;\n\n\t/**\n\t * Gets the child of the given node with the given property key if a child exists under that key.\n\t *\n\t * @remarks {@link ObjectSchemaOptions.allowUnknownOptionalFields | Unknown optional fields} of Object nodes will not be returned by this method.\n\t *\n\t * @param node - The parent node whose child is being requested.\n\t * @param key - The property key under the node under which the child is being requested.\n\t * For Object nodes, this is the developer-facing \"property key\", not the \"{@link SimpleObjectFieldSchema.storedKey | stored keys}\".\n\t *\n\t * @returns The child node or leaf value under the given key, or `undefined` if no such child exists.\n\t *\n\t * @see {@link (TreeAlpha:interface).key2}\n\t * @see {@link (TreeNodeApi:interface).parent}\n\t */\n\tchild(node: TreeNode, key: string | number): TreeNode | TreeLeafValue | undefined;\n\n\t/**\n\t * Gets the children of the provided node, paired with their property keys under the node.\n\t *\n\t * @remarks\n\t * No guarantees are made regarding the order of the children in the returned array.\n\t *\n\t * Optional properties of Object nodes with no value are not included in the result.\n\t *\n\t * {@link ObjectSchemaOptions.allowUnknownOptionalFields | Unknown optional fields} of Object nodes are not included in the result.\n\t *\n\t * @param node - The node whose children are being requested.\n\t *\n\t * @returns\n\t * An array of pairs of the form `[propertyKey, child]`.\n\t *\n\t * For Array nodes, the `propertyKey` is the index of the child in the array.\n\t *\n\t * For Object nodes, the returned `propertyKey`s are the developer-facing \"property keys\", not the \"{@link SimpleObjectFieldSchema.storedKey | stored keys}\".\n\t *\n\t * @see {@link (TreeAlpha:interface).key2}\n\t * @see {@link (TreeNodeApi:interface).parent}\n\t */\n\tchildren(\n\t\tnode: TreeNode,\n\t): Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]>;\n\n\t/**\n\t * Track observations of any TreeNode content.\n\t * @remarks\n\t * This subscribes to changes to any nodes content observed during `trackDuring`.\n\t *\n\t * Currently this does not support tracking parentage (see {@link (TreeAlpha:interface).trackObservationsOnce} for a version which does):\n\t * if accessing parentage during `trackDuring`, this will throw a usage error.\n\t *\n\t * This also does not track node status changes (e.g. whether a node is attached to a view or not).\n\t * The current behavior of checking status is unspecified: future versions may track it, error, or ignore it.\n\t *\n\t * These subscriptions remain active until `unsubscribe` is called: `onInvalidation` may be called multiple times.\n\t * See {@link (TreeAlpha:interface).trackObservationsOnce} for a version which automatically unsubscribes on the first invalidation.\n\t * @privateRemarks\n\t * This version, while more general than {@link (TreeAlpha:interface).trackObservationsOnce}, might be unnecessary.\n\t * Maybe this should be removed and only `trackObservationsOnce` kept.\n\t * Reevaluate this before stabilizing.\n\t */\n\ttrackObservations<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult>;\n\n\t/**\n\t * {@link (TreeAlpha:interface).trackObservations} except automatically unsubscribes when the first invalidation occurs.\n\t * @remarks\n\t * This also supports tracking parentage, unlike {@link (TreeAlpha:interface).trackObservations}, as long as the parent is not undefined.\n\t *\n\t * @example Simple cached value invalidation\n\t * ```typescript\n\t * // Compute and cache this \"foo\" value, and clear the cache when the fields read in the callback to compute it change.\n\t * cachedFoo ??= TreeAlpha.trackObservationsOnce(\n\t * \t() => {\n\t * \t\tcachedFoo = undefined;\n\t * \t},\n\t * \t() => nodeA.someChild.bar + nodeB.someChild.baz,\n\t * ).result;\n\t * ```\n\t *\n\t * That is equivalent to doing the following:\n\t * ```typescript\n\t * if (cachedFoo === undefined) {\n\t * \tcachedFoo = nodeA.someChild.bar + nodeB.someChild.baz;\n\t * \tconst invalidate = (): void => {\n\t * \t\tcachedFoo = undefined;\n\t * \t\tfor (const u of unsubscribe) {\n\t * \t\t\tu();\n\t * \t\t}\n\t * \t};\n\t * \tconst unsubscribe: (() => void)[] = [\n\t * \t\tTreeBeta.on(nodeA, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"someChild\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeB, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"someChild\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeA.someChild, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"bar\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeB.someChild, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"baz\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t];\n\t * }\n\t * ```\n\t * @example Cached derived schema property\n\t * ```typescript\n\t * const factory = new SchemaFactory(\"com.example\");\n\t * class Vector extends factory.object(\"Vector\", {\n\t * \tx: SchemaFactory.number,\n\t * \ty: SchemaFactory.number,\n\t * }) {\n\t * \t#length: number | undefined = undefined;\n\t * \tpublic length(): number {\n\t * \t\tif (this.#length === undefined) {\n\t * \t\t\tconst result = TreeAlpha.trackObservationsOnce(\n\t * \t\t\t\t() => {\n\t * \t\t\t\t\tthis.#length = undefined;\n\t * \t\t\t\t},\n\t * \t\t\t\t() => Math.hypot(this.x, this.y),\n\t * \t\t\t);\n\t * \t\t\tthis.#length = result.result;\n\t * \t\t}\n\t * \t\treturn this.#length;\n\t * \t}\n\t * }\n\t * const vec = new Vector({ x: 3, y: 4 });\n\t * assert.equal(vec.length(), 5);\n\t * vec.x = 0;\n\t * assert.equal(vec.length(), 4);\n\t * ```\n\t */\n\ttrackObservationsOnce<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult>;\n\n\t/**\n\t * Ensures that the provided content will be interpreted as the given schema when inserting into the tree.\n\t * @returns `content`, for convenience.\n\t * @remarks\n\t * If applicable, this will tag the given content with a {@link contentSchemaSymbol | special property} that indicates its intended schema.\n\t * The `content` will be interpreted as the given `schema` when later inserted into the tree.\n\t *\n\t * This does not validate that the content actually conforms to the given schema (such validation will be done at insert time).\n\t * If the content is not compatible with the tagged schema, an error will be thrown when the content is inserted.\n\t *\n\t * This is particularly useful when the content's schema cannot be inferred from its structure alone because it is compatible with multiple schemas.\n\t * @example\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"example\");\n\t * class Dog extends sf.object(\"Dog\", { name: sf.string() }) {}\n\t * class Cat extends sf.object(\"Cat\", { name: sf.string() }) {}\n\t * class Root extends sf.object(\"Root\", { pet: [Dog, Cat] }) {}\n\t * // ...\n\t * const pet = { name: \"Max\" };\n\t * view.root.pet = pet; // Error: ambiguous schema - is it a Dog or a Cat?\n\t * TreeAlpha.ensureSchema(Dog, pet); // Tags `pet` as a Dog.\n\t * view.root.pet = pet; // No error - it's a Dog.\n\t * ```\n\t */\n\ttagContentSchema<TSchema extends TreeNodeSchema, TContent extends InsertableField<TSchema>>(\n\t\tschema: TSchema,\n\t\tcontent: TContent,\n\t): TContent;\n}\n\n/**\n * Results from an operation with tracked observations.\n * @remarks\n * Results from {@link (TreeAlpha:interface).trackObservations} or {@link (TreeAlpha:interface).trackObservationsOnce}.\n * @sealed @alpha\n */\nexport interface ObservationResults<TResult> {\n\t/**\n\t * The result of the operation which had its observations tracked.\n\t */\n\treadonly result: TResult;\n\n\t/**\n\t * Call to unsubscribe from further invalidations.\n\t */\n\treadonly unsubscribe: () => void;\n}\n\n/**\n * Subscription to changes on a single node.\n * @remarks\n * Either tracks some set of fields, or all fields and can be updated to track more fields.\n */\nclass NodeSubscription {\n\t/**\n\t * If undefined, subscribes to all keys.\n\t * Otherwise only subscribes to the keys in the set.\n\t */\n\tprivate keys: Set<FieldKey> | undefined;\n\tprivate readonly unsubscribe: () => void;\n\tprivate constructor(\n\t\tprivate readonly onInvalidation: () => void,\n\t\tflexNode: FlexTreeNode,\n\t) {\n\t\t// TODO:Performance: It is possible to optimize this to not use the public TreeNode API.\n\t\tconst node = getOrCreateNodeFromInnerNode(flexNode);\n\t\tassert(node instanceof TreeNode, 0xc54 /* Unexpected leaf value */);\n\n\t\tconst handler = (data: NodeChangedData): void => {\n\t\t\tif (this.keys === undefined || data.changedProperties === undefined) {\n\t\t\t\tthis.onInvalidation();\n\t\t\t} else {\n\t\t\t\tlet keyMap: ReadonlyMap<FieldKey, string> | undefined;\n\t\t\t\tconst schema = treeNodeApi.schema(node);\n\t\t\t\tif (isObjectNodeSchema(schema)) {\n\t\t\t\t\tkeyMap = schema.storedKeyToPropertyKey;\n\t\t\t\t}\n\t\t\t\t// TODO:Performance: Ideally this would use Set.prototype.isDisjointFrom when available.\n\t\t\t\tfor (const flexKey of this.keys) {\n\t\t\t\t\t// TODO:Performance: doing everything at the flex tree layer could avoid this translation\n\t\t\t\t\tconst key = keyMap?.get(flexKey) ?? flexKey;\n\n\t\t\t\t\tif (data.changedProperties.has(key)) {\n\t\t\t\t\t\tthis.onInvalidation();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis.unsubscribe = TreeBeta.on(node, \"nodeChanged\", handler);\n\t}\n\n\t/**\n\t * Create an {@link Observer} which subscribes to what was observed in {@link NodeSubscription}s.\n\t */\n\tpublic static createObserver(\n\t\tinvalidate: () => void,\n\t\tonlyOnce = false,\n\t): { observer: Observer; unsubscribe: () => void } {\n\t\tconst subscriptions = new Map<FlexTreeNode, NodeSubscription>();\n\t\tconst observer: Observer = {\n\t\t\tobserveNodeFields(flexNode: FlexTreeNode): void {\n\t\t\t\tif (flexNode.value !== undefined) {\n\t\t\t\t\t// Leaf value, nothing to observe.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst subscription = subscriptions.get(flexNode);\n\t\t\t\tif (subscription !== undefined) {\n\t\t\t\t\t// Already subscribed to this node.\n\t\t\t\t\tsubscription.keys = undefined; // Now subscribed to all keys.\n\t\t\t\t} else {\n\t\t\t\t\tconst newSubscription = new NodeSubscription(invalidate, flexNode);\n\t\t\t\t\tsubscriptions.set(flexNode, newSubscription);\n\t\t\t\t}\n\t\t\t},\n\t\t\tobserveNodeField(flexNode: FlexTreeNode, key: FieldKey): void {\n\t\t\t\tif (flexNode.value !== undefined) {\n\t\t\t\t\t// Leaf value, nothing to observe.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst subscription = subscriptions.get(flexNode);\n\t\t\t\tif (subscription !== undefined) {\n\t\t\t\t\t// Already subscribed to this node: if not subscribed to all keys, subscribe to this one.\n\t\t\t\t\t// TODO:Performance: due to how JavaScript set ordering works,\n\t\t\t\t\t// it might be faster to check `has` and only add if not present in case the same field is viewed many times.\n\t\t\t\t\tsubscription.keys?.add(key);\n\t\t\t\t} else {\n\t\t\t\t\tconst newSubscription = new NodeSubscription(invalidate, flexNode);\n\t\t\t\t\tnewSubscription.keys = new Set([key]);\n\t\t\t\t\tsubscriptions.set(flexNode, newSubscription);\n\t\t\t\t}\n\t\t\t},\n\t\t\tobserveParentOf(node: FlexTreeNode): void {\n\t\t\t\t// Supporting parent tracking is more difficult that it might seem at first.\n\t\t\t\t// There are two main complicating factors:\n\t\t\t\t// 1. The parent may be undefined (the node is a root).\n\t\t\t\t// 2. If tracking this by subscribing to the parent's changes, then which events are subscribed to needs to be updated after the parent changes.\n\t\t\t\t//\n\t\t\t\t// If not supporting the first case (undefined parents), the second case gets problematic: edits which un-parent a node could error due to being unable to update the event subscription.\n\t\t\t\t// For now this is mitigated by only supporting one of tracking (non-undefined) parents or maintaining event subscriptions across edits.\n\n\t\t\t\tif (!onlyOnce) {\n\t\t\t\t\t// TODO: better APIS should be provided which make handling this case practical.\n\t\t\t\t\tthrow new UsageError(\"Observation tracking for parents is currently not supported.\");\n\t\t\t\t}\n\n\t\t\t\tconst parent = withObservation(undefined, () => node.parentField.parent);\n\n\t\t\t\tif (parent.parent === undefined) {\n\t\t\t\t\t// TODO: better APIS should be provided which make handling this case practical.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Observation tracking for parents is currently not supported when parent is undefined.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tobserver.observeNodeField(parent.parent, parent.key);\n\t\t\t},\n\t\t};\n\n\t\tlet subscribed = true;\n\n\t\treturn {\n\t\t\tobserver,\n\t\t\tunsubscribe: () => {\n\t\t\t\tif (!subscribed) {\n\t\t\t\t\tthrow new UsageError(\"Already unsubscribed\");\n\t\t\t\t}\n\t\t\t\tsubscribed = false;\n\t\t\t\tfor (const subscription of subscriptions.values()) {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Handles both {@link (TreeAlpha:interface).trackObservations} and {@link (TreeAlpha:interface).trackObservationsOnce}.\n */\nfunction trackObservations<TResult>(\n\tonInvalidation: () => void,\n\ttrackDuring: () => TResult,\n\tonlyOnce = false,\n): ObservationResults<TResult> {\n\tlet observing = true;\n\n\tconst invalidate = (): void => {\n\t\tif (observing) {\n\t\t\tthrow new UsageError(\"Cannot invalidate while tracking observations\");\n\t\t}\n\t\tonInvalidation();\n\t};\n\n\tconst { observer, unsubscribe } = NodeSubscription.createObserver(invalidate, onlyOnce);\n\tconst result = withObservation(observer, trackDuring);\n\tobserving = false;\n\n\treturn {\n\t\tresult,\n\t\tunsubscribe,\n\t};\n}\n\n/**\n * Extensions to {@link (Tree:variable)} and {@link (TreeBeta:variable)} which are not yet stable.\n * @see {@link (TreeAlpha:interface)}.\n * @alpha\n */\nexport const TreeAlpha: TreeAlpha = {\n\ttrackObservations<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult> {\n\t\treturn trackObservations(onInvalidation, trackDuring);\n\t},\n\n\ttrackObservationsOnce<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult> {\n\t\tconst result = trackObservations(\n\t\t\t() => {\n\t\t\t\t// trackObservations ensures no invalidation occurs while its running,\n\t\t\t\t// so this callback can only run after trackObservations has returns and thus result is defined.\n\t\t\t\tresult.unsubscribe();\n\t\t\t\tonInvalidation();\n\t\t\t},\n\t\t\ttrackDuring,\n\t\t\ttrue,\n\t\t);\n\t\treturn result;\n\t},\n\n\tbranch(node: TreeNode): TreeBranchAlpha | undefined {\n\t\tconst kernel = getKernel(node);\n\t\tif (!kernel.isHydrated()) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst view = kernel.anchorNode.anchorSet.slots.get(ViewSlot);\n\t\tassert(\n\t\t\tview instanceof SchematizingSimpleTreeView,\n\t\t\t0xa5c /* Unexpected view implementation */,\n\t\t);\n\t\treturn view;\n\t},\n\n\tcreate<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: InsertableField<TSchema>,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t> {\n\t\tconst mapTree = unhydratedFlexTreeFromInsertable(\n\t\t\tdata as InsertableField<UnsafeUnknownSchema>,\n\t\t\tschema,\n\t\t);\n\t\tconst result = mapTree === undefined ? undefined : getOrCreateNodeFromInnerNode(mapTree);\n\t\treturn result as Unhydrated<\n\t\t\tTSchema extends ImplicitFieldSchema\n\t\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t\t: TreeNode | TreeLeafValue | undefined\n\t\t>;\n\t},\n\n\timportConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: ConciseTree | undefined,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t> {\n\t\treturn importConcise(schema, data);\n\t},\n\n\texportConcise,\n\n\timportVerbose<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tdata: VerboseTree | undefined,\n\t\toptions?: TreeParsingOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\t\tconst config: TreeEncodingOptions = { ...options };\n\t\t// Create a config which is standalone, and thus can be used without having to refer back to the schema.\n\t\tconst schemalessConfig = applySchemaToParserOptions(schema, config);\n\t\tif (data === undefined) {\n\t\t\tconst field = normalizeFieldSchema(schema);\n\t\t\tif (field.kind !== FieldKind.Optional) {\n\t\t\t\tthrow new UsageError(\"undefined provided for non-optional field.\");\n\t\t\t}\n\t\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t\t}\n\t\tconst cursor = cursorFromVerbose(data, schemalessConfig);\n\t\treturn createFromCursor(\n\t\t\tschema,\n\t\t\tcursor,\n\t\t\tconvertField(normalizeFieldSchema(schema), toUnhydratedSchema),\n\t\t);\n\t},\n\n\texportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree {\n\t\tif (isTreeValue(node)) {\n\t\t\treturn node;\n\t\t}\n\t\tconst config: TreeEncodingOptions = { ...options };\n\n\t\tconst cursor = borrowCursorFromTreeNodeOrValue(node);\n\t\tconst kernel = getKernel(node);\n\t\treturn verboseFromCursor(cursor, kernel.context, config);\n\t},\n\n\texportCompressed(\n\t\tnode: TreeNode | TreeLeafValue,\n\t\toptions: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, \"minVersionForCollab\">,\n\t): JsonCompatible<IFluidHandle> {\n\t\tconst schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);\n\t\tconst format = fluidVersionToFieldBatchCodecWriteVersion(options.minVersionForCollab);\n\t\tconst codec = makeFieldBatchCodec({ jsonValidator: FormatValidatorNoOp }, format);\n\t\tconst cursor = borrowFieldCursorFromTreeNodeOrValue(node);\n\t\tconst batch: FieldBatch = [cursor];\n\t\t// If none provided, create a compressor which will not compress anything.\n\t\tconst idCompressor = options.idCompressor ?? createIdCompressor();\n\n\t\t// Grabbing an existing stored schema from the node is important to ensure that unknown optional fields can be preserved.\n\t\t// Note that if the node is unhydrated, this can result in all staged allowed types being included in the schema, which might be undesired.\n\t\tconst storedSchema = isTreeNode(node)\n\t\t\t? getKernel(node).context.flexContext.schema\n\t\t\t: toInitialSchema(schema);\n\n\t\tconst context: FieldBatchEncodingContext = {\n\t\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\t\tidCompressor,\n\t\t\toriginatorId: idCompressor.localSessionId, // TODO: Why is this needed?\n\t\t\tschema: { schema: storedSchema, policy: defaultSchemaPolicy },\n\t\t};\n\t\tconst result = codec.encode(batch, context);\n\t\treturn result;\n\t},\n\n\timportCompressed<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tcompressedData: JsonCompatible<IFluidHandle>,\n\t\toptions: {\n\t\t\tidCompressor?: IIdCompressor;\n\t\t} & ICodecOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\t\tconst config = new TreeViewConfigurationAlpha({ schema });\n\t\tconst content: ViewContent = {\n\t\t\t// Always use a v1 schema codec for consistency.\n\t\t\t// TODO: reevaluate how staged schema should behave in schema import/export APIs before stabilizing this.\n\t\t\tschema: extractPersistedSchema(config.schema, FluidClientVersion.v2_0, () => true),\n\t\t\ttree: compressedData,\n\t\t\tidCompressor: options.idCompressor ?? createIdCompressor(),\n\t\t};\n\t\tconst view = independentInitializedView(config, options, content);\n\t\treturn TreeBeta.clone<TSchema>(view.root);\n\t},\n\n\tidentifier,\n\n\tkey2(node: TreeNode): string | number | undefined {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn undefined;\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\treturn getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t},\n\n\tchild: (\n\t\tnode: TreeNode,\n\t\tpropertyKey: string | number,\n\t): TreeNode | TreeLeafValue | undefined => {\n\t\tconst flexNode = getInnerNode(node);\n\t\tdebugAssert(\n\t\t\t() => !flexNode.context.isDisposed() || \"The provided tree node has been disposed.\",\n\t\t);\n\n\t\tconst schema = treeNodeApi.schema(node);\n\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tconst sequence = flexNode.tryGetField(EmptyKey) as FlexTreeSequenceField | undefined;\n\n\t\t\t\t// Empty sequence - cannot have children.\n\t\t\t\tif (sequence === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst index =\n\t\t\t\t\ttypeof propertyKey === \"number\"\n\t\t\t\t\t\t? propertyKey\n\t\t\t\t\t\t: asIndex(propertyKey, Number.POSITIVE_INFINITY);\n\n\t\t\t\t// If the key is not a valid index, then there is no corresponding child.\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst childFlexTree = sequence.at(index);\n\n\t\t\t\t// No child at the given index.\n\t\t\t\tif (childFlexTree === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn getOrCreateNodeFromInnerUnboxedNode(childFlexTree);\n\t\t\t}\n\t\t\tcase NodeKind.Map:\n\t\t\t\tif (typeof propertyKey !== \"string\") {\n\t\t\t\t\t// Map nodes only support string keys.\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t// Fall through\n\t\t\tcase NodeKind.Record:\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tlet storedKey: string | number = propertyKey;\n\t\t\t\tif (isObjectNodeSchema(schema)) {\n\t\t\t\t\tconst fieldSchema = schema.fields.get(String(propertyKey));\n\t\t\t\t\tif (fieldSchema === undefined) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tstoredKey = fieldSchema.storedKey;\n\t\t\t\t}\n\n\t\t\t\tconst field = flexNode.tryGetField(brand(String(storedKey)));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\tfail(0xbc3 /* Leaf schema associated with non-leaf tree node. */);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t},\n\n\tchildren(node: TreeNode): [propertyKey: string | number, child: TreeNode | TreeLeafValue][] {\n\t\tconst flexNode = getInnerNode(node);\n\t\tdebugAssert(\n\t\t\t() => !flexNode.context.isDisposed() || \"The provided tree node has been disposed.\",\n\t\t);\n\n\t\tconst schema = treeNodeApi.schema(node);\n\n\t\tconst result: [string | number, TreeNode | TreeLeafValue][] = [];\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tconst sequence = flexNode.tryGetField(EmptyKey) as FlexTreeSequenceField | undefined;\n\t\t\t\tif (sequence === undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tfor (let index = 0; index < sequence.length; index++) {\n\t\t\t\t\tconst childFlexTree = sequence.at(index);\n\t\t\t\t\tassert(childFlexTree !== undefined, 0xbc4 /* Sequence child was undefined. */);\n\t\t\t\t\tconst childTree = getOrCreateNodeFromInnerUnboxedNode(childFlexTree);\n\t\t\t\t\tresult.push([index, childTree]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Map:\n\t\t\tcase NodeKind.Record: {\n\t\t\t\tfor (const [key, flexField] of flexNode.fields) {\n\t\t\t\t\tconst childTreeNode = tryGetTreeNodeForField(flexField);\n\t\t\t\t\tif (childTreeNode !== undefined) {\n\t\t\t\t\t\tresult.push([key, childTreeNode]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xbc5 /* Expected object schema. */);\n\t\t\t\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\t\t\t\tconst storedKey = fieldSchema.storedKey;\n\t\t\t\t\tconst flexField = flexNode.tryGetField(brand(String(storedKey)));\n\t\t\t\t\tif (flexField !== undefined) {\n\t\t\t\t\t\tconst childTreeNode = tryGetTreeNodeForField(flexField);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildTreeNode !== undefined,\n\t\t\t\t\t\t\t0xbc6 /* Expected child tree node for field. */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tresult.push([propertyKey, childTreeNode]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\tfail(0xbc7 /* Leaf schema associated with non-leaf tree node. */);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t},\n\n\ttagContentSchema<TSchema extends TreeNodeSchema, TNode extends InsertableField<TSchema>>(\n\t\tschema: TSchema,\n\t\tnode: TNode,\n\t): TNode {\n\t\tif (typeof node === \"object\" && node !== null && !isFluidHandle(node)) {\n\t\t\tReflect.defineProperty(node, contentSchemaSymbol, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: schema.identifier,\n\t\t\t});\n\t\t}\n\t\treturn node;\n\t},\n};\n\n/**\n * Borrow a cursor from a field.\n * @remarks\n * The cursor must be put back to its original location before the node is used again.\n */\nfunction borrowFieldCursorFromTreeNodeOrValue(\n\tnode: TreeNode | TreeLeafValue | undefined,\n): ITreeCursorSynchronous {\n\tif (node === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\tconst cursor = borrowCursorFromTreeNodeOrValue(node);\n\t// TODO: avoid copy: borrow cursor from field instead.\n\tconst mapTree = mapTreeFromCursor(cursor);\n\treturn cursorForMapTreeField([mapTree]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeAlpha.js","sourceRoot":"","sources":["../../src/shared-tree/treeAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,eAAe,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAItE,OAAO,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EAER,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,S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E,KAAK;gBACnB,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM,CAAC,UAAU;aACxB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC;AAEF;;;;GAIG;AACH,SAAS,oCAAoC,CAC5C,IAA0C;IAE1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAC;IACrD,sDAAsD;IACtD,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tdebugAssert,\n\tfail,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport { createIdCompressor } from \"@fluidframework/id-compressor/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tasIndex,\n\tgetKernel,\n\tTreeNode,\n\ttype Unhydrated,\n\tTreeBeta,\n\ttryGetSchema,\n\tcreateFromCursor,\n\tFieldKind,\n\tnormalizeFieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype InsertableField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeLeafValue,\n\ttype UnsafeUnknownSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\ttype TreeEncodingOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\ttype TreeBranch,\n\tTreeViewConfigurationAlpha,\n\tgetStoredKey,\n\tgetPropertyKeyFromStoredKey,\n\ttreeNodeApi,\n\tgetIdentifierFromNode,\n\tunhydratedFlexTreeFromInsertable,\n\tgetOrCreateNodeFromInnerNode,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tgetInnerNode,\n\tNodeKind,\n\ttryGetTreeNodeForField,\n\tisObjectNodeSchema,\n\tisTreeNode,\n\ttoInitialSchema,\n\tconvertField,\n\ttoUnhydratedSchema,\n\ttype TreeParsingOptions,\n\ttype NodeChangedData,\n\ttype ConciseTree,\n\timportConcise,\n\texportConcise,\n\tborrowCursorFromTreeNodeOrValue,\n\tcontentSchemaSymbol,\n\ttype TreeNodeSchema,\n} from \"../simple-tree/index.js\";\nimport { brand, extractFromOpaque, type JsonCompatible } from \"../util/index.js\";\nimport {\n\tFluidClientVersion,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\tFormatValidatorNoOp,\n} from \"../codec/index.js\";\nimport { EmptyKey, type FieldKey, type ITreeCursorSynchronous } from \"../core/index.js\";\nimport {\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tisTreeValue,\n\tmakeFieldBatchCodec,\n\tmapTreeFromCursor,\n\tTreeCompressionStrategy,\n\ttype FieldBatch,\n\ttype FieldBatchEncodingContext,\n\ttype LocalNodeIdentifier,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeNode,\n\ttype Observer,\n\twithObservation,\n} from \"../feature-libraries/index.js\";\nimport type { TreeBranchAlpha } from \"../simple-tree/index.js\";\nimport { independentInitializedView, type ViewContent } from \"./independentView.js\";\nimport { SchematizingSimpleTreeView, ViewSlot } from \"./schematizingTreeView.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils\";\n\nconst identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined => {\n\tconst nodeIdentifier = getIdentifierFromNode(node, \"uncompressed\");\n\tif (typeof nodeIdentifier === \"number\") {\n\t\tthrow new TypeError(\"identifier should be uncompressed.\");\n\t}\n\treturn nodeIdentifier;\n};\n\nidentifier.shorten = (branch: TreeBranch, nodeIdentifier: string): number | undefined => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\tconst localNodeKey = nodeKeyManager.tryLocalizeNodeIdentifier(nodeIdentifier);\n\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : undefined;\n};\n\nidentifier.lengthen = (branch: TreeBranch, nodeIdentifier: number): string => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\treturn nodeKeyManager.stabilizeNodeIdentifier(\n\t\tnodeIdentifier as unknown as LocalNodeIdentifier,\n\t);\n};\n\nidentifier.getShort = (node: TreeNode): number | undefined => {\n\tconst shortIdentifier = getIdentifierFromNode(node, \"compressed\");\n\treturn typeof shortIdentifier === \"number\" ? shortIdentifier : undefined;\n};\n\nidentifier.create = (branch: TreeBranch): string => {\n\tconst nodeKeyManager = (branch as SchematizingSimpleTreeView<ImplicitFieldSchema>)\n\t\t.nodeKeyManager;\n\treturn nodeKeyManager.stabilizeNodeIdentifier(nodeKeyManager.generateLocalNodeIdentifier());\n};\n\nObject.freeze(identifier);\n\n/**\n * A utility interface for retrieving or converting node identifiers.\n *\n * @remarks\n * This provides methods to:\n *\n * - Retrieve long or short identifiers from nodes\n *\n * - Convert between long identifiers and short identifiers\n *\n * - Generates long identifiers\n *\n * @alpha @sealed\n */\nexport interface TreeIdentifierUtils {\n\t/**\n\t * Returns the contents of a node's {@link SchemaFactory.identifier} field as a stable identifier.\n\t * If the identifier field does not exist, returns undefined.\n\t *\n\t * @param node - The TreeNode you want to get the identifier from,\n\t */\n\t(node: TreeNode): string | undefined;\n\n\t/**\n\t * Returns the shortened identifier as a number given long identifier known by the id compressor on the branch if possible.\n\t * Otherwise, it will return the original string identifier provided.\n\t * If the id does not exist, or is unknown by the id compressor, it returns undefined.\n\t *\n\t * This method is the inverse of {@link TreeIdentifierUtils.lengthen}. If you shorten an identifier\n\t * and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.\n\t *\n\t * @param branch - TreeBranch from where you get the idCompressor to do the decompression.\n\t * @param nodeIdentifier - the stable identifier that needs to be shortened.\n\t */\n\tshorten(branch: TreeBranch, nodeIdentifier: string): number | undefined;\n\n\t/**\n\t * Returns the stable id as a string if the identifier is decompressible and known by the id compressor. Otherwise, it will throw an error.\n\t *\n\t * This method is the inverse of {@link TreeIdentifierUtils.shorten}. If you lengthen an identifier\n\t * and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.\n\t *\n\t * @param branch - TreeBranch from where you want to get the id compressor to do the decompression.\n\t * @param nodeIdentifier - The local identifier that needs to be expanded.\n\t */\n\tlengthen(branch: TreeBranch, nodeIdentifier: number): string;\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 undefined.\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\tgetShort(node: TreeNode): number | undefined;\n\n\t/**\n\t * Creates and returns a long identifier.\n\t * The long identifier is a compressible, stable identifier generated by the tree's ID compressor.\n\t *\n\t * @param branch - TreeBranch from where you want to get the id compressor to generate the identifier from.\n\t */\n\tcreate(branch: TreeBranch): string;\n}\n\n/**\n * Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.\n * @remarks\n * Use via the {@link (TreeAlpha:variable)} singleton.\n *\n * The unhydrated node creation APIs in this interface do not support {@link ObjectSchemaOptions.allowUnknownOptionalFields | unknown optional fields}.\n * This is because unknown optional fields still must have a schema: its just that the schema may come from the document's stored schema.\n * Unhydrated nodes created via this interface are not associated with any document, so there is nowhere for them to get schema for unknown optional fields.\n * Note that {@link (TreeBeta:interface).clone} can create an unhydrated node with unknown optional fields, as it uses the source node's stored schema (if any).\n *\n * Export APIs in this interface include {@link ObjectSchemaOptions.allowUnknownOptionalFields | unknown optional fields}\n * if they are using {@link KeyEncodingOptions.allStoredKeys}.\n *\n * @privateRemarks\n * TODO:\n * There should be a way to provide a source for defaulted identifiers for unhydrated node creation, either via these APIs or some way to add them to its output later.\n * If an option were added to these APIs, it could also be used to enable unknown optional fields.\n *\n * @system @sealed @alpha\n */\nexport interface TreeAlpha {\n\t/**\n\t * Retrieve the {@link TreeBranch | branch}, if any, for the given node.\n\t * @param node - The node to query\n\t * @remarks If the node has already been inserted into the tree, this will return the branch associated with that node's {@link TreeView | view}.\n\t * Otherwise, it will return `undefined` (because the node has not yet been inserted and is therefore not part of a branch or view).\n\t *\n\t * This does not fork a new branch, but rather retrieves the _existing_ branch for the node.\n\t * To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.\n\t */\n\tbranch(node: TreeNode): TreeBranchAlpha | undefined;\n\n\t/**\n\t * Construct tree content that is compatible with the field defined by the provided `schema`.\n\t * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n\t * @param data - The data used to construct the field content.\n\t * @remarks\n\t * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.\n\t * This function exists as a generalization that can be used in other cases as well,\n\t * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.\n\t */\n\tcreate<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: InsertableField<TSchema>,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).importConcise}\n\t */\n\timportConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: ConciseTree | undefined,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).(exportConcise:1)}\n\t * @privateRemarks Note: this was retained on this interface because {@link (TreeAlpha:interface).importConcise} exists.\n\t * It should be removed if/when that is removed from this interface.\n\t */\n\texportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;\n\n\t/**\n\t * {@inheritDoc (TreeBeta:interface).(exportConcise:2)}\n\t * @privateRemarks Note: this was retained on this interface because {@link (TreeAlpha:interface).importConcise} exists.\n\t * It should be removed if/when that is removed from this interface.\n\t */\n\texportConcise(\n\t\tnode: TreeNode | TreeLeafValue | undefined,\n\t\toptions?: TreeEncodingOptions,\n\t): ConciseTree | undefined;\n\n\t/**\n\t * Construct tree content compatible with a field defined by the provided `schema`.\n\t * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n\t * @param data - The data used to construct the field content. See {@link (TreeAlpha:interface).(exportVerbose:1)}.\n\t * @remarks\n\t * This currently does not support input containing\n\t * {@link ObjectSchemaOptions.allowUnknownOptionalFields| unknown optional fields} but does support\n\t * {@link SchemaStaticsBeta.staged | staged} allowed types.\n\t * Non-empty default values for fields are currently not supported (must be provided in the input).\n\t * The content will be validated against the schema and an error will be thrown if out of schema.\n\t */\n\timportVerbose<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tdata: VerboseTree | undefined,\n\t\toptions?: TreeParsingOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\n\t/**\n\t * Copy a snapshot of the current version of a TreeNode into a JSON compatible plain old JavaScript Object (except for {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}).\n\t * Uses the {@link VerboseTree} format, with an explicit type on every node.\n\t *\n\t * @remarks\n\t * There are several cases this may be preferred to {@link (TreeBeta:interface).(exportConcise:1)}:\n\t *\n\t * 1. When not using {@link ITreeConfigurationOptions.preventAmbiguity} (or when using `useStableFieldKeys`), `exportConcise` can produce ambiguous data (the type may be unclear on some nodes).\n\t * `exportVerbose` will always be unambiguous and thus lossless.\n\t *\n\t * 2. When the data might be interpreted without access to the exact same view schema. In such cases, the types may be unknowable if not included.\n\t *\n\t * 3. When easy access to the type is desired.\n\t */\n\texportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;\n\n\t/**\n\t * Export the content of the provided `tree` in a compressed JSON compatible format.\n\t * @remarks\n\t * If an `idCompressor` is provided, it will be used to compress identifiers and thus will be needed to decompress the data.\n\t *\n\t * Always uses \"stored\" keys.\n\t * See {@link KeyEncodingOptions.allStoredKeys} for details.\n\t * @privateRemarks\n\t * TODO: It is currently not clear how to work with the idCompressors correctly in the package API.\n\t * Better APIs should probably be provided as there is currently no way to associate an un-hydrated tree with an idCompressor,\n\t * Nor get the correct idCompressor from a subtree to use when exporting it.\n\t * Additionally using `createIdCompressor` to make an idCompressor is `@legacy` and thus not intended for use in this API surface.\n\t * It would probably make more sense if we provided a way to get an idCompressor from the context of a node,\n\t * which could be optional (and settable if missing) for un0hydrated nodes and required for hydrated ones.\n\t * Add in a stable public API for creating idCompressors, and a way to get them from a tree (without view schema), and that should address the anticipated use-cases.\n\t */\n\texportCompressed(\n\t\ttree: TreeNode | TreeLeafValue,\n\t\toptions: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, \"minVersionForCollab\">,\n\t): JsonCompatible<IFluidHandle>;\n\n\t/**\n\t * Import data encoded by {@link (TreeAlpha:interface).exportCompressed}.\n\t *\n\t * @param schema - Schema with which the data must be compatible. This compatibility is not verified and must be ensured by the caller.\n\t * @param compressedData - Data compressed by {@link (TreeAlpha:interface).exportCompressed}.\n\t * @param options - If {@link (TreeAlpha:interface).exportCompressed} was given an `idCompressor`, it must be provided here.\n\t *\n\t * @remarks\n\t * If the data could have been encoded with a different schema, consider encoding the schema along side it using {@link extractPersistedSchema} and loading the data using {@link independentView}.\n\t *\n\t * @privateRemarks\n\t * This API could be improved:\n\t *\n\t * 1. It could validate that the schema is compatible, and return or throw an error in the invalid case (maybe add a \"try\" version).\n\t *\n\t * 2. A \"try\" version of this could return an error if the data isn't in a supported format (as determined by version and/or JasonValidator).\n\t *\n\t * 3. Requiring the caller provide a JsonValidator isn't the most friendly API. It might be practical to provide a default.\n\t */\n\timportCompressed<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tcompressedData: JsonCompatible<IFluidHandle>,\n\t\toptions: { idCompressor?: IIdCompressor } & ICodecOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\n\t/**\n\t * APIs for creating, converting, and retrieving identifiers.\n\t */\n\treadonly identifier: TreeIdentifierUtils;\n\n\t/**\n\t * The key of the given node under its parent.\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 * If `node` is the root node, this returns undefined.\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t */\n\tkey2(node: TreeNode): string | number | undefined;\n\n\t/**\n\t * Gets the child of the given node with the given property key if a child exists under that key.\n\t *\n\t * @remarks {@link ObjectSchemaOptions.allowUnknownOptionalFields | Unknown optional fields} of Object nodes will not be returned by this method.\n\t *\n\t * @param node - The parent node whose child is being requested.\n\t * @param key - The property key under the node under which the child is being requested.\n\t * For Object nodes, this is the developer-facing \"property key\", not the \"{@link SimpleObjectFieldSchema.storedKey | stored keys}\".\n\t *\n\t * @returns The child node or leaf value under the given key, or `undefined` if no such child exists.\n\t *\n\t * @see {@link (TreeAlpha:interface).key2}\n\t * @see {@link (TreeNodeApi:interface).parent}\n\t */\n\tchild(node: TreeNode, key: string | number): TreeNode | TreeLeafValue | undefined;\n\n\t/**\n\t * Gets the children of the provided node, paired with their property keys under the node.\n\t *\n\t * @remarks\n\t * No guarantees are made regarding the order of the children in the returned array.\n\t *\n\t * Optional properties of Object nodes with no value are not included in the result.\n\t *\n\t * {@link ObjectSchemaOptions.allowUnknownOptionalFields | Unknown optional fields} of Object nodes are not included in the result.\n\t *\n\t * @param node - The node whose children are being requested.\n\t *\n\t * @returns\n\t * An array of pairs of the form `[propertyKey, child]`.\n\t *\n\t * For Array nodes, the `propertyKey` is the index of the child in the array.\n\t *\n\t * For Object nodes, the returned `propertyKey`s are the developer-facing \"property keys\", not the \"{@link SimpleObjectFieldSchema.storedKey | stored keys}\".\n\t *\n\t * @see {@link (TreeAlpha:interface).key2}\n\t * @see {@link (TreeNodeApi:interface).parent}\n\t */\n\tchildren(\n\t\tnode: TreeNode,\n\t): Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]>;\n\n\t/**\n\t * Track observations of any TreeNode content.\n\t * @remarks\n\t * This subscribes to changes to any nodes content observed during `trackDuring`.\n\t *\n\t * Currently this does not support tracking parentage (see {@link (TreeAlpha:interface).trackObservationsOnce} for a version which does):\n\t * if accessing parentage during `trackDuring`, this will throw a usage error.\n\t *\n\t * This also does not track node status changes (e.g. whether a node is attached to a view or not).\n\t * The current behavior of checking status is unspecified: future versions may track it, error, or ignore it.\n\t *\n\t * These subscriptions remain active until `unsubscribe` is called: `onInvalidation` may be called multiple times.\n\t * See {@link (TreeAlpha:interface).trackObservationsOnce} for a version which automatically unsubscribes on the first invalidation.\n\t * @privateRemarks\n\t * This version, while more general than {@link (TreeAlpha:interface).trackObservationsOnce}, might be unnecessary.\n\t * Maybe this should be removed and only `trackObservationsOnce` kept.\n\t * Reevaluate this before stabilizing.\n\t */\n\ttrackObservations<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult>;\n\n\t/**\n\t * {@link (TreeAlpha:interface).trackObservations} except automatically unsubscribes when the first invalidation occurs.\n\t * @remarks\n\t * This also supports tracking parentage, unlike {@link (TreeAlpha:interface).trackObservations}, as long as the parent is not undefined.\n\t *\n\t * @example Simple cached value invalidation\n\t * ```typescript\n\t * // Compute and cache this \"foo\" value, and clear the cache when the fields read in the callback to compute it change.\n\t * cachedFoo ??= TreeAlpha.trackObservationsOnce(\n\t * \t() => {\n\t * \t\tcachedFoo = undefined;\n\t * \t},\n\t * \t() => nodeA.someChild.bar + nodeB.someChild.baz,\n\t * ).result;\n\t * ```\n\t *\n\t * That is equivalent to doing the following:\n\t * ```typescript\n\t * if (cachedFoo === undefined) {\n\t * \tcachedFoo = nodeA.someChild.bar + nodeB.someChild.baz;\n\t * \tconst invalidate = (): void => {\n\t * \t\tcachedFoo = undefined;\n\t * \t\tfor (const u of unsubscribe) {\n\t * \t\t\tu();\n\t * \t\t}\n\t * \t};\n\t * \tconst unsubscribe: (() => void)[] = [\n\t * \t\tTreeBeta.on(nodeA, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"someChild\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeB, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"someChild\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeA.someChild, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"bar\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t\tTreeBeta.on(nodeB.someChild, \"nodeChanged\", (data) => {\n\t * \t\t\tif (data.changedProperties.has(\"baz\")) {\n\t * \t\t\t\tinvalidate();\n\t * \t\t\t}\n\t * \t\t}),\n\t * \t];\n\t * }\n\t * ```\n\t * @example Cached derived schema property\n\t * ```typescript\n\t * const factory = new SchemaFactory(\"com.example\");\n\t * class Vector extends factory.object(\"Vector\", {\n\t * \tx: SchemaFactory.number,\n\t * \ty: SchemaFactory.number,\n\t * }) {\n\t * \t#length: number | undefined = undefined;\n\t * \tpublic length(): number {\n\t * \t\tif (this.#length === undefined) {\n\t * \t\t\tconst result = TreeAlpha.trackObservationsOnce(\n\t * \t\t\t\t() => {\n\t * \t\t\t\t\tthis.#length = undefined;\n\t * \t\t\t\t},\n\t * \t\t\t\t() => Math.hypot(this.x, this.y),\n\t * \t\t\t);\n\t * \t\t\tthis.#length = result.result;\n\t * \t\t}\n\t * \t\treturn this.#length;\n\t * \t}\n\t * }\n\t * const vec = new Vector({ x: 3, y: 4 });\n\t * assert.equal(vec.length(), 5);\n\t * vec.x = 0;\n\t * assert.equal(vec.length(), 4);\n\t * ```\n\t */\n\ttrackObservationsOnce<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult>;\n\n\t/**\n\t * Ensures that the provided content will be interpreted as the given schema when inserting into the tree.\n\t * @returns `content`, for convenience.\n\t * @remarks\n\t * If applicable, this will tag the given content with a {@link contentSchemaSymbol | special property} that indicates its intended schema.\n\t * The `content` will be interpreted as the given `schema` when later inserted into the tree.\n\t *\n\t * This does not validate that the content actually conforms to the given schema (such validation will be done at insert time).\n\t * If the content is not compatible with the tagged schema, an error will be thrown when the content is inserted.\n\t *\n\t * This is particularly useful when the content's schema cannot be inferred from its structure alone because it is compatible with multiple schemas.\n\t * @example\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"example\");\n\t * class Dog extends sf.object(\"Dog\", { name: sf.string() }) {}\n\t * class Cat extends sf.object(\"Cat\", { name: sf.string() }) {}\n\t * class Root extends sf.object(\"Root\", { pet: [Dog, Cat] }) {}\n\t * // ...\n\t * const pet = { name: \"Max\" };\n\t * view.root.pet = pet; // Error: ambiguous schema - is it a Dog or a Cat?\n\t * TreeAlpha.ensureSchema(Dog, pet); // Tags `pet` as a Dog.\n\t * view.root.pet = pet; // No error - it's a Dog.\n\t * ```\n\t */\n\ttagContentSchema<TSchema extends TreeNodeSchema, TContent extends InsertableField<TSchema>>(\n\t\tschema: TSchema,\n\t\tcontent: TContent,\n\t): TContent;\n}\n\n/**\n * Results from an operation with tracked observations.\n * @remarks\n * Results from {@link (TreeAlpha:interface).trackObservations} or {@link (TreeAlpha:interface).trackObservationsOnce}.\n * @sealed @alpha\n */\nexport interface ObservationResults<TResult> {\n\t/**\n\t * The result of the operation which had its observations tracked.\n\t */\n\treadonly result: TResult;\n\n\t/**\n\t * Call to unsubscribe from further invalidations.\n\t */\n\treadonly unsubscribe: () => void;\n}\n\n/**\n * Subscription to changes on a single node.\n * @remarks\n * Either tracks some set of fields, or all fields and can be updated to track more fields.\n */\nclass NodeSubscription {\n\t/**\n\t * If undefined, subscribes to all keys.\n\t * Otherwise only subscribes to the keys in the set.\n\t */\n\tprivate keys: Set<FieldKey> | undefined;\n\tprivate readonly unsubscribe: () => void;\n\tprivate constructor(\n\t\tprivate readonly onInvalidation: () => void,\n\t\tflexNode: FlexTreeNode,\n\t) {\n\t\t// TODO:Performance: It is possible to optimize this to not use the public TreeNode API.\n\t\tconst node = getOrCreateNodeFromInnerNode(flexNode);\n\t\tassert(node instanceof TreeNode, 0xc54 /* Unexpected leaf value */);\n\n\t\tconst handler = (data: NodeChangedData): void => {\n\t\t\tif (this.keys === undefined || data.changedProperties === undefined) {\n\t\t\t\tthis.onInvalidation();\n\t\t\t} else {\n\t\t\t\tlet keyMap: ReadonlyMap<FieldKey, string> | undefined;\n\t\t\t\tconst schema = treeNodeApi.schema(node);\n\t\t\t\tif (isObjectNodeSchema(schema)) {\n\t\t\t\t\tkeyMap = schema.storedKeyToPropertyKey;\n\t\t\t\t}\n\t\t\t\t// TODO:Performance: Ideally this would use Set.prototype.isDisjointFrom when available.\n\t\t\t\tfor (const flexKey of this.keys) {\n\t\t\t\t\t// TODO:Performance: doing everything at the flex tree layer could avoid this translation\n\t\t\t\t\tconst key = keyMap?.get(flexKey) ?? flexKey;\n\n\t\t\t\t\tif (data.changedProperties.has(key)) {\n\t\t\t\t\t\tthis.onInvalidation();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis.unsubscribe = TreeBeta.on(node, \"nodeChanged\", handler);\n\t}\n\n\t/**\n\t * Create an {@link Observer} which subscribes to what was observed in {@link NodeSubscription}s.\n\t */\n\tpublic static createObserver(\n\t\tinvalidate: () => void,\n\t\tonlyOnce = false,\n\t): { observer: Observer; unsubscribe: () => void } {\n\t\tconst subscriptions = new Map<FlexTreeNode, NodeSubscription>();\n\t\tconst observer: Observer = {\n\t\t\tobserveNodeFields(flexNode: FlexTreeNode): void {\n\t\t\t\tif (flexNode.value !== undefined) {\n\t\t\t\t\t// Leaf value, nothing to observe.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst subscription = subscriptions.get(flexNode);\n\t\t\t\tif (subscription !== undefined) {\n\t\t\t\t\t// Already subscribed to this node.\n\t\t\t\t\tsubscription.keys = undefined; // Now subscribed to all keys.\n\t\t\t\t} else {\n\t\t\t\t\tconst newSubscription = new NodeSubscription(invalidate, flexNode);\n\t\t\t\t\tsubscriptions.set(flexNode, newSubscription);\n\t\t\t\t}\n\t\t\t},\n\t\t\tobserveNodeField(flexNode: FlexTreeNode, key: FieldKey): void {\n\t\t\t\tif (flexNode.value !== undefined) {\n\t\t\t\t\t// Leaf value, nothing to observe.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst subscription = subscriptions.get(flexNode);\n\t\t\t\tif (subscription !== undefined) {\n\t\t\t\t\t// Already subscribed to this node: if not subscribed to all keys, subscribe to this one.\n\t\t\t\t\t// TODO:Performance: due to how JavaScript set ordering works,\n\t\t\t\t\t// it might be faster to check `has` and only add if not present in case the same field is viewed many times.\n\t\t\t\t\tsubscription.keys?.add(key);\n\t\t\t\t} else {\n\t\t\t\t\tconst newSubscription = new NodeSubscription(invalidate, flexNode);\n\t\t\t\t\tnewSubscription.keys = new Set([key]);\n\t\t\t\t\tsubscriptions.set(flexNode, newSubscription);\n\t\t\t\t}\n\t\t\t},\n\t\t\tobserveParentOf(node: FlexTreeNode): void {\n\t\t\t\t// Supporting parent tracking is more difficult that it might seem at first.\n\t\t\t\t// There are two main complicating factors:\n\t\t\t\t// 1. The parent may be undefined (the node is a root).\n\t\t\t\t// 2. If tracking this by subscribing to the parent's changes, then which events are subscribed to needs to be updated after the parent changes.\n\t\t\t\t//\n\t\t\t\t// If not supporting the first case (undefined parents), the second case gets problematic: edits which un-parent a node could error due to being unable to update the event subscription.\n\t\t\t\t// For now this is mitigated by only supporting one of tracking (non-undefined) parents or maintaining event subscriptions across edits.\n\n\t\t\t\tif (!onlyOnce) {\n\t\t\t\t\t// TODO: better APIS should be provided which make handling this case practical.\n\t\t\t\t\tthrow new UsageError(\"Observation tracking for parents is currently not supported.\");\n\t\t\t\t}\n\n\t\t\t\tconst parent = withObservation(undefined, () => node.parentField.parent);\n\n\t\t\t\tif (parent.parent === undefined) {\n\t\t\t\t\t// TODO: better APIS should be provided which make handling this case practical.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Observation tracking for parents is currently not supported when parent is undefined.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tobserver.observeNodeField(parent.parent, parent.key);\n\t\t\t},\n\t\t};\n\n\t\tlet subscribed = true;\n\n\t\treturn {\n\t\t\tobserver,\n\t\t\tunsubscribe: () => {\n\t\t\t\tif (!subscribed) {\n\t\t\t\t\tthrow new UsageError(\"Already unsubscribed\");\n\t\t\t\t}\n\t\t\t\tsubscribed = false;\n\t\t\t\tfor (const subscription of subscriptions.values()) {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Handles both {@link (TreeAlpha:interface).trackObservations} and {@link (TreeAlpha:interface).trackObservationsOnce}.\n */\nfunction trackObservations<TResult>(\n\tonInvalidation: () => void,\n\ttrackDuring: () => TResult,\n\tonlyOnce = false,\n): ObservationResults<TResult> {\n\tlet observing = true;\n\n\tconst invalidate = (): void => {\n\t\tif (observing) {\n\t\t\tthrow new UsageError(\"Cannot invalidate while tracking observations\");\n\t\t}\n\t\tonInvalidation();\n\t};\n\n\tconst { observer, unsubscribe } = NodeSubscription.createObserver(invalidate, onlyOnce);\n\tconst result = withObservation(observer, trackDuring);\n\tobserving = false;\n\n\treturn {\n\t\tresult,\n\t\tunsubscribe,\n\t};\n}\n\n/**\n * Extensions to {@link (Tree:variable)} and {@link (TreeBeta:variable)} which are not yet stable.\n * @see {@link (TreeAlpha:interface)}.\n * @alpha\n */\nexport const TreeAlpha: TreeAlpha = {\n\ttrackObservations<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult> {\n\t\treturn trackObservations(onInvalidation, trackDuring);\n\t},\n\n\ttrackObservationsOnce<TResult>(\n\t\tonInvalidation: () => void,\n\t\ttrackDuring: () => TResult,\n\t): ObservationResults<TResult> {\n\t\tconst result = trackObservations(\n\t\t\t() => {\n\t\t\t\t// trackObservations ensures no invalidation occurs while its running,\n\t\t\t\t// so this callback can only run after trackObservations has returns and thus result is defined.\n\t\t\t\tresult.unsubscribe();\n\t\t\t\tonInvalidation();\n\t\t\t},\n\t\t\ttrackDuring,\n\t\t\ttrue,\n\t\t);\n\t\treturn result;\n\t},\n\n\tbranch(node: TreeNode): TreeBranchAlpha | undefined {\n\t\tconst kernel = getKernel(node);\n\t\tif (!kernel.isHydrated()) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst view = kernel.anchorNode.anchorSet.slots.get(ViewSlot);\n\t\tassert(\n\t\t\tview instanceof SchematizingSimpleTreeView,\n\t\t\t0xa5c /* Unexpected view implementation */,\n\t\t);\n\t\treturn view;\n\t},\n\n\tcreate<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: InsertableField<TSchema>,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t> {\n\t\tconst mapTree = unhydratedFlexTreeFromInsertable(\n\t\t\tdata as InsertableField<UnsafeUnknownSchema>,\n\t\t\tschema,\n\t\t);\n\t\tconst result = mapTree === undefined ? undefined : getOrCreateNodeFromInnerNode(mapTree);\n\t\treturn result as Unhydrated<\n\t\t\tTSchema extends ImplicitFieldSchema\n\t\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t\t: TreeNode | TreeLeafValue | undefined\n\t\t>;\n\t},\n\n\timportConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tschema: UnsafeUnknownSchema extends TSchema\n\t\t\t? ImplicitFieldSchema\n\t\t\t: TSchema & ImplicitFieldSchema,\n\t\tdata: ConciseTree | undefined,\n\t): Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t> {\n\t\treturn importConcise(schema, data);\n\t},\n\n\texportConcise,\n\n\timportVerbose<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tdata: VerboseTree | undefined,\n\t\toptions?: TreeParsingOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\t\tconst config: TreeEncodingOptions = { ...options };\n\t\t// Create a config which is standalone, and thus can be used without having to refer back to the schema.\n\t\tconst schemalessConfig = applySchemaToParserOptions(schema, config);\n\t\tif (data === undefined) {\n\t\t\tconst field = normalizeFieldSchema(schema);\n\t\t\tif (field.kind !== FieldKind.Optional) {\n\t\t\t\tthrow new UsageError(\"undefined provided for non-optional field.\");\n\t\t\t}\n\t\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t\t}\n\t\tconst cursor = cursorFromVerbose(data, schemalessConfig);\n\t\treturn createFromCursor(\n\t\t\tschema,\n\t\t\tcursor,\n\t\t\tconvertField(normalizeFieldSchema(schema), toUnhydratedSchema),\n\t\t);\n\t},\n\n\texportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree {\n\t\tif (isTreeValue(node)) {\n\t\t\treturn node;\n\t\t}\n\t\tconst config: TreeEncodingOptions = { ...options };\n\n\t\tconst cursor = borrowCursorFromTreeNodeOrValue(node);\n\t\tconst kernel = getKernel(node);\n\t\treturn verboseFromCursor(cursor, kernel.context, config);\n\t},\n\n\texportCompressed(\n\t\tnode: TreeNode | TreeLeafValue,\n\t\toptions: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, \"minVersionForCollab\">,\n\t): JsonCompatible<IFluidHandle> {\n\t\tconst schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);\n\t\tconst codec = makeFieldBatchCodec({\n\t\t\tjsonValidator: FormatValidatorNoOp,\n\t\t\tminVersionForCollab: options.minVersionForCollab,\n\t\t});\n\t\tconst cursor = borrowFieldCursorFromTreeNodeOrValue(node);\n\t\tconst batch: FieldBatch = [cursor];\n\t\t// If none provided, create a compressor which will not compress anything.\n\t\tconst idCompressor = options.idCompressor ?? createIdCompressor();\n\n\t\t// Grabbing an existing stored schema from the node is important to ensure that unknown optional fields can be preserved.\n\t\t// Note that if the node is unhydrated, this can result in all staged allowed types being included in the schema, which might be undesired.\n\t\tconst storedSchema = isTreeNode(node)\n\t\t\t? getKernel(node).context.flexContext.schema\n\t\t\t: toInitialSchema(schema);\n\n\t\tconst context: FieldBatchEncodingContext = {\n\t\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\t\tidCompressor,\n\t\t\toriginatorId: idCompressor.localSessionId, // TODO: Why is this needed?\n\t\t\tschema: { schema: storedSchema, policy: defaultSchemaPolicy },\n\t\t};\n\t\tconst result = codec.encode(batch, context);\n\t\treturn result;\n\t},\n\n\timportCompressed<const TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t\tcompressedData: JsonCompatible<IFluidHandle>,\n\t\toptions: {\n\t\t\tidCompressor?: IIdCompressor;\n\t\t} & CodecWriteOptions,\n\t): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\t\tconst config = new TreeViewConfigurationAlpha({ schema });\n\t\tconst content: ViewContent = {\n\t\t\t// Always use a v1 schema codec for consistency.\n\t\t\t// TODO: reevaluate how staged schema should behave in schema import/export APIs before stabilizing this.\n\t\t\tschema: extractPersistedSchema(config.schema, FluidClientVersion.v2_0, () => true),\n\t\t\ttree: compressedData,\n\t\t\tidCompressor: options.idCompressor ?? createIdCompressor(),\n\t\t};\n\t\tconst view = independentInitializedView(config, options, content);\n\t\treturn TreeBeta.clone<TSchema>(view.root);\n\t},\n\n\tidentifier,\n\n\tkey2(node: TreeNode): string | number | undefined {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn undefined;\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\treturn getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t},\n\n\tchild: (\n\t\tnode: TreeNode,\n\t\tpropertyKey: string | number,\n\t): TreeNode | TreeLeafValue | undefined => {\n\t\tconst flexNode = getInnerNode(node);\n\t\tdebugAssert(\n\t\t\t() => !flexNode.context.isDisposed() || \"The provided tree node has been disposed.\",\n\t\t);\n\n\t\tconst schema = treeNodeApi.schema(node);\n\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tconst sequence = flexNode.tryGetField(EmptyKey) as FlexTreeSequenceField | undefined;\n\n\t\t\t\t// Empty sequence - cannot have children.\n\t\t\t\tif (sequence === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst index =\n\t\t\t\t\ttypeof propertyKey === \"number\"\n\t\t\t\t\t\t? propertyKey\n\t\t\t\t\t\t: asIndex(propertyKey, Number.POSITIVE_INFINITY);\n\n\t\t\t\t// If the key is not a valid index, then there is no corresponding child.\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst childFlexTree = sequence.at(index);\n\n\t\t\t\t// No child at the given index.\n\t\t\t\tif (childFlexTree === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn getOrCreateNodeFromInnerUnboxedNode(childFlexTree);\n\t\t\t}\n\t\t\tcase NodeKind.Map:\n\t\t\t\tif (typeof propertyKey !== \"string\") {\n\t\t\t\t\t// Map nodes only support string keys.\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t// Fall through\n\t\t\tcase NodeKind.Record:\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tlet storedKey: string | number = propertyKey;\n\t\t\t\tif (isObjectNodeSchema(schema)) {\n\t\t\t\t\tconst fieldSchema = schema.fields.get(String(propertyKey));\n\t\t\t\t\tif (fieldSchema === undefined) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tstoredKey = fieldSchema.storedKey;\n\t\t\t\t}\n\n\t\t\t\tconst field = flexNode.tryGetField(brand(String(storedKey)));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\tfail(0xbc3 /* Leaf schema associated with non-leaf tree node. */);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t},\n\n\tchildren(node: TreeNode): [propertyKey: string | number, child: TreeNode | TreeLeafValue][] {\n\t\tconst flexNode = getInnerNode(node);\n\t\tdebugAssert(\n\t\t\t() => !flexNode.context.isDisposed() || \"The provided tree node has been disposed.\",\n\t\t);\n\n\t\tconst schema = treeNodeApi.schema(node);\n\n\t\tconst result: [string | number, TreeNode | TreeLeafValue][] = [];\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tconst sequence = flexNode.tryGetField(EmptyKey) as FlexTreeSequenceField | undefined;\n\t\t\t\tif (sequence === undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tfor (let index = 0; index < sequence.length; index++) {\n\t\t\t\t\tconst childFlexTree = sequence.at(index);\n\t\t\t\t\tassert(childFlexTree !== undefined, 0xbc4 /* Sequence child was undefined. */);\n\t\t\t\t\tconst childTree = getOrCreateNodeFromInnerUnboxedNode(childFlexTree);\n\t\t\t\t\tresult.push([index, childTree]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Map:\n\t\t\tcase NodeKind.Record: {\n\t\t\t\tfor (const [key, flexField] of flexNode.fields) {\n\t\t\t\t\tconst childTreeNode = tryGetTreeNodeForField(flexField);\n\t\t\t\t\tif (childTreeNode !== undefined) {\n\t\t\t\t\t\tresult.push([key, childTreeNode]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xbc5 /* Expected object schema. */);\n\t\t\t\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\t\t\t\tconst storedKey = fieldSchema.storedKey;\n\t\t\t\t\tconst flexField = flexNode.tryGetField(brand(String(storedKey)));\n\t\t\t\t\tif (flexField !== undefined) {\n\t\t\t\t\t\tconst childTreeNode = tryGetTreeNodeForField(flexField);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildTreeNode !== undefined,\n\t\t\t\t\t\t\t0xbc6 /* Expected child tree node for field. */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tresult.push([propertyKey, childTreeNode]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\tfail(0xbc7 /* Leaf schema associated with non-leaf tree node. */);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t},\n\n\ttagContentSchema<TSchema extends TreeNodeSchema, TNode extends InsertableField<TSchema>>(\n\t\tschema: TSchema,\n\t\tnode: TNode,\n\t): TNode {\n\t\tif (typeof node === \"object\" && node !== null && !isFluidHandle(node)) {\n\t\t\tReflect.defineProperty(node, contentSchemaSymbol, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: schema.identifier,\n\t\t\t});\n\t\t}\n\t\treturn node;\n\t},\n};\n\n/**\n * Borrow a cursor from a field.\n * @remarks\n * The cursor must be put back to its original location before the node is used again.\n */\nfunction borrowFieldCursorFromTreeNodeOrValue(\n\tnode: TreeNode | TreeLeafValue | undefined,\n): ITreeCursorSynchronous {\n\tif (node === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\tconst cursor = borrowCursorFromTreeNodeOrValue(node);\n\t// TODO: avoid copy: borrow cursor from field instead.\n\tconst mapTree = mapTreeFromCursor(cursor);\n\treturn cursorForMapTreeField([mapTree]);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeCheckout.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeCheckout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EAOjC,KAAK,sBAAsB,EAE3B,KAAK,WAAW,EAQhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,8BAA8B,EAQnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,gBAAgB,EAGhB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAe,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4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AE,MAAM,GAAG,UAAU,GAAG,SAAS;IAKrD,IAAW,WAAW,IAAI,UAAU,CAEnC;IAaM,MAAM,IAAI,YAAY;IA2BtB,YAAY,CAClB,MAAM,EAAE,gBAAgB,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,GAC/D,IAAI;IAwBA,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAoBpC,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAOzC,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IACnC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAuB3D,YAAY,CAAC,SAAS,EAAE,gBAAgB,EAAE,sBAAsB,CAAC,EAAE,IAAI,GAAG,IAAI;IAW9E,OAAO,IAAI,IAAI;IAKf,CAAC,aAAa,CAAC,IAAI,IAAI;IAcvB,eAAe,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE;IAiB/E;;;;OAIG;IACI,IAAI,IAAI,IAAI;IAQnB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,gBAAgB;IAoDxB,OAAO,CAAC,sBAAsB;IAsB9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;;;;;;;OAQG;IACI,aAAa,CACnB,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,EACrC,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,GACjD,OAAO;IAWV,iGAAiG;IACjG,OAAO,CAAC,cAAc;CAStB"}
|
|
@@ -40,10 +40,8 @@ export function createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCod
|
|
|
40
40
|
jsonValidator: FormatValidatorNoOp,
|
|
41
41
|
minVersionForCollab: FluidClientVersion.v2_0,
|
|
42
42
|
};
|
|
43
|
-
const defaultFieldBatchVersion = 1;
|
|
44
43
|
const changeFamily = args?.changeFamily ??
|
|
45
|
-
new SharedTreeChangeFamily(revisionTagCodec, args?.fieldBatchCodec ??
|
|
46
|
-
makeFieldBatchCodec(defaultCodecOptions, defaultFieldBatchVersion), defaultCodecOptions, args?.chunkCompressionStrategy, idCompressor);
|
|
44
|
+
new SharedTreeChangeFamily(revisionTagCodec, args?.fieldBatchCodec ?? makeFieldBatchCodec(defaultCodecOptions), defaultCodecOptions, args?.chunkCompressionStrategy, idCompressor);
|
|
47
45
|
// TODO: If a branch is passed in, is it supposed to be local main?
|
|
48
46
|
// Otherwise shouldn't we set `isSharedBranch` to false?
|
|
49
47
|
const branch = args?.branch ??
|