@fluidframework/tree 2.110.0 → 2.111.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 +1 -0
- package/CHANGELOG.md +48 -0
- package/api-report/tree.alpha.api.md +48 -31
- package/api-report/tree.beta.api.md +38 -0
- package/api-report/tree.legacy.beta.api.md +38 -0
- package/dist/core/change-family/changeFamily.d.ts +3 -10
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/rebase/types.d.ts +2 -2
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +83 -9
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.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 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -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.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +4 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +5 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +5 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +7 -4
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/dist/shared-tree/transactionPostProcessor.js +28 -0
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
- package/dist/shared-tree/treeAlpha.js +3 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +16 -12
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +18 -9
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +1 -1
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +3 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +84 -9
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +74 -7
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactory.js +2 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
- 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 +91 -28
- 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 +86 -22
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
- package/dist/simple-tree/core/treeNodeSchema.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.map +1 -1
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +69 -758
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +275 -322
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +273 -0
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/dist/text/textDomainFormattedDefault.js +94 -0
- package/dist/text/textDomainFormattedDefault.js.map +1 -0
- package/dist/util/compressedIds.d.ts +118 -0
- package/dist/util/compressedIds.d.ts.map +1 -0
- package/dist/util/compressedIds.js +133 -0
- package/dist/util/compressedIds.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +9 -1
- package/dist/util/index.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +3 -10
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/rebase/types.d.ts +2 -2
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +82 -9
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.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/forest-summary/codec.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -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.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +5 -8
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +5 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +5 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +8 -5
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
- package/lib/shared-tree/transactionPostProcessor.js +23 -0
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
- package/lib/shared-tree/treeAlpha.js +3 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +16 -12
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +18 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
- package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +1 -1
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +1 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +3 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +84 -9
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +73 -6
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
- 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 +91 -28
- 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 +86 -22
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
- package/lib/simple-tree/core/treeNodeSchema.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.map +1 -1
- package/lib/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +69 -758
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +277 -324
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +273 -0
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
- package/lib/text/textDomainFormattedDefault.js +91 -0
- package/lib/text/textDomainFormattedDefault.js.map +1 -0
- package/lib/util/compressedIds.d.ts +118 -0
- package/lib/util/compressedIds.d.ts.map +1 -0
- package/lib/util/compressedIds.js +124 -0
- package/lib/util/compressedIds.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/package.json +23 -23
- package/src/core/change-family/changeFamily.ts +3 -12
- package/src/core/rebase/types.ts +2 -2
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
- package/src/entrypoints/alpha.ts +12 -8
- package/src/entrypoints/beta.ts +8 -0
- package/src/entrypoints/legacy.ts +8 -0
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +35 -64
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +138 -42
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
- package/src/feature-libraries/chunked-forest/index.ts +3 -0
- package/src/feature-libraries/forest-summary/codec.ts +5 -3
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
- package/src/feature-libraries/index.ts +3 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
- package/src/index.ts +13 -8
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -10
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizingTreeView.ts +25 -25
- package/src/shared-tree/sharedTree.ts +16 -4
- package/src/shared-tree/transactionPostProcessor.ts +40 -0
- package/src/shared-tree/treeAlpha.ts +3 -3
- package/src/shared-tree/treeCheckout.ts +61 -44
- package/src/shared-tree/unhydratedTreeContext.ts +18 -15
- package/src/shared-tree-core/editManagerCodecs.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
- package/src/shared-tree-core/index.ts +8 -5
- package/src/shared-tree-core/sharedTreeCore.ts +3 -2
- package/src/shared-tree-core/transaction.ts +148 -18
- package/src/simple-tree/api/index.ts +13 -9
- package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
- package/src/simple-tree/api/schemaFactory.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -2
- package/src/simple-tree/api/transactionTypes.ts +111 -39
- package/src/simple-tree/api/tree.ts +141 -47
- package/src/simple-tree/api/treeBeta.ts +2 -0
- package/src/simple-tree/core/treeNodeSchema.ts +7 -7
- package/src/simple-tree/index.ts +12 -8
- package/src/text/index.ts +1 -0
- package/src/text/textDomainFormatted.ts +520 -415
- package/src/text/textDomainFormattedDefault.ts +150 -0
- package/src/util/compressedIds.ts +216 -0
- package/src/util/index.ts +15 -0
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
SchemaAndPolicy,
|
|
14
14
|
} from "../core/index.js";
|
|
15
15
|
import {
|
|
16
|
+
type IdentifierHealingConfig,
|
|
16
17
|
type JsonCompatibleReadOnly,
|
|
17
18
|
type JsonCompatibleReadOnlyObject,
|
|
18
19
|
JsonCompatibleReadOnlySchema,
|
|
@@ -26,8 +27,8 @@ export interface EditManagerEncodingContext {
|
|
|
26
27
|
idCompressor: IIdCompressor;
|
|
27
28
|
readonly schema?: SchemaAndPolicy;
|
|
28
29
|
readonly isSummary: boolean;
|
|
29
|
-
|
|
30
|
-
readonly
|
|
30
|
+
/** See {@link IdentifierHealingConfig}. */
|
|
31
|
+
readonly healing?: IdentifierHealingConfig;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
SchemaAndPolicy,
|
|
15
15
|
} from "../core/index.js";
|
|
16
16
|
import {
|
|
17
|
+
type IdentifierHealingConfig,
|
|
17
18
|
type JsonCompatibleReadOnly,
|
|
18
19
|
type JsonCompatibleReadOnlyObject,
|
|
19
20
|
JsonCompatibleReadOnlySchema,
|
|
@@ -30,8 +31,8 @@ export interface EditManagerEncodingContext {
|
|
|
30
31
|
idCompressor: IIdCompressor;
|
|
31
32
|
readonly schema?: SchemaAndPolicy;
|
|
32
33
|
readonly isSummary: boolean;
|
|
33
|
-
|
|
34
|
-
readonly
|
|
34
|
+
/** See {@link IdentifierHealingConfig}. */
|
|
35
|
+
readonly healing?: IdentifierHealingConfig;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export function makeSharedBranchesCodecWithVersion<TChangeset>(
|
|
@@ -16,7 +16,7 @@ import type { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal"
|
|
|
16
16
|
|
|
17
17
|
import type { IJsonCodec } from "../codec/index.js";
|
|
18
18
|
import type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from "../core/index.js";
|
|
19
|
-
import type { JsonCompatibleReadOnly } from "../util/index.js";
|
|
19
|
+
import type { IdentifierHealingConfig, JsonCompatibleReadOnly } from "../util/index.js";
|
|
20
20
|
|
|
21
21
|
import type { EditManager, SummaryData } from "./editManager.js";
|
|
22
22
|
import type { EditManagerEncodingContext } from "./editManagerCodecs.js";
|
|
@@ -85,10 +85,8 @@ export class EditManagerSummarizer<TChangeset>
|
|
|
85
85
|
private readonly idCompressor: IIdCompressor,
|
|
86
86
|
minVersionForCollab: MinimumVersionForCollab,
|
|
87
87
|
private readonly schemaAndPolicy?: SchemaAndPolicy,
|
|
88
|
-
/** See {@link
|
|
89
|
-
private readonly
|
|
90
|
-
/** See {@link EditManagerEncodingContext.sharedObjectId}. */
|
|
91
|
-
private readonly sharedObjectId?: string,
|
|
88
|
+
/** See {@link IdentifierHealingConfig}. */
|
|
89
|
+
private readonly healing?: IdentifierHealingConfig,
|
|
92
90
|
) {
|
|
93
91
|
super(
|
|
94
92
|
EditManagerSummarizer.key,
|
|
@@ -111,8 +109,7 @@ export class EditManagerSummarizer<TChangeset>
|
|
|
111
109
|
idCompressor: this.idCompressor,
|
|
112
110
|
schema: this.schemaAndPolicy,
|
|
113
111
|
isSummary: true,
|
|
114
|
-
|
|
115
|
-
sharedObjectId: this.sharedObjectId,
|
|
112
|
+
healing: this.healing,
|
|
116
113
|
};
|
|
117
114
|
const jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);
|
|
118
115
|
const dataString = stringify(jsonCompatible);
|
|
@@ -137,8 +134,7 @@ export class EditManagerSummarizer<TChangeset>
|
|
|
137
134
|
const data = this.codec.decode(summary, {
|
|
138
135
|
idCompressor: this.idCompressor,
|
|
139
136
|
isSummary: true,
|
|
140
|
-
|
|
141
|
-
sharedObjectId: this.sharedObjectId,
|
|
137
|
+
healing: this.healing,
|
|
142
138
|
});
|
|
143
139
|
this.editManager.loadSummaryData(data);
|
|
144
140
|
}
|
|
@@ -12,13 +12,16 @@ export {
|
|
|
12
12
|
} from "./branch.js";
|
|
13
13
|
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
type
|
|
15
|
+
type ChangeProcessor,
|
|
16
|
+
type OnPop,
|
|
17
|
+
type OnPush,
|
|
18
|
+
type SquashingTransactionOptions,
|
|
17
19
|
type TransactionEvents,
|
|
18
|
-
|
|
20
|
+
type Transactor,
|
|
21
|
+
ChangeProcessorApplicability,
|
|
19
22
|
SquashingTransactionStack,
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
TransactionResult,
|
|
24
|
+
TransactionStack,
|
|
22
25
|
} from "./transaction.js";
|
|
23
26
|
|
|
24
27
|
export {
|
|
@@ -197,8 +197,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
197
197
|
this.idCompressor,
|
|
198
198
|
options.minVersionForCollab,
|
|
199
199
|
this.schemaAndPolicy,
|
|
200
|
-
options.healUnresolvableIdentifiersOnDecode
|
|
201
|
-
|
|
200
|
+
options.healUnresolvableIdentifiersOnDecode === true
|
|
201
|
+
? { sharedObjectId: sharedObject.id }
|
|
202
|
+
: undefined,
|
|
202
203
|
),
|
|
203
204
|
...summarizables,
|
|
204
205
|
];
|
|
@@ -40,15 +40,17 @@ export enum TransactionResult {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* A simple API for managing transactions.
|
|
43
|
+
* @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
|
|
43
44
|
*/
|
|
44
|
-
export interface Transactor {
|
|
45
|
+
export interface Transactor<TOptions> {
|
|
45
46
|
/**
|
|
46
47
|
* Start a new transaction.
|
|
48
|
+
* @param options - Options controlling how the transaction is committed.
|
|
47
49
|
* @remarks
|
|
48
50
|
* If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
|
|
49
51
|
* i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
|
|
50
52
|
*/
|
|
51
|
-
start(): void;
|
|
53
|
+
start(options?: TOptions): void;
|
|
52
54
|
/**
|
|
53
55
|
* Close this transaction by squashing its edits and committing them as a single edit.
|
|
54
56
|
* @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
|
|
@@ -89,8 +91,9 @@ export interface TransactionEvents {
|
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
93
|
* Callbacks for transaction lifecycle events.
|
|
94
|
+
* @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
|
|
92
95
|
*/
|
|
93
|
-
export interface Callbacks {
|
|
96
|
+
export interface Callbacks<TOptions> {
|
|
94
97
|
/**
|
|
95
98
|
* Called when the current transaction is popped from the {@link TransactionStack | stack}.
|
|
96
99
|
*/
|
|
@@ -104,37 +107,42 @@ export interface Callbacks {
|
|
|
104
107
|
* Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.
|
|
105
108
|
* The event "bubbles up" to (and no further past) its first registered callback.
|
|
106
109
|
*/
|
|
107
|
-
readonly onPush?: OnPush
|
|
110
|
+
readonly onPush?: OnPush<TOptions>;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
/**
|
|
111
114
|
* A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
|
|
112
115
|
* @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.
|
|
113
116
|
* This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
|
|
117
|
+
* @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
|
|
118
|
+
* @param options - The options passed to {@link Transactor.start | start}.
|
|
114
119
|
*/
|
|
115
|
-
export type OnPush = () => Callbacks | void;
|
|
120
|
+
export type OnPush<TOptions> = (options?: TOptions) => Callbacks<TOptions> | void;
|
|
116
121
|
|
|
117
122
|
/**
|
|
118
123
|
* A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.
|
|
119
124
|
* @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
|
|
125
|
+
* @param result - The result of the transaction.
|
|
120
126
|
*/
|
|
121
127
|
export type OnPop = (result: TransactionResult) => void;
|
|
122
128
|
|
|
123
129
|
/**
|
|
124
130
|
* A frame in the transaction stack.
|
|
131
|
+
* @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
|
|
125
132
|
*/
|
|
126
|
-
interface TransactionStackFrame {
|
|
133
|
+
interface TransactionStackFrame<TOptions> {
|
|
127
134
|
/** The callbacks provided when this transaction frame was pushed onto the stack. */
|
|
128
|
-
readonly callbacks: Callbacks
|
|
135
|
+
readonly callbacks: Callbacks<TOptions>;
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
/**
|
|
132
139
|
* An implementation of {@link Transactor} that uses a stack to manage transactions.
|
|
133
140
|
* @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.
|
|
141
|
+
* @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.
|
|
134
142
|
*/
|
|
135
|
-
export class TransactionStack implements Transactor
|
|
136
|
-
readonly #stack: TransactionStackFrame[] = [];
|
|
137
|
-
readonly #onPush?: OnPush
|
|
143
|
+
export class TransactionStack<TOptions> implements Transactor<TOptions>, IDisposable {
|
|
144
|
+
readonly #stack: TransactionStackFrame<TOptions>[] = [];
|
|
145
|
+
readonly #onPush?: OnPush<TOptions>;
|
|
138
146
|
|
|
139
147
|
readonly #events = createEmitter<TransactionEvents>();
|
|
140
148
|
public get events(): Listenable<TransactionEvents> {
|
|
@@ -150,7 +158,7 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
150
158
|
* Construct a new {@link TransactionStack}.
|
|
151
159
|
* @param onPush - A {@link OnPush | function} that will be called when a transaction begins.
|
|
152
160
|
*/
|
|
153
|
-
public constructor(onPush?: OnPush) {
|
|
161
|
+
public constructor(onPush?: OnPush<TOptions>) {
|
|
154
162
|
this.#onPush = onPush;
|
|
155
163
|
}
|
|
156
164
|
|
|
@@ -159,11 +167,11 @@ export class TransactionStack implements Transactor, IDisposable {
|
|
|
159
167
|
return this.#stack.length;
|
|
160
168
|
}
|
|
161
169
|
|
|
162
|
-
public start(): void {
|
|
170
|
+
public start(options?: TOptions): void {
|
|
163
171
|
this.ensureNotDisposed();
|
|
164
172
|
const last = getLast(this.#stack);
|
|
165
173
|
const onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;
|
|
166
|
-
const { onPush, onPop } = onPushCurrent?.() ?? {};
|
|
174
|
+
const { onPush, onPop } = onPushCurrent?.(options) ?? {};
|
|
167
175
|
this.#stack.push({
|
|
168
176
|
callbacks: { onPop, onPush: onPush ?? onPushCurrent },
|
|
169
177
|
});
|
|
@@ -216,6 +224,73 @@ export type OnPopWithViewUpdate<TChange> = (
|
|
|
216
224
|
viewUpdate: TChange | undefined,
|
|
217
225
|
) => void;
|
|
218
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Informs the caller of {@link ChangeProcessor} what context it should be invoked for.
|
|
229
|
+
* @remarks This is purely a recommendation to the caller of the processor and
|
|
230
|
+
* not a strict rule.
|
|
231
|
+
*/
|
|
232
|
+
export enum ChangeProcessorApplicability {
|
|
233
|
+
/**
|
|
234
|
+
* Invoke the processor if no later (outer) instance of this change processor
|
|
235
|
+
* may be applied to related changes before changes are "visible".
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* This designation is meant for processors that only need to be applied
|
|
239
|
+
* once to a set of related changes independent of scope or nesting,
|
|
240
|
+
* with the understanding that the processor should still be applied no
|
|
241
|
+
* later than when the changes are "visible" (e.g. committed to a branch).
|
|
242
|
+
* For example, a processor that removes extraneous information from a
|
|
243
|
+
* change (e.g. data for nodes that were both created and removed within a
|
|
244
|
+
* transaction) only needs to be applied once to the squashed change
|
|
245
|
+
* produced by the outermost transaction.
|
|
246
|
+
*/
|
|
247
|
+
IfOutermost,
|
|
248
|
+
/**
|
|
249
|
+
* Invoke the processor in all contexts.
|
|
250
|
+
*/
|
|
251
|
+
Always,
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Processes a change altering its representation.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* A change processor receives a change and returns a change with the
|
|
259
|
+
* same observable effect but otherwise transformed.
|
|
260
|
+
*
|
|
261
|
+
* Currently this is the internal counterpart of the type-erased post-processor
|
|
262
|
+
* exposed on the public transaction API. The public boundary type-erases this
|
|
263
|
+
* (see the conversion helpers in the `shared-tree` layer) so that its internal
|
|
264
|
+
* change representation does not leak into the public API.
|
|
265
|
+
*/
|
|
266
|
+
export interface ChangeProcessor<TChange> {
|
|
267
|
+
/**
|
|
268
|
+
* Informs what context it should be invoked for.
|
|
269
|
+
*/
|
|
270
|
+
readonly applicability: ChangeProcessorApplicability;
|
|
271
|
+
/**
|
|
272
|
+
* Processes the given change, returning a change with the same observable effect.
|
|
273
|
+
*/
|
|
274
|
+
readonly processChange: (change: TChange) => TChange;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Options for {@link Transactor.start | starting} a transaction.
|
|
279
|
+
*/
|
|
280
|
+
export interface SquashingTransactionOptions<TChange> {
|
|
281
|
+
/**
|
|
282
|
+
* An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started
|
|
283
|
+
* with this option is committed.
|
|
284
|
+
*
|
|
285
|
+
* @remarks
|
|
286
|
+
* When omitted, the transaction's edits are squashed without any post-processing.
|
|
287
|
+
*
|
|
288
|
+
* How often the processor is invoked across nested transactions is governed by its
|
|
289
|
+
* {@link ChangeProcessor.applicability | applicability}.
|
|
290
|
+
*/
|
|
291
|
+
readonly postProcessor?: ChangeProcessor<TChange>;
|
|
292
|
+
}
|
|
293
|
+
|
|
219
294
|
/**
|
|
220
295
|
* An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.
|
|
221
296
|
* @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.
|
|
@@ -225,7 +300,7 @@ export type OnPopWithViewUpdate<TChange> = (
|
|
|
225
300
|
export class SquashingTransactionStack<
|
|
226
301
|
TEditor extends ChangeFamilyEditor,
|
|
227
302
|
TChange,
|
|
228
|
-
> extends TransactionStack {
|
|
303
|
+
> extends TransactionStack<SquashingTransactionOptions<TChange>> {
|
|
229
304
|
#transactionBranch?: SharedTreeBranch<TEditor, TChange>;
|
|
230
305
|
|
|
231
306
|
/**
|
|
@@ -284,15 +359,41 @@ export class SquashingTransactionStack<
|
|
|
284
359
|
* Construct a new {@link SquashingTransactionStack}.
|
|
285
360
|
* @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.
|
|
286
361
|
* @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
|
|
362
|
+
* @remarks To post-process the squashed change produced when a transaction is committed (for example, to "minimize"
|
|
363
|
+
* it so that it contains no extraneous information), start the transaction with a
|
|
364
|
+
* {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction
|
|
365
|
+
* options rather than baked into this stack, so different transactions may supply different post-processors (or none).
|
|
287
366
|
*/
|
|
288
367
|
public constructor(
|
|
289
368
|
public readonly branch: SharedTreeBranch<TEditor, TChange>,
|
|
290
369
|
mintRevisionTag: () => RevisionTag,
|
|
291
370
|
onPush?: () => OnPopWithViewUpdate<TChange> | void,
|
|
292
371
|
) {
|
|
372
|
+
// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to
|
|
373
|
+
// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it
|
|
374
|
+
// commits, or `undefined` when none should be applied.
|
|
375
|
+
const postProcessorStack: (ChangeProcessor<TChange> | undefined)[] = [];
|
|
376
|
+
// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).
|
|
377
|
+
// A processor with "outermost" applicability that is already active in an enclosing transaction resolves to
|
|
378
|
+
// `undefined` so that it is only applied once (at the outermost transaction that supplied it).
|
|
379
|
+
const resolvePostProcessor = (
|
|
380
|
+
requested: ChangeProcessor<TChange> | undefined,
|
|
381
|
+
): ChangeProcessor<TChange> | undefined => {
|
|
382
|
+
if (
|
|
383
|
+
requested?.applicability === ChangeProcessorApplicability.IfOutermost &&
|
|
384
|
+
postProcessorStack.includes(requested)
|
|
385
|
+
) {
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
return requested;
|
|
389
|
+
};
|
|
390
|
+
|
|
293
391
|
super(
|
|
294
392
|
// Invoked when an outer transaction starts
|
|
295
|
-
(
|
|
393
|
+
(
|
|
394
|
+
startOptions?: SquashingTransactionOptions<TChange>,
|
|
395
|
+
): Callbacks<SquashingTransactionOptions<TChange>> => {
|
|
396
|
+
postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
|
|
296
397
|
// Keep track of the commit that each transaction was on when it started
|
|
297
398
|
const startHead = this.activeBranch.getHead();
|
|
298
399
|
const rebaser = this.branch.changeFamily.rebaser;
|
|
@@ -309,6 +410,7 @@ export class SquashingTransactionStack<
|
|
|
309
410
|
// Invoked when an outer transaction ends
|
|
310
411
|
const onOuterTransactionPop: OnPop = (result) => {
|
|
311
412
|
assert(this.size === 0, 0xcae /* The outer transaction should be ending */);
|
|
413
|
+
const postProcessor = postProcessorStack.pop();
|
|
312
414
|
transactionBranch.editor.exitTransaction();
|
|
313
415
|
|
|
314
416
|
const sourcePath: GraphCommit<TChange>[] = [];
|
|
@@ -357,16 +459,20 @@ export class SquashingTransactionStack<
|
|
|
357
459
|
}
|
|
358
460
|
// Squash all the new commits on the transaction branch into a new commit on the original branch
|
|
359
461
|
const squash = rebaser.compose(transactionSteps);
|
|
462
|
+
// Apply this transaction's post-processor (if any) to the squashed change (for example, to
|
|
463
|
+
// "minimize" it so that it contains no extraneous information).
|
|
464
|
+
const change =
|
|
465
|
+
postProcessor === undefined ? squash : postProcessor.processChange(squash);
|
|
360
466
|
|
|
361
467
|
if (targetPath.length === 0) {
|
|
362
468
|
// No changes were made on the original branch since the transaction began
|
|
363
469
|
// The transaction commit can be applied directly
|
|
364
|
-
this.branch.apply(tagChange(
|
|
470
|
+
this.branch.apply(tagChange(change, transactionRevision));
|
|
365
471
|
// The view is already up-to-date so there's nothing more to do
|
|
366
472
|
} else {
|
|
367
473
|
// Some changes were made on `branch` since the transaction began
|
|
368
474
|
const unrebasedHead = mintCommit(startHead, {
|
|
369
|
-
change
|
|
475
|
+
change,
|
|
370
476
|
revision: transactionRevision,
|
|
371
477
|
});
|
|
372
478
|
// We need to rebase the transaction commit on top of the new changes
|
|
@@ -407,13 +513,17 @@ export class SquashingTransactionStack<
|
|
|
407
513
|
outerOnPop?.(result, viewUpdate);
|
|
408
514
|
};
|
|
409
515
|
// Invoked when a nested transaction begins
|
|
410
|
-
const onNestedTransactionPush: OnPush = (
|
|
516
|
+
const onNestedTransactionPush: OnPush<SquashingTransactionOptions<TChange>> = (
|
|
517
|
+
nestedStartOptions,
|
|
518
|
+
) => {
|
|
519
|
+
postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
|
|
411
520
|
const nestedStartHead = this.activeBranch.getHead();
|
|
412
521
|
const nestedOuterOnPop = onPush?.();
|
|
413
522
|
transactionBranch.editor.enterTransaction();
|
|
414
523
|
return {
|
|
415
524
|
// Invoked when a nested transaction ends
|
|
416
525
|
onPop: (result) => {
|
|
526
|
+
const nestedPostProcessor = postProcessorStack.pop();
|
|
417
527
|
transactionBranch.editor.exitTransaction();
|
|
418
528
|
switch (result) {
|
|
419
529
|
case TransactionResult.Abort: {
|
|
@@ -422,6 +532,26 @@ export class SquashingTransactionStack<
|
|
|
422
532
|
break;
|
|
423
533
|
}
|
|
424
534
|
case TransactionResult.Commit: {
|
|
535
|
+
// When this nested transaction supplied a post-processor that should be applied here, squash its
|
|
536
|
+
// edits into a single (post-processed) commit on the transaction branch rather than leaving them to
|
|
537
|
+
// be squashed only when the outermost transaction is committed.
|
|
538
|
+
if (nestedPostProcessor !== undefined) {
|
|
539
|
+
const nestedSteps: GraphCommit<TChange>[] = [];
|
|
540
|
+
findAncestor(
|
|
541
|
+
[transactionBranch.getHead(), nestedSteps],
|
|
542
|
+
(c) => c === nestedStartHead,
|
|
543
|
+
);
|
|
544
|
+
if (nestedSteps.length > 0) {
|
|
545
|
+
assert(
|
|
546
|
+
transactionRevision !== undefined,
|
|
547
|
+
0xd07 /* Expected transaction revision in the presence of transaction steps */,
|
|
548
|
+
);
|
|
549
|
+
const squash = rebaser.compose(nestedSteps);
|
|
550
|
+
const processedSquash = nestedPostProcessor.processChange(squash);
|
|
551
|
+
transactionBranch.removeAfter(nestedStartHead);
|
|
552
|
+
transactionBranch.apply(tagChange(processedSquash, transactionRevision));
|
|
553
|
+
}
|
|
554
|
+
}
|
|
425
555
|
break;
|
|
426
556
|
}
|
|
427
557
|
default: {
|
|
@@ -179,19 +179,23 @@ export {
|
|
|
179
179
|
} from "./storedSchema.js";
|
|
180
180
|
|
|
181
181
|
export {
|
|
182
|
+
type NoChangeConstraint,
|
|
183
|
+
type NodeInDocumentConstraint,
|
|
184
|
+
rollback,
|
|
185
|
+
type RunTransactionParamsAlpha,
|
|
186
|
+
type RunTransactionParamsBeta,
|
|
187
|
+
type TransactionCallbackStatusAlpha,
|
|
188
|
+
type TransactionCallbackStatusBeta,
|
|
182
189
|
type TransactionConstraint,
|
|
183
190
|
type TransactionConstraintAlpha,
|
|
184
|
-
type
|
|
185
|
-
type NoChangeConstraint,
|
|
186
|
-
type RunTransactionParams,
|
|
187
|
-
type VoidTransactionCallbackStatus,
|
|
188
|
-
type TransactionCallbackStatus,
|
|
189
|
-
type TransactionResult,
|
|
190
|
-
type TransactionResultExt,
|
|
191
|
-
type TransactionResultSuccess,
|
|
191
|
+
type TransactionPostProcessor,
|
|
192
192
|
type TransactionResultFailed,
|
|
193
|
+
type TransactionResultSuccess,
|
|
194
|
+
type TransactionValueResult,
|
|
195
|
+
type TransactionVoidResult,
|
|
196
|
+
type VoidTransactionCallbackStatusAlpha,
|
|
197
|
+
type VoidTransactionCallbackStatusBeta,
|
|
193
198
|
type WithValue,
|
|
194
|
-
rollback,
|
|
195
199
|
} from "./transactionTypes.js";
|
|
196
200
|
|
|
197
201
|
export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
|
|
@@ -78,7 +78,7 @@ export function singletonSchema<TScope extends string, TName extends string | nu
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* Converts an enum into a collection of
|
|
81
|
+
* Converts an enum into a collection of schemas which can be used in a union.
|
|
82
82
|
*
|
|
83
83
|
* @typeParam TScope - The scope of the provided factory.
|
|
84
84
|
* There is a known issue where if a factory is provided that is typed as a {@link SchemaFactoryAlpha}, and its scope contains a "." character,
|
|
@@ -88,7 +88,7 @@ export function singletonSchema<TScope extends string, TName extends string | nu
|
|
|
88
88
|
* @remarks
|
|
89
89
|
* The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
|
|
90
90
|
* Numeric enums values have the value implicitly converted into a string.
|
|
91
|
-
* Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other
|
|
91
|
+
* Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schemas.
|
|
92
92
|
* @example
|
|
93
93
|
* ```typescript
|
|
94
94
|
* const schemaFactory = new SchemaFactory("com.myApp");
|
|
@@ -213,7 +213,7 @@ export function enumEntries(
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* Converts an array of distinct strings into a collection of
|
|
216
|
+
* Converts an array of distinct strings into a collection of schemas which can be used like an enum style union.
|
|
217
217
|
* @remarks
|
|
218
218
|
* The returned collection is also a function which can be used to convert strings into {@link Unhydrated} nodes in the union.
|
|
219
219
|
* Each node type has a `.value` getter which returns the associated string.
|
|
@@ -339,7 +339,7 @@ export class SchemaFactory<
|
|
|
339
339
|
/**
|
|
340
340
|
* Construct a SchemaFactory with a given {@link SchemaFactory.scope|scope}.
|
|
341
341
|
* @remarks
|
|
342
|
-
* There are no restrictions on mixing
|
|
342
|
+
* There are no restrictions on mixing schemas from different schema factories.
|
|
343
343
|
* Typically each library will create one or more SchemaFactories and use them to define its schema.
|
|
344
344
|
*/
|
|
345
345
|
public constructor(
|
|
@@ -698,7 +698,7 @@ export class SchemaFactory<
|
|
|
698
698
|
const same = compareSets({ a: inputTypes, b: outputTypes });
|
|
699
699
|
if (!same) {
|
|
700
700
|
throw new UsageError(
|
|
701
|
-
`Structurally named schema collision: two
|
|
701
|
+
`Structurally named schema collision: two schemas named "${fullName}" were defined with different input schemas.`,
|
|
702
702
|
);
|
|
703
703
|
}
|
|
704
704
|
return structural;
|
|
@@ -422,11 +422,11 @@ export interface SnapshotSchemaCompatibilityOptions {
|
|
|
422
422
|
* Libraries which export schema for use by others will need to take special care to ensure the stability contract they offer their users aligns which what is validated by this utility.
|
|
423
423
|
*
|
|
424
424
|
* This utility only tests compatibility of the historical snapshots against the current schema; it does not test them against each-other.
|
|
425
|
-
* Generally any historical
|
|
425
|
+
* Generally any historical schemas should have been tested against the ones before them at the time they were current.
|
|
426
426
|
* If for some reason a version of a schema made it into production that was not compatible with a previous version,
|
|
427
427
|
* that can still be represented here (but may require manually generating a snapshot for that version)
|
|
428
428
|
* and this will still allow testing that all historical version can be upgraded to the current one.
|
|
429
|
-
* If a sufficiently incompatible historical
|
|
429
|
+
* If a sufficiently incompatible historical schemas were used in production, it may be impossible to make a single schema which can accommodate all of them:
|
|
430
430
|
* this utility can be used to confirm that is the case, as well as to avoid the problem in the first place by testing schema before each one is deployed.
|
|
431
431
|
*
|
|
432
432
|
* @example Mocha test which validates the current `config` can collaborate with all historical version back to 2.0.0, and load and update any versions older than that.
|