@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
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { EncodedFieldBatch
|
|
6
|
+
export type { EncodedFieldBatch } from "./format.js";
|
|
7
|
+
export { FieldBatchFormatVersion } from "./format.js";
|
|
7
8
|
export type { FieldBatch } from "./fieldBatch.js";
|
|
8
9
|
export {
|
|
9
10
|
type FieldBatchCodec,
|
|
10
|
-
|
|
11
|
+
fieldBatchCodecBuilder,
|
|
11
12
|
type FieldBatchEncodingContext,
|
|
12
13
|
type IncrementalEncoderDecoder,
|
|
13
14
|
type IncrementalEncoder,
|
|
14
15
|
type IncrementalDecoder,
|
|
15
16
|
type ChunkReferenceId,
|
|
16
|
-
getCodecTreeForFieldBatchFormat,
|
|
17
17
|
} from "./codecs.js";
|
|
18
18
|
export {
|
|
19
19
|
type IncrementalEncodingPolicy,
|
|
@@ -16,12 +16,11 @@ export {
|
|
|
16
16
|
} from "./chunkTree.js";
|
|
17
17
|
export { buildChunkedForest } from "./chunkedForest.js";
|
|
18
18
|
export {
|
|
19
|
-
EncodedFieldBatch,
|
|
19
|
+
type EncodedFieldBatch,
|
|
20
20
|
FieldBatchFormatVersion,
|
|
21
|
-
getCodecTreeForFieldBatchFormat,
|
|
22
21
|
type FieldBatch,
|
|
23
22
|
type FieldBatchCodec,
|
|
24
|
-
|
|
23
|
+
fieldBatchCodecBuilder,
|
|
25
24
|
type FieldBatchEncodingContext,
|
|
26
25
|
type IncrementalEncoderDecoder,
|
|
27
26
|
type ChunkReferenceId,
|
|
@@ -22,8 +22,25 @@ import type { FlexTreeNode } from "./flexTreeTypes.js";
|
|
|
22
22
|
* See {@link withObservation} and {@link currentObserver}.
|
|
23
23
|
*/
|
|
24
24
|
export interface Observer {
|
|
25
|
+
/**
|
|
26
|
+
* Arbitrary content in `node` subtree might be observed.
|
|
27
|
+
*/
|
|
28
|
+
observeNodeDeep(node: FlexTreeNode): void;
|
|
29
|
+
/**
|
|
30
|
+
* Which fields exist (as non-empty) on `node` is being observed.
|
|
31
|
+
* @remarks
|
|
32
|
+
* The set of fields should be considered order independent.
|
|
33
|
+
*/
|
|
25
34
|
observeNodeFields(node: FlexTreeNode): void;
|
|
35
|
+
/**
|
|
36
|
+
* The contents of the `key` field of `node` are being observed.
|
|
37
|
+
* @remarks
|
|
38
|
+
* Any (shallow) change to which children exist in this field, or in what order should invalidate this observation.
|
|
39
|
+
*/
|
|
26
40
|
observeNodeField(node: FlexTreeNode, key: FieldKey): void;
|
|
41
|
+
/**
|
|
42
|
+
* The parent of `node` is being observed.
|
|
43
|
+
*/
|
|
27
44
|
observeParentOf(node: FlexTreeNode): void;
|
|
28
45
|
}
|
|
29
46
|
|
|
@@ -4,89 +4,79 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
getConfigForMinVersionForCollab,
|
|
10
|
-
lowestMinVersionForCollab,
|
|
11
|
-
} from "@fluidframework/runtime-utils/internal";
|
|
12
|
-
import { Type } from "@sinclair/typebox";
|
|
7
|
+
import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
|
|
13
8
|
|
|
14
9
|
import {
|
|
15
|
-
|
|
10
|
+
ClientVersionDispatchingCodecBuilder,
|
|
11
|
+
type CodecAndSchema,
|
|
16
12
|
type CodecWriteOptions,
|
|
17
13
|
FluidClientVersion,
|
|
18
|
-
type IJsonCodec,
|
|
19
|
-
makeVersionedValidatedCodec,
|
|
20
14
|
} from "../../codec/index.js";
|
|
21
15
|
import type { FieldKey, ITreeCursorSynchronous } from "../../core/index.js";
|
|
22
|
-
import {
|
|
23
|
-
|
|
16
|
+
import {
|
|
17
|
+
fieldBatchCodecBuilder,
|
|
18
|
+
type FieldBatchEncodingContext,
|
|
19
|
+
} from "../chunked-forest/index.js";
|
|
24
20
|
|
|
25
|
-
import { ForestFormatVersion,
|
|
26
|
-
import { FormatV1 } from "./formatV1.js";
|
|
27
|
-
import { FormatV2 } from "./formatV2.js";
|
|
21
|
+
import { ForestFormatVersion, FormatCommon } from "./formatCommon.js";
|
|
28
22
|
|
|
29
23
|
/**
|
|
30
24
|
* Uses field cursors
|
|
31
25
|
*/
|
|
32
26
|
export type FieldSet = ReadonlyMap<FieldKey, ITreeCursorSynchronous>;
|
|
33
|
-
export type ForestCodec =
|
|
34
|
-
FieldSet,
|
|
35
|
-
Format,
|
|
36
|
-
JsonCompatibleReadOnly,
|
|
37
|
-
FieldBatchEncodingContext
|
|
38
|
-
>;
|
|
27
|
+
export type ForestCodec = ReturnType<typeof forestCodecBuilder.build>;
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
* Convert a MinimumVersionForCollab to a ForestFormatVersion.
|
|
42
|
-
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
43
|
-
* @returns The ForestFormatVersion that corresponds to the provided MinimumVersionForCollab.
|
|
44
|
-
*/
|
|
45
|
-
export function clientVersionToForestFormatVersion(
|
|
46
|
-
clientVersion: MinimumVersionForCollab,
|
|
47
|
-
): ForestFormatVersion {
|
|
48
|
-
return brand(
|
|
49
|
-
getConfigForMinVersionForCollab(clientVersion, {
|
|
50
|
-
[lowestMinVersionForCollab]: ForestFormatVersion.v1,
|
|
51
|
-
[FluidClientVersion.v2_74]: ForestFormatVersion.v2,
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function makeForestSummarizerCodec(
|
|
29
|
+
function makeForestSummarizerCodec(
|
|
57
30
|
options: CodecWriteOptions,
|
|
58
|
-
|
|
59
|
-
):
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
67
|
-
encode: (data: FieldSet, context: FieldBatchEncodingContext):
|
|
31
|
+
version: ForestFormatVersion,
|
|
32
|
+
): CodecAndSchema<FieldSet, FieldBatchEncodingContext> {
|
|
33
|
+
// Performance: Since multiple places (including multiple versions of this codec) use the field batch codec,
|
|
34
|
+
// we may end up with multiple copies of it, including compiling its format validation multiple times.
|
|
35
|
+
// This is not ideal, but is not too bad as it is a small fixed number of copies and thus should not be too expensive.
|
|
36
|
+
// If this becomes problematic a cache could be added for options to codec instances somewhere.
|
|
37
|
+
const fieldBatchCodec = fieldBatchCodecBuilder.build(options);
|
|
38
|
+
const formatSchema = FormatCommon;
|
|
39
|
+
return {
|
|
40
|
+
encode: (data: FieldSet, context: FieldBatchEncodingContext): FormatCommon => {
|
|
68
41
|
const keys: FieldKey[] = [];
|
|
69
42
|
const fields: ITreeCursorSynchronous[] = [];
|
|
70
43
|
for (const [key, value] of data) {
|
|
71
44
|
keys.push(key);
|
|
72
45
|
fields.push(value);
|
|
73
46
|
}
|
|
74
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
keys,
|
|
49
|
+
fields: fieldBatchCodec.encode(fields, context),
|
|
50
|
+
version,
|
|
51
|
+
};
|
|
75
52
|
},
|
|
76
|
-
decode: (data:
|
|
53
|
+
decode: (data: FormatCommon, context: FieldBatchEncodingContext): FieldSet => {
|
|
77
54
|
const out: Map<FieldKey, ITreeCursorSynchronous> = new Map();
|
|
78
|
-
const fields =
|
|
55
|
+
const fields = fieldBatchCodec.decode(data.fields, context);
|
|
79
56
|
assert(data.keys.length === fields.length, 0x891 /* mismatched lengths */);
|
|
80
57
|
for (const [index, field] of fields.entries()) {
|
|
81
58
|
out.set(data.keys[index] ?? oob(), field);
|
|
82
59
|
}
|
|
83
60
|
return out;
|
|
84
61
|
},
|
|
85
|
-
|
|
62
|
+
schema: formatSchema,
|
|
63
|
+
};
|
|
86
64
|
}
|
|
87
65
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
/**
|
|
67
|
+
* {@link ClientVersionDispatchingCodecBuilder} for forest summarizer codecs.
|
|
68
|
+
*/
|
|
69
|
+
export const forestCodecBuilder = ClientVersionDispatchingCodecBuilder.build("Forest", [
|
|
70
|
+
{
|
|
71
|
+
minVersionForCollab: lowestMinVersionForCollab,
|
|
72
|
+
formatVersion: ForestFormatVersion.v1,
|
|
73
|
+
codec: (options: CodecWriteOptions) =>
|
|
74
|
+
makeForestSummarizerCodec(options, ForestFormatVersion.v1),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
minVersionForCollab: FluidClientVersion.v2_74,
|
|
78
|
+
formatVersion: ForestFormatVersion.v2,
|
|
79
|
+
codec: (options: CodecWriteOptions) =>
|
|
80
|
+
makeForestSummarizerCodec(options, ForestFormatVersion.v2),
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
@@ -41,18 +41,12 @@ import {
|
|
|
41
41
|
import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
|
|
42
42
|
import {
|
|
43
43
|
defaultIncrementalEncodingPolicy,
|
|
44
|
-
type FieldBatchCodec,
|
|
45
44
|
type FieldBatchEncodingContext,
|
|
46
45
|
type IncrementalEncodingPolicy,
|
|
47
46
|
} from "../chunked-forest/index.js";
|
|
48
47
|
import { TreeCompressionStrategy } from "../treeCompressionUtils.js";
|
|
49
48
|
|
|
50
|
-
import {
|
|
51
|
-
clientVersionToForestFormatVersion,
|
|
52
|
-
type ForestCodec,
|
|
53
|
-
makeForestSummarizerCodec,
|
|
54
|
-
} from "./codec.js";
|
|
55
|
-
import { ForestFormatVersion } from "./formatCommon.js";
|
|
49
|
+
import { forestCodecBuilder, type ForestCodec } from "./codec.js";
|
|
56
50
|
import {
|
|
57
51
|
ForestIncrementalSummaryBehavior,
|
|
58
52
|
ForestIncrementalSummaryBuilder,
|
|
@@ -85,7 +79,6 @@ export class ForestSummarizer
|
|
|
85
79
|
public constructor(
|
|
86
80
|
private readonly forest: IEditableForest,
|
|
87
81
|
private readonly revisionTagCodec: RevisionTagCodec,
|
|
88
|
-
fieldBatchCodec: FieldBatchCodec,
|
|
89
82
|
private readonly encoderContext: FieldBatchEncodingContext,
|
|
90
83
|
options: CodecWriteOptions,
|
|
91
84
|
private readonly idCompressor: IIdCompressor,
|
|
@@ -99,11 +92,8 @@ export class ForestSummarizer
|
|
|
99
92
|
true /* supportPreVersioningFormat */,
|
|
100
93
|
);
|
|
101
94
|
|
|
102
|
-
this.codec =
|
|
95
|
+
this.codec = forestCodecBuilder.build(options);
|
|
103
96
|
|
|
104
|
-
const forestFormatWriteVersion = clientVersionToForestFormatVersion(
|
|
105
|
-
options.minVersionForCollab,
|
|
106
|
-
);
|
|
107
97
|
const summaryFormatWriteVersion = minVersionToForestSummaryFormatVersion(
|
|
108
98
|
options.minVersionForCollab,
|
|
109
99
|
);
|
|
@@ -111,9 +101,10 @@ export class ForestSummarizer
|
|
|
111
101
|
summaryFormatWriteVersion,
|
|
112
102
|
);
|
|
113
103
|
|
|
114
|
-
// Incremental summary is supported
|
|
104
|
+
// Incremental summary is supported in ForestSummaryFormatVersion.v3 onwards.
|
|
105
|
+
// Note that even in versions that support it, it is possible that the
|
|
106
|
+
// FieldBatchCodec will not use incremental encoding (for example if using its v1 formats which does not support it).
|
|
115
107
|
const enableIncrementalSummary =
|
|
116
|
-
forestFormatWriteVersion >= ForestFormatVersion.v2 &&
|
|
117
108
|
summaryFormatWriteVersion >= ForestSummaryFormatVersion.v3 &&
|
|
118
109
|
encoderContext.encodeType === TreeCompressionStrategy.CompressedIncremental;
|
|
119
110
|
this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
+
import { versionField } from "../../codec/index.js";
|
|
8
9
|
import { schemaFormatV1 } from "../../core/index.js";
|
|
9
10
|
import { strictEnum, type Values, JsonCompatibleReadOnlySchema } from "../../util/index.js";
|
|
10
11
|
|
|
@@ -13,26 +14,20 @@ import { strictEnum, type Values, JsonCompatibleReadOnlySchema } from "../../uti
|
|
|
13
14
|
*/
|
|
14
15
|
export const ForestFormatVersion = strictEnum("ForestFormatVersion", {
|
|
15
16
|
v1: 1,
|
|
16
|
-
/** This format
|
|
17
|
+
/** This format is the same as v1, and was added at the same time as incremental encoding for reasons that no longer apply */
|
|
17
18
|
v2: 2,
|
|
18
19
|
});
|
|
19
20
|
export type ForestFormatVersion = Values<typeof ForestFormatVersion>;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
{ additionalProperties: false },
|
|
35
|
-
);
|
|
36
|
-
export type Format<TVersion extends ForestFormatVersion = ForestFormatVersion> = Static<
|
|
37
|
-
ReturnType<typeof FormatCommon<TVersion>>
|
|
38
|
-
>;
|
|
22
|
+
/**
|
|
23
|
+
* Format used by {@link ForestFormatVersion.v1} and {@link ForestFormatVersion.v2}.
|
|
24
|
+
*/
|
|
25
|
+
export const FormatCommon = Type.Object(
|
|
26
|
+
{
|
|
27
|
+
...versionField,
|
|
28
|
+
keys: Type.Array(schemaFormatV1.FieldKeySchema),
|
|
29
|
+
fields: JsonCompatibleReadOnlySchema, // Uses field batch codec
|
|
30
|
+
},
|
|
31
|
+
{ additionalProperties: false },
|
|
32
|
+
);
|
|
33
|
+
export type FormatCommon = Static<typeof FormatCommon>;
|
|
@@ -31,18 +31,6 @@ import type {
|
|
|
31
31
|
|
|
32
32
|
import { summaryContentBlobKey } from "./summaryFormatV3.js";
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* State that tells whether a summary is currently being tracked.
|
|
36
|
-
*/
|
|
37
|
-
export const ForestSummaryTrackingState = {
|
|
38
|
-
/** A summary is currently being tracked. */
|
|
39
|
-
Tracking: "Tracking",
|
|
40
|
-
/** A summary is ready to be tracked. */
|
|
41
|
-
ReadyToTrack: "ReadyToTrack",
|
|
42
|
-
} as const;
|
|
43
|
-
export type ForestSummaryTrackingState =
|
|
44
|
-
(typeof ForestSummaryTrackingState)[keyof typeof ForestSummaryTrackingState];
|
|
45
|
-
|
|
46
34
|
/**
|
|
47
35
|
* The properties of a chunk tracked during the loading process.
|
|
48
36
|
* These are used to identify a chunk when it is decoded and recreate the tracking state
|
|
@@ -144,44 +132,6 @@ export enum ForestIncrementalSummaryBehavior {
|
|
|
144
132
|
SingleBlob,
|
|
145
133
|
}
|
|
146
134
|
|
|
147
|
-
/**
|
|
148
|
-
* Validates that a summary is currently being tracked and that the tracked summary properties are defined.
|
|
149
|
-
* @param forestSummaryState - The current state of the forest summary tracking.
|
|
150
|
-
* @param trackedSummaryProperties - The properties of the tracked summary, which must be available.
|
|
151
|
-
*/
|
|
152
|
-
function validateTrackingSummary(
|
|
153
|
-
forestSummaryState: ForestSummaryTrackingState,
|
|
154
|
-
trackedSummaryProperties: TrackedSummaryProperties | undefined,
|
|
155
|
-
): asserts trackedSummaryProperties is TrackedSummaryProperties {
|
|
156
|
-
assert(
|
|
157
|
-
forestSummaryState === ForestSummaryTrackingState.Tracking,
|
|
158
|
-
0xc22 /* Not tracking a summary */,
|
|
159
|
-
);
|
|
160
|
-
assert(
|
|
161
|
-
trackedSummaryProperties !== undefined,
|
|
162
|
-
0xc23 /* Tracked summary properties must be available when tracking a summary */,
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Validates that a summary is ready to be tracked and that the tracked summary properties are undefined.
|
|
168
|
-
* @param forestSummaryState - The current state of the forest summary tracking.
|
|
169
|
-
* @param trackedSummaryProperties - The properties of the tracked summary, which must be undefined.
|
|
170
|
-
*/
|
|
171
|
-
function validateReadyToTrackSummary(
|
|
172
|
-
forestSummaryState: ForestSummaryTrackingState,
|
|
173
|
-
trackedSummaryProperties: TrackedSummaryProperties | undefined,
|
|
174
|
-
): asserts trackedSummaryProperties is undefined {
|
|
175
|
-
assert(
|
|
176
|
-
forestSummaryState === ForestSummaryTrackingState.ReadyToTrack,
|
|
177
|
-
0xc24 /* Already tracking a summary */,
|
|
178
|
-
);
|
|
179
|
-
assert(
|
|
180
|
-
trackedSummaryProperties === undefined,
|
|
181
|
-
0xc25 /* Tracked summary properties must not be available when ready to track */,
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
135
|
/* eslint-disable jsdoc/check-indentation */
|
|
186
136
|
/**
|
|
187
137
|
* Tracks and builds the incremental summary tree for a forest where chunks that support incremental encoding are
|
|
@@ -235,19 +185,29 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
235
185
|
> = new Map();
|
|
236
186
|
|
|
237
187
|
/**
|
|
238
|
-
*
|
|
188
|
+
* True when encoding a summary, false otherwise.
|
|
189
|
+
* @remarks
|
|
190
|
+
* Exposed for testing purposes.
|
|
239
191
|
*/
|
|
240
|
-
public
|
|
241
|
-
|
|
242
|
-
|
|
192
|
+
public get isSummarizing(): boolean {
|
|
193
|
+
return this.trackedSummaryProperties !== undefined;
|
|
194
|
+
}
|
|
243
195
|
/**
|
|
244
196
|
* The sequence number of the latest summary that was successful.
|
|
245
197
|
*/
|
|
246
198
|
private latestSummarySequenceNumber: number = -1;
|
|
247
199
|
|
|
248
200
|
/**
|
|
249
|
-
* The current state of the summary being tracked.
|
|
250
|
-
*
|
|
201
|
+
* The current state of the summary being "tracked".
|
|
202
|
+
* @remarks
|
|
203
|
+
* A summary being "tracked" means that a summary is being encoded.
|
|
204
|
+
* This is undefined if no summary is currently being encoded.
|
|
205
|
+
*
|
|
206
|
+
* @privateRemarks
|
|
207
|
+
* This has nothing to do which how content from a summary being loaded is tracked (thats written all in chunkTrackingPropertiesMap).
|
|
208
|
+
* "Tracked" should probably be renamed to "encoded" or "summarizing" or something like that to avoid confusion.
|
|
209
|
+
* Perhaps a better way to clarify this would be to not store this property on this object at all, and have it
|
|
210
|
+
* only exist within the scope of the summary encoding (use an encoding specific object to accumulate any stat necessary during encode).
|
|
251
211
|
*/
|
|
252
212
|
private trackedSummaryProperties: TrackedSummaryProperties | undefined;
|
|
253
213
|
|
|
@@ -321,6 +281,15 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
321
281
|
await downloadChunkContentsInTree(forestTree, "");
|
|
322
282
|
}
|
|
323
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Asserts that a summary is currently being tracked and that the tracked summary properties are defined.
|
|
286
|
+
* @returns The properties of the tracked summary.
|
|
287
|
+
*/
|
|
288
|
+
private requireTrackingSummary(): TrackedSummaryProperties {
|
|
289
|
+
assert(this.trackedSummaryProperties !== undefined, 0xc22 /* Not tracking a summary */);
|
|
290
|
+
return this.trackedSummaryProperties;
|
|
291
|
+
}
|
|
292
|
+
|
|
324
293
|
/**
|
|
325
294
|
* Must be called when starting a new forest summary to track it.
|
|
326
295
|
* @param fullTree - Whether the summary is a full tree summary. If true, the summary will not contain
|
|
@@ -336,6 +305,11 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
336
305
|
stringify: SummaryElementStringifier;
|
|
337
306
|
builder: SummaryTreeBuilder;
|
|
338
307
|
}): ForestIncrementalSummaryBehavior {
|
|
308
|
+
assert(
|
|
309
|
+
this.trackedSummaryProperties === undefined,
|
|
310
|
+
0xc24 /* Already tracking a summary */,
|
|
311
|
+
);
|
|
312
|
+
|
|
339
313
|
const { fullTree, incrementalSummaryContext, stringify, builder } = args;
|
|
340
314
|
// If there is no incremental summary context, do not summarize incrementally. This happens in two scenarios:
|
|
341
315
|
// 1. When summarizing a detached container, i.e., the first ever summary.
|
|
@@ -344,9 +318,6 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
344
318
|
return ForestIncrementalSummaryBehavior.SingleBlob;
|
|
345
319
|
}
|
|
346
320
|
|
|
347
|
-
validateReadyToTrackSummary(this.forestSummaryState, this.trackedSummaryProperties);
|
|
348
|
-
|
|
349
|
-
this.forestSummaryState = ForestSummaryTrackingState.Tracking;
|
|
350
321
|
this.latestSummarySequenceNumber = incrementalSummaryContext.latestSummarySequenceNumber;
|
|
351
322
|
this.trackedSummaryProperties = {
|
|
352
323
|
summarySequenceNumber: incrementalSummaryContext.summarySequenceNumber,
|
|
@@ -368,7 +339,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
368
339
|
chunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,
|
|
369
340
|
): ChunkReferenceId[] {
|
|
370
341
|
// Validate that a summary is currently being tracked and that the tracked summary properties are defined.
|
|
371
|
-
|
|
342
|
+
const trackedSummaryProperties = this.requireTrackingSummary();
|
|
372
343
|
|
|
373
344
|
const chunkReferenceIds: ChunkReferenceId[] = [];
|
|
374
345
|
const chunks = this.getChunkAtCursor(cursor);
|
|
@@ -383,12 +354,12 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
383
354
|
this.latestSummarySequenceNumber,
|
|
384
355
|
chunk,
|
|
385
356
|
);
|
|
386
|
-
if (previousChunkProperties !== undefined && !
|
|
357
|
+
if (previousChunkProperties !== undefined && !trackedSummaryProperties.fullTree) {
|
|
387
358
|
chunkProperties = previousChunkProperties;
|
|
388
|
-
|
|
359
|
+
trackedSummaryProperties.parentSummaryBuilder.addHandle(
|
|
389
360
|
`${chunkProperties.referenceId}`,
|
|
390
361
|
SummaryType.Tree,
|
|
391
|
-
`${
|
|
362
|
+
`${trackedSummaryProperties.latestSummaryBasePath}/${chunkProperties.summaryPath}`,
|
|
392
363
|
);
|
|
393
364
|
} else {
|
|
394
365
|
// Generate a new reference ID for the chunk.
|
|
@@ -398,23 +369,23 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
398
369
|
// for the chunk in its summary properties.
|
|
399
370
|
// This is done before encoding the chunk so that the summary path is updated correctly when encoding
|
|
400
371
|
// any incremental chunks that are under this chunk.
|
|
401
|
-
|
|
372
|
+
trackedSummaryProperties.chunkSummaryPath.push(newReferenceId);
|
|
402
373
|
|
|
403
374
|
chunkProperties = {
|
|
404
375
|
referenceId: newReferenceId,
|
|
405
|
-
summaryPath:
|
|
376
|
+
summaryPath: trackedSummaryProperties.chunkSummaryPath.join("/"),
|
|
406
377
|
};
|
|
407
378
|
|
|
408
|
-
const parentSummaryBuilder =
|
|
379
|
+
const parentSummaryBuilder = trackedSummaryProperties.parentSummaryBuilder;
|
|
409
380
|
// Create a new summary builder for this chunk to build its summary tree which will be stored in the
|
|
410
381
|
// parent's summary tree under its reference ID.
|
|
411
382
|
// Before encoding the chunk, set the parent summary builder to this chunk's summary builder so that
|
|
412
383
|
// any incremental chunks in the subtree of this chunk will use that as their parent summary builder.
|
|
413
384
|
const chunkSummaryBuilder = new SummaryTreeBuilder();
|
|
414
|
-
|
|
385
|
+
trackedSummaryProperties.parentSummaryBuilder = chunkSummaryBuilder;
|
|
415
386
|
chunkSummaryBuilder.addBlob(
|
|
416
387
|
summaryContentBlobKey,
|
|
417
|
-
|
|
388
|
+
trackedSummaryProperties.stringify(chunkEncoder(chunk)),
|
|
418
389
|
);
|
|
419
390
|
|
|
420
391
|
// Add this chunk's summary tree to the parent's summary tree. The summary tree contains its encoded
|
|
@@ -425,13 +396,13 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
425
396
|
);
|
|
426
397
|
|
|
427
398
|
// Restore the parent summary builder and chunk summary path.
|
|
428
|
-
|
|
429
|
-
|
|
399
|
+
trackedSummaryProperties.parentSummaryBuilder = parentSummaryBuilder;
|
|
400
|
+
trackedSummaryProperties.chunkSummaryPath.pop();
|
|
430
401
|
}
|
|
431
402
|
|
|
432
403
|
setInNestedMap(
|
|
433
404
|
this.chunkTrackingPropertiesMap,
|
|
434
|
-
|
|
405
|
+
trackedSummaryProperties.summarySequenceNumber,
|
|
435
406
|
chunk,
|
|
436
407
|
chunkProperties,
|
|
437
408
|
);
|
|
@@ -469,7 +440,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
469
440
|
return;
|
|
470
441
|
}
|
|
471
442
|
|
|
472
|
-
|
|
443
|
+
const trackedSummaryProperties = this.requireTrackingSummary();
|
|
473
444
|
|
|
474
445
|
builder.addBlob(forestSummaryRootContentKey, forestSummaryRootContent);
|
|
475
446
|
|
|
@@ -481,7 +452,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
481
452
|
this.latestSummarySequenceNumber,
|
|
482
453
|
);
|
|
483
454
|
const currentSummaryTrackingMap = this.chunkTrackingPropertiesMap.get(
|
|
484
|
-
|
|
455
|
+
trackedSummaryProperties.summarySequenceNumber,
|
|
485
456
|
);
|
|
486
457
|
if (latestSummaryTrackingMap !== undefined && currentSummaryTrackingMap !== undefined) {
|
|
487
458
|
for (const [chunk, chunkProperties] of latestSummaryTrackingMap.entries()) {
|
|
@@ -499,7 +470,6 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
499
470
|
}
|
|
500
471
|
}
|
|
501
472
|
|
|
502
|
-
this.forestSummaryState = ForestSummaryTrackingState.ReadyToTrack;
|
|
503
473
|
this.trackedSummaryProperties = undefined;
|
|
504
474
|
}
|
|
505
475
|
|
|
@@ -11,7 +11,7 @@ export { allowsValue, assertAllowedValue, isTreeValue } from "./valueUtilities.j
|
|
|
11
11
|
|
|
12
12
|
export {
|
|
13
13
|
ForestSummarizer,
|
|
14
|
-
|
|
14
|
+
forestCodecBuilder,
|
|
15
15
|
ForestFormatVersion,
|
|
16
16
|
} from "./forest-summary/index.js";
|
|
17
17
|
export {
|
|
@@ -104,9 +104,8 @@ export {
|
|
|
104
104
|
type FieldBatch,
|
|
105
105
|
type FieldBatchCodec,
|
|
106
106
|
FieldBatchFormatVersion,
|
|
107
|
-
getCodecTreeForFieldBatchFormat,
|
|
108
107
|
makeTreeChunker,
|
|
109
|
-
|
|
108
|
+
fieldBatchCodecBuilder,
|
|
110
109
|
type FieldBatchEncodingContext,
|
|
111
110
|
emptyChunk,
|
|
112
111
|
combineChunks,
|
|
@@ -204,7 +203,6 @@ export {
|
|
|
204
203
|
AnchorTreeIndex,
|
|
205
204
|
hasElement,
|
|
206
205
|
type TreeIndex,
|
|
207
|
-
type TreeIndexKey,
|
|
208
206
|
type TreeIndexNodes,
|
|
209
207
|
} from "./indexing/index.js";
|
|
210
208
|
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import { disposeSymbol, getOrCreate } from "../../util/index.js";
|
|
28
28
|
import { TreeStatus } from "../flex-tree/index.js";
|
|
29
29
|
|
|
30
|
-
import type { TreeIndex,
|
|
30
|
+
import type { TreeIndex, TreeIndexNodes } from "./types.js";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* A function that gets the value to index a node on, must be pure and functional.
|
|
@@ -40,7 +40,7 @@ import type { TreeIndex, TreeIndexKey, TreeIndexNodes } from "./types.js";
|
|
|
40
40
|
* but returns the cursor to the state it was in before being passed to the function. It should also not be disposed by this function
|
|
41
41
|
* and must be disposed elsewhere.
|
|
42
42
|
*/
|
|
43
|
-
export type KeyFinder<TKey
|
|
43
|
+
export type KeyFinder<TKey> = (tree: ITreeSubscriptionCursor) => TKey;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* An index from some arbitrary keys to anchor nodes. Keys can be anything that is a {@link TreeValue}.
|
|
@@ -50,9 +50,7 @@ export type KeyFinder<TKey extends TreeIndexKey> = (tree: ITreeSubscriptionCurso
|
|
|
50
50
|
* Detached nodes are stored in the index but filtered out when any public facing apis are called. This means that
|
|
51
51
|
* calling {@link keys} will not include any keys that are stored in the index but only map to detached nodes.
|
|
52
52
|
*/
|
|
53
|
-
export class AnchorTreeIndex<TKey
|
|
54
|
-
implements TreeIndex<TKey, TValue>
|
|
55
|
-
{
|
|
53
|
+
export class AnchorTreeIndex<TKey, TValue> implements TreeIndex<TKey, TValue> {
|
|
56
54
|
public disposed = false;
|
|
57
55
|
/**
|
|
58
56
|
* Caches {@link KeyFinder}s for each schema definition. If a schema maps to null, it does not
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
-
|
|
8
6
|
/**
|
|
9
7
|
* an array of nodes that is guaranteed to have at least one element
|
|
10
8
|
*
|
|
@@ -13,25 +11,25 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
13
11
|
export type TreeIndexNodes<TNode> = readonly [first: TNode, ...rest: TNode[]];
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* An index allows lookup content from a tree using keys.
|
|
15
|
+
* @remarks
|
|
16
|
+
* The index will be kept up to date with the {@link TreeBranchAlpha} it is associated with.
|
|
17
|
+
* Keeping an index up to date incurs overhead.
|
|
18
|
+
* Therefore, indexes should only be created when needed and disposed when no longer needed.
|
|
18
19
|
* @privateRemarks
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A index where values are keyed on {@link TreeIndexKey}s.
|
|
28
|
-
*
|
|
20
|
+
* We have various disposable interfaces. Perhaps this should extend one.
|
|
21
|
+
* Currently all of these indexes are generated on load and exist only in memory (do not persist anything to the document).
|
|
22
|
+
* In the future, we may want to support indexes which persist some content, allowing them to be kept up to date when when only loading part of a tree.
|
|
23
|
+
* Since currently partially loading a tree is not supported, there is no need for this.
|
|
24
|
+
* At some point the low level shared tree index type for persisted indexes could be leveraged to provide user facing extensible sets of persisted indexes.
|
|
25
|
+
* @sealed
|
|
29
26
|
* @alpha
|
|
30
27
|
*/
|
|
31
|
-
export interface TreeIndex<TKey extends
|
|
32
|
-
extends ReadonlyMap<TKey, TValue> {
|
|
28
|
+
export interface TreeIndex<TKey, TValue> extends ReadonlyMap<TKey, TValue> {
|
|
33
29
|
/**
|
|
34
|
-
* Disposes the index such that it can no longer be used and receives no updates
|
|
30
|
+
* Disposes the index such that it can no longer be used and receives no updates for changes in the tree.
|
|
31
|
+
* @remarks
|
|
32
|
+
* An index may not be used after it is disposed.
|
|
35
33
|
*/
|
|
36
34
|
dispose(): void;
|
|
37
35
|
}
|