@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
|
@@ -388,6 +388,14 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
388
388
|
|
|
389
389
|
private editLock: EditLock;
|
|
390
390
|
|
|
391
|
+
/**
|
|
392
|
+
* User-defined label associated with the transaction whose commit is currently being produced for this checkout.
|
|
393
|
+
*
|
|
394
|
+
* @remarks
|
|
395
|
+
* This label is used to implement {@link TreeCheckout.runWithTransactionLabel}.
|
|
396
|
+
*/
|
|
397
|
+
private transactionLabel?: unknown;
|
|
398
|
+
|
|
391
399
|
private readonly views = new Set<TreeView<ImplicitFieldSchema>>();
|
|
392
400
|
|
|
393
401
|
/**
|
|
@@ -439,6 +447,34 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
439
447
|
this.registerForBranchEvents();
|
|
440
448
|
}
|
|
441
449
|
|
|
450
|
+
/**
|
|
451
|
+
* Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.
|
|
452
|
+
*
|
|
453
|
+
* @remarks
|
|
454
|
+
* The label is stored during the execution of the function and will be included in the {@link ChangeMetadata} of the transaction.
|
|
455
|
+
*
|
|
456
|
+
* Labels supplied to nested transactions are ignored - only the outermost transaction label is ever used.
|
|
457
|
+
*
|
|
458
|
+
* @param fn - The function to execute. It receives the user provided transaction label as an optional parameter.
|
|
459
|
+
* @param label - The label to associate with the outermost transaction.
|
|
460
|
+
* @returns The result of executing `fn`.
|
|
461
|
+
*/
|
|
462
|
+
public runWithTransactionLabel<TLabel, TResult>(
|
|
463
|
+
fn: (label?: TLabel) => TResult,
|
|
464
|
+
label: TLabel | undefined,
|
|
465
|
+
): TResult {
|
|
466
|
+
// If a transaction label is already set, nesting is occurring, so we should not override it.
|
|
467
|
+
if (this.transactionLabel !== undefined) {
|
|
468
|
+
return fn(this.transactionLabel as TLabel);
|
|
469
|
+
}
|
|
470
|
+
this.transactionLabel = label;
|
|
471
|
+
try {
|
|
472
|
+
return fn(this.transactionLabel as TLabel);
|
|
473
|
+
} finally {
|
|
474
|
+
this.transactionLabel = undefined;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
442
478
|
public get removedRoots(): ReadOnlyDetachedFieldIndex {
|
|
443
479
|
return this._removedRoots;
|
|
444
480
|
}
|
|
@@ -464,16 +500,23 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
464
500
|
: undefined;
|
|
465
501
|
// When each transaction is started, make a restorable checkpoint of the current state of removed roots
|
|
466
502
|
const restoreRemovedRoots = this._removedRoots.createCheckpoint();
|
|
467
|
-
return (result) => {
|
|
503
|
+
return (result, viewUpdate: SharedTreeChange | undefined) => {
|
|
504
|
+
const newHead = this.#transaction.branch.getHead();
|
|
468
505
|
switch (result) {
|
|
469
506
|
case TransactionResult.Abort: {
|
|
470
507
|
restoreRemovedRoots();
|
|
508
|
+
if (viewUpdate !== undefined) {
|
|
509
|
+
this.applyChange(viewUpdate, newHead.revision);
|
|
510
|
+
}
|
|
471
511
|
break;
|
|
472
512
|
}
|
|
473
513
|
case TransactionResult.Commit: {
|
|
514
|
+
if (viewUpdate !== undefined) {
|
|
515
|
+
this.applyChange(viewUpdate, newHead.revision);
|
|
516
|
+
}
|
|
474
517
|
if (!this.transaction.isInProgress()) {
|
|
475
518
|
// The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.
|
|
476
|
-
this.validateCommit(
|
|
519
|
+
this.validateCommit(newHead);
|
|
477
520
|
}
|
|
478
521
|
break;
|
|
479
522
|
}
|
|
@@ -554,9 +597,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
554
597
|
originatorId: this.idCompressor.localSessionId,
|
|
555
598
|
revision,
|
|
556
599
|
};
|
|
557
|
-
const encodedChange = this.changeFamily.codecs
|
|
558
|
-
.resolve(4)
|
|
559
|
-
.json.encode(change, context);
|
|
600
|
+
const encodedChange = this.changeFamily.codecs.resolve(4).encode(change, context);
|
|
560
601
|
|
|
561
602
|
assert(
|
|
562
603
|
commit.parent !== undefined,
|
|
@@ -570,6 +611,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
570
611
|
} satisfies SerializedChange;
|
|
571
612
|
},
|
|
572
613
|
getRevertible: (onDisposed) => getRevertible?.(onDisposed),
|
|
614
|
+
label: this.transactionLabel,
|
|
573
615
|
};
|
|
574
616
|
|
|
575
617
|
this.#events.emit("changed", metadata, getRevertible);
|
|
@@ -577,7 +619,10 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
577
619
|
}
|
|
578
620
|
} else if (this.isRemoteChangeEvent(event)) {
|
|
579
621
|
// TODO: figure out how to plumb through commit kind info for remote changes
|
|
580
|
-
this.#events.emit("changed", {
|
|
622
|
+
this.#events.emit("changed", {
|
|
623
|
+
isLocal: false,
|
|
624
|
+
kind: CommitKind.Default,
|
|
625
|
+
});
|
|
581
626
|
}
|
|
582
627
|
};
|
|
583
628
|
|
|
@@ -619,7 +664,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
619
664
|
originatorId: this.idCompressor.localSessionId,
|
|
620
665
|
revision,
|
|
621
666
|
};
|
|
622
|
-
const decodedChange = this.changeFamily.codecs.resolve(4).
|
|
667
|
+
const decodedChange = this.changeFamily.codecs.resolve(4).decode(change, context);
|
|
623
668
|
this.applyChange(decodedChange, revision);
|
|
624
669
|
}
|
|
625
670
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
8
8
|
|
|
9
|
-
import type { IJsonCodec
|
|
9
|
+
import type { IJsonCodec } from "../codec/index.js";
|
|
10
10
|
import type {
|
|
11
11
|
ChangeEncodingContext,
|
|
12
12
|
EncodedRevisionTag,
|
|
@@ -32,7 +32,7 @@ export interface EditManagerEncodingContext {
|
|
|
32
32
|
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
34
34
|
function encodeCommit<TChangeset, T extends Commit<TChangeset>>(
|
|
35
|
-
changeCodec:
|
|
35
|
+
changeCodec: IJsonCodec<
|
|
36
36
|
TChangeset,
|
|
37
37
|
JsonCompatibleReadOnly,
|
|
38
38
|
JsonCompatibleReadOnly,
|
|
@@ -54,13 +54,13 @@ function encodeCommit<TChangeset, T extends Commit<TChangeset>>(
|
|
|
54
54
|
idCompressor: context.idCompressor,
|
|
55
55
|
revision: undefined,
|
|
56
56
|
}),
|
|
57
|
-
change: changeCodec.
|
|
57
|
+
change: changeCodec.encode(commit.change, { ...context, revision: commit.revision }),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
62
62
|
function decodeCommit<TChangeset, T extends EncodedCommit<JsonCompatibleReadOnly>>(
|
|
63
|
-
changeCodec:
|
|
63
|
+
changeCodec: IJsonCodec<
|
|
64
64
|
TChangeset,
|
|
65
65
|
JsonCompatibleReadOnly,
|
|
66
66
|
JsonCompatibleReadOnly,
|
|
@@ -84,12 +84,12 @@ function decodeCommit<TChangeset, T extends EncodedCommit<JsonCompatibleReadOnly
|
|
|
84
84
|
return {
|
|
85
85
|
...commit,
|
|
86
86
|
revision,
|
|
87
|
-
change: changeCodec.
|
|
87
|
+
change: changeCodec.decode(commit.change, { ...context, revision }),
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export function encodeSharedBranch<TChangeset>(
|
|
92
|
-
changeCodec:
|
|
92
|
+
changeCodec: IJsonCodec<
|
|
93
93
|
TChangeset,
|
|
94
94
|
JsonCompatibleReadOnly,
|
|
95
95
|
JsonCompatibleReadOnly,
|
|
@@ -160,7 +160,7 @@ export function encodeSharedBranch<TChangeset>(
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export function decodeSharedBranch<TChangeset>(
|
|
163
|
-
changeCodec:
|
|
163
|
+
changeCodec: IJsonCodec<
|
|
164
164
|
TChangeset,
|
|
165
165
|
JsonCompatibleReadOnly,
|
|
166
166
|
JsonCompatibleReadOnly,
|
|
@@ -5,12 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
type ICodecOptions,
|
|
10
|
-
type IJsonCodec,
|
|
11
|
-
type IMultiFormatCodec,
|
|
12
|
-
withSchemaValidation,
|
|
13
|
-
} from "../codec/index.js";
|
|
8
|
+
import { type ICodecOptions, type IJsonCodec, withSchemaValidation } from "../codec/index.js";
|
|
14
9
|
import type {
|
|
15
10
|
ChangeEncodingContext,
|
|
16
11
|
EncodedRevisionTag,
|
|
@@ -29,7 +24,7 @@ export interface EditManagerEncodingContext {
|
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
export function makeV1CodecWithVersion<TChangeset>(
|
|
32
|
-
changeCodec:
|
|
27
|
+
changeCodec: IJsonCodec<
|
|
33
28
|
TChangeset,
|
|
34
29
|
JsonCompatibleReadOnly,
|
|
35
30
|
JsonCompatibleReadOnly,
|
|
@@ -49,9 +44,7 @@ export function makeV1CodecWithVersion<TChangeset>(
|
|
|
49
44
|
JsonCompatibleReadOnly,
|
|
50
45
|
EditManagerEncodingContext
|
|
51
46
|
> {
|
|
52
|
-
const format = EncodedEditManager(
|
|
53
|
-
changeCodec.json.encodedSchema ?? JsonCompatibleReadOnlySchema,
|
|
54
|
-
);
|
|
47
|
+
const format = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);
|
|
55
48
|
|
|
56
49
|
const codec: IJsonCodec<
|
|
57
50
|
SummaryData<TChangeset>,
|
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
type ICodecOptions,
|
|
11
|
-
type IJsonCodec,
|
|
12
|
-
type IMultiFormatCodec,
|
|
13
|
-
withSchemaValidation,
|
|
14
|
-
} from "../codec/index.js";
|
|
9
|
+
import { type ICodecOptions, type IJsonCodec, withSchemaValidation } from "../codec/index.js";
|
|
15
10
|
import type {
|
|
16
11
|
ChangeEncodingContext,
|
|
17
12
|
EncodedRevisionTag,
|
|
@@ -36,7 +31,7 @@ export interface EditManagerEncodingContext {
|
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
39
|
-
changeCodec:
|
|
34
|
+
changeCodec: IJsonCodec<
|
|
40
35
|
TChangeset,
|
|
41
36
|
JsonCompatibleReadOnly,
|
|
42
37
|
JsonCompatibleReadOnly,
|
|
@@ -56,9 +51,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
|
56
51
|
JsonCompatibleReadOnly,
|
|
57
52
|
EditManagerEncodingContext
|
|
58
53
|
> {
|
|
59
|
-
const format = EncodedEditManager(
|
|
60
|
-
changeCodec.json.encodedSchema ?? JsonCompatibleReadOnlySchema,
|
|
61
|
-
);
|
|
54
|
+
const format = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);
|
|
62
55
|
|
|
63
56
|
const codec: IJsonCodec<
|
|
64
57
|
SummaryData<TChangeset>,
|
|
@@ -126,7 +126,7 @@ export class EditManagerSummarizer<TChangeset>
|
|
|
126
126
|
0x42c /* There should not already be stored EditManager data when loading from summary */,
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
-
const summary = parse(bufferToString(schemaBuffer, "
|
|
129
|
+
const summary = parse(bufferToString(schemaBuffer, "utf8")) as JsonCompatibleReadOnly;
|
|
130
130
|
const data = this.codec.decode(summary, { idCompressor: this.idCompressor });
|
|
131
131
|
this.editManager.loadSummaryData(data);
|
|
132
132
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import {
|
|
7
|
+
import type { TAnySchema } from "@sinclair/typebox";
|
|
8
8
|
|
|
9
9
|
import { type ICodecOptions, type IJsonCodec, withSchemaValidation } from "../codec/index.js";
|
|
10
10
|
import type {
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
RevisionTag,
|
|
15
15
|
} from "../core/index.js";
|
|
16
16
|
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
17
|
+
import { JsonCompatibleReadOnlySchema } from "../util/index.js";
|
|
17
18
|
|
|
18
19
|
import type { MessageEncodingContext } from "./messageCodecs.js";
|
|
19
20
|
import type { MessageFormatVersion } from "./messageFormat.js";
|
|
@@ -43,12 +44,12 @@ export function makeV1ToV4CodecWithVersion<TChangeset>(
|
|
|
43
44
|
> {
|
|
44
45
|
return withSchemaValidation<
|
|
45
46
|
DecodedMessage<TChangeset>,
|
|
46
|
-
TAnySchema,
|
|
47
|
+
TAnySchema | typeof JsonCompatibleReadOnlySchema,
|
|
47
48
|
JsonCompatibleReadOnly,
|
|
48
49
|
JsonCompatibleReadOnly,
|
|
49
50
|
MessageEncodingContext
|
|
50
51
|
>(
|
|
51
|
-
Message(changeCodec.encodedSchema ??
|
|
52
|
+
Message(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema),
|
|
52
53
|
{
|
|
53
54
|
encode: (decoded: DecodedMessage<TChangeset>, context: MessageEncodingContext) => {
|
|
54
55
|
assert(decoded.type === "commit", 0xc68 /* Only commit messages are supported */);
|
|
@@ -146,9 +146,7 @@ export function makeMessageCodecs<TChangeset>(
|
|
|
146
146
|
case unbrand(MessageFormatVersion.v3):
|
|
147
147
|
case unbrand(MessageFormatVersion.v4):
|
|
148
148
|
case unbrand(MessageFormatVersion.v6): {
|
|
149
|
-
const changeCodec = changeCodecs.resolve(
|
|
150
|
-
dependentChangeFormatVersion.lookup(version),
|
|
151
|
-
).json;
|
|
149
|
+
const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));
|
|
152
150
|
return [
|
|
153
151
|
version,
|
|
154
152
|
makeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version),
|
|
@@ -158,9 +156,7 @@ export function makeMessageCodecs<TChangeset>(
|
|
|
158
156
|
return [version, makeDiscontinuedCodecVersion(options, version, "2.74.0")];
|
|
159
157
|
}
|
|
160
158
|
case unbrand(MessageFormatVersion.vSharedBranches): {
|
|
161
|
-
const changeCodec = changeCodecs.resolve(
|
|
162
|
-
dependentChangeFormatVersion.lookup(version),
|
|
163
|
-
).json;
|
|
159
|
+
const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version));
|
|
164
160
|
return [
|
|
165
161
|
version,
|
|
166
162
|
makeSharedBranchesCodecWithVersion(changeCodec, revisionTagCodec, options, version),
|
|
@@ -9,13 +9,17 @@ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
|
9
9
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
+
diffHistories,
|
|
12
13
|
findAncestor,
|
|
14
|
+
findCommonAncestor,
|
|
15
|
+
mintCommit,
|
|
16
|
+
rebaseBranch,
|
|
13
17
|
tagChange,
|
|
14
18
|
type ChangeFamilyEditor,
|
|
15
19
|
type GraphCommit,
|
|
16
20
|
type RevisionTag,
|
|
17
21
|
} from "../core/index.js";
|
|
18
|
-
import { getLast, getOrCreate
|
|
22
|
+
import { getLast, getOrCreate } from "../util/index.js";
|
|
19
23
|
|
|
20
24
|
import type { SharedTreeBranch, SharedTreeBranchEvents } from "./branch.js";
|
|
21
25
|
|
|
@@ -42,6 +46,8 @@ export interface Transactor {
|
|
|
42
46
|
* Start a new transaction.
|
|
43
47
|
* If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
|
|
44
48
|
* i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
|
|
49
|
+
* @param isAsync - Whether the transaction is asynchronous.
|
|
50
|
+
* An error will be thrown if an asynchronous transaction is started while a synchronous transaction is in progress.
|
|
45
51
|
*
|
|
46
52
|
* @remarks Asynchronous transactions are not supported on the root checkout,
|
|
47
53
|
* since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate
|
|
@@ -55,7 +61,7 @@ export interface Transactor {
|
|
|
55
61
|
* @privateRemarks There is currently no enforcement that asynchronous transactions don't happen on the root checkout.
|
|
56
62
|
* AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.
|
|
57
63
|
*/
|
|
58
|
-
start(): void;
|
|
64
|
+
start(isAsync: boolean): void;
|
|
59
65
|
/**
|
|
60
66
|
* Close this transaction by squashing its edits and committing them as a single edit.
|
|
61
67
|
* If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
|
|
@@ -126,12 +132,22 @@ export type OnPush = () => Callbacks | void;
|
|
|
126
132
|
*/
|
|
127
133
|
export type OnPop = (result: TransactionResult) => void;
|
|
128
134
|
|
|
135
|
+
/**
|
|
136
|
+
* A frame in the transaction stack.
|
|
137
|
+
*/
|
|
138
|
+
interface TransactionStackFrame {
|
|
139
|
+
/** The callbacks provided when this transaction frame was pushed onto the stack. */
|
|
140
|
+
readonly callbacks: Callbacks;
|
|
141
|
+
/** Whether this transaction frame is asynchronous. */
|
|
142
|
+
readonly isAsync: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
129
145
|
/**
|
|
130
146
|
* An implementation of {@link Transactor} that uses a stack to manage transactions.
|
|
131
147
|
* @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.
|
|
132
148
|
*/
|
|
133
149
|
export class TransactionStack implements Transactor, IDisposable {
|
|
134
|
-
readonly #stack:
|
|
150
|
+
readonly #stack: TransactionStackFrame[] = [];
|
|
135
151
|
readonly #onPush?: OnPush;
|
|
136
152
|
|
|
137
153
|
readonly #events = createEmitter<TransactionEvents>();
|
|
@@ -157,11 +173,20 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
157
173
|
return this.#stack.length > 0;
|
|
158
174
|
}
|
|
159
175
|
|
|
160
|
-
public start(): void {
|
|
176
|
+
public start(isAsync: boolean): void {
|
|
161
177
|
this.ensureNotDisposed();
|
|
162
|
-
const
|
|
178
|
+
const last = getLast(this.#stack);
|
|
179
|
+
if (last !== undefined && !last.isAsync && isAsync) {
|
|
180
|
+
throw new UsageError(
|
|
181
|
+
"An asynchronous transaction cannot be started while a synchronous transaction is in progress.",
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;
|
|
163
185
|
const { onPush, onPop } = onPushCurrent?.() ?? {};
|
|
164
|
-
this.#stack.push({
|
|
186
|
+
this.#stack.push({
|
|
187
|
+
callbacks: { onPop, onPush: onPush ?? onPushCurrent },
|
|
188
|
+
isAsync,
|
|
189
|
+
});
|
|
165
190
|
this.#events.emit("started");
|
|
166
191
|
}
|
|
167
192
|
|
|
@@ -171,7 +196,7 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
171
196
|
throw new UsageError("No transaction to commit");
|
|
172
197
|
}
|
|
173
198
|
this.#events.emit("committing");
|
|
174
|
-
this.#stack.pop()?.onPop?.(TransactionResult.Commit);
|
|
199
|
+
this.#stack.pop()?.callbacks.onPop?.(TransactionResult.Commit);
|
|
175
200
|
}
|
|
176
201
|
|
|
177
202
|
public abort(): void {
|
|
@@ -180,7 +205,7 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
180
205
|
throw new UsageError("No transaction to abort");
|
|
181
206
|
}
|
|
182
207
|
this.#events.emit("aborting");
|
|
183
|
-
this.#stack.pop()?.onPop?.(TransactionResult.Abort);
|
|
208
|
+
this.#stack.pop()?.callbacks.onPop?.(TransactionResult.Abort);
|
|
184
209
|
}
|
|
185
210
|
|
|
186
211
|
public dispose(): void {
|
|
@@ -198,6 +223,19 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
198
223
|
}
|
|
199
224
|
}
|
|
200
225
|
|
|
226
|
+
/**
|
|
227
|
+
* A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.
|
|
228
|
+
* @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.isInProgress} will be false during its execution.
|
|
229
|
+
* @param result - The result of the transaction.
|
|
230
|
+
* @param viewUpdate - The change that needs to be applied to the view to keep it up-to-date with the branch after the transaction ends.
|
|
231
|
+
* This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.
|
|
232
|
+
* This will be `undefined` if no such change is necessary.
|
|
233
|
+
*/
|
|
234
|
+
export type OnPopWithViewUpdate<TChange> = (
|
|
235
|
+
result: TransactionResult,
|
|
236
|
+
viewUpdate: TChange | undefined,
|
|
237
|
+
) => void;
|
|
238
|
+
|
|
201
239
|
/**
|
|
202
240
|
* An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
|
|
203
241
|
* @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.
|
|
@@ -270,14 +308,14 @@ export class SquashingTransactionStack<
|
|
|
270
308
|
public constructor(
|
|
271
309
|
public readonly branch: SharedTreeBranch<TEditor, TChange>,
|
|
272
310
|
mintRevisionTag: () => RevisionTag,
|
|
273
|
-
onPush?: () =>
|
|
311
|
+
onPush?: () => OnPopWithViewUpdate<TChange> | void,
|
|
274
312
|
) {
|
|
275
313
|
super(
|
|
276
314
|
// Invoked when an outer transaction starts
|
|
277
315
|
(): Callbacks => {
|
|
278
316
|
// Keep track of the commit that each transaction was on when it started
|
|
279
|
-
// TODO:#8603: This may need to be computed differently if we allow rebasing during a transaction.
|
|
280
317
|
const startHead = this.activeBranch.getHead();
|
|
318
|
+
const rebaser = this.branch.changeFamily.rebaser;
|
|
281
319
|
const outerOnPop = onPush?.();
|
|
282
320
|
let transactionRevision: RevisionTag | undefined;
|
|
283
321
|
const transactionBranch = this.branch.fork(
|
|
@@ -287,33 +325,97 @@ export class SquashingTransactionStack<
|
|
|
287
325
|
);
|
|
288
326
|
this.setTransactionBranch(transactionBranch);
|
|
289
327
|
transactionBranch.editor.enterTransaction();
|
|
328
|
+
|
|
290
329
|
// Invoked when an outer transaction ends
|
|
291
330
|
const onOuterTransactionPop: OnPop = (result) => {
|
|
292
331
|
assert(!this.isInProgress(), 0xcae /* The outer transaction should be ending */);
|
|
293
332
|
transactionBranch.editor.exitTransaction();
|
|
333
|
+
|
|
334
|
+
const sourcePath: GraphCommit<TChange>[] = [];
|
|
335
|
+
const targetPath: GraphCommit<TChange>[] = [];
|
|
336
|
+
const ancestor = findCommonAncestor(
|
|
337
|
+
[startHead, sourcePath],
|
|
338
|
+
[branch.getHead(), targetPath],
|
|
339
|
+
);
|
|
340
|
+
assert(ancestor !== undefined, 0xcce /* branches must be related */);
|
|
341
|
+
|
|
342
|
+
const transactionSteps: GraphCommit<TChange>[] = [];
|
|
343
|
+
findAncestor(
|
|
344
|
+
[transactionBranch.getHead(), transactionSteps],
|
|
345
|
+
(c) => c === startHead,
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
let viewUpdate: TChange | undefined;
|
|
294
349
|
switch (result) {
|
|
295
350
|
case TransactionResult.Abort: {
|
|
296
|
-
// When a transaction is aborted, roll back all the transaction's changes on the current branch
|
|
351
|
+
// When a transaction is aborted, roll back all the transaction's changes on the current branch.
|
|
352
|
+
// It is important that this happens before and separately from updating the view because the `TreeCheckout` needs to
|
|
353
|
+
// revert some internal (state to match what it was before the transaction began) before applying the view update (if any).
|
|
297
354
|
transactionBranch.removeAfter(startHead);
|
|
355
|
+
// If changes were made on `branch` since the transaction began, the view will need to be updated to reflect those changes.
|
|
356
|
+
if (targetPath.length > 0) {
|
|
357
|
+
viewUpdate = diffHistories(
|
|
358
|
+
rebaser,
|
|
359
|
+
startHead,
|
|
360
|
+
this.branch.getHead(),
|
|
361
|
+
mintRevisionTag,
|
|
362
|
+
);
|
|
363
|
+
}
|
|
298
364
|
break;
|
|
299
365
|
}
|
|
300
366
|
case TransactionResult.Commit: {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (removedCommits.length > 0) {
|
|
308
|
-
for (const commit of removedCommits) {
|
|
367
|
+
if (transactionSteps.length > 0) {
|
|
368
|
+
assert(
|
|
369
|
+
transactionRevision !== undefined,
|
|
370
|
+
0xccf /* Expected transaction revision in the presence of transaction steps */,
|
|
371
|
+
);
|
|
372
|
+
for (const commit of transactionSteps) {
|
|
309
373
|
assert(
|
|
310
374
|
commit.revision === transactionRevision,
|
|
311
375
|
0xcaf /* Unexpected commit in transaction */,
|
|
312
376
|
);
|
|
313
377
|
}
|
|
314
|
-
|
|
315
|
-
|
|
378
|
+
// Squash all the new commits on the transaction branch into a new commit on the original branch
|
|
379
|
+
const squash = rebaser.compose(transactionSteps);
|
|
380
|
+
|
|
381
|
+
if (targetPath.length === 0) {
|
|
382
|
+
// No changes were made on the original branch since the transaction began
|
|
383
|
+
// The transaction commit can be applied directly
|
|
384
|
+
this.branch.apply(tagChange(squash, transactionRevision));
|
|
385
|
+
// The view is already up-to-date so there's nothing more to do
|
|
386
|
+
} else {
|
|
387
|
+
// Some changes were made on `branch` since the transaction began
|
|
388
|
+
const unrebasedHead = mintCommit(startHead, {
|
|
389
|
+
change: squash,
|
|
390
|
+
revision: transactionRevision,
|
|
391
|
+
});
|
|
392
|
+
// We need to rebase the transaction commit on top of the new changes
|
|
393
|
+
const rebased = rebaseBranch(
|
|
394
|
+
mintRevisionTag,
|
|
395
|
+
rebaser,
|
|
396
|
+
unrebasedHead,
|
|
397
|
+
branch.getHead(),
|
|
398
|
+
);
|
|
399
|
+
assert(
|
|
400
|
+
rebased.newSourceHead.revision === transactionRevision,
|
|
401
|
+
0xcd0 /* The transaction commit should be rebased to the tip */,
|
|
402
|
+
);
|
|
403
|
+
this.branch.apply(rebased.newSourceHead);
|
|
404
|
+
viewUpdate = rebased.sourceChange;
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
if (targetPath.length > 0) {
|
|
408
|
+
// Changes were made on `branch` since the transaction began.
|
|
409
|
+
// The view will need to be updated to reflect those changes.
|
|
410
|
+
viewUpdate = diffHistories(
|
|
411
|
+
rebaser,
|
|
412
|
+
startHead,
|
|
413
|
+
this.branch.getHead(),
|
|
414
|
+
mintRevisionTag,
|
|
415
|
+
);
|
|
416
|
+
}
|
|
316
417
|
}
|
|
418
|
+
|
|
317
419
|
break;
|
|
318
420
|
}
|
|
319
421
|
default: {
|
|
@@ -322,7 +424,7 @@ export class SquashingTransactionStack<
|
|
|
322
424
|
}
|
|
323
425
|
transactionBranch.dispose();
|
|
324
426
|
this.setTransactionBranch(undefined);
|
|
325
|
-
outerOnPop?.(result);
|
|
427
|
+
outerOnPop?.(result, viewUpdate);
|
|
326
428
|
};
|
|
327
429
|
// Invoked when a nested transaction begins
|
|
328
430
|
const onNestedTransactionPush: OnPush = () => {
|
|
@@ -346,7 +448,7 @@ export class SquashingTransactionStack<
|
|
|
346
448
|
unreachableCase(result);
|
|
347
449
|
}
|
|
348
450
|
}
|
|
349
|
-
nestedOuterOnPop?.(result);
|
|
451
|
+
nestedOuterOnPop?.(result, undefined);
|
|
350
452
|
},
|
|
351
453
|
};
|
|
352
454
|
};
|
|
@@ -99,11 +99,12 @@ export abstract class VersionedSummarizer<TVersion extends number> implements Su
|
|
|
99
99
|
): Promise<void> {
|
|
100
100
|
let version: TVersion | undefined;
|
|
101
101
|
if (await services.contains(summarizablesMetadataKey)) {
|
|
102
|
-
const metadata = await readAndParseSnapshotBlob
|
|
102
|
+
const metadata = (await readAndParseSnapshotBlob(
|
|
103
103
|
summarizablesMetadataKey,
|
|
104
104
|
services,
|
|
105
105
|
(contents) => parse(contents),
|
|
106
|
-
|
|
106
|
+
// TODO: this type cast should use a codec to validate the data instead of just type casting.
|
|
107
|
+
)) as SharedTreeSummarizableMetadata;
|
|
107
108
|
version = metadata.version as TVersion;
|
|
108
109
|
if (!this.supportedVersions.has(version)) {
|
|
109
110
|
throw new UsageError(`Cannot read version ${version} of shared tree summary.`);
|
|
@@ -53,6 +53,7 @@ export {
|
|
|
53
53
|
adaptEnum,
|
|
54
54
|
enumFromStrings,
|
|
55
55
|
singletonSchema,
|
|
56
|
+
createCustomizedFluidFrameworkScopedFactory,
|
|
56
57
|
} from "./schemaCreationUtilities.js";
|
|
57
58
|
export {
|
|
58
59
|
getIdentifierFromNode,
|
|
@@ -180,7 +181,7 @@ export {
|
|
|
180
181
|
exportCompatibilitySchemaSnapshot,
|
|
181
182
|
importCompatibilitySchemaSnapshot,
|
|
182
183
|
checkCompatibility,
|
|
183
|
-
|
|
184
|
+
snapshotSchemaCompatibility,
|
|
184
185
|
type SnapshotFileSystem,
|
|
185
|
-
type
|
|
186
|
+
type SnapshotSchemaCompatibilityOptions,
|
|
186
187
|
} from "./snapshotCompatibilityChecker.js";
|
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
} from "../core/index.js";
|
|
18
18
|
|
|
19
19
|
import type { SchemaFactory, ScopedSchemaName } from "./schemaFactory.js";
|
|
20
|
+
import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
|
|
20
21
|
|
|
21
22
|
/*
|
|
22
23
|
* This file does two things:
|
|
@@ -247,9 +248,8 @@ export function enumFromStrings<
|
|
|
247
248
|
type MembersUnion = Members[number];
|
|
248
249
|
|
|
249
250
|
// Get all keys of the Members tuple which are numeric strings as union of numbers:
|
|
250
|
-
type Indexes =
|
|
251
|
-
? N
|
|
252
|
-
: never;
|
|
251
|
+
type Indexes =
|
|
252
|
+
Extract<keyof Members, `${number}`> extends `${infer N extends number}` ? N : never;
|
|
253
253
|
|
|
254
254
|
type TOut = {
|
|
255
255
|
[Index in Indexes as Members[Index]]: ReturnType<
|
|
@@ -298,11 +298,11 @@ function _enumFromStrings2<TScope extends string, const Members extends readonly
|
|
|
298
298
|
factory: SchemaFactory<TScope>,
|
|
299
299
|
members: Members,
|
|
300
300
|
) {
|
|
301
|
-
const enumObject
|
|
301
|
+
const enumObject = Object.create(null) as {
|
|
302
302
|
[key in keyof Members as Members[key] extends string
|
|
303
303
|
? Members[key]
|
|
304
304
|
: string]: Members[key] extends string ? Members[key] : string;
|
|
305
|
-
}
|
|
305
|
+
};
|
|
306
306
|
for (const name of members) {
|
|
307
307
|
Object.defineProperty(enumObject, name, {
|
|
308
308
|
enumerable: true,
|
|
@@ -314,3 +314,33 @@ function _enumFromStrings2<TScope extends string, const Members extends readonly
|
|
|
314
314
|
|
|
315
315
|
return adaptEnum(factory, enumObject);
|
|
316
316
|
}
|
|
317
|
+
|
|
318
|
+
function createCustomizedScopedFactory<
|
|
319
|
+
TUserScope extends string,
|
|
320
|
+
TCreatorDomain extends string,
|
|
321
|
+
>(
|
|
322
|
+
inputSchemaFactory: SchemaFactoryBeta<TUserScope>,
|
|
323
|
+
creatorDomain: TCreatorDomain,
|
|
324
|
+
): SchemaFactoryBeta<`${TCreatorDomain}<${TUserScope}>`> {
|
|
325
|
+
return new SchemaFactoryBeta(`${creatorDomain}<${inputSchemaFactory.scope}>`);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Declare a SchemaFactory for use in cases where the Fluid Framework's code creates the schema and owns its schema compatibility (and thus scope)
|
|
330
|
+
* but it is parameterized by user provided data, the `TUserScope`.
|
|
331
|
+
* @remarks
|
|
332
|
+
* This should allow future logic in {@link generateSchemaFromSimpleSchema} to recognize these schema as ones defined by Fluid Framework,
|
|
333
|
+
* and special case them to provide better APIs and maintain data invariants.
|
|
334
|
+
*/
|
|
335
|
+
export function createCustomizedFluidFrameworkScopedFactory<
|
|
336
|
+
TUserScope extends string,
|
|
337
|
+
TCreatorDomain extends string,
|
|
338
|
+
>(
|
|
339
|
+
inputSchemaFactory: SchemaFactoryBeta<TUserScope>,
|
|
340
|
+
fluidDomainSuffix: TCreatorDomain,
|
|
341
|
+
): SchemaFactoryBeta<`com.fluidframework.${TCreatorDomain}<${TUserScope}>`> {
|
|
342
|
+
return createCustomizedScopedFactory(
|
|
343
|
+
inputSchemaFactory,
|
|
344
|
+
`com.fluidframework.${fluidDomainSuffix}` as const,
|
|
345
|
+
);
|
|
346
|
+
}
|
|
@@ -149,7 +149,7 @@ export function createSimpleTreeIndex<
|
|
|
149
149
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
150
150
|
indexableSchema?: readonly TreeNodeSchema[],
|
|
151
151
|
): SimpleTreeIndex<TKey, TValue> {
|
|
152
|
-
const indexableSchemaMap = new Map();
|
|
152
|
+
const indexableSchemaMap = new Map<string, TreeNodeSchema>();
|
|
153
153
|
if (indexableSchema === undefined) {
|
|
154
154
|
walkFieldSchema(view.schema, {
|
|
155
155
|
node: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),
|