@fluidframework/tree 2.101.1 → 2.103.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 +8 -0
- package/api-report/tree.alpha.api.md +19 -0
- package/dist/codec/codec.d.ts +22 -53
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +7 -44
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +56 -28
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +29 -12
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +5 -4
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +26 -3
- package/dist/codec/versioned/format.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -2
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +4 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +27 -4
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +16 -15
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +31 -8
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +29 -28
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +33 -10
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +2 -2
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +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 +4 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +33 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +25 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js +33 -10
- package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +63 -5
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +18 -4
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +106 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +36 -13
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +41 -18
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +35 -6
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +67 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +5 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +7 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +1 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +2 -2
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +26 -3
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +26 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +48 -25
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -6
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +31 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +34 -11
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +25 -2
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js +27 -4
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +27 -4
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +1 -3
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.js +63 -40
- package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.js +55 -32
- package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.js +27 -4
- package/dist/feature-libraries/sequence-field/formatV3.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/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/isAuditableFromOutcome.d.ts +20 -0
- package/dist/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/dist/shared-tree/isAuditableFromOutcome.js +36 -0
- package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +2 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +28 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +5 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +37 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +2 -2
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +39 -16
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +33 -10
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +27 -4
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +25 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +3 -3
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +2 -2
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +31 -8
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +29 -6
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +62 -24
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +54 -31
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +48 -0
- package/dist/text/codePointUtils.d.ts.map +1 -0
- package/dist/text/codePointUtils.js +80 -0
- package/dist/text/codePointUtils.js.map +1 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +93 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +65 -8
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +24 -6
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +29 -1
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +9 -7
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +7 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +18 -4
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/typeboxBrand.d.ts +1 -1
- package/dist/util/typeboxBrand.d.ts.map +1 -1
- package/dist/util/typeboxBrand.js +26 -3
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.d.ts +2 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +25 -2
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +44 -0
- package/lib/codec/codec.d.ts +22 -53
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +7 -44
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +56 -28
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +27 -10
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +5 -4
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +1 -1
- package/lib/codec/versioned/format.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +4 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +16 -15
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +1 -1
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +29 -28
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -1
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +2 -2
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +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 +5 -3
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +2 -2
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +62 -5
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +20 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +102 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +9 -3
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js +41 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +6 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +2 -3
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -3
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -3
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.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/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/isAuditableFromOutcome.d.ts +20 -0
- package/lib/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/lib/shared-tree/isAuditableFromOutcome.js +32 -0
- package/lib/shared-tree/isAuditableFromOutcome.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +2 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +1 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +5 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +38 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +3 -3
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +3 -3
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +3 -3
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +60 -23
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +48 -0
- package/lib/text/codePointUtils.d.ts.map +1 -0
- package/lib/text/codePointUtils.js +75 -0
- package/lib/text/codePointUtils.js.map +1 -0
- package/lib/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +93 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +56 -0
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +24 -6
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +30 -2
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +7 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +18 -4
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/typeboxBrand.d.ts +1 -1
- package/lib/util/typeboxBrand.d.ts.map +1 -1
- package/lib/util/typeboxBrand.js +1 -1
- package/lib/util/typeboxBrand.js.map +1 -1
- package/lib/util/utils.d.ts +2 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +1 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/codec.ts +82 -73
- package/src/codec/index.ts +2 -1
- package/src/codec/versioned/codec.ts +173 -73
- package/src/codec/versioned/format.ts +2 -1
- package/src/codec/versioned/index.ts +2 -1
- package/src/core/rebase/types.ts +1 -1
- package/src/core/schema-stored/formatV1.ts +2 -1
- package/src/core/schema-stored/formatV2.ts +2 -1
- package/src/core/tree/deltaUtil.ts +2 -2
- package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -3
- package/src/core/tree/detachedFieldIndexCodecs.ts +2 -2
- package/src/core/tree/detachedFieldIndexFormatCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexFormatV2.ts +2 -1
- package/src/core/tree/persistedTreeTextFormat.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +88 -3
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +27 -7
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +143 -7
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +30 -28
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +7 -7
- package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV1.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +13 -8
- package/src/feature-libraries/chunked-forest/codec/format/formatVText.ts +84 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +6 -1
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +25 -4
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +14 -18
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +131 -44
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +36 -14
- package/src/feature-libraries/forest-summary/codec.ts +9 -4
- package/src/feature-libraries/forest-summary/formatCommon.ts +2 -1
- package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV1.ts +2 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV2.ts +2 -1
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +2 -1
- package/src/feature-libraries/schema-index/codec.ts +2 -5
- package/src/feature-libraries/schema-index/formatV1.ts +2 -1
- package/src/feature-libraries/schema-index/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/compose.ts +1 -4
- package/src/feature-libraries/sequence-field/formatV1.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV3.ts +2 -1
- package/src/index.ts +6 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/isAuditableFromOutcome.ts +34 -0
- package/src/shared-tree/sharedTree.ts +2 -5
- package/src/shared-tree/sharedTreeChangeFormat.ts +2 -1
- package/src/shared-tree/treeCheckout.ts +55 -15
- package/src/shared-tree-core/editManager.ts +2 -2
- package/src/shared-tree-core/editManagerCodecs.ts +4 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +2 -1
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -1
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +4 -4
- package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +2 -1
- package/src/simple-tree/core/treeNodeKernel.ts +66 -28
- package/src/simple-tree/simpleSchemaFormatV1.ts +2 -1
- package/src/text/codePointUtils.ts +81 -0
- package/src/text/index.ts +1 -0
- package/src/text/textDomain.ts +155 -2
- package/src/text/textDomainFormatted.ts +73 -2
- package/src/treeFactory.ts +5 -0
- package/src/util/breakable.ts +27 -6
- package/src/util/typeboxBrand.ts +2 -1
- package/src/util/utils.ts +2 -1
|
@@ -15,16 +15,16 @@ type VersionedJson = JsonCompatibleReadOnlyObject & Versioned;
|
|
|
15
15
|
/**
|
|
16
16
|
* Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
|
|
17
17
|
*/
|
|
18
|
-
export declare function makeDiscontinuedCodecAndSchema<TDecoded,
|
|
18
|
+
export declare function makeDiscontinuedCodecAndSchema<TDecoded, TFormatVersion extends FormatVersion = FormatVersion>(discontinuedVersion: TFormatVersion, discontinuedSince: SemanticVersion): CodecVersion<TDecoded, unknown, TFormatVersion, ICodecOptions, unknown>;
|
|
19
19
|
/**
|
|
20
20
|
* A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.
|
|
21
21
|
* @remarks
|
|
22
22
|
* The codec should not perform its own schema validation.
|
|
23
23
|
* The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.
|
|
24
24
|
*/
|
|
25
|
-
export type CodecAndSchema<TDecoded,
|
|
25
|
+
export type CodecAndSchema<TDecoded, TEncodeContext = void, TDecodeContext = TEncodeContext> = {
|
|
26
26
|
readonly schema: TSchema;
|
|
27
|
-
} & IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly,
|
|
27
|
+
} & IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TEncodeContext, TDecodeContext>;
|
|
28
28
|
/**
|
|
29
29
|
* A codec alongside its format version and schema.
|
|
30
30
|
*/
|
|
@@ -48,7 +48,7 @@ export interface CodecVersionBase<T = unknown, TFormatVersion extends FormatVers
|
|
|
48
48
|
* Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,
|
|
49
49
|
* helping ensure that tests and production code behave the same.
|
|
50
50
|
*/
|
|
51
|
-
export interface CodecVersion<TDecoded,
|
|
51
|
+
export interface CodecVersion<TDecoded, TEncodeContext, TFormatVersion extends FormatVersion, TBuildOptions extends ICodecOptions = ICodecOptions, TDecodeContext = TEncodeContext> extends CodecVersionBase<CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> | ((options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>), TFormatVersion> {
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* {@link CodecVersion} after normalization into a consistent type.
|
|
@@ -56,29 +56,47 @@ export interface CodecVersion<TDecoded, TContext, TFormatVersion extends FormatV
|
|
|
56
56
|
* Produced by {@link normalizeCodecVersion}.
|
|
57
57
|
* Includes schema validation.
|
|
58
58
|
*/
|
|
59
|
-
export interface NormalizedCodecVersion<TDecoded,
|
|
59
|
+
export interface NormalizedCodecVersion<TDecoded, TEncodeContext, TFormatVersion extends FormatVersion, TBuildOptions extends ICodecOptions, TDecodeContext = TEncodeContext> extends CodecVersionBase<(options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>, TFormatVersion> {
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* {@link NormalizedCodecVersion} after applying the build options.
|
|
63
63
|
* @remarks
|
|
64
|
-
* Produced by {@link
|
|
64
|
+
* Produced by {@link VersionDispatchingCodecBuilder.applyOptions}.
|
|
65
65
|
*/
|
|
66
|
-
interface EvaluatedCodecVersion<TDecoded,
|
|
66
|
+
interface EvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion extends FormatVersion, TDecodeContext = TEncodeContext> extends CodecVersionBase<CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>, TFormatVersion> {
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
69
|
+
* A codec that can read multiple format versions and write a single selected version.
|
|
70
|
+
* @remarks
|
|
71
|
+
* Produced by {@link VersionDispatchingCodecBuilder.build}.
|
|
72
|
+
*
|
|
73
|
+
* @typeParam TDecoded - The in memory (not encoded) format.
|
|
74
|
+
* @typeParam TEncodeContext - Context type passed to encode operations.
|
|
75
|
+
* @typeParam TFormatVersion - The type of format version identifiers used by this codec.
|
|
76
|
+
* @typeParam TDecodeContext - Context type passed to decode operations. Defaults to `TEncodeContext`.
|
|
77
|
+
*/
|
|
78
|
+
export interface VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion extends FormatVersion, TDecodeContext = TEncodeContext> extends IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TEncodeContext, TDecodeContext> {
|
|
79
|
+
/**
|
|
80
|
+
* The format version which this codec writes.
|
|
81
|
+
* @remarks
|
|
82
|
+
* Selected by {@link VersionDispatchingCodecBuilder.build} based on the provided options.
|
|
83
|
+
*/
|
|
84
|
+
readonly writeVersion: TFormatVersion;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates a {@link VersionDispatchingCodec} using a {@link CodecVersion} to select the {@link VersionDispatchingCodec.writeVersion}.
|
|
71
88
|
* @privateRemarks
|
|
72
|
-
* This is a two stage builder so the first stage can encapsulate all codec specific details and
|
|
89
|
+
* This is a two stage builder so the first stage (the static build) can encapsulate all codec specific details and
|
|
90
|
+
* the second (the instance build) can bring in configuration.
|
|
73
91
|
*/
|
|
74
|
-
export declare class
|
|
92
|
+
export declare class VersionDispatchingCodecBuilder<TBuildOptions extends ICodecOptions = ICodecOptions, TDecoded = unknown, TEncodeContext = unknown, TFormatVersion extends FormatVersion = FormatVersion, TName extends CodecName = string, TDecodeContext = TEncodeContext> {
|
|
75
93
|
/**
|
|
76
94
|
* See {@link CodecName}.
|
|
77
95
|
*/
|
|
78
96
|
readonly name: TName;
|
|
79
|
-
readonly registry: readonly NormalizedCodecVersion<TDecoded,
|
|
97
|
+
readonly registry: readonly NormalizedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TBuildOptions, TDecodeContext>[];
|
|
80
98
|
/**
|
|
81
|
-
* Use {@link
|
|
99
|
+
* Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.
|
|
82
100
|
* @remarks
|
|
83
101
|
* Inputs to this are assumed to be constants in the code controlled by the developers of this package,
|
|
84
102
|
* and constructed at least once during tests.
|
|
@@ -87,37 +105,47 @@ export declare class ClientVersionDispatchingCodecBuilder<TBuildOptions extends
|
|
|
87
105
|
*/
|
|
88
106
|
private constructor();
|
|
89
107
|
/**
|
|
90
|
-
* Applies
|
|
108
|
+
* Applies `options` to the codec registry to produce a list of evaluated codecs.
|
|
91
109
|
* @remarks
|
|
92
110
|
* This is used by build, which is what production code should use.
|
|
93
111
|
* This is only exposed for testing purposes.
|
|
94
112
|
*/
|
|
95
|
-
applyOptions(options: TBuildOptions): EvaluatedCodecVersion<TDecoded,
|
|
113
|
+
applyOptions(options: TBuildOptions): EvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[];
|
|
96
114
|
/**
|
|
97
|
-
*
|
|
115
|
+
* Builds a complete {@link VersionDispatchingCodec} that can decode all registered versions
|
|
116
|
+
* and encode a version selected by the provided options.
|
|
98
117
|
*/
|
|
99
|
-
build(options: TBuildOptions & CodecWriteOptions):
|
|
100
|
-
/**
|
|
101
|
-
* The format version which this codec writes.
|
|
102
|
-
* @remarks
|
|
103
|
-
* This is selected based on the provided {@link CodecWriteOptions}.
|
|
104
|
-
*/
|
|
105
|
-
readonly writeVersion: TFormatVersion;
|
|
106
|
-
};
|
|
118
|
+
build(options: TBuildOptions & CodecWriteOptions): VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>;
|
|
107
119
|
private buildDecoderInternal;
|
|
108
120
|
/**
|
|
109
|
-
*
|
|
121
|
+
* Builds a decoder-only codec that can decode any supported format without encoding capability.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* The returned codec contains only the `decode` method and can be used when only decoding is needed.
|
|
125
|
+
* This is useful for scenarios where reading/decoding versioned data is sufficient.
|
|
126
|
+
*
|
|
127
|
+
* @param options - Build options (typically containing the `jsonValidator`)
|
|
128
|
+
* @returns An object with a `decode` method that can handle any supported format version
|
|
110
129
|
*/
|
|
111
|
-
buildDecoder(options: TBuildOptions): Pick<
|
|
130
|
+
buildDecoder(options: TBuildOptions): Pick<VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>, "decode">;
|
|
112
131
|
getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree<TFormatVersion>;
|
|
113
132
|
/**
|
|
114
|
-
*
|
|
133
|
+
* Creates a new VersionDispatchingCodecBuilder from the provided codec registry.
|
|
134
|
+
*
|
|
115
135
|
* @remarks
|
|
116
136
|
* This static method infers the types of the builder from the provided registry,
|
|
117
137
|
* making it easier to create builders without needing to explicitly specify all type parameters.
|
|
118
138
|
* This gets better type inference than the constructor.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const builder = VersionDispatchingCodecBuilder.build('myCodec', [
|
|
143
|
+
* { minVersionForCollab: lowestMinVersionForCollab, formatVersion: 1, codec: { encode, decode, schema } },
|
|
144
|
+
* { minVersionForCollab: '2.100.0', formatVersion: 2, codec: { encode, decode, schema } },
|
|
145
|
+
* ]);
|
|
146
|
+
* ```
|
|
119
147
|
*/
|
|
120
|
-
static build<Name extends CodecName, Entry extends CodecVersion<unknown, unknown, FormatVersion, never>>(name: Name, inputRegistry: readonly Entry[]):
|
|
148
|
+
static build<Name extends CodecName, Entry extends CodecVersion<unknown, unknown, FormatVersion, never, unknown>>(name: Name, inputRegistry: readonly Entry[]): VersionDispatchingCodecBuilder<Entry extends CodecVersion<unknown, unknown, FormatVersion, infer B extends ICodecOptions, unknown> ? B : never, Entry extends CodecVersion<infer D, unknown, FormatVersion, never, unknown> ? D : never, unknown extends (Entry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never) ? void : Entry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never, Entry extends CodecVersion<unknown, unknown, infer F extends FormatVersion, never, unknown> ? F : never, Name, unknown extends (Entry extends CodecVersion<unknown, unknown, FormatVersion, never, infer D_1> ? D_1 : never) ? unknown extends (Entry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never) ? void : Entry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never : Entry extends CodecVersion<unknown, unknown, FormatVersion, never, infer D_1> ? D_1 : never>;
|
|
121
149
|
}
|
|
122
150
|
export {};
|
|
123
151
|
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAIN,KAAK,eAAe,EACpB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,KAAK,aAAa,GAAG,4BAA4B,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAIN,KAAK,eAAe,EACpB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEN,KAAK,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d,cAAc,EACd,aAAa,EACb,cAAc,CACd,EAAE,CAAC;IAEJ;;;;;;;OAOG;IACH,OAAO;IA6DP;;;;;OAKG;IACI,YAAY,CAClB,OAAO,EAAE,aAAa,GACpB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE;IAQpF;;;OAGG;IACI,KAAK,CACX,OAAO,EAAE,aAAa,GAAG,iBAAiB,GACxC,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC;IAYpF,OAAO,CAAC,oBAAoB;IAsC5B;;;;;;;;;OASG;IACI,YAAY,CAClB,OAAO,EAAE,aAAa,GACpB,IAAI,CACN,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,EACjF,QAAQ,CACR;IAIM,YAAY,CAAC,aAAa,EAAE,uBAAuB,GAAG,SAAS,CAAC,cAAc,CAAC;IAStF;;;;;;;;;;;;;;;OAeG;WAEW,KAAK,CAClB,IAAI,SAAS,SAAS,EACtB,KAAK,SAAS,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,EAC1E,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,KAAK,EAAE;CAwC7C"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.VersionDispatchingCodecBuilder = exports.makeDiscontinuedCodecAndSchema = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/runtime-utils/internal");
|
|
10
10
|
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
@@ -94,14 +94,14 @@ function normalizeCodecVersion(codecVersion) {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Creates a
|
|
98
|
-
* version number in data it encounters for decode.
|
|
97
|
+
* Creates a {@link VersionDispatchingCodec} using a {@link CodecVersion} to select the {@link VersionDispatchingCodec.writeVersion}.
|
|
99
98
|
* @privateRemarks
|
|
100
|
-
* This is a two stage builder so the first stage can encapsulate all codec specific details and
|
|
99
|
+
* This is a two stage builder so the first stage (the static build) can encapsulate all codec specific details and
|
|
100
|
+
* the second (the instance build) can bring in configuration.
|
|
101
101
|
*/
|
|
102
|
-
class
|
|
102
|
+
class VersionDispatchingCodecBuilder {
|
|
103
103
|
/**
|
|
104
|
-
* Use {@link
|
|
104
|
+
* Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.
|
|
105
105
|
* @remarks
|
|
106
106
|
* Inputs to this are assumed to be constants in the code controlled by the developers of this package,
|
|
107
107
|
* and constructed at least once during tests.
|
|
@@ -141,7 +141,7 @@ class ClientVersionDispatchingCodecBuilder {
|
|
|
141
141
|
this.registry = normalizedRegistry;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
|
-
* Applies
|
|
144
|
+
* Applies `options` to the codec registry to produce a list of evaluated codecs.
|
|
145
145
|
* @remarks
|
|
146
146
|
* This is used by build, which is what production code should use.
|
|
147
147
|
* This is only exposed for testing purposes.
|
|
@@ -154,7 +154,8 @@ class ClientVersionDispatchingCodecBuilder {
|
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* Builds a complete {@link VersionDispatchingCodec} that can decode all registered versions
|
|
158
|
+
* and encode a version selected by the provided options.
|
|
158
159
|
*/
|
|
159
160
|
build(options) {
|
|
160
161
|
const [applied, decoder] = this.buildDecoderInternal(options);
|
|
@@ -186,7 +187,14 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
186
187
|
];
|
|
187
188
|
}
|
|
188
189
|
/**
|
|
189
|
-
*
|
|
190
|
+
* Builds a decoder-only codec that can decode any supported format without encoding capability.
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* The returned codec contains only the `decode` method and can be used when only decoding is needed.
|
|
194
|
+
* This is useful for scenarios where reading/decoding versioned data is sufficient.
|
|
195
|
+
*
|
|
196
|
+
* @param options - Build options (typically containing the `jsonValidator`)
|
|
197
|
+
* @returns An object with a `decode` method that can handle any supported format version
|
|
190
198
|
*/
|
|
191
199
|
buildDecoder(options) {
|
|
192
200
|
return this.buildDecoderInternal(options)[1];
|
|
@@ -200,20 +208,29 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
200
208
|
};
|
|
201
209
|
}
|
|
202
210
|
/**
|
|
203
|
-
*
|
|
211
|
+
* Creates a new VersionDispatchingCodecBuilder from the provided codec registry.
|
|
212
|
+
*
|
|
204
213
|
* @remarks
|
|
205
214
|
* This static method infers the types of the builder from the provided registry,
|
|
206
215
|
* making it easier to create builders without needing to explicitly specify all type parameters.
|
|
207
216
|
* This gets better type inference than the constructor.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const builder = VersionDispatchingCodecBuilder.build('myCodec', [
|
|
221
|
+
* { minVersionForCollab: lowestMinVersionForCollab, formatVersion: 1, codec: { encode, decode, schema } },
|
|
222
|
+
* { minVersionForCollab: '2.100.0', formatVersion: 2, codec: { encode, decode, schema } },
|
|
223
|
+
* ]);
|
|
224
|
+
* ```
|
|
208
225
|
*/
|
|
209
226
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
210
227
|
static build(name, inputRegistry) {
|
|
211
228
|
const input = inputRegistry;
|
|
212
|
-
const builder = new
|
|
229
|
+
const builder = new VersionDispatchingCodecBuilder(name, input);
|
|
213
230
|
return builder;
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
|
-
exports.
|
|
233
|
+
exports.VersionDispatchingCodecBuilder = VersionDispatchingCodecBuilder;
|
|
217
234
|
/**
|
|
218
235
|
* Selects which format should be used when writing data.
|
|
219
236
|
* @remarks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AC,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAClC,QAAsB,EACtB,mBAA4C;IAE5C,MAAM,cAAc,GAAiE,EAAE,CAAC;IACxF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC/C,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAM,IAAA,kDAAuC,EACxD,mBAAmB,EACnB,cAAc,CACd,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,QAAqC;IACzD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollabIterable,\n\tlowestMinVersionForCollab,\n\ttype MinimumMinorSemanticVersion,\n\ttype SemanticVersion,\n} from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { gt } from \"semver-ts\";\n\nimport { pkgVersion } from \"../../packageVersion.js\";\nimport {\n\tJsonCompatibleReadOnlySchema,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\twithSchemaValidation,\n\ttype FormatVersion,\n\ttype CodecWriteOptions,\n\ttype CodecName,\n\ttype CodecTree,\n} from \"../codec.js\";\n\nimport { Versioned } from \"./format.js\";\n\n/**\n * Json compatible data with a format version.\n */\ntype VersionedJson = JsonCompatibleReadOnlyObject & Versioned;\n\n/**\n * Validate that the version is one of the supported values.\n * @remarks\n * If supportedVersions contains undefined, data with no version field is also accepted despite the return type indicating otherwise.\n * This is for legacy compatibility where older data may not have a version field.\n */\nfunction makeVersionedCodec<\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTContext = void,\n>(\n\tsupportedVersions: Set<FormatVersion>,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tinner: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TContext> {\n\tconst codec = {\n\t\tencode: (data: TDecoded, context: TContext): TEncoded => {\n\t\t\tconst encoded = inner.encode(data, context);\n\t\t\tassert(\n\t\t\t\tsupportedVersions.has(encoded.version),\n\t\t\t\t0x88b /* version being encoded should be supported */,\n\t\t\t);\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: TValidate, context: TContext): TDecoded => {\n\t\t\tconst versioned = data as Versioned; // Validated by withSchemaValidation\n\t\t\tif (!supportedVersions.has(versioned.version)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding data. Supported versions for this data are: ${[...supportedVersions].join(\", \")}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst decoded = inner.decode(data, context);\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\t// If undefined is a supported version, skip using withSchemaValidation to enforce there is a version field.\n\t// Codec will still assert the content of the field is in supportedVersions, so it is still somewhat validated, just in a different way.\n\tif (supportedVersions.has(undefined)) {\n\t\treturn codec;\n\t}\n\n\treturn withSchemaValidation(Versioned, codec, validator);\n}\n\n/**\n * Wrap a codec with version checking and schema validation.\n * @remarks\n * The passed in codec should not perform its own schema validation.\n * The schema validation gets added here.\n */\nfunction makeVersionedValidatedCodec<\n\tEncodedSchema extends TSchema,\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTContext = void,\n>(\n\toptions: ICodecOptions,\n\tsupportedVersions: Set<FormatVersion>,\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TContext> &\n\tPick<CodecAndSchema<TDecoded, TContext>, \"schema\"> {\n\treturn {\n\t\t...makeVersionedCodec(\n\t\t\tsupportedVersions,\n\t\t\toptions,\n\t\t\twithSchemaValidation(schema, codec, options.jsonValidator),\n\t\t),\n\t\tschema,\n\t};\n}\n\n/**\n * Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.\n */\nexport function makeDiscontinuedCodecAndSchema<\n\tTDecoded,\n\tTContext,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n>(\n\tdiscontinuedVersion: TFormatVersion,\n\tdiscontinuedSince: SemanticVersion,\n): CodecVersion<TDecoded, TContext, TFormatVersion> {\n\treturn {\n\t\tminVersionForCollab: undefined,\n\t\tformatVersion: discontinuedVersion,\n\t\tcodec: {\n\t\t\tschema: JsonCompatibleReadOnlySchema,\n\t\t\tencode: (_data: TDecoded) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\tdecode: (data: unknown) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot decode data in format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.\n * @remarks\n * The codec should not perform its own schema validation.\n * The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.\n */\nexport type CodecAndSchema<TDecoded, TContext = void> = {\n\treadonly schema: TSchema;\n} & IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TContext>;\n\n/**\n * A codec alongside its format version and schema.\n */\nexport interface CodecVersionBase<\n\tT = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * When `undefined` the codec will never be selected as a write version except via override.\n\t * @remarks\n\t * This format will be used for decode if data in it needs to be decoded, regardless of `minVersionForCollab`.\n\t * `undefined` should be used for unstable codec versions (with string FormatVersions),\n\t * as well as previously stabilized formats that are discontinued (meaning we always prefer to use some other format for encoding).\n\t */\n\treadonly minVersionForCollab: MinimumVersionForCollab | undefined;\n\treadonly formatVersion: TFormatVersion;\n\treadonly codec: T;\n}\n\n/**\n * A particular version of a codec and when to use it.\n * @privateRemarks\n * This allows lazy building of the codec with options.\n * This option can likely be removed as the codec handling is made simpler and more consistent.\n * Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,\n * helping ensure that tests and production code behave the same.\n */\nexport interface CodecVersion<\n\tTDecoded,\n\tTContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n> extends CodecVersionBase<\n\t\t| CodecAndSchema<TDecoded, TContext>\n\t\t| ((options: TBuildOptions) => CodecAndSchema<TDecoded, TContext>),\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link CodecVersion} after normalization into a consistent type.\n * @remarks\n * Produced by {@link normalizeCodecVersion}.\n * Includes schema validation.\n */\nexport interface NormalizedCodecVersion<\n\tTDecoded,\n\tTContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n> extends CodecVersionBase<\n\t\t(options: TBuildOptions) => CodecAndSchema<TDecoded, TContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link NormalizedCodecVersion} after applying the build options.\n * @remarks\n * Produced by {@link ClientVersionDispatchingCodecBuilder.applyOptions}.\n */\ninterface EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion>\n\textends CodecVersionBase<CodecAndSchema<TDecoded, TContext>, TFormatVersion> {}\n\n/**\n * Normalize the codec to a single format.\n * @remarks\n * Bakes in schema validation, so output no longer exposes the schema.\n */\nfunction normalizeCodecVersion<\n\tTDecoded,\n\tTContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n>(\n\tcodecVersion: CodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions>,\n): NormalizedCodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions> {\n\tconst codecBuilder: (options: TBuildOptions) => CodecAndSchema<TDecoded, TContext> =\n\t\ttypeof codecVersion.codec === \"function\"\n\t\t\t? codecVersion.codec\n\t\t\t: () => codecVersion.codec as CodecAndSchema<TDecoded, TContext>;\n\tconst codec = (options: TBuildOptions): CodecAndSchema<TDecoded, TContext> => {\n\t\tconst built = codecBuilder(options);\n\t\treturn makeVersionedValidatedCodec(\n\t\t\toptions,\n\t\t\tnew Set([codecVersion.formatVersion]),\n\t\t\tbuilt.schema,\n\t\t\tbuilt,\n\t\t);\n\t};\n\n\treturn {\n\t\tminVersionForCollab: codecVersion.minVersionForCollab,\n\t\tformatVersion: codecVersion.formatVersion,\n\t\tcodec,\n\t};\n}\n\n/**\n * Creates a codec which dispatches to the appropriate member of a codec family based on the `minVersionForCollab` for encode and the\n * version number in data it encounters for decode.\n * @privateRemarks\n * This is a two stage builder so the first stage can encapsulate all codec specific details and the second can bring in configuration.\n */\nexport class ClientVersionDispatchingCodecBuilder<\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecoded = unknown,\n\tTContext = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n\tTName extends CodecName = string,\n> {\n\tpublic readonly registry: readonly NormalizedCodecVersion<\n\t\tTDecoded,\n\t\tTContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions\n\t>[];\n\n\t/**\n\t * Use {@link ClientVersionDispatchingCodecBuilder.build} to create an instance of this class.\n\t * @remarks\n\t * Inputs to this are assumed to be constants in the code controlled by the developers of this package,\n\t * and constructed at least once during tests.\n\t * Because of this, the validation of these inputs done with debugAssert should be sufficient,\n\t * and using debugAssert avoids bloating the bundle size for production users.\n\t */\n\tprivate constructor(\n\t\t/**\n\t\t * See {@link CodecName}.\n\t\t */\n\t\tpublic readonly name: TName,\n\t\t/**\n\t\t * The registry of codecs which this builder can use to encode and decode data.\n\t\t */\n\t\tinputRegistry: readonly CodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions>[],\n\t) {\n\t\ttype Normalized = NormalizedCodecVersion<\n\t\t\tTDecoded,\n\t\t\tTContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions\n\t\t>;\n\t\tconst normalizedRegistry: Normalized[] = [];\n\t\tconst formats: Set<FormatVersion> = new Set();\n\t\tconst versions: Set<string | undefined> = new Set();\n\n\t\tfor (const codec of inputRegistry) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\t!formats.has(codec.formatVersion) ||\n\t\t\t\t\t`duplicate codec format ${name} ${codec.formatVersion}`,\n\t\t\t);\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tcodec.minVersionForCollab === undefined ||\n\t\t\t\t\ttypeof codec.formatVersion !== \"string\" ||\n\t\t\t\t\t`unstable format ${JSON.stringify(codec.formatVersion)} (string formats) must not have a minVersionForCollab in ${name}`,\n\t\t\t);\n\t\t\tformats.add(codec.formatVersion);\n\t\t\tconst normalizedCodec = normalizeCodecVersion(codec);\n\t\t\tnormalizedRegistry.push(normalizedCodec);\n\t\t\tif (codec.minVersionForCollab !== undefined) {\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\t!versions.has(codec.minVersionForCollab) ||\n\t\t\t\t\t\t`Codec ${name} has multiple entries for version ${JSON.stringify(codec.minVersionForCollab)}`,\n\t\t\t\t);\n\t\t\t\tversions.add(codec.minVersionForCollab);\n\t\t\t}\n\t\t}\n\n\t\tdebugAssert(\n\t\t\t() =>\n\t\t\t\tversions.has(lowestMinVersionForCollab) ||\n\t\t\t\t`Codec ${name} is missing entry for lowestMinVersionForCollab`,\n\t\t);\n\n\t\tthis.registry = normalizedRegistry;\n\t}\n\n\t/**\n\t * Applies the provided options to the codec registry to produce a list of evaluated codecs.\n\t * @remarks\n\t * This is used by build, which is what production code should use.\n\t * This is only exposed for testing purposes.\n\t */\n\tpublic applyOptions(\n\t\toptions: TBuildOptions,\n\t): EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion>[] {\n\t\treturn this.registry.map((codec) => ({\n\t\t\tminVersionForCollab: codec.minVersionForCollab,\n\t\t\tformatVersion: codec.formatVersion,\n\t\t\tcodec: codec.codec(options),\n\t\t}));\n\t}\n\n\t/**\n\t * Produce a single codec which can read any supported format, and writes a version selected based on the provided options.\n\t */\n\tpublic build(options: TBuildOptions & CodecWriteOptions): IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTContext\n\t> & {\n\t\t/**\n\t\t * The format version which this codec writes.\n\t\t * @remarks\n\t\t * This is selected based on the provided {@link CodecWriteOptions}.\n\t\t */\n\t\treadonly writeVersion: TFormatVersion;\n\t} {\n\t\tconst [applied, decoder] = this.buildDecoderInternal(options);\n\t\tconst writeVersion = getWriteVersion(this.name, options, applied);\n\t\treturn {\n\t\t\t...decoder,\n\t\t\tencode: (data: TDecoded, context: TContext): JsonCompatibleReadOnly => {\n\t\t\t\treturn writeVersion.codec.encode(data, context);\n\t\t\t},\n\t\t\twriteVersion: writeVersion.formatVersion,\n\t\t};\n\t}\n\n\tprivate buildDecoderInternal(\n\t\toptions: TBuildOptions,\n\t): [\n\t\tEvaluatedCodecVersion<TDecoded, TContext, TFormatVersion>[],\n\t\tPick<\n\t\t\tIJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t\t\"decode\"\n\t\t>,\n\t] {\n\t\tconst applied = this.applyOptions(options);\n\t\tconst fromFormatVersion = new Map<\n\t\t\tFormatVersion,\n\t\t\tEvaluatedCodecVersion<TDecoded, TContext, TFormatVersion>\n\t\t>(applied.map((codec) => [codec.formatVersion, codec]));\n\t\treturn [\n\t\t\tapplied,\n\t\t\t{\n\t\t\t\tdecode: (data: JsonCompatibleReadOnly, context: TContext): TDecoded => {\n\t\t\t\t\tconst versioned = data as Partial<Versioned>;\n\t\t\t\t\tconst codec = fromFormatVersion.get(versioned.version);\n\t\t\t\t\tif (codec === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn codec.codec.decode(data, context);\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Produce a single codec which can read any supported format.\n\t */\n\tpublic buildDecoder(\n\t\toptions: TBuildOptions,\n\t): Pick<\n\t\tIJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t\"decode\"\n\t> {\n\t\treturn this.buildDecoderInternal(options)[1];\n\t}\n\n\tpublic getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree<TFormatVersion> {\n\t\t// TODO: add support for children codecs.\n\t\tconst selected = getWriteVersionNoOverrides(this.registry, clientVersion);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tversion: selected.formatVersion,\n\t\t};\n\t}\n\n\t/**\n\t * Builds a ClientVersionDispatchingCodecBuilder from the provided registry.\n\t * @remarks\n\t * This static method infers the types of the builder from the provided registry,\n\t * making it easier to create builders without needing to explicitly specify all type parameters.\n\t * This gets better type inference than the constructor.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic static build<\n\t\tName extends CodecName,\n\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never>,\n\t>(name: Name, inputRegistry: readonly Entry[]) {\n\t\ttype TDecoded2 =\n\t\t\tEntry extends CodecVersion<infer D, unknown, FormatVersion, never> ? D : never;\n\t\ttype TContext2 =\n\t\t\tEntry extends CodecVersion<unknown, infer C, FormatVersion, never> ? C : never;\n\t\ttype TFormatVersion2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, infer F, never> ? F : never;\n\t\ttype TBuildOptions2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, infer B> ? B : never;\n\n\t\ttype CodecFinal = CodecVersion<\n\t\t\tTDecoded2,\n\t\t\t// If it does not matter what context is provided, undefined is fine, so allow it to be omitted.\n\t\t\tunknown extends TContext2 ? void : TContext2,\n\t\t\tTFormatVersion2,\n\t\t\tTBuildOptions2\n\t\t>;\n\n\t\tconst input = inputRegistry as readonly unknown[] as readonly CodecFinal[];\n\n\t\tconst builder = new ClientVersionDispatchingCodecBuilder<\n\t\t\tTBuildOptions2,\n\t\t\tTDecoded2,\n\t\t\tunknown extends TContext2 ? void : TContext2,\n\t\t\tTFormatVersion2,\n\t\t\tName\n\t\t>(name, input);\n\t\treturn builder;\n\t}\n}\n\n/**\n * Selects which format should be used when writing data.\n * @remarks\n * This either uses the override specified in the options, or selects the newest format compatible with the provided minVersionForCollab.\n */\nfunction getWriteVersion<T extends CodecVersionBase>(\n\tname: CodecName,\n\toptions: CodecWriteOptions,\n\tversions: readonly T[],\n): T {\n\tif (options.writeVersionOverrides?.has(name) === true) {\n\t\tconst selectedFormatVersion = options.writeVersionOverrides.get(name);\n\t\tconst selected = versions.find((codec) => codec.formatVersion === selectedFormatVersion);\n\t\tif (selected === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)}. Supported versions are: ${versionList(versions)}.`,\n\t\t\t);\n\t\t} else if (options.allowPossiblyIncompatibleWriteVersionOverrides !== true) {\n\t\t\tconst selectedMinVersionForCollab = selected.minVersionForCollab;\n\t\t\tif (selectedMinVersionForCollab === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it has minVersionForCollab undefined. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t} else if (gt(selectedMinVersionForCollab, options.minVersionForCollab)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it is only compatible back to client version ${selectedMinVersionForCollab} and the requested oldest compatible client was ${options.minVersionForCollab}. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn selected;\n\t}\n\n\treturn getWriteVersionNoOverrides(versions, options.minVersionForCollab);\n}\n\n/**\n * Selects which format should be used when writing data, without consider overrides.\n */\nfunction getWriteVersionNoOverrides<T extends CodecVersionBase>(\n\tversions: readonly T[],\n\tminVersionForCollab: MinimumVersionForCollab,\n): T {\n\tconst stableVersions: [MinimumMinorSemanticVersion | MinimumVersionForCollab, T][] = [];\n\tfor (const version of versions) {\n\t\tif (version.minVersionForCollab !== undefined) {\n\t\t\tstableVersions.push([version.minVersionForCollab, version]);\n\t\t}\n\t}\n\n\tconst result: T = getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tstableVersions,\n\t);\n\treturn result;\n}\n\n/**\n * Formats a list of versions for use in UsageErrors.\n */\nfunction versionList(versions: readonly CodecVersionBase[]): string {\n\treturn JSON.stringify(Array.from(versions, (codec) => codec.formatVersion));\n}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A0B,CAAC,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAClC,QAAsB,EACtB,mBAA4C;IAE5C,MAAM,cAAc,GAAiE,EAAE,CAAC;IACxF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC/C,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAM,IAAA,kDAAuC,EACxD,mBAAmB,EACnB,cAAc,CACd,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,QAAqC;IACzD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollabIterable,\n\tlowestMinVersionForCollab,\n\ttype MinimumMinorSemanticVersion,\n\ttype SemanticVersion,\n} from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { gt } from \"semver-ts\";\n\nimport { pkgVersion } from \"../../packageVersion.js\";\nimport {\n\tJsonCompatibleReadOnlySchema,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\twithSchemaValidation,\n\ttype FormatVersion,\n\ttype CodecWriteOptions,\n\ttype CodecName,\n\ttype CodecTree,\n} from \"../codec.js\";\n\nimport { Versioned } from \"./format.js\";\n\n/**\n * Json compatible data with a format version.\n */\ntype VersionedJson = JsonCompatibleReadOnlyObject & Versioned;\n\n/**\n * Validate that the version is one of the supported values.\n * @remarks\n * If supportedVersions contains undefined, data with no version field is also accepted despite the return type indicating otherwise.\n * This is for legacy compatibility where older data may not have a version field.\n */\nfunction makeVersionedCodec<\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\tsupportedVersions: Set<FormatVersion>,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tinner: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> {\n\tconst codec = {\n\t\tencode: (data: TDecoded, context: TEncodeContext): TEncoded => {\n\t\t\tconst encoded = inner.encode(data, context);\n\t\t\tassert(\n\t\t\t\tsupportedVersions.has(encoded.version),\n\t\t\t\t0x88b /* version being encoded should be supported */,\n\t\t\t);\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: TValidate, context: TDecodeContext): TDecoded => {\n\t\t\tconst versioned = data as Versioned; // Validated by withSchemaValidation\n\t\t\tif (!supportedVersions.has(versioned.version)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding data. Supported versions for this data are: ${[...supportedVersions].join(\", \")}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst decoded = inner.decode(data, context);\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\t// If undefined is a supported version, skip using withSchemaValidation to enforce there is a version field.\n\t// Codec will still assert the content of the field is in supportedVersions, so it is still somewhat validated, just in a different way.\n\tif (supportedVersions.has(undefined)) {\n\t\treturn codec;\n\t}\n\n\treturn withSchemaValidation(Versioned, codec, validator);\n}\n\n/**\n * Wrap a codec with version checking and schema validation.\n * @remarks\n * The passed in codec should not perform its own schema validation.\n * The schema validation gets added here.\n */\nfunction makeVersionedValidatedCodec<\n\tEncodedSchema extends TSchema,\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\toptions: ICodecOptions,\n\tsupportedVersions: Set<FormatVersion>,\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> &\n\tPick<CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>, \"schema\"> {\n\treturn {\n\t\t...makeVersionedCodec(\n\t\t\tsupportedVersions,\n\t\t\toptions,\n\t\t\twithSchemaValidation(schema, codec, options.jsonValidator),\n\t\t),\n\t\tschema,\n\t};\n}\n\n/**\n * Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.\n */\nexport function makeDiscontinuedCodecAndSchema<\n\tTDecoded,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n>(\n\tdiscontinuedVersion: TFormatVersion,\n\tdiscontinuedSince: SemanticVersion,\n): CodecVersion<TDecoded, unknown, TFormatVersion, ICodecOptions, unknown> {\n\treturn {\n\t\tminVersionForCollab: undefined,\n\t\tformatVersion: discontinuedVersion,\n\t\tcodec: {\n\t\t\tschema: JsonCompatibleReadOnlySchema,\n\t\t\tencode: (_data: TDecoded) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\tdecode: (data: unknown) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot decode data in format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.\n * @remarks\n * The codec should not perform its own schema validation.\n * The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.\n */\nexport type CodecAndSchema<\n\tTDecoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> = {\n\treadonly schema: TSchema;\n} & IJsonCodec<\n\tTDecoded,\n\tVersionedJson,\n\tJsonCompatibleReadOnly,\n\tTEncodeContext,\n\tTDecodeContext\n>;\n\n/**\n * A codec alongside its format version and schema.\n */\nexport interface CodecVersionBase<\n\tT = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * When `undefined` the codec will never be selected as a write version except via override.\n\t * @remarks\n\t * This format will be used for decode if data in it needs to be decoded, regardless of `minVersionForCollab`.\n\t * `undefined` should be used for unstable codec versions (with string FormatVersions),\n\t * as well as previously stabilized formats that are discontinued (meaning we always prefer to use some other format for encoding).\n\t */\n\treadonly minVersionForCollab: MinimumVersionForCollab | undefined;\n\treadonly formatVersion: TFormatVersion;\n\treadonly codec: T;\n}\n\n/**\n * A particular version of a codec and when to use it.\n * @privateRemarks\n * This allows lazy building of the codec with options.\n * This option can likely be removed as the codec handling is made simpler and more consistent.\n * Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,\n * helping ensure that tests and production code behave the same.\n */\nexport interface CodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t| CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>\n\t\t| ((options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>),\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link CodecVersion} after normalization into a consistent type.\n * @remarks\n * Produced by {@link normalizeCodecVersion}.\n * Includes schema validation.\n */\nexport interface NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t(options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link NormalizedCodecVersion} after applying the build options.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.applyOptions}.\n */\ninterface EvaluatedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\tCodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * Normalize the codec to a single format.\n * @remarks\n * Bakes in schema validation, so output no longer exposes the schema.\n */\nfunction normalizeCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n>(\n\tcodecVersion: CodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>,\n): NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion,\n\tTBuildOptions,\n\tTDecodeContext\n> {\n\tconst codecBuilder: (\n\t\toptions: TBuildOptions,\n\t) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> =\n\t\ttypeof codecVersion.codec === \"function\"\n\t\t\t? codecVersion.codec\n\t\t\t: () => codecVersion.codec as CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>;\n\tconst codec = (\n\t\toptions: TBuildOptions,\n\t): CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> => {\n\t\tconst built = codecBuilder(options);\n\t\treturn makeVersionedValidatedCodec(\n\t\t\toptions,\n\t\t\tnew Set([codecVersion.formatVersion]),\n\t\t\tbuilt.schema,\n\t\t\tbuilt,\n\t\t);\n\t};\n\n\treturn {\n\t\tminVersionForCollab: codecVersion.minVersionForCollab,\n\t\tformatVersion: codecVersion.formatVersion,\n\t\tcodec,\n\t};\n}\n\n/**\n * A codec that can read multiple format versions and write a single selected version.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.build}.\n *\n * @typeParam TDecoded - The in memory (not encoded) format.\n * @typeParam TEncodeContext - Context type passed to encode operations.\n * @typeParam TFormatVersion - The type of format version identifiers used by this codec.\n * @typeParam TDecodeContext - Context type passed to decode operations. Defaults to `TEncodeContext`.\n */\nexport interface VersionDispatchingCodec<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t> {\n\t/**\n\t * The format version which this codec writes.\n\t * @remarks\n\t * Selected by {@link VersionDispatchingCodecBuilder.build} based on the provided options.\n\t */\n\treadonly writeVersion: TFormatVersion;\n}\n\n/**\n * Creates a {@link VersionDispatchingCodec} using a {@link CodecVersion} to select the {@link VersionDispatchingCodec.writeVersion}.\n * @privateRemarks\n * This is a two stage builder so the first stage (the static build) can encapsulate all codec specific details and\n * the second (the instance build) can bring in configuration.\n */\nexport class VersionDispatchingCodecBuilder<\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecoded = unknown,\n\tTEncodeContext = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n\tTName extends CodecName = string,\n\tTDecodeContext = TEncodeContext,\n> {\n\tpublic readonly registry: readonly NormalizedCodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>[];\n\n\t/**\n\t * Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.\n\t * @remarks\n\t * Inputs to this are assumed to be constants in the code controlled by the developers of this package,\n\t * and constructed at least once during tests.\n\t * Because of this, the validation of these inputs done with debugAssert should be sufficient,\n\t * and using debugAssert avoids bloating the bundle size for production users.\n\t */\n\tprivate constructor(\n\t\t/**\n\t\t * See {@link CodecName}.\n\t\t */\n\t\tpublic readonly name: TName,\n\t\t/**\n\t\t * The registry of codecs which this builder can use to encode and decode data.\n\t\t */\n\t\tinputRegistry: readonly CodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>[],\n\t) {\n\t\ttype Normalized = NormalizedCodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>;\n\t\tconst normalizedRegistry: Normalized[] = [];\n\t\tconst formats: Set<FormatVersion> = new Set();\n\t\tconst versions: Set<string | undefined> = new Set();\n\n\t\tfor (const codec of inputRegistry) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\t!formats.has(codec.formatVersion) ||\n\t\t\t\t\t`duplicate codec format ${name} ${codec.formatVersion}`,\n\t\t\t);\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tcodec.minVersionForCollab === undefined ||\n\t\t\t\t\ttypeof codec.formatVersion !== \"string\" ||\n\t\t\t\t\t`unstable format ${JSON.stringify(codec.formatVersion)} (string formats) must not have a minVersionForCollab in ${name}`,\n\t\t\t);\n\t\t\tformats.add(codec.formatVersion);\n\t\t\tconst normalizedCodec = normalizeCodecVersion(codec);\n\t\t\tnormalizedRegistry.push(normalizedCodec);\n\t\t\tif (codec.minVersionForCollab !== undefined) {\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\t!versions.has(codec.minVersionForCollab) ||\n\t\t\t\t\t\t`Codec ${name} has multiple entries for version ${JSON.stringify(codec.minVersionForCollab)}`,\n\t\t\t\t);\n\t\t\t\tversions.add(codec.minVersionForCollab);\n\t\t\t}\n\t\t}\n\n\t\tdebugAssert(\n\t\t\t() =>\n\t\t\t\tversions.has(lowestMinVersionForCollab) ||\n\t\t\t\t`Codec ${name} is missing entry for lowestMinVersionForCollab`,\n\t\t);\n\n\t\tthis.registry = normalizedRegistry;\n\t}\n\n\t/**\n\t * Applies `options` to the codec registry to produce a list of evaluated codecs.\n\t * @remarks\n\t * This is used by build, which is what production code should use.\n\t * This is only exposed for testing purposes.\n\t */\n\tpublic applyOptions(\n\t\toptions: TBuildOptions,\n\t): EvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[] {\n\t\treturn this.registry.map((codec) => ({\n\t\t\tminVersionForCollab: codec.minVersionForCollab,\n\t\t\tformatVersion: codec.formatVersion,\n\t\t\tcodec: codec.codec(options),\n\t\t}));\n\t}\n\n\t/**\n\t * Builds a complete {@link VersionDispatchingCodec} that can decode all registered versions\n\t * and encode a version selected by the provided options.\n\t */\n\tpublic build(\n\t\toptions: TBuildOptions & CodecWriteOptions,\n\t): VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext> {\n\t\tconst [applied, decoder] = this.buildDecoderInternal(options);\n\t\tconst writeVersion = getWriteVersion(this.name, options, applied);\n\t\treturn {\n\t\t\t...decoder,\n\t\t\tencode: (data: TDecoded, context: TEncodeContext): JsonCompatibleReadOnly => {\n\t\t\t\treturn writeVersion.codec.encode(data, context);\n\t\t\t},\n\t\t\twriteVersion: writeVersion.formatVersion,\n\t\t};\n\t}\n\n\tprivate buildDecoderInternal(\n\t\toptions: TBuildOptions,\n\t): [\n\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[],\n\t\tPick<\n\t\t\tIJsonCodec<\n\t\t\t\tTDecoded,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tTEncodeContext,\n\t\t\t\tTDecodeContext\n\t\t\t>,\n\t\t\t\"decode\"\n\t\t>,\n\t] {\n\t\tconst applied = this.applyOptions(options);\n\t\tconst fromFormatVersion = new Map<\n\t\t\tFormatVersion,\n\t\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>\n\t\t>(applied.map((codec) => [codec.formatVersion, codec]));\n\t\treturn [\n\t\t\tapplied,\n\t\t\t{\n\t\t\t\tdecode: (data: JsonCompatibleReadOnly, context: TDecodeContext): TDecoded => {\n\t\t\t\t\tconst versioned = data as Partial<Versioned>;\n\t\t\t\t\tconst codec = fromFormatVersion.get(versioned.version);\n\t\t\t\t\tif (codec === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn codec.codec.decode(data, context);\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds a decoder-only codec that can decode any supported format without encoding capability.\n\t *\n\t * @remarks\n\t * The returned codec contains only the `decode` method and can be used when only decoding is needed.\n\t * This is useful for scenarios where reading/decoding versioned data is sufficient.\n\t *\n\t * @param options - Build options (typically containing the `jsonValidator`)\n\t * @returns An object with a `decode` method that can handle any supported format version\n\t */\n\tpublic buildDecoder(\n\t\toptions: TBuildOptions,\n\t): Pick<\n\t\tVersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>,\n\t\t\"decode\"\n\t> {\n\t\treturn this.buildDecoderInternal(options)[1];\n\t}\n\n\tpublic getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree<TFormatVersion> {\n\t\t// TODO: add support for children codecs.\n\t\tconst selected = getWriteVersionNoOverrides(this.registry, clientVersion);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tversion: selected.formatVersion,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a new VersionDispatchingCodecBuilder from the provided codec registry.\n\t *\n\t * @remarks\n\t * This static method infers the types of the builder from the provided registry,\n\t * making it easier to create builders without needing to explicitly specify all type parameters.\n\t * This gets better type inference than the constructor.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = VersionDispatchingCodecBuilder.build('myCodec', [\n\t * { minVersionForCollab: lowestMinVersionForCollab, formatVersion: 1, codec: { encode, decode, schema } },\n\t * { minVersionForCollab: '2.100.0', formatVersion: 2, codec: { encode, decode, schema } },\n\t * ]);\n\t * ```\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic static build<\n\t\tName extends CodecName,\n\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, unknown>,\n\t>(name: Name, inputRegistry: readonly Entry[]) {\n\t\ttype TDecoded2 =\n\t\t\tEntry extends CodecVersion<infer D, unknown, FormatVersion, never, unknown> ? D : never;\n\t\ttype TEncodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never;\n\t\ttype TFormatVersion2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, infer F, never, unknown> ? F : never;\n\t\ttype TBuildOptions2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, infer B, unknown>\n\t\t\t\t? B\n\t\t\t\t: never;\n\t\ttype TDecodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, infer D> ? D : never;\n\n\t\ttype ResolvedEncodeContext = unknown extends TEncodeContext2 ? void : TEncodeContext2;\n\t\ttype ResolvedDecodeContext = unknown extends TDecodeContext2\n\t\t\t? ResolvedEncodeContext\n\t\t\t: TDecodeContext2;\n\n\t\ttype CodecFinal = CodecVersion<\n\t\t\tTDecoded2,\n\t\t\t// If it does not matter what context is provided, undefined is fine, so allow it to be omitted.\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tTBuildOptions2,\n\t\t\tResolvedDecodeContext\n\t\t>;\n\n\t\tconst input = inputRegistry as readonly unknown[] as readonly CodecFinal[];\n\n\t\tconst builder = new VersionDispatchingCodecBuilder<\n\t\t\tTBuildOptions2,\n\t\t\tTDecoded2,\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tName,\n\t\t\tResolvedDecodeContext\n\t\t>(name, input);\n\t\treturn builder;\n\t}\n}\n\n/**\n * Selects which format should be used when writing data.\n * @remarks\n * This either uses the override specified in the options, or selects the newest format compatible with the provided minVersionForCollab.\n */\nfunction getWriteVersion<T extends CodecVersionBase>(\n\tname: CodecName,\n\toptions: CodecWriteOptions,\n\tversions: readonly T[],\n): T {\n\tif (options.writeVersionOverrides?.has(name) === true) {\n\t\tconst selectedFormatVersion = options.writeVersionOverrides.get(name);\n\t\tconst selected = versions.find((codec) => codec.formatVersion === selectedFormatVersion);\n\t\tif (selected === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)}. Supported versions are: ${versionList(versions)}.`,\n\t\t\t);\n\t\t} else if (options.allowPossiblyIncompatibleWriteVersionOverrides !== true) {\n\t\t\tconst selectedMinVersionForCollab = selected.minVersionForCollab;\n\t\t\tif (selectedMinVersionForCollab === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it has minVersionForCollab undefined. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t} else if (gt(selectedMinVersionForCollab, options.minVersionForCollab)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it is only compatible back to client version ${selectedMinVersionForCollab} and the requested oldest compatible client was ${options.minVersionForCollab}. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn selected;\n\t}\n\n\treturn getWriteVersionNoOverrides(versions, options.minVersionForCollab);\n}\n\n/**\n * Selects which format should be used when writing data, without consider overrides.\n */\nfunction getWriteVersionNoOverrides<T extends CodecVersionBase>(\n\tversions: readonly T[],\n\tminVersionForCollab: MinimumVersionForCollab,\n): T {\n\tconst stableVersions: [MinimumMinorSemanticVersion | MinimumVersionForCollab, T][] = [];\n\tfor (const version of versions) {\n\t\tif (version.minVersionForCollab !== undefined) {\n\t\t\tstableVersions.push([version.minVersionForCollab, version]);\n\t\t}\n\t}\n\n\tconst result: T = getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tstableVersions,\n\t);\n\treturn result;\n}\n\n/**\n * Formats a list of versions for use in UsageErrors.\n */\nfunction versionList(versions: readonly CodecVersionBase[]): string {\n\treturn JSON.stringify(Array.from(versions, (codec) => codec.formatVersion));\n}\n"]}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import * as Type from "@sinclair/typebox";
|
|
6
|
+
import type { Static } from "@sinclair/typebox";
|
|
6
7
|
/**
|
|
7
8
|
* A field to use in TypeBox schemas for the version field of a versioned format.
|
|
8
9
|
* @remarks
|
|
@@ -16,19 +17,19 @@ export declare const versionField: {
|
|
|
16
17
|
* Having this schema be particularly strict is not too important since
|
|
17
18
|
* checking that the contents are the exact value expected is done by `makeVersionedCodec` in the {@link VersionDispatchingCodecBuilder}.
|
|
18
19
|
*/
|
|
19
|
-
readonly version:
|
|
20
|
+
readonly version: Type.TUnion<[Type.TNumber, Type.TString]>;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* An object which has a {@link versionField}.
|
|
23
24
|
*/
|
|
24
|
-
export declare const Versioned:
|
|
25
|
+
export declare const Versioned: Type.TObject<{
|
|
25
26
|
/**
|
|
26
27
|
* String versions are used for formats that are not yet officially supported. See {@link FormatVersion} for details.
|
|
27
28
|
* @remarks
|
|
28
29
|
* Having this schema be particularly strict is not too important since
|
|
29
30
|
* checking that the contents are the exact value expected is done by `makeVersionedCodec` in the {@link VersionDispatchingCodecBuilder}.
|
|
30
31
|
*/
|
|
31
|
-
readonly version:
|
|
32
|
+
readonly version: Type.TUnion<[Type.TNumber, Type.TString]>;
|
|
32
33
|
}>;
|
|
33
34
|
export type Versioned = Static<typeof Versioned>;
|
|
34
35
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACxB;;;;;OAKG;;CAEM,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;IAZrB;;;;;OAKG;;EAO8C,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -3,9 +3,32 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
6
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
30
|
exports.Versioned = exports.versionField = void 0;
|
|
8
|
-
const
|
|
31
|
+
const Type = __importStar(require("@sinclair/typebox"));
|
|
9
32
|
/**
|
|
10
33
|
* A field to use in TypeBox schemas for the version field of a versioned format.
|
|
11
34
|
* @remarks
|
|
@@ -19,10 +42,10 @@ exports.versionField = {
|
|
|
19
42
|
* Having this schema be particularly strict is not too important since
|
|
20
43
|
* checking that the contents are the exact value expected is done by `makeVersionedCodec` in the {@link VersionDispatchingCodecBuilder}.
|
|
21
44
|
*/
|
|
22
|
-
version:
|
|
45
|
+
version: Type.Union([Type.Number(), Type.String()]),
|
|
23
46
|
};
|
|
24
47
|
/**
|
|
25
48
|
* An object which has a {@link versionField}.
|
|
26
49
|
*/
|
|
27
|
-
exports.Versioned =
|
|
50
|
+
exports.Versioned = Type.Object(exports.versionField);
|
|
28
51
|
//# sourceMappingURL=format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/codec/versioned/format.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/codec/versioned/format.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wDAA0C;AAG1C;;;;;GAKG;AACU,QAAA,YAAY,GAAG;IAC3B;;;;;OAKG;IACH,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;CAC1C,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as Type from \"@sinclair/typebox\";\nimport type { Static } from \"@sinclair/typebox\";\n\n/**\n * A field to use in TypeBox schemas for the version field of a versioned format.\n * @remarks\n * Spread this into the top level object schema for the format.\n * The version field is required for all versioned formats, and is used by the {@link VersionDispatchingCodecBuilder} to determine which codec version to use when decoding.\n */\nexport const versionField = {\n\t/**\n\t * String versions are used for formats that are not yet officially supported. See {@link FormatVersion} for details.\n\t * @remarks\n\t * Having this schema be particularly strict is not too important since\n\t * checking that the contents are the exact value expected is done by `makeVersionedCodec` in the {@link VersionDispatchingCodecBuilder}.\n\t */\n\tversion: Type.Union([Type.Number(), Type.String()]),\n} as const;\n\n/**\n * An object which has a {@link versionField}.\n */\nexport const Versioned = Type.Object(versionField);\n\nexport type Versioned = Static<typeof Versioned>;\n"]}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { Versioned, versionField } from "./format.js";
|
|
6
|
-
export { makeDiscontinuedCodecAndSchema,
|
|
6
|
+
export { makeDiscontinuedCodecAndSchema, VersionDispatchingCodecBuilder, type VersionDispatchingCodec, type CodecVersion, type CodecAndSchema, } from "./codec.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACN,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACN,8BAA8B,EAC9B,8BAA8B,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.VersionDispatchingCodecBuilder = exports.makeDiscontinuedCodecAndSchema = exports.versionField = exports.Versioned = void 0;
|
|
8
8
|
var format_js_1 = require("./format.js");
|
|
9
9
|
Object.defineProperty(exports, "Versioned", { enumerable: true, get: function () { return format_js_1.Versioned; } });
|
|
10
10
|
Object.defineProperty(exports, "versionField", { enumerable: true, get: function () { return format_js_1.versionField; } });
|
|
11
11
|
var codec_js_1 = require("./codec.js");
|
|
12
12
|
Object.defineProperty(exports, "makeDiscontinuedCodecAndSchema", { enumerable: true, get: function () { return codec_js_1.makeDiscontinuedCodecAndSchema; } });
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "VersionDispatchingCodecBuilder", { enumerable: true, get: function () { return codec_js_1.VersionDispatchingCodecBuilder; } });
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/codec/versioned/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAsD;AAA7C,sGAAA,SAAS,OAAA;AAAE,yGAAA,YAAY,OAAA;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/codec/versioned/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAsD;AAA7C,sGAAA,SAAS,OAAA;AAAE,yGAAA,YAAY,OAAA;AAChC,uCAMoB;AALnB,0HAAA,8BAA8B,OAAA;AAC9B,0HAAA,8BAA8B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { Versioned, versionField } from \"./format.js\";\nexport {\n\tmakeDiscontinuedCodecAndSchema,\n\tVersionDispatchingCodecBuilder,\n\ttype VersionDispatchingCodec,\n\ttype CodecVersion,\n\ttype CodecAndSchema,\n} from \"./codec.js\";\n"]}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { OpSpaceCompressedId, SessionId, SessionSpaceCompressedId, StableId } from "@fluidframework/id-compressor";
|
|
6
|
+
import * as Type from "@sinclair/typebox";
|
|
6
7
|
import { type Brand, type JsonCompatibleReadOnly, type NestedMap, RangeMap } from "../../util/index.js";
|
|
7
8
|
import type { RevertibleAlpha } from "../revertible.js";
|
|
8
9
|
/**
|
|
9
10
|
* The identifier for a particular session/user/client that can generate `GraphCommit`s
|
|
10
11
|
*/
|
|
11
|
-
export declare const SessionIdSchema:
|
|
12
|
+
export declare const SessionIdSchema: Type.TUnsafe<SessionId>;
|
|
12
13
|
/**
|
|
13
14
|
* A unique identifier for a commit. Commits that have been rebased, but are semantically
|
|
14
15
|
* the same, will share the same revision tag.
|
|
@@ -18,9 +19,9 @@ export declare const SessionIdSchema: import("@sinclair/typebox").TUnsafe<Sessio
|
|
|
18
19
|
*/
|
|
19
20
|
export type RevisionTag = SessionSpaceCompressedId | "root";
|
|
20
21
|
export type EncodedRevisionTag = Brand<OpSpaceCompressedId, "EncodedRevisionTag"> | "root";
|
|
21
|
-
export declare const RevisionTagSchema:
|
|
22
|
+
export declare const RevisionTagSchema: Type.TUnion<[Type.TLiteral<"root">, Type.TUnsafe<Brand<OpSpaceCompressedId, "EncodedRevisionTag">>]>;
|
|
22
23
|
export type EncodedStableId = Brand<StableId, "EncodedStableId">;
|
|
23
|
-
export declare const StableIdSchema:
|
|
24
|
+
export declare const StableIdSchema: Type.TString;
|
|
24
25
|
/**
|
|
25
26
|
* An ID which is unique within a revision of a `ModularChangeset`.
|
|
26
27
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/rebase/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EACN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,QAA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