@fluidframework/tree 2.90.0 → 2.92.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 +365 -0
- package/alpha.d.ts +2 -2
- package/api-extractor/api-extractor-lint-alpha.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-alpha.esm.json +1 -1
- package/api-extractor/api-extractor-lint-beta.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-beta.esm.json +1 -1
- package/api-extractor/api-extractor-lint-bundle.json +1 -1
- package/api-extractor/api-extractor-lint-legacy.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-legacy.esm.json +1 -1
- package/api-extractor/api-extractor-lint-public.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-public.esm.json +1 -1
- package/api-extractor/api-extractor.current.json +1 -1
- package/api-extractor/api-extractor.legacy.json +2 -1
- package/api-extractor.json +1 -0
- package/api-report/tree.alpha.api.md +141 -37
- package/beta.d.ts +2 -2
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +28 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +1 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +2 -2
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -4
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +18 -36
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +46 -59
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -4
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/forest/forest.d.ts +5 -2
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +8 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
- package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/dist/core/rebase/revisionTagCodec.js +2 -0
- package/dist/core/rebase/revisionTagCodec.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +2 -2
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +4 -4
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -1
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -0
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +42 -7
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/cursor.d.ts +25 -1
- package/dist/core/tree/cursor.d.ts.map +1 -1
- package/dist/core/tree/cursor.js +45 -1
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +13 -1
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +34 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +6 -2
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +11 -0
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +5 -0
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +6 -0
- package/dist/entrypoints/alpha.d.ts.map +1 -0
- package/dist/entrypoints/alpha.js +91 -0
- package/dist/entrypoints/alpha.js.map +1 -0
- package/dist/entrypoints/beta.d.ts +6 -0
- package/dist/entrypoints/beta.d.ts.map +1 -0
- package/dist/entrypoints/beta.js +43 -0
- package/dist/entrypoints/beta.js.map +1 -0
- package/dist/entrypoints/internal.d.ts +6 -0
- package/dist/entrypoints/internal.d.ts.map +1 -0
- package/dist/entrypoints/internal.js +28 -0
- package/dist/entrypoints/internal.js.map +1 -0
- package/dist/entrypoints/legacy.d.ts +6 -0
- package/dist/entrypoints/legacy.d.ts.map +1 -0
- package/dist/entrypoints/legacy.js +49 -0
- package/dist/entrypoints/legacy.js.map +1 -0
- package/dist/entrypoints/public.d.ts +6 -0
- package/dist/entrypoints/public.d.ts.map +1 -0
- package/dist/entrypoints/public.js +27 -0
- package/dist/entrypoints/public.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
- package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/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.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/cursorComparator.d.ts +23 -0
- package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/dist/feature-libraries/cursorComparator.js +65 -0
- package/dist/feature-libraries/cursorComparator.js.map +1 -0
- package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -5
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +12 -7
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +0 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/index.js +2 -3
- package/dist/feature-libraries/schema-edits/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -21
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +1 -2
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- 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/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +14 -21
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +15 -117
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -22
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +10 -27
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.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 +13 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +2 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +13 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -0
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +34 -69
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +885 -677
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -3
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +40 -67
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +6 -9
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +5 -8
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +38 -74
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -2
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +12 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts.map +1 -1
- package/dist/sharedTreeAttributes.js +3 -0
- package/dist/sharedTreeAttributes.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +72 -7
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +10 -11
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js +13 -7
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +6 -6
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +7 -19
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeAlpha.d.ts +69 -0
- package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/treeAlpha.js +7 -0
- package/dist/simple-tree/api/treeAlpha.js.map +1 -0
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +3 -0
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +49 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +41 -2
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +23 -2
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +45 -8
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +3 -2
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +3 -4
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +321 -13
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +100 -25
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +5 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/rangeMap.d.ts +25 -18
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +24 -30
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +0 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/eslint.config.mts +10 -2
- package/internal.d.ts +2 -2
- package/legacy.d.ts +2 -2
- package/lib/api.d.ts +6 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +28 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +2 -2
- 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 +18 -36
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +45 -56
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/forest/forest.d.ts +5 -2
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +8 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
- package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/lib/core/rebase/revisionTagCodec.js +2 -0
- package/lib/core/rebase/revisionTagCodec.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +2 -2
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +4 -4
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +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/anchorSet.d.ts +8 -0
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +42 -7
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/cursor.d.ts +25 -1
- package/lib/core/tree/cursor.d.ts.map +1 -1
- package/lib/core/tree/cursor.js +43 -0
- package/lib/core/tree/cursor.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +13 -1
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +31 -0
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +2 -2
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +11 -0
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +5 -0
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +6 -0
- package/lib/entrypoints/alpha.d.ts.map +1 -0
- package/lib/entrypoints/alpha.js +12 -0
- package/lib/entrypoints/alpha.js.map +1 -0
- package/lib/entrypoints/beta.d.ts +6 -0
- package/lib/entrypoints/beta.d.ts.map +1 -0
- package/lib/entrypoints/beta.js +12 -0
- package/lib/entrypoints/beta.js.map +1 -0
- package/lib/entrypoints/internal.d.ts +6 -0
- package/lib/entrypoints/internal.d.ts.map +1 -0
- package/lib/entrypoints/internal.js +12 -0
- package/lib/entrypoints/internal.js.map +1 -0
- package/lib/entrypoints/legacy.d.ts +6 -0
- package/lib/entrypoints/legacy.d.ts.map +1 -0
- package/lib/entrypoints/legacy.js +15 -0
- package/lib/entrypoints/legacy.js.map +1 -0
- package/lib/entrypoints/public.d.ts +6 -0
- package/lib/entrypoints/public.d.ts.map +1 -0
- package/lib/entrypoints/public.js +10 -0
- package/lib/entrypoints/public.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
- package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.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.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/cursorComparator.d.ts +23 -0
- package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/lib/feature-libraries/cursorComparator.js +61 -0
- package/lib/feature-libraries/cursorComparator.js.map +1 -0
- package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +12 -7
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +0 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/index.js +1 -1
- package/lib/feature-libraries/schema-edits/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +0 -19
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +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/schema-index/index.d.ts +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +1 -1
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -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/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +4 -11
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +17 -116
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -22
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +11 -27
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.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 +11 -5
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +2 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +13 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -0
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +34 -69
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +889 -682
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +41 -65
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +5 -8
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +3 -3
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +38 -71
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +0 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +14 -4
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts.map +1 -1
- package/lib/sharedTreeAttributes.js +3 -0
- package/lib/sharedTreeAttributes.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +66 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +10 -11
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js +14 -8
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +7 -7
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +7 -19
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeAlpha.d.ts +69 -0
- package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/treeAlpha.js +6 -0
- package/lib/simple-tree/api/treeAlpha.js.map +1 -0
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +3 -0
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +49 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +41 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +23 -2
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +45 -8
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +3 -2
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +3 -4
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +321 -13
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +103 -28
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +6 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/rangeMap.d.ts +25 -18
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +25 -31
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +0 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +50 -50
- package/scripts/generate-entrypoint-sources.sh +31 -0
- package/src/api.ts +11 -0
- package/src/codec/codec.ts +32 -2
- package/src/codec/index.ts +2 -3
- package/src/codec/versioned/codec.ts +99 -109
- package/src/codec/versioned/index.ts +1 -3
- package/src/core/forest/forest.ts +5 -2
- package/src/core/index.ts +4 -0
- package/src/core/rebase/changeRebaser.ts +8 -0
- package/src/core/rebase/revisionTagCodec.ts +4 -4
- package/src/core/rebase/utils.ts +9 -2
- package/src/core/schema-stored/formatV2.ts +1 -1
- package/src/core/tree/anchorSet.ts +67 -10
- package/src/core/tree/cursor.ts +52 -1
- package/src/core/tree/deltaUtil.ts +37 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
- package/src/core/tree/index.ts +4 -0
- package/src/core/tree/visitDelta.ts +13 -1
- package/src/core/tree/visitorUtils.ts +5 -0
- package/{dist/alpha.d.ts → src/entrypoints/alpha.ts} +25 -11
- package/{lib/beta.d.ts → src/entrypoints/beta.ts} +4 -7
- package/src/entrypoints/internal.ts +13 -0
- package/{lib/legacy.d.ts → src/entrypoints/legacy.ts} +13 -8
- package/{dist/public.d.ts → src/entrypoints/public.ts} +3 -6
- package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
- package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
- package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
- package/src/feature-libraries/chunked-forest/index.ts +2 -1
- package/src/feature-libraries/cursorComparator.ts +77 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
- package/src/feature-libraries/index.ts +5 -3
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +20 -10
- package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +3 -8
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +16 -8
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +15 -6
- package/src/feature-libraries/object-forest/objectForest.ts +8 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
- package/src/feature-libraries/schema-edits/index.ts +1 -4
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
- package/src/feature-libraries/schema-index/codec.ts +0 -25
- package/src/feature-libraries/schema-index/formatV2.ts +1 -1
- package/src/feature-libraries/schema-index/index.ts +1 -4
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
- package/src/index.ts +29 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -18
- package/src/shared-tree/index.ts +0 -4
- package/src/shared-tree/schematizingTreeView.ts +19 -165
- package/src/shared-tree/sharedTree.ts +16 -59
- package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
- package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
- package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
- package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
- package/src/shared-tree/tree.ts +2 -5
- package/src/shared-tree/treeAlpha.ts +26 -0
- package/src/shared-tree/treeCheckout.ts +277 -100
- package/src/shared-tree/unhydratedTreeContext.ts +1 -1
- package/src/shared-tree-core/editManagerCodecs.ts +99 -124
- package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
- package/src/shared-tree-core/index.ts +4 -8
- package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
- package/src/shared-tree-core/messageCodecs.ts +88 -126
- package/src/shared-tree-core/messageFormat.ts +0 -3
- package/src/shared-tree-core/sharedTreeCore.ts +14 -21
- package/src/sharedTreeAttributes.ts +3 -0
- package/src/simple-tree/api/eraseSchemaDetails.ts +60 -0
- package/src/simple-tree/api/index.ts +22 -1
- package/src/simple-tree/api/schemaFactory.ts +8 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +275 -27
- package/src/simple-tree/api/schemaFactoryBeta.ts +10 -1
- package/src/simple-tree/api/schemaStatics.ts +79 -21
- package/src/simple-tree/api/storedSchema.ts +8 -19
- package/src/simple-tree/api/tree.ts +7 -20
- package/src/simple-tree/api/treeAlpha.ts +90 -0
- package/src/simple-tree/api/treeBeta.ts +1 -1
- package/src/simple-tree/api/treeChangeEvents.ts +3 -0
- package/src/simple-tree/api/treeNodeApi.ts +95 -3
- package/src/simple-tree/api/typesUnsafe.ts +49 -1
- package/src/simple-tree/core/treeNodeKernel.ts +53 -7
- package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
- package/src/simple-tree/fieldSchema.ts +29 -5
- package/src/simple-tree/index.ts +20 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +5 -0
- package/src/simple-tree/node-kinds/object/index.ts +3 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +69 -11
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +33 -2
- package/src/text/textDomainFormatted.ts +113 -11
- package/src/treeFactory.ts +10 -5
- package/src/util/rangeMap.ts +54 -50
- package/src/util/referenceCounting.ts +0 -1
- package/src/util/typeCheck.ts +1 -0
- package/src/util/typeUtils.ts +4 -7
- package/dist/beta.d.ts +0 -152
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- package/dist/legacy.d.ts +0 -159
- package/lib/alpha.d.ts +0 -304
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- package/lib/public.d.ts +0 -94
- /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
- /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
package/dist/codec/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { type FormatVersion, DependentFormatVersion, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type CodecWriteOptionsBeta, type IDecoder, type IEncoder, type IJsonCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, type CodecTree, jsonableCodecTree, extractJsonValidator, type CodecName, eraseEncodedType, } from "./codec.js";
|
|
5
|
+
export { type FormatVersion, DependentFormatVersion, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type CodecWriteOptionsBeta, type IDecoder, type IEncoder, type IJsonCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, type CodecTree, jsonableCodecTree, extractJsonValidator, type CodecName, eraseEncodedType, type JsonCodecPart, } from "./codec.js";
|
|
6
6
|
export { DiscriminatedUnionDispatcher, type DiscriminatedUnionLibrary, unionOptions, } from "./discriminatedUnions.js";
|
|
7
|
-
export { Versioned,
|
|
7
|
+
export { Versioned, makeDiscontinuedCodecAndSchema, ClientVersionDispatchingCodecBuilder, type CodecVersion, type CodecAndSchema, versionField, } from "./versioned/index.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,SAAS,EACd,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,SAAS,EACd,gBAAgB,EAChB,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,SAAS,EACT,8BAA8B,EAC9B,oCAAoC,EACpC,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,YAAY,GACZ,MAAM,sBAAsB,CAAC"}
|
package/dist/codec/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.versionField = exports.ClientVersionDispatchingCodecBuilder = exports.
|
|
7
|
+
exports.versionField = exports.ClientVersionDispatchingCodecBuilder = exports.makeDiscontinuedCodecAndSchema = exports.Versioned = exports.unionOptions = exports.DiscriminatedUnionDispatcher = exports.eraseEncodedType = exports.extractJsonValidator = exports.jsonableCodecTree = exports.FormatValidatorNoOp = exports.toFormatValidator = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.unitCodec = exports.makeCodecFamily = exports.DependentFormatVersion = void 0;
|
|
8
8
|
var codec_js_1 = require("./codec.js");
|
|
9
9
|
Object.defineProperty(exports, "DependentFormatVersion", { enumerable: true, get: function () { return codec_js_1.DependentFormatVersion; } });
|
|
10
10
|
Object.defineProperty(exports, "makeCodecFamily", { enumerable: true, get: function () { return codec_js_1.makeCodecFamily; } });
|
|
@@ -22,9 +22,7 @@ Object.defineProperty(exports, "DiscriminatedUnionDispatcher", { enumerable: tru
|
|
|
22
22
|
Object.defineProperty(exports, "unionOptions", { enumerable: true, get: function () { return discriminatedUnions_js_1.unionOptions; } });
|
|
23
23
|
var index_js_1 = require("./versioned/index.js");
|
|
24
24
|
Object.defineProperty(exports, "Versioned", { enumerable: true, get: function () { return index_js_1.Versioned; } });
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "makeVersionDispatchingCodec", { enumerable: true, get: function () { return index_js_1.makeVersionDispatchingCodec; } });
|
|
27
|
-
Object.defineProperty(exports, "makeDiscontinuedCodecVersion", { enumerable: true, get: function () { return index_js_1.makeDiscontinuedCodecVersion; } });
|
|
25
|
+
Object.defineProperty(exports, "makeDiscontinuedCodecAndSchema", { enumerable: true, get: function () { return index_js_1.makeDiscontinuedCodecAndSchema; } });
|
|
28
26
|
Object.defineProperty(exports, "ClientVersionDispatchingCodecBuilder", { enumerable: true, get: function () { return index_js_1.ClientVersionDispatchingCodecBuilder; } });
|
|
29
27
|
Object.defineProperty(exports, "versionField", { enumerable: true, get: function () { return index_js_1.versionField; } });
|
|
30
28
|
//# sourceMappingURL=index.js.map
|
package/dist/codec/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCA0BoB;AAxBnB,kHAAA,sBAAsB,OAAA;AAStB,2GAAA,eAAe,OAAA;AAEf,qGAAA,SAAS,OAAA;AACT,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AAGnB,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AAEpB,4GAAA,gBAAgB,OAAA;AAGjB,mEAIkC;AAHjC,sIAAA,4BAA4B,OAAA;AAE5B,sHAAA,YAAY,OAAA;AAEb,iDAO8B;AAN7B,qGAAA,SAAS,OAAA;AACT,0HAAA,8BAA8B,OAAA;AAC9B,gIAAA,oCAAoC,OAAA;AAGpC,wGAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FormatVersion,\n\tDependentFormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype CodecWriteOptionsBeta,\n\ttype IDecoder,\n\ttype IEncoder,\n\ttype IJsonCodec,\n\ttype JsonValidator,\n\tmakeCodecFamily,\n\ttype SchemaValidationFunction,\n\tunitCodec,\n\twithSchemaValidation,\n\tFluidClientVersion,\n\tcurrentVersion,\n\ttoFormatValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n\ttype CodecTree,\n\tjsonableCodecTree,\n\textractJsonValidator,\n\ttype CodecName,\n\teraseEncodedType,\n\ttype JsonCodecPart,\n} from \"./codec.js\";\nexport {\n\tDiscriminatedUnionDispatcher,\n\ttype DiscriminatedUnionLibrary,\n\tunionOptions,\n} from \"./discriminatedUnions.js\";\nexport {\n\tVersioned,\n\tmakeDiscontinuedCodecAndSchema,\n\tClientVersionDispatchingCodecBuilder,\n\ttype CodecVersion,\n\ttype CodecAndSchema,\n\tversionField,\n} from \"./versioned/index.js\";\n"]}
|
|
@@ -4,41 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
6
6
|
import { type SemanticVersion } from "@fluidframework/runtime-utils/internal";
|
|
7
|
-
import {
|
|
8
|
-
import type
|
|
9
|
-
import { type
|
|
7
|
+
import type { TSchema } from "@sinclair/typebox";
|
|
8
|
+
import { type JsonCompatibleReadOnly, type JsonCompatibleReadOnlyObject } from "../../util/index.js";
|
|
9
|
+
import { type ICodecOptions, type IJsonCodec, type FormatVersion, type CodecWriteOptions, type CodecName, type CodecTree } from "../codec.js";
|
|
10
10
|
import { Versioned } from "./format.js";
|
|
11
11
|
/**
|
|
12
12
|
* Json compatible data with a format version.
|
|
13
13
|
*/
|
|
14
14
|
type VersionedJson = JsonCompatibleReadOnlyObject & Versioned;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* The passed in codec should not perform its own schema validation.
|
|
19
|
-
* The schema validation gets added here.
|
|
20
|
-
*
|
|
21
|
-
* TODO: users of this should migrate to {@link ClientVersionDispatchingCodecBuilder}.
|
|
22
|
-
*/
|
|
23
|
-
export declare function makeVersionedValidatedCodec<EncodedSchema extends TSchema, TDecoded, TEncoded extends Versioned = VersionedJson, TValidate = TEncoded, TContext = void>(options: ICodecOptions, supportedVersions: Set<FormatVersion>, schema: EncodedSchema, codec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>): IJsonCodec<TDecoded, TEncoded, TValidate, TContext>;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a codec which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
|
|
26
|
-
*
|
|
27
|
-
* TODO: {@link ClientVersionDispatchingCodecBuilder} should get support for extra decode only entries and/or unstable formats (codecs without a minVersionForCollab that will never be selected for write unless overridden).
|
|
28
|
-
* Once done, users of this should migrate to ClientVersionDispatchingCodecBuilder and this function can be simplified.
|
|
29
|
-
*/
|
|
30
|
-
export declare function makeDiscontinuedCodecVersion<TDecoded, TEncoded extends Versioned = VersionedJson, TContext = unknown>(options: ICodecOptions, discontinuedVersion: FormatVersion, discontinuedSince: SemanticVersion): IJsonCodec<TDecoded, TEncoded, TEncoded, TContext>;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a codec which dispatches to the appropriate member of a codec family based on the version of
|
|
33
|
-
* data it encounters.
|
|
34
|
-
* @remarks
|
|
35
|
-
* Each member of the codec family must write an explicit version number into the data it encodes (implementing {@link Versioned}).
|
|
36
|
-
*
|
|
37
|
-
* TODO: Users of this should migrate to {@link ClientVersionDispatchingCodecBuilder} so that the actual format version used can be encapsulated.
|
|
16
|
+
* Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
|
|
38
17
|
*/
|
|
39
|
-
export declare function
|
|
40
|
-
writeVersion: FormatVersion;
|
|
41
|
-
}): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;
|
|
18
|
+
export declare function makeDiscontinuedCodecAndSchema<TDecoded, TContext, TFormatVersion extends FormatVersion = FormatVersion>(discontinuedVersion: TFormatVersion, discontinuedSince: SemanticVersion): CodecVersion<TDecoded, TContext, TFormatVersion>;
|
|
42
19
|
/**
|
|
43
20
|
* A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.
|
|
44
21
|
* @remarks
|
|
@@ -71,7 +48,7 @@ export interface CodecVersionBase<T = unknown, TFormatVersion extends FormatVers
|
|
|
71
48
|
* Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,
|
|
72
49
|
* helping ensure that tests and production code behave the same.
|
|
73
50
|
*/
|
|
74
|
-
export interface CodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion, TBuildOptions extends
|
|
51
|
+
export interface CodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion, TBuildOptions extends ICodecOptions = ICodecOptions> extends CodecVersionBase<CodecAndSchema<TDecoded, TContext> | ((options: TBuildOptions) => CodecAndSchema<TDecoded, TContext>), TFormatVersion> {
|
|
75
52
|
}
|
|
76
53
|
/**
|
|
77
54
|
* {@link CodecVersion} after normalization into a consistent type.
|
|
@@ -79,14 +56,14 @@ export interface CodecVersion<TDecoded, TContext, TFormatVersion extends FormatV
|
|
|
79
56
|
* Produced by {@link normalizeCodecVersion}.
|
|
80
57
|
* Includes schema validation.
|
|
81
58
|
*/
|
|
82
|
-
export interface NormalizedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion, TBuildOptions extends
|
|
59
|
+
export interface NormalizedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion, TBuildOptions extends ICodecOptions> extends CodecVersionBase<(options: TBuildOptions) => CodecAndSchema<TDecoded, TContext>, TFormatVersion> {
|
|
83
60
|
}
|
|
84
61
|
/**
|
|
85
62
|
* {@link NormalizedCodecVersion} after applying the build options.
|
|
86
63
|
* @remarks
|
|
87
64
|
* Produced by {@link ClientVersionDispatchingCodecBuilder.applyOptions}.
|
|
88
65
|
*/
|
|
89
|
-
interface EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion> extends CodecVersionBase<
|
|
66
|
+
interface EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion> extends CodecVersionBase<CodecAndSchema<TDecoded, TContext>, TFormatVersion> {
|
|
90
67
|
}
|
|
91
68
|
/**
|
|
92
69
|
* Creates a codec which dispatches to the appropriate member of a codec family based on the `minVersionForCollab` for encode and the
|
|
@@ -94,11 +71,11 @@ interface EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion extends Forma
|
|
|
94
71
|
* @privateRemarks
|
|
95
72
|
* This is a two stage builder so the first stage can encapsulate all codec specific details and the second can bring in configuration.
|
|
96
73
|
*/
|
|
97
|
-
export declare class ClientVersionDispatchingCodecBuilder<
|
|
74
|
+
export declare class ClientVersionDispatchingCodecBuilder<TBuildOptions extends ICodecOptions = ICodecOptions, TDecoded = unknown, TContext = unknown, TFormatVersion extends FormatVersion = FormatVersion, TName extends CodecName = string> {
|
|
98
75
|
/**
|
|
99
76
|
* See {@link CodecName}.
|
|
100
77
|
*/
|
|
101
|
-
readonly name:
|
|
78
|
+
readonly name: TName;
|
|
102
79
|
readonly registry: readonly NormalizedCodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions>[];
|
|
103
80
|
/**
|
|
104
81
|
* Use {@link ClientVersionDispatchingCodecBuilder.build} to create an instance of this class.
|
|
@@ -119,7 +96,7 @@ export declare class ClientVersionDispatchingCodecBuilder<Name extends CodecName
|
|
|
119
96
|
/**
|
|
120
97
|
* Produce a single codec which can read any supported format, and writes a version selected based on the provided options.
|
|
121
98
|
*/
|
|
122
|
-
build(options: TBuildOptions): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> & {
|
|
99
|
+
build(options: TBuildOptions & CodecWriteOptions): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> & {
|
|
123
100
|
/**
|
|
124
101
|
* The format version which this codec writes.
|
|
125
102
|
* @remarks
|
|
@@ -127,7 +104,12 @@ export declare class ClientVersionDispatchingCodecBuilder<Name extends CodecName
|
|
|
127
104
|
*/
|
|
128
105
|
readonly writeVersion: TFormatVersion;
|
|
129
106
|
};
|
|
130
|
-
|
|
107
|
+
private buildDecoderInternal;
|
|
108
|
+
/**
|
|
109
|
+
* Produce a single codec which can read any supported format.
|
|
110
|
+
*/
|
|
111
|
+
buildDecoder(options: TBuildOptions): Pick<IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>, "decode">;
|
|
112
|
+
getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree<TFormatVersion>;
|
|
131
113
|
/**
|
|
132
114
|
* Builds a ClientVersionDispatchingCodecBuilder from the provided registry.
|
|
133
115
|
* @remarks
|
|
@@ -135,7 +117,7 @@ export declare class ClientVersionDispatchingCodecBuilder<Name extends CodecName
|
|
|
135
117
|
* making it easier to create builders without needing to explicitly specify all type parameters.
|
|
136
118
|
* This gets better type inference than the constructor.
|
|
137
119
|
*/
|
|
138
|
-
static build<Name extends CodecName, Entry extends CodecVersion<unknown, unknown, FormatVersion, never>>(name: Name, inputRegistry: readonly Entry[]): ClientVersionDispatchingCodecBuilder<
|
|
120
|
+
static build<Name extends CodecName, Entry extends CodecVersion<unknown, unknown, FormatVersion, never>>(name: Name, inputRegistry: readonly Entry[]): ClientVersionDispatchingCodecBuilder<Entry extends CodecVersion<unknown, unknown, FormatVersion, infer B extends ICodecOptions> ? B : never, Entry extends CodecVersion<infer D, unknown, FormatVersion, never> ? D : never, unknown extends (Entry extends CodecVersion<unknown, infer C, FormatVersion, never> ? C : never) ? void : Entry extends CodecVersion<unknown, infer C, FormatVersion, never> ? C : never, Entry extends CodecVersion<unknown, unknown, infer F extends FormatVersion, never> ? F : never, Name>;
|
|
139
121
|
}
|
|
140
122
|
export {};
|
|
141
123
|
//# 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,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBA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nE,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,QAAQ,CACR,GAAG;QACH;;;;WAIG;QACH,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC;KACtC;IAYD,OAAO,CAAC,oBAAoB;IAgC5B;;OAEG;IACI,YAAY,CAClB,OAAO,EAAE,aAAa,GACpB,IAAI,CACN,UAAU,CAAC,QAAQ,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,EAC9E,QAAQ,CACR;IAIM,YAAY,CAAC,aAAa,EAAE,uBAAuB,GAAG,SAAS,CAAC,cAAc,CAAC;IAStF;;;;;;OAMG;WAEW,KAAK,CAClB,IAAI,SAAS,SAAS,EACtB,KAAK,SAAS,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,EACjE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,KAAK,EAAE;CA6B7C"}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ClientVersionDispatchingCodecBuilder = exports.
|
|
7
|
+
exports.ClientVersionDispatchingCodecBuilder = 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");
|
|
11
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
12
11
|
const semver_ts_1 = require("semver-ts");
|
|
13
12
|
const packageVersion_js_1 = require("../../packageVersion.js");
|
|
13
|
+
const index_js_1 = require("../../util/index.js");
|
|
14
14
|
const codec_js_1 = require("../codec.js");
|
|
15
15
|
const format_js_1 = require("./format.js");
|
|
16
16
|
/**
|
|
@@ -48,60 +48,32 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
48
48
|
* @remarks
|
|
49
49
|
* The passed in codec should not perform its own schema validation.
|
|
50
50
|
* The schema validation gets added here.
|
|
51
|
-
*
|
|
52
|
-
* TODO: users of this should migrate to {@link ClientVersionDispatchingCodecBuilder}.
|
|
53
51
|
*/
|
|
54
52
|
function makeVersionedValidatedCodec(options, supportedVersions, schema, codec) {
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Creates a codec which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
|
|
60
|
-
*
|
|
61
|
-
* TODO: {@link ClientVersionDispatchingCodecBuilder} should get support for extra decode only entries and/or unstable formats (codecs without a minVersionForCollab that will never be selected for write unless overridden).
|
|
62
|
-
* Once done, users of this should migrate to ClientVersionDispatchingCodecBuilder and this function can be simplified.
|
|
63
|
-
*/
|
|
64
|
-
function makeDiscontinuedCodecVersion(options, discontinuedVersion, discontinuedSince) {
|
|
65
|
-
const schema = typebox_1.Type.Object({
|
|
66
|
-
version: discontinuedVersion === undefined
|
|
67
|
-
? typebox_1.Type.Undefined()
|
|
68
|
-
: typebox_1.Type.Literal(discontinuedVersion),
|
|
69
|
-
},
|
|
70
|
-
// Using `additionalProperties: true` allows this schema to be used when loading data encoded by older versions even though they contain additional properties.
|
|
71
|
-
{ additionalProperties: true });
|
|
72
|
-
const codec = {
|
|
73
|
-
encode: (_) => {
|
|
74
|
-
throw new internal_3.UsageError(`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`);
|
|
75
|
-
},
|
|
76
|
-
decode: (data) => {
|
|
77
|
-
throw new internal_3.UsageError(`Cannot decode data to format ${data.version}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`);
|
|
78
|
-
},
|
|
53
|
+
return {
|
|
54
|
+
...makeVersionedCodec(supportedVersions, options, (0, codec_js_1.withSchemaValidation)(schema, codec, options.jsonValidator)),
|
|
55
|
+
schema,
|
|
79
56
|
};
|
|
80
|
-
return makeVersionedValidatedCodec(options, new Set([discontinuedVersion]), schema, codec);
|
|
81
57
|
}
|
|
82
|
-
exports.makeDiscontinuedCodecVersion = makeDiscontinuedCodecVersion;
|
|
83
58
|
/**
|
|
84
|
-
* Creates a codec which
|
|
85
|
-
* data it encounters.
|
|
86
|
-
* @remarks
|
|
87
|
-
* Each member of the codec family must write an explicit version number into the data it encodes (implementing {@link Versioned}).
|
|
88
|
-
*
|
|
89
|
-
* TODO: Users of this should migrate to {@link ClientVersionDispatchingCodecBuilder} so that the actual format version used can be encapsulated.
|
|
59
|
+
* Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
|
|
90
60
|
*/
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
61
|
+
function makeDiscontinuedCodecAndSchema(discontinuedVersion, discontinuedSince) {
|
|
62
|
+
return {
|
|
63
|
+
minVersionForCollab: undefined,
|
|
64
|
+
formatVersion: discontinuedVersion,
|
|
65
|
+
codec: {
|
|
66
|
+
schema: index_js_1.JsonCompatibleReadOnlySchema,
|
|
67
|
+
encode: (_data) => {
|
|
68
|
+
throw new internal_3.UsageError(`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`);
|
|
69
|
+
},
|
|
70
|
+
decode: (data) => {
|
|
71
|
+
throw new internal_3.UsageError(`Cannot decode data in format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`);
|
|
72
|
+
},
|
|
101
73
|
},
|
|
102
|
-
}
|
|
74
|
+
};
|
|
103
75
|
}
|
|
104
|
-
exports.
|
|
76
|
+
exports.makeDiscontinuedCodecAndSchema = makeDiscontinuedCodecAndSchema;
|
|
105
77
|
/**
|
|
106
78
|
* Normalize the codec to a single format.
|
|
107
79
|
* @remarks
|
|
@@ -185,25 +157,40 @@ class ClientVersionDispatchingCodecBuilder {
|
|
|
185
157
|
* Produce a single codec which can read any supported format, and writes a version selected based on the provided options.
|
|
186
158
|
*/
|
|
187
159
|
build(options) {
|
|
188
|
-
const applied = this.
|
|
160
|
+
const [applied, decoder] = this.buildDecoderInternal(options);
|
|
189
161
|
const writeVersion = getWriteVersion(this.name, options, applied);
|
|
190
|
-
const fromFormatVersion = new Map(applied.map((codec) => [codec.formatVersion, codec]));
|
|
191
162
|
return {
|
|
163
|
+
...decoder,
|
|
192
164
|
encode: (data, context) => {
|
|
193
165
|
return writeVersion.codec.encode(data, context);
|
|
194
166
|
},
|
|
195
|
-
decode: (data, context) => {
|
|
196
|
-
const versioned = data;
|
|
197
|
-
const codec = fromFormatVersion.get(versioned.version);
|
|
198
|
-
if (codec === undefined) {
|
|
199
|
-
throw new internal_3.UsageError(`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.
|
|
200
|
-
The client which encoded this data likely specified an "minVersionForCollab" value which corresponds to a version newer than the version of this client ("${packageVersion_js_1.pkgVersion}").`);
|
|
201
|
-
}
|
|
202
|
-
return codec.codec.decode(data, context);
|
|
203
|
-
},
|
|
204
167
|
writeVersion: writeVersion.formatVersion,
|
|
205
168
|
};
|
|
206
169
|
}
|
|
170
|
+
buildDecoderInternal(options) {
|
|
171
|
+
const applied = this.applyOptions(options);
|
|
172
|
+
const fromFormatVersion = new Map(applied.map((codec) => [codec.formatVersion, codec]));
|
|
173
|
+
return [
|
|
174
|
+
applied,
|
|
175
|
+
{
|
|
176
|
+
decode: (data, context) => {
|
|
177
|
+
const versioned = data;
|
|
178
|
+
const codec = fromFormatVersion.get(versioned.version);
|
|
179
|
+
if (codec === undefined) {
|
|
180
|
+
throw new internal_3.UsageError(`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.
|
|
181
|
+
The client which encoded this data likely specified an "minVersionForCollab" value which corresponds to a version newer than the version of this client ("${packageVersion_js_1.pkgVersion}").`);
|
|
182
|
+
}
|
|
183
|
+
return codec.codec.decode(data, context);
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Produce a single codec which can read any supported format.
|
|
190
|
+
*/
|
|
191
|
+
buildDecoder(options) {
|
|
192
|
+
return this.buildDecoderInternal(options)[1];
|
|
193
|
+
}
|
|
207
194
|
getCodecTree(clientVersion) {
|
|
208
195
|
// TODO: add support for children codecs.
|
|
209
196
|
const selected = getWriteVersionNoOverrides(this.registry, clientVersion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA0E;AAE1E,qEAKgD;AAChD,uEAAsE;AACtE,+CAAuD;AACvD,yCAA+B;AAE/B,+DAAqD;AAKrD,0CASqB;AAErB,2CAAwC;AAOxC;;;;;GAKG;AACH,SAAS,kBAAkB,CAM1B,iBAAqC,EACrC,EAAE,aAAa,EAAE,SAAS,EAAiB,EAC3C,KAA0D;IAE1D,MAAM,KAAK,GAAG;QACb,MAAM,EAAE,CAAC,IAAc,EAAE,OAAiB,EAAY,EAAE;YACvD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC5C,IAAA,iBAAM,EACL,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EACtC,KAAK,CAAC,+CAA+C,CACrD,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAe,EAAE,OAAiB,EAAY,EAAE;YACxD,MAAM,SAAS,GAAG,IAAiB,CAAC,CAAC,oCAAoC;YACzE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,MAAM,IAAI,qBAAU,CACnB,uBAAuB,SAAS,CAA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AC,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, type TSchema } from \"@sinclair/typebox\";\nimport { gt } from \"semver-ts\";\n\nimport { pkgVersion } from \"../../packageVersion.js\";\nimport type {\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\nimport {\n\ttype ICodecFamily,\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 *\n * TODO: users of this should migrate to {@link ClientVersionDispatchingCodecBuilder}.\n */\nexport function 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\treturn makeVersionedCodec(\n\t\tsupportedVersions,\n\t\toptions,\n\t\twithSchemaValidation(schema, codec, options.jsonValidator),\n\t);\n}\n\n/**\n * Creates a codec which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.\n *\n * TODO: {@link ClientVersionDispatchingCodecBuilder} should get support for extra decode only entries and/or unstable formats (codecs without a minVersionForCollab that will never be selected for write unless overridden).\n * Once done, users of this should migrate to ClientVersionDispatchingCodecBuilder and this function can be simplified.\n */\nexport function makeDiscontinuedCodecVersion<\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTContext = unknown,\n>(\n\toptions: ICodecOptions,\n\tdiscontinuedVersion: FormatVersion,\n\tdiscontinuedSince: SemanticVersion,\n): IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> {\n\tconst schema = Type.Object(\n\t\t{\n\t\t\tversion:\n\t\t\t\tdiscontinuedVersion === undefined\n\t\t\t\t\t? Type.Undefined()\n\t\t\t\t\t: Type.Literal(discontinuedVersion),\n\t\t},\n\t\t// Using `additionalProperties: true` allows this schema to be used when loading data encoded by older versions even though they contain additional properties.\n\t\t{ additionalProperties: true },\n\t);\n\tconst codec: IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> = {\n\t\tencode: (_: TDecoded): TEncoded => {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t);\n\t\t},\n\t\tdecode: (data: TEncoded): TDecoded => {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Cannot decode data to format ${data.version}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t);\n\t\t},\n\t};\n\treturn makeVersionedValidatedCodec(options, new Set([discontinuedVersion]), schema, codec);\n}\n\n/**\n * Creates a codec which dispatches to the appropriate member of a codec family based on the version of\n * data it encounters.\n * @remarks\n * Each member of the codec family must write an explicit version number into the data it encodes (implementing {@link Versioned}).\n *\n * TODO: Users of this should migrate to {@link ClientVersionDispatchingCodecBuilder} so that the actual format version used can be encapsulated.\n */\nexport function makeVersionDispatchingCodec<TDecoded, TContext>(\n\tfamily: ICodecFamily<TDecoded, TContext>,\n\toptions: ICodecOptions & { writeVersion: FormatVersion },\n): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\tconst writeCodec = family.resolve(options.writeVersion);\n\tconst supportedVersions = new Set(family.getSupportedFormats());\n\treturn makeVersionedCodec(supportedVersions, options, {\n\t\tencode(data, context): Versioned {\n\t\t\treturn writeCodec.encode(data, context) as Versioned;\n\t\t},\n\t\tdecode(data: Versioned, context) {\n\t\t\tconst codec = family.resolve(data.version);\n\t\t\treturn codec.decode(data, context);\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 CodecWriteOptions,\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 CodecWriteOptions,\n> extends CodecVersionBase<\n\t\t(\n\t\t\toptions: TBuildOptions,\n\t\t) => IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, 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<\n\t\tIJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TContext>,\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\tTContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends CodecWriteOptions,\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 = (\n\t\toptions: TBuildOptions,\n\t): IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, 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\tName extends CodecName,\n\tTDecoded,\n\tTContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends CodecWriteOptions,\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: Name,\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): 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 = this.applyOptions(options);\n\t\tconst writeVersion = getWriteVersion(this.name, options, applied);\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\tencode: (data: TDecoded, context: TContext): JsonCompatibleReadOnly => {\n\t\t\t\treturn writeVersion.codec.encode(data, context);\n\t\t\t},\n\t\t\tdecode: (data: JsonCompatibleReadOnly, context: TContext): TDecoded => {\n\t\t\t\tconst versioned = data as Partial<Versioned>;\n\t\t\t\tconst codec = fromFormatVersion.get(versioned.version);\n\t\t\t\tif (codec === undefined) {\n\t\t\t\t\tthrow new UsageError(\n\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);\n\t\t\t\t}\n\t\t\t\treturn codec.codec.decode(data, context);\n\t\t\t},\n\t\t\twriteVersion: writeVersion.formatVersion,\n\t\t};\n\t}\n\n\tpublic getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree {\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\tName,\n\t\t\tTDecoded2,\n\t\t\tunknown extends TContext2 ? void : TContext2,\n\t\t\tTFormatVersion2,\n\t\t\tTBuildOptions2\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"]}
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA0E;AAE1E,qEAKgD;AAChD,uEAAsE;AAEtE,yCAA+B;AAE/B,+DAAqD;AACrD,kDAI6B;AAC7B,0CAQqB;AAErB,2CAAwC;AAOxC;;;;;GAKG;AACH,SAAS,kBAAkB,CAM1B,iBAAqC,EACrC,EAAE,aAAa,EAAE,SAAS,EAAiB,EAC3C,KAA0D;IAE1D,MAAM,KAAK,GAAG;QACb,MAAM,EAAE,CAAC,IAAc,EAAE,OAAiB,EAAY,EAAE;YACvD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC5C,IAAA,iBAAM,EACL,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EACtC,KAAK,CAAC,+CAA+C,CACrD,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAe,EAAE,OAAiB,EAAY,EAAE;YACxD,MAAM,SAAS,GAAG,IAAiB,CAAC,CAAC,oCAAoC;YACzE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,MAAM,IAAI,qBAAU,CACnB,uBAAuB,SAAS,CAAC,OAAO,2EAA2E,CAAC,GAAG,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;4JACG,8BAAU,KAAK,CACtK,CAAC;YACH,CAAC;YACD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC5C,O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D,2BAA2B,mDAAmD,OAAO,CAAC,mBAAmB,+FAA+F,CACnW,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,OAAO,0BAA0B,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\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}\n"]}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { Versioned, versionField } from "./format.js";
|
|
6
|
-
export {
|
|
6
|
+
export { makeDiscontinuedCodecAndSchema, ClientVersionDispatchingCodecBuilder, 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,
|
|
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,oCAAoC,EACpC,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ClientVersionDispatchingCodecBuilder = exports.
|
|
7
|
+
exports.ClientVersionDispatchingCodecBuilder = 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
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "makeVersionDispatchingCodec", { enumerable: true, get: function () { return codec_js_1.makeVersionDispatchingCodec; } });
|
|
14
|
-
Object.defineProperty(exports, "makeDiscontinuedCodecVersion", { enumerable: true, get: function () { return codec_js_1.makeDiscontinuedCodecVersion; } });
|
|
12
|
+
Object.defineProperty(exports, "makeDiscontinuedCodecAndSchema", { enumerable: true, get: function () { return codec_js_1.makeDiscontinuedCodecAndSchema; } });
|
|
15
13
|
Object.defineProperty(exports, "ClientVersionDispatchingCodecBuilder", { enumerable: true, get: function () { return codec_js_1.ClientVersionDispatchingCodecBuilder; } });
|
|
16
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,uCAKoB;AAJnB,0HAAA,8BAA8B,OAAA;AAC9B,gIAAA,oCAAoC,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\tClientVersionDispatchingCodecBuilder,\n\ttype CodecVersion,\n\ttype CodecAndSchema,\n} from \"./codec.js\";\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { Listenable } from "@fluidframework/core-interfaces/internal";
|
|
6
|
+
import type { Breakable } from "../../util/index.js";
|
|
6
7
|
import type { FieldKey, TreeStoredSchemaSubscription } from "../schema-stored/index.js";
|
|
7
8
|
import { type Anchor, type AnchorSet, type AnnouncedVisitor, type DetachedField, type ITreeCursor, type ITreeCursorSynchronous, type TreeChunk, type UpPath } from "../tree/index.js";
|
|
8
9
|
import type { IEditableForest } from "./editableForest.js";
|
|
@@ -56,11 +57,13 @@ export interface IForestSubscription {
|
|
|
56
57
|
*/
|
|
57
58
|
readonly anchors: AnchorSet;
|
|
58
59
|
/**
|
|
59
|
-
* Create an independent copy of this forest, that uses the provided schema
|
|
60
|
+
* Create an independent copy of this forest, that uses the provided schema.
|
|
60
61
|
*
|
|
61
62
|
* The new copy will not invalidate observers (dependents) of the old one.
|
|
63
|
+
* @param breaker - If provided, the cloned forest will use this breaker instead of inheriting the original's.
|
|
64
|
+
* This is useful when creating a fork that should have fault isolation from the original.
|
|
62
65
|
*/
|
|
63
|
-
clone(schema: TreeStoredSchemaSubscription,
|
|
66
|
+
clone(schema: TreeStoredSchemaSubscription, breaker?: Breakable): IEditableForest;
|
|
64
67
|
/**
|
|
65
68
|
* Generate a TreeChunk[] for the current field (and its children) of cursor.
|
|
66
69
|
* This can be used to chunk data that is then inserted into the forest.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forest.d.ts","sourceRoot":"","sources":["../../../src/core/forest/forest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAG3E,OAAO,KAAK,EAAE,QAAQ,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EACN,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,MAAM,EA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