@fluidframework/tree 2.71.0 → 2.72.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 +26 -40
- package/api-report/tree.alpha.api.md +27 -18
- package/api-report/tree.beta.api.md +42 -0
- package/api-report/tree.legacy.beta.api.md +42 -0
- package/dist/alpha.d.ts +9 -7
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/beta.d.ts +7 -0
- package/dist/codec/codec.d.ts +16 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +16 -3
- package/dist/codec/codec.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 +6 -6
- 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 +29 -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/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 +12 -8
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +9 -4
- package/dist/feature-libraries/chunked-forest/codec/format.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 +1 -2
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
- 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 +1 -2
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +3 -21
- package/dist/feature-libraries/default-schema/defaultFieldKinds.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 +8 -1
- package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/format.js +8 -3
- 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 +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -2
- package/dist/feature-libraries/index.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 +22 -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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- 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/sharedTree.d.ts +12 -16
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +87 -127
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +12 -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 +35 -17
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +43 -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 +11 -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 +38 -21
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +50 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
- package/dist/shared-tree-core/messageFormat.js +51 -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/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 +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -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.js +6 -3
- 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 +292 -0
- package/dist/simple-tree/api/simpleSchemaCodec.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 +2 -2
- 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 +1 -1
- package/dist/simple-tree/core/allowedTypes.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/index.d.ts +2 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -0
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +11 -3
- 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/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +1 -1
- 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/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 +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -2
- package/dist/util/index.js.map +1 -1
- package/lib/alpha.d.ts +9 -7
- package/lib/api.js +2 -2
- package/lib/api.js.map +1 -1
- package/lib/beta.d.ts +7 -0
- package/lib/codec/codec.d.ts +16 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +16 -3
- package/lib/codec/codec.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 +6 -6
- 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 +29 -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/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 +13 -8
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +8 -3
- package/lib/feature-libraries/chunked-forest/codec/format.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/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -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 +1 -9
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -20
- package/lib/feature-libraries/default-schema/defaultFieldKinds.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 +8 -1
- package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/format.js +7 -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 +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- package/lib/feature-libraries/index.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 +24 -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/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- 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/sharedTree.d.ts +12 -16
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +90 -130
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +7 -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 +32 -16
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +42 -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 +35 -20
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +50 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
- package/lib/shared-tree-core/messageFormat.js +48 -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/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 +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/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.js +6 -3
- 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 +264 -0
- package/lib/simple-tree/api/simpleSchemaCodec.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 +2 -2
- 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 +1 -1
- package/lib/simple-tree/core/allowedTypes.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/index.d.ts +2 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -0
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +2 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +11 -3
- 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/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +1 -1
- 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/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 +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/package.json +24 -24
- package/src/api.ts +2 -2
- package/src/codec/codec.ts +17 -3
- package/src/core/index.ts +1 -2
- package/src/core/schema-stored/index.ts +1 -2
- package/src/core/schema-stored/schema.ts +10 -7
- 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 +33 -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/chunked-forest/codec/codecs.ts +18 -13
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/format.ts +15 -4
- package/src/feature-libraries/chunked-forest/codec/index.ts +4 -2
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +2 -2
- package/src/feature-libraries/chunked-forest/index.ts +0 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -29
- 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 +12 -2
- package/src/feature-libraries/forest-summary/index.ts +2 -1
- package/src/feature-libraries/index.ts +1 -2
- 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 +34 -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/index.ts +3 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +16 -5
- package/src/shared-tree/sharedTree.ts +112 -172
- package/src/shared-tree/sharedTreeChangeCodecs.ts +15 -9
- 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 +56 -19
- package/src/shared-tree-core/editManagerFormatCommons.ts +47 -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 +11 -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 +60 -26
- package/src/shared-tree-core/messageFormat.ts +56 -0
- package/src/shared-tree-core/sharedTreeCore.ts +11 -13
- 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 +6 -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 +6 -3
- package/src/simple-tree/api/simpleSchemaCodec.ts +360 -0
- package/src/simple-tree/api/storedSchema.ts +8 -5
- package/src/simple-tree/api/tree.ts +2 -2
- 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 +3 -3
- package/src/simple-tree/core/treeNode.ts +2 -2
- package/src/simple-tree/index.ts +5 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +2 -2
- package/src/simple-tree/node-kinds/map/mapNode.ts +2 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
- package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
- package/src/simple-tree/simpleSchema.ts +12 -3
- package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
- package/src/tableSchema.ts +5 -2
- package/src/treeFactory.ts +33 -1
- package/src/util/brand.ts +40 -2
- package/src/util/brandedMap.ts +3 -1
- package/src/util/index.ts +1 -0
|
@@ -8,7 +8,7 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
type CodecTree,
|
|
11
|
-
type
|
|
11
|
+
type CodecWriteOptions,
|
|
12
12
|
type IJsonCodec,
|
|
13
13
|
makeVersionedValidatedCodec,
|
|
14
14
|
} from "../../../codec/index.js";
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type TreeChunk,
|
|
20
20
|
} from "../../../core/index.js";
|
|
21
21
|
import {
|
|
22
|
+
brand,
|
|
22
23
|
brandedNumberType,
|
|
23
24
|
type Brand,
|
|
24
25
|
type JsonCompatibleReadOnly,
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
|
|
32
33
|
import { decode } from "./chunkDecoding.js";
|
|
33
34
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
34
|
-
import { EncodedFieldBatch, validVersions,
|
|
35
|
+
import { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from "./format.js";
|
|
35
36
|
import { schemaCompressedEncode } from "./schemaBasedEncode.js";
|
|
36
37
|
import { uncompressedEncode } from "./uncompressedEncode.js";
|
|
37
38
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
@@ -123,17 +124,19 @@ export type FieldBatchCodec = IJsonCodec<
|
|
|
123
124
|
* @privateRemarks
|
|
124
125
|
* TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
|
|
125
126
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.
|
|
129
|
+
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
130
|
+
*/
|
|
131
|
+
function clientVersionToFieldBatchVersion(
|
|
132
|
+
clientVersion: MinimumVersionForCollab,
|
|
133
|
+
): FieldBatchFormatVersion {
|
|
134
|
+
// Currently, field batch codec only writes in version 1.
|
|
135
|
+
return brand(FieldBatchFormatVersion.v1);
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
export function makeFieldBatchCodec(
|
|
134
|
-
options
|
|
135
|
-
writeVersion: number,
|
|
136
|
-
): FieldBatchCodec {
|
|
138
|
+
export function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {
|
|
139
|
+
const writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);
|
|
137
140
|
// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since
|
|
138
141
|
// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if
|
|
139
142
|
// decode is being run on a client that just submitted a schema change, but the op is from another client who has
|
|
@@ -198,6 +201,8 @@ export function makeFieldBatchCodec(
|
|
|
198
201
|
});
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
export function getCodecTreeForFieldBatchFormat(
|
|
202
|
-
|
|
204
|
+
export function getCodecTreeForFieldBatchFormat(
|
|
205
|
+
clientVersion: MinimumVersionForCollab,
|
|
206
|
+
): CodecTree {
|
|
207
|
+
return { name: "FieldBatch", version: clientVersionToFieldBatchVersion(clientVersion) };
|
|
203
208
|
}
|
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
type EncodedFieldBatch,
|
|
34
34
|
type EncodedNestedArrayShape,
|
|
35
35
|
type EncodedValueShape,
|
|
36
|
+
FieldBatchFormatVersion,
|
|
36
37
|
SpecialField,
|
|
37
|
-
version,
|
|
38
38
|
} from "./format.js";
|
|
39
39
|
import type { IncrementalEncoder } from "./codecs.js";
|
|
40
40
|
|
|
@@ -57,7 +57,7 @@ export function compressedEncode(
|
|
|
57
57
|
anyFieldEncoder.encodeField(cursor, context, buffer);
|
|
58
58
|
batchBuffer.push(buffer);
|
|
59
59
|
}
|
|
60
|
-
return updateShapesAndIdentifiersEncoding(
|
|
60
|
+
return updateShapesAndIdentifiersEncoding(FieldBatchFormatVersion.v1, batchBuffer);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;
|
|
@@ -15,12 +15,20 @@ import {
|
|
|
15
15
|
} from "./formatGeneric.js";
|
|
16
16
|
import type { Brand } from "../../../util/index.js";
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The format version for the field batch.
|
|
20
|
+
*/
|
|
21
|
+
export const FieldBatchFormatVersion = {
|
|
22
|
+
v1: 1,
|
|
23
|
+
} as const;
|
|
24
|
+
export type FieldBatchFormatVersion = Brand<
|
|
25
|
+
(typeof FieldBatchFormatVersion)[keyof typeof FieldBatchFormatVersion],
|
|
26
|
+
"FieldBatchFormatVersion"
|
|
27
|
+
>;
|
|
20
28
|
|
|
21
29
|
// Compatible versions used for format/version validation.
|
|
22
30
|
// TODO: A proper version update policy will need to be documented.
|
|
23
|
-
export const validVersions = new Set([
|
|
31
|
+
export const validVersions = new Set([FieldBatchFormatVersion.v1]);
|
|
24
32
|
|
|
25
33
|
/**
|
|
26
34
|
* Top level length is implied from length of data array.
|
|
@@ -209,5 +217,8 @@ export type EncodedNodeShape = Static<typeof EncodedNodeShape>;
|
|
|
209
217
|
export type EncodedAnyShape = Static<typeof EncodedAnyShape>;
|
|
210
218
|
export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
|
|
211
219
|
|
|
212
|
-
export const EncodedFieldBatch = EncodedFieldBatchGeneric(
|
|
220
|
+
export const EncodedFieldBatch = EncodedFieldBatchGeneric(
|
|
221
|
+
FieldBatchFormatVersion.v1,
|
|
222
|
+
EncodedChunkShape,
|
|
223
|
+
);
|
|
213
224
|
export type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
EncodedFieldBatch,
|
|
8
|
+
type FieldBatchFormatVersion,
|
|
9
|
+
} from "./format.js";
|
|
7
10
|
export type { FieldBatch } from "./fieldBatch.js";
|
|
8
11
|
export {
|
|
9
12
|
type FieldBatchCodec,
|
|
10
13
|
makeFieldBatchCodec,
|
|
11
14
|
type FieldBatchEncodingContext,
|
|
12
|
-
fluidVersionToFieldBatchCodecWriteVersion,
|
|
13
15
|
type IncrementalEncoderDecoder,
|
|
14
16
|
type IncrementalEncoder,
|
|
15
17
|
type IncrementalDecoder,
|
|
@@ -12,10 +12,10 @@ import type { FluidSerializableReadOnly } from "../../valueUtilities.js";
|
|
|
12
12
|
|
|
13
13
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
14
14
|
import {
|
|
15
|
+
FieldBatchFormatVersion,
|
|
15
16
|
type EncodedFieldBatch,
|
|
16
17
|
type EncodedNestedArrayShape,
|
|
17
18
|
type EncodedNodeShape,
|
|
18
|
-
version,
|
|
19
19
|
} from "./format.js";
|
|
20
20
|
import type { ShapeIndex } from "./formatGeneric.js";
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ import type { ShapeIndex } from "./formatGeneric.js";
|
|
|
30
30
|
export function uncompressedEncode(batch: FieldBatch): EncodedFieldBatch {
|
|
31
31
|
const rootFields = batch.map(encodeSequence);
|
|
32
32
|
return {
|
|
33
|
-
version,
|
|
33
|
+
version: FieldBatchFormatVersion.v1,
|
|
34
34
|
identifiers: [],
|
|
35
35
|
// A single shape used to encode all fields.
|
|
36
36
|
shapes: [{ c: anyNodeShape }, { a: anyArray }],
|
|
@@ -107,8 +107,7 @@ export const required = new FieldKindWithEditor(
|
|
|
107
107
|
// Which direction is allowed is a subjective policy choice.
|
|
108
108
|
(other.kind === sequence.identifier ||
|
|
109
109
|
other.kind === requiredIdentifier ||
|
|
110
|
-
other.kind === optional.identifier
|
|
111
|
-
other.kind === nodeKey.identifier) &&
|
|
110
|
+
other.kind === optional.identifier) &&
|
|
112
111
|
allowsTreeSchemaIdentifierSuperset(types, other.types),
|
|
113
112
|
new Set(),
|
|
114
113
|
);
|
|
@@ -129,28 +128,6 @@ export const sequence = new FieldKindWithEditor(
|
|
|
129
128
|
new Set([]),
|
|
130
129
|
);
|
|
131
130
|
|
|
132
|
-
const nodeKeyIdentifier = "NodeKey";
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Exactly one identifier.
|
|
136
|
-
*
|
|
137
|
-
* TODO: this is almost the same as identifier, but apparently unused.
|
|
138
|
-
* Confirm if this is truly unused since before the document format was stabilized, and remove if possible.
|
|
139
|
-
* @deprecated Superseded by {@link identifier}.
|
|
140
|
-
*/
|
|
141
|
-
export const nodeKey = new FieldKindWithEditor(
|
|
142
|
-
nodeKeyIdentifier,
|
|
143
|
-
Multiplicity.Single,
|
|
144
|
-
noChangeHandler,
|
|
145
|
-
(types, other) =>
|
|
146
|
-
(other.kind === sequence.identifier ||
|
|
147
|
-
other.kind === requiredIdentifier ||
|
|
148
|
-
other.kind === optional.identifier ||
|
|
149
|
-
other.kind === nodeKeyIdentifier) &&
|
|
150
|
-
allowsTreeSchemaIdentifierSuperset(types, other.types),
|
|
151
|
-
new Set(),
|
|
152
|
-
);
|
|
153
|
-
|
|
154
131
|
const identifierFieldIdentifier = "Identifier";
|
|
155
132
|
|
|
156
133
|
/**
|
|
@@ -214,7 +191,6 @@ export const fieldKindConfigurations: ReadonlyMap<
|
|
|
214
191
|
[
|
|
215
192
|
brand(1),
|
|
216
193
|
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
|
|
217
|
-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
|
|
218
194
|
[required.identifier, { kind: required, formatVersion: 1 }],
|
|
219
195
|
[optional.identifier, { kind: optional, formatVersion: 1 }],
|
|
220
196
|
[sequence.identifier, { kind: sequence, formatVersion: 1 }],
|
|
@@ -225,7 +201,6 @@ export const fieldKindConfigurations: ReadonlyMap<
|
|
|
225
201
|
[
|
|
226
202
|
brand(2),
|
|
227
203
|
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
|
|
228
|
-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
|
|
229
204
|
[required.identifier, { kind: required, formatVersion: 2 }],
|
|
230
205
|
[optional.identifier, { kind: optional, formatVersion: 2 }],
|
|
231
206
|
[sequence.identifier, { kind: sequence, formatVersion: 1 }],
|
|
@@ -236,7 +211,6 @@ export const fieldKindConfigurations: ReadonlyMap<
|
|
|
236
211
|
[
|
|
237
212
|
brand(3),
|
|
238
213
|
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
|
|
239
|
-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
|
|
240
214
|
[required.identifier, { kind: required, formatVersion: 2 }],
|
|
241
215
|
[optional.identifier, { kind: optional, formatVersion: 2 }],
|
|
242
216
|
[sequence.identifier, { kind: sequence, formatVersion: 2 }],
|
|
@@ -247,7 +221,6 @@ export const fieldKindConfigurations: ReadonlyMap<
|
|
|
247
221
|
[
|
|
248
222
|
brand(4),
|
|
249
223
|
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
|
|
250
|
-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
|
|
251
224
|
[required.identifier, { kind: required, formatVersion: 2 }],
|
|
252
225
|
[optional.identifier, { kind: optional, formatVersion: 2 }],
|
|
253
226
|
[sequence.identifier, { kind: sequence, formatVersion: 3 }],
|
|
@@ -284,7 +257,7 @@ export function getCodecTreeForModularChangeFormat(
|
|
|
284
257
|
* code which uses this should be audited for compatibility considerations.
|
|
285
258
|
*/
|
|
286
259
|
export const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(
|
|
287
|
-
[required, optional, sequence,
|
|
260
|
+
[required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]),
|
|
288
261
|
);
|
|
289
262
|
|
|
290
263
|
// Create named Aliases for nicer intellisense.
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
type CodecTree,
|
|
10
|
-
type
|
|
11
|
+
type CodecWriteOptions,
|
|
11
12
|
type IJsonCodec,
|
|
12
13
|
makeVersionedValidatedCodec,
|
|
13
14
|
} from "../../codec/index.js";
|
|
14
15
|
import type { FieldKey, ITreeCursorSynchronous } from "../../core/index.js";
|
|
15
16
|
import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
|
|
16
17
|
|
|
17
|
-
import { Format } from "./format.js";
|
|
18
|
-
import
|
|
18
|
+
import { Format, ForestFormatVersion } from "./format.js";
|
|
19
|
+
import { brand } from "../../util/index.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Uses field cursors
|
|
@@ -23,15 +24,28 @@ import type { Brand } from "../../util/index.js";
|
|
|
23
24
|
export type FieldSet = ReadonlyMap<FieldKey, ITreeCursorSynchronous>;
|
|
24
25
|
export type ForestCodec = IJsonCodec<FieldSet, Format, Format, FieldBatchEncodingContext>;
|
|
25
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Convert a MinimumVersionForCollab to a ForestFormatVersion.
|
|
29
|
+
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
30
|
+
* @returns The ForestFormatVersion that corresponds to the provided MinimumVersionForCollab.
|
|
31
|
+
*/
|
|
32
|
+
function clientVersionToForestSummaryVersion(
|
|
33
|
+
clientVersion: MinimumVersionForCollab,
|
|
34
|
+
): ForestFormatVersion {
|
|
35
|
+
// Currently, forest summary codec only writes in version 1.
|
|
36
|
+
return brand(ForestFormatVersion.v1);
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
export function makeForestSummarizerCodec(
|
|
27
|
-
options:
|
|
40
|
+
options: CodecWriteOptions,
|
|
28
41
|
fieldBatchCodec: FieldBatchCodec,
|
|
29
42
|
): ForestCodec {
|
|
30
43
|
const inner = fieldBatchCodec;
|
|
31
44
|
// TODO: AB#41865
|
|
32
45
|
// This needs to be updated to support multiple versions.
|
|
33
46
|
// The second version will be used to enable incremental summarization.
|
|
34
|
-
|
|
47
|
+
const writeVersion = clientVersionToForestSummaryVersion(options.minVersionForCollab);
|
|
48
|
+
return makeVersionedValidatedCodec(options, new Set([ForestFormatVersion.v1]), Format, {
|
|
35
49
|
encode: (data: FieldSet, context: FieldBatchEncodingContext): Format => {
|
|
36
50
|
const keys: FieldKey[] = [];
|
|
37
51
|
const fields: ITreeCursorSynchronous[] = [];
|
|
@@ -39,7 +53,7 @@ export function makeForestSummarizerCodec(
|
|
|
39
53
|
keys.push(key);
|
|
40
54
|
fields.push(value);
|
|
41
55
|
}
|
|
42
|
-
return { keys, fields: inner.encode(fields, context), version:
|
|
56
|
+
return { keys, fields: inner.encode(fields, context), version: writeVersion };
|
|
43
57
|
},
|
|
44
58
|
decode: (data: Format, context: FieldBatchEncodingContext): FieldSet => {
|
|
45
59
|
const out: Map<FieldKey, ITreeCursorSynchronous> = new Map();
|
|
@@ -53,7 +67,8 @@ export function makeForestSummarizerCodec(
|
|
|
53
67
|
});
|
|
54
68
|
}
|
|
55
69
|
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
export function getCodecTreeForForestFormat(
|
|
71
|
+
clientVersion: MinimumVersionForCollab,
|
|
72
|
+
): CodecTree {
|
|
73
|
+
return { name: "Forest", version: clientVersionToForestSummaryVersion(clientVersion) };
|
|
59
74
|
}
|
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
SummaryElementStringifier,
|
|
34
34
|
} from "../../shared-tree-core/index.js";
|
|
35
35
|
import { idAllocatorFromMaxId, type JsonCompatible } from "../../util/index.js";
|
|
36
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
36
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
37
37
|
import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
|
|
38
38
|
import {
|
|
39
39
|
defaultIncrementalEncodingPolicy,
|
|
@@ -7,12 +7,22 @@ import { type Static, Type } from "@sinclair/typebox";
|
|
|
7
7
|
|
|
8
8
|
import { Versioned } from "../../codec/index.js";
|
|
9
9
|
import { schemaFormatV1 } from "../../core/index.js";
|
|
10
|
+
import type { Brand } from "../../util/index.js";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The format version for the forest.
|
|
14
|
+
*/
|
|
15
|
+
export const ForestFormatVersion = {
|
|
16
|
+
v1: 1,
|
|
17
|
+
} as const;
|
|
18
|
+
export type ForestFormatVersion = Brand<
|
|
19
|
+
(typeof ForestFormatVersion)[keyof typeof ForestFormatVersion],
|
|
20
|
+
"ForestFormatVersion"
|
|
21
|
+
>;
|
|
12
22
|
|
|
13
23
|
export const Format = Type.Object(
|
|
14
24
|
{
|
|
15
|
-
version: Type.Literal(
|
|
25
|
+
version: Type.Literal(ForestFormatVersion.v1),
|
|
16
26
|
keys: Type.Array(schemaFormatV1.FieldKeySchema),
|
|
17
27
|
fields: Versioned,
|
|
18
28
|
},
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export { forestSummaryKey, ForestSummarizer } from "./forestSummarizer.js";
|
|
7
|
-
export { getCodecTreeForForestFormat
|
|
7
|
+
export { getCodecTreeForForestFormat } from "./codec.js";
|
|
8
|
+
export { ForestFormatVersion } from "./format.js";
|
|
@@ -33,6 +33,7 @@ export {
|
|
|
33
33
|
makeSchemaCodec,
|
|
34
34
|
makeSchemaCodecs,
|
|
35
35
|
getCodecTreeForSchemaFormat,
|
|
36
|
+
clientVersionToSchemaVersion,
|
|
36
37
|
} from "./schema-index/index.js";
|
|
37
38
|
export {
|
|
38
39
|
stackTreeNodeCursor,
|
|
@@ -107,7 +108,6 @@ export {
|
|
|
107
108
|
getCodecTreeForFieldBatchFormat,
|
|
108
109
|
makeTreeChunker,
|
|
109
110
|
makeFieldBatchCodec,
|
|
110
|
-
fluidVersionToFieldBatchCodecWriteVersion,
|
|
111
111
|
type FieldBatchEncodingContext,
|
|
112
112
|
emptyChunk,
|
|
113
113
|
combineChunks,
|
|
@@ -203,7 +203,6 @@ export {
|
|
|
203
203
|
makeSchemaChangeCodecs,
|
|
204
204
|
EncodedSchemaChange,
|
|
205
205
|
getCodecTreeForSchemaChangeFormat,
|
|
206
|
-
type SchemaChangeFormatVersion,
|
|
207
206
|
} from "./schema-edits/index.js";
|
|
208
207
|
|
|
209
208
|
export { makeMitigatedChangeFamily } from "./mitigatedChangeFamily.js";
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
export {
|
|
7
7
|
makeSchemaChangeCodecs,
|
|
8
8
|
getCodecTreeForSchemaChangeFormat,
|
|
9
|
-
type SchemaChangeFormatVersion,
|
|
10
9
|
} from "./schemaChangeCodecs.js";
|
|
11
10
|
export type { SchemaChange } from "./schemaChangeTypes.js";
|
|
12
11
|
export { EncodedSchemaChange } from "./schemaChangeFormat.js";
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
type CodecTree,
|
|
11
|
+
type CodecWriteOptions,
|
|
10
12
|
type ICodecFamily,
|
|
11
|
-
type ICodecOptions,
|
|
12
13
|
type IJsonCodec,
|
|
13
14
|
makeCodecFamily,
|
|
14
15
|
makeVersionDispatchingCodec,
|
|
@@ -18,32 +19,31 @@ import { getCodecTreeForSchemaFormat, makeSchemaCodec } from "../schema-index/in
|
|
|
18
19
|
|
|
19
20
|
import { EncodedSchemaChange } from "./schemaChangeFormat.js";
|
|
20
21
|
import type { SchemaChange } from "./schemaChangeTypes.js";
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
22
|
+
import { SchemaFormatVersion } from "../../core/index.js";
|
|
23
|
+
import { brand } from "../../util/index.js";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Create a family of schema change codecs.
|
|
26
27
|
* @param options - Specifies common codec options, including which `validator` to use.
|
|
27
28
|
* @returns The composed codec family.
|
|
28
29
|
*/
|
|
29
|
-
export function makeSchemaChangeCodecs(
|
|
30
|
+
export function makeSchemaChangeCodecs(
|
|
31
|
+
options: CodecWriteOptions,
|
|
32
|
+
): ICodecFamily<SchemaChange> {
|
|
30
33
|
return makeCodecFamily([
|
|
31
|
-
[
|
|
32
|
-
[
|
|
34
|
+
[SchemaFormatVersion.v1, makeSchemaChangeCodecV1(options, brand(SchemaFormatVersion.v1))],
|
|
35
|
+
[SchemaFormatVersion.v2, makeSchemaChangeCodecV1(options, brand(SchemaFormatVersion.v2))],
|
|
33
36
|
]);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
export type SchemaChangeFormatVersion = Brand<
|
|
37
|
-
SchemaVersion.v1 | SchemaVersion.v2,
|
|
38
|
-
"SchemaChangeFormatVersion"
|
|
39
|
-
>;
|
|
40
39
|
export function getCodecTreeForSchemaChangeFormat(
|
|
41
|
-
version:
|
|
40
|
+
version: SchemaFormatVersion,
|
|
41
|
+
clientVersion: MinimumVersionForCollab,
|
|
42
42
|
): CodecTree {
|
|
43
43
|
return {
|
|
44
44
|
name: "SchemaChange",
|
|
45
45
|
version,
|
|
46
|
-
children: [getCodecTreeForSchemaFormat(
|
|
46
|
+
children: [getCodecTreeForSchemaFormat(clientVersion)],
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -54,8 +54,8 @@ export function getCodecTreeForSchemaChangeFormat(
|
|
|
54
54
|
* @returns The composed codec.
|
|
55
55
|
*/
|
|
56
56
|
export function makeSchemaChangeCodec(
|
|
57
|
-
options:
|
|
58
|
-
writeVersion:
|
|
57
|
+
options: CodecWriteOptions,
|
|
58
|
+
writeVersion: SchemaFormatVersion,
|
|
59
59
|
): IJsonCodec<SchemaChange> {
|
|
60
60
|
const family = makeSchemaChangeCodecs(options);
|
|
61
61
|
return makeVersionDispatchingCodec(family, { ...options, writeVersion });
|
|
@@ -68,8 +68,8 @@ export function makeSchemaChangeCodec(
|
|
|
68
68
|
* @returns The composed schema change codec.
|
|
69
69
|
*/
|
|
70
70
|
function makeSchemaChangeCodecV1(
|
|
71
|
-
options:
|
|
72
|
-
schemaWriteVersion:
|
|
71
|
+
options: CodecWriteOptions,
|
|
72
|
+
schemaWriteVersion: SchemaFormatVersion,
|
|
73
73
|
): IJsonCodec<SchemaChange, EncodedSchemaChange> {
|
|
74
74
|
const schemaCodec = makeSchemaCodec(options, schemaWriteVersion);
|
|
75
75
|
const schemaChangeCodec: IJsonCodec<SchemaChange, EncodedSchemaChange> = {
|
|
@@ -7,6 +7,8 @@ import { fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type CodecTree,
|
|
10
|
+
type CodecWriteOptions,
|
|
11
|
+
FluidClientVersion,
|
|
10
12
|
type ICodecFamily,
|
|
11
13
|
type ICodecOptions,
|
|
12
14
|
type IJsonCodec,
|
|
@@ -15,7 +17,7 @@ import {
|
|
|
15
17
|
makeVersionedValidatedCodec,
|
|
16
18
|
} from "../../codec/index.js";
|
|
17
19
|
import {
|
|
18
|
-
|
|
20
|
+
SchemaFormatVersion,
|
|
19
21
|
type TreeNodeSchemaIdentifier,
|
|
20
22
|
type TreeNodeStoredSchema,
|
|
21
23
|
type TreeStoredSchema,
|
|
@@ -31,35 +33,42 @@ import { Format as FormatV2 } from "./formatV2.js";
|
|
|
31
33
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
* Convert a MinimumVersionForCollab to a
|
|
36
|
+
* Convert a MinimumVersionForCollab to a SchemaFormatVersion.
|
|
35
37
|
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
36
|
-
* @returns The
|
|
38
|
+
* @returns The SchemaFormatVersion that corresponds to the provided MinimumVersionForCollab.
|
|
37
39
|
*/
|
|
38
40
|
export function clientVersionToSchemaVersion(
|
|
39
41
|
clientVersion: MinimumVersionForCollab,
|
|
40
|
-
):
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
): SchemaFormatVersion {
|
|
43
|
+
return clientVersion < FluidClientVersion.v2_43
|
|
44
|
+
? brand(SchemaFormatVersion.v1)
|
|
45
|
+
: brand(SchemaFormatVersion.v2);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
export function getCodecTreeForSchemaFormat(
|
|
46
|
-
|
|
48
|
+
export function getCodecTreeForSchemaFormat(
|
|
49
|
+
clientVersion: MinimumVersionForCollab,
|
|
50
|
+
): CodecTree {
|
|
51
|
+
return { name: "Schema", version: clientVersionToSchemaVersion(clientVersion) };
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
/**
|
|
50
55
|
* Create a schema codec.
|
|
51
|
-
* @param options - Specifies common codec options, including which `validator` to use.
|
|
52
|
-
* @param
|
|
56
|
+
* @param options - Specifies common codec options, including `minVersionForCollab` and which `validator` to use.
|
|
57
|
+
* @param writeVersionOverride - The schema version to write. If not provided, the version will be derived from `minVersionForCollab`.
|
|
53
58
|
* @returns The composed codec.
|
|
54
59
|
*
|
|
55
60
|
* @privateRemarks We should consider using the Shared Tree format version instead as it may be more valuable for application authors than the schema version.
|
|
56
61
|
*/
|
|
57
62
|
export function makeSchemaCodec(
|
|
58
|
-
options:
|
|
59
|
-
|
|
63
|
+
options: CodecWriteOptions,
|
|
64
|
+
writeVersionOverride?: SchemaFormatVersion,
|
|
60
65
|
): IJsonCodec<TreeStoredSchema> {
|
|
61
66
|
const family = makeSchemaCodecs(options);
|
|
62
|
-
return makeVersionDispatchingCodec(family, {
|
|
67
|
+
return makeVersionDispatchingCodec(family, {
|
|
68
|
+
...options,
|
|
69
|
+
writeVersion:
|
|
70
|
+
writeVersionOverride ?? clientVersionToSchemaVersion(options.minVersionForCollab),
|
|
71
|
+
});
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
/**
|
|
@@ -69,8 +78,8 @@ export function makeSchemaCodec(
|
|
|
69
78
|
*/
|
|
70
79
|
export function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStoredSchema> {
|
|
71
80
|
return makeCodecFamily([
|
|
72
|
-
[
|
|
73
|
-
[
|
|
81
|
+
[SchemaFormatVersion.v1, makeSchemaCodecV1(options)],
|
|
82
|
+
[SchemaFormatVersion.v2, makeSchemaCodecV2(options)],
|
|
74
83
|
]);
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -80,11 +89,14 @@ export function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStore
|
|
|
80
89
|
* @param version - The schema write version.
|
|
81
90
|
* @returns The encoded schema.
|
|
82
91
|
*/
|
|
83
|
-
export function encodeRepo(
|
|
92
|
+
export function encodeRepo(
|
|
93
|
+
repo: TreeStoredSchema,
|
|
94
|
+
version: SchemaFormatVersion,
|
|
95
|
+
): JsonCompatible {
|
|
84
96
|
switch (version) {
|
|
85
|
-
case
|
|
97
|
+
case SchemaFormatVersion.v1:
|
|
86
98
|
return encodeRepoV1(repo) as JsonCompatible;
|
|
87
|
-
case
|
|
99
|
+
case SchemaFormatVersion.v2:
|
|
88
100
|
return encodeRepoV2(repo) as JsonCompatible;
|
|
89
101
|
default:
|
|
90
102
|
unreachableCase(version);
|
|
@@ -95,7 +107,7 @@ function encodeRepoV1(repo: TreeStoredSchema): FormatV1 {
|
|
|
95
107
|
const nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV1());
|
|
96
108
|
const rootFieldSchema = encodeFieldSchemaV1(repo.rootFieldSchema);
|
|
97
109
|
return {
|
|
98
|
-
version:
|
|
110
|
+
version: SchemaFormatVersion.v1,
|
|
99
111
|
nodes: nodeSchema,
|
|
100
112
|
root: rootFieldSchema,
|
|
101
113
|
};
|
|
@@ -105,7 +117,7 @@ function encodeRepoV2(repo: TreeStoredSchema): FormatV2 {
|
|
|
105
117
|
const nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV2());
|
|
106
118
|
const rootFieldSchema = encodeFieldSchemaV2(repo.rootFieldSchema);
|
|
107
119
|
return {
|
|
108
|
-
version:
|
|
120
|
+
version: SchemaFormatVersion.v2,
|
|
109
121
|
nodes: nodeSchema,
|
|
110
122
|
root: rootFieldSchema,
|
|
111
123
|
};
|
|
@@ -169,7 +181,7 @@ function decodeV2(f: FormatV2): TreeStoredSchema {
|
|
|
169
181
|
* @returns The codec.
|
|
170
182
|
*/
|
|
171
183
|
function makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV1> {
|
|
172
|
-
return makeVersionedValidatedCodec(options, new Set([
|
|
184
|
+
return makeVersionedValidatedCodec(options, new Set([SchemaFormatVersion.v1]), FormatV1, {
|
|
173
185
|
encode: (data: TreeStoredSchema) => encodeRepoV1(data),
|
|
174
186
|
decode: (data: FormatV1) => decodeV1(data),
|
|
175
187
|
});
|
|
@@ -181,7 +193,7 @@ function makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema,
|
|
|
181
193
|
* @returns The codec.
|
|
182
194
|
*/
|
|
183
195
|
function makeSchemaCodecV2(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV2> {
|
|
184
|
-
return makeVersionedValidatedCodec(options, new Set([
|
|
196
|
+
return makeVersionedValidatedCodec(options, new Set([SchemaFormatVersion.v2]), FormatV2, {
|
|
185
197
|
encode: (data: TreeStoredSchema) => encodeRepoV2(data),
|
|
186
198
|
decode: (data: FormatV2) => decodeV2(data),
|
|
187
199
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { SchemaFormatVersion, schemaFormatV1 } from "../../core/index.js";
|
|
9
9
|
|
|
10
10
|
const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
|
21
21
|
*/
|
|
22
22
|
export const Format = Type.Object(
|
|
23
23
|
{
|
|
24
|
-
version: Type.Literal(
|
|
24
|
+
version: Type.Literal(SchemaFormatVersion.v1),
|
|
25
25
|
nodes: Type.Record(Type.String(), schemaFormatV1.TreeNodeSchemaDataFormat),
|
|
26
26
|
root: schemaFormatV1.FieldSchemaFormat,
|
|
27
27
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { SchemaFormatVersion, schemaFormatV2 } from "../../core/index.js";
|
|
9
9
|
|
|
10
10
|
const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
|
21
21
|
*/
|
|
22
22
|
export const Format = Type.Object(
|
|
23
23
|
{
|
|
24
|
-
version: Type.Literal(
|
|
24
|
+
version: Type.Literal(SchemaFormatVersion.v2),
|
|
25
25
|
nodes: Type.Record(Type.String(), schemaFormatV2.TreeNodeSchemaDataFormat),
|
|
26
26
|
root: schemaFormatV2.FieldSchemaFormat,
|
|
27
27
|
},
|
|
@@ -17,6 +17,7 @@ import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
|
17
17
|
import type { IJsonCodec } from "../../codec/index.js";
|
|
18
18
|
import {
|
|
19
19
|
type MutableTreeStoredSchema,
|
|
20
|
+
type SchemaFormatVersion,
|
|
20
21
|
type TreeStoredSchema,
|
|
21
22
|
schemaDataIsEmpty,
|
|
22
23
|
} from "../../core/index.js";
|
|
@@ -108,7 +109,7 @@ export class SchemaSummarizer implements Summarizable {
|
|
|
108
109
|
*/
|
|
109
110
|
export function encodeTreeSchema(
|
|
110
111
|
schema: TreeStoredSchema,
|
|
111
|
-
writeVersion:
|
|
112
|
+
writeVersion: SchemaFormatVersion,
|
|
112
113
|
): JsonCompatible {
|
|
113
114
|
return encodeRepo(schema, writeVersion);
|
|
114
115
|
}
|