@fluidframework/tree 2.53.0 → 2.60.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/.eslintrc.cjs +0 -19
- package/.mocharc.customBenchmarks.cjs +1 -9
- package/CHANGELOG.md +56 -0
- package/api-report/tree.alpha.api.md +50 -36
- package/api-report/tree.beta.api.md +15 -1
- package/api-report/{tree.legacy.alpha.api.md → tree.legacy.beta.api.md} +5 -5
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/alpha.d.ts +8 -2
- package/dist/beta.d.ts +3 -0
- package/dist/codec/codec.d.ts +43 -6
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +22 -2
- 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 +4 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/external-utilities/index.d.ts +1 -1
- package/dist/external-utilities/index.d.ts.map +1 -1
- package/dist/external-utilities/index.js +2 -1
- package/dist/external-utilities/index.js.map +1 -1
- package/dist/external-utilities/typeboxValidator.d.ts +6 -1
- package/dist/external-utilities/typeboxValidator.d.ts.map +1 -1
- package/dist/external-utilities/typeboxValidator.js +7 -1
- package/dist/external-utilities/typeboxValidator.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +28 -5
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +91 -16
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +10 -1
- package/dist/feature-libraries/chunked-forest/codec/format.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.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +17 -6
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.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.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +3 -0
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +76 -38
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +322 -0
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
- 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 -1
- package/dist/feature-libraries/forest-summary/index.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/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/treeCompressionUtils.d.ts +15 -0
- package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCompressionUtils.js +16 -1
- package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +1 -1
- package/dist/jsonDomainSchema.d.ts.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/schematizingTreeView.d.ts +1 -1
- 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 +23 -6
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +4 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +3 -0
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +9 -11
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +2 -2
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +13 -0
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts +2 -2
- package/dist/sharedTreeAttributes.js +2 -2
- package/dist/sharedTreeAttributes.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +39 -11
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +79 -19
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +7 -2
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -0
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +9 -6
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +8 -7
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +21 -25
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFactoryBeta.js +26 -0
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -0
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +1 -0
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +68 -74
- 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/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +3 -3
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
- package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
- package/dist/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +3 -4
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +0 -3
- package/dist/simple-tree/fieldSchema.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 +4 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +2 -3
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +12 -0
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +0 -3
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +0 -3
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +11 -80
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +200 -117
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts +1 -2
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +1 -2
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +8 -2
- package/lib/beta.d.ts +3 -0
- package/lib/codec/codec.d.ts +43 -6
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +19 -1
- 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/external-utilities/index.d.ts +1 -1
- package/lib/external-utilities/index.d.ts.map +1 -1
- package/lib/external-utilities/index.js +1 -1
- package/lib/external-utilities/index.js.map +1 -1
- package/lib/external-utilities/typeboxValidator.d.ts +6 -1
- package/lib/external-utilities/typeboxValidator.d.ts.map +1 -1
- package/lib/external-utilities/typeboxValidator.js +6 -0
- package/lib/external-utilities/typeboxValidator.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +27 -5
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -3
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +87 -14
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +9 -0
- package/lib/feature-libraries/chunked-forest/codec/format.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.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +18 -7
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.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.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -0
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +75 -37
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +318 -0
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
- 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 +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/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/treeCompressionUtils.d.ts +15 -0
- package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCompressionUtils.js +15 -0
- package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +1 -1
- package/lib/jsonDomainSchema.d.ts.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/schematizingTreeView.d.ts +1 -1
- 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 +23 -6
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +4 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +3 -0
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +9 -11
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +2 -2
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +13 -0
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts +2 -2
- package/lib/sharedTreeAttributes.js +2 -2
- package/lib/sharedTreeAttributes.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +2 -2
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +39 -11
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +79 -19
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +7 -2
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +1 -0
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +9 -6
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +6 -6
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +22 -26
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFactoryBeta.js +22 -0
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -0
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +1 -0
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +68 -74
- 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/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +4 -4
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
- package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
- package/lib/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +3 -4
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +0 -3
- package/lib/simple-tree/fieldSchema.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/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +2 -3
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +12 -0
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +0 -3
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +0 -3
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +11 -80
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +201 -118
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts +1 -2
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -2
- package/lib/treeFactory.js.map +1 -1
- package/package.json +22 -22
- package/src/codec/codec.ts +52 -7
- package/src/codec/index.ts +4 -0
- package/src/external-utilities/index.ts +1 -1
- package/src/external-utilities/typeboxValidator.ts +7 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +38 -4
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +10 -3
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +96 -8
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +123 -19
- package/src/feature-libraries/chunked-forest/codec/format.ts +11 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +28 -3
- package/src/feature-libraries/chunked-forest/index.ts +2 -0
- package/src/feature-libraries/forest-summary/codec.ts +3 -0
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +118 -50
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +511 -0
- package/src/feature-libraries/forest-summary/index.ts +1 -1
- package/src/feature-libraries/index.ts +5 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +8 -4
- package/src/feature-libraries/treeCompressionUtils.ts +19 -0
- package/src/index.ts +6 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +1 -1
- package/src/shared-tree/sharedTree.ts +37 -4
- package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
- package/src/shared-tree/tree.ts +3 -0
- package/src/shared-tree/treeAlpha.ts +10 -11
- package/src/shared-tree/treeCheckout.ts +2 -2
- package/src/shared-tree-core/sharedTreeCore.ts +17 -0
- package/src/sharedTreeAttributes.ts +2 -2
- package/src/simple-tree/api/conciseTree.ts +2 -1
- package/src/simple-tree/api/customTree.ts +102 -32
- package/src/simple-tree/api/getJsonSchema.ts +7 -2
- package/src/simple-tree/api/index.ts +3 -0
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
- package/src/simple-tree/api/schemaFactory.ts +21 -14
- package/src/simple-tree/api/schemaFactoryAlpha.ts +29 -30
- package/src/simple-tree/api/schemaFactoryBeta.ts +28 -0
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -3
- package/src/simple-tree/api/transactionTypes.ts +1 -0
- package/src/simple-tree/api/tree.ts +75 -81
- package/src/simple-tree/api/verboseTree.ts +42 -39
- package/src/simple-tree/core/simpleNodeSchemaBase.ts +6 -0
- package/src/simple-tree/fieldSchema.ts +3 -4
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/node-kinds/record/recordNode.ts +2 -3
- package/src/simple-tree/simpleSchema.ts +12 -0
- package/src/simple-tree/toStoredSchema.ts +0 -3
- package/src/tableSchema.ts +261 -243
- package/src/treeFactory.ts +1 -2
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "../node-kinds/index.js";
|
|
18
18
|
import {
|
|
19
19
|
defaultSchemaFactoryObjectOptions,
|
|
20
|
-
|
|
20
|
+
scoped,
|
|
21
21
|
structuralName,
|
|
22
22
|
type NodeSchemaOptionsAlpha,
|
|
23
23
|
type SchemaFactoryObjectOptions,
|
|
@@ -46,6 +46,7 @@ import type {
|
|
|
46
46
|
TreeRecordNodeUnsafe,
|
|
47
47
|
} from "./typesUnsafe.js";
|
|
48
48
|
import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
|
|
49
|
+
import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
|
|
49
50
|
|
|
50
51
|
// This import prevents a large number of type references in the API reports from showing up as *_2.
|
|
51
52
|
/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */
|
|
@@ -212,20 +213,14 @@ const schemaStaticsAlpha: SchemaStaticsAlpha = {
|
|
|
212
213
|
*
|
|
213
214
|
* @alpha
|
|
214
215
|
* @privateRemarks
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
216
|
+
* When building schema, when `options` is not provided, `TCustomMetadata` is inferred as `unknown`.
|
|
217
|
+
* If desired, this could be made to infer `undefined` instead by adding overloads for everything,
|
|
218
|
+
* but currently it is not worth the maintenance overhead as there is no use case which this is known to be helpful for.
|
|
218
219
|
*/
|
|
219
220
|
export class SchemaFactoryAlpha<
|
|
220
221
|
out TScope extends string | undefined = string | undefined,
|
|
221
222
|
TName extends number | string = string,
|
|
222
|
-
> extends
|
|
223
|
-
private scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {
|
|
224
|
-
return (
|
|
225
|
-
this.scope === undefined ? `${name}` : `${this.scope}.${name}`
|
|
226
|
-
) as ScopedSchemaName<TScope, Name>;
|
|
227
|
-
}
|
|
228
|
-
|
|
223
|
+
> extends SchemaFactoryBeta<TScope, TName> {
|
|
229
224
|
/**
|
|
230
225
|
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
231
226
|
*
|
|
@@ -255,7 +250,7 @@ export class SchemaFactoryAlpha<
|
|
|
255
250
|
readonly createFromInsertable: unknown;
|
|
256
251
|
} {
|
|
257
252
|
return objectSchema(
|
|
258
|
-
this
|
|
253
|
+
scoped<TScope, TName, Name>(this, name),
|
|
259
254
|
fields,
|
|
260
255
|
true,
|
|
261
256
|
options?.allowUnknownOptionalFields ??
|
|
@@ -410,7 +405,7 @@ export class SchemaFactoryAlpha<
|
|
|
410
405
|
options?: NodeSchemaOptionsAlpha<TCustomMetadata>,
|
|
411
406
|
): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
412
407
|
return mapSchema(
|
|
413
|
-
this
|
|
408
|
+
scoped<TScope, TName, Name>(this, name),
|
|
414
409
|
allowedTypes,
|
|
415
410
|
true,
|
|
416
411
|
true,
|
|
@@ -440,7 +435,7 @@ export class SchemaFactoryAlpha<
|
|
|
440
435
|
}
|
|
441
436
|
|
|
442
437
|
/**
|
|
443
|
-
* Define
|
|
438
|
+
* Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
444
439
|
*
|
|
445
440
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
446
441
|
* @param allowedTypes - The types that may appear in the array.
|
|
@@ -461,7 +456,7 @@ export class SchemaFactoryAlpha<
|
|
|
461
456
|
options?: NodeSchemaOptionsAlpha<TCustomMetadata>,
|
|
462
457
|
): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
463
458
|
return arraySchema(
|
|
464
|
-
this
|
|
459
|
+
scoped<TScope, TName, Name>(this, name),
|
|
465
460
|
allowedTypes,
|
|
466
461
|
true,
|
|
467
462
|
true,
|
|
@@ -628,23 +623,24 @@ export class SchemaFactoryAlpha<
|
|
|
628
623
|
}
|
|
629
624
|
|
|
630
625
|
/**
|
|
631
|
-
* Define a {@link TreeNodeSchema} for a {@link (
|
|
626
|
+
* Define a {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.
|
|
632
627
|
*
|
|
633
628
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
634
629
|
*
|
|
635
630
|
* @remarks
|
|
636
|
-
* This is not intended to be used directly, use the overload of `
|
|
637
|
-
* This is only public to work around a compiler limitation.
|
|
631
|
+
* This is not intended to be used directly, use the overload of `record` which takes a name instead.
|
|
638
632
|
*/
|
|
639
633
|
private namedRecord<
|
|
640
634
|
Name extends TName | string,
|
|
641
635
|
const T extends ImplicitAllowedTypes,
|
|
642
636
|
const ImplicitlyConstructable extends boolean,
|
|
637
|
+
const TCustomMetadata = unknown,
|
|
643
638
|
>(
|
|
644
639
|
name: Name,
|
|
645
640
|
allowedTypes: T,
|
|
646
641
|
customizable: boolean,
|
|
647
642
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
643
|
+
options?: NodeSchemaOptionsAlpha<TCustomMetadata>,
|
|
648
644
|
): TreeNodeSchemaBoth<
|
|
649
645
|
/* Name */ ScopedSchemaName<TScope, Name>,
|
|
650
646
|
/* Kind */ NodeKind.Record,
|
|
@@ -656,10 +652,12 @@ export class SchemaFactoryAlpha<
|
|
|
656
652
|
/* TConstructorExtra */ undefined
|
|
657
653
|
> {
|
|
658
654
|
const record = recordSchema({
|
|
659
|
-
identifier: this
|
|
655
|
+
identifier: scoped<TScope, TName, Name>(this, name),
|
|
660
656
|
info: allowedTypes,
|
|
661
657
|
customizable,
|
|
662
658
|
implicitlyConstructable,
|
|
659
|
+
metadata: options?.metadata,
|
|
660
|
+
persistedMetadata: options?.persistedMetadata,
|
|
663
661
|
});
|
|
664
662
|
|
|
665
663
|
return record as TreeNodeSchemaBoth<
|
|
@@ -696,7 +694,7 @@ export class SchemaFactoryAlpha<
|
|
|
696
694
|
options?: NodeSchemaOptionsAlpha<TCustomMetadata>,
|
|
697
695
|
): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {
|
|
698
696
|
return recordSchema({
|
|
699
|
-
identifier: this
|
|
697
|
+
identifier: scoped<TScope, TName, Name>(this, name),
|
|
700
698
|
info: allowedTypes,
|
|
701
699
|
customizable: true,
|
|
702
700
|
implicitlyConstructable: true,
|
|
@@ -716,7 +714,8 @@ export class SchemaFactoryAlpha<
|
|
|
716
714
|
public recordRecursive<
|
|
717
715
|
Name extends TName,
|
|
718
716
|
const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
|
|
719
|
-
|
|
717
|
+
const TCustomMetadata = unknown,
|
|
718
|
+
>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {
|
|
720
719
|
const RecordSchema = this.namedRecord(
|
|
721
720
|
name,
|
|
722
721
|
allowedTypes as T & ImplicitAllowedTypes,
|
|
@@ -724,6 +723,7 @@ export class SchemaFactoryAlpha<
|
|
|
724
723
|
// Setting this to true seems to work ok currently, but not for other node kinds.
|
|
725
724
|
// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.
|
|
726
725
|
/* implicitlyConstructable */ false,
|
|
726
|
+
options,
|
|
727
727
|
);
|
|
728
728
|
|
|
729
729
|
return RecordSchema as TreeNodeSchemaClass<
|
|
@@ -740,19 +740,18 @@ export class SchemaFactoryAlpha<
|
|
|
740
740
|
},
|
|
741
741
|
/* ImplicitlyConstructable */ false,
|
|
742
742
|
/* Info */ T,
|
|
743
|
-
/* TConstructorExtra */ undefined
|
|
743
|
+
/* TConstructorExtra */ undefined,
|
|
744
|
+
/* TCustomMetadata */ TCustomMetadata
|
|
744
745
|
>;
|
|
745
746
|
}
|
|
746
747
|
|
|
747
748
|
/**
|
|
748
|
-
*
|
|
749
|
-
* @remarks
|
|
750
|
-
* The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).
|
|
751
|
-
* Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.
|
|
749
|
+
* {@inheritDoc SchemaFactoryBeta.scopedFactory}
|
|
752
750
|
*/
|
|
753
|
-
public
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
751
|
+
public scopedFactoryAlpha<
|
|
752
|
+
const T extends TName,
|
|
753
|
+
TNameInner extends number | string = string,
|
|
754
|
+
>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {
|
|
755
|
+
return new SchemaFactoryAlpha(scoped<TScope, TName, T>(this, name));
|
|
757
756
|
}
|
|
758
757
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SchemaFactory, scoped, type ScopedSchemaName } from "./schemaFactory.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* {@link SchemaFactory} with additional beta APIs.
|
|
10
|
+
* @beta
|
|
11
|
+
* @privateRemarks
|
|
12
|
+
*/
|
|
13
|
+
export class SchemaFactoryBeta<
|
|
14
|
+
out TScope extends string | undefined = string | undefined,
|
|
15
|
+
TName extends number | string = string,
|
|
16
|
+
> extends SchemaFactory<TScope, TName> {
|
|
17
|
+
/**
|
|
18
|
+
* Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.
|
|
19
|
+
* @remarks
|
|
20
|
+
* The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).
|
|
21
|
+
* Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.
|
|
22
|
+
*/
|
|
23
|
+
public scopedFactory<const T extends TName, TNameInner extends number | string = string>(
|
|
24
|
+
name: T,
|
|
25
|
+
): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner> {
|
|
26
|
+
return new SchemaFactoryBeta(scoped(this, name));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
ObjectNodeSchema,
|
|
38
38
|
} from "../node-kinds/index.js";
|
|
39
39
|
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
40
|
+
import { KeyEncodingOptions } from "./customTree.js";
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Generates a JSON Schema representation from a simple tree schema.
|
|
@@ -45,8 +46,6 @@ import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
|
45
46
|
*
|
|
46
47
|
* This cannot handle the case where the root is undefined since undefined is not a concept in JSON.
|
|
47
48
|
* This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.
|
|
48
|
-
*
|
|
49
|
-
* @internal
|
|
50
49
|
*/
|
|
51
50
|
export function toJsonSchema(
|
|
52
51
|
schema: TreeSchema,
|
|
@@ -62,6 +61,7 @@ export function toJsonSchema(
|
|
|
62
61
|
// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.
|
|
63
62
|
// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes
|
|
64
63
|
// TODO: handle case where allowedTypes is empty.
|
|
64
|
+
// TODO: handle staged types in a controllable way.
|
|
65
65
|
return hasSingle(allowedTypes)
|
|
66
66
|
? {
|
|
67
67
|
...allowedTypes[0],
|
|
@@ -160,7 +160,10 @@ export function convertObjectNodeSchema(
|
|
|
160
160
|
const properties: Record<string, JsonFieldSchema> = {};
|
|
161
161
|
const required: string[] = [];
|
|
162
162
|
for (const [propertyKey, fieldSchema] of schema.fields) {
|
|
163
|
-
const key =
|
|
163
|
+
const key =
|
|
164
|
+
options.keys === KeyEncodingOptions.usePropertyKeys
|
|
165
|
+
? propertyKey
|
|
166
|
+
: fieldSchema.storedKey;
|
|
164
167
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
165
168
|
for (const allowedType of fieldSchema.allowedTypesIdentifiers) {
|
|
166
169
|
allowedTypes.push(createSchemaRef(allowedType));
|
|
@@ -190,6 +193,7 @@ export function convertObjectNodeSchema(
|
|
|
190
193
|
_treeNodeSchemaKind: NodeKind.Object,
|
|
191
194
|
properties,
|
|
192
195
|
required,
|
|
196
|
+
// TODO: support unknown optional fields (only when using "allStoredKeys", and constrain the content to be in schema somehow)
|
|
193
197
|
additionalProperties: false,
|
|
194
198
|
};
|
|
195
199
|
|
|
@@ -166,6 +166,81 @@ export interface TreeBranch extends IDisposable {
|
|
|
166
166
|
*/
|
|
167
167
|
rebaseOnto(branch: TreeBranch): void;
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
171
|
+
* @param transaction - The function to run as the body of the transaction.
|
|
172
|
+
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
173
|
+
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
174
|
+
* abort the transaction and discard any changes it made so far.
|
|
175
|
+
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
176
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
177
|
+
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
178
|
+
*
|
|
179
|
+
* - A "success" flag indicating whether the transaction was successful or not.
|
|
180
|
+
* - The success or failure value as returned by the transaction function.
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
184
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
185
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
186
|
+
* However, using a transaction has the following additional consequences:
|
|
187
|
+
*
|
|
188
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
189
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
190
|
+
*
|
|
191
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
192
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
193
|
+
*
|
|
194
|
+
* Nested transactions:
|
|
195
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
196
|
+
*
|
|
197
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
198
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
199
|
+
* for the outermost transaction which includes all inner transactions.
|
|
200
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
201
|
+
*/
|
|
202
|
+
runTransaction<TSuccessValue, TFailureValue>(
|
|
203
|
+
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
204
|
+
params?: RunTransactionParams,
|
|
205
|
+
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
206
|
+
/**
|
|
207
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
208
|
+
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
209
|
+
*
|
|
210
|
+
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
211
|
+
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
212
|
+
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
213
|
+
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
214
|
+
*
|
|
215
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
216
|
+
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
217
|
+
* transaction was successful or not.
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
221
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
222
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
223
|
+
* However, using a transaction has the following additional consequences:
|
|
224
|
+
*
|
|
225
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
226
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
227
|
+
*
|
|
228
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
229
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
230
|
+
*
|
|
231
|
+
* Nested transactions:
|
|
232
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
233
|
+
*
|
|
234
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
235
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
236
|
+
* for the outermost transaction which includes all inner transactions.
|
|
237
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
238
|
+
*/
|
|
239
|
+
runTransaction(
|
|
240
|
+
transaction: () => VoidTransactionCallbackStatus | void,
|
|
241
|
+
params?: RunTransactionParams,
|
|
242
|
+
): TransactionResult;
|
|
243
|
+
|
|
169
244
|
/**
|
|
170
245
|
* Dispose of this branch, cleaning up any resources associated with it.
|
|
171
246
|
* @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
|
|
@@ -279,87 +354,6 @@ export interface TreeViewAlpha<
|
|
|
279
354
|
|
|
280
355
|
// Override the base branch method to return a typed view rather than merely a branch.
|
|
281
356
|
fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
285
|
-
* @param transaction - The function to run as the body of the transaction.
|
|
286
|
-
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
287
|
-
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
288
|
-
* abort the transaction and discard any changes it made so far.
|
|
289
|
-
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
290
|
-
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
291
|
-
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
292
|
-
*
|
|
293
|
-
* - A "success" flag indicating whether the transaction was successful or not.
|
|
294
|
-
*
|
|
295
|
-
* - The success of failure value as returned by the transaction function.
|
|
296
|
-
* @remarks
|
|
297
|
-
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
298
|
-
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
299
|
-
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
300
|
-
* However, using a transaction has the following additional consequences:
|
|
301
|
-
*
|
|
302
|
-
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
303
|
-
*
|
|
304
|
-
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
305
|
-
*
|
|
306
|
-
* Local change events will be emitted for each change as the transaction is being applied.
|
|
307
|
-
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
308
|
-
*
|
|
309
|
-
* Nested transactions:
|
|
310
|
-
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
311
|
-
*
|
|
312
|
-
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
313
|
-
*
|
|
314
|
-
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
315
|
-
* for the outermost transaction which includes all inner transactions.
|
|
316
|
-
*
|
|
317
|
-
* - Undo will undo the outermost transaction and all inner transactions.
|
|
318
|
-
*/
|
|
319
|
-
runTransaction<TSuccessValue, TFailureValue>(
|
|
320
|
-
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
321
|
-
params?: RunTransactionParams,
|
|
322
|
-
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
323
|
-
/**
|
|
324
|
-
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
325
|
-
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
326
|
-
*
|
|
327
|
-
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
328
|
-
*
|
|
329
|
-
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
330
|
-
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
331
|
-
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
332
|
-
*
|
|
333
|
-
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
334
|
-
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
335
|
-
* transaction was successful or not.
|
|
336
|
-
* @remarks
|
|
337
|
-
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
338
|
-
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
339
|
-
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
340
|
-
* However, using a transaction has the following additional consequences:
|
|
341
|
-
*
|
|
342
|
-
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
343
|
-
*
|
|
344
|
-
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
345
|
-
*
|
|
346
|
-
* Local change events will be emitted for each change as the transaction is being applied.
|
|
347
|
-
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
348
|
-
*
|
|
349
|
-
* Nested transactions:
|
|
350
|
-
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
351
|
-
*
|
|
352
|
-
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
353
|
-
*
|
|
354
|
-
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
355
|
-
* for the outermost transaction which includes all inner transactions.
|
|
356
|
-
*
|
|
357
|
-
* - Undo will undo the outermost transaction and all inner transactions.
|
|
358
|
-
*/
|
|
359
|
-
runTransaction(
|
|
360
|
-
transaction: () => VoidTransactionCallbackStatus | void,
|
|
361
|
-
params?: RunTransactionParams,
|
|
362
|
-
): TransactionResult;
|
|
363
357
|
}
|
|
364
358
|
|
|
365
359
|
/**
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
import { isObjectNodeSchema } from "../node-kinds/index.js";
|
|
38
38
|
import {
|
|
39
39
|
customFromCursor,
|
|
40
|
+
KeyEncodingOptions,
|
|
40
41
|
replaceHandles,
|
|
41
42
|
unknownTypeError,
|
|
42
43
|
type CustomTreeNode,
|
|
@@ -118,53 +119,55 @@ export function applySchemaToParserOptions(
|
|
|
118
119
|
options: TreeEncodingOptions,
|
|
119
120
|
): SchemalessParseOptions {
|
|
120
121
|
const config: Required<TreeEncodingOptions> = {
|
|
121
|
-
|
|
122
|
+
keys: KeyEncodingOptions.usePropertyKeys,
|
|
122
123
|
...options,
|
|
123
124
|
};
|
|
124
125
|
|
|
125
126
|
const context = getUnhydratedContext(schema);
|
|
126
127
|
|
|
127
128
|
return {
|
|
128
|
-
keyConverter:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return arbitrary;
|
|
151
|
-
}
|
|
152
|
-
return key;
|
|
153
|
-
},
|
|
154
|
-
parse: (type, inputKey): FieldKey => {
|
|
155
|
-
const simpleNodeSchema = context.schema.get(brand(type)) ?? unknownTypeError(type);
|
|
156
|
-
if (isObjectNodeSchema(simpleNodeSchema)) {
|
|
157
|
-
const info = simpleNodeSchema.flexKeyMap.get(inputKey);
|
|
158
|
-
if (info === undefined) {
|
|
159
|
-
throw new UsageError(
|
|
160
|
-
`Failed to parse VerboseTree due to unexpected key ${JSON.stringify(inputKey)} on type ${JSON.stringify(type)}.`,
|
|
129
|
+
keyConverter:
|
|
130
|
+
config.keys !== KeyEncodingOptions.usePropertyKeys
|
|
131
|
+
? undefined
|
|
132
|
+
: {
|
|
133
|
+
encode: (type, key: FieldKey): string => {
|
|
134
|
+
// translate stored key into property key.
|
|
135
|
+
const simpleNodeSchema =
|
|
136
|
+
context.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);
|
|
137
|
+
if (isObjectNodeSchema(simpleNodeSchema)) {
|
|
138
|
+
const propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);
|
|
139
|
+
if (propertyKey !== undefined) {
|
|
140
|
+
return propertyKey;
|
|
141
|
+
}
|
|
142
|
+
// Looking up an out of schema key.
|
|
143
|
+
// This must point to a non-existent field.
|
|
144
|
+
// It's possible that the key, if we returned it unmodified, could point to some data
|
|
145
|
+
// (for example if looking up a key which is a stored key already when using property keys).
|
|
146
|
+
// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:
|
|
147
|
+
const arbitrary = "arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90";
|
|
148
|
+
assert(
|
|
149
|
+
!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),
|
|
150
|
+
0xa13 /* arbitrarily selected unused key was actually used */,
|
|
161
151
|
);
|
|
152
|
+
return arbitrary;
|
|
153
|
+
}
|
|
154
|
+
return key;
|
|
155
|
+
},
|
|
156
|
+
parse: (type, inputKey): FieldKey => {
|
|
157
|
+
const simpleNodeSchema =
|
|
158
|
+
context.schema.get(brand(type)) ?? unknownTypeError(type);
|
|
159
|
+
if (isObjectNodeSchema(simpleNodeSchema)) {
|
|
160
|
+
const info = simpleNodeSchema.flexKeyMap.get(inputKey);
|
|
161
|
+
if (info === undefined) {
|
|
162
|
+
throw new UsageError(
|
|
163
|
+
`Failed to parse VerboseTree due to unexpected key ${JSON.stringify(inputKey)} on type ${JSON.stringify(type)}.`,
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return info.storedKey;
|
|
162
167
|
}
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
return brand(inputKey);
|
|
168
|
+
return brand(inputKey);
|
|
169
|
+
},
|
|
166
170
|
},
|
|
167
|
-
},
|
|
168
171
|
};
|
|
169
172
|
}
|
|
170
173
|
|
|
@@ -284,7 +287,7 @@ export function verboseFromCursor(
|
|
|
284
287
|
options: TreeEncodingOptions,
|
|
285
288
|
): VerboseTree {
|
|
286
289
|
const config: Required<TreeEncodingOptions> = {
|
|
287
|
-
|
|
290
|
+
keys: KeyEncodingOptions.usePropertyKeys,
|
|
288
291
|
...options,
|
|
289
292
|
};
|
|
290
293
|
|
|
@@ -25,6 +25,12 @@ export interface SimpleNodeSchemaBase<
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* User-provided {@link NodeSchemaMetadata} for this schema.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Note: this metadata is not persisted nor made part of the collaborative state; it is strictly client-local.
|
|
31
|
+
* Different clients in the same collaborative session may see different metadata for the same field.
|
|
32
|
+
*
|
|
33
|
+
* Set via {@link NodeSchemaOptions.metadata}.
|
|
28
34
|
*/
|
|
29
35
|
readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
|
|
30
36
|
}
|
|
@@ -187,7 +187,9 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
187
187
|
export interface FieldPropsAlpha<TCustomMetadata = unknown>
|
|
188
188
|
extends FieldProps<TCustomMetadata> {
|
|
189
189
|
/**
|
|
190
|
-
* The persisted metadata for
|
|
190
|
+
* The persisted metadata for a field schema.
|
|
191
|
+
* @remarks
|
|
192
|
+
* Sets {@link SimpleFieldSchema.persistedMetadata}.
|
|
191
193
|
*/
|
|
192
194
|
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
193
195
|
}
|
|
@@ -428,9 +430,6 @@ export class FieldSchemaAlpha<
|
|
|
428
430
|
*/
|
|
429
431
|
public readonly allowedTypesMetadata: AllowedTypesMetadata;
|
|
430
432
|
|
|
431
|
-
/**
|
|
432
|
-
* Persisted metadata for this field schema.
|
|
433
|
-
*/
|
|
434
433
|
public get persistedMetadata(): JsonCompatibleReadOnlyObject | undefined {
|
|
435
434
|
return this.propsAlpha?.persistedMetadata;
|
|
436
435
|
}
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -70,6 +70,7 @@ export {
|
|
|
70
70
|
type SchemaCompatibilityStatus,
|
|
71
71
|
type ITreeConfigurationOptions,
|
|
72
72
|
SchemaFactory,
|
|
73
|
+
SchemaFactoryBeta,
|
|
73
74
|
SchemaFactoryAlpha,
|
|
74
75
|
type SchemaFactoryObjectOptions,
|
|
75
76
|
type ScopedSchemaName,
|
|
@@ -161,6 +162,8 @@ export {
|
|
|
161
162
|
type NodeSchemaOptions,
|
|
162
163
|
type NodeSchemaOptionsAlpha,
|
|
163
164
|
type SchemaStaticsAlpha,
|
|
165
|
+
KeyEncodingOptions,
|
|
166
|
+
type TreeParsingOptions,
|
|
164
167
|
} from "./api/index.js";
|
|
165
168
|
export type {
|
|
166
169
|
SimpleTreeSchema,
|
|
@@ -184,11 +184,10 @@ function createRecordNodeProxy(
|
|
|
184
184
|
|
|
185
185
|
const innerNode = getOrCreateInnerNode(proxy);
|
|
186
186
|
const field = innerNode.tryGetField(brand(key)) as FlexTreeOptionalField | undefined;
|
|
187
|
-
if (field
|
|
188
|
-
|
|
187
|
+
if (field !== undefined) {
|
|
188
|
+
field.editor.set(undefined, field.length === 0);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
field.editor.set(undefined, field.length === 0);
|
|
192
191
|
return true;
|
|
193
192
|
},
|
|
194
193
|
});
|
|
@@ -26,6 +26,15 @@ export interface SimpleNodeSchemaBaseAlpha<
|
|
|
26
26
|
> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {
|
|
27
27
|
/**
|
|
28
28
|
* Persisted metadata for this node schema.
|
|
29
|
+
* @remarks
|
|
30
|
+
* While this can be stored in the document, not all versions / configurations will do so.
|
|
31
|
+
* Additionally, this is not part of {@link TreeView.compatibility|schema compatibility}, so different clients
|
|
32
|
+
* (even within the same collaborative session) may see different `persistedMetadata` for the same node.
|
|
33
|
+
* Specified using {@link NodeSchemaOptionsAlpha.persistedMetadata}.
|
|
34
|
+
* @privateRemarks
|
|
35
|
+
* How/when this gets updated in documents,
|
|
36
|
+
* and how to read it from documents should be documented here when this feature is more mature and these questions have good answers.
|
|
37
|
+
* If this does end up getting reflected in some compatibility value, that should also be documented.
|
|
29
38
|
*/
|
|
30
39
|
readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;
|
|
31
40
|
}
|
|
@@ -184,6 +193,9 @@ export interface SimpleFieldSchema {
|
|
|
184
193
|
|
|
185
194
|
/**
|
|
186
195
|
* Persisted metadata for this field schema.
|
|
196
|
+
* @remarks
|
|
197
|
+
* Like {@link SimpleNodeSchemaBaseAlpha.persistedMetadata} but for fields.
|
|
198
|
+
* Set via {@link FieldPropsAlpha.persistedMetadata}.
|
|
187
199
|
*/
|
|
188
200
|
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
189
201
|
}
|
|
@@ -161,9 +161,6 @@ export const convertFieldKind: ReadonlyMap<FieldKind, FlexFieldKind> = new Map<
|
|
|
161
161
|
* Converts a {@link TreeNodeSchema} into a {@link TreeNodeStoredSchema}.
|
|
162
162
|
* @privateRemarks
|
|
163
163
|
* TODO: Persist node metadata once schema FormatV2 is supported.
|
|
164
|
-
*
|
|
165
|
-
* TODO: AB#43548: Using a stored schema for unhydrated flex trees does not handle schema evolution features like "allowUnknownOptionalFields".
|
|
166
|
-
* Usage of this and the conversion which wrap it should be audited and reduced.
|
|
167
164
|
*/
|
|
168
165
|
export function getStoredSchema(
|
|
169
166
|
schema: SimpleNodeSchema,
|