@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
package/src/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ export {
|
|
|
12
12
|
type LocalChangeMetadata,
|
|
13
13
|
type RemoteChangeMetadata,
|
|
14
14
|
type ChangeMetadata,
|
|
15
|
+
type LabelTree,
|
|
16
|
+
type TransactionLabels,
|
|
15
17
|
type RevertibleFactory,
|
|
16
18
|
type RevertibleAlphaFactory,
|
|
17
19
|
type RevertibleAlpha,
|
|
@@ -53,7 +55,6 @@ export {
|
|
|
53
55
|
TreeStatus,
|
|
54
56
|
TreeCompressionStrategy,
|
|
55
57
|
type TreeIndex,
|
|
56
|
-
type TreeIndexKey,
|
|
57
58
|
type TreeIndexNodes,
|
|
58
59
|
type IncrementalEncodingPolicy,
|
|
59
60
|
} from "./feature-libraries/index.js";
|
|
@@ -160,13 +161,13 @@ export {
|
|
|
160
161
|
type ValidateRecursiveSchema,
|
|
161
162
|
type FixRecursiveArraySchema,
|
|
162
163
|
// Index APIs
|
|
163
|
-
type SimpleTreeIndex,
|
|
164
164
|
type IdentifierIndex,
|
|
165
|
-
|
|
165
|
+
createTreeIndex,
|
|
166
166
|
createIdentifierIndex,
|
|
167
167
|
type DirtyTreeStatus,
|
|
168
168
|
trackDirtyNodes,
|
|
169
169
|
type DirtyTreeMap,
|
|
170
|
+
type TreeIndexKey,
|
|
170
171
|
// experimental @alpha APIs:
|
|
171
172
|
adaptEnum,
|
|
172
173
|
enumFromStrings,
|
|
@@ -305,6 +306,8 @@ export {
|
|
|
305
306
|
type SnapshotSchemaCompatibilityOptions,
|
|
306
307
|
type ArrayPlaceAnchor,
|
|
307
308
|
createArrayInsertionAnchor,
|
|
309
|
+
type WithValue,
|
|
310
|
+
type TreeContextAlpha,
|
|
308
311
|
} from "./simple-tree/index.js";
|
|
309
312
|
export {
|
|
310
313
|
SharedTree,
|
package/src/packageVersion.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "../core/index.js";
|
|
24
24
|
import {
|
|
25
25
|
createNodeIdentifierManager,
|
|
26
|
-
|
|
26
|
+
fieldBatchCodecBuilder,
|
|
27
27
|
makeSchemaCodec,
|
|
28
28
|
type FieldBatchEncodingContext,
|
|
29
29
|
defaultSchemaPolicy,
|
|
@@ -236,14 +236,14 @@ export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSc
|
|
|
236
236
|
});
|
|
237
237
|
|
|
238
238
|
if (options?.content !== undefined) {
|
|
239
|
-
// Any version can be passed down to `makeSchemaCodec` and `
|
|
239
|
+
// Any version can be passed down to `makeSchemaCodec` and `fieldBatchCodecBuilder.build` here.
|
|
240
240
|
// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not `minVersionForCollab`.
|
|
241
241
|
const writeOptions: CodecWriteOptions = {
|
|
242
242
|
...options,
|
|
243
243
|
minVersionForCollab: FluidClientVersion.v2_0,
|
|
244
244
|
};
|
|
245
245
|
const schemaCodec = makeSchemaCodec(writeOptions, SchemaFormatVersion.v1);
|
|
246
|
-
const fieldBatchCodec =
|
|
246
|
+
const fieldBatchCodec = fieldBatchCodecBuilder.build(writeOptions);
|
|
247
247
|
const newSchema = schemaCodec.decode(options.content.schema as Format);
|
|
248
248
|
|
|
249
249
|
const context: FieldBatchEncodingContext = {
|
|
@@ -166,6 +166,10 @@ export class SchematizingSimpleTreeView<
|
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
public isBranch(): this is TreeBranchAlpha {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
|
|
169
173
|
public applyChange(change: JsonCompatibleReadOnly): void {
|
|
170
174
|
this.checkout.applySerializedChange(change);
|
|
171
175
|
}
|
|
@@ -328,8 +332,13 @@ export class SchematizingSimpleTreeView<
|
|
|
328
332
|
private mountTransaction(params: RunTransactionParams | undefined, isAsync: boolean): void {
|
|
329
333
|
this.ensureUndisposed();
|
|
330
334
|
const { checkout } = this;
|
|
331
|
-
|
|
332
|
-
|
|
335
|
+
if (isAsync && checkout.transaction.size > 0) {
|
|
336
|
+
throw new UsageError(
|
|
337
|
+
"An asynchronous transaction cannot be started while another transaction is already in progress.",
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
checkout.pushLabelFrame(params?.label);
|
|
341
|
+
checkout.transaction.start();
|
|
333
342
|
|
|
334
343
|
// Validate preconditions before running the transaction callback.
|
|
335
344
|
addConstraintsToTransaction(
|
|
@@ -344,7 +353,7 @@ export class SchematizingSimpleTreeView<
|
|
|
344
353
|
| TransactionCallbackStatus<TSuccessValue, TFailureValue>
|
|
345
354
|
| VoidTransactionCallbackStatus
|
|
346
355
|
| void,
|
|
347
|
-
params
|
|
356
|
+
params: RunTransactionParams | undefined,
|
|
348
357
|
): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {
|
|
349
358
|
this.ensureUndisposed();
|
|
350
359
|
const { checkout } = this;
|
|
@@ -354,6 +363,7 @@ export class SchematizingSimpleTreeView<
|
|
|
354
363
|
)?.value;
|
|
355
364
|
|
|
356
365
|
if (rollback === true) {
|
|
366
|
+
checkout.popLabelFrame(true);
|
|
357
367
|
checkout.transaction.abort();
|
|
358
368
|
return value === undefined
|
|
359
369
|
? { success: false }
|
|
@@ -367,6 +377,7 @@ export class SchematizingSimpleTreeView<
|
|
|
367
377
|
transactionCallbackStatus?.preconditionsOnRevert,
|
|
368
378
|
);
|
|
369
379
|
|
|
380
|
+
checkout.popLabelFrame(false);
|
|
370
381
|
checkout.runWithTransactionLabel(() => {
|
|
371
382
|
checkout.transaction.commit();
|
|
372
383
|
}, params?.label);
|
|
@@ -611,17 +622,11 @@ export function addConstraintsToTransaction(
|
|
|
611
622
|
constraints: readonly TransactionConstraintAlpha[] = [],
|
|
612
623
|
): void {
|
|
613
624
|
for (const constraint of constraints) {
|
|
625
|
+
assertValidConstraint(constraint, constraintsOnRevert);
|
|
614
626
|
const constraintType = constraint.type;
|
|
615
627
|
switch (constraintType) {
|
|
616
628
|
case "nodeInDocument": {
|
|
617
629
|
const node = getInnerNode(constraint.node);
|
|
618
|
-
const nodeStatus = getKernel(constraint.node).getStatus();
|
|
619
|
-
if (nodeStatus !== TreeStatus.InDocument) {
|
|
620
|
-
const revertText = constraintsOnRevert ? " on revert" : "";
|
|
621
|
-
throw new UsageError(
|
|
622
|
-
`Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
630
|
assert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);
|
|
626
631
|
if (constraintsOnRevert) {
|
|
627
632
|
checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);
|
|
@@ -644,3 +649,31 @@ export function addConstraintsToTransaction(
|
|
|
644
649
|
}
|
|
645
650
|
}
|
|
646
651
|
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Throws if the given {@link TransactionConstraintAlpha | transaction constraint} is not currently satisfied.
|
|
655
|
+
*/
|
|
656
|
+
export function assertValidConstraint(
|
|
657
|
+
constraint: TransactionConstraintAlpha,
|
|
658
|
+
onRevert: boolean,
|
|
659
|
+
): void {
|
|
660
|
+
switch (constraint.type) {
|
|
661
|
+
case "nodeInDocument": {
|
|
662
|
+
const nodeStatus = getKernel(constraint.node).getStatus();
|
|
663
|
+
if (nodeStatus !== TreeStatus.InDocument) {
|
|
664
|
+
const revertText = onRevert ? " on revert" : "";
|
|
665
|
+
throw new UsageError(
|
|
666
|
+
`Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
case "noChange": {
|
|
672
|
+
// This constraint is always satisfied at the time of checking, since it just requires that no changes have been made since the transaction callback returned.
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
default: {
|
|
676
|
+
unreachableCase(constraint);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
@@ -56,10 +56,9 @@ import {
|
|
|
56
56
|
buildForest,
|
|
57
57
|
defaultIncrementalEncodingPolicy,
|
|
58
58
|
defaultSchemaPolicy,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
fieldBatchCodecBuilder,
|
|
60
|
+
forestCodecBuilder,
|
|
61
61
|
jsonableTreeFromFieldCursor,
|
|
62
|
-
makeFieldBatchCodec,
|
|
63
62
|
makeMitigatedChangeFamily,
|
|
64
63
|
makeSchemaCodec,
|
|
65
64
|
makeTreeChunker,
|
|
@@ -241,7 +240,7 @@ export class SharedTreeKernel
|
|
|
241
240
|
schemaCodec,
|
|
242
241
|
options.minVersionForCollab,
|
|
243
242
|
);
|
|
244
|
-
const fieldBatchCodec =
|
|
243
|
+
const fieldBatchCodec = fieldBatchCodecBuilder.build(options);
|
|
245
244
|
|
|
246
245
|
const encoderContext = {
|
|
247
246
|
schema: {
|
|
@@ -255,7 +254,6 @@ export class SharedTreeKernel
|
|
|
255
254
|
const forestSummarizer = new ForestSummarizer(
|
|
256
255
|
forest,
|
|
257
256
|
revisionTagCodec,
|
|
258
|
-
fieldBatchCodec,
|
|
259
257
|
encoderContext,
|
|
260
258
|
options,
|
|
261
259
|
idCompressor,
|
|
@@ -420,7 +418,7 @@ export class SharedTreeKernel
|
|
|
420
418
|
|
|
421
419
|
public override didAttach(): void {
|
|
422
420
|
for (const checkout of this.checkouts.values()) {
|
|
423
|
-
if (checkout.transaction.
|
|
421
|
+
if (checkout.transaction.size > 0) {
|
|
424
422
|
// Attaching during a transaction is not currently supported.
|
|
425
423
|
// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.
|
|
426
424
|
throw new UsageError(
|
|
@@ -438,7 +436,7 @@ export class SharedTreeKernel
|
|
|
438
436
|
): void {
|
|
439
437
|
for (const checkout of this.checkouts.values()) {
|
|
440
438
|
assert(
|
|
441
|
-
|
|
439
|
+
checkout.transaction.size === 0,
|
|
442
440
|
0x674 /* Unexpected transaction is open while applying stashed ops */,
|
|
443
441
|
);
|
|
444
442
|
}
|
|
@@ -453,7 +451,7 @@ export class SharedTreeKernel
|
|
|
453
451
|
): void {
|
|
454
452
|
const checkout = this.getCheckout(branchId);
|
|
455
453
|
assert(
|
|
456
|
-
|
|
454
|
+
checkout.transaction.size === 0,
|
|
457
455
|
0xaa6 /* Cannot submit a commit while a transaction is in progress */,
|
|
458
456
|
);
|
|
459
457
|
if (isResubmit) {
|
|
@@ -596,12 +594,12 @@ export function getCodecTreeForSharedTreeFormat(
|
|
|
596
594
|
clientVersion: MinimumVersionForCollab,
|
|
597
595
|
): CodecTree {
|
|
598
596
|
const children: CodecTree[] = [];
|
|
599
|
-
children.push(
|
|
597
|
+
children.push(forestCodecBuilder.getCodecTree(clientVersion));
|
|
600
598
|
children.push(schemaCodecBuilder.getCodecTree(clientVersion));
|
|
601
599
|
children.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));
|
|
602
600
|
children.push(getCodecTreeForEditManagerFormat(clientVersion));
|
|
603
601
|
children.push(getCodecTreeForMessageFormat(clientVersion));
|
|
604
|
-
children.push(
|
|
602
|
+
children.push(fieldBatchCodecBuilder.getCodecTree(clientVersion));
|
|
605
603
|
return {
|
|
606
604
|
name: "SharedTree",
|
|
607
605
|
version: undefined, // SharedTree does not have a version of its own.
|
package/src/shared-tree/tree.ts
CHANGED
|
@@ -467,7 +467,7 @@ function runTransactionInCheckout<TResult>(
|
|
|
467
467
|
transaction: () => TResult | typeof rollback,
|
|
468
468
|
preconditions: readonly TransactionConstraint[],
|
|
469
469
|
): TResult | typeof rollback {
|
|
470
|
-
checkout.transaction.start(
|
|
470
|
+
checkout.transaction.start();
|
|
471
471
|
addConstraintsToTransaction(checkout, false, preconditions);
|
|
472
472
|
|
|
473
473
|
let result: ReturnType<typeof transaction>;
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
cursorForMapTreeField,
|
|
27
27
|
defaultSchemaPolicy,
|
|
28
28
|
isTreeValue,
|
|
29
|
-
|
|
29
|
+
fieldBatchCodecBuilder,
|
|
30
30
|
mapTreeFromCursor,
|
|
31
31
|
TreeCompressionStrategy,
|
|
32
32
|
type FieldBatch,
|
|
@@ -80,6 +80,7 @@ import {
|
|
|
80
80
|
exportConcise,
|
|
81
81
|
borrowCursorFromTreeNodeOrValue,
|
|
82
82
|
contentSchemaSymbol,
|
|
83
|
+
type TreeContextAlpha,
|
|
83
84
|
type TreeNodeSchema,
|
|
84
85
|
getUnhydratedContext,
|
|
85
86
|
type TreeBranchAlpha,
|
|
@@ -88,6 +89,7 @@ import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js"
|
|
|
88
89
|
|
|
89
90
|
import { independentInitializedView, type ViewContent } from "./independentView.js";
|
|
90
91
|
import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
|
|
92
|
+
import { UnhydratedTreeContext } from "./unhydratedTreeContext.js";
|
|
91
93
|
|
|
92
94
|
const identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined => {
|
|
93
95
|
return getIdentifierFromNode(node, "uncompressed");
|
|
@@ -237,9 +239,17 @@ export interface TreeAlpha {
|
|
|
237
239
|
*
|
|
238
240
|
* This does not fork a new branch, but rather retrieves the _existing_ branch for the node.
|
|
239
241
|
* To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.
|
|
242
|
+
*
|
|
243
|
+
* @deprecated To obtain a {@link TreeBranchAlpha | branch }, use `TreeAlpha.context(node)` to obtain a {@link TreeContextAlpha | context} and then check {@link TreeContextAlpha.isBranch | isBranch()}.
|
|
240
244
|
*/
|
|
241
245
|
branch(node: TreeNode): TreeBranchAlpha | undefined;
|
|
242
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Retrieve the {@link TreeContextAlpha | context} for the given node.
|
|
249
|
+
* @param node - The node to query
|
|
250
|
+
*/
|
|
251
|
+
context(node: TreeNode): TreeContextAlpha;
|
|
252
|
+
|
|
243
253
|
/**
|
|
244
254
|
* Construct tree content that is compatible with the field defined by the provided `schema`.
|
|
245
255
|
* @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
|
|
@@ -587,9 +597,10 @@ export interface ObservationResults<TResult> {
|
|
|
587
597
|
class NodeSubscription {
|
|
588
598
|
/**
|
|
589
599
|
* If undefined, subscribes to all keys.
|
|
600
|
+
* If "deep", subscribes to all changes in the subtree.
|
|
590
601
|
* Otherwise only subscribes to the keys in the set.
|
|
591
602
|
*/
|
|
592
|
-
private keys: Set<FieldKey> | undefined;
|
|
603
|
+
private keys: Set<FieldKey> | undefined | "deep";
|
|
593
604
|
private readonly unsubscribe: () => void;
|
|
594
605
|
private constructor(
|
|
595
606
|
private readonly onInvalidation: () => void,
|
|
@@ -600,6 +611,9 @@ class NodeSubscription {
|
|
|
600
611
|
assert(node instanceof TreeNode, 0xc54 /* Unexpected leaf value */);
|
|
601
612
|
|
|
602
613
|
const handler = (data: NodeChangedData): void => {
|
|
614
|
+
if (this.keys === "deep") {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
603
617
|
if (this.keys === undefined || data.changedProperties === undefined) {
|
|
604
618
|
this.onInvalidation();
|
|
605
619
|
} else {
|
|
@@ -620,7 +634,18 @@ class NodeSubscription {
|
|
|
620
634
|
}
|
|
621
635
|
}
|
|
622
636
|
};
|
|
623
|
-
|
|
637
|
+
|
|
638
|
+
// TODO:Performance: It would be better to defer subscribing to events so that this can subscribe to the correct one instead of both.
|
|
639
|
+
const shallow = TreeBeta.on(node, "nodeChanged", handler);
|
|
640
|
+
const deep = TreeBeta.on(node, "treeChanged", () => {
|
|
641
|
+
if (this.keys === "deep") {
|
|
642
|
+
this.onInvalidation();
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
this.unsubscribe = () => {
|
|
646
|
+
shallow();
|
|
647
|
+
deep();
|
|
648
|
+
};
|
|
624
649
|
}
|
|
625
650
|
|
|
626
651
|
/**
|
|
@@ -632,18 +657,39 @@ class NodeSubscription {
|
|
|
632
657
|
): { observer: Observer; unsubscribe: () => void } {
|
|
633
658
|
const subscriptions = new Map<FlexTreeNode, NodeSubscription>();
|
|
634
659
|
const observer: Observer = {
|
|
660
|
+
observeNodeDeep(flexNode: FlexTreeNode): void {
|
|
661
|
+
if (flexNode.value !== undefined) {
|
|
662
|
+
// Leaf value: the set of fields (and thus their content) is always empty, and cannot change, so no need to subscribe.
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
const subscription = subscriptions.get(flexNode);
|
|
667
|
+
if (subscription === undefined) {
|
|
668
|
+
const newSubscription = new NodeSubscription(invalidate, flexNode);
|
|
669
|
+
newSubscription.keys = "deep";
|
|
670
|
+
subscriptions.set(flexNode, newSubscription);
|
|
671
|
+
} else {
|
|
672
|
+
// Already subscribed to this node.
|
|
673
|
+
subscription.keys = "deep"; // Now subscribed to subtree changes (deep observation).
|
|
674
|
+
}
|
|
675
|
+
},
|
|
635
676
|
observeNodeFields(flexNode: FlexTreeNode): void {
|
|
636
677
|
if (flexNode.value !== undefined) {
|
|
637
|
-
// Leaf value,
|
|
678
|
+
// Leaf value: the set of fields is always empty, and cannot change, so no need to subscribe.
|
|
638
679
|
return;
|
|
639
680
|
}
|
|
681
|
+
|
|
682
|
+
// Subscribe to any change to any field to ensure that any change which empties or fills a field will invalidate.
|
|
683
|
+
// This could be more targeted by detecting specifically edits which change the emptiness of fields if desired.
|
|
640
684
|
const subscription = subscriptions.get(flexNode);
|
|
641
685
|
if (subscription === undefined) {
|
|
642
686
|
const newSubscription = new NodeSubscription(invalidate, flexNode);
|
|
643
687
|
subscriptions.set(flexNode, newSubscription);
|
|
644
688
|
} else {
|
|
645
689
|
// Already subscribed to this node.
|
|
646
|
-
subscription.keys
|
|
690
|
+
if (subscription.keys instanceof Set) {
|
|
691
|
+
subscription.keys = undefined; // Now subscribed to all keys.
|
|
692
|
+
}
|
|
647
693
|
}
|
|
648
694
|
},
|
|
649
695
|
observeNodeField(flexNode: FlexTreeNode, key: FieldKey): void {
|
|
@@ -657,10 +703,12 @@ class NodeSubscription {
|
|
|
657
703
|
newSubscription.keys = new Set([key]);
|
|
658
704
|
subscriptions.set(flexNode, newSubscription);
|
|
659
705
|
} else {
|
|
660
|
-
// Already subscribed to this node: if not subscribed to all keys, subscribe to this one.
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
706
|
+
// Already subscribed to this node: if not subscribed to all keys or "deep", subscribe to this one.
|
|
707
|
+
if (subscription.keys instanceof Set) {
|
|
708
|
+
// TODO:Performance: due to how JavaScript set ordering works,
|
|
709
|
+
// it might be faster to check `has` and only add if not present in case the same field is viewed many times.
|
|
710
|
+
subscription.keys.add(key);
|
|
711
|
+
}
|
|
664
712
|
}
|
|
665
713
|
},
|
|
666
714
|
observeParentOf(node: FlexTreeNode): void {
|
|
@@ -763,6 +811,10 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
763
811
|
return result;
|
|
764
812
|
},
|
|
765
813
|
|
|
814
|
+
context(node: TreeNode): TreeContextAlpha {
|
|
815
|
+
return this.branch(node) ?? UnhydratedTreeContext.instance;
|
|
816
|
+
},
|
|
817
|
+
|
|
766
818
|
branch(node: TreeNode): TreeBranchAlpha | undefined {
|
|
767
819
|
const kernel = getKernel(node);
|
|
768
820
|
if (!kernel.isHydrated()) {
|
|
@@ -852,7 +904,7 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
852
904
|
options: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, "minVersionForCollab">,
|
|
853
905
|
): JsonCompatible<IFluidHandle> {
|
|
854
906
|
const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
|
|
855
|
-
const codec =
|
|
907
|
+
const codec = fieldBatchCodecBuilder.build({
|
|
856
908
|
jsonValidator: FormatValidatorNoOp,
|
|
857
909
|
minVersionForCollab: options.minVersionForCollab,
|
|
858
910
|
});
|
|
@@ -874,7 +926,8 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
874
926
|
schema: { schema: storedSchema, policy: defaultSchemaPolicy },
|
|
875
927
|
};
|
|
876
928
|
const result = codec.encode(batch, context);
|
|
877
|
-
|
|
929
|
+
// TODO: codecs should better track which ones can contain handles, and which cannot. When done properly, casts like this can be removed.
|
|
930
|
+
return result as JsonCompatible<IFluidHandle>;
|
|
878
931
|
},
|
|
879
932
|
|
|
880
933
|
importCompressed<const TSchema extends ImplicitFieldSchema>(
|