@fluidframework/tree 2.53.1 → 2.61.0-355054
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.cjs +2 -3
- package/.mocharc.customBenchmarks.cjs +1 -9
- package/CHANGELOG.md +56 -0
- package/alpha.d.ts +1 -1
- package/api-report/tree.alpha.api.md +51 -37
- package/api-report/tree.beta.api.md +16 -2
- package/api-report/{tree.legacy.alpha.api.md → tree.legacy.beta.api.md} +72 -6
- package/api-report/tree.legacy.public.api.md +2 -2
- package/api-report/tree.public.api.md +2 -2
- package/beta.d.ts +1 -1
- package/dist/alpha.d.ts +17 -7
- package/dist/beta.d.ts +10 -4
- 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/legacy.d.ts +21 -4
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +5 -3
- 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 +1 -0
- 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/schemaFactoryRecursive.d.ts +5 -3
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- 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/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +7 -1
- package/dist/util/breakable.js.map +1 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/alpha.d.ts +17 -7
- package/lib/beta.d.ts +10 -4
- 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/legacy.d.ts +21 -4
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +5 -3
- 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 +1 -0
- 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/schemaFactoryRecursive.d.ts +5 -3
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- 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/lib/tsdoc-metadata.json +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +7 -1
- package/lib/util/breakable.js.map +1 -1
- package/package.json +28 -28
- 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 +3 -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/schemaFactoryRecursive.ts +41 -40
- 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
- package/src/util/breakable.ts +9 -1
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type FieldKey,
|
|
12
12
|
type FieldKindIdentifier,
|
|
13
13
|
type ITreeCursorSynchronous,
|
|
14
|
+
type TreeChunk,
|
|
14
15
|
type TreeFieldStoredSchema,
|
|
15
16
|
type TreeNodeSchemaIdentifier,
|
|
16
17
|
type Value,
|
|
@@ -35,9 +36,10 @@ import {
|
|
|
35
36
|
SpecialField,
|
|
36
37
|
version,
|
|
37
38
|
} from "./format.js";
|
|
39
|
+
import type { ChunkReferenceId, IncrementalEncoder } from "./codecs.js";
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
|
-
* Encode data from `FieldBatch` into an `
|
|
42
|
+
* Encode data from `FieldBatch` into an `EncodedFieldBatch`.
|
|
41
43
|
*
|
|
42
44
|
* Optimized for encoded size and encoding performance.
|
|
43
45
|
*
|
|
@@ -347,22 +349,48 @@ export class InlineArrayEncoder
|
|
|
347
349
|
}
|
|
348
350
|
}
|
|
349
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Encodes the shape for a nested array as {@link EncodedNestedArray} shape.
|
|
354
|
+
*/
|
|
355
|
+
export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {
|
|
356
|
+
/**
|
|
357
|
+
* @param innerShape - The shape of each item in this nested array.
|
|
358
|
+
*/
|
|
359
|
+
public constructor(public readonly innerShape: Shape) {
|
|
360
|
+
super();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public encodeShape(
|
|
364
|
+
identifiers: DeduplicationTable<string>,
|
|
365
|
+
shapes: DeduplicationTable<Shape>,
|
|
366
|
+
): EncodedChunkShape {
|
|
367
|
+
const shape: EncodedNestedArrayShape =
|
|
368
|
+
shapes.valueToIndex.get(this.innerShape) ??
|
|
369
|
+
fail(0xb4f /* index for shape not found in table */);
|
|
370
|
+
return {
|
|
371
|
+
a: shape,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
public countReferencedShapesAndIdentifiers(
|
|
376
|
+
identifiers: Counter<string>,
|
|
377
|
+
shapeDiscovered: (shape: Shape) => void,
|
|
378
|
+
): void {
|
|
379
|
+
shapeDiscovered(this.innerShape);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
350
383
|
/**
|
|
351
384
|
* Encodes a field as a nested array with the {@link EncodedNestedArrayShape} shape.
|
|
352
385
|
* @remarks
|
|
353
|
-
* The fact this is also a Shape is an implementation detail
|
|
386
|
+
* The fact this is also exposes a Shape is an implementation detail: it allows the shape it uses to be itself
|
|
354
387
|
* which is an easy way to keep all the related code together without extra objects.
|
|
355
388
|
*/
|
|
356
|
-
export class NestedArrayEncoder
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
public constructor(public readonly inner: NodeEncoder) {
|
|
363
|
-
super();
|
|
364
|
-
this.shape = this;
|
|
365
|
-
}
|
|
389
|
+
export class NestedArrayEncoder implements FieldEncoder {
|
|
390
|
+
public constructor(
|
|
391
|
+
public readonly innerEncoder: NodeEncoder,
|
|
392
|
+
public readonly shape: NestedArrayShape = new NestedArrayShape(innerEncoder.shape),
|
|
393
|
+
) {}
|
|
366
394
|
|
|
367
395
|
public encodeField(
|
|
368
396
|
cursor: ITreeCursorSynchronous,
|
|
@@ -374,7 +402,7 @@ export class NestedArrayEncoder
|
|
|
374
402
|
const length = cursor.getFieldLength();
|
|
375
403
|
forEachNode(cursor, () => {
|
|
376
404
|
const before = buffer.length;
|
|
377
|
-
this.
|
|
405
|
+
this.innerEncoder.encodeNode(cursor, context, buffer);
|
|
378
406
|
allNonZeroSize &&= buffer.length - before !== 0;
|
|
379
407
|
});
|
|
380
408
|
if (buffer.length === 0) {
|
|
@@ -389,27 +417,77 @@ export class NestedArrayEncoder
|
|
|
389
417
|
outputBuffer.push(buffer);
|
|
390
418
|
}
|
|
391
419
|
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Encodes a chunk with the {@link EncodedIncrementalChunkShape} shape.
|
|
424
|
+
* This chunks will be encoded separately, i.e., the contents of the chunk will not be part of the main buffer.
|
|
425
|
+
* A reference to the chunk will be stored in the main buffer as an {@link ChunkReferenceId}.
|
|
426
|
+
*/
|
|
427
|
+
export class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {
|
|
428
|
+
/**
|
|
429
|
+
* Encodes all the nodes in the chunk at the cursor position using `InlineArrayShape`.
|
|
430
|
+
*/
|
|
431
|
+
public static encodeChunk(chunk: TreeChunk, context: EncoderContext): BufferFormat {
|
|
432
|
+
const chunkOutputBuffer: BufferFormat = [];
|
|
433
|
+
const nodesEncoder = asNodesEncoder(anyNodeEncoder);
|
|
434
|
+
const chunkCursor = chunk.cursor();
|
|
435
|
+
chunkCursor.firstNode();
|
|
436
|
+
const chunkLength = chunkCursor.chunkLength;
|
|
437
|
+
for (let index = 0; index < chunkLength; index++) {
|
|
438
|
+
nodesEncoder.encodeNodes(chunkCursor, context, chunkOutputBuffer);
|
|
439
|
+
}
|
|
440
|
+
assert(
|
|
441
|
+
chunkCursor.mode === CursorLocationType.Fields,
|
|
442
|
+
0xc29 /* should return to fields mode when finished encoding */,
|
|
443
|
+
);
|
|
444
|
+
return chunkOutputBuffer;
|
|
445
|
+
}
|
|
392
446
|
|
|
393
447
|
public encodeShape(
|
|
394
448
|
identifiers: DeduplicationTable<string>,
|
|
395
449
|
shapes: DeduplicationTable<Shape>,
|
|
396
450
|
): EncodedChunkShape {
|
|
397
|
-
const shape: EncodedNestedArrayShape =
|
|
398
|
-
shapes.valueToIndex.get(this.inner.shape) ??
|
|
399
|
-
fail(0xb4f /* index for shape not found in table */);
|
|
400
451
|
return {
|
|
401
|
-
|
|
452
|
+
e: 0 /* EncodedIncrementalChunkShape */,
|
|
402
453
|
};
|
|
403
454
|
}
|
|
404
455
|
|
|
405
456
|
public countReferencedShapesAndIdentifiers(
|
|
406
457
|
identifiers: Counter<string>,
|
|
407
458
|
shapeDiscovered: (shape: Shape) => void,
|
|
408
|
-
): void {
|
|
409
|
-
|
|
459
|
+
): void {}
|
|
460
|
+
|
|
461
|
+
public get shape(): this {
|
|
462
|
+
return this;
|
|
410
463
|
}
|
|
411
464
|
}
|
|
412
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Encodes an incremental field whose chunks are encoded separately and referenced by their {@link ChunkReferenceId}.
|
|
468
|
+
* The shape of the content of this field is {@link NestedShape} where the items in the array are
|
|
469
|
+
* the {@link ChunkReferenceId}s of the encoded chunks.
|
|
470
|
+
*/
|
|
471
|
+
export const incrementalFieldEncoder: FieldEncoder = {
|
|
472
|
+
encodeField(
|
|
473
|
+
cursor: ITreeCursorSynchronous,
|
|
474
|
+
context: EncoderContext,
|
|
475
|
+
outputBuffer: BufferFormat,
|
|
476
|
+
): void {
|
|
477
|
+
assert(
|
|
478
|
+
context.shouldEncodeIncrementally,
|
|
479
|
+
0xc2a /* incremental encoding must be enabled to use IncrementalFieldShape */,
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
const chunkReferenceIds = context.encodeIncrementalField(cursor, (chunk: TreeChunk) =>
|
|
483
|
+
IncrementalChunkShape.encodeChunk(chunk, context),
|
|
484
|
+
);
|
|
485
|
+
outputBuffer.push(chunkReferenceIds);
|
|
486
|
+
},
|
|
487
|
+
|
|
488
|
+
shape: new NestedArrayShape(new IncrementalChunkShape() /* innerShape */),
|
|
489
|
+
};
|
|
490
|
+
|
|
413
491
|
/**
|
|
414
492
|
* Encode `value` with `shape` into `outputBuffer`.
|
|
415
493
|
*
|
|
@@ -448,6 +526,7 @@ export function encodeValue(
|
|
|
448
526
|
/**
|
|
449
527
|
* Provides common contextual information during encoding, like schema and policy settings.
|
|
450
528
|
* Also, provides a cache to avoid duplicating equivalent shapes during a batch of encode operations.
|
|
529
|
+
* @remarks
|
|
451
530
|
* To avoid Shape duplication, any Shapes used in the encoding should either be:
|
|
452
531
|
* - Singletons defined in a static scope.
|
|
453
532
|
* - Cached in this object for future reuse such that all equivalent Shapes are deduplicated.
|
|
@@ -461,6 +540,7 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
|
|
|
461
540
|
private readonly fieldEncoderFromPolicy: FieldEncoderPolicy,
|
|
462
541
|
public readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
|
|
463
542
|
public readonly idCompressor: IIdCompressor,
|
|
543
|
+
private readonly incrementalEncoder: IncrementalEncoder | undefined,
|
|
464
544
|
) {}
|
|
465
545
|
|
|
466
546
|
public nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {
|
|
@@ -476,6 +556,30 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
|
|
|
476
556
|
public nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {
|
|
477
557
|
return getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));
|
|
478
558
|
}
|
|
559
|
+
|
|
560
|
+
public get shouldEncodeIncrementally(): boolean {
|
|
561
|
+
return this.incrementalEncoder !== undefined;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* {@link IncrementalEncoder.encodeIncrementalField}
|
|
566
|
+
*/
|
|
567
|
+
public encodeIncrementalField(
|
|
568
|
+
cursor: ITreeCursorSynchronous,
|
|
569
|
+
encoder: (chunk: TreeChunk) => BufferFormat,
|
|
570
|
+
): ChunkReferenceId[] {
|
|
571
|
+
assert(
|
|
572
|
+
this.incrementalEncoder !== undefined,
|
|
573
|
+
0xc2b /* incremental encoding must be enabled */,
|
|
574
|
+
);
|
|
575
|
+
// Encoder for the chunk that encodes its data using the provided encoder function and
|
|
576
|
+
// updates the encoded data for shapes and identifiers.
|
|
577
|
+
const chunkEncoder = (chunk: TreeChunk): EncodedFieldBatch => {
|
|
578
|
+
const chunkOutputBuffer = encoder(chunk);
|
|
579
|
+
return updateShapesAndIdentifiersEncoding(version, [chunkOutputBuffer]);
|
|
580
|
+
};
|
|
581
|
+
return this.incrementalEncoder.encodeIncrementalField(cursor, chunkEncoder);
|
|
582
|
+
}
|
|
479
583
|
}
|
|
480
584
|
|
|
481
585
|
export interface NodeEncodeBuilder {
|
|
@@ -47,6 +47,12 @@ export const EncodedInlineArrayShape = Type.Object(
|
|
|
47
47
|
*/
|
|
48
48
|
export const EncodedAnyShape = Type.Literal(0);
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Encoded content is a {@link ChunkReferenceId}.
|
|
52
|
+
* This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.
|
|
53
|
+
*/
|
|
54
|
+
export const EncodedIncrementalChunkShape = Type.Literal(0);
|
|
55
|
+
|
|
50
56
|
/**
|
|
51
57
|
* Content of the encoded field is specified by the Shape referenced by the ShapeIndex.
|
|
52
58
|
* This is a tuple for conciseness.
|
|
@@ -185,6 +191,10 @@ export const EncodedChunkShape = Type.Object(
|
|
|
185
191
|
* {@link EncodedAnyShape} union member.
|
|
186
192
|
*/
|
|
187
193
|
d: Type.Optional(EncodedAnyShape),
|
|
194
|
+
/**
|
|
195
|
+
* {@link EncodedIncrementalChunkShape} union member.
|
|
196
|
+
*/
|
|
197
|
+
e: Type.Optional(EncodedIncrementalChunkShape),
|
|
188
198
|
},
|
|
189
199
|
unionOptions,
|
|
190
200
|
);
|
|
@@ -195,6 +205,7 @@ export type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;
|
|
|
195
205
|
export type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;
|
|
196
206
|
export type EncodedNodeShape = Static<typeof EncodedNodeShape>;
|
|
197
207
|
export type EncodedAnyShape = Static<typeof EncodedAnyShape>;
|
|
208
|
+
export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
|
|
198
209
|
|
|
199
210
|
export const EncodedFieldBatch = EncodedFieldBatchGeneric(version, EncodedChunkShape);
|
|
200
211
|
export type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ValueSchema,
|
|
17
17
|
Multiplicity,
|
|
18
18
|
identifierFieldKindIdentifier,
|
|
19
|
+
type FieldKey,
|
|
19
20
|
} from "../../../core/index.js";
|
|
20
21
|
import type { FullSchemaPolicy } from "../../modular-schema/index.js";
|
|
21
22
|
|
|
@@ -28,13 +29,19 @@ import {
|
|
|
28
29
|
anyNodeEncoder,
|
|
29
30
|
asFieldEncoder,
|
|
30
31
|
compressedEncode,
|
|
32
|
+
incrementalFieldEncoder,
|
|
31
33
|
} from "./compressedEncode.js";
|
|
32
34
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
33
35
|
import { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from "./format.js";
|
|
36
|
+
import type { IncrementalEncoder } from "./codecs.js";
|
|
34
37
|
import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
40
|
* Encode data from `fieldBatch` in into an `EncodedChunk`.
|
|
41
|
+
* @remarks
|
|
42
|
+
* If `incrementalEncoder` is provided,
|
|
43
|
+
* fields that support incremental encoding will encode their chunks separately via the `incrementalEncoder`.
|
|
44
|
+
* See {@link IncrementalEncoder} for more details.
|
|
38
45
|
*
|
|
39
46
|
* Optimized for encoded size and encoding performance.
|
|
40
47
|
* TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.
|
|
@@ -44,22 +51,28 @@ export function schemaCompressedEncode(
|
|
|
44
51
|
policy: FullSchemaPolicy,
|
|
45
52
|
fieldBatch: FieldBatch,
|
|
46
53
|
idCompressor: IIdCompressor,
|
|
54
|
+
incrementalEncoder?: IncrementalEncoder,
|
|
47
55
|
): EncodedFieldBatch {
|
|
48
|
-
return compressedEncode(
|
|
56
|
+
return compressedEncode(
|
|
57
|
+
fieldBatch,
|
|
58
|
+
buildContext(schema, policy, idCompressor, incrementalEncoder),
|
|
59
|
+
);
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export function buildContext(
|
|
52
63
|
storedSchema: StoredSchemaCollection,
|
|
53
64
|
policy: FullSchemaPolicy,
|
|
54
65
|
idCompressor: IIdCompressor,
|
|
66
|
+
incrementalEncoder?: IncrementalEncoder,
|
|
55
67
|
): EncoderContext {
|
|
56
68
|
const context: EncoderContext = new EncoderContext(
|
|
57
69
|
(fieldBuilder: FieldEncodeBuilder, schemaName: TreeNodeSchemaIdentifier) =>
|
|
58
|
-
getNodeEncoder(fieldBuilder, storedSchema, schemaName),
|
|
70
|
+
getNodeEncoder(fieldBuilder, storedSchema, schemaName, incrementalEncoder),
|
|
59
71
|
(nodeBuilder: NodeEncodeBuilder, fieldSchema: TreeFieldStoredSchema) =>
|
|
60
72
|
getFieldEncoder(nodeBuilder, fieldSchema, context, storedSchema),
|
|
61
73
|
policy.fieldKinds,
|
|
62
74
|
idCompressor,
|
|
75
|
+
incrementalEncoder,
|
|
63
76
|
);
|
|
64
77
|
return context;
|
|
65
78
|
}
|
|
@@ -111,6 +124,7 @@ export function getNodeEncoder(
|
|
|
111
124
|
fieldBuilder: FieldEncodeBuilder,
|
|
112
125
|
storedSchema: StoredSchemaCollection,
|
|
113
126
|
schemaName: TreeNodeSchemaIdentifier,
|
|
127
|
+
incrementalEncoder?: IncrementalEncoder,
|
|
114
128
|
): NodeShapeBasedEncoder {
|
|
115
129
|
const schema =
|
|
116
130
|
storedSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);
|
|
@@ -120,9 +134,20 @@ export function getNodeEncoder(
|
|
|
120
134
|
// consider moving some optional and sequence fields to extra fields if they are commonly empty
|
|
121
135
|
// to reduce encoded size.
|
|
122
136
|
|
|
137
|
+
const shouldEncodeFieldIncrementallyLocal = (
|
|
138
|
+
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
139
|
+
fieldKey: FieldKey,
|
|
140
|
+
): boolean =>
|
|
141
|
+
incrementalEncoder?.shouldEncodeFieldIncrementally(nodeIdentifier, fieldKey) ?? false;
|
|
123
142
|
const objectNodeFields: KeyedFieldEncoder[] = [];
|
|
124
143
|
for (const [key, field] of schema.objectNodeFields ?? []) {
|
|
125
|
-
|
|
144
|
+
const fieldEncoder = shouldEncodeFieldIncrementallyLocal(schemaName, key)
|
|
145
|
+
? incrementalFieldEncoder
|
|
146
|
+
: fieldBuilder.fieldEncoderFromSchema(field);
|
|
147
|
+
objectNodeFields.push({
|
|
148
|
+
key,
|
|
149
|
+
encoder: fieldEncoder,
|
|
150
|
+
});
|
|
126
151
|
}
|
|
127
152
|
|
|
128
153
|
const shape = new NodeShapeBasedEncoder(schemaName, false, objectNodeFields, undefined);
|
|
@@ -26,6 +26,9 @@ export function makeForestSummarizerCodec(
|
|
|
26
26
|
fieldBatchCodec: FieldBatchCodec,
|
|
27
27
|
): ForestCodec {
|
|
28
28
|
const inner = fieldBatchCodec;
|
|
29
|
+
// TODO: AB#41865
|
|
30
|
+
// This needs to be updated to support multiple versions.
|
|
31
|
+
// The second version will be used to enable incremental summarization.
|
|
29
32
|
return makeVersionedValidatedCodec(options, new Set([1]), Format, {
|
|
30
33
|
encode: (data: FieldSet, context: FieldBatchEncodingContext): Format => {
|
|
31
34
|
const keys: FieldKey[] = [];
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
ISummaryTreeWithStats,
|
|
13
13
|
ITelemetryContext,
|
|
14
14
|
} from "@fluidframework/runtime-definitions/internal";
|
|
15
|
-
import { createSingleBlobSummary } from "@fluidframework/shared-object-base/internal";
|
|
16
15
|
|
|
17
16
|
import type { CodecWriteOptions } from "../../codec/index.js";
|
|
18
17
|
import {
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
type ITreeSubscriptionCursor,
|
|
25
24
|
type RevisionTagCodec,
|
|
26
25
|
TreeNavigationResult,
|
|
26
|
+
type TreeNodeSchemaIdentifier,
|
|
27
27
|
applyDelta,
|
|
28
28
|
forEachField,
|
|
29
29
|
makeDetachedFieldIndex,
|
|
@@ -33,25 +33,37 @@ import type {
|
|
|
33
33
|
SummaryElementParser,
|
|
34
34
|
SummaryElementStringifier,
|
|
35
35
|
} from "../../shared-tree-core/index.js";
|
|
36
|
-
import { idAllocatorFromMaxId } from "../../util/index.js";
|
|
37
|
-
|
|
36
|
+
import { idAllocatorFromMaxId, type JsonCompatible } from "../../util/index.js";
|
|
37
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
38
|
+
import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
|
|
38
39
|
import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
|
|
39
40
|
|
|
40
41
|
import { type ForestCodec, makeForestSummarizerCodec } from "./codec.js";
|
|
41
|
-
import
|
|
42
|
+
import {
|
|
43
|
+
ForestIncrementalSummaryBehavior,
|
|
44
|
+
ForestIncrementalSummaryBuilder,
|
|
45
|
+
forestSummaryContentKey,
|
|
46
|
+
} from "./incrementalSummaryBuilder.js";
|
|
47
|
+
import { TreeCompressionStrategyExtended } from "../treeCompressionUtils.js";
|
|
48
|
+
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
|
-
* The
|
|
51
|
+
* The key for the tree that contains the overall forest's summary tree.
|
|
52
|
+
* This tree is added by the parent of the forest summarizer.
|
|
53
|
+
* See {@link ForestIncrementalSummaryBuilder} for details on the summary structure.
|
|
44
54
|
*/
|
|
45
|
-
export const
|
|
55
|
+
export const forestSummaryKey = "Forest";
|
|
46
56
|
|
|
47
57
|
/**
|
|
48
58
|
* Provides methods for summarizing and loading a forest.
|
|
49
59
|
*/
|
|
50
60
|
export class ForestSummarizer implements Summarizable {
|
|
51
|
-
public readonly key =
|
|
61
|
+
public readonly key = forestSummaryKey;
|
|
52
62
|
|
|
53
63
|
private readonly codec: ForestCodec;
|
|
54
64
|
|
|
65
|
+
private readonly incrementalSummaryBuilder: ForestIncrementalSummaryBuilder;
|
|
66
|
+
|
|
55
67
|
/**
|
|
56
68
|
* @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.
|
|
57
69
|
*/
|
|
@@ -62,19 +74,45 @@ export class ForestSummarizer implements Summarizable {
|
|
|
62
74
|
private readonly encoderContext: FieldBatchEncodingContext,
|
|
63
75
|
options: CodecWriteOptions,
|
|
64
76
|
private readonly idCompressor: IIdCompressor,
|
|
77
|
+
shouldEncodeFieldIncrementally?: (
|
|
78
|
+
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
79
|
+
fieldKey: FieldKey,
|
|
80
|
+
) => boolean,
|
|
65
81
|
) {
|
|
66
82
|
// TODO: this should take in CodecWriteOptions, and use it to pick the write version.
|
|
67
83
|
this.codec = makeForestSummarizerCodec(options, fieldBatchCodec);
|
|
84
|
+
|
|
85
|
+
const shouldEncodeFieldIncrementallyLocal = (
|
|
86
|
+
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
87
|
+
fieldKey: FieldKey,
|
|
88
|
+
): boolean => shouldEncodeFieldIncrementally?.(nodeIdentifier, fieldKey) ?? false;
|
|
89
|
+
this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(
|
|
90
|
+
encoderContext.encodeType ===
|
|
91
|
+
TreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,
|
|
92
|
+
(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),
|
|
93
|
+
shouldEncodeFieldIncrementallyLocal,
|
|
94
|
+
);
|
|
68
95
|
}
|
|
69
96
|
|
|
70
97
|
/**
|
|
71
|
-
*
|
|
98
|
+
* Summarization of the forest's tree content.
|
|
99
|
+
* @returns a summary tree containing the forest's tree content.
|
|
100
|
+
* @remarks
|
|
101
|
+
* If incremental summary is disabled, all the content will be added to a single summary blob.
|
|
102
|
+
* If incremental summary is enabled, the summary will be a tree.
|
|
103
|
+
* See {@link ForestIncrementalSummaryBuilder} for details of what this tree looks like.
|
|
72
104
|
*
|
|
73
105
|
* TODO: when perf matters, this should be replaced with a chunked async version using a binary format.
|
|
74
|
-
*
|
|
75
|
-
* @returns a snapshot of the forest's tree as a string.
|
|
76
106
|
*/
|
|
77
|
-
|
|
107
|
+
public summarize(props: {
|
|
108
|
+
stringify: SummaryElementStringifier;
|
|
109
|
+
fullTree?: boolean;
|
|
110
|
+
trackState?: boolean;
|
|
111
|
+
telemetryContext?: ITelemetryContext;
|
|
112
|
+
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext;
|
|
113
|
+
}): ISummaryTreeWithStats {
|
|
114
|
+
const { stringify, fullTree = false, incrementalSummaryContext } = props;
|
|
115
|
+
|
|
78
116
|
const rootCursor = this.forest.getCursorAboveDetachedFields();
|
|
79
117
|
const fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =
|
|
80
118
|
new Map();
|
|
@@ -89,55 +127,85 @@ export class ForestSummarizer implements Summarizable {
|
|
|
89
127
|
);
|
|
90
128
|
fieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);
|
|
91
129
|
});
|
|
92
|
-
const encoded = this.codec.encode(fieldMap, this.encoderContext);
|
|
93
130
|
|
|
131
|
+
// Let the incremental summary builder know that we are starting a new summary.
|
|
132
|
+
// It returns whether incremental encoding is enabled.
|
|
133
|
+
const incrementalSummaryBehavior = this.incrementalSummaryBuilder.startSummary({
|
|
134
|
+
fullTree,
|
|
135
|
+
incrementalSummaryContext,
|
|
136
|
+
stringify,
|
|
137
|
+
});
|
|
138
|
+
const encoderContext: FieldBatchEncodingContext = {
|
|
139
|
+
...this.encoderContext,
|
|
140
|
+
incrementalEncoderDecoder:
|
|
141
|
+
incrementalSummaryBehavior === ForestIncrementalSummaryBehavior.Incremental
|
|
142
|
+
? this.incrementalSummaryBuilder
|
|
143
|
+
: undefined,
|
|
144
|
+
};
|
|
145
|
+
const encoded = this.codec.encode(fieldMap, encoderContext);
|
|
94
146
|
fieldMap.forEach((value) => value.free());
|
|
95
|
-
return stringify(encoded);
|
|
96
|
-
}
|
|
97
147
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
telemetryContext?: ITelemetryContext;
|
|
103
|
-
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext;
|
|
104
|
-
}): ISummaryTreeWithStats {
|
|
105
|
-
return createSingleBlobSummary(treeBlobKey, this.getTreeString(props.stringify));
|
|
148
|
+
return this.incrementalSummaryBuilder.completeSummary({
|
|
149
|
+
incrementalSummaryContext,
|
|
150
|
+
forestSummaryContent: stringify(encoded),
|
|
151
|
+
});
|
|
106
152
|
}
|
|
107
153
|
|
|
108
154
|
public async load(
|
|
109
155
|
services: IChannelStorageService,
|
|
110
156
|
parse: SummaryElementParser,
|
|
111
157
|
): Promise<void> {
|
|
112
|
-
|
|
113
|
-
|
|
158
|
+
// The contents of the top-level forest must be present under a summary blob named `forestSummaryContentKey`.
|
|
159
|
+
// If the summary was generated as `ForestIncrementalSummaryBehavior.SingleBlob`, this blob will contain all
|
|
160
|
+
// of forest's contents.
|
|
161
|
+
// If the summary was generated as `ForestIncrementalSummaryBehavior.Incremental`, this blob will contain only
|
|
162
|
+
// the top-level forest node's contents.
|
|
163
|
+
// The contents of the incremental chunks will be in separate tree nodes and will be read later during decoding.
|
|
164
|
+
assert(
|
|
165
|
+
await services.contains(forestSummaryContentKey),
|
|
166
|
+
0xc21 /* Forest summary content missing in snapshot */,
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const readAndParseBlob = async <T extends JsonCompatible<IFluidHandle>>(
|
|
170
|
+
id: string,
|
|
171
|
+
): Promise<T> => {
|
|
172
|
+
const treeBuffer = await services.readBlob(id);
|
|
114
173
|
const treeBufferString = bufferToString(treeBuffer, "utf8");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
174
|
+
return parse(treeBufferString) as T;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Load the incremental summary builder so that it can download any incremental chunks in the
|
|
178
|
+
// snapshot.
|
|
179
|
+
await this.incrementalSummaryBuilder.load(services, readAndParseBlob);
|
|
180
|
+
|
|
181
|
+
// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the
|
|
182
|
+
// forest summary format.
|
|
183
|
+
const fields = this.codec.decode(await readAndParseBlob(forestSummaryContentKey), {
|
|
184
|
+
...this.encoderContext,
|
|
185
|
+
incrementalEncoderDecoder: this.incrementalSummaryBuilder,
|
|
186
|
+
});
|
|
187
|
+
const allocator = idAllocatorFromMaxId();
|
|
188
|
+
const fieldChanges: [FieldKey, DeltaFieldChanges][] = [];
|
|
189
|
+
const build: DeltaDetachedNodeBuild[] = [];
|
|
190
|
+
for (const [fieldKey, field] of fields) {
|
|
191
|
+
const chunked = chunkFieldSingle(field, {
|
|
192
|
+
policy: defaultChunkPolicy,
|
|
193
|
+
idCompressor: this.idCompressor,
|
|
194
|
+
});
|
|
195
|
+
const buildId = { minor: allocator.allocate(chunked.topLevelLength) };
|
|
196
|
+
build.push({
|
|
197
|
+
id: buildId,
|
|
198
|
+
trees: chunked,
|
|
199
|
+
});
|
|
200
|
+
fieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);
|
|
141
201
|
}
|
|
202
|
+
|
|
203
|
+
assert(this.forest.isEmpty, 0x797 /* forest must be empty */);
|
|
204
|
+
applyDelta(
|
|
205
|
+
{ build, fields: new Map(fieldChanges) },
|
|
206
|
+
undefined,
|
|
207
|
+
this.forest,
|
|
208
|
+
makeDetachedFieldIndex("init", this.revisionTagCodec, this.idCompressor),
|
|
209
|
+
);
|
|
142
210
|
}
|
|
143
211
|
}
|