@fluidframework/tree 2.83.0 → 2.90.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/.vscode/settings.json +6 -5
- package/CHANGELOG.md +95 -0
- package/README.md +1 -1
- package/api-report/tree.alpha.api.md +63 -24
- package/api-report/tree.beta.api.md +30 -0
- package/api-report/tree.legacy.beta.api.md +30 -0
- package/dist/alpha.d.ts +10 -6
- package/dist/beta.d.ts +4 -1
- package/dist/codec/codec.d.ts +2 -0
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +4 -3
- 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 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +13 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +18 -3
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +22 -1
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +16 -3
- package/dist/codec/versioned/format.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -1
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -3
- package/dist/core/index.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.map +1 -1
- package/dist/core/rebase/types.d.ts +78 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -7
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +22 -44
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +11 -0
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +3 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -4
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -4
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts +17 -0
- package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +5 -12
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +33 -33
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +6 -7
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -4
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +13 -11
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -14
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +31 -48
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/index.js +2 -2
- package/dist/feature-libraries/forest-summary/index.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 -5
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -3
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/indexing/index.d.ts +1 -1
- package/dist/feature-libraries/indexing/index.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/index.js.map +1 -1
- package/dist/feature-libraries/indexing/types.d.ts +15 -13
- package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/types.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.js +2 -2
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +5 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +35 -7
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +7 -7
- package/dist/shared-tree/sharedTree.js.map +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 +8 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +48 -8
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +35 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +123 -17
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.d.ts +20 -0
- package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -0
- package/dist/shared-tree/unhydratedTreeContext.js +56 -0
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -0
- package/dist/shared-tree-core/transaction.d.ts +15 -27
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +7 -11
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +4 -0
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
- package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/identifierIndex.js +1 -1
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +3 -2
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +3 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +15 -13
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +4 -4
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +4 -4
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +22 -25
- 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 +69 -132
- 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/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +2 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +27 -9
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +43 -7
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +14 -8
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +97 -25
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/util/rangeMap.d.ts +1 -0
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +5 -6
- package/dist/util/rangeMap.js.map +1 -1
- package/lib/alpha.d.ts +10 -6
- package/lib/beta.d.ts +4 -1
- package/lib/codec/codec.d.ts +2 -0
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +4 -3
- 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 +13 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +18 -3
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +22 -1
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +15 -2
- package/lib/codec/versioned/format.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/index.d.ts +1 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +0 -1
- package/lib/core/index.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.map +1 -1
- package/lib/core/rebase/types.d.ts +78 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -7
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +25 -45
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +11 -0
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +3 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts +17 -0
- package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +5 -12
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +35 -32
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +7 -8
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -4
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +7 -4
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -14
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +30 -47
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/index.js +1 -1
- package/lib/feature-libraries/forest-summary/index.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 +2 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -3
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/indexing/index.d.ts +1 -1
- package/lib/feature-libraries/indexing/index.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/index.js.map +1 -1
- package/lib/feature-libraries/indexing/types.d.ts +15 -13
- package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/types.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +4 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.js +3 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +5 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +33 -6
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +8 -8
- package/lib/shared-tree/sharedTree.js.map +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 +8 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +49 -9
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +35 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +124 -18
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.d.ts +20 -0
- package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -0
- package/lib/shared-tree/unhydratedTreeContext.js +52 -0
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -0
- package/lib/shared-tree-core/transaction.d.ts +15 -27
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +7 -11
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +4 -0
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
- package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/identifierIndex.js +2 -2
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +3 -2
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +3 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +15 -13
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +4 -4
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +22 -25
- 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 +69 -132
- 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/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +27 -9
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +45 -9
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +14 -8
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +80 -8
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/util/rangeMap.d.ts +1 -0
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +5 -6
- package/lib/util/rangeMap.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/codec.ts +5 -4
- package/src/codec/index.ts +1 -0
- package/src/codec/versioned/codec.ts +32 -6
- package/src/codec/versioned/format.ts +17 -2
- package/src/codec/versioned/index.ts +1 -1
- package/src/core/index.ts +2 -6
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +80 -0
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +59 -78
- package/src/feature-libraries/chunked-forest/codec/format.ts +11 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +3 -3
- package/src/feature-libraries/chunked-forest/index.ts +2 -3
- package/src/feature-libraries/flex-tree/observer.ts +17 -0
- package/src/feature-libraries/forest-summary/codec.ts +46 -56
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -14
- package/src/feature-libraries/forest-summary/formatCommon.ts +14 -19
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +44 -74
- package/src/feature-libraries/forest-summary/index.ts +1 -1
- package/src/feature-libraries/index.ts +2 -4
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +3 -5
- package/src/feature-libraries/indexing/index.ts +1 -1
- package/src/feature-libraries/indexing/types.ts +15 -17
- package/src/index.ts +6 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +3 -3
- package/src/shared-tree/schematizingTreeView.ts +43 -10
- package/src/shared-tree/sharedTree.ts +8 -10
- package/src/shared-tree/tree.ts +1 -1
- package/src/shared-tree/treeAlpha.ts +64 -11
- package/src/shared-tree/treeCheckout.ts +142 -21
- package/src/shared-tree/unhydratedTreeContext.ts +87 -0
- package/src/shared-tree-core/transaction.ts +19 -39
- package/src/simple-tree/api/configuration.ts +4 -0
- package/src/simple-tree/api/identifierIndex.ts +4 -4
- package/src/simple-tree/api/index.ts +3 -1
- package/src/simple-tree/api/schemaFactory.ts +3 -2
- package/src/simple-tree/api/simpleTreeIndex.ts +26 -20
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +4 -4
- package/src/simple-tree/api/transactionTypes.ts +24 -26
- package/src/simple-tree/api/tree.ts +92 -131
- package/src/simple-tree/index.ts +4 -2
- package/src/text/textDomain.ts +91 -12
- package/src/text/textDomainFormatted.ts +127 -15
- package/src/util/rangeMap.ts +5 -11
- package/dist/core/schema-view/index.d.ts +0 -6
- package/dist/core/schema-view/index.d.ts.map +0 -1
- package/dist/core/schema-view/index.js +0 -10
- package/dist/core/schema-view/index.js.map +0 -1
- package/dist/core/schema-view/view.d.ts +0 -31
- package/dist/core/schema-view/view.d.ts.map +0 -1
- package/dist/core/schema-view/view.js +0 -18
- package/dist/core/schema-view/view.js.map +0 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +0 -12
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +0 -1
- package/dist/feature-libraries/forest-summary/formatV1.js +0 -10
- package/dist/feature-libraries/forest-summary/formatV1.js.map +0 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +0 -12
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +0 -1
- package/dist/feature-libraries/forest-summary/formatV2.js +0 -10
- package/dist/feature-libraries/forest-summary/formatV2.js.map +0 -1
- package/lib/core/schema-view/index.d.ts +0 -6
- package/lib/core/schema-view/index.d.ts.map +0 -1
- package/lib/core/schema-view/index.js +0 -6
- package/lib/core/schema-view/index.js.map +0 -1
- package/lib/core/schema-view/view.d.ts +0 -31
- package/lib/core/schema-view/view.d.ts.map +0 -1
- package/lib/core/schema-view/view.js +0 -14
- package/lib/core/schema-view/view.js.map +0 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +0 -12
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +0 -1
- package/lib/feature-libraries/forest-summary/formatV1.js +0 -7
- package/lib/feature-libraries/forest-summary/formatV1.js.map +0 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +0 -12
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +0 -1
- package/lib/feature-libraries/forest-summary/formatV2.js +0 -7
- package/lib/feature-libraries/forest-summary/formatV2.js.map +0 -1
- package/src/core/schema-view/README.md +0 -9
- package/src/core/schema-view/index.ts +0 -10
- package/src/core/schema-view/view.ts +0 -38
- package/src/feature-libraries/forest-summary/formatV1.ts +0 -11
- package/src/feature-libraries/forest-summary/formatV2.ts +0 -11
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
type TreeIndexNodes,
|
|
18
18
|
hasElement,
|
|
19
19
|
type TreeIndex,
|
|
20
|
-
type TreeIndexKey,
|
|
21
20
|
type KeyFinder,
|
|
22
21
|
} from "../../feature-libraries/index.js";
|
|
23
22
|
import type { SchematizingSimpleTreeView } from "../../shared-tree/index.js";
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
type TreeNode,
|
|
28
27
|
type TreeNodeSchema,
|
|
29
28
|
type NodeFromSchema,
|
|
29
|
+
type TreeLeafValue,
|
|
30
30
|
} from "../core/index.js";
|
|
31
31
|
import type { ImplicitFieldSchema } from "../fieldSchema.js";
|
|
32
32
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
@@ -35,14 +35,16 @@ import type { TreeView } from "./tree.js";
|
|
|
35
35
|
import { treeNodeApi } from "./treeNodeApi.js";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Value that may be used as keys in a {@link TreeIndex}.
|
|
39
|
+
* @remarks
|
|
40
|
+
* This supports values which have value semantics and are compared by value, just like {@link TreeLeafValue}.
|
|
41
|
+
* This allows using any tree value as a key (for example in an index tracking where those values occur in the tree).
|
|
40
42
|
* @alpha
|
|
41
43
|
*/
|
|
42
|
-
export type
|
|
44
|
+
export type TreeIndexKey = TreeLeafValue;
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
|
-
* Creates a {@link
|
|
47
|
+
* Creates a {@link TreeIndex} with a specified indexer.
|
|
46
48
|
*
|
|
47
49
|
* @param view - the view for the tree being indexed
|
|
48
50
|
* @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema
|
|
@@ -52,7 +54,7 @@ export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey,
|
|
|
52
54
|
*
|
|
53
55
|
* @alpha
|
|
54
56
|
*/
|
|
55
|
-
export function
|
|
57
|
+
export function createTreeIndex<
|
|
56
58
|
TFieldSchema extends ImplicitFieldSchema,
|
|
57
59
|
TKey extends TreeIndexKey,
|
|
58
60
|
TValue,
|
|
@@ -61,9 +63,10 @@ export function createSimpleTreeIndex<
|
|
|
61
63
|
indexer: (schema: TreeNodeSchema) => string | undefined,
|
|
62
64
|
getValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,
|
|
63
65
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
64
|
-
):
|
|
66
|
+
): TreeIndex<TKey, TValue>;
|
|
67
|
+
|
|
65
68
|
/**
|
|
66
|
-
* Creates a {@link
|
|
69
|
+
* Creates a {@link TreeIndex} with a specified indexer.
|
|
67
70
|
*
|
|
68
71
|
* @param view - the view for the tree being indexed
|
|
69
72
|
* @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema
|
|
@@ -74,7 +77,7 @@ export function createSimpleTreeIndex<
|
|
|
74
77
|
*
|
|
75
78
|
* @alpha
|
|
76
79
|
*/
|
|
77
|
-
export function
|
|
80
|
+
export function createTreeIndex<
|
|
78
81
|
TFieldSchema extends ImplicitFieldSchema,
|
|
79
82
|
TKey extends TreeIndexKey,
|
|
80
83
|
TValue,
|
|
@@ -85,9 +88,10 @@ export function createSimpleTreeIndex<
|
|
|
85
88
|
getValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,
|
|
86
89
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
87
90
|
indexableSchema: readonly TSchema[],
|
|
88
|
-
):
|
|
91
|
+
): TreeIndex<TKey, TValue>;
|
|
92
|
+
|
|
89
93
|
/**
|
|
90
|
-
* Creates a {@link
|
|
94
|
+
* Creates a {@link TreeIndex} with a specified indexer.
|
|
91
95
|
*
|
|
92
96
|
* @param view - the view for the tree being indexed
|
|
93
97
|
* @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema
|
|
@@ -97,7 +101,7 @@ export function createSimpleTreeIndex<
|
|
|
97
101
|
*
|
|
98
102
|
* @alpha
|
|
99
103
|
*/
|
|
100
|
-
export function
|
|
104
|
+
export function createTreeIndex<
|
|
101
105
|
TFieldSchema extends ImplicitFieldSchema,
|
|
102
106
|
TKey extends TreeIndexKey,
|
|
103
107
|
TValue,
|
|
@@ -106,9 +110,10 @@ export function createSimpleTreeIndex<
|
|
|
106
110
|
indexer: Map<TreeNodeSchema, string>,
|
|
107
111
|
getValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,
|
|
108
112
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
109
|
-
):
|
|
113
|
+
): TreeIndex<TKey, TValue>;
|
|
114
|
+
|
|
110
115
|
/**
|
|
111
|
-
* Creates a {@link
|
|
116
|
+
* Creates a {@link TreeIndex} with a specified indexer.
|
|
112
117
|
*
|
|
113
118
|
* @param view - the view for the tree being indexed
|
|
114
119
|
* @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema
|
|
@@ -119,7 +124,7 @@ export function createSimpleTreeIndex<
|
|
|
119
124
|
*
|
|
120
125
|
* @alpha
|
|
121
126
|
*/
|
|
122
|
-
export function
|
|
127
|
+
export function createTreeIndex<
|
|
123
128
|
TFieldSchema extends ImplicitFieldSchema,
|
|
124
129
|
TKey extends TreeIndexKey,
|
|
125
130
|
TValue,
|
|
@@ -130,13 +135,14 @@ export function createSimpleTreeIndex<
|
|
|
130
135
|
getValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,
|
|
131
136
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
132
137
|
indexableSchema: readonly TSchema[],
|
|
133
|
-
):
|
|
138
|
+
): TreeIndex<TKey, TValue>;
|
|
139
|
+
|
|
134
140
|
/**
|
|
135
|
-
* Creates a {@link
|
|
141
|
+
* Creates a {@link TreeIndex} with a specified indexer.
|
|
136
142
|
*
|
|
137
143
|
* @alpha
|
|
138
144
|
*/
|
|
139
|
-
export function
|
|
145
|
+
export function createTreeIndex<
|
|
140
146
|
TFieldSchema extends ImplicitFieldSchema,
|
|
141
147
|
TKey extends TreeIndexKey,
|
|
142
148
|
TValue,
|
|
@@ -148,7 +154,7 @@ export function createSimpleTreeIndex<
|
|
|
148
154
|
| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),
|
|
149
155
|
isKeyValid: (key: TreeIndexKey) => key is TKey,
|
|
150
156
|
indexableSchema?: readonly TreeNodeSchema[],
|
|
151
|
-
):
|
|
157
|
+
): TreeIndex<TKey, TValue> {
|
|
152
158
|
const indexableSchemaMap = new Map<string, TreeNodeSchema>();
|
|
153
159
|
if (indexableSchema === undefined) {
|
|
154
160
|
walkFieldSchema(view.schema, {
|
|
@@ -214,7 +220,7 @@ export function createSimpleTreeIndex<
|
|
|
214
220
|
|
|
215
221
|
// all the type checking guarantees that we put nodes of the correct type in the index
|
|
216
222
|
// but it's not captured in the type system
|
|
217
|
-
return index as
|
|
223
|
+
return index as TreeIndex<TKey, TValue>;
|
|
218
224
|
}
|
|
219
225
|
|
|
220
226
|
function makeGenericKeyFinder<TKey extends TreeIndexKey>(
|
|
@@ -167,7 +167,7 @@ export function importCompatibilitySchemaSnapshot(
|
|
|
167
167
|
* allowing for greater portability and easier testing.
|
|
168
168
|
*
|
|
169
169
|
* @input
|
|
170
|
-
* @
|
|
170
|
+
* @beta
|
|
171
171
|
*/
|
|
172
172
|
export interface SnapshotFileSystem {
|
|
173
173
|
/**
|
|
@@ -245,7 +245,7 @@ export interface CombinedSchemaCompatibilityStatus {
|
|
|
245
245
|
/**
|
|
246
246
|
* The options for {@link snapshotSchemaCompatibility}.
|
|
247
247
|
* @input
|
|
248
|
-
* @
|
|
248
|
+
* @beta
|
|
249
249
|
*/
|
|
250
250
|
export interface SnapshotSchemaCompatibilityOptions {
|
|
251
251
|
/**
|
|
@@ -447,7 +447,7 @@ export interface SnapshotSchemaCompatibilityOptions {
|
|
|
447
447
|
* import fs from "node:fs";
|
|
448
448
|
* import path from "node:path";
|
|
449
449
|
*
|
|
450
|
-
* import { snapshotSchemaCompatibility } from "@fluidframework/tree/
|
|
450
|
+
* import { snapshotSchemaCompatibility } from "@fluidframework/tree/beta";
|
|
451
451
|
*
|
|
452
452
|
* // The TreeViewConfiguration the application uses, which contains the application's schema.
|
|
453
453
|
* import { treeViewConfiguration } from "./schema.js";
|
|
@@ -485,7 +485,7 @@ export interface SnapshotSchemaCompatibilityOptions {
|
|
|
485
485
|
* but it would be nice to better unify how we do that versioning and format validation with our codecs.
|
|
486
486
|
*
|
|
487
487
|
* See snapshotCompatibilityChecker.example.mts for the large example included above.
|
|
488
|
-
* @
|
|
488
|
+
* @beta
|
|
489
489
|
*/
|
|
490
490
|
export function snapshotSchemaCompatibility(
|
|
491
491
|
options: SnapshotSchemaCompatibilityOptions,
|
|
@@ -49,22 +49,27 @@ export interface NoChangeConstraint {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Contains a value returned from a transaction.
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
export interface WithValue<TValue> {
|
|
56
|
+
/** The user-supplied value. */
|
|
57
|
+
value: TValue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Contains a value and status returned from a user-supplied {@link TreeBranchAlpha.(runTransaction:1) | transaction callback}.
|
|
53
62
|
* @alpha
|
|
54
63
|
*/
|
|
55
64
|
export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = (
|
|
56
|
-
| {
|
|
65
|
+
| (WithValue<TSuccessValue> & {
|
|
57
66
|
/** Indicates that the transaction callback ran successfully. */
|
|
58
67
|
rollback?: false;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
| {
|
|
68
|
+
})
|
|
69
|
+
| (WithValue<TFailureValue> & {
|
|
63
70
|
/** Indicates that the transaction callback failed and the transaction should be rolled back. */
|
|
64
71
|
rollback: true;
|
|
65
|
-
|
|
66
|
-
value: TFailureValue;
|
|
67
|
-
}
|
|
72
|
+
})
|
|
68
73
|
) & {
|
|
69
74
|
/**
|
|
70
75
|
* An optional list of {@link TransactionConstraintAlpha | constraints} that will be checked when the commit corresponding
|
|
@@ -77,8 +82,7 @@ export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = (
|
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
|
-
* The
|
|
81
|
-
* need to return a value. This is the same as {@link TransactionCallbackStatus} but with the `value` field omitted. This
|
|
85
|
+
* The result of a {@link TreeBranchAlpha.(runTransaction:2) | transaction} that doesn't return a value.
|
|
82
86
|
* @alpha
|
|
83
87
|
*/
|
|
84
88
|
export type VoidTransactionCallbackStatus = Omit<
|
|
@@ -87,25 +91,21 @@ export type VoidTransactionCallbackStatus = Omit<
|
|
|
87
91
|
>;
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
|
-
* The result of
|
|
94
|
+
* The result of a {@link TreeBranchAlpha.(runTransaction:1) | transaction} that completed successfully.
|
|
91
95
|
* @alpha
|
|
92
96
|
*/
|
|
93
|
-
export interface TransactionResultSuccess<TSuccessValue> {
|
|
94
|
-
/**
|
|
97
|
+
export interface TransactionResultSuccess<TSuccessValue> extends WithValue<TSuccessValue> {
|
|
98
|
+
/** The success flag for a transaction that completed without being {@link TransactionCallbackStatus | rolled back}. */
|
|
95
99
|
success: true;
|
|
96
|
-
/** The user defined value when the transaction was successful. */
|
|
97
|
-
value: TSuccessValue;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
|
-
* The result of
|
|
103
|
+
* The result of a {@link TreeBranchAlpha.(runTransaction:1) | transaction} that was rolled back.
|
|
102
104
|
* @alpha
|
|
103
105
|
*/
|
|
104
|
-
export interface TransactionResultFailed<TFailureValue> {
|
|
105
|
-
/**
|
|
106
|
+
export interface TransactionResultFailed<TFailureValue> extends WithValue<TFailureValue> {
|
|
107
|
+
/** The failure flag for a transaction that was {@link TransactionCallbackStatus | rolled back}. */
|
|
106
108
|
success: false;
|
|
107
|
-
/** The user defined value when the transaction failed. */
|
|
108
|
-
value: TFailureValue;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -133,17 +133,15 @@ export type TransactionResult =
|
|
|
133
133
|
export interface RunTransactionParams {
|
|
134
134
|
/**
|
|
135
135
|
* An optional list of {@link TransactionConstraintAlpha | constraints} that are checked just before the transaction begins.
|
|
136
|
+
* @remarks
|
|
136
137
|
* If any of the constraints are not met when `runTransaction` is called, an error will be thrown.
|
|
137
|
-
* If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on
|
|
138
|
-
* this client and ignored by all other clients.
|
|
138
|
+
* If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on this client and ignored by all other clients.
|
|
139
139
|
*/
|
|
140
140
|
readonly preconditions?: readonly TransactionConstraintAlpha[];
|
|
141
141
|
/**
|
|
142
142
|
* A label for this transaction that allows it to be correlated with later edits (e.g. for controlling undo/redo grouping).
|
|
143
|
-
*
|
|
144
143
|
* @remarks
|
|
145
|
-
*
|
|
146
|
-
* `label` property of {@link ChangeMetadata} in the `commitApplied` or `changed` event.
|
|
144
|
+
* If this transaction is applied to a {@link TreeBranchAlpha | branch}, the label will be available in the {@link LocalChangeMetadata.label | metadata} of the {@link TreeBranchEvents.changed | `changed`} event.
|
|
147
145
|
*
|
|
148
146
|
* If there is a nested transaction, only the outermost transaction label will be used.
|
|
149
147
|
*/
|
|
@@ -11,12 +11,18 @@ import type {
|
|
|
11
11
|
RevertibleAlphaFactory,
|
|
12
12
|
RevertibleFactory,
|
|
13
13
|
} from "../../core/index.js";
|
|
14
|
+
// This is referenced by doc comments.
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
import type { TreeStatus } from "../../feature-libraries/index.js";
|
|
14
17
|
import type {
|
|
15
18
|
// This is referenced by doc comments.
|
|
16
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
17
20
|
TreeAlpha,
|
|
18
21
|
} from "../../shared-tree/index.js";
|
|
19
22
|
import type { JsonCompatibleReadOnly } from "../../util/index.js";
|
|
23
|
+
// This is referenced by doc comments.
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
+
import type { Unhydrated } from "../core/index.js";
|
|
20
26
|
import type {
|
|
21
27
|
ImplicitFieldSchema,
|
|
22
28
|
InsertableField,
|
|
@@ -35,6 +41,7 @@ import type {
|
|
|
35
41
|
TransactionResult,
|
|
36
42
|
TransactionResultExt,
|
|
37
43
|
VoidTransactionCallbackStatus,
|
|
44
|
+
WithValue,
|
|
38
45
|
} from "./transactionTypes.js";
|
|
39
46
|
import type { VerboseTree } from "./verboseTree.js";
|
|
40
47
|
|
|
@@ -175,6 +182,80 @@ export interface TreeBranch extends IDisposable {
|
|
|
175
182
|
dispose(error?: Error): void;
|
|
176
183
|
}
|
|
177
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.
|
|
187
|
+
* @alpha
|
|
188
|
+
*/
|
|
189
|
+
export interface TreeContextAlpha {
|
|
190
|
+
/**
|
|
191
|
+
* Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.
|
|
192
|
+
* @param transaction - A callback run during the transaction to perform user-supplied operations.
|
|
193
|
+
* It may optionally return a {@link WithValue | value }, which will be returned by the `runTransaction` call.
|
|
194
|
+
* @param params - Optional {@link RunTransactionParams | parameters} for the transaction.
|
|
195
|
+
* @returns A {@link TransactionResultExt | value } indicating whether or not the transaction succeeded, and containing the value returned by `transaction`.
|
|
196
|
+
* @remarks
|
|
197
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes from a remote client can be interleaved with those changes.
|
|
198
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
199
|
+
*
|
|
200
|
+
* {@link (TreeBeta:interface).on | Change events } will be emitted for changed nodes on this client _as each edit happens_, just as they would be if the changes were made outside of a transaction.
|
|
201
|
+
* Any other/future clients or contexts will process the transaction "squashed", i.e. they will apply its changes all at once, emitting only a single event per node (even if that node was edited multiple times in the transaction).
|
|
202
|
+
* Edits to the tree are not permitted within these event callbacks, therefore no other local changes from this client will be interleaved with the changes in this transaction.
|
|
203
|
+
*
|
|
204
|
+
* Using a transaction has the following additional consequences:
|
|
205
|
+
*
|
|
206
|
+
* - If {@link Revertible | reverted } (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
207
|
+
* Only the "outermost" transaction commits a change to the synchronized tree state and therefore only the outermost transaction can be reverted.
|
|
208
|
+
* If a transaction is started and completed while another transaction is already in progress, then the inner transaction will be reverted together with the outer transaction.
|
|
209
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
210
|
+
*
|
|
211
|
+
* `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.
|
|
212
|
+
* Use {@link TreeContextAlpha.isBranch | isBranch() } to check whether this context is associated with a branch and gain {@link TreeBranchAlpha.(runTransaction:1) | access to more transaction capabilities} if so.
|
|
213
|
+
*/
|
|
214
|
+
runTransaction<TValue>(
|
|
215
|
+
transaction: () => WithValue<TValue>,
|
|
216
|
+
params?: RunTransactionParams,
|
|
217
|
+
): TransactionResultExt<TValue, TValue>;
|
|
218
|
+
|
|
219
|
+
/** An overload of {@link TreeContextAlpha.(runTransaction:1) | runTransaction } which does not return a value. */
|
|
220
|
+
runTransaction(transaction: () => void, params?: RunTransactionParams): TransactionResult;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* An asynchronous version of {@link TreeContextAlpha.(runTransaction:1) | runTransaction}.
|
|
224
|
+
* @remarks
|
|
225
|
+
* As with synchronous transactions, all of the changes in an asynchronous transaction are treated as a unit.
|
|
226
|
+
* Therefore, no other changes (either from this client or from a remote client) can be interleaved with the transaction changes.
|
|
227
|
+
*
|
|
228
|
+
* Unlike with synchronous transactions, it is possible that other changes (e.g. from a remote client) may be applied to the branch while this transaction is in progress.
|
|
229
|
+
* Those other changes will be not be reflected on the branch until after this transaction completes, at which point the transaction changes will be applied after those other changes.
|
|
230
|
+
*
|
|
231
|
+
* An asynchronous transaction may not be started while any other transaction is in progress in this context.
|
|
232
|
+
*/
|
|
233
|
+
runTransactionAsync<TValue>(
|
|
234
|
+
transaction: () => Promise<WithValue<TValue>>,
|
|
235
|
+
params?: RunTransactionParams,
|
|
236
|
+
): Promise<TransactionResultExt<TValue, TValue>>;
|
|
237
|
+
|
|
238
|
+
/** An overload of {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value. */
|
|
239
|
+
runTransactionAsync(
|
|
240
|
+
transaction: () => Promise<void>,
|
|
241
|
+
params?: RunTransactionParams,
|
|
242
|
+
): Promise<TransactionResult>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* True if this context is associated with a {@link TreeBranchAlpha | branch} and false if it is associated with an {@link Unhydrated | unhydrated } node.
|
|
246
|
+
* @remarks If this returns true, the context can be safely inferred or cast to {@link TreeBranchAlpha} to access additional branch-specific APIs.
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const context = tree.context(someNode);
|
|
250
|
+
* if (context.isBranch()) {
|
|
251
|
+
* assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on TreeBranchAlpha, so this is only accessible if `context` is a branch context.
|
|
252
|
+
* context.root.foo = "bar"; // Edit the root of the SharedTree that `someNode` belongs to.
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
isBranch(): this is TreeBranchAlpha;
|
|
257
|
+
}
|
|
258
|
+
|
|
178
259
|
/**
|
|
179
260
|
* {@link TreeBranch} with alpha-level APIs.
|
|
180
261
|
* @remarks
|
|
@@ -183,7 +264,7 @@ export interface TreeBranch extends IDisposable {
|
|
|
183
264
|
* A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.
|
|
184
265
|
* @sealed @alpha
|
|
185
266
|
*/
|
|
186
|
-
export interface TreeBranchAlpha extends TreeBranch {
|
|
267
|
+
export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
|
|
187
268
|
/**
|
|
188
269
|
* Events for the branch
|
|
189
270
|
*/
|
|
@@ -211,75 +292,18 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
211
292
|
fork(): TreeBranchAlpha;
|
|
212
293
|
|
|
213
294
|
/**
|
|
214
|
-
* Run a
|
|
215
|
-
* @param transaction - The function to run as the body of the transaction.
|
|
216
|
-
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
217
|
-
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
218
|
-
* abort the transaction and discard any changes it made so far.
|
|
219
|
-
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
220
|
-
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
221
|
-
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
222
|
-
*
|
|
223
|
-
* - A "success" flag indicating whether the transaction was successful or not.
|
|
224
|
-
* - The success or failure value as returned by the transaction function.
|
|
225
|
-
*
|
|
295
|
+
* {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on a branch of the SharedTree.
|
|
296
|
+
* @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatus | value or rollback signal}.
|
|
226
297
|
* @remarks
|
|
227
|
-
*
|
|
228
|
-
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
229
|
-
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
230
|
-
* However, using a transaction has the following additional consequences:
|
|
231
|
-
*
|
|
232
|
-
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
233
|
-
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
234
|
-
*
|
|
235
|
-
* Local change events will be emitted for each change as the transaction is being applied.
|
|
236
|
-
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
237
|
-
*
|
|
238
|
-
* Nested transactions:
|
|
239
|
-
* This API can be called from within the transaction callback of another `runTransaction` or `runTransactionAsync` call. That will have slightly different behavior:
|
|
240
|
-
*
|
|
241
|
-
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
242
|
-
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
243
|
-
* for the outermost transaction which includes all inner transactions.
|
|
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.
|
|
298
|
+
* If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.
|
|
246
299
|
*/
|
|
247
300
|
runTransaction<TSuccessValue, TFailureValue>(
|
|
248
301
|
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
249
302
|
params?: RunTransactionParams,
|
|
250
303
|
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
304
|
+
|
|
251
305
|
/**
|
|
252
|
-
*
|
|
253
|
-
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
254
|
-
*
|
|
255
|
-
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
256
|
-
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
257
|
-
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
258
|
-
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
259
|
-
*
|
|
260
|
-
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
261
|
-
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
262
|
-
* transaction was successful or not.
|
|
263
|
-
*
|
|
264
|
-
* @remarks
|
|
265
|
-
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
266
|
-
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
267
|
-
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
268
|
-
* However, using a transaction has the following additional consequences:
|
|
269
|
-
*
|
|
270
|
-
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
271
|
-
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
272
|
-
*
|
|
273
|
-
* Local change events will be emitted for each change as the transaction is being applied.
|
|
274
|
-
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
275
|
-
*
|
|
276
|
-
* Nested transactions:
|
|
277
|
-
* This API can be called from within the transaction callback of another `runTransaction` or `runTransactionAsync` call. That will have slightly different behavior:
|
|
278
|
-
*
|
|
279
|
-
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
280
|
-
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
281
|
-
* for the outermost transaction which includes all inner transactions.
|
|
282
|
-
* - Undo will undo the outermost transaction and all inner transactions.
|
|
306
|
+
* An overload of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction } which does not return a value.
|
|
283
307
|
*/
|
|
284
308
|
runTransaction(
|
|
285
309
|
transaction: () => VoidTransactionCallbackStatus | void,
|
|
@@ -287,80 +311,17 @@ export interface TreeBranchAlpha extends TreeBranch {
|
|
|
287
311
|
): TransactionResult;
|
|
288
312
|
|
|
289
313
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @
|
|
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.
|
|
314
|
+
* An asynchronous version of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction}.
|
|
315
|
+
* @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.
|
|
325
316
|
*/
|
|
317
|
+
|
|
326
318
|
runTransactionAsync<TSuccessValue, TFailureValue>(
|
|
327
319
|
transaction: () => Promise<TransactionCallbackStatus<TSuccessValue, TFailureValue>>,
|
|
328
320
|
params?: RunTransactionParams,
|
|
329
321
|
): Promise<TransactionResultExt<TSuccessValue, TFailureValue>>;
|
|
322
|
+
|
|
330
323
|
/**
|
|
331
|
-
*
|
|
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.
|
|
324
|
+
* An overload of {@link TreeBranchAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.
|
|
364
325
|
*/
|
|
365
326
|
runTransactionAsync(
|
|
366
327
|
transaction: () => Promise<VoidTransactionCallbackStatus | void>,
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -95,10 +95,10 @@ export {
|
|
|
95
95
|
importConcise,
|
|
96
96
|
TreeBeta,
|
|
97
97
|
type TreeChangeEventsBeta,
|
|
98
|
-
type SimpleTreeIndex,
|
|
99
98
|
type IdentifierIndex,
|
|
100
|
-
|
|
99
|
+
createTreeIndex,
|
|
101
100
|
createIdentifierIndex,
|
|
101
|
+
type TreeIndexKey,
|
|
102
102
|
type DirtyTreeStatus,
|
|
103
103
|
trackDirtyNodes,
|
|
104
104
|
type DirtyTreeMap,
|
|
@@ -201,6 +201,8 @@ export {
|
|
|
201
201
|
type SnapshotFileSystem,
|
|
202
202
|
type SnapshotSchemaCompatibilityOptions,
|
|
203
203
|
createCustomizedFluidFrameworkScopedFactory,
|
|
204
|
+
type TreeContextAlpha,
|
|
205
|
+
type WithValue,
|
|
204
206
|
} from "./api/index.js";
|
|
205
207
|
export type {
|
|
206
208
|
SimpleTreeSchema,
|