@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
|
@@ -138,4 +138,14 @@ export interface RunTransactionParams {
|
|
|
138
138
|
* this client and ignored by all other clients.
|
|
139
139
|
*/
|
|
140
140
|
readonly preconditions?: readonly TransactionConstraintAlpha[];
|
|
141
|
+
/**
|
|
142
|
+
* A label for this transaction that allows it to be correlated with later edits (e.g. for controlling undo/redo grouping).
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* This label is associated with the commit produced by this transaction, and is surfaced through the
|
|
146
|
+
* `label` property of {@link ChangeMetadata} in the `commitApplied` or `changed` event.
|
|
147
|
+
*
|
|
148
|
+
* If there is a nested transaction, only the outermost transaction label will be used.
|
|
149
|
+
*/
|
|
150
|
+
readonly label?: unknown;
|
|
141
151
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces";
|
|
7
7
|
|
|
8
8
|
import type {
|
|
9
|
-
CommitMetadata,
|
|
10
9
|
ChangeMetadata,
|
|
10
|
+
CommitMetadata,
|
|
11
11
|
RevertibleAlphaFactory,
|
|
12
12
|
RevertibleFactory,
|
|
13
13
|
} from "../../core/index.js";
|
|
@@ -211,7 +211,7 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
211
211
|
fork(): TreeBranchAlpha;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
214
|
+
* Run a synchronous transaction which applies one or more edits to the tree as a single atomic unit.
|
|
215
215
|
* @param transaction - The function to run as the body of the transaction.
|
|
216
216
|
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
217
217
|
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
@@ -236,19 +236,20 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
236
236
|
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
237
237
|
*
|
|
238
238
|
* Nested transactions:
|
|
239
|
-
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
239
|
+
* This API can be called from within the transaction callback of another `runTransaction` or `runTransactionAsync` call. That will have slightly different behavior:
|
|
240
240
|
*
|
|
241
241
|
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
242
242
|
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
243
243
|
* for the outermost transaction which includes all inner transactions.
|
|
244
244
|
* - Undo will undo the outermost transaction and all inner transactions.
|
|
245
|
+
* - If a label is provided in the params, only the label for the outermost transaction will be used. All other labels will be ignored.
|
|
245
246
|
*/
|
|
246
247
|
runTransaction<TSuccessValue, TFailureValue>(
|
|
247
248
|
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
248
249
|
params?: RunTransactionParams,
|
|
249
250
|
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
250
251
|
/**
|
|
251
|
-
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
252
|
+
* Run a synchronous transaction which applies one or more edits to the tree as a single atomic unit.
|
|
252
253
|
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
253
254
|
*
|
|
254
255
|
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
@@ -273,7 +274,7 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
273
274
|
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
274
275
|
*
|
|
275
276
|
* Nested transactions:
|
|
276
|
-
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
277
|
+
* This API can be called from within the transaction callback of another `runTransaction` or `runTransactionAsync` call. That will have slightly different behavior:
|
|
277
278
|
*
|
|
278
279
|
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
279
280
|
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
@@ -285,6 +286,87 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
285
286
|
params?: RunTransactionParams,
|
|
286
287
|
): TransactionResult;
|
|
287
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Run an asynchronous transaction which applies one or more edits to the tree as a single atomic unit.
|
|
291
|
+
* @param transaction - The function to run as the body of the transaction.
|
|
292
|
+
* It should return a promise that resolves to a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
293
|
+
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
294
|
+
* abort the transaction and discard any changes it made so far.
|
|
295
|
+
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
296
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
297
|
+
* @returns A promise that resolves to a result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
298
|
+
*
|
|
299
|
+
* - A "success" flag indicating whether the transaction was successful or not.
|
|
300
|
+
* - The success or failure value as returned by the transaction function.
|
|
301
|
+
*
|
|
302
|
+
* The promise will reject if the constraints are not met or something unexpected happens.
|
|
303
|
+
*
|
|
304
|
+
* @remarks
|
|
305
|
+
* As with synchronous transactions, using an asynchronous transaction has the following consequences:
|
|
306
|
+
* - All of the changes in the transaction are treated as a unit, therefore no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.
|
|
307
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
308
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
309
|
+
*
|
|
310
|
+
* Unlike with synchronous transactions, using an asynchronous transaction has the following consequences:
|
|
311
|
+
* - It is possible that other changes (either from this client by merging a branch or from a remote client) may be applied to the branch while this transaction is in progress.
|
|
312
|
+
* These other changes will be not be reflected on the branch until after this transaction completes,
|
|
313
|
+
* at which point the transaction changes will be applied after these other changes.
|
|
314
|
+
*
|
|
315
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
316
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
317
|
+
*
|
|
318
|
+
* Nested transactions:
|
|
319
|
+
* This API can be called from within the transaction callback of another `runTransactionAsync` call. That will have slightly different behavior:
|
|
320
|
+
*
|
|
321
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
322
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
323
|
+
* for the outermost transaction which includes all inner transactions.
|
|
324
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
325
|
+
*/
|
|
326
|
+
runTransactionAsync<TSuccessValue, TFailureValue>(
|
|
327
|
+
transaction: () => Promise<TransactionCallbackStatus<TSuccessValue, TFailureValue>>,
|
|
328
|
+
params?: RunTransactionParams,
|
|
329
|
+
): Promise<TransactionResultExt<TSuccessValue, TFailureValue>>;
|
|
330
|
+
/**
|
|
331
|
+
* Run an asynchronous transaction which applies one or more edits to the tree as a single atomic unit.
|
|
332
|
+
* @param transaction - The function to run as the body of the transaction. It must return a promise that can resolve to any of the following:
|
|
333
|
+
*
|
|
334
|
+
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
335
|
+
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
336
|
+
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
337
|
+
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
338
|
+
*
|
|
339
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
340
|
+
* @returns A promise that resolves to a result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
341
|
+
* transaction was successful or not. The promise will reject if the constraints are not met or something unexpected happens.
|
|
342
|
+
*
|
|
343
|
+
* @remarks
|
|
344
|
+
* As with synchronous transactions, using an asynchronous transaction has the following consequences:
|
|
345
|
+
* - All of the changes in the transaction are treated as a unit, therefore no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.
|
|
346
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
347
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
348
|
+
*
|
|
349
|
+
* Unlike with synchronous transactions, using an asynchronous transaction has the following consequences:
|
|
350
|
+
* - It is possible that other changes (either from this client by merging a branch or from a remote client) may be applied to the branch while this transaction is in progress.
|
|
351
|
+
* These other changes will be not be reflected on the branch until after this transaction completes,
|
|
352
|
+
* at which point the transaction changes will be applied after these other changes.
|
|
353
|
+
*
|
|
354
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
355
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
356
|
+
*
|
|
357
|
+
* Nested transactions:
|
|
358
|
+
* This API can be called from within the transaction callback of another `runTransactionAsync` call. That will have slightly different behavior:
|
|
359
|
+
*
|
|
360
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
361
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
362
|
+
* for the outermost transaction which includes all inner transactions.
|
|
363
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
364
|
+
*/
|
|
365
|
+
runTransactionAsync(
|
|
366
|
+
transaction: () => Promise<VoidTransactionCallbackStatus | void>,
|
|
367
|
+
params?: RunTransactionParams,
|
|
368
|
+
): Promise<TransactionResult>;
|
|
369
|
+
|
|
288
370
|
/**
|
|
289
371
|
* Apply a serialized change to this branch.
|
|
290
372
|
* @param change - the change to apply.
|
|
@@ -343,7 +425,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
343
425
|
* @remarks
|
|
344
426
|
* {@link TreeViewEvents.schemaChanged} is fired when the compatibility status changes.
|
|
345
427
|
* See {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution/ | schema-evolution} for more guidance on how to change schema while maintaining compatibility.
|
|
346
|
-
* Use {@link
|
|
428
|
+
* Use {@link snapshotSchemaCompatibility} to write tests to validate that this compatibility behaves as desired across schema changes.
|
|
347
429
|
*/
|
|
348
430
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
349
431
|
|
|
@@ -544,7 +626,7 @@ export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied">
|
|
|
544
626
|
* @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,
|
|
545
627
|
* this commit is not revertible.
|
|
546
628
|
*/
|
|
547
|
-
commitApplied(data:
|
|
629
|
+
commitApplied(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;
|
|
548
630
|
}
|
|
549
631
|
|
|
550
632
|
/**
|
|
@@ -120,7 +120,7 @@ export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode>
|
|
|
120
120
|
* Extensions to {@link (Tree:interface)} which are not yet stable.
|
|
121
121
|
* @remarks
|
|
122
122
|
* Use via the {@link (TreeBeta:variable)} singleton.
|
|
123
|
-
* @
|
|
123
|
+
* @sealed @beta
|
|
124
124
|
*/
|
|
125
125
|
export interface TreeBeta {
|
|
126
126
|
/**
|
|
@@ -650,7 +650,7 @@ export type TreeNodeFromImplicitAllowedTypes<
|
|
|
650
650
|
* This type exists only to be linked from documentation to provide a single linkable place to document some details of
|
|
651
651
|
* "Input" types and how they handle schema.
|
|
652
652
|
*
|
|
653
|
-
* When a schema is used to describe data which is an input into an API, the API is {@link https://en.wikipedia.org/wiki/Type_variance | contravariant}
|
|
653
|
+
* When a schema is used to describe data which is an input into an API, the API is {@link https://en.wikipedia.org/wiki/Type_variance | contravariant} over the schema.
|
|
654
654
|
* (See also {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations | TypeScript Variance Annotations}).
|
|
655
655
|
*
|
|
656
656
|
* Since these schema are expressed using TypeScript types, it is possible for the user of the API to provide non-exact values of these types which has implications that depended on the variance.
|
|
@@ -575,15 +575,12 @@ export function isTreeNodeSchemaClass<
|
|
|
575
575
|
* If a schema is both TreeNodeSchemaClass and TreeNodeSchemaNonClass, prefer TreeNodeSchemaClass since that includes subclasses properly.
|
|
576
576
|
* @public
|
|
577
577
|
*/
|
|
578
|
-
export type NodeFromSchema<T extends TreeNodeSchema> =
|
|
579
|
-
string,
|
|
580
|
-
NodeKind,
|
|
581
|
-
infer TNode
|
|
582
|
-
>
|
|
583
|
-
? TNode
|
|
584
|
-
: T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode>
|
|
578
|
+
export type NodeFromSchema<T extends TreeNodeSchema> =
|
|
579
|
+
T extends TreeNodeSchemaClass<string, NodeKind, infer TNode>
|
|
585
580
|
? TNode
|
|
586
|
-
:
|
|
581
|
+
: T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode>
|
|
582
|
+
? TNode
|
|
583
|
+
: never;
|
|
587
584
|
|
|
588
585
|
/**
|
|
589
586
|
* Data which can be used as a node to be inserted.
|
|
@@ -59,7 +59,22 @@ import type { Context } from "./context.js";
|
|
|
59
59
|
import type { TreeNode } from "./treeNode.js";
|
|
60
60
|
|
|
61
61
|
interface UnhydratedTreeSequenceFieldEditBuilder
|
|
62
|
-
extends SequenceFieldEditBuilder<FlexibleFieldContent, UnhydratedFlexTreeNode[]> {
|
|
62
|
+
extends SequenceFieldEditBuilder<FlexibleFieldContent, UnhydratedFlexTreeNode[]> {
|
|
63
|
+
/**
|
|
64
|
+
* Moves elements from a source position to a destination position.
|
|
65
|
+
* Can move within the same field or from another unhydrated sequence field.
|
|
66
|
+
* @param sourceIndex - The index of the first element to move.
|
|
67
|
+
* @param count - The number of elements to move.
|
|
68
|
+
* @param destIndex - The index at which to insert the moved elements.
|
|
69
|
+
* @param source - The source field to move from (defaults to this field for within-field moves).
|
|
70
|
+
*/
|
|
71
|
+
move(
|
|
72
|
+
sourceIndex: number,
|
|
73
|
+
count: number,
|
|
74
|
+
destIndex: number,
|
|
75
|
+
source?: UnhydratedSequenceField,
|
|
76
|
+
): void;
|
|
77
|
+
}
|
|
63
78
|
|
|
64
79
|
type UnhydratedFlexTreeNodeEvents = Pick<
|
|
65
80
|
AnchorEvents,
|
|
@@ -543,6 +558,33 @@ export class UnhydratedSequenceField
|
|
|
543
558
|
});
|
|
544
559
|
return removed ?? fail(0xb4a /* Expected removed to be set by edit */);
|
|
545
560
|
},
|
|
561
|
+
move: (sourceIndex, count, destIndex, source?): void => {
|
|
562
|
+
const sourceField = source ?? this;
|
|
563
|
+
if (sourceField === this) {
|
|
564
|
+
// Within-field move: do both operations in a single edit to emit only one event
|
|
565
|
+
this.edit((mapTrees) => {
|
|
566
|
+
const removed = mapTrees.splice(sourceIndex, count);
|
|
567
|
+
// Adjust destination index if it comes after the source
|
|
568
|
+
const adjustedDest = destIndex > sourceIndex ? destIndex - count : destIndex;
|
|
569
|
+
if (removed.length < 1000) {
|
|
570
|
+
// For "smallish arrays" (`1000` is not empirically derived), the `splice` function is appropriate...
|
|
571
|
+
mapTrees.splice(adjustedDest, 0, ...removed);
|
|
572
|
+
} else {
|
|
573
|
+
// ...but we avoid using `splice` + spread for very large arrays since there is a limit on how many elements can be spread (too many will overflow the stack).
|
|
574
|
+
return [
|
|
575
|
+
...mapTrees.slice(0, adjustedDest),
|
|
576
|
+
...removed,
|
|
577
|
+
...mapTrees.slice(adjustedDest),
|
|
578
|
+
];
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
} else {
|
|
582
|
+
// Cross-field move: remove from source, insert into destination
|
|
583
|
+
// Each field emits one event (correct behavior for different fields)
|
|
584
|
+
const removed = sourceField.editor.remove(sourceIndex, count);
|
|
585
|
+
this.editor.insert(destIndex, removed);
|
|
586
|
+
}
|
|
587
|
+
},
|
|
546
588
|
} satisfies UnhydratedTreeSequenceFieldEditBuilder;
|
|
547
589
|
|
|
548
590
|
public at(index: number): FlexTreeUnknownUnboxed | undefined {
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -197,9 +197,10 @@ export {
|
|
|
197
197
|
checkCompatibility,
|
|
198
198
|
eraseSchemaDetails,
|
|
199
199
|
eraseSchemaDetailsSubclassable,
|
|
200
|
-
|
|
200
|
+
snapshotSchemaCompatibility,
|
|
201
201
|
type SnapshotFileSystem,
|
|
202
|
-
type
|
|
202
|
+
type SnapshotSchemaCompatibilityOptions,
|
|
203
|
+
createCustomizedFluidFrameworkScopedFactory,
|
|
203
204
|
} from "./api/index.js";
|
|
204
205
|
export type {
|
|
205
206
|
SimpleTreeSchema,
|
|
@@ -266,6 +267,8 @@ export {
|
|
|
266
267
|
type RecordNodePojoEmulationSchema,
|
|
267
268
|
RecordNodeSchema,
|
|
268
269
|
type TreeRecordNode,
|
|
270
|
+
type ArrayPlaceAnchor,
|
|
271
|
+
createArrayInsertionAnchor,
|
|
269
272
|
} from "./node-kinds/index.js";
|
|
270
273
|
export {
|
|
271
274
|
unhydratedFlexTreeFromInsertable,
|
|
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
8
8
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
|
|
10
|
-
import { type TreeValue, ValueSchema } from "../core/index.js";
|
|
10
|
+
import { type FieldKey, type TreeValue, ValueSchema } from "../core/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type FlexTreeNode,
|
|
13
13
|
isFlexTreeNode,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
type TreeNodeSchemaInitializedData,
|
|
29
29
|
CompatibilityLevel,
|
|
30
30
|
type FlexContent,
|
|
31
|
+
type UnhydratedFlexTreeField,
|
|
31
32
|
} from "./core/index.js";
|
|
32
33
|
import { getTreeNodeSchemaInitializedData } from "./createContext.js";
|
|
33
34
|
import type { SimpleLeafNodeSchema } from "./simpleSchema.js";
|
|
@@ -185,7 +186,7 @@ export function leafToFlexContent(
|
|
|
185
186
|
value: mappedValue,
|
|
186
187
|
type: brand(mappedSchema.identifier),
|
|
187
188
|
},
|
|
188
|
-
new Map(),
|
|
189
|
+
new Map<FieldKey, UnhydratedFlexTreeField>(),
|
|
189
190
|
];
|
|
190
191
|
|
|
191
192
|
return result;
|
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
createTreeNodeSchemaPrivateData,
|
|
53
53
|
type FlexContent,
|
|
54
54
|
type TreeNodeSchemaPrivateData,
|
|
55
|
-
withBufferedTreeEvents,
|
|
56
55
|
AnnotatedAllowedTypesInternal,
|
|
57
56
|
} from "../../core/index.js";
|
|
58
57
|
import {
|
|
@@ -128,6 +127,19 @@ export interface TreeArrayNode<
|
|
|
128
127
|
*/
|
|
129
128
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
130
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Inserts new item(s) at the end of the array.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* The order of the inserted items relative to other concurrently inserted items at the same location is only partially specified:
|
|
135
|
+
* Concurrently inserting `[A, B]` and `[X, Y]` at the same location may yield
|
|
136
|
+
* either `[A, B, X, Y]` or `[X, Y, A, B]`, regardless of the order in which those edits are sequenced.
|
|
137
|
+
* No other interleavings are possible. (e.g. `[A, X, B, Y]` is not possible.)
|
|
138
|
+
*
|
|
139
|
+
* @param value - The content to insert.
|
|
140
|
+
*/
|
|
141
|
+
push(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
142
|
+
|
|
131
143
|
/**
|
|
132
144
|
* Removes the item at the specified location.
|
|
133
145
|
* @param index - The index at which to remove the item.
|
|
@@ -966,6 +978,9 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
966
978
|
public insertAtEnd(...value: Insertable<T>): void {
|
|
967
979
|
this.insertAt(this.length, ...value);
|
|
968
980
|
}
|
|
981
|
+
public push(...value: Insertable<T>): void {
|
|
982
|
+
this.insertAt(this.length, ...value);
|
|
983
|
+
}
|
|
969
984
|
public removeAt(index: number): void {
|
|
970
985
|
const field = getSequenceField(this);
|
|
971
986
|
validateIndex(index, field, "TreeArrayNode.removeAt");
|
|
@@ -1105,24 +1120,19 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
1105
1120
|
);
|
|
1106
1121
|
}
|
|
1107
1122
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
destinationGap - movedCount,
|
|
1122
|
-
sourceField.editor.remove(sourceStart, movedCount),
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
|
-
});
|
|
1123
|
+
assert(
|
|
1124
|
+
destinationField instanceof UnhydratedSequenceField,
|
|
1125
|
+
0xcd5 /* destinationField should be unhydrated since we're in the else branch of isHydrated() check */,
|
|
1126
|
+
);
|
|
1127
|
+
|
|
1128
|
+
// Use native move which handles the operation atomically for within-field moves
|
|
1129
|
+
// to ensure only a single event is emitted per affected field.
|
|
1130
|
+
destinationField.editor.move(
|
|
1131
|
+
sourceStart,
|
|
1132
|
+
movedCount,
|
|
1133
|
+
destinationGap,
|
|
1134
|
+
sourceField === destinationField ? undefined : sourceField,
|
|
1135
|
+
);
|
|
1126
1136
|
}
|
|
1127
1137
|
}
|
|
1128
1138
|
|
|
@@ -1389,3 +1399,73 @@ function shallowCompatibilityTest(
|
|
|
1389
1399
|
|
|
1390
1400
|
return CompatibilityLevel.None;
|
|
1391
1401
|
}
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* A location in a {@link (TreeArrayNode:interface)}.
|
|
1405
|
+
* @remarks
|
|
1406
|
+
* Tracks a location even as the array is mutated.
|
|
1407
|
+
* How this is adjusted for edits depends on the specific anchor being used.
|
|
1408
|
+
* See {@link createArrayInsertionAnchor} for one way to create such an anchor.
|
|
1409
|
+
* @privateRemarks
|
|
1410
|
+
* This being sealed is not important for its current behaviors as nothing downcasts this,
|
|
1411
|
+
* however it is possible we might want to add additional members in the future:
|
|
1412
|
+
* sealing this ensures that such additions are a non-breaking change.
|
|
1413
|
+
* Things we might want to add include status (for example if its deleted) or events (for example to notify when its index changes).
|
|
1414
|
+
* Some specific anchors might even want to add additional method members for things like confidence
|
|
1415
|
+
* (so we can indicate when the anchor goes from being truly robust to a heuristic guess due to an edit).
|
|
1416
|
+
* @alpha
|
|
1417
|
+
* @sealed
|
|
1418
|
+
*/
|
|
1419
|
+
export interface ArrayPlaceAnchor {
|
|
1420
|
+
/**
|
|
1421
|
+
* The current index within the array that this anchor refers to.
|
|
1422
|
+
* @remarks
|
|
1423
|
+
* This value is updated as the array is edited in a way that depends on the specific anchor implementation.
|
|
1424
|
+
* This index may take on a value from 0 to the length of the array (inclusive).
|
|
1425
|
+
* If used as the index to insert content into the array, this means it can point to any location in the array,
|
|
1426
|
+
* including just after the last child.
|
|
1427
|
+
*/
|
|
1428
|
+
get index(): number;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Create an {@link ArrayPlaceAnchor} tracking an insertion point in the array which is currently at the provided index.
|
|
1433
|
+
*
|
|
1434
|
+
* @param node - The array node to anchor into.
|
|
1435
|
+
* @param currentIndex - The current index of the place to track.
|
|
1436
|
+
* @remarks
|
|
1437
|
+
* This anchor will track the logical position in the array across changes.
|
|
1438
|
+
* As long as the subsection of the array surrounding the anchor point is not edited,
|
|
1439
|
+
* this anchor will move with them, keeping its relative position to those children fixed.
|
|
1440
|
+
* How exactly it behaves when the adjacent portion of the array is modified is subject to change,
|
|
1441
|
+
* but this will always report a valid index to insert content at (which can be the index after the last item in the array).
|
|
1442
|
+
*
|
|
1443
|
+
* This is intended to track a location that might be used for an insertion point (for example in a text editor): future changes to its details should
|
|
1444
|
+
* make it behave better for such uses.
|
|
1445
|
+
*
|
|
1446
|
+
* The current implementation is known to behave particularly poorly if the child which was at the original anchor point's index is removed
|
|
1447
|
+
* (jumps to the end of the array): this behavior is subject to change.
|
|
1448
|
+
* @privateRemarks
|
|
1449
|
+
* When stabilized, this should probably become a method on {@link (TreeArrayNode:interface)}.
|
|
1450
|
+
* Future versions of this should use rebaser / changeset logic to do a better job of tracking a location across removals or reinsertion.
|
|
1451
|
+
* How this would work, especially for unhydrated nodes is not yet clear.
|
|
1452
|
+
* @alpha
|
|
1453
|
+
*/
|
|
1454
|
+
export function createArrayInsertionAnchor(
|
|
1455
|
+
node: TreeArrayNode,
|
|
1456
|
+
currentIndex: number,
|
|
1457
|
+
): ArrayPlaceAnchor {
|
|
1458
|
+
const field = getInnerNode(node).getBoxed(EmptyKey);
|
|
1459
|
+
const child = field.boxedAt(currentIndex);
|
|
1460
|
+
return {
|
|
1461
|
+
get index() {
|
|
1462
|
+
if (child === undefined) {
|
|
1463
|
+
return field.length;
|
|
1464
|
+
}
|
|
1465
|
+
if (child.parentField.parent !== field) {
|
|
1466
|
+
return field.length;
|
|
1467
|
+
}
|
|
1468
|
+
return child.parentField.index;
|
|
1469
|
+
},
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
@@ -189,24 +189,25 @@ export type FieldHasDefault<T extends ImplicitFieldSchema> = [T] extends [
|
|
|
189
189
|
*/
|
|
190
190
|
export type InsertableObjectFromSchemaRecord<
|
|
191
191
|
T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
192
|
-
> =
|
|
193
|
-
|
|
194
|
-
?
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
192
|
+
> =
|
|
193
|
+
RestrictiveStringRecord<ImplicitFieldSchema> extends T
|
|
194
|
+
? { arbitraryKey: "arbitraryValue" } extends T
|
|
195
|
+
? // {} case
|
|
196
|
+
Record<string, never>
|
|
197
|
+
: // RestrictiveStringRecord<ImplicitFieldSchema> case
|
|
198
|
+
never
|
|
199
|
+
: FlattenKeys<
|
|
200
|
+
{
|
|
201
|
+
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<
|
|
202
|
+
T[Property & string]
|
|
203
|
+
>;
|
|
204
|
+
} & {
|
|
205
|
+
// Field does not have a known default, make it required:
|
|
206
|
+
readonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false
|
|
207
|
+
? Property
|
|
208
|
+
: never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
209
|
+
}
|
|
210
|
+
>;
|
|
210
211
|
|
|
211
212
|
/**
|
|
212
213
|
* Maps from simple field keys ("property" keys) to information about the field.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { assert, debugAssert, fail } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
|
|
10
10
|
import { filterIterable, hasSingle, oneFromIterable } from "../util/index.js";
|
|
@@ -58,7 +58,9 @@ export function unhydratedFlexTreeFromInsertable<TIn extends InsertableContent |
|
|
|
58
58
|
if (data === undefined) {
|
|
59
59
|
// TODO: this code-path should support defaults
|
|
60
60
|
if (normalizedFieldSchema.kind !== FieldKind.Optional) {
|
|
61
|
-
throw new UsageError(
|
|
61
|
+
throw new UsageError(
|
|
62
|
+
`Got undefined for non-optional field expecting one of ${quotedAllowedTypesWithNames(normalizedFieldSchema.allowedTypeSet)}`,
|
|
63
|
+
);
|
|
62
64
|
}
|
|
63
65
|
return undefined as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;
|
|
64
66
|
}
|
|
@@ -71,6 +73,47 @@ export function unhydratedFlexTreeFromInsertable<TIn extends InsertableContent |
|
|
|
71
73
|
return flexTree as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Throw a usage error with a helpful message about `schema` not being in `allowedTypes` for insertable content.
|
|
78
|
+
*/
|
|
79
|
+
function allowedTypesInsertableSchemaError(
|
|
80
|
+
allowedTypes: ReadonlySet<TreeNodeSchema>,
|
|
81
|
+
schema: TreeNodeSchema,
|
|
82
|
+
): never {
|
|
83
|
+
debugAssert(
|
|
84
|
+
() =>
|
|
85
|
+
!allowedTypes.has(schema) ||
|
|
86
|
+
"This function should only be called if the schema is not in the allowed types.",
|
|
87
|
+
);
|
|
88
|
+
const map = new Map([...allowedTypes].map((s) => [s.identifier, s]));
|
|
89
|
+
const expected = map.get(schema.identifier);
|
|
90
|
+
if (expected !== undefined) {
|
|
91
|
+
throw new UsageError(
|
|
92
|
+
`A node with schema ${quotedSchemaIdentifierWithName(schema)} was provided where a node with that identifier is allowed, but the actual schema required (${quotedSchemaIdentifierWithName(expected)}) is not the same schema object.
|
|
93
|
+
TreeNodeSchema have significant object identity and thus the exact same object must be used as the schema when defining what nodes are allowed and when constructing the node to use.`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
throw new UsageError(
|
|
97
|
+
`Expected insertable for one of ${quotedAllowedTypesWithNames(allowedTypes)}. Got node with schema ${quotedSchemaIdentifierWithName(schema)}.
|
|
98
|
+
Nodes are valid insertable objects, but only if their schema are in the allowed list.`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Gets a description of a schema for use in error messages.
|
|
104
|
+
*/
|
|
105
|
+
function quotedSchemaIdentifierWithName(schema: TreeNodeSchema): string {
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
107
|
+
return `${JSON.stringify(schema.identifier)} (name: ${JSON.stringify((schema as Function).name)})`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets a description of an allowedTypes for use in error messages.
|
|
112
|
+
*/
|
|
113
|
+
function quotedAllowedTypesWithNames(allowedTypes: Iterable<TreeNodeSchema>): string {
|
|
114
|
+
return `[${[...allowedTypes].map(quotedSchemaIdentifierWithName).join(", ")}]`;
|
|
115
|
+
}
|
|
116
|
+
|
|
74
117
|
/**
|
|
75
118
|
* Copy content from `data` into a UnhydratedFlexTreeNode.
|
|
76
119
|
*/
|
|
@@ -83,10 +126,12 @@ export function unhydratedFlexTreeFromInsertableNode(
|
|
|
83
126
|
const inner = kernel.getInnerNodeIfUnhydrated();
|
|
84
127
|
if (inner === undefined) {
|
|
85
128
|
// The node is already hydrated, meaning that it already got inserted into the tree previously
|
|
86
|
-
throw new UsageError(
|
|
129
|
+
throw new UsageError(
|
|
130
|
+
`A node with schema ${quotedSchemaIdentifierWithName(kernel.schema)} was inserted into the tree more than once. This is not supported.`,
|
|
131
|
+
);
|
|
87
132
|
} else {
|
|
88
133
|
if (!allowedTypes.has(kernel.schema)) {
|
|
89
|
-
|
|
134
|
+
allowedTypesInsertableSchemaError(allowedTypes, kernel.schema);
|
|
90
135
|
}
|
|
91
136
|
return inner;
|
|
92
137
|
}
|
|
@@ -112,17 +157,13 @@ function getType(
|
|
|
112
157
|
const possibleTypes = getPossibleTypes(allowedTypes, data);
|
|
113
158
|
if (possibleTypes.length === 0) {
|
|
114
159
|
throw new UsageError(
|
|
115
|
-
`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${
|
|
116
|
-
[...allowedTypes].map((schema) => schema.identifier),
|
|
117
|
-
)}.`,
|
|
160
|
+
`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${quotedAllowedTypesWithNames(allowedTypes)}.`,
|
|
118
161
|
);
|
|
119
162
|
}
|
|
120
163
|
if (!hasSingle(possibleTypes)) {
|
|
121
164
|
throw new UsageError(
|
|
122
165
|
`The provided data is compatible with more than one type allowed by the schema.
|
|
123
|
-
The set of possible types is ${
|
|
124
|
-
...possibleTypes.map((schema) => schema.identifier),
|
|
125
|
-
])}.
|
|
166
|
+
The set of possible types is ${quotedAllowedTypesWithNames(possibleTypes)}.
|
|
126
167
|
Explicitly construct an unhydrated node of the desired type to disambiguate.
|
|
127
168
|
For class-based schema, this can be done by replacing an expression like "{foo: 1}" with "new MySchema({foo: 1})".`,
|
|
128
169
|
);
|