@fluidframework/tree 2.81.1 → 2.83.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 +168 -0
- package/README.md +33 -5
- package/api-report/tree.alpha.api.md +75 -39
- package/api-report/tree.beta.api.md +164 -3
- package/api-report/tree.legacy.beta.api.md +164 -3
- package/api-report/tree.legacy.public.api.md +2 -1
- package/api-report/tree.public.api.md +2 -1
- package/dist/alpha.d.ts +10 -4
- package/dist/beta.d.ts +4 -0
- package/dist/codec/codec.d.ts +18 -45
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +12 -50
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +20 -7
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +56 -30
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +3 -2
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +4 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +23 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +30 -16
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +2 -2
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +0 -5
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +11 -10
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -6
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +9 -7
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.js +1 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +6 -4
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/visitDelta.js +2 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/extensibleUnionNode.d.ts +97 -0
- package/dist/extensibleUnionNode.d.ts.map +1 -0
- package/dist/extensibleUnionNode.js +89 -0
- package/dist/extensibleUnionNode.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +7 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +4 -42
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +2 -41
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.js +1 -2
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +2 -41
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.js +1 -2
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -3
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +13 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +6 -4
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +2 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +36 -13
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -0
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +25 -9
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -32
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +39 -5
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/dist/shared-tree/tree.d.ts +1 -1
- package/dist/shared-tree/tree.js +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +20 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +41 -7
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -2
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- 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 +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +2 -2
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +14 -3
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +59 -16
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -3
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +180 -99
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +82 -7
- 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/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -0
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +29 -0
- package/dist/simple-tree/core/unhydratedFlexTree.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 +5 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +47 -14
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js +2 -1
- package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js +2 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +33 -7
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +71 -48
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +200 -98
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +3 -3
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +48 -32
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +30 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +35 -23
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +2 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +6 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/opaque.d.ts.map +1 -1
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.d.ts +3 -2
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +12 -7
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/readSnapshotBlob.js.map +1 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +20 -16
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +49 -17
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +0 -9
- package/lib/alpha.d.ts +10 -4
- package/lib/beta.d.ts +4 -0
- package/lib/codec/codec.d.ts +18 -45
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +10 -47
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +20 -7
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +59 -33
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +3 -2
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +23 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +27 -15
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +2 -2
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +0 -5
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +11 -10
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -6
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +2 -0
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +9 -7
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -1
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +6 -4
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/visitDelta.js +2 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/extensibleUnionNode.d.ts +97 -0
- package/lib/extensibleUnionNode.d.ts.map +1 -0
- package/lib/extensibleUnionNode.js +86 -0
- package/lib/extensibleUnionNode.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +5 -5
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +8 -2
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +4 -42
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +2 -41
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.js +1 -2
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +2 -41
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.js +1 -2
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +6 -4
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +2 -2
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +36 -13
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +1 -0
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +25 -9
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -34
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +40 -6
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/lib/shared-tree/tree.d.ts +1 -1
- package/lib/shared-tree/tree.js +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +20 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +41 -7
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +2 -2
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +2 -2
- 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 +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +2 -2
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +14 -3
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +61 -18
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -2
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +179 -98
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +82 -7
- 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/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -0
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +29 -0
- package/lib/simple-tree/core/unhydratedFlexTree.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 +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +46 -14
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +34 -8
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +71 -48
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +201 -99
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +3 -3
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +30 -14
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +30 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +33 -22
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +2 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/opaque.d.ts.map +1 -1
- package/lib/util/opaque.js.map +1 -1
- package/lib/util/rangeMap.d.ts +3 -2
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +12 -7
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/readSnapshotBlob.js.map +1 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +20 -16
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +44 -15
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/codec.ts +33 -116
- package/src/codec/index.ts +2 -3
- package/src/codec/versioned/codec.ts +127 -95
- package/src/core/index.ts +3 -1
- package/src/core/rebase/changeRebaser.ts +3 -2
- package/src/core/rebase/index.ts +3 -1
- package/src/core/rebase/types.ts +51 -13
- package/src/core/schema-stored/formatV1.ts +2 -4
- package/src/core/schema-stored/formatV2.ts +9 -7
- package/src/core/schema-stored/index.ts +2 -0
- package/src/core/schema-stored/schema.ts +4 -1
- package/src/core/tree/anchorSet.ts +1 -3
- package/src/core/tree/delta.ts +9 -7
- package/src/core/tree/deltaUtil.ts +1 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +6 -4
- package/src/core/tree/visitDelta.ts +2 -2
- package/src/extensibleUnionNode.ts +177 -0
- package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +5 -11
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
- package/src/feature-libraries/default-schema/index.ts +0 -1
- package/src/feature-libraries/forest-summary/codec.ts +15 -9
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
- package/src/feature-libraries/forest-summary/formatCommon.ts +7 -6
- package/src/feature-libraries/forest-summary/formatV1.ts +1 -3
- package/src/feature-libraries/forest-summary/formatV2.ts +1 -3
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
- package/src/feature-libraries/index.ts +3 -2
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +4 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +12 -12
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
- package/src/feature-libraries/optional-field/optionalField.ts +1 -1
- package/src/feature-libraries/optional-field/requiredField.ts +2 -4
- package/src/feature-libraries/schema-index/codec.ts +7 -5
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
- package/src/feature-libraries/sequence-field/invert.ts +2 -2
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
- package/src/index.ts +14 -9
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +42 -6
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizingTreeView.ts +63 -18
- package/src/shared-tree/sharedTree.ts +19 -37
- package/src/shared-tree/sharedTreeChangeCodecs.ts +45 -11
- package/src/shared-tree/tree.ts +2 -2
- package/src/shared-tree/treeAlpha.ts +1 -1
- package/src/shared-tree/treeCheckout.ts +52 -7
- package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -7
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -10
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -10
- package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
- package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
- package/src/shared-tree-core/messageCodecs.ts +2 -6
- package/src/shared-tree-core/transaction.ts +125 -23
- package/src/shared-tree-core/versionedSummarizer.ts +3 -2
- package/src/simple-tree/api/index.ts +3 -2
- package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
- package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +344 -142
- package/src/simple-tree/api/transactionTypes.ts +10 -0
- package/src/simple-tree/api/tree.ts +89 -7
- package/src/simple-tree/api/treeBeta.ts +1 -1
- package/src/simple-tree/core/allowedTypes.ts +1 -1
- package/src/simple-tree/core/treeNodeSchema.ts +5 -8
- package/src/simple-tree/core/unhydratedFlexTree.ts +43 -1
- package/src/simple-tree/index.ts +5 -2
- package/src/simple-tree/leafNodeSchema.ts +3 -2
- package/src/simple-tree/node-kinds/array/arrayNode.ts +99 -19
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +2 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +51 -10
- package/src/tableSchema.ts +280 -140
- package/src/text/textDomainFormatted.ts +37 -17
- package/src/util/bTreeUtils.ts +55 -32
- package/src/util/brand.ts +4 -12
- package/src/util/brandedMap.ts +2 -6
- package/src/util/breakable.ts +3 -2
- package/src/util/index.ts +9 -3
- package/src/util/opaque.ts +2 -6
- package/src/util/rangeMap.ts +20 -11
- package/src/util/readSnapshotBlob.ts +3 -3
- package/src/util/typeCheck.ts +11 -9
- package/src/util/utils.ts +57 -28
- package/api-extractor-lint.json +0 -4
- package/biome.jsonc +0 -4
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, debugAssert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
8
8
|
import {
|
|
9
9
|
getConfigForMinVersionForCollabIterable,
|
|
10
|
-
|
|
10
|
+
lowestMinVersionForCollab,
|
|
11
11
|
type MinimumMinorSemanticVersion,
|
|
12
12
|
type SemanticVersion,
|
|
13
13
|
} from "@fluidframework/runtime-utils/internal";
|
|
@@ -27,9 +27,7 @@ import {
|
|
|
27
27
|
withSchemaValidation,
|
|
28
28
|
type FormatVersion,
|
|
29
29
|
type CodecWriteOptions,
|
|
30
|
-
type IMultiFormatCodec,
|
|
31
30
|
type CodecName,
|
|
32
|
-
ensureBinaryEncoding,
|
|
33
31
|
type CodecTree,
|
|
34
32
|
} from "../codec.js";
|
|
35
33
|
|
|
@@ -151,7 +149,7 @@ export function makeVersionDispatchingCodec<TDecoded, TContext>(
|
|
|
151
149
|
family: ICodecFamily<TDecoded, TContext>,
|
|
152
150
|
options: ICodecOptions & { writeVersion: FormatVersion },
|
|
153
151
|
): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {
|
|
154
|
-
const writeCodec = family.resolve(options.writeVersion)
|
|
152
|
+
const writeCodec = family.resolve(options.writeVersion);
|
|
155
153
|
const supportedVersions = new Set(family.getSupportedFormats());
|
|
156
154
|
return makeVersionedCodec(supportedVersions, options, {
|
|
157
155
|
encode(data, context): Versioned {
|
|
@@ -159,7 +157,7 @@ export function makeVersionDispatchingCodec<TDecoded, TContext>(
|
|
|
159
157
|
},
|
|
160
158
|
decode(data: Versioned, context) {
|
|
161
159
|
const codec = family.resolve(data.version);
|
|
162
|
-
return codec.
|
|
160
|
+
return codec.decode(data, context);
|
|
163
161
|
},
|
|
164
162
|
});
|
|
165
163
|
}
|
|
@@ -170,10 +168,9 @@ export function makeVersionDispatchingCodec<TDecoded, TContext>(
|
|
|
170
168
|
* The codec should not perform its own schema validation.
|
|
171
169
|
* The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.
|
|
172
170
|
*/
|
|
173
|
-
export type CodecAndSchema<TDecoded, TContext = void> = {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
);
|
|
171
|
+
export type CodecAndSchema<TDecoded, TContext = void> = {
|
|
172
|
+
readonly schema: TSchema;
|
|
173
|
+
} & IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TContext>;
|
|
177
174
|
|
|
178
175
|
/**
|
|
179
176
|
* A codec alongside its format version and schema.
|
|
@@ -182,6 +179,14 @@ export interface CodecVersionBase<
|
|
|
182
179
|
T = unknown,
|
|
183
180
|
TFormatVersion extends FormatVersion = FormatVersion,
|
|
184
181
|
> {
|
|
182
|
+
/**
|
|
183
|
+
* When `undefined` the codec will never be selected as a write version except via override.
|
|
184
|
+
* @remarks
|
|
185
|
+
* This format will be used for decode if data in it needs to be decoded, regardless of `minVersionForCollab`.
|
|
186
|
+
* `undefined` should be used for unstable codec versions (with string FormatVersions),
|
|
187
|
+
* as well as previously stabilized formats that are discontinued (meaning we always prefer to use some other format for encoding).
|
|
188
|
+
*/
|
|
189
|
+
readonly minVersionForCollab: MinimumVersionForCollab | undefined;
|
|
185
190
|
readonly formatVersion: TFormatVersion;
|
|
186
191
|
readonly codec: T;
|
|
187
192
|
}
|
|
@@ -228,11 +233,8 @@ export interface NormalizedCodecVersion<
|
|
|
228
233
|
* @remarks
|
|
229
234
|
* Produced by {@link ClientVersionDispatchingCodecBuilder.applyOptions}.
|
|
230
235
|
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
TContext,
|
|
234
|
-
TFormatVersion extends FormatVersion,
|
|
235
|
-
> extends CodecVersionBase<
|
|
236
|
+
interface EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion extends FormatVersion>
|
|
237
|
+
extends CodecVersionBase<
|
|
236
238
|
IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TContext>,
|
|
237
239
|
TFormatVersion
|
|
238
240
|
> {}
|
|
@@ -258,17 +260,16 @@ function normalizeCodecVersion<
|
|
|
258
260
|
options: TBuildOptions,
|
|
259
261
|
): IJsonCodec<TDecoded, VersionedJson, JsonCompatibleReadOnly, TContext> => {
|
|
260
262
|
const built = codecBuilder(options);
|
|
261
|
-
// We currently don't expose or use binary formats, but someday we might.
|
|
262
|
-
const multiFormat = ensureBinaryEncoding<TDecoded, TContext, VersionedJson>(built);
|
|
263
263
|
return makeVersionedValidatedCodec(
|
|
264
264
|
options,
|
|
265
265
|
new Set([codecVersion.formatVersion]),
|
|
266
266
|
built.schema,
|
|
267
|
-
|
|
267
|
+
built,
|
|
268
268
|
);
|
|
269
269
|
};
|
|
270
270
|
|
|
271
271
|
return {
|
|
272
|
+
minVersionForCollab: codecVersion.minVersionForCollab,
|
|
272
273
|
formatVersion: codecVersion.formatVersion,
|
|
273
274
|
codec,
|
|
274
275
|
};
|
|
@@ -287,13 +288,20 @@ export class ClientVersionDispatchingCodecBuilder<
|
|
|
287
288
|
TFormatVersion extends FormatVersion,
|
|
288
289
|
TBuildOptions extends CodecWriteOptions,
|
|
289
290
|
> {
|
|
290
|
-
public readonly registry:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
public readonly registry: readonly NormalizedCodecVersion<
|
|
292
|
+
TDecoded,
|
|
293
|
+
TContext,
|
|
294
|
+
TFormatVersion,
|
|
295
|
+
TBuildOptions
|
|
296
|
+
>[];
|
|
294
297
|
|
|
295
298
|
/**
|
|
296
299
|
* Use {@link ClientVersionDispatchingCodecBuilder.build} to create an instance of this class.
|
|
300
|
+
* @remarks
|
|
301
|
+
* Inputs to this are assumed to be constants in the code controlled by the developers of this package,
|
|
302
|
+
* and constructed at least once during tests.
|
|
303
|
+
* Because of this, the validation of these inputs done with debugAssert should be sufficient,
|
|
304
|
+
* and using debugAssert avoids bloating the bundle size for production users.
|
|
297
305
|
*/
|
|
298
306
|
private constructor(
|
|
299
307
|
/**
|
|
@@ -303,9 +311,7 @@ export class ClientVersionDispatchingCodecBuilder<
|
|
|
303
311
|
/**
|
|
304
312
|
* The registry of codecs which this builder can use to encode and decode data.
|
|
305
313
|
*/
|
|
306
|
-
inputRegistry:
|
|
307
|
-
CodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions>
|
|
308
|
-
>,
|
|
314
|
+
inputRegistry: readonly CodecVersion<TDecoded, TContext, TFormatVersion, TBuildOptions>[],
|
|
309
315
|
) {
|
|
310
316
|
type Normalized = NormalizedCodecVersion<
|
|
311
317
|
TDecoded,
|
|
@@ -313,18 +319,41 @@ export class ClientVersionDispatchingCodecBuilder<
|
|
|
313
319
|
TFormatVersion,
|
|
314
320
|
TBuildOptions
|
|
315
321
|
>;
|
|
316
|
-
const normalizedRegistry =
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
const normalizedRegistry: Normalized[] = [];
|
|
323
|
+
const formats: Set<FormatVersion> = new Set();
|
|
324
|
+
const versions: Set<string | undefined> = new Set();
|
|
325
|
+
|
|
326
|
+
for (const codec of inputRegistry) {
|
|
327
|
+
debugAssert(
|
|
328
|
+
() =>
|
|
329
|
+
!formats.has(codec.formatVersion) ||
|
|
330
|
+
`duplicate codec format ${name} ${codec.formatVersion}`,
|
|
331
|
+
);
|
|
332
|
+
debugAssert(
|
|
333
|
+
() =>
|
|
334
|
+
codec.minVersionForCollab === undefined ||
|
|
335
|
+
typeof codec.formatVersion !== "string" ||
|
|
336
|
+
`unstable format ${JSON.stringify(codec.formatVersion)} (string formats) must not have a minVersionForCollab in ${name}`,
|
|
337
|
+
);
|
|
338
|
+
formats.add(codec.formatVersion);
|
|
324
339
|
const normalizedCodec = normalizeCodecVersion(codec);
|
|
325
|
-
normalizedRegistry.
|
|
340
|
+
normalizedRegistry.push(normalizedCodec);
|
|
341
|
+
if (codec.minVersionForCollab !== undefined) {
|
|
342
|
+
debugAssert(
|
|
343
|
+
() =>
|
|
344
|
+
!versions.has(codec.minVersionForCollab) ||
|
|
345
|
+
`Codec ${name} has multiple entries for version ${JSON.stringify(codec.minVersionForCollab)}`,
|
|
346
|
+
);
|
|
347
|
+
versions.add(codec.minVersionForCollab);
|
|
348
|
+
}
|
|
326
349
|
}
|
|
327
350
|
|
|
351
|
+
debugAssert(
|
|
352
|
+
() =>
|
|
353
|
+
versions.has(lowestMinVersionForCollab) ||
|
|
354
|
+
`Codec ${name} is missing entry for lowestMinVersionForCollab`,
|
|
355
|
+
);
|
|
356
|
+
|
|
328
357
|
this.registry = normalizedRegistry;
|
|
329
358
|
}
|
|
330
359
|
|
|
@@ -336,18 +365,12 @@ export class ClientVersionDispatchingCodecBuilder<
|
|
|
336
365
|
*/
|
|
337
366
|
public applyOptions(
|
|
338
367
|
options: TBuildOptions,
|
|
339
|
-
):
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
{
|
|
346
|
-
formatVersion: codec.formatVersion,
|
|
347
|
-
codec: codec.codec(options),
|
|
348
|
-
},
|
|
349
|
-
] as const,
|
|
350
|
-
);
|
|
368
|
+
): EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion>[] {
|
|
369
|
+
return this.registry.map((codec) => ({
|
|
370
|
+
minVersionForCollab: codec.minVersionForCollab,
|
|
371
|
+
formatVersion: codec.formatVersion,
|
|
372
|
+
codec: codec.codec(options),
|
|
373
|
+
}));
|
|
351
374
|
}
|
|
352
375
|
|
|
353
376
|
/**
|
|
@@ -361,7 +384,7 @@ export class ClientVersionDispatchingCodecBuilder<
|
|
|
361
384
|
const fromFormatVersion = new Map<
|
|
362
385
|
FormatVersion,
|
|
363
386
|
EvaluatedCodecVersion<TDecoded, TContext, TFormatVersion>
|
|
364
|
-
>(applied.map((
|
|
387
|
+
>(applied.map((codec) => [codec.formatVersion, codec]));
|
|
365
388
|
return {
|
|
366
389
|
encode: (data: TDecoded, context: TContext): JsonCompatibleReadOnly => {
|
|
367
390
|
return writeVersion.codec.encode(data, context);
|
|
@@ -382,7 +405,7 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
382
405
|
|
|
383
406
|
public getCodecTree(clientVersion: MinimumVersionForCollab): CodecTree {
|
|
384
407
|
// TODO: add support for children codecs.
|
|
385
|
-
const selected =
|
|
408
|
+
const selected = getWriteVersionNoOverrides(this.registry, clientVersion);
|
|
386
409
|
return {
|
|
387
410
|
name: this.name,
|
|
388
411
|
version: selected.formatVersion,
|
|
@@ -400,31 +423,33 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
400
423
|
public static build<
|
|
401
424
|
Name extends CodecName,
|
|
402
425
|
Entry extends CodecVersion<unknown, unknown, FormatVersion, never>,
|
|
403
|
-
>(name: Name, inputRegistry:
|
|
404
|
-
type TDecoded2 =
|
|
405
|
-
? D
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
: never;
|
|
410
|
-
type
|
|
411
|
-
?
|
|
412
|
-
|
|
413
|
-
type
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
>(name: Name, inputRegistry: readonly Entry[]) {
|
|
427
|
+
type TDecoded2 =
|
|
428
|
+
Entry extends CodecVersion<infer D, unknown, FormatVersion, never> ? D : never;
|
|
429
|
+
type TContext2 =
|
|
430
|
+
Entry extends CodecVersion<unknown, infer C, FormatVersion, never> ? C : never;
|
|
431
|
+
type TFormatVersion2 =
|
|
432
|
+
Entry extends CodecVersion<unknown, unknown, infer F, never> ? F : never;
|
|
433
|
+
type TBuildOptions2 =
|
|
434
|
+
Entry extends CodecVersion<unknown, unknown, FormatVersion, infer B> ? B : never;
|
|
435
|
+
|
|
436
|
+
type CodecFinal = CodecVersion<
|
|
437
|
+
TDecoded2,
|
|
438
|
+
// If it does not matter what context is provided, undefined is fine, so allow it to be omitted.
|
|
439
|
+
unknown extends TContext2 ? void : TContext2,
|
|
440
|
+
TFormatVersion2,
|
|
441
|
+
TBuildOptions2
|
|
442
|
+
>;
|
|
443
|
+
|
|
444
|
+
const input = inputRegistry as readonly unknown[] as readonly CodecFinal[];
|
|
445
|
+
|
|
446
|
+
const builder = new ClientVersionDispatchingCodecBuilder<
|
|
447
|
+
Name,
|
|
448
|
+
TDecoded2,
|
|
449
|
+
unknown extends TContext2 ? void : TContext2,
|
|
450
|
+
TFormatVersion2,
|
|
451
|
+
TBuildOptions2
|
|
452
|
+
>(name, input);
|
|
428
453
|
return builder;
|
|
429
454
|
}
|
|
430
455
|
}
|
|
@@ -437,39 +462,51 @@ The client which encoded this data likely specified an "minVersionForCollab" val
|
|
|
437
462
|
function getWriteVersion<T extends CodecVersionBase>(
|
|
438
463
|
name: CodecName,
|
|
439
464
|
options: CodecWriteOptions,
|
|
440
|
-
versions: readonly
|
|
465
|
+
versions: readonly T[],
|
|
441
466
|
): T {
|
|
442
467
|
if (options.writeVersionOverrides?.has(name) === true) {
|
|
443
468
|
const selectedFormatVersion = options.writeVersionOverrides.get(name);
|
|
444
|
-
const selected = versions.find(
|
|
445
|
-
([_v, codec]) => codec.formatVersion === selectedFormatVersion,
|
|
446
|
-
);
|
|
469
|
+
const selected = versions.find((codec) => codec.formatVersion === selectedFormatVersion);
|
|
447
470
|
if (selected === undefined) {
|
|
448
471
|
throw new UsageError(
|
|
449
|
-
`Codec "${name}" does not support requested format version ${selectedFormatVersion}. Supported versions are: ${versionList(versions)}.`,
|
|
472
|
+
`Codec "${name}" does not support requested format version ${JSON.stringify(selectedFormatVersion)}. Supported versions are: ${versionList(versions)}.`,
|
|
450
473
|
);
|
|
451
474
|
} else if (options.allowPossiblyIncompatibleWriteVersionOverrides !== true) {
|
|
452
|
-
const selectedMinVersionForCollab = selected
|
|
453
|
-
// Currently all versions must specify a minVersionForCollab, so undefined is not expected here.
|
|
454
|
-
// TODO: It should be possible to have a version which would never be automatically selected for write (and thus does not have or need a minVersionForCollab), but can be selected via override.
|
|
455
|
-
// Use-cases for this include experimental versions not yet stable, and discontinued or intermediate versions which are mainly being kept for read compatibility but still support writing (perhaps for round-trip testing).
|
|
456
|
-
// For now, this check should never pass, and there is no way to create such a version yet.
|
|
475
|
+
const selectedMinVersionForCollab = selected.minVersionForCollab;
|
|
457
476
|
if (selectedMinVersionForCollab === undefined) {
|
|
458
477
|
throw new UsageError(
|
|
459
|
-
`Codec "${name}" does not support requested format version ${selectedFormatVersion} because it
|
|
478
|
+
`Codec "${name}" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it has minVersionForCollab undefined. Use "allowPossiblyIncompatibleWriteVersionOverrides" to suppress this error if appropriate.`,
|
|
460
479
|
);
|
|
461
480
|
} else if (gt(selectedMinVersionForCollab, options.minVersionForCollab)) {
|
|
462
481
|
throw new UsageError(
|
|
463
|
-
`Codec "${name}" does not support requested format version ${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.`,
|
|
482
|
+
`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.`,
|
|
464
483
|
);
|
|
465
484
|
}
|
|
466
485
|
}
|
|
467
486
|
|
|
468
|
-
return selected
|
|
487
|
+
return selected;
|
|
469
488
|
}
|
|
489
|
+
|
|
490
|
+
return getWriteVersionNoOverrides(versions, options.minVersionForCollab);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Selects which format should be used when writing data, without consider overrides.
|
|
495
|
+
*/
|
|
496
|
+
function getWriteVersionNoOverrides<T extends CodecVersionBase>(
|
|
497
|
+
versions: readonly T[],
|
|
498
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
499
|
+
): T {
|
|
500
|
+
const stableVersions: [MinimumMinorSemanticVersion | MinimumVersionForCollab, T][] = [];
|
|
501
|
+
for (const version of versions) {
|
|
502
|
+
if (version.minVersionForCollab !== undefined) {
|
|
503
|
+
stableVersions.push([version.minVersionForCollab, version]);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
470
507
|
const result: T = getConfigForMinVersionForCollabIterable(
|
|
471
|
-
|
|
472
|
-
|
|
508
|
+
minVersionForCollab,
|
|
509
|
+
stableVersions,
|
|
473
510
|
);
|
|
474
511
|
return result;
|
|
475
512
|
}
|
|
@@ -477,11 +514,6 @@ function getWriteVersion<T extends CodecVersionBase>(
|
|
|
477
514
|
/**
|
|
478
515
|
* Formats a list of versions for use in UsageErrors.
|
|
479
516
|
*/
|
|
480
|
-
function versionList(
|
|
481
|
-
versions
|
|
482
|
-
MinimumMinorSemanticVersion | MinimumVersionForCollab,
|
|
483
|
-
CodecVersionBase,
|
|
484
|
-
][],
|
|
485
|
-
): string {
|
|
486
|
-
return `${Array.from(versions, ([_v, codec]) => codec.formatVersion).join(", ")}`;
|
|
517
|
+
function versionList(versions: readonly CodecVersionBase[]): string {
|
|
518
|
+
return JSON.stringify(Array.from(versions, (codec) => codec.formatVersion));
|
|
487
519
|
}
|
package/src/core/index.ts
CHANGED
|
@@ -212,7 +212,9 @@ export {
|
|
|
212
212
|
isAncestor,
|
|
213
213
|
type ChangeAtomIdRangeMap,
|
|
214
214
|
newChangeAtomIdRangeMap,
|
|
215
|
-
|
|
215
|
+
comparePartialRevisions,
|
|
216
|
+
compareChangesetLocalIds,
|
|
217
|
+
comparePartialChangesetLocalIds,
|
|
216
218
|
diffHistories,
|
|
217
219
|
type RevisionReplacer,
|
|
218
220
|
} from "./rebase/index.js";
|
|
@@ -121,13 +121,14 @@ export interface RevisionReplacer {
|
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* Returns the updated ID for the given ID.
|
|
124
|
-
* @param id - The ID to update.
|
|
124
|
+
* @param id - The ID of the first change atom to update.
|
|
125
|
+
* @param count - The number of contiguous change atoms to update. Defaults to 1.
|
|
125
126
|
* @returns an updated ID iff the given `id` needs updating, otherwise returns the given `id`.
|
|
126
127
|
* @remarks
|
|
127
128
|
* This function always maps the same input {@link ChangeAtomId.revision | revision} and {@link ChangeAtomId.localId | local ID} to the same output revision local ID.
|
|
128
129
|
* This means multiple references to the same atom of change will remain consistent after revision replacement.
|
|
129
130
|
*/
|
|
130
|
-
getUpdatedAtomId<T extends ChangeAtomId>(id: T): T;
|
|
131
|
+
getUpdatedAtomId<T extends ChangeAtomId>(id: T, count?: number): T;
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
export interface TaggedChange<TChangeset, TTag = RevisionTag | undefined> {
|
package/src/core/rebase/index.ts
CHANGED
|
@@ -31,7 +31,9 @@ export {
|
|
|
31
31
|
subtractChangeAtomIds,
|
|
32
32
|
type ChangeAtomIdRangeMap,
|
|
33
33
|
newChangeAtomIdRangeMap,
|
|
34
|
-
|
|
34
|
+
comparePartialRevisions,
|
|
35
|
+
compareChangesetLocalIds,
|
|
36
|
+
comparePartialChangesetLocalIds,
|
|
35
37
|
} from "./types.js";
|
|
36
38
|
export { RevisionTagCodec } from "./revisionTagCodec.js";
|
|
37
39
|
export {
|
package/src/core/rebase/types.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
brand,
|
|
20
20
|
brandedNumberType,
|
|
21
21
|
brandedStringType,
|
|
22
|
+
comparePartialStrings,
|
|
22
23
|
} from "../../util/index.js";
|
|
23
24
|
import type { RevertibleAlpha } from "../revertible.js";
|
|
24
25
|
|
|
@@ -46,6 +47,9 @@ export const StableIdSchema = Type.String();
|
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* An ID which is unique within a revision of a `ModularChangeset`.
|
|
50
|
+
* @remarks
|
|
51
|
+
* Always a real number (never `NaN` or +/- `Infinity`).
|
|
52
|
+
*
|
|
49
53
|
* A `ModularChangeset` which is a composition of multiple revisions may contain duplicate `ChangesetLocalId`s,
|
|
50
54
|
* but they are unique when qualified by the revision of the change they are used in.
|
|
51
55
|
*/
|
|
@@ -122,10 +126,30 @@ export function taggedOptAtomId(
|
|
|
122
126
|
return taggedAtomId(id, revision);
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
export function offsetChangeAtomId(id:
|
|
129
|
+
export function offsetChangeAtomId<T extends ChangeAtomId>(id: T, offset: number): T {
|
|
126
130
|
return { ...id, localId: brand(id.localId + offset) };
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
// #region These comparison functions are used instead of e.g. `compareNumbers` as a performance optimization
|
|
134
|
+
|
|
135
|
+
export function compareChangesetLocalIds(a: ChangesetLocalId, b: ChangesetLocalId): number {
|
|
136
|
+
return a - b; // No need to consider `NaN` or `Infinity` since ChangesetLocalId is always a real number
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function comparePartialChangesetLocalIds(
|
|
140
|
+
a: ChangesetLocalId | undefined,
|
|
141
|
+
b: ChangesetLocalId | undefined,
|
|
142
|
+
): number {
|
|
143
|
+
if (a === undefined) {
|
|
144
|
+
return b === undefined ? 0 : -1;
|
|
145
|
+
} else if (b === undefined) {
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
return compareChangesetLocalIds(a, b);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// #endregion
|
|
152
|
+
|
|
129
153
|
/**
|
|
130
154
|
* A node in a graph of commits. A commit's parent is the commit on which it was based.
|
|
131
155
|
*/
|
|
@@ -204,6 +228,12 @@ export interface LocalChangeMetadata extends CommitMetadata {
|
|
|
204
228
|
getRevertible(
|
|
205
229
|
onDisposed?: (revertible: RevertibleAlpha) => void,
|
|
206
230
|
): RevertibleAlpha | undefined;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Optional label provided by the user when commit was created.
|
|
234
|
+
* This can be used by undo/redo to group or classify edits.
|
|
235
|
+
*/
|
|
236
|
+
readonly label?: unknown;
|
|
207
237
|
}
|
|
208
238
|
|
|
209
239
|
/**
|
|
@@ -225,6 +255,11 @@ export interface RemoteChangeMetadata extends CommitMetadata {
|
|
|
225
255
|
* @remarks This is only available for {@link LocalChangeMetadata | local changes}.
|
|
226
256
|
*/
|
|
227
257
|
readonly getRevertible?: undefined;
|
|
258
|
+
/**
|
|
259
|
+
* Label provided by the user when commit was created.
|
|
260
|
+
* @remarks This is only available for {@link LocalChangeMetadata | local changes}.
|
|
261
|
+
*/
|
|
262
|
+
readonly label?: undefined;
|
|
228
263
|
}
|
|
229
264
|
|
|
230
265
|
/**
|
|
@@ -255,12 +290,14 @@ export function mintCommit<TChange>(
|
|
|
255
290
|
|
|
256
291
|
export type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;
|
|
257
292
|
|
|
258
|
-
export function newChangeAtomIdRangeMap<V>(
|
|
259
|
-
|
|
293
|
+
export function newChangeAtomIdRangeMap<V>(
|
|
294
|
+
offsetValue?: (value: V, offset: number) => V,
|
|
295
|
+
): ChangeAtomIdRangeMap<V> {
|
|
296
|
+
return new RangeMap(offsetChangeAtomId, subtractChangeAtomIds, offsetValue);
|
|
260
297
|
}
|
|
261
298
|
|
|
262
299
|
export function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {
|
|
263
|
-
const cmp =
|
|
300
|
+
const cmp = comparePartialRevisions(a.revision, b.revision);
|
|
264
301
|
if (cmp !== 0) {
|
|
265
302
|
return cmp * Number.POSITIVE_INFINITY;
|
|
266
303
|
}
|
|
@@ -268,19 +305,20 @@ export function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number
|
|
|
268
305
|
return a.localId - b.localId;
|
|
269
306
|
}
|
|
270
307
|
|
|
271
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Compares two {@link RevisionTag}s to form a strict total ordering.
|
|
310
|
+
* @remarks This function tolerates arbitrary strings, not just the string "root".
|
|
311
|
+
* It sorts as follows: `undefined` \< `string` \< `number`
|
|
312
|
+
*/
|
|
313
|
+
export function comparePartialRevisions(
|
|
272
314
|
a: RevisionTag | undefined,
|
|
273
315
|
b: RevisionTag | undefined,
|
|
274
316
|
): number {
|
|
275
|
-
if (a ===
|
|
276
|
-
return b ===
|
|
277
|
-
} else if (b ===
|
|
278
|
-
return 1;
|
|
279
|
-
} else if (a < b) {
|
|
317
|
+
if (typeof a === "number") {
|
|
318
|
+
return typeof b === "number" ? a - b : 1;
|
|
319
|
+
} else if (typeof b === "number") {
|
|
280
320
|
return -1;
|
|
281
|
-
} else if (a > b) {
|
|
282
|
-
return 1;
|
|
283
321
|
}
|
|
284
322
|
|
|
285
|
-
return
|
|
323
|
+
return comparePartialStrings(a, b);
|
|
286
324
|
}
|
|
@@ -52,6 +52,7 @@ const FieldSchemaFormatBase = Type.Object({
|
|
|
52
52
|
|
|
53
53
|
const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
54
54
|
|
|
55
|
+
export type FieldSchemaFormat = Static<typeof FieldSchemaFormat>;
|
|
55
56
|
export const FieldSchemaFormat = Type.Composite([FieldSchemaFormatBase], noAdditionalProps);
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -70,6 +71,7 @@ export enum PersistedValueSchema {
|
|
|
70
71
|
*
|
|
71
72
|
* See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
|
|
72
73
|
*/
|
|
74
|
+
export type TreeNodeSchemaDataFormat = Static<typeof TreeNodeSchemaDataFormat>;
|
|
73
75
|
export const TreeNodeSchemaDataFormat = Type.Object(
|
|
74
76
|
{
|
|
75
77
|
/**
|
|
@@ -87,7 +89,3 @@ export const TreeNodeSchemaDataFormat = Type.Object(
|
|
|
87
89
|
},
|
|
88
90
|
unionOptions,
|
|
89
91
|
);
|
|
90
|
-
|
|
91
|
-
export type TreeNodeSchemaDataFormat = Static<typeof TreeNodeSchemaDataFormat>;
|
|
92
|
-
|
|
93
|
-
export type FieldSchemaFormat = Static<typeof FieldSchemaFormat>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
8
|
import { unionOptions } from "../../codec/index.js";
|
|
9
|
+
import type { JsonCompatibleReadOnlyObject } from "../../util/index.js";
|
|
9
10
|
import { JsonCompatibleReadOnlySchema } from "../../util/index.js";
|
|
10
11
|
|
|
11
12
|
import {
|
|
@@ -14,7 +15,12 @@ import {
|
|
|
14
15
|
TreeNodeSchemaIdentifierSchema,
|
|
15
16
|
} from "./formatV1.js";
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
+
export type PersistedMetadataFormat = Static<typeof PersistedMetadataFormat>;
|
|
19
|
+
export const PersistedMetadataFormat = Type.Optional(
|
|
20
|
+
Type.Unsafe<JsonCompatibleReadOnlyObject>(
|
|
21
|
+
Type.Record(Type.String(), JsonCompatibleReadOnlySchema),
|
|
22
|
+
),
|
|
23
|
+
);
|
|
18
24
|
|
|
19
25
|
const FieldSchemaFormatBase = Type.Object({
|
|
20
26
|
kind: FieldKindIdentifierSchema,
|
|
@@ -24,6 +30,7 @@ const FieldSchemaFormatBase = Type.Object({
|
|
|
24
30
|
|
|
25
31
|
const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
26
32
|
|
|
33
|
+
export type FieldSchemaFormat = Static<typeof FieldSchemaFormat>;
|
|
27
34
|
export const FieldSchemaFormat = Type.Composite([FieldSchemaFormatBase], noAdditionalProps);
|
|
28
35
|
|
|
29
36
|
/**
|
|
@@ -56,6 +63,7 @@ export type TreeNodeSchemaUnionFormat = Static<typeof TreeNodeSchemaUnionFormat>
|
|
|
56
63
|
*
|
|
57
64
|
* See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
|
|
58
65
|
*/
|
|
66
|
+
export type TreeNodeSchemaDataFormat = Static<typeof TreeNodeSchemaDataFormat>;
|
|
59
67
|
export const TreeNodeSchemaDataFormat = Type.Object(
|
|
60
68
|
{
|
|
61
69
|
/**
|
|
@@ -71,9 +79,3 @@ export const TreeNodeSchemaDataFormat = Type.Object(
|
|
|
71
79
|
},
|
|
72
80
|
noAdditionalProps,
|
|
73
81
|
);
|
|
74
|
-
|
|
75
|
-
export type TreeNodeSchemaDataFormat = Static<typeof TreeNodeSchemaDataFormat>;
|
|
76
|
-
|
|
77
|
-
export type FieldSchemaFormat = Static<typeof FieldSchemaFormat>;
|
|
78
|
-
|
|
79
|
-
export type PersistedMetadataFormat = Static<typeof PersistedMetadataFormat>;
|
|
@@ -37,6 +37,8 @@ export { Multiplicity } from "./multiplicity.js";
|
|
|
37
37
|
export type { TreeNodeSchemaIdentifier, FieldKey, FieldKindIdentifier } from "./formatV1.js";
|
|
38
38
|
|
|
39
39
|
import * as schemaFormatV1 from "./formatV1.js";
|
|
40
|
+
// eslint-disable-next-line unicorn/prefer-export-from -- fixing requires `export * as` (breaks API-Extractor) or named exports (changes public API)
|
|
40
41
|
export { schemaFormatV1 };
|
|
41
42
|
import * as schemaFormatV2 from "./formatV2.js";
|
|
43
|
+
// eslint-disable-next-line unicorn/prefer-export-from -- fixing requires `export * as` (breaks API-Extractor) or named exports (changes public API)
|
|
42
44
|
export { schemaFormatV2 };
|
|
@@ -253,7 +253,10 @@ export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
253
253
|
private encodeFieldsObject(
|
|
254
254
|
encodeFieldSchema: (storedFieldSchema: TreeFieldStoredSchema) => FieldSchemaFormat,
|
|
255
255
|
): Record<string, FieldSchemaFormat> {
|
|
256
|
-
const fieldsObject: Record<string, FieldSchemaFormat> = Object.create(null)
|
|
256
|
+
const fieldsObject: Record<string, FieldSchemaFormat> = Object.create(null) as Record<
|
|
257
|
+
string,
|
|
258
|
+
FieldSchemaFormat
|
|
259
|
+
>;
|
|
257
260
|
// Sort fields to ensure output is identical for for equivalent schema (since field order is not considered significant).
|
|
258
261
|
// This makes comparing schema easier, and ensures chunk reuse for schema summaries isn't needlessly broken.
|
|
259
262
|
for (const key of [...this.objectNodeFields.keys()].sort()) {
|
|
@@ -128,9 +128,7 @@ export interface AnchorEvents {
|
|
|
128
128
|
*
|
|
129
129
|
* Compare to {@link AnchorEvents.childrenChanged} which is emitted in the middle of the batch/delta-visit.
|
|
130
130
|
*/
|
|
131
|
-
childrenChangedAfterBatch(arg: {
|
|
132
|
-
changedFields: ReadonlySet<FieldKey>;
|
|
133
|
-
}): void;
|
|
131
|
+
childrenChangedAfterBatch(arg: { changedFields: ReadonlySet<FieldKey> }): void;
|
|
134
132
|
|
|
135
133
|
/**
|
|
136
134
|
* Emitted in the middle of applying a batch of changes (i.e. during a delta a visit), if something in the subtree
|
package/src/core/tree/delta.ts
CHANGED
|
@@ -196,10 +196,12 @@ export interface DetachedNodeRename {
|
|
|
196
196
|
readonly newId: DetachedNodeId;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
199
|
+
export interface FieldChanges {
|
|
200
|
+
/**
|
|
201
|
+
* Represents a list of changes to the nodes in the field.
|
|
202
|
+
* The index of each mark within the range of nodes, before
|
|
203
|
+
* applying any of the changes, is not represented explicitly.
|
|
204
|
+
* It corresponds to the sum of `mark.count` values for all previous marks for which `isAttachMark(mark)` is false.
|
|
205
|
+
*/
|
|
206
|
+
readonly marks: readonly Mark[];
|
|
207
|
+
}
|
|
@@ -20,7 +20,7 @@ export function deltaForRootInitialization(content: TreeChunk): Root {
|
|
|
20
20
|
const delta: Root = {
|
|
21
21
|
build: [{ id: buildId, trees: content }],
|
|
22
22
|
fields: new Map<FieldKey, FieldChanges>([
|
|
23
|
-
[rootFieldKey, [{ count: content.topLevelLength, attach: buildId }]],
|
|
23
|
+
[rootFieldKey, { marks: [{ count: content.topLevelLength, attach: buildId }] }],
|
|
24
24
|
]),
|
|
25
25
|
};
|
|
26
26
|
return delta;
|