@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
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
-
import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
|
|
7
|
-
import { EncodedNodeChangeset, } from "../modular-schema/index.js";
|
|
8
|
-
import { EncodedOptionalChangeset, EncodedRegisterId } from "./optionalFieldChangeFormatV1.js";
|
|
9
|
-
function makeRegisterIdCodec(revisionTagCodec) {
|
|
10
|
-
const changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);
|
|
11
|
-
return {
|
|
12
|
-
encode: (registerId, context) => {
|
|
13
|
-
if (registerId === "self") {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
return changeAtomIdCodec.encode(registerId, context);
|
|
17
|
-
},
|
|
18
|
-
decode: (registerId, context) => {
|
|
19
|
-
if (registerId === null) {
|
|
20
|
-
return "self";
|
|
21
|
-
}
|
|
22
|
-
return changeAtomIdCodec.decode(registerId, context);
|
|
23
|
-
},
|
|
24
|
-
encodedSchema: EncodedRegisterId,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export function makeOptionalFieldCodec(revisionTagCodec) {
|
|
28
|
-
const registerIdCodec = makeRegisterIdCodec(revisionTagCodec);
|
|
29
|
-
return {
|
|
30
|
-
encode: (change, context) => {
|
|
31
|
-
const encoded = {};
|
|
32
|
-
encoded.m = [];
|
|
33
|
-
if (change.valueReplace !== undefined) {
|
|
34
|
-
if (change.valueReplace.src !== undefined) {
|
|
35
|
-
encoded.m.push([
|
|
36
|
-
registerIdCodec.encode(change.valueReplace.src, context.baseContext),
|
|
37
|
-
registerIdCodec.encode("self", context.baseContext),
|
|
38
|
-
true,
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
// When the source of the replace is "self", the destination is a reserved ID that will only be used if
|
|
42
|
-
// the tree in the field is concurrently replaced.
|
|
43
|
-
if (change.valueReplace.isEmpty || change.valueReplace.src === "self") {
|
|
44
|
-
encoded.d = registerIdCodec.encode(change.valueReplace.dst, context.baseContext);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
encoded.m.push([
|
|
48
|
-
registerIdCodec.encode("self", context.baseContext),
|
|
49
|
-
registerIdCodec.encode(change.valueReplace.dst, context.baseContext),
|
|
50
|
-
false,
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const [src, dst] of change.moves) {
|
|
55
|
-
encoded.m.push([
|
|
56
|
-
registerIdCodec.encode(src, context.baseContext),
|
|
57
|
-
registerIdCodec.encode(dst, context.baseContext),
|
|
58
|
-
true,
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
if (encoded.m.length === 0) {
|
|
62
|
-
delete encoded.m;
|
|
63
|
-
}
|
|
64
|
-
if (change.childChanges.length > 0) {
|
|
65
|
-
encoded.c = [];
|
|
66
|
-
for (const [id, childChange] of change.childChanges) {
|
|
67
|
-
encoded.c.push([
|
|
68
|
-
registerIdCodec.encode(id, context.baseContext),
|
|
69
|
-
context.encodeNode(childChange),
|
|
70
|
-
]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return encoded;
|
|
74
|
-
},
|
|
75
|
-
decode: (encoded, context) => {
|
|
76
|
-
// The register that the node in the optional field is moved to upon detach
|
|
77
|
-
let detached;
|
|
78
|
-
// The register that the node is moved from to upon attaching that node in the optional field
|
|
79
|
-
let attached;
|
|
80
|
-
const moves = [];
|
|
81
|
-
if (encoded.m !== undefined) {
|
|
82
|
-
for (const [encodedSrc, encodedDst] of encoded.m) {
|
|
83
|
-
const src = registerIdCodec.decode(encodedSrc, context.baseContext);
|
|
84
|
-
const dst = registerIdCodec.decode(encodedDst, context.baseContext);
|
|
85
|
-
if (src === "self" || dst === "self") {
|
|
86
|
-
if (src === "self") {
|
|
87
|
-
assert(detached === undefined, 0x8d0 /* Multiple detached nodes */);
|
|
88
|
-
detached = dst;
|
|
89
|
-
}
|
|
90
|
-
if (dst === "self") {
|
|
91
|
-
assert(attached === undefined, 0x8d1 /* Multiple attached nodes */);
|
|
92
|
-
attached = src;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
moves.push([src, dst]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const decoded = {
|
|
101
|
-
moves,
|
|
102
|
-
childChanges: encoded.c?.map(([id, encodedChange]) => [
|
|
103
|
-
registerIdCodec.decode(id, context.baseContext),
|
|
104
|
-
context.decodeNode(encodedChange),
|
|
105
|
-
]) ?? [],
|
|
106
|
-
};
|
|
107
|
-
if (detached !== undefined && attached !== undefined) {
|
|
108
|
-
if (detached === "self" || attached === "self") {
|
|
109
|
-
assert(encoded.d !== undefined, 0x8d2 /* Invalid change: pin must have a reserved detach ID */);
|
|
110
|
-
const reserved = registerIdCodec.decode(encoded.d, context.baseContext);
|
|
111
|
-
assert(reserved !== "self", 0x8d3 /* Invalid reserved detach ID */);
|
|
112
|
-
decoded.valueReplace = { isEmpty: false, dst: reserved, src: "self" };
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
assert(encoded.d === undefined, 0x8d4 /* Invalid change: unexpected reserved detach ID on a change that detaches a node from the field */);
|
|
116
|
-
decoded.valueReplace = {
|
|
117
|
-
isEmpty: false,
|
|
118
|
-
dst: detached,
|
|
119
|
-
src: attached,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else if (attached !== undefined) {
|
|
124
|
-
assert(encoded.d !== undefined, 0x8d5 /* Invalid change: attach must have a reserved detach ID */);
|
|
125
|
-
const reserved = registerIdCodec.decode(encoded.d, context.baseContext);
|
|
126
|
-
assert(reserved !== "self", 0x8d6 /* Invalid reserved detach ID */);
|
|
127
|
-
decoded.valueReplace = {
|
|
128
|
-
isEmpty: true,
|
|
129
|
-
dst: reserved,
|
|
130
|
-
src: attached,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
else if (detached !== undefined) {
|
|
134
|
-
assert(encoded.d === undefined, 0x8d7 /* Invalid change: unexpected reserved detach ID on a change that detaches a node from the field */);
|
|
135
|
-
assert(detached !== "self", 0x8d8 /* Invalid detach ID */);
|
|
136
|
-
decoded.valueReplace = {
|
|
137
|
-
isEmpty: false,
|
|
138
|
-
dst: detached,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
else if (encoded.d !== undefined) {
|
|
142
|
-
const detachId = registerIdCodec.decode(encoded.d, context.baseContext);
|
|
143
|
-
assert(detachId !== "self", 0x8d9 /* Invalid detach ID */);
|
|
144
|
-
decoded.valueReplace = {
|
|
145
|
-
isEmpty: true,
|
|
146
|
-
dst: detachId,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
return decoded;
|
|
150
|
-
},
|
|
151
|
-
encodedSchema: EncodedOptionalChangeset(EncodedNodeChangeset),
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=optionalFieldCodecV1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optionalFieldCodecV1.js","sourceRoot":"","sources":["../../../src/feature-libraries/optional-field/optionalFieldCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACN,oBAAoB,GAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAG/F,SAAS,mBAAmB,CAC3B,gBAKC;IAED,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAClE,OAAO;QACN,MAAM,EAAE,CAAC,UAAsB,EAAE,OAA8B,EAAE,EAAE;YAClE,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC;YACb,CAAC;YACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,EAAE,CAAC,UAA6B,EAAE,OAA8B,EAAE,EAAE;YACzE,IAAI,UAAU,KAAK,IAAI,EAA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O,CAAC,YAAY,GAAG;oBACtB,OAAO,EAAE,KAAK;oBACd,GAAG,EAAE,QAAQ;iBACb,CAAC;YACH,CAAC;iBAAM,IAAI,OAAO,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;gBACpC,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;gBACxE,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBAC3D,OAAO,CAAC,YAAY,GAAG;oBACtB,OAAO,EAAE,IAAI;oBACb,GAAG,EAAE,QAAQ;iBACb,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,aAAa,EAAE,wBAAwB,CAAC,oBAAoB,CAAC;KAC7D,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport type { IJsonCodec } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { Mutable } from \"../../util/index.js\";\nimport { makeChangeAtomIdCodec } from \"../changeAtomIdCodec.js\";\nimport {\n\tEncodedNodeChangeset,\n\ttype FieldChangeEncodingContext,\n} from \"../modular-schema/index.js\";\n\nimport { EncodedOptionalChangeset, EncodedRegisterId } from \"./optionalFieldChangeFormatV1.js\";\nimport type { Move, OptionalChangeset, RegisterId } from \"./optionalFieldChangeTypes.js\";\n\nfunction makeRegisterIdCodec(\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n): IJsonCodec<RegisterId, EncodedRegisterId, EncodedRegisterId, ChangeEncodingContext> {\n\tconst changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);\n\treturn {\n\t\tencode: (registerId: RegisterId, context: ChangeEncodingContext) => {\n\t\t\tif (registerId === \"self\") {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn changeAtomIdCodec.encode(registerId, context);\n\t\t},\n\t\tdecode: (registerId: EncodedRegisterId, context: ChangeEncodingContext) => {\n\t\t\tif (registerId === null) {\n\t\t\t\treturn \"self\";\n\t\t\t}\n\t\t\treturn changeAtomIdCodec.decode(registerId, context);\n\t\t},\n\t\tencodedSchema: EncodedRegisterId,\n\t};\n}\n\nexport function makeOptionalFieldCodec(\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n): IJsonCodec<\n\tOptionalChangeset,\n\tEncodedOptionalChangeset<TAnySchema>,\n\tEncodedOptionalChangeset<TAnySchema>,\n\tFieldChangeEncodingContext\n> {\n\tconst registerIdCodec = makeRegisterIdCodec(revisionTagCodec);\n\n\treturn {\n\t\tencode: (change: OptionalChangeset, context: FieldChangeEncodingContext) => {\n\t\t\tconst encoded: EncodedOptionalChangeset<TAnySchema> = {};\n\t\t\tencoded.m = [];\n\n\t\t\tif (change.valueReplace !== undefined) {\n\t\t\t\tif (change.valueReplace.src !== undefined) {\n\t\t\t\t\tencoded.m.push([\n\t\t\t\t\t\tregisterIdCodec.encode(change.valueReplace.src, context.baseContext),\n\t\t\t\t\t\tregisterIdCodec.encode(\"self\", context.baseContext),\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\t// When the source of the replace is \"self\", the destination is a reserved ID that will only be used if\n\t\t\t\t// the tree in the field is concurrently replaced.\n\t\t\t\tif (change.valueReplace.isEmpty || change.valueReplace.src === \"self\") {\n\t\t\t\t\tencoded.d = registerIdCodec.encode(change.valueReplace.dst, context.baseContext);\n\t\t\t\t} else {\n\t\t\t\t\tencoded.m.push([\n\t\t\t\t\t\tregisterIdCodec.encode(\"self\", context.baseContext),\n\t\t\t\t\t\tregisterIdCodec.encode(change.valueReplace.dst, context.baseContext),\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [src, dst] of change.moves) {\n\t\t\t\tencoded.m.push([\n\t\t\t\t\tregisterIdCodec.encode(src, context.baseContext),\n\t\t\t\t\tregisterIdCodec.encode(dst, context.baseContext),\n\t\t\t\t\ttrue,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\tif (encoded.m.length === 0) {\n\t\t\t\tdelete encoded.m;\n\t\t\t}\n\n\t\t\tif (change.childChanges.length > 0) {\n\t\t\t\tencoded.c = [];\n\t\t\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\t\t\tencoded.c.push([\n\t\t\t\t\t\tregisterIdCodec.encode(id, context.baseContext),\n\t\t\t\t\t\tcontext.encodeNode(childChange),\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn encoded;\n\t\t},\n\n\t\tdecode: (\n\t\t\tencoded: EncodedOptionalChangeset<TAnySchema>,\n\t\t\tcontext: FieldChangeEncodingContext,\n\t\t) => {\n\t\t\t// The register that the node in the optional field is moved to upon detach\n\t\t\tlet detached: RegisterId | undefined;\n\t\t\t// The register that the node is moved from to upon attaching that node in the optional field\n\t\t\tlet attached: RegisterId | undefined;\n\t\t\tconst moves: Move[] = [];\n\t\t\tif (encoded.m !== undefined) {\n\t\t\t\tfor (const [encodedSrc, encodedDst] of encoded.m) {\n\t\t\t\t\tconst src = registerIdCodec.decode(encodedSrc, context.baseContext);\n\t\t\t\t\tconst dst = registerIdCodec.decode(encodedDst, context.baseContext);\n\t\t\t\t\tif (src === \"self\" || dst === \"self\") {\n\t\t\t\t\t\tif (src === \"self\") {\n\t\t\t\t\t\t\tassert(detached === undefined, 0x8d0 /* Multiple detached nodes */);\n\t\t\t\t\t\t\tdetached = dst;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (dst === \"self\") {\n\t\t\t\t\t\t\tassert(attached === undefined, 0x8d1 /* Multiple attached nodes */);\n\t\t\t\t\t\t\tattached = src;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmoves.push([src, dst]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst decoded: Mutable<OptionalChangeset> = {\n\t\t\t\tmoves,\n\t\t\t\tchildChanges:\n\t\t\t\t\tencoded.c?.map(([id, encodedChange]) => [\n\t\t\t\t\t\tregisterIdCodec.decode(id, context.baseContext),\n\t\t\t\t\t\tcontext.decodeNode(encodedChange),\n\t\t\t\t\t]) ?? [],\n\t\t\t};\n\n\t\t\tif (detached !== undefined && attached !== undefined) {\n\t\t\t\tif (detached === \"self\" || attached === \"self\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tencoded.d !== undefined,\n\t\t\t\t\t\t0x8d2 /* Invalid change: pin must have a reserved detach ID */,\n\t\t\t\t\t);\n\t\t\t\t\tconst reserved = registerIdCodec.decode(encoded.d, context.baseContext);\n\t\t\t\t\tassert(reserved !== \"self\", 0x8d3 /* Invalid reserved detach ID */);\n\t\t\t\t\tdecoded.valueReplace = { isEmpty: false, dst: reserved, src: \"self\" };\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tencoded.d === undefined,\n\t\t\t\t\t\t0x8d4 /* Invalid change: unexpected reserved detach ID on a change that detaches a node from the field */,\n\t\t\t\t\t);\n\t\t\t\t\tdecoded.valueReplace = {\n\t\t\t\t\t\tisEmpty: false,\n\t\t\t\t\t\tdst: detached,\n\t\t\t\t\t\tsrc: attached,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} else if (attached !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tencoded.d !== undefined,\n\t\t\t\t\t0x8d5 /* Invalid change: attach must have a reserved detach ID */,\n\t\t\t\t);\n\t\t\t\tconst reserved = registerIdCodec.decode(encoded.d, context.baseContext);\n\t\t\t\tassert(reserved !== \"self\", 0x8d6 /* Invalid reserved detach ID */);\n\t\t\t\tdecoded.valueReplace = {\n\t\t\t\t\tisEmpty: true,\n\t\t\t\t\tdst: reserved,\n\t\t\t\t\tsrc: attached,\n\t\t\t\t};\n\t\t\t} else if (detached !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tencoded.d === undefined,\n\t\t\t\t\t0x8d7 /* Invalid change: unexpected reserved detach ID on a change that detaches a node from the field */,\n\t\t\t\t);\n\t\t\t\tassert(detached !== \"self\", 0x8d8 /* Invalid detach ID */);\n\t\t\t\tdecoded.valueReplace = {\n\t\t\t\t\tisEmpty: false,\n\t\t\t\t\tdst: detached,\n\t\t\t\t};\n\t\t\t} else if (encoded.d !== undefined) {\n\t\t\t\tconst detachId = registerIdCodec.decode(encoded.d, context.baseContext);\n\t\t\t\tassert(detachId !== \"self\", 0x8d9 /* Invalid detach ID */);\n\t\t\t\tdecoded.valueReplace = {\n\t\t\t\t\tisEmpty: true,\n\t\t\t\t\tdst: detachId,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t\tencodedSchema: EncodedOptionalChangeset(EncodedNodeChangeset),\n\t};\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type IJsonCodec } from "../../codec/index.js";
|
|
6
|
-
import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag } from "../../core/index.js";
|
|
7
|
-
import { type JsonCompatibleReadOnly } from "../../util/index.js";
|
|
8
|
-
import { type FieldChangeEncodingContext } from "../modular-schema/index.js";
|
|
9
|
-
import { type Changeset } from "./types.js";
|
|
10
|
-
export declare function makeV1Codec(revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>): IJsonCodec<Changeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, FieldChangeEncodingContext>;
|
|
11
|
-
//# sourceMappingURL=sequenceFieldCodecV1.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceFieldCodecV1.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EACX,qBAAqB,EAErB,kBAAkB,EAClB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,sBAAsB,EAAuB,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAIN,KAAK,SAAS,EAUd,MAAM,YAAY,CAAC;AAGpB,wBAAgB,WAAW,CAC1B,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,GACC,UAAU,CACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,CA0RA"}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
6
|
-
import { DiscriminatedUnionDispatcher } from "../../codec/index.js";
|
|
7
|
-
import { brand } from "../../util/index.js";
|
|
8
|
-
import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
|
|
9
|
-
import { EncodedNodeChangeset, } from "../modular-schema/index.js";
|
|
10
|
-
import { Changeset as ChangesetSchema, DetachIdOverrideType, } from "./formatV1.js";
|
|
11
|
-
import { NoopMarkType, } from "./types.js";
|
|
12
|
-
import { isNoopMark, normalizeCellRename } from "./utils.js";
|
|
13
|
-
export function makeV1Codec(revisionTagCodec) {
|
|
14
|
-
const changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);
|
|
15
|
-
const markEffectCodec = {
|
|
16
|
-
encode(effect, context) {
|
|
17
|
-
function encodeRevision(revision) {
|
|
18
|
-
if (revision === undefined || revision === context.revision) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
return revisionTagCodec.encode(revision, context);
|
|
22
|
-
}
|
|
23
|
-
const type = effect.type;
|
|
24
|
-
switch (type) {
|
|
25
|
-
case "MoveIn":
|
|
26
|
-
return {
|
|
27
|
-
moveIn: {
|
|
28
|
-
revision: encodeRevision(effect.revision),
|
|
29
|
-
finalEndpoint: effect.finalEndpoint === undefined
|
|
30
|
-
? undefined
|
|
31
|
-
: changeAtomIdCodec.encode(effect.finalEndpoint, context),
|
|
32
|
-
id: effect.id,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
case "Insert":
|
|
36
|
-
return {
|
|
37
|
-
insert: {
|
|
38
|
-
revision: encodeRevision(effect.revision),
|
|
39
|
-
id: effect.id,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
case "Remove":
|
|
43
|
-
return {
|
|
44
|
-
delete: {
|
|
45
|
-
revision: encodeRevision(effect.revision),
|
|
46
|
-
idOverride: effect.idOverride === undefined
|
|
47
|
-
? undefined
|
|
48
|
-
: {
|
|
49
|
-
// An arbitrary override type is chosen here. It only had an impact on lineage logic which was not enabled in V1.
|
|
50
|
-
type: DetachIdOverrideType.Unattach,
|
|
51
|
-
id: cellIdCodec.encode(effect.idOverride, context),
|
|
52
|
-
},
|
|
53
|
-
id: effect.id,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
case "MoveOut":
|
|
57
|
-
return {
|
|
58
|
-
moveOut: {
|
|
59
|
-
revision: encodeRevision(effect.revision),
|
|
60
|
-
finalEndpoint: effect.finalEndpoint === undefined
|
|
61
|
-
? undefined
|
|
62
|
-
: changeAtomIdCodec.encode(effect.finalEndpoint, context),
|
|
63
|
-
idOverride: effect.idOverride === undefined
|
|
64
|
-
? undefined
|
|
65
|
-
: {
|
|
66
|
-
// An arbitrary override type is chosen here. It only had an impact on lineage logic which was not enabled in V1.
|
|
67
|
-
type: DetachIdOverrideType.Unattach,
|
|
68
|
-
id: cellIdCodec.encode(effect.idOverride, context),
|
|
69
|
-
},
|
|
70
|
-
id: effect.id,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
case "AttachAndDetach":
|
|
74
|
-
return {
|
|
75
|
-
attachAndDetach: {
|
|
76
|
-
attach: markEffectCodec.encode(effect.attach, context),
|
|
77
|
-
detach: markEffectCodec.encode(effect.detach, context),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
case "Rename":
|
|
81
|
-
// In documents generated by clients on release >=2.2 (i.e., running the code from the PR that added this comment),
|
|
82
|
-
// renames are encoded as AttachAndDetach with a special id.
|
|
83
|
-
// This ensures forward-compatibility of clients on release <=2.1 with documents/ops generated by clients on release >=2.2.
|
|
84
|
-
return markEffectCodec.encode({
|
|
85
|
-
type: "AttachAndDetach",
|
|
86
|
-
attach: { type: "MoveIn", id: renameLocalId },
|
|
87
|
-
detach: { type: "MoveOut", id: renameLocalId, idOverride: effect.idOverride },
|
|
88
|
-
}, context);
|
|
89
|
-
case NoopMarkType:
|
|
90
|
-
fail(0xb2b /* Mark type: NoopMarkType should not be encoded. */);
|
|
91
|
-
default:
|
|
92
|
-
unreachableCase(type);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
decode(encoded, context) {
|
|
96
|
-
return decoderLibrary.dispatch(encoded, context);
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
function decodeRevision(encodedRevision, context) {
|
|
100
|
-
if (encodedRevision === undefined) {
|
|
101
|
-
assert(context.revision !== undefined, 0x965 /* Implicit revision should be provided */);
|
|
102
|
-
return context.revision;
|
|
103
|
-
}
|
|
104
|
-
return revisionTagCodec.decode(encodedRevision, context);
|
|
105
|
-
}
|
|
106
|
-
const decoderLibrary = new DiscriminatedUnionDispatcher({
|
|
107
|
-
moveIn(encoded, context) {
|
|
108
|
-
const { id, finalEndpoint, revision } = encoded;
|
|
109
|
-
const mark = {
|
|
110
|
-
type: "MoveIn",
|
|
111
|
-
id,
|
|
112
|
-
};
|
|
113
|
-
mark.revision = decodeRevision(revision, context);
|
|
114
|
-
if (finalEndpoint !== undefined) {
|
|
115
|
-
mark.finalEndpoint = changeAtomIdCodec.decode(finalEndpoint, context);
|
|
116
|
-
}
|
|
117
|
-
return mark;
|
|
118
|
-
},
|
|
119
|
-
insert(encoded, context) {
|
|
120
|
-
const { id, revision } = encoded;
|
|
121
|
-
const mark = {
|
|
122
|
-
type: "Insert",
|
|
123
|
-
id,
|
|
124
|
-
};
|
|
125
|
-
mark.revision = decodeRevision(revision, context);
|
|
126
|
-
return mark;
|
|
127
|
-
},
|
|
128
|
-
delete(encoded, context) {
|
|
129
|
-
const { id, revision, idOverride } = encoded;
|
|
130
|
-
const mark = {
|
|
131
|
-
type: "Remove",
|
|
132
|
-
id,
|
|
133
|
-
};
|
|
134
|
-
mark.revision = decodeRevision(revision, context);
|
|
135
|
-
if (idOverride !== undefined) {
|
|
136
|
-
mark.idOverride = cellIdCodec.decode(idOverride.id, context);
|
|
137
|
-
}
|
|
138
|
-
return mark;
|
|
139
|
-
},
|
|
140
|
-
moveOut(encoded, context) {
|
|
141
|
-
const { id, finalEndpoint, idOverride, revision } = encoded;
|
|
142
|
-
const mark = {
|
|
143
|
-
type: "MoveOut",
|
|
144
|
-
id,
|
|
145
|
-
};
|
|
146
|
-
mark.revision = decodeRevision(revision, context);
|
|
147
|
-
if (finalEndpoint !== undefined) {
|
|
148
|
-
mark.finalEndpoint = changeAtomIdCodec.decode(finalEndpoint, context);
|
|
149
|
-
}
|
|
150
|
-
if (idOverride !== undefined) {
|
|
151
|
-
mark.idOverride = cellIdCodec.decode(idOverride.id, context);
|
|
152
|
-
}
|
|
153
|
-
return mark;
|
|
154
|
-
},
|
|
155
|
-
attachAndDetach(encoded, context) {
|
|
156
|
-
const attach = decoderLibrary.dispatch(encoded.attach, context);
|
|
157
|
-
const detach = decoderLibrary.dispatch(encoded.detach, context);
|
|
158
|
-
// In documents generated by clients on release >=2.2 (i.e., running the code from the PR that added this comment),
|
|
159
|
-
// renames are encoded as AttachAndDetach with a special id.
|
|
160
|
-
// This ensures forward-compatibility of clients on release <=2.1 with documents/ops generated by clients on release >=2.2.
|
|
161
|
-
if (attach.id === renameLocalId) {
|
|
162
|
-
assert(detach.idOverride !== undefined, 0x9f7 /* Rename must have idOverride */);
|
|
163
|
-
return {
|
|
164
|
-
type: "Rename",
|
|
165
|
-
idOverride: detach.idOverride,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
type: "AttachAndDetach",
|
|
170
|
-
attach,
|
|
171
|
-
detach,
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
const cellIdCodec = {
|
|
176
|
-
encode: (cellId, context) => {
|
|
177
|
-
const encoded = {
|
|
178
|
-
atom: changeAtomIdCodec.encode(cellId, context),
|
|
179
|
-
};
|
|
180
|
-
return encoded;
|
|
181
|
-
},
|
|
182
|
-
decode: ({ atom }, context) => {
|
|
183
|
-
return changeAtomIdCodec.decode(atom, context);
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
return {
|
|
187
|
-
encode: (changeset, context) => {
|
|
188
|
-
const jsonMarks = [];
|
|
189
|
-
for (const mark of changeset) {
|
|
190
|
-
const encodedMark = {
|
|
191
|
-
count: mark.count,
|
|
192
|
-
};
|
|
193
|
-
if (!isNoopMark(mark)) {
|
|
194
|
-
encodedMark.effect = markEffectCodec.encode(mark, context.baseContext);
|
|
195
|
-
}
|
|
196
|
-
if (mark.cellId !== undefined) {
|
|
197
|
-
encodedMark.cellId = cellIdCodec.encode(mark.cellId, context.baseContext);
|
|
198
|
-
}
|
|
199
|
-
if (mark.changes !== undefined) {
|
|
200
|
-
encodedMark.changes = context.encodeNode(mark.changes);
|
|
201
|
-
}
|
|
202
|
-
jsonMarks.push(encodedMark);
|
|
203
|
-
}
|
|
204
|
-
return jsonMarks;
|
|
205
|
-
},
|
|
206
|
-
decode: (changeset, context) => {
|
|
207
|
-
const marks = [];
|
|
208
|
-
for (const mark of changeset) {
|
|
209
|
-
const decodedMark = {
|
|
210
|
-
count: mark.count,
|
|
211
|
-
};
|
|
212
|
-
if (mark.effect !== undefined) {
|
|
213
|
-
Object.assign(decodedMark, markEffectCodec.decode(mark.effect, context.baseContext));
|
|
214
|
-
}
|
|
215
|
-
if (mark.cellId !== undefined) {
|
|
216
|
-
decodedMark.cellId = cellIdCodec.decode(mark.cellId, context.baseContext);
|
|
217
|
-
}
|
|
218
|
-
// Type deduction wrongly narrows the type of `decodedMark` to `NoopMark & HasMarkFields`.
|
|
219
|
-
// We declare a new casted copy of `decodedMark` to recover the correct type.
|
|
220
|
-
let decodedMark2 = decodedMark;
|
|
221
|
-
if (decodedMark2.cellId !== undefined && decodedMark2.type === "AttachAndDetach") {
|
|
222
|
-
// In documents generated by clients on release <=2.1 (i.e., not running the code from the PR that added this comment),
|
|
223
|
-
// rename-like AttachAndDetach marks are not normalized to Rename marks thus requiring this normalization step.
|
|
224
|
-
// This ensures backward compatibility with documents generated by clients on release <=2.1.
|
|
225
|
-
decodedMark2 = normalizeCellRename(decodedMark2.cellId, decodedMark2.count, decodedMark2.attach, decodedMark2.detach);
|
|
226
|
-
}
|
|
227
|
-
if (mark.changes !== undefined) {
|
|
228
|
-
decodedMark2.changes = context.decodeNode(mark.changes);
|
|
229
|
-
}
|
|
230
|
-
marks.push(decodedMark2);
|
|
231
|
-
}
|
|
232
|
-
return marks;
|
|
233
|
-
},
|
|
234
|
-
encodedSchema: ChangesetSchema(EncodedNodeChangeset),
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Arbitrary ID that is used to indicate a Rename effect.
|
|
239
|
-
*/
|
|
240
|
-
const renameLocalId = brand(-1);
|
|
241
|
-
//# sourceMappingURL=sequenceFieldCodecV1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceFieldCodecV1.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EAAE,4BAA4B,EAAmB,MAAM,sBAAsB,CAAC;AAOrF,OAAO,EAA6C,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACN,oBAAoB,GAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,SAAS,IAAI,eAAe,EAC5B,oBAAoB,GAEpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAWN,YAAY,GAGZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,UAAU,WAAW,CAC1B,gBAKC;IAOD,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAClE,MAAM,eAAe,GAKjB;QACH,MAAM,CAAC,MAAkB,EAAE,OAA8B;YACxD,SAAS,cAAc,CACtB,QAAiC;gBAEjC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;oBAC7D,OAAO,SAAS,CAAC;gBAClB,CAAC;gBAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,CA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IAAI,CAAC,YAAY,CAAC,CAAC;YAC1B,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QACD,aAAa,EAAE,eAAe,CAAC,oBAAoB,CAAC;KACpD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,aAAa,GAAqB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport { DiscriminatedUnionDispatcher, type IJsonCodec } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangesetLocalId,\n\tEncodedRevisionTag,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport { type JsonCompatibleReadOnly, type Mutable, brand } from \"../../util/index.js\";\nimport { makeChangeAtomIdCodec } from \"../changeAtomIdCodec.js\";\nimport {\n\tEncodedNodeChangeset,\n\ttype FieldChangeEncodingContext,\n} from \"../modular-schema/index.js\";\n\nimport {\n\tChangeset as ChangesetSchema,\n\tDetachIdOverrideType,\n\ttype Encoded,\n} from \"./formatV1.js\";\nimport {\n\ttype Attach,\n\ttype AttachAndDetach,\n\ttype CellId,\n\ttype Changeset,\n\ttype Detach,\n\ttype Insert,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MoveIn,\n\ttype MoveOut,\n\tNoopMarkType,\n\ttype Remove,\n\ttype Rename,\n} from \"./types.js\";\nimport { isNoopMark, normalizeCellRename } from \"./utils.js\";\n\nexport function makeV1Codec(\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n): IJsonCodec<\n\tChangeset,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tFieldChangeEncodingContext\n> {\n\tconst changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);\n\tconst markEffectCodec: IJsonCodec<\n\t\tMarkEffect,\n\t\tEncoded.MarkEffect,\n\t\tEncoded.MarkEffect,\n\t\tChangeEncodingContext\n\t> = {\n\t\tencode(effect: MarkEffect, context: ChangeEncodingContext): Encoded.MarkEffect {\n\t\t\tfunction encodeRevision(\n\t\t\t\trevision: RevisionTag | undefined,\n\t\t\t): EncodedRevisionTag | undefined {\n\t\t\t\tif (revision === undefined || revision === context.revision) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn revisionTagCodec.encode(revision, context);\n\t\t\t}\n\n\t\t\tconst type = effect.type;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"MoveIn\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmoveIn: {\n\t\t\t\t\t\t\trevision: encodeRevision(effect.revision),\n\t\t\t\t\t\t\tfinalEndpoint:\n\t\t\t\t\t\t\t\teffect.finalEndpoint === undefined\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: changeAtomIdCodec.encode(effect.finalEndpoint, context),\n\t\t\t\t\t\t\tid: effect.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\tcase \"Insert\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tinsert: {\n\t\t\t\t\t\t\trevision: encodeRevision(effect.revision),\n\t\t\t\t\t\t\tid: effect.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\tcase \"Remove\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdelete: {\n\t\t\t\t\t\t\trevision: encodeRevision(effect.revision),\n\t\t\t\t\t\t\tidOverride:\n\t\t\t\t\t\t\t\teffect.idOverride === undefined\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t// An arbitrary override type is chosen here. It only had an impact on lineage logic which was not enabled in V1.\n\t\t\t\t\t\t\t\t\t\t\ttype: DetachIdOverrideType.Unattach,\n\t\t\t\t\t\t\t\t\t\t\tid: cellIdCodec.encode(effect.idOverride, context),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tid: effect.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\tcase \"MoveOut\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmoveOut: {\n\t\t\t\t\t\t\trevision: encodeRevision(effect.revision),\n\t\t\t\t\t\t\tfinalEndpoint:\n\t\t\t\t\t\t\t\teffect.finalEndpoint === undefined\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: changeAtomIdCodec.encode(effect.finalEndpoint, context),\n\t\t\t\t\t\t\tidOverride:\n\t\t\t\t\t\t\t\teffect.idOverride === undefined\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t// An arbitrary override type is chosen here. It only had an impact on lineage logic which was not enabled in V1.\n\t\t\t\t\t\t\t\t\t\t\ttype: DetachIdOverrideType.Unattach,\n\t\t\t\t\t\t\t\t\t\t\tid: cellIdCodec.encode(effect.idOverride, context),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tid: effect.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\tcase \"AttachAndDetach\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tattachAndDetach: {\n\t\t\t\t\t\t\tattach: markEffectCodec.encode(effect.attach, context) as Encoded.Attach,\n\t\t\t\t\t\t\tdetach: markEffectCodec.encode(effect.detach, context) as Encoded.Detach,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\tcase \"Rename\":\n\t\t\t\t\t// In documents generated by clients on release >=2.2 (i.e., running the code from the PR that added this comment),\n\t\t\t\t\t// renames are encoded as AttachAndDetach with a special id.\n\t\t\t\t\t// This ensures forward-compatibility of clients on release <=2.1 with documents/ops generated by clients on release >=2.2.\n\t\t\t\t\treturn markEffectCodec.encode(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"AttachAndDetach\",\n\t\t\t\t\t\t\tattach: { type: \"MoveIn\", id: renameLocalId },\n\t\t\t\t\t\t\tdetach: { type: \"MoveOut\", id: renameLocalId, idOverride: effect.idOverride },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t);\n\t\t\t\tcase NoopMarkType:\n\t\t\t\t\tfail(0xb2b /* Mark type: NoopMarkType should not be encoded. */);\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t},\n\t\tdecode(encoded: Encoded.MarkEffect, context: ChangeEncodingContext): MarkEffect {\n\t\t\treturn decoderLibrary.dispatch(encoded, context);\n\t\t},\n\t};\n\n\tfunction decodeRevision(\n\t\tencodedRevision: EncodedRevisionTag | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): RevisionTag {\n\t\tif (encodedRevision === undefined) {\n\t\t\tassert(context.revision !== undefined, 0x965 /* Implicit revision should be provided */);\n\t\t\treturn context.revision;\n\t\t}\n\n\t\treturn revisionTagCodec.decode(encodedRevision, context);\n\t}\n\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncoded.MarkEffect,\n\t\t/* args */ [context: ChangeEncodingContext],\n\t\tMarkEffect\n\t>({\n\t\tmoveIn(encoded: Encoded.MoveIn, context: ChangeEncodingContext): MoveIn {\n\t\t\tconst { id, finalEndpoint, revision } = encoded;\n\t\t\tconst mark: MoveIn = {\n\t\t\t\ttype: \"MoveIn\",\n\t\t\t\tid,\n\t\t\t};\n\n\t\t\tmark.revision = decodeRevision(revision, context);\n\t\t\tif (finalEndpoint !== undefined) {\n\t\t\t\tmark.finalEndpoint = changeAtomIdCodec.decode(finalEndpoint, context);\n\t\t\t}\n\t\t\treturn mark;\n\t\t},\n\t\tinsert(encoded: Encoded.Insert, context: ChangeEncodingContext): Insert {\n\t\t\tconst { id, revision } = encoded;\n\t\t\tconst mark: Insert = {\n\t\t\t\ttype: \"Insert\",\n\t\t\t\tid,\n\t\t\t};\n\n\t\t\tmark.revision = decodeRevision(revision, context);\n\t\t\treturn mark;\n\t\t},\n\t\tdelete(encoded: Encoded.Remove, context: ChangeEncodingContext): Remove {\n\t\t\tconst { id, revision, idOverride } = encoded;\n\t\t\tconst mark: Mutable<Remove> = {\n\t\t\t\ttype: \"Remove\",\n\t\t\t\tid,\n\t\t\t};\n\n\t\t\tmark.revision = decodeRevision(revision, context);\n\t\t\tif (idOverride !== undefined) {\n\t\t\t\tmark.idOverride = cellIdCodec.decode(idOverride.id, context);\n\t\t\t}\n\t\t\treturn mark;\n\t\t},\n\t\tmoveOut(encoded: Encoded.MoveOut, context: ChangeEncodingContext): MoveOut {\n\t\t\tconst { id, finalEndpoint, idOverride, revision } = encoded;\n\t\t\tconst mark: Mutable<MoveOut> = {\n\t\t\t\ttype: \"MoveOut\",\n\t\t\t\tid,\n\t\t\t};\n\n\t\t\tmark.revision = decodeRevision(revision, context);\n\t\t\tif (finalEndpoint !== undefined) {\n\t\t\t\tmark.finalEndpoint = changeAtomIdCodec.decode(finalEndpoint, context);\n\t\t\t}\n\t\t\tif (idOverride !== undefined) {\n\t\t\t\tmark.idOverride = cellIdCodec.decode(idOverride.id, context);\n\t\t\t}\n\n\t\t\treturn mark;\n\t\t},\n\t\tattachAndDetach(\n\t\t\tencoded: Encoded.AttachAndDetach,\n\t\t\tcontext: ChangeEncodingContext,\n\t\t): AttachAndDetach | Rename {\n\t\t\tconst attach = decoderLibrary.dispatch(encoded.attach, context) as Attach;\n\t\t\tconst detach = decoderLibrary.dispatch(encoded.detach, context) as Detach;\n\t\t\t// In documents generated by clients on release >=2.2 (i.e., running the code from the PR that added this comment),\n\t\t\t// renames are encoded as AttachAndDetach with a special id.\n\t\t\t// This ensures forward-compatibility of clients on release <=2.1 with documents/ops generated by clients on release >=2.2.\n\t\t\tif (attach.id === renameLocalId) {\n\t\t\t\tassert(detach.idOverride !== undefined, 0x9f7 /* Rename must have idOverride */);\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"Rename\",\n\t\t\t\t\tidOverride: detach.idOverride,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"AttachAndDetach\",\n\t\t\t\tattach,\n\t\t\t\tdetach,\n\t\t\t};\n\t\t},\n\t});\n\n\tconst cellIdCodec: IJsonCodec<\n\t\tCellId,\n\t\tEncoded.CellId,\n\t\tEncoded.CellId,\n\t\tChangeEncodingContext\n\t> = {\n\t\tencode: (cellId: CellId, context: ChangeEncodingContext): Encoded.CellId => {\n\t\t\tconst encoded: Encoded.CellId = {\n\t\t\t\tatom: changeAtomIdCodec.encode(cellId, context),\n\t\t\t};\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: ({ atom }: Encoded.CellId, context: ChangeEncodingContext): CellId => {\n\t\t\treturn changeAtomIdCodec.decode(atom, context);\n\t\t},\n\t};\n\n\t/**\n\t * If we want to make the node change aspect of this codec more type-safe, we could adjust generics\n\t * to be in terms of the schema rather than the concrete type of the node change.\n\t */\n\ttype NodeChangeSchema = TAnySchema;\n\n\treturn {\n\t\tencode: (\n\t\t\tchangeset: Changeset,\n\t\t\tcontext: FieldChangeEncodingContext,\n\t\t): JsonCompatibleReadOnly & Encoded.Changeset<NodeChangeSchema> => {\n\t\t\tconst jsonMarks: Encoded.Changeset<NodeChangeSchema> = [];\n\t\t\tfor (const mark of changeset) {\n\t\t\t\tconst encodedMark: Encoded.Mark<NodeChangeSchema> = {\n\t\t\t\t\tcount: mark.count,\n\t\t\t\t};\n\t\t\t\tif (!isNoopMark(mark)) {\n\t\t\t\t\tencodedMark.effect = markEffectCodec.encode(mark, context.baseContext);\n\t\t\t\t}\n\t\t\t\tif (mark.cellId !== undefined) {\n\t\t\t\t\tencodedMark.cellId = cellIdCodec.encode(mark.cellId, context.baseContext);\n\t\t\t\t}\n\t\t\t\tif (mark.changes !== undefined) {\n\t\t\t\t\tencodedMark.changes = context.encodeNode(mark.changes);\n\t\t\t\t}\n\t\t\t\tjsonMarks.push(encodedMark);\n\t\t\t}\n\t\t\treturn jsonMarks;\n\t\t},\n\t\tdecode: (\n\t\t\tchangeset: Encoded.Changeset<NodeChangeSchema>,\n\t\t\tcontext: FieldChangeEncodingContext,\n\t\t): Changeset => {\n\t\t\tconst marks: Changeset = [];\n\t\t\tfor (const mark of changeset) {\n\t\t\t\tconst decodedMark: Mark = {\n\t\t\t\t\tcount: mark.count,\n\t\t\t\t};\n\n\t\t\t\tif (mark.effect !== undefined) {\n\t\t\t\t\tObject.assign(decodedMark, markEffectCodec.decode(mark.effect, context.baseContext));\n\t\t\t\t}\n\t\t\t\tif (mark.cellId !== undefined) {\n\t\t\t\t\tdecodedMark.cellId = cellIdCodec.decode(mark.cellId, context.baseContext);\n\t\t\t\t}\n\t\t\t\t// Type deduction wrongly narrows the type of `decodedMark` to `NoopMark & HasMarkFields`.\n\t\t\t\t// We declare a new casted copy of `decodedMark` to recover the correct type.\n\t\t\t\tlet decodedMark2 = decodedMark as Mark;\n\t\t\t\tif (decodedMark2.cellId !== undefined && decodedMark2.type === \"AttachAndDetach\") {\n\t\t\t\t\t// In documents generated by clients on release <=2.1 (i.e., not running the code from the PR that added this comment),\n\t\t\t\t\t// rename-like AttachAndDetach marks are not normalized to Rename marks thus requiring this normalization step.\n\t\t\t\t\t// This ensures backward compatibility with documents generated by clients on release <=2.1.\n\t\t\t\t\tdecodedMark2 = normalizeCellRename(\n\t\t\t\t\t\tdecodedMark2.cellId,\n\t\t\t\t\t\tdecodedMark2.count,\n\t\t\t\t\t\tdecodedMark2.attach,\n\t\t\t\t\t\tdecodedMark2.detach,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (mark.changes !== undefined) {\n\t\t\t\t\tdecodedMark2.changes = context.decodeNode(mark.changes);\n\t\t\t\t}\n\t\t\t\tmarks.push(decodedMark2);\n\t\t\t}\n\t\t\treturn marks;\n\t\t},\n\t\tencodedSchema: ChangesetSchema(EncodedNodeChangeset),\n\t};\n}\n\n/**\n * Arbitrary ID that is used to indicate a Rename effect.\n */\nconst renameLocalId: ChangesetLocalId = brand(-1);\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { FullSchemaPolicy } from "../modular-schema/index.js";
|
|
7
|
-
|
|
8
|
-
import { fieldKinds } from "./defaultFieldKinds.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* FullSchemaPolicy with the default field kinds.
|
|
12
|
-
*/
|
|
13
|
-
export const defaultSchemaPolicy: FullSchemaPolicy = {
|
|
14
|
-
fieldKinds,
|
|
15
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
|
|
8
|
-
import type {
|
|
9
|
-
FieldKindIdentifier,
|
|
10
|
-
TreeFieldStoredSchema,
|
|
11
|
-
TreeStoredSchema,
|
|
12
|
-
TreeTypeSet,
|
|
13
|
-
Multiplicity,
|
|
14
|
-
} from "../../core/index.js";
|
|
15
|
-
|
|
16
|
-
import type { FieldChangeHandler, FieldEditor } from "./fieldChangeHandler.js";
|
|
17
|
-
import { FlexFieldKind, type FullSchemaPolicy } from "./fieldKind.js";
|
|
18
|
-
import { isNeverField } from "./isNeverTree.js";
|
|
19
|
-
|
|
20
|
-
// TODO: stronger typing
|
|
21
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Functionality for FieldKinds that is stable,
|
|
25
|
-
* meaning that it can not change in any measurable way without providing a new identifier.
|
|
26
|
-
*
|
|
27
|
-
* It is assumed that this information and policy is available on all clients interacting with a document
|
|
28
|
-
* using the identifier.
|
|
29
|
-
*
|
|
30
|
-
* This must contain enough information to process remote edits to this FieldKind consistently with all clients.
|
|
31
|
-
* All behavior must be deterministic, and not change across versions of the app/library.
|
|
32
|
-
*
|
|
33
|
-
* These policies include the data encoding, change encoding, change rebase and change application.
|
|
34
|
-
*/
|
|
35
|
-
export class FieldKindWithEditor<
|
|
36
|
-
TEditor extends FieldEditor<any> = FieldEditor<any>,
|
|
37
|
-
TMultiplicity extends Multiplicity = Multiplicity,
|
|
38
|
-
TName extends string = string,
|
|
39
|
-
> extends FlexFieldKind<TName, TMultiplicity> {
|
|
40
|
-
/**
|
|
41
|
-
* @param identifier - Globally scoped identifier.
|
|
42
|
-
* @param multiplicity - bound on the number of children that fields of this kind may have.
|
|
43
|
-
* TODO: replace with numeric upper and lower bounds.
|
|
44
|
-
* @param changeHandler - Change handling policy.
|
|
45
|
-
* @param allowsTreeSupersetOf - returns true iff `superset` supports all that this does
|
|
46
|
-
* and `superset` is an allowed upgrade. Does not have to handle the `never` cases.
|
|
47
|
-
* See {@link isNeverField}.
|
|
48
|
-
* TODO: when used as a method (instead of a free function like the other superset related functions),
|
|
49
|
-
* this name is/signature is confusing and seems backwards.
|
|
50
|
-
* @param handlesEditsFrom - Kinds (in addition to this) whose edits can be processed by changeHandler.
|
|
51
|
-
* If the kind of a field changes, and edits are rebased across that kind change,
|
|
52
|
-
* listing the other old kind here can prevent those edits from being conflicted and
|
|
53
|
-
* provide a chance to handle them.
|
|
54
|
-
*/
|
|
55
|
-
public constructor(
|
|
56
|
-
identifier: TName,
|
|
57
|
-
multiplicity: TMultiplicity,
|
|
58
|
-
public readonly changeHandler: FieldChangeHandler<any, TEditor>,
|
|
59
|
-
private readonly allowsTreeSupersetOf: (
|
|
60
|
-
originalTypes: TreeTypeSet,
|
|
61
|
-
superset: TreeFieldStoredSchema,
|
|
62
|
-
) => boolean,
|
|
63
|
-
public readonly handlesEditsFrom: ReadonlySet<FieldKindIdentifier>,
|
|
64
|
-
) {
|
|
65
|
-
super(identifier as TName & FieldKindIdentifier, multiplicity);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Returns true if and only if `superset` permits a (non-strict) superset of the subtrees
|
|
70
|
-
* allowed by field made from `this` and `originalTypes`.
|
|
71
|
-
*/
|
|
72
|
-
public allowsFieldSuperset(
|
|
73
|
-
policy: FullSchemaPolicy,
|
|
74
|
-
originalData: TreeStoredSchema,
|
|
75
|
-
originalTypes: TreeTypeSet,
|
|
76
|
-
superset: TreeFieldStoredSchema,
|
|
77
|
-
): boolean {
|
|
78
|
-
if (
|
|
79
|
-
isNeverField(policy, originalData, {
|
|
80
|
-
kind: this.identifier,
|
|
81
|
-
types: originalTypes,
|
|
82
|
-
// Metadata is not used for this check.
|
|
83
|
-
persistedMetadata: undefined,
|
|
84
|
-
})
|
|
85
|
-
) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
if (isNeverField(policy, originalData, superset)) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return this.allowsTreeSupersetOf(originalTypes, superset);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Downcasts to {@link FieldKindWithEditor}.
|
|
97
|
-
*/
|
|
98
|
-
export function withEditor<
|
|
99
|
-
TName extends string = string,
|
|
100
|
-
TMultiplicity extends Multiplicity = Multiplicity,
|
|
101
|
-
>(
|
|
102
|
-
kind: FlexFieldKind<TName, TMultiplicity>,
|
|
103
|
-
): FieldKindWithEditor<FieldEditor<any>, TMultiplicity, TName> {
|
|
104
|
-
assert(kind instanceof FieldKindWithEditor, 0x7b5 /* kind must be FieldKindWithEditor */);
|
|
105
|
-
return kind as FieldKindWithEditor<FieldEditor<any>, TMultiplicity, TName>;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|