@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
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { objectToMap, type JsonCompatibleReadOnly } from "../../util/index.js";
|
|
7
|
+
import { unreachableCase, transformMapValues } from "@fluidframework/core-utils/internal";
|
|
8
|
+
import type {
|
|
9
|
+
SimpleAllowedTypeAttributes,
|
|
10
|
+
SimpleArrayNodeSchema,
|
|
11
|
+
SimpleFieldSchema,
|
|
12
|
+
SimpleLeafNodeSchema,
|
|
13
|
+
SimpleMapNodeSchema,
|
|
14
|
+
SimpleNodeSchema,
|
|
15
|
+
SimpleObjectFieldSchema,
|
|
16
|
+
SimpleObjectNodeSchema,
|
|
17
|
+
SimpleRecordNodeSchema,
|
|
18
|
+
SimpleTreeSchema,
|
|
19
|
+
} from "../simpleSchema.js";
|
|
20
|
+
import { createSchemaUpgrade, NodeKind, SchemaUpgrade } from "../core/index.js";
|
|
21
|
+
import type { FieldKind } from "../fieldSchema.js";
|
|
22
|
+
import type { ValueSchema } from "../../core/index.js";
|
|
23
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
24
|
+
import * as Format from "../simpleSchemaFormatV1.js";
|
|
25
|
+
import {
|
|
26
|
+
DiscriminatedUnionDispatcher,
|
|
27
|
+
extractJsonValidator,
|
|
28
|
+
FormatValidatorNoOp,
|
|
29
|
+
type FormatValidator,
|
|
30
|
+
} from "../../codec/index.js";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Encodes a simple schema (view or stored) into a serializable format.
|
|
34
|
+
* @remarks The JSON-compatible schema returned from this method is only intended for use in snapshots/comparisons of schemas.
|
|
35
|
+
* It is not possible to reconstruct a full schema (including metadata and persistedMetadata) from the encoded format.
|
|
36
|
+
* @param treeSchema - The tree schema to convert.
|
|
37
|
+
* @returns A serializable representation of the schema.
|
|
38
|
+
*
|
|
39
|
+
* @alpha
|
|
40
|
+
*/
|
|
41
|
+
export function encodeSimpleSchema(simpleSchema: SimpleTreeSchema): JsonCompatibleReadOnly {
|
|
42
|
+
// Convert types to serializable forms
|
|
43
|
+
const encodedDefinitions: Format.SimpleSchemaDefinitionsFormat = {};
|
|
44
|
+
|
|
45
|
+
for (const [identifier, schema] of simpleSchema.definitions) {
|
|
46
|
+
const encodedDefinition = encodeNodeSchema(schema);
|
|
47
|
+
encodedDefinitions[identifier] = encodedDefinition;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const encodedSchema: Format.SimpleTreeSchemaFormat = {
|
|
51
|
+
version: Format.SimpleSchemaFormatVersion.v1,
|
|
52
|
+
root: encodeField(simpleSchema.root),
|
|
53
|
+
definitions: encodedDefinitions,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return encodedSchema;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Decodes a JSON-compatible schema into a simple schema.
|
|
61
|
+
* @param encodedSchema - The encoded schema to decode.
|
|
62
|
+
* @param validator - The format validator to use to validate the encoded schema.
|
|
63
|
+
* @returns A decoded simple schema.
|
|
64
|
+
* @throws Will throw a usage error if the encoded schema is not in the expected format.
|
|
65
|
+
*
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export function decodeSimpleSchema(
|
|
69
|
+
encodedSchema: JsonCompatibleReadOnly,
|
|
70
|
+
validator?: FormatValidator,
|
|
71
|
+
): SimpleTreeSchema {
|
|
72
|
+
const effectiveValidator = validator ?? FormatValidatorNoOp;
|
|
73
|
+
const compiledValidator = extractJsonValidator(effectiveValidator).compile(
|
|
74
|
+
Format.SimpleTreeSchemaFormat,
|
|
75
|
+
);
|
|
76
|
+
if (!compiledValidator.check(encodedSchema)) {
|
|
77
|
+
throw new UsageError(
|
|
78
|
+
"The provided simple schema is not valid according to the schema format.",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
root: decodeSimpleFieldSchema(encodedSchema.root),
|
|
84
|
+
definitions: new Map(
|
|
85
|
+
transformMapValues(objectToMap(encodedSchema.definitions), (value, key) => {
|
|
86
|
+
return decodeNodeSchema(value);
|
|
87
|
+
}),
|
|
88
|
+
),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Encodes a node schema to a serializable object.
|
|
94
|
+
* @param schema - The node schema to convert.
|
|
95
|
+
* @returns A serializable representation of the node schema.
|
|
96
|
+
*/
|
|
97
|
+
function encodeNodeSchema(schema: SimpleNodeSchema): Format.SimpleNodeSchemaUnionFormat {
|
|
98
|
+
const kind = schema.kind;
|
|
99
|
+
switch (kind) {
|
|
100
|
+
case NodeKind.Leaf:
|
|
101
|
+
return { leaf: encodeLeafNode(schema) };
|
|
102
|
+
case NodeKind.Array:
|
|
103
|
+
return { array: encodeContainerNode(schema) };
|
|
104
|
+
case NodeKind.Map:
|
|
105
|
+
return { map: encodeContainerNode(schema) };
|
|
106
|
+
case NodeKind.Record:
|
|
107
|
+
return { record: encodeContainerNode(schema) };
|
|
108
|
+
case NodeKind.Object:
|
|
109
|
+
return { object: encodeObjectNode(schema) };
|
|
110
|
+
default: {
|
|
111
|
+
unreachableCase(kind);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Encodes a leaf node schema to a serializable object.
|
|
118
|
+
* @param schema - The leaf node schema to convert.
|
|
119
|
+
* @returns A serializable representation of the leaf node schema.
|
|
120
|
+
*/
|
|
121
|
+
function encodeLeafNode(schema: SimpleLeafNodeSchema): Format.SimpleLeafNodeSchemaFormat {
|
|
122
|
+
return {
|
|
123
|
+
kind: schema.kind,
|
|
124
|
+
leafKind: schema.leafKind,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Encodes a container node schema (a simple schema that is a Map, Array, or Record) to a serializable object.
|
|
130
|
+
* @param schema - The container node schema to convert.
|
|
131
|
+
* @returns A serializable representation of the container node schema. Includes the `kind` for disambiguation between different
|
|
132
|
+
* container kinds.
|
|
133
|
+
*/
|
|
134
|
+
function encodeContainerNode(
|
|
135
|
+
schema: SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema,
|
|
136
|
+
):
|
|
137
|
+
| Format.SimpleArrayNodeSchemaFormat
|
|
138
|
+
| Format.SimpleMapNodeSchemaFormat
|
|
139
|
+
| Format.SimpleRecordNodeSchemaFormat {
|
|
140
|
+
return {
|
|
141
|
+
kind: schema.kind,
|
|
142
|
+
simpleAllowedTypes: encodeSimpleAllowedTypes(schema.simpleAllowedTypes),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Encodes a simple allowed types map to a serializable object. Needed because JSON serialization does not support Maps.
|
|
148
|
+
* @param simpleAllowedTypes - The simple allowed types map to convert.
|
|
149
|
+
* @returns A serializable representation of the simple allowed types.
|
|
150
|
+
*/
|
|
151
|
+
function encodeSimpleAllowedTypes(
|
|
152
|
+
simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>,
|
|
153
|
+
): Format.SimpleAllowedTypesFormat {
|
|
154
|
+
const encodedAllowedTypes: Format.SimpleAllowedTypesFormat = {};
|
|
155
|
+
for (const [identifier, attributes] of simpleAllowedTypes) {
|
|
156
|
+
const isStaged = attributes.isStaged instanceof SchemaUpgrade ? true : attributes.isStaged;
|
|
157
|
+
encodedAllowedTypes[identifier] = { isStaged };
|
|
158
|
+
}
|
|
159
|
+
return encodedAllowedTypes;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Encodes an object node schema to a serializable object.
|
|
164
|
+
* @param schema - The object node schema to convert.
|
|
165
|
+
* @returns A serializable representation of the object node schema.
|
|
166
|
+
*/
|
|
167
|
+
function encodeObjectNode(
|
|
168
|
+
schema: SimpleObjectNodeSchema,
|
|
169
|
+
): Format.SimpleObjectNodeSchemaFormat {
|
|
170
|
+
const encodedFields: Format.SimpleObjectFieldSchemasFormat = {};
|
|
171
|
+
for (const [fieldKey, fieldSchema] of schema.fields) {
|
|
172
|
+
encodedFields[fieldKey] = encodeObjectField(fieldSchema);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
kind: schema.kind,
|
|
177
|
+
fields: encodedFields,
|
|
178
|
+
allowUnknownOptionalFields: schema.allowUnknownOptionalFields,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Encodes an object field schema to a serializable object.
|
|
184
|
+
* @param fieldSchema - The object field schema to convert.
|
|
185
|
+
* @returns A serializable representation of the object field schema.
|
|
186
|
+
*/
|
|
187
|
+
function encodeObjectField(
|
|
188
|
+
fieldSchema: SimpleObjectFieldSchema,
|
|
189
|
+
): Format.SimpleObjectFieldSchemaFormat {
|
|
190
|
+
const encodedField = encodeField(fieldSchema);
|
|
191
|
+
return { ...encodedField, storedKey: fieldSchema.storedKey };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Encodes a field schema to a serializable object.
|
|
196
|
+
* @param fieldSchema - The field schema to convert.
|
|
197
|
+
* @returns A serializable representation of the field schema.
|
|
198
|
+
*/
|
|
199
|
+
function encodeField(fieldSchema: SimpleFieldSchema): Format.SimpleFieldSchemaFormat {
|
|
200
|
+
return {
|
|
201
|
+
kind: fieldSchema.kind,
|
|
202
|
+
simpleAllowedTypes: encodeSimpleAllowedTypes(fieldSchema.simpleAllowedTypes),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const decodeNodeSchemaDispatcher: DiscriminatedUnionDispatcher<
|
|
207
|
+
Format.SimpleNodeSchemaUnionFormat,
|
|
208
|
+
[],
|
|
209
|
+
| SimpleLeafNodeSchema
|
|
210
|
+
| SimpleArrayNodeSchema
|
|
211
|
+
| SimpleMapNodeSchema
|
|
212
|
+
| SimpleRecordNodeSchema
|
|
213
|
+
| SimpleObjectNodeSchema
|
|
214
|
+
> = new DiscriminatedUnionDispatcher({
|
|
215
|
+
leaf: decodeLeafNode,
|
|
216
|
+
array: decodeContainerNode,
|
|
217
|
+
map: decodeContainerNode,
|
|
218
|
+
record: decodeContainerNode,
|
|
219
|
+
object: decodeObjectNode,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Decodes a node schema from a JSON-compatible object.
|
|
224
|
+
* @param encodedNodeSchema - The encoded node schema to decode.
|
|
225
|
+
* @returns The decoded node schema.
|
|
226
|
+
*/
|
|
227
|
+
function decodeNodeSchema(
|
|
228
|
+
encodedNodeSchema: Format.SimpleNodeSchemaUnionFormat,
|
|
229
|
+
):
|
|
230
|
+
| SimpleLeafNodeSchema
|
|
231
|
+
| SimpleArrayNodeSchema
|
|
232
|
+
| SimpleMapNodeSchema
|
|
233
|
+
| SimpleRecordNodeSchema
|
|
234
|
+
| SimpleObjectNodeSchema {
|
|
235
|
+
return decodeNodeSchemaDispatcher.dispatch(encodedNodeSchema);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Decodes a container node schema (array, map, record) from a JSON-compatible object.
|
|
240
|
+
* @param encodedContainerSchema - The encoded schema to decode.
|
|
241
|
+
* @returns The decoded container node schema.
|
|
242
|
+
*/
|
|
243
|
+
function decodeContainerNode(
|
|
244
|
+
encodedContainerSchema:
|
|
245
|
+
| Format.SimpleArrayNodeSchemaFormat
|
|
246
|
+
| Format.SimpleMapNodeSchemaFormat
|
|
247
|
+
| Format.SimpleRecordNodeSchemaFormat,
|
|
248
|
+
): SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema {
|
|
249
|
+
return {
|
|
250
|
+
kind: encodedContainerSchema.kind as NodeKind.Array | NodeKind.Map | NodeKind.Record,
|
|
251
|
+
simpleAllowedTypes: decodeSimpleAllowedTypes(encodedContainerSchema.simpleAllowedTypes),
|
|
252
|
+
// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.
|
|
253
|
+
persistedMetadata: undefined,
|
|
254
|
+
metadata: {},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Decodes a leaf node schema from a JSON-compatible object.
|
|
260
|
+
* @param encodedLeafSchema - The encoded leaf node schema.
|
|
261
|
+
* @returns The decoded leaf node schema.
|
|
262
|
+
*/
|
|
263
|
+
function decodeLeafNode(
|
|
264
|
+
encodedLeafSchema: Format.SimpleLeafNodeSchemaFormat,
|
|
265
|
+
): SimpleLeafNodeSchema {
|
|
266
|
+
return {
|
|
267
|
+
kind: NodeKind.Leaf,
|
|
268
|
+
leafKind: encodedLeafSchema.leafKind as ValueSchema,
|
|
269
|
+
// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.
|
|
270
|
+
persistedMetadata: undefined,
|
|
271
|
+
metadata: {},
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Decodes a object node schema from a JSON-compatible object.
|
|
277
|
+
* @param encodedObjectSchema - The encoded object node schema.
|
|
278
|
+
* @returns The decoded object node schema.
|
|
279
|
+
*/
|
|
280
|
+
function decodeObjectNode(
|
|
281
|
+
encodedObjectSchema: Format.SimpleObjectNodeSchemaFormat,
|
|
282
|
+
): SimpleObjectNodeSchema {
|
|
283
|
+
return {
|
|
284
|
+
kind: NodeKind.Object,
|
|
285
|
+
fields: decodeObjectFields(encodedObjectSchema.fields),
|
|
286
|
+
// It is possible for allowUnknownOptionalFields to be undefined. This happens when serializing a Simple Schema derived
|
|
287
|
+
// from a stored schema.
|
|
288
|
+
allowUnknownOptionalFields: encodedObjectSchema.allowUnknownOptionalFields,
|
|
289
|
+
// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.
|
|
290
|
+
persistedMetadata: undefined,
|
|
291
|
+
metadata: {},
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Decodes a map of object fields from a JSON-compatible object.
|
|
297
|
+
* @param encodedFields - The encoded fields.
|
|
298
|
+
* @returns A map of the decoded object fields.
|
|
299
|
+
*/
|
|
300
|
+
function decodeObjectFields(
|
|
301
|
+
encodedFields: Format.SimpleObjectFieldSchemasFormat,
|
|
302
|
+
): ReadonlyMap<string, SimpleObjectFieldSchema> {
|
|
303
|
+
const fields = new Map<string, SimpleObjectFieldSchema>();
|
|
304
|
+
for (const [fieldKey, fieldSchema] of Object.entries(encodedFields)) {
|
|
305
|
+
fields.set(fieldKey, decodeObjectField(fieldSchema));
|
|
306
|
+
}
|
|
307
|
+
return fields;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Decodes a {@link SimpleObjectFieldSchema} from a JSON-compatible object.
|
|
312
|
+
* @param encodedField - The encoded field schema.
|
|
313
|
+
* @returns The decoded simple object field schema.
|
|
314
|
+
*/
|
|
315
|
+
function decodeObjectField(
|
|
316
|
+
encodedField: Format.SimpleObjectFieldSchemaFormat,
|
|
317
|
+
): SimpleObjectFieldSchema {
|
|
318
|
+
const baseField = decodeSimpleFieldSchema(encodedField);
|
|
319
|
+
return {
|
|
320
|
+
...baseField,
|
|
321
|
+
storedKey: encodedField.storedKey,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Decodes a {@link SimpleFieldSchema} from a JSON-compatible object.
|
|
327
|
+
* @param encodedField - The encoded field schema.
|
|
328
|
+
* @returns The decoded simple field schema.
|
|
329
|
+
*/
|
|
330
|
+
function decodeSimpleFieldSchema(
|
|
331
|
+
encodedField: Format.SimpleFieldSchemaFormat,
|
|
332
|
+
): SimpleFieldSchema {
|
|
333
|
+
return {
|
|
334
|
+
kind: encodedField.kind as FieldKind,
|
|
335
|
+
simpleAllowedTypes: decodeSimpleAllowedTypes(encodedField.simpleAllowedTypes),
|
|
336
|
+
// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.
|
|
337
|
+
persistedMetadata: undefined,
|
|
338
|
+
metadata: {},
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Decodes a simple allowed types map from a JSON-compatible object.
|
|
344
|
+
* @param encodedAllowedTypes - The encoded simple allowed types.
|
|
345
|
+
* @returns A map of the decoded simple allowed types.
|
|
346
|
+
*/
|
|
347
|
+
function decodeSimpleAllowedTypes(
|
|
348
|
+
encodedAllowedTypes: Format.SimpleAllowedTypesFormat,
|
|
349
|
+
): ReadonlyMap<string, SimpleAllowedTypeAttributes> {
|
|
350
|
+
const untypedMap = objectToMap(encodedAllowedTypes);
|
|
351
|
+
|
|
352
|
+
const simpleAllowedTypes = transformMapValues(
|
|
353
|
+
untypedMap,
|
|
354
|
+
(value): SimpleAllowedTypeAttributes => {
|
|
355
|
+
const isStaged = value.isStaged === true ? createSchemaUpgrade() : value.isStaged;
|
|
356
|
+
return { isStaged };
|
|
357
|
+
},
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
return simpleAllowedTypes;
|
|
361
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { JsonCompatibleReadOnly } from "../../util/index.js";
|
|
7
|
+
import { toStoredSchema } from "../toStoredSchema.js";
|
|
8
|
+
import { TreeViewConfigurationAlpha, TreeViewConfiguration } from "./configuration.js";
|
|
9
|
+
import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
|
|
10
|
+
import { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
|
|
11
|
+
import { decodeSimpleSchema, encodeSimpleSchema } from "./simpleSchemaCodec.js";
|
|
12
|
+
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
13
|
+
import { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.
|
|
17
|
+
*
|
|
18
|
+
* @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.
|
|
19
|
+
*
|
|
20
|
+
* @example This example demonstrates checking the compatibility of a historical schema against a current schema.
|
|
21
|
+
* In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object
|
|
22
|
+
* that adds an optional z field.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* // This snapshot is assumed to be the same as Point3D, except missing `z`.
|
|
26
|
+
* const encodedSchema = JSON.parse(fs.readFileSync("PointSchema.json", "utf8"));
|
|
27
|
+
* const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);
|
|
28
|
+
*
|
|
29
|
+
* // Build the current view schema
|
|
30
|
+
* class Point3D extends factory.object("Point", {
|
|
31
|
+
* x: factory.number,
|
|
32
|
+
* y: factory.number,
|
|
33
|
+
*
|
|
34
|
+
* // The current schema has a new optional field that was not present on Point2D
|
|
35
|
+
* z: factory.optional(factory.number),
|
|
36
|
+
* }) {}
|
|
37
|
+
* const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });
|
|
38
|
+
*
|
|
39
|
+
* // Check to see if the document created by the historical view schema can be opened with the current view schema
|
|
40
|
+
* const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);
|
|
41
|
+
*
|
|
42
|
+
* // z is not present in Point2D, so the schema must be upgraded
|
|
43
|
+
* assert.equal(backwardsCompatibilityStatus.canView, false);
|
|
44
|
+
*
|
|
45
|
+
* // The schema can be upgraded to add the new optional field
|
|
46
|
+
* assert.equal(backwardsCompatibilityStatus.canUpgrade, true);
|
|
47
|
+
*
|
|
48
|
+
* // Test what the old version of the application would do with a tree using the new schema:
|
|
49
|
+
* const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);
|
|
50
|
+
*
|
|
51
|
+
* // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,
|
|
52
|
+
* // this assert will fail, detecting the forwards compatibility break:
|
|
53
|
+
* // this means these two versions of the application cannot collaborate on content using these schema.
|
|
54
|
+
* assert.equal(forwardsCompatibilityStatus.canView, true);
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.
|
|
58
|
+
* @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.
|
|
59
|
+
* @returns The compatibility status.
|
|
60
|
+
*
|
|
61
|
+
* @alpha
|
|
62
|
+
*/
|
|
63
|
+
export function checkCompatibility(
|
|
64
|
+
viewWhichCreatedStoredSchema: TreeViewConfiguration,
|
|
65
|
+
view: TreeViewConfiguration,
|
|
66
|
+
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
67
|
+
const viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });
|
|
68
|
+
const stored = toStoredSchema(viewWhichCreatedStoredSchema.schema, {
|
|
69
|
+
includeStaged: () => true,
|
|
70
|
+
});
|
|
71
|
+
const tester = new SchemaCompatibilityTester(viewAsAlpha);
|
|
72
|
+
return tester.checkCompatibility(stored);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.
|
|
77
|
+
*
|
|
78
|
+
* Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.
|
|
79
|
+
*
|
|
80
|
+
* @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.
|
|
81
|
+
*
|
|
82
|
+
* @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.
|
|
83
|
+
* @returns The JSON representation of the schema.
|
|
84
|
+
*
|
|
85
|
+
* @example This example creates and persists a snapshot of a Point2D schema.
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* const schemaFactory = new SchemaFactory("test");
|
|
89
|
+
* class Point2D extends schemaFactory.object("Point", {
|
|
90
|
+
* x: factory.number,
|
|
91
|
+
* y: factory.number,
|
|
92
|
+
* }) {}
|
|
93
|
+
* const viewSchema = new TreeViewConfiguration({ schema: Point2D });
|
|
94
|
+
* const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));
|
|
95
|
+
* fs.writeFileSync("PointSchema.json", encodedSchema);
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @alpha
|
|
99
|
+
*/
|
|
100
|
+
export function exportCompatibilitySchemaSnapshot(
|
|
101
|
+
config: Pick<TreeViewConfiguration, "schema">,
|
|
102
|
+
): JsonCompatibleReadOnly {
|
|
103
|
+
const simpleSchema = toSimpleTreeSchema(config.schema, true);
|
|
104
|
+
return encodeSimpleSchema(simpleSchema);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.
|
|
109
|
+
*
|
|
110
|
+
* Can load snapshots created by the same or older package versions, but not necessarily newer versions.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.
|
|
113
|
+
*
|
|
114
|
+
* @param config - The JSON representation of the schema.
|
|
115
|
+
* @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.
|
|
116
|
+
* @throws Will throw a usage error if the encoded schema is not in the expected format.
|
|
117
|
+
*
|
|
118
|
+
* @example This example loads and parses a snapshot of a Point2D schema.
|
|
119
|
+
*
|
|
120
|
+
* ```ts;
|
|
121
|
+
* const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync("PointSchema.json", "utf8"));
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @alpha
|
|
125
|
+
*/
|
|
126
|
+
export function importCompatibilitySchemaSnapshot(
|
|
127
|
+
config: JsonCompatibleReadOnly,
|
|
128
|
+
): TreeViewConfiguration {
|
|
129
|
+
const simpleSchema = decodeSimpleSchema(config);
|
|
130
|
+
const viewSchema = generateSchemaFromSimpleSchema(simpleSchema);
|
|
131
|
+
|
|
132
|
+
// We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for
|
|
133
|
+
// a schema produced by `generateSchemaFromSimpleSchema`.
|
|
134
|
+
return new TreeViewConfiguration({ schema: viewSchema.root });
|
|
135
|
+
}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
7
|
-
import type
|
|
8
|
-
import {
|
|
7
|
+
import { FluidClientVersion, type ICodecOptions } from "../../codec/index.js";
|
|
8
|
+
import { SchemaFormatVersion } from "../../core/index.js";
|
|
9
9
|
import { encodeTreeSchema, makeSchemaCodec } from "../../feature-libraries/index.js";
|
|
10
10
|
import {
|
|
11
11
|
clientVersionToSchemaVersion,
|
|
12
12
|
type FormatV1,
|
|
13
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
13
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
14
14
|
} from "../../feature-libraries/schema-index/index.js";
|
|
15
|
-
import type
|
|
15
|
+
import { brand, type JsonCompatible } from "../../util/index.js";
|
|
16
16
|
import type { SchemaUpgrade } from "../core/index.js";
|
|
17
17
|
import { normalizeFieldSchema, type ImplicitFieldSchema } from "../fieldSchema.js";
|
|
18
18
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
@@ -100,7 +100,10 @@ export function comparePersistedSchema(
|
|
|
100
100
|
): Omit<SchemaCompatibilityStatus, "canInitialize"> {
|
|
101
101
|
// Any version can be passed down to makeSchemaCodec here.
|
|
102
102
|
// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
|
|
103
|
-
const schemaCodec = makeSchemaCodec(
|
|
103
|
+
const schemaCodec = makeSchemaCodec(
|
|
104
|
+
{ ...options, minVersionForCollab: FluidClientVersion.v2_0 },
|
|
105
|
+
brand(SchemaFormatVersion.v1),
|
|
106
|
+
);
|
|
104
107
|
const stored = schemaCodec.decode(persisted as FormatV1);
|
|
105
108
|
const config = new TreeViewConfigurationAlpha({
|
|
106
109
|
schema: normalizeFieldSchema(view),
|
|
@@ -431,7 +431,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
431
431
|
*
|
|
432
432
|
* Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.
|
|
433
433
|
*
|
|
434
|
-
* For the computation of this equivalence, {@link
|
|
434
|
+
* For the computation of this equivalence, {@link SchemaStaticsBeta.staged | staged} schemas are not included.
|
|
435
435
|
* If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.
|
|
436
436
|
*/
|
|
437
437
|
readonly isEquivalent: boolean;
|
|
@@ -445,7 +445,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
445
445
|
*
|
|
446
446
|
* - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.
|
|
447
447
|
*
|
|
448
|
-
* - An additional type allowed at a location in the stored schema where it is {@link
|
|
448
|
+
* - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsBeta.staged | staged} in the view schema.
|
|
449
449
|
*
|
|
450
450
|
* In these cases `canUpgrade` and `isEquivalent` will be false.
|
|
451
451
|
*
|
|
@@ -577,7 +577,7 @@ export interface TreeViewEvents {
|
|
|
577
577
|
/**
|
|
578
578
|
* Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.
|
|
579
579
|
* @alpha
|
|
580
|
-
* @deprecated Use {@link asAlpha} instead.
|
|
580
|
+
* @deprecated Use {@link (asAlpha:1)} instead.
|
|
581
581
|
* @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.
|
|
582
582
|
*/
|
|
583
583
|
export function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(
|
|
@@ -551,7 +551,7 @@ export interface TreeRecordNodeUnsafe<
|
|
|
551
551
|
* @remarks
|
|
552
552
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
553
553
|
* @sealed
|
|
554
|
-
* @
|
|
554
|
+
* @beta
|
|
555
555
|
* @system
|
|
556
556
|
*/
|
|
557
557
|
export type UnannotateAllowedTypeUnsafe<
|
|
@@ -564,7 +564,7 @@ export type UnannotateAllowedTypeUnsafe<
|
|
|
564
564
|
* {@link Unenforced} version of {@link AnnotatedAllowedType}.
|
|
565
565
|
* @remarks
|
|
566
566
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
567
|
-
* @system @sealed @
|
|
567
|
+
* @system @sealed @beta
|
|
568
568
|
*/
|
|
569
569
|
export interface AnnotatedAllowedTypeUnsafe<T = Unenforced<LazyItem<TreeNodeSchema>>>
|
|
570
570
|
extends AnnotatedAllowedType<T> {}
|
|
@@ -573,7 +573,7 @@ export interface AnnotatedAllowedTypeUnsafe<T = Unenforced<LazyItem<TreeNodeSche
|
|
|
573
573
|
* {@link Unenforced} version of {@link AnnotatedAllowedTypes}.
|
|
574
574
|
* @remarks
|
|
575
575
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
576
|
-
* @system @sealed @
|
|
576
|
+
* @system @sealed @beta
|
|
577
577
|
*/
|
|
578
578
|
export interface AnnotatedAllowedTypesUnsafe
|
|
579
579
|
extends AnnotatedAllowedTypes<LazyItem<System_Unsafe.TreeNodeSchemaUnsafe>> {}
|
|
@@ -592,7 +592,7 @@ export type AllowedTypesFullUnsafe<
|
|
|
592
592
|
* {@link Unenforced} version of {@link AllowedTypesFullFromMixed}.
|
|
593
593
|
* @remarks
|
|
594
594
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
595
|
-
* @system @sealed @
|
|
595
|
+
* @system @sealed @beta
|
|
596
596
|
*/
|
|
597
597
|
export type AllowedTypesFullFromMixedUnsafe<
|
|
598
598
|
T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],
|
|
@@ -603,7 +603,7 @@ export type AllowedTypesFullFromMixedUnsafe<
|
|
|
603
603
|
* {@link Unenforced} version of {@link UnannotateAllowedTypesList}.
|
|
604
604
|
* @remarks
|
|
605
605
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
606
|
-
* @system @sealed @
|
|
606
|
+
* @system @sealed @beta
|
|
607
607
|
*/
|
|
608
608
|
export type UnannotateAllowedTypesListUnsafe<
|
|
609
609
|
T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],
|
|
@@ -615,7 +615,7 @@ export type UnannotateAllowedTypesListUnsafe<
|
|
|
615
615
|
* {@link Unenforced} version of {@link AnnotateAllowedTypesList}.
|
|
616
616
|
* @remarks
|
|
617
617
|
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
618
|
-
* @system @sealed @
|
|
618
|
+
* @system @sealed @beta
|
|
619
619
|
*/
|
|
620
620
|
export type AnnotateAllowedTypesListUnsafe<
|
|
621
621
|
T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],
|