@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
package/lib/util/brand.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/util/brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/util/brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,KAAK,CAAC,SAAS,EAAE,IAAI,IAAI,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8BAAsB,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI;IACpD,SAAS,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAE5C;;OAEG;IACH,OAAO;IAEP;;;;OAIG;WACW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,KAAK;CAKhE;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,WAAW,CAC5F,MAAM,SAAS,EACf,OAAO,CACP,GACE,SAAS,GACT,KAAK,CAAC;AAET;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,WAAW,CAC3F,OAAO,EACP,MAAM,IAAI,CACV,GACE,IAAI,GACJ,KAAK,CAAC;AAET;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,SAAS,WAAW,CAAC,MAAM,SAAS,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,KAAK,GACxE,CAAC,CAEH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,CAAC,EACjC,KAAK,EAAE,CAAC,GACN,CAAC,EAAE,SAAS,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,GAAG,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,WAAW,CAAC,MAAM,SAAS,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GACvF,EAAE,GACF,CAAC,KAAK,CAAC,KACN,EAAE,GAAG,CAAC,CAEV"}
|
package/lib/util/brand.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Implementation detail for {@link Brand}.
|
|
8
8
|
*
|
|
9
9
|
* See `MakeNominal` for some more details.
|
|
10
10
|
*
|
|
@@ -42,6 +42,11 @@ export class BrandedType {
|
|
|
42
42
|
* Adds a type {@link Brand} to a value.
|
|
43
43
|
*
|
|
44
44
|
* Only do this when specifically allowed by the requirements of the type being converted to.
|
|
45
|
+
* @remarks
|
|
46
|
+
* This infers the branded type from context so it can very easily be used to a semantically invalid conversion.
|
|
47
|
+
* Treat this like "as" casts: they are an indicator that the user/reader must ensure the conversion is valid.
|
|
48
|
+
*
|
|
49
|
+
* If branding a constant, and wanting to preserve the exact typing of the constant, use {@link brandConst} instead.
|
|
45
50
|
* @privateRemarks
|
|
46
51
|
* Leaving `T` unconstrained here allows for better type inference when branding unions.
|
|
47
52
|
* For example when assigning `brand(number)` a number to an optional branded number field,
|
|
@@ -53,4 +58,24 @@ export class BrandedType {
|
|
|
53
58
|
export function brand(value) {
|
|
54
59
|
return value;
|
|
55
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Adds a type {@link Brand} to a value, while preserving the exact type of the value being branded.
|
|
63
|
+
* @remarks
|
|
64
|
+
* This takes in the type to brand to as a required type parameter, unlike {@link brand} which infers it from context.
|
|
65
|
+
* This also preserves the exact type of the value being branded.
|
|
66
|
+
* TypeScript has no way to take an explicit type parameter and infer another in a single generic context.
|
|
67
|
+
* To work around this, two generic contexts are used, first a function to infer the parameter type,
|
|
68
|
+
* and a second function (returned) to take the explicit type parameter.
|
|
69
|
+
*
|
|
70
|
+
* This is intended for use when branding constants.
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const requiredIdentifier = brandConst("Value")<FieldKindIdentifier>();
|
|
74
|
+
* ```
|
|
75
|
+
* @privateRemarks
|
|
76
|
+
* The dummy parameter is used to produce a compile error in the event where the value being branded is incompatible with the branded type.
|
|
77
|
+
*/
|
|
78
|
+
export function brandConst(value) {
|
|
79
|
+
return () => value;
|
|
80
|
+
}
|
|
56
81
|
//# sourceMappingURL=brand.js.map
|
package/lib/util/brand.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/util/brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/util/brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAwBtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,WAAW;IAahC;;OAEG;IACH,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAY;QAC9C,MAAM,IAAI,UAAU,CACnB,0GAA0G,CAC1G,CAAC;IACH,CAAC;CACD;AAwBD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,KAAK,CACpB,KAA0E;IAE1E,OAAO,KAAU,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CACzB,KAAQ;IAMR,OAAO,GAAO,EAAE,CAAC,KAAe,CAAC;AAClC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { Covariant } from \"./typeCheck.js\";\n\n/**\n * Constructs a \"Branded\" type, adding a type-checking only field to `ValueType`.\n * @remarks\n * Two usages of `Brand` should never use the same `Name`.\n * If they do, the resulting types will be assignable which defeats the point of this type.\n *\n * This type is constructed such that the first line of type errors when assigning\n * mismatched branded types will be:\n * `Type 'Name1' is not assignable to type 'Name2'.`\n *\n * These branded types are not opaque: A `Brand<A, B>` can still be used as a `A`.\n *\n * @example Simple usage:\n * ```typescript\n * export type StrongId = Brand<string, \"tree.StrongId\">;\n * const x: StrongId = brand(\"myId\");\n * ```\n */\nexport type Brand<ValueType, Name> = ValueType & BrandedType<ValueType, Name>;\n\n/**\n * Implementation detail for {@link Brand}.\n *\n * See `MakeNominal` for some more details.\n *\n * Do not use this class with `instanceof`: this will always be false at runtime,\n * but the compiler may think it's true in some cases.\n *\n * @remarks\n * This is covariant over ValueType.\n * This is suitable for when ValueType is immutable (like string or number),\n * which is the common use-case for branding.\n *\n * @privateRemarks\n * This is split out into its own type as that's the only way to:\n *\n * - make the member protected (so you can't accidentally try and access it).\n * - get nominal typing (so types produced without using this class can never be assignable to it).\n *\n * @sealed\n */\nexport abstract class BrandedType<out ValueType, Name> {\n\tprotected _typeCheck?: Covariant<ValueType>;\n\t/**\n\t * Compile time only marker to make type checking more strict.\n\t * This method will not exist at runtime and accessing it is invalid.\n\t * See {@link Brand} for details.\n\t *\n\t * @privateRemarks\n\t * `Name` is used as the return type of a method rather than a a simple readonly member as this allows types with two brands to be intersected without getting `never`.\n\t * The method takes in never to help emphasize that its not callable.\n\t */\n\tprotected abstract brand(dummy: never): Name;\n\n\t/**\n\t * This class should never exist at runtime, so make it un-constructable.\n\t */\n\tprivate constructor() {}\n\n\t/**\n\t * Since this class is a compile time only type brand, `instanceof` will never work with it.\n\t * This `Symbol.hasInstance` implementation ensures that `instanceof` will error if used,\n\t * and in TypeScript 5.3 and newer will produce a compile time error if used.\n\t */\n\tpublic static [Symbol.hasInstance](value: never): value is never {\n\t\tthrow new UsageError(\n\t\t\t\"BrandedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.\",\n\t\t);\n\t}\n}\n\n/**\n * Implementation detail of type branding. Should not be used directly outside this file,\n * but shows up as part of branded types so API-Extractor requires it to be exported.\n */\nexport type ValueFromBranded<T extends BrandedType<unknown, unknown>> = T extends BrandedType<\n\tinfer ValueType,\n\tunknown\n>\n\t? ValueType\n\t: never;\n\n/**\n * Implementation detail of type branding. Should not be used directly outside this file,\n * but shows up as part of branded types so API-Extractor requires it to be exported.\n */\nexport type NameFromBranded<T extends BrandedType<unknown, unknown>> = T extends BrandedType<\n\tunknown,\n\tinfer Name\n>\n\t? Name\n\t: never;\n\n/**\n * Adds a type {@link Brand} to a value.\n *\n * Only do this when specifically allowed by the requirements of the type being converted to.\n * @remarks\n * This infers the branded type from context so it can very easily be used to a semantically invalid conversion.\n * Treat this like \"as\" casts: they are an indicator that the user/reader must ensure the conversion is valid.\n *\n * If branding a constant, and wanting to preserve the exact typing of the constant, use {@link brandConst} instead.\n * @privateRemarks\n * Leaving `T` unconstrained here allows for better type inference when branding unions.\n * For example when assigning `brand(number)` a number to an optional branded number field,\n * constraining T to `BrandedType<unknown, string>` causes the inference to fail and requires explicitly providing the type parameter.\n * For example leaving T unconstrained instead allows the union of `BrandedType | undefined` to distribute over the conditional allowing the branding only the the union members which should be branded.\n * This does not permit branding an optional value into an optional field since non branded union members are still excluded from input to this function:\n * this is an intended restriction as it causes compile errors for misuse of this function (like using brand when the relevant type is not a branded type).\n */\nexport function brand<T>(\n\tvalue: T extends BrandedType<infer ValueType, unknown> ? ValueType : never,\n): T {\n\treturn value as T;\n}\n\n/**\n * Adds a type {@link Brand} to a value, while preserving the exact type of the value being branded.\n * @remarks\n * This takes in the type to brand to as a required type parameter, unlike {@link brand} which infers it from context.\n * This also preserves the exact type of the value being branded.\n * TypeScript has no way to take an explicit type parameter and infer another in a single generic context.\n * To work around this, two generic contexts are used, first a function to infer the parameter type,\n * and a second function (returned) to take the explicit type parameter.\n *\n * This is intended for use when branding constants.\n * @example\n * ```typescript\n * const requiredIdentifier = brandConst(\"Value\")<FieldKindIdentifier>();\n * ```\n * @privateRemarks\n * The dummy parameter is used to produce a compile error in the event where the value being branded is incompatible with the branded type.\n */\nexport function brandConst<const T>(\n\tvalue: T,\n): <T2 extends BrandedType<unknown, unknown>>(\n\t...dummy: T extends (T2 extends BrandedType<infer ValueType, unknown> ? ValueType : never)\n\t\t? []\n\t\t: [never]\n) => T2 & T {\n\treturn <T2>() => value as T2 & T;\n}\n"]}
|
package/lib/util/brandedMap.d.ts
CHANGED
|
@@ -8,10 +8,12 @@ import type { Invariant } from "./typeCheck.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Key in a {@link BrandedMapSubset}.
|
|
10
10
|
* @remarks
|
|
11
|
+
* `TContent` is used as part of the brand to strongly associate the key type with the type of the values it looks up.
|
|
12
|
+
*
|
|
11
13
|
* Due to the `TContent` type parameter being invariant (which it has to be since keys are used to both read and write data),
|
|
12
14
|
* generic collections end up needing to constrain their key's `TContent` to `any`.
|
|
13
15
|
*/
|
|
14
|
-
export type BrandedKey<TKey, TContent> = TKey
|
|
16
|
+
export type BrandedKey<TKey, TContent> = Brand<TKey, ["BrandedKey", Invariant<TContent>]>;
|
|
15
17
|
export type BrandedKeyContent<TKey extends BrandedKey<unknown, any>> = TKey extends BrandedKey<unknown, infer TContent> ? TContent : never;
|
|
16
18
|
/**
|
|
17
19
|
* A Map where the keys carry the types of values which they correspond to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brandedMap.d.ts","sourceRoot":"","sources":["../../src/util/brandedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"brandedMap.d.ts","sourceRoot":"","sources":["../../src/util/brandedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,IAAI,EAAE,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAG1F,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,SAAS,UAAU,CAC7F,OAAO,EACP,MAAM,QAAQ,CACd,GACE,QAAQ,GACR,KAAK,CAAC;AAET;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC;IACnE,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,iBAAiB,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAC9D,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAC/D,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAC1C,GAAG,EAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAChD,GAAG,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EACrB,YAAY,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GACjD,CAAC,CAEH;AASD;;GAEG;AACH,wBAAgB,WAAW,CAG1B,KAAK,SAAS,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,KACjE,KAAK,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brandedMap.js","sourceRoot":"","sources":["../../src/util/brandedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"brandedMap.js","sourceRoot":"","sources":["../../src/util/brandedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA0CzC;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,GAAgD,EAChD,GAAqB,EACrB,YAAmD;IAEnD,OAAO,WAAW,CAAsB,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB;;GAEG;AACH,MAAM,UAAU,WAAW;IAK1B,OAAO,WAAW,EAAW,CAAC;AAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Brand } from \"./brand.js\";\nimport type { Opaque } from \"./opaque.js\";\nimport type { Invariant } from \"./typeCheck.js\";\nimport { getOrCreate } from \"./utils.js\";\n\n/**\n * Key in a {@link BrandedMapSubset}.\n * @remarks\n * `TContent` is used as part of the brand to strongly associate the key type with the type of the values it looks up.\n *\n * Due to the `TContent` type parameter being invariant (which it has to be since keys are used to both read and write data),\n * generic collections end up needing to constrain their key's `TContent` to `any`.\n */\nexport type BrandedKey<TKey, TContent> = Brand<TKey, [\"BrandedKey\", Invariant<TContent>]>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type BrandedKeyContent<TKey extends BrandedKey<unknown, any>> = TKey extends BrandedKey<\n\tunknown,\n\tinfer TContent\n>\n\t? TContent\n\t: never;\n\n/**\n * A Map where the keys carry the types of values which they correspond to.\n *\n * Example usage:\n * ```typescript\n * type FooSlot<TContent> = BrandedKey<Opaque<Brand<number, \"FooSlot\">>, TContent>;\n * const counterSlot = brandedSlot<FooSlot<number>>();\n * const slots: BrandedMapSubset<FooSlot<any>> = new Map();\n * slots.set(counterSlot, slots.get(counterSlot) ?? 0 + 1);\n * ```\n *\n * @remarks\n * These APIs are designed so that a Map can be used to implement this type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface BrandedMapSubset<K extends BrandedKey<unknown, any>> {\n\tget<K2 extends K>(key: K2): BrandedKeyContent<K2> | undefined;\n\thas(key: K): boolean;\n\tset<K2 extends K>(key: K2, value: BrandedKeyContent<K2>): this;\n\tdelete(key: K): boolean;\n}\n\n/**\n * Version of {@link getOrCreate} with better typing for {@link BrandedMapSubset}.\n * @privateRemarks\n * Only infers type from key to avoid inferring `any` from map's key.\n */\nexport function getOrCreateSlotContent<K, V>(\n\tmap: NoInfer<BrandedMapSubset<BrandedKey<K, V>>>,\n\tkey: BrandedKey<K, V>,\n\tdefaultValue: NoInfer<(key: BrandedKey<K, V>) => V>,\n): V {\n\treturn getOrCreate<BrandedKey<K, V>, V>(map, key, defaultValue);\n}\n\n/**\n * A counter used to allocate unique numbers (See {@link brandedSlot}) to use as {@link BrandedKey}s.\n * This allows the keys to be small integers, which are efficient to use as keys in maps.\n * See {@link BrandedMapSubset}.\n */\nlet slotCounter = 0;\n\n/**\n * Define a strongly typed slot in which data can be stored in a {@link BrandedMapSubset}.\n */\nexport function brandedSlot<\n\t// See note on BrandedKey.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlot extends BrandedKey<number | Opaque<Brand<number, string>>, any>,\n>(): TSlot {\n\treturn slotCounter++ as TSlot;\n}\n"]}
|
package/lib/util/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { brand, type Brand, BrandedType, type NameFromBranded, type ValueFromBranded, } from "./brand.js";
|
|
5
|
+
export { brand, type Brand, BrandedType, type NameFromBranded, type ValueFromBranded, brandConst, } from "./brand.js";
|
|
6
6
|
export { brandedNumberType, brandedStringType } from "./typeboxBrand.js";
|
|
7
7
|
export { brandOpaque, extractFromOpaque, type ExtractFromOpaque, type Opaque, } from "./opaque.js";
|
|
8
8
|
export { deleteFromNestedMap, getOrAddInNestedMap, getOrDefaultInNestedMap, forEachInNestedMap, type NestedMap, type ReadonlyNestedMap, SizedNestedMap, populateNestedMap, setInNestedMap, tryAddToNestedMap, tryGetFromNestedMap, mapNestedMap, nestedMapToFlatList, nestedMapFromFlatList, getOrCreateInNestedMap, } from "./nestedMap.js";
|
package/lib/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,MAAM,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,KAAK,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,4BAA4B,EAC5B,SAAS,EACT,WAAW,EACX,cAAc,EACd,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,WAAW,EACX,SAAS,EACT,eAAe,EACf,KAAK,KAAK,EACV,YAAY,EACZ,aAAa,EACb,KAAK,WAAW,EAChB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,EACb,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErF,YAAY,EACX,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EACR,KAAK,gBAAgB,EACrB,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,KAAK,WAAW,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/lib/util/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { brand, BrandedType, } from "./brand.js";
|
|
5
|
+
export { brand, BrandedType, brandConst, } from "./brand.js";
|
|
6
6
|
export { brandedNumberType, brandedStringType } from "./typeboxBrand.js";
|
|
7
7
|
export { brandOpaque, extractFromOpaque, } from "./opaque.js";
|
|
8
8
|
export { deleteFromNestedMap, getOrAddInNestedMap, getOrDefaultInNestedMap, forEachInNestedMap, SizedNestedMap, populateNestedMap, setInNestedMap, tryAddToNestedMap, tryGetFromNestedMap, mapNestedMap, nestedMapToFlatList, nestedMapFromFlatList, getOrCreateInNestedMap, } from "./nestedMap.js";
|
package/lib/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EAEL,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EAEL,WAAW,EAGX,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,GAGjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAGlB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAkB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAmB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAiBrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,eAAe,EAKf,4BAA4B,EAC5B,SAAS,EACT,WAAW,EACX,cAAc,EAId,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,WAAW,EACX,SAAS,EACT,eAAe,EAEf,YAAY,EACZ,aAAa,EAEb,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,EACb,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAyB,MAAM,wBAAwB,CAAC;AAcrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAIN,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EAER,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EAET,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAmB,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n\tbrandConst,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tclone,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromIterable,\n\ttype Named,\n\tcompareNamed,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n\titerableHasSome,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport { type TupleBTree, newTupleBTree, mergeTupleBTrees } from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tree",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"temp-directory": "nyc/.nyc_output"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@fluid-internal/client-utils": "~2.
|
|
105
|
-
"@fluidframework/container-runtime": "~2.
|
|
106
|
-
"@fluidframework/core-interfaces": "~2.
|
|
107
|
-
"@fluidframework/core-utils": "~2.
|
|
108
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
109
|
-
"@fluidframework/driver-definitions": "~2.
|
|
110
|
-
"@fluidframework/id-compressor": "~2.
|
|
111
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
112
|
-
"@fluidframework/runtime-utils": "~2.
|
|
113
|
-
"@fluidframework/shared-object-base": "~2.
|
|
114
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
104
|
+
"@fluid-internal/client-utils": "~2.72.0",
|
|
105
|
+
"@fluidframework/container-runtime": "~2.72.0",
|
|
106
|
+
"@fluidframework/core-interfaces": "~2.72.0",
|
|
107
|
+
"@fluidframework/core-utils": "~2.72.0",
|
|
108
|
+
"@fluidframework/datastore-definitions": "~2.72.0",
|
|
109
|
+
"@fluidframework/driver-definitions": "~2.72.0",
|
|
110
|
+
"@fluidframework/id-compressor": "~2.72.0",
|
|
111
|
+
"@fluidframework/runtime-definitions": "~2.72.0",
|
|
112
|
+
"@fluidframework/runtime-utils": "~2.72.0",
|
|
113
|
+
"@fluidframework/shared-object-base": "~2.72.0",
|
|
114
|
+
"@fluidframework/telemetry-utils": "~2.72.0",
|
|
115
115
|
"@sinclair/typebox": "^0.34.13",
|
|
116
116
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
117
117
|
"@types/ungap__structured-clone": "^1.2.0",
|
|
@@ -122,20 +122,20 @@
|
|
|
122
122
|
"devDependencies": {
|
|
123
123
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
124
124
|
"@biomejs/biome": "~1.9.3",
|
|
125
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
126
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
127
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
128
|
-
"@fluid-private/test-drivers": "~2.
|
|
125
|
+
"@fluid-internal/mocha-test-setup": "~2.72.0",
|
|
126
|
+
"@fluid-private/stochastic-test-utils": "~2.72.0",
|
|
127
|
+
"@fluid-private/test-dds-utils": "~2.72.0",
|
|
128
|
+
"@fluid-private/test-drivers": "~2.72.0",
|
|
129
129
|
"@fluid-tools/benchmark": "^0.51.0",
|
|
130
|
-
"@fluid-tools/build-cli": "^0.
|
|
130
|
+
"@fluid-tools/build-cli": "^0.60.0",
|
|
131
131
|
"@fluidframework/build-common": "^2.0.3",
|
|
132
|
-
"@fluidframework/build-tools": "^0.
|
|
133
|
-
"@fluidframework/container-definitions": "~2.
|
|
134
|
-
"@fluidframework/container-loader": "~2.
|
|
135
|
-
"@fluidframework/eslint-config-fluid": "
|
|
136
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
137
|
-
"@fluidframework/test-utils": "~2.
|
|
138
|
-
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.
|
|
132
|
+
"@fluidframework/build-tools": "^0.60.0",
|
|
133
|
+
"@fluidframework/container-definitions": "~2.72.0",
|
|
134
|
+
"@fluidframework/container-loader": "~2.72.0",
|
|
135
|
+
"@fluidframework/eslint-config-fluid": "~2.72.0",
|
|
136
|
+
"@fluidframework/test-runtime-utils": "~2.72.0",
|
|
137
|
+
"@fluidframework/test-utils": "~2.72.0",
|
|
138
|
+
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.71.0",
|
|
139
139
|
"@microsoft/api-extractor": "7.52.11",
|
|
140
140
|
"@types/diff": "^3.5.1",
|
|
141
141
|
"@types/easy-table": "^0.0.32",
|
package/src/api.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type TreeViewAlpha,
|
|
9
9
|
type TreeViewBeta,
|
|
10
10
|
type ImplicitFieldSchema,
|
|
11
|
-
// eslint-disable-next-line import/no-deprecated
|
|
11
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
12
12
|
asTreeViewAlpha,
|
|
13
13
|
} from "./simple-tree/index.js";
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
export function asAlpha<TSchema extends ImplicitFieldSchema>(
|
|
27
27
|
view: TreeView<TSchema>,
|
|
28
28
|
): TreeViewAlpha<TSchema> {
|
|
29
|
-
// eslint-disable-next-line import/no-deprecated
|
|
29
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
30
30
|
return asTreeViewAlpha(view);
|
|
31
31
|
}
|
|
32
32
|
|
package/src/codec/codec.ts
CHANGED
|
@@ -499,9 +499,23 @@ export const FluidClientVersion = {
|
|
|
499
499
|
// then update it to "2.001" once we actually have the opt in working.
|
|
500
500
|
// v2_1 = v2_0,
|
|
501
501
|
|
|
502
|
-
/**
|
|
503
|
-
|
|
504
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Fluid Framework Client 2.43 and newer.
|
|
504
|
+
*
|
|
505
|
+
* New formats introduced in 2.43:
|
|
506
|
+
* - SchemaFormatVersion.v2
|
|
507
|
+
* - MessageFormatVersion.v4
|
|
508
|
+
* - EditManagerFormatVersion.v4
|
|
509
|
+
* - Sequence format version 3
|
|
510
|
+
*/
|
|
511
|
+
v2_43: "2.43.0",
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Fluid Framework Client 2.52 and newer.
|
|
515
|
+
*
|
|
516
|
+
* New formats introduced in 2.52:
|
|
517
|
+
* - DetachedFieldIndexFormatVersion.v2
|
|
518
|
+
*/
|
|
505
519
|
v2_52: "2.52.0",
|
|
506
520
|
} as const satisfies Record<string, MinimumVersionForCollab>;
|
|
507
521
|
|
package/src/core/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type Brand,
|
|
11
11
|
type JsonCompatibleReadOnlyObject,
|
|
12
12
|
type MakeNominal,
|
|
13
|
-
|
|
13
|
+
brandConst,
|
|
14
14
|
invertMap,
|
|
15
15
|
} from "../../util/index.js";
|
|
16
16
|
|
|
@@ -33,14 +33,17 @@ import type { Multiplicity } from "./multiplicity.js";
|
|
|
33
33
|
/**
|
|
34
34
|
* The format version for the schema.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
37
|
-
v1
|
|
36
|
+
export const SchemaFormatVersion = {
|
|
37
|
+
v1: 1,
|
|
38
38
|
/**
|
|
39
39
|
* Adds persisted metadata to the node schema and field schema.
|
|
40
40
|
*/
|
|
41
|
-
v2
|
|
42
|
-
}
|
|
43
|
-
export type SchemaFormatVersion = Brand<
|
|
41
|
+
v2: 2,
|
|
42
|
+
} as const;
|
|
43
|
+
export type SchemaFormatVersion = Brand<
|
|
44
|
+
(typeof SchemaFormatVersion)[keyof typeof SchemaFormatVersion],
|
|
45
|
+
"SchemaFormatVersion"
|
|
46
|
+
>;
|
|
44
47
|
|
|
45
48
|
type FieldSchemaFormat = FieldSchemaFormatV1 | FieldSchemaFormatV2;
|
|
46
49
|
|
|
@@ -157,7 +160,7 @@ export interface TreeFieldStoredSchema {
|
|
|
157
160
|
*
|
|
158
161
|
* 2. The schema used for out of schema fields (which thus must be empty/not exist) on object and leaf nodes.
|
|
159
162
|
*/
|
|
160
|
-
export const forbiddenFieldKindIdentifier
|
|
163
|
+
export const forbiddenFieldKindIdentifier = brandConst("Forbidden")<FieldKindIdentifier>();
|
|
161
164
|
|
|
162
165
|
/**
|
|
163
166
|
* A schema for empty fields (fields which must always be empty).
|
|
@@ -12,6 +12,7 @@ import { hasSingle } from "../../util/index.js";
|
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
Format,
|
|
15
|
+
type DetachedFieldIndexFormatVersion,
|
|
15
16
|
type EncodedRootsForRevision,
|
|
16
17
|
type RootRanges,
|
|
17
18
|
} from "./detachedFieldIndexFormatCommon.js";
|
|
@@ -27,7 +28,7 @@ import type { Static, TSchema } from "@sinclair/typebox";
|
|
|
27
28
|
export function makeDetachedFieldIndexCodecFromMajorCodec<
|
|
28
29
|
TEncodedRevisionTag,
|
|
29
30
|
TEncodedRevisionTagSchema extends TSchema,
|
|
30
|
-
TVersion extends
|
|
31
|
+
TVersion extends DetachedFieldIndexFormatVersion,
|
|
31
32
|
>(
|
|
32
33
|
options: ICodecOptions,
|
|
33
34
|
majorCodec: IJsonCodec<Major, TEncodedRevisionTag>,
|
|
@@ -14,9 +14,11 @@ import {
|
|
|
14
14
|
RevisionTagSchema,
|
|
15
15
|
} from "../rebase/index.js";
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import type { FormatV1 } from "./detachedFieldIndexFormatV1.js";
|
|
18
18
|
import type { DetachedFieldSummaryData, Major } from "./detachedFieldIndexTypes.js";
|
|
19
19
|
import { makeDetachedFieldIndexCodecFromMajorCodec } from "./detachedFieldIndexCodecCommon.js";
|
|
20
|
+
import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
|
|
21
|
+
import { brand } from "../../util/index.js";
|
|
20
22
|
|
|
21
23
|
class MajorCodec implements IJsonCodec<Major, EncodedRevisionTag> {
|
|
22
24
|
public constructor(
|
|
@@ -74,7 +76,7 @@ export function makeDetachedNodeToFieldCodecV1(
|
|
|
74
76
|
return makeDetachedFieldIndexCodecFromMajorCodec(
|
|
75
77
|
options,
|
|
76
78
|
majorCodec,
|
|
77
|
-
|
|
79
|
+
brand(DetachedFieldIndexFormatVersion.v1),
|
|
78
80
|
RevisionTagSchema,
|
|
79
81
|
);
|
|
80
82
|
}
|
|
@@ -9,14 +9,12 @@ import type { IIdCompressor, StableId } from "@fluidframework/id-compressor";
|
|
|
9
9
|
import type { ICodecOptions, IJsonCodec } from "../../codec/index.js";
|
|
10
10
|
import type { EncodedRevisionTag, RevisionTagCodec, RevisionTag } from "../rebase/index.js";
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
type FormatV2,
|
|
14
|
-
StableOrFinalRevisionTag,
|
|
15
|
-
version2,
|
|
16
|
-
} from "./detachedFieldIndexFormatV2.js";
|
|
12
|
+
import { type FormatV2, StableOrFinalRevisionTag } from "./detachedFieldIndexFormatV2.js";
|
|
17
13
|
import type { DetachedFieldSummaryData, Major } from "./detachedFieldIndexTypes.js";
|
|
18
14
|
import { makeDetachedFieldIndexCodecFromMajorCodec } from "./detachedFieldIndexCodecCommon.js";
|
|
19
15
|
import { isStableId } from "@fluidframework/id-compressor/internal";
|
|
16
|
+
import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
|
|
17
|
+
import { brand } from "../../util/index.js";
|
|
20
18
|
|
|
21
19
|
class MajorCodec implements IJsonCodec<Major> {
|
|
22
20
|
public constructor(
|
|
@@ -66,7 +64,7 @@ export function makeDetachedNodeToFieldCodecV2(
|
|
|
66
64
|
return makeDetachedFieldIndexCodecFromMajorCodec(
|
|
67
65
|
options,
|
|
68
66
|
majorCodec,
|
|
69
|
-
|
|
67
|
+
brand(DetachedFieldIndexFormatVersion.v2),
|
|
70
68
|
StableOrFinalRevisionTag,
|
|
71
69
|
);
|
|
72
70
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
type CodecTree,
|
|
@@ -16,12 +17,24 @@ import {
|
|
|
16
17
|
} from "../../codec/index.js";
|
|
17
18
|
import type { RevisionTagCodec } from "../rebase/index.js";
|
|
18
19
|
|
|
19
|
-
import { version1 } from "./detachedFieldIndexFormatV1.js";
|
|
20
|
-
import { version2 } from "./detachedFieldIndexFormatV2.js";
|
|
21
20
|
import { makeDetachedNodeToFieldCodecV1 } from "./detachedFieldIndexCodecV1.js";
|
|
22
21
|
import { makeDetachedNodeToFieldCodecV2 } from "./detachedFieldIndexCodecV2.js";
|
|
23
22
|
import type { DetachedFieldSummaryData } from "./detachedFieldIndexTypes.js";
|
|
24
|
-
import
|
|
23
|
+
import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
|
|
24
|
+
import { brand } from "../../util/index.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Convert a MinimumVersionForCollab to a version for detached field codecs.
|
|
28
|
+
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
29
|
+
* @returns The detached field codec version that corresponds to the provided MinimumVersionForCollab.
|
|
30
|
+
*/
|
|
31
|
+
function clientVersionToDetachedFieldVersion(
|
|
32
|
+
clientVersion: MinimumVersionForCollab,
|
|
33
|
+
): DetachedFieldIndexFormatVersion {
|
|
34
|
+
return clientVersion < FluidClientVersion.v2_52
|
|
35
|
+
? brand(DetachedFieldIndexFormatVersion.v1)
|
|
36
|
+
: brand(DetachedFieldIndexFormatVersion.v2);
|
|
37
|
+
}
|
|
25
38
|
|
|
26
39
|
export function makeDetachedFieldIndexCodec(
|
|
27
40
|
revisionTagCodec: RevisionTagCodec,
|
|
@@ -29,9 +42,10 @@ export function makeDetachedFieldIndexCodec(
|
|
|
29
42
|
idCompressor: IIdCompressor,
|
|
30
43
|
): IJsonCodec<DetachedFieldSummaryData> {
|
|
31
44
|
const family = makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor);
|
|
32
|
-
|
|
33
|
-
options
|
|
34
|
-
|
|
45
|
+
return makeVersionDispatchingCodec(family, {
|
|
46
|
+
...options,
|
|
47
|
+
writeVersion: clientVersionToDetachedFieldVersion(options.minVersionForCollab),
|
|
48
|
+
});
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
export function makeDetachedFieldIndexCodecFamily(
|
|
@@ -40,14 +54,22 @@ export function makeDetachedFieldIndexCodecFamily(
|
|
|
40
54
|
idCompressor: IIdCompressor,
|
|
41
55
|
): ICodecFamily<DetachedFieldSummaryData> {
|
|
42
56
|
return makeCodecFamily([
|
|
43
|
-
[
|
|
44
|
-
|
|
57
|
+
[
|
|
58
|
+
DetachedFieldIndexFormatVersion.v1,
|
|
59
|
+
makeDetachedNodeToFieldCodecV1(revisionTagCodec, options, idCompressor),
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
DetachedFieldIndexFormatVersion.v2,
|
|
63
|
+
makeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor),
|
|
64
|
+
],
|
|
45
65
|
]);
|
|
46
66
|
}
|
|
47
67
|
|
|
48
|
-
export type DetachedFieldIndexFormatVersion = Brand<1 | 2, "DetachedFieldIndexFormatVersion">;
|
|
49
68
|
export function getCodecTreeForDetachedFieldIndexFormat(
|
|
50
|
-
|
|
69
|
+
clientVersion: MinimumVersionForCollab,
|
|
51
70
|
): CodecTree {
|
|
52
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
name: "DetachedFieldIndex",
|
|
73
|
+
version: clientVersionToDetachedFieldVersion(clientVersion),
|
|
74
|
+
};
|
|
53
75
|
}
|
|
@@ -5,10 +5,22 @@
|
|
|
5
5
|
|
|
6
6
|
import { type Static, type TSchema, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import { brandedNumberType } from "../../util/index.js";
|
|
8
|
+
import { brandedNumberType, type Brand } from "../../util/index.js";
|
|
9
9
|
|
|
10
10
|
import type { ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The format version for the detached field index.
|
|
14
|
+
*/
|
|
15
|
+
export const DetachedFieldIndexFormatVersion = {
|
|
16
|
+
v1: 1,
|
|
17
|
+
v2: 2,
|
|
18
|
+
} as const;
|
|
19
|
+
export type DetachedFieldIndexFormatVersion = Brand<
|
|
20
|
+
(typeof DetachedFieldIndexFormatVersion)[keyof typeof DetachedFieldIndexFormatVersion],
|
|
21
|
+
"DetachedFieldIndexFormatVersion"
|
|
22
|
+
>;
|
|
23
|
+
|
|
12
24
|
/**
|
|
13
25
|
* The ID of a detached node. Is not globally unique on.
|
|
14
26
|
* A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
|
|
@@ -54,7 +66,10 @@ export const EncodedRootsForRevision = <Schema extends TSchema>(tRevisionTag: Sc
|
|
|
54
66
|
]);
|
|
55
67
|
export type EncodedRootsForRevision = Static<ReturnType<typeof EncodedRootsForRevision>>;
|
|
56
68
|
|
|
57
|
-
export const Format = <
|
|
69
|
+
export const Format = <
|
|
70
|
+
TVersion extends DetachedFieldIndexFormatVersion,
|
|
71
|
+
TRevisionTagSchema extends TSchema,
|
|
72
|
+
>(
|
|
58
73
|
tVersion: TVersion,
|
|
59
74
|
tRevisionTag: TRevisionTagSchema,
|
|
60
75
|
// Return type is intentionally derived.
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Static } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import { Format } from "./detachedFieldIndexFormatCommon.js";
|
|
8
|
+
import { DetachedFieldIndexFormatVersion, Format } from "./detachedFieldIndexFormatCommon.js";
|
|
9
9
|
import { RevisionTagSchema } from "../rebase/index.js";
|
|
10
|
+
import { brand } from "../../util/index.js";
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export const FormatV1 = Format(
|
|
13
|
+
brand<DetachedFieldIndexFormatVersion>(DetachedFieldIndexFormatVersion.v1),
|
|
14
|
+
RevisionTagSchema,
|
|
15
|
+
);
|
|
14
16
|
|
|
15
17
|
export type FormatV1 = Static<typeof FormatV1>;
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import { Type, type Static } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import { Format } from "./detachedFieldIndexFormatCommon.js";
|
|
8
|
+
import { DetachedFieldIndexFormatVersion, Format } from "./detachedFieldIndexFormatCommon.js";
|
|
9
9
|
import { RevisionTagSchema, StableIdSchema } from "../rebase/index.js";
|
|
10
|
-
|
|
11
|
-
export const version2 = 2.0;
|
|
10
|
+
import { brand } from "../../util/index.js";
|
|
12
11
|
|
|
13
12
|
export const StableOrFinalRevisionTag = Type.Union([RevisionTagSchema, StableIdSchema]);
|
|
14
13
|
|
|
15
|
-
export const FormatV2 = Format(
|
|
14
|
+
export const FormatV2 = Format(
|
|
15
|
+
brand<DetachedFieldIndexFormatVersion>(DetachedFieldIndexFormatVersion.v2),
|
|
16
|
+
StableOrFinalRevisionTag,
|
|
17
|
+
);
|
|
16
18
|
|
|
17
19
|
export type FormatV2 = Static<typeof FormatV2>;
|
package/src/core/tree/index.ts
CHANGED
|
@@ -119,9 +119,7 @@ export {
|
|
|
119
119
|
|
|
120
120
|
export { DetachedFieldIndex } from "./detachedFieldIndex.js";
|
|
121
121
|
|
|
122
|
-
export {
|
|
123
|
-
|
|
124
|
-
getCodecTreeForDetachedFieldIndexFormat,
|
|
125
|
-
} from "./detachedFieldIndexCodecs.js";
|
|
122
|
+
export { getCodecTreeForDetachedFieldIndexFormat } from "./detachedFieldIndexCodecs.js";
|
|
123
|
+
export { type DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
|
|
126
124
|
|
|
127
125
|
export { type ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Static, TSchema } from "@sinclair/typebox";
|
|
7
7
|
// This export is documented as supported in typebox's documentation.
|
|
8
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
8
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
9
9
|
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
|
10
10
|
|
|
11
11
|
import { toFormatValidator, type JsonValidator } from "../codec/index.js";
|