@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
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
SchemaVersion,
|
|
36
36
|
type TaggedChange,
|
|
37
37
|
type TreeFieldStoredSchema,
|
|
38
|
+
type TreeNodeSchemaIdentifier,
|
|
38
39
|
type TreeNodeStoredSchema,
|
|
39
40
|
type TreeStoredSchema,
|
|
40
41
|
TreeStoredSchemaRepository,
|
|
@@ -56,6 +57,7 @@ import {
|
|
|
56
57
|
makeMitigatedChangeFamily,
|
|
57
58
|
makeSchemaCodec,
|
|
58
59
|
makeTreeChunker,
|
|
60
|
+
type TreeCompressionStrategyPrivate,
|
|
59
61
|
} from "../feature-libraries/index.js";
|
|
60
62
|
// eslint-disable-next-line import/no-internal-modules
|
|
61
63
|
import type { FormatV1 } from "../feature-libraries/schema-index/index.js";
|
|
@@ -271,6 +273,7 @@ export class SharedTreeKernel
|
|
|
271
273
|
encoderContext,
|
|
272
274
|
options,
|
|
273
275
|
idCompressor,
|
|
276
|
+
options.shouldEncodeFieldIncrementally,
|
|
274
277
|
);
|
|
275
278
|
const removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);
|
|
276
279
|
const innerChangeFamily = new SharedTreeChangeFamily(
|
|
@@ -582,12 +585,25 @@ export type SharedTreeOptions = Partial<CodecWriteOptions> &
|
|
|
582
585
|
Partial<SharedTreeFormatOptions> &
|
|
583
586
|
ForestOptions;
|
|
584
587
|
|
|
585
|
-
export interface SharedTreeOptionsInternal
|
|
588
|
+
export interface SharedTreeOptionsInternal
|
|
589
|
+
extends Omit<SharedTreeOptions, "treeEncodeType">,
|
|
590
|
+
Partial<SharedTreeFormatOptionsInternal> {
|
|
586
591
|
disposeForksAfterTransaction?: boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Returns whether a field should be incrementally encoded.
|
|
594
|
+
* @param nodeIdentifier - The identifier of the node containing the field.
|
|
595
|
+
* @param fieldKey - The key of the field to check.
|
|
596
|
+
* @remarks
|
|
597
|
+
* The policy for which fields should get incremental encoding should eventually be specified some other way.
|
|
598
|
+
*/
|
|
599
|
+
shouldEncodeFieldIncrementally?(
|
|
600
|
+
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
601
|
+
fieldKey: FieldKey,
|
|
602
|
+
): boolean;
|
|
587
603
|
}
|
|
588
604
|
/**
|
|
589
605
|
* Configuration options for SharedTree's internal tree storage.
|
|
590
|
-
* @
|
|
606
|
+
* @beta @input
|
|
591
607
|
*/
|
|
592
608
|
export interface ForestOptions {
|
|
593
609
|
/**
|
|
@@ -598,7 +614,7 @@ export interface ForestOptions {
|
|
|
598
614
|
|
|
599
615
|
/**
|
|
600
616
|
* Options for configuring the persisted format SharedTree uses.
|
|
601
|
-
* @alpha
|
|
617
|
+
* @alpha @input
|
|
602
618
|
*/
|
|
603
619
|
export interface SharedTreeFormatOptions {
|
|
604
620
|
/**
|
|
@@ -620,11 +636,22 @@ export interface SharedTreeFormatOptions {
|
|
|
620
636
|
formatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];
|
|
621
637
|
}
|
|
622
638
|
|
|
639
|
+
export interface SharedTreeFormatOptionsInternal
|
|
640
|
+
extends Omit<SharedTreeFormatOptions, "treeEncodeType"> {
|
|
641
|
+
treeEncodeType: TreeCompressionStrategyPrivate;
|
|
642
|
+
}
|
|
643
|
+
|
|
623
644
|
/**
|
|
624
645
|
* Used to distinguish between different forest types.
|
|
625
646
|
* @remarks
|
|
647
|
+
* The "Forest" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.
|
|
648
|
+
* ForestTypes should all have the same behavior, but may differ in performance and debuggability.
|
|
649
|
+
*
|
|
626
650
|
* Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.
|
|
627
|
-
* @
|
|
651
|
+
* @privateRemarks
|
|
652
|
+
* Implement using {@link toForestType}.
|
|
653
|
+
* Consume using {@link buildConfiguredForest}.
|
|
654
|
+
* @sealed @beta
|
|
628
655
|
*/
|
|
629
656
|
export interface ForestType extends ErasedType<"ForestType"> {}
|
|
630
657
|
|
|
@@ -698,6 +725,12 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
|
|
|
698
725
|
treeEncodeType: TreeCompressionStrategy.Compressed,
|
|
699
726
|
formatVersion: SharedTreeFormatVersion.v3,
|
|
700
727
|
disposeForksAfterTransaction: true,
|
|
728
|
+
shouldEncodeFieldIncrementally: (
|
|
729
|
+
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
730
|
+
fieldKey: FieldKey,
|
|
731
|
+
): boolean => {
|
|
732
|
+
return false;
|
|
733
|
+
},
|
|
701
734
|
};
|
|
702
735
|
|
|
703
736
|
function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
ModularChangeFamily,
|
|
24
24
|
type ModularChangeset,
|
|
25
25
|
type TreeChunk,
|
|
26
|
-
type
|
|
26
|
+
type TreeCompressionStrategyPrivate,
|
|
27
27
|
fieldKindConfigurations,
|
|
28
28
|
fieldKinds,
|
|
29
29
|
makeModularChangeCodecFamily,
|
|
@@ -61,7 +61,7 @@ export class SharedTreeChangeFamily
|
|
|
61
61
|
revisionTagCodec: RevisionTagCodec,
|
|
62
62
|
fieldBatchCodec: FieldBatchCodec,
|
|
63
63
|
codecOptions: ICodecOptions,
|
|
64
|
-
chunkCompressionStrategy?:
|
|
64
|
+
chunkCompressionStrategy?: TreeCompressionStrategyPrivate,
|
|
65
65
|
private readonly idCompressor?: IIdCompressor,
|
|
66
66
|
) {
|
|
67
67
|
const modularChangeCodec = makeModularChangeCodecFamily(
|
package/src/shared-tree/tree.ts
CHANGED
|
@@ -60,6 +60,9 @@ export interface Tree extends TreeNodeApi {
|
|
|
60
60
|
export const Tree: Tree = {
|
|
61
61
|
...treeNodeApi,
|
|
62
62
|
|
|
63
|
+
// Note: the implementation details of `createRunTransaction` are deprecated.
|
|
64
|
+
// We have introduced replacement `@alpha` APIs on `TreeBranch`, but until they are `@public`, we can't reasonably deprecated this.
|
|
65
|
+
// Once they have been promoted to public, we can deprecate this API.
|
|
63
66
|
runTransaction: createRunTransaction(),
|
|
64
67
|
|
|
65
68
|
contains(parent: TreeNode, child: TreeNode): boolean {
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
toInitialSchema,
|
|
55
55
|
convertField,
|
|
56
56
|
toUnhydratedSchema,
|
|
57
|
+
type TreeParsingOptions,
|
|
57
58
|
} from "../simple-tree/index.js";
|
|
58
59
|
import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js";
|
|
59
60
|
import {
|
|
@@ -201,7 +202,7 @@ export interface TreeIdentifierUtils {
|
|
|
201
202
|
* Note that {@link (TreeBeta:interface).clone} can create an unhydrated node with unknown optional fields, as it uses the source node's stored schema (if any).
|
|
202
203
|
*
|
|
203
204
|
* Export APIs in this interface include {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields | unknown optional fields}
|
|
204
|
-
* if they are using {@link
|
|
205
|
+
* if they are using {@link KeyEncodingOptions.allStoredKeys}.
|
|
205
206
|
*
|
|
206
207
|
* @privateRemarks
|
|
207
208
|
* TODO:
|
|
@@ -273,18 +274,16 @@ export interface TreeAlpha {
|
|
|
273
274
|
* @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
|
|
274
275
|
* @param data - The data used to construct the field content. See {@link (TreeAlpha:interface).(exportVerbose:1)}.
|
|
275
276
|
* @remarks
|
|
276
|
-
* This currently does not support input containing
|
|
277
|
-
* @
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* Does it robustly validate? How do you use it with schema evolution features like staged allowed types and allowUnknownOptionalFields? Which errors are deferred until insertion/hydration?
|
|
282
|
-
* Ensure whatever policy is chosen is documented, enforces, tested and applied consistently to all import code paths.
|
|
277
|
+
* This currently does not support input containing
|
|
278
|
+
* {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields| unknown optional fields} but does support
|
|
279
|
+
* {@link SchemaStaticsAlpha.staged | staged} allowed types.
|
|
280
|
+
* Non-empty default values for fields are currently not supported (must be provided in the input).
|
|
281
|
+
* The content will be validated against the schema and an error will be thrown if out of schema.
|
|
283
282
|
*/
|
|
284
283
|
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
285
284
|
schema: TSchema,
|
|
286
285
|
data: VerboseTree | undefined,
|
|
287
|
-
options?:
|
|
286
|
+
options?: TreeParsingOptions,
|
|
288
287
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
289
288
|
|
|
290
289
|
/**
|
|
@@ -322,7 +321,7 @@ export interface TreeAlpha {
|
|
|
322
321
|
* If an `idCompressor` is provided, it will be used to compress identifiers and thus will be needed to decompress the data.
|
|
323
322
|
*
|
|
324
323
|
* Always uses "stored" keys.
|
|
325
|
-
* See {@link
|
|
324
|
+
* See {@link KeyEncodingOptions.allStoredKeys} for details.
|
|
326
325
|
* @privateRemarks
|
|
327
326
|
* TODO: It is currently not clear how to work with the idCompressors correctly in the package API.
|
|
328
327
|
* Better APIs should probably be provided as there is currently no way to associate an un-hydrated tree with an idCompressor,
|
|
@@ -482,7 +481,7 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
482
481
|
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
483
482
|
schema: TSchema,
|
|
484
483
|
data: VerboseTree | undefined,
|
|
485
|
-
options?:
|
|
484
|
+
options?: TreeParsingOptions,
|
|
486
485
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
487
486
|
const config: TreeEncodingOptions = { ...options };
|
|
488
487
|
// Create a config which is standalone, and thus can be used without having to refer back to the schema.
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from "../core/index.js";
|
|
51
51
|
import {
|
|
52
52
|
type FieldBatchCodec,
|
|
53
|
-
type
|
|
53
|
+
type TreeCompressionStrategyPrivate,
|
|
54
54
|
allowsRepoSuperset,
|
|
55
55
|
buildForest,
|
|
56
56
|
createNodeIdentifierManager,
|
|
@@ -286,7 +286,7 @@ export function createTreeCheckout(
|
|
|
286
286
|
forest?: IEditableForest;
|
|
287
287
|
fieldBatchCodec?: FieldBatchCodec;
|
|
288
288
|
removedRoots?: DetachedFieldIndex;
|
|
289
|
-
chunkCompressionStrategy?:
|
|
289
|
+
chunkCompressionStrategy?: TreeCompressionStrategyPrivate;
|
|
290
290
|
logger?: ITelemetryLoggerExt;
|
|
291
291
|
breaker?: Breakable;
|
|
292
292
|
disposeForksAfterTransaction?: boolean;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
9
|
+
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
9
10
|
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
10
11
|
import type {
|
|
11
12
|
IExperimentalIncrementalSummaryContext,
|
|
@@ -517,5 +518,21 @@ function scopeStorageService(
|
|
|
517
518
|
async list(path) {
|
|
518
519
|
return service.list(`${scope}${path}`);
|
|
519
520
|
},
|
|
521
|
+
getSnapshotTree(): ISnapshotTree | undefined {
|
|
522
|
+
const snapshotTree = service.getSnapshotTree?.();
|
|
523
|
+
if (snapshotTree === undefined) {
|
|
524
|
+
return undefined;
|
|
525
|
+
}
|
|
526
|
+
let scopedTree = snapshotTree;
|
|
527
|
+
for (const element of pathElements) {
|
|
528
|
+
const tree = scopedTree.trees[element];
|
|
529
|
+
assert(
|
|
530
|
+
tree !== undefined,
|
|
531
|
+
0xc20 /* snapshot tree not found for one of tree's summarizables */,
|
|
532
|
+
);
|
|
533
|
+
scopedTree = tree;
|
|
534
|
+
}
|
|
535
|
+
return scopedTree;
|
|
536
|
+
},
|
|
520
537
|
};
|
|
521
538
|
}
|
|
@@ -9,14 +9,14 @@ import { pkgVersion } from "./packageVersion.js";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
12
|
-
* @
|
|
12
|
+
* @beta
|
|
13
13
|
* @legacy
|
|
14
14
|
*/
|
|
15
15
|
export const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
19
|
-
* @
|
|
19
|
+
* @beta
|
|
20
20
|
* @legacy
|
|
21
21
|
*/
|
|
22
22
|
export const SharedTreeAttributes: IChannelAttributes = {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
replaceHandles,
|
|
14
14
|
type TreeEncodingOptions,
|
|
15
15
|
type HandleConverter,
|
|
16
|
+
KeyEncodingOptions,
|
|
16
17
|
} from "./customTree.js";
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -46,7 +47,7 @@ export function conciseFromCursor(
|
|
|
46
47
|
options: TreeEncodingOptions,
|
|
47
48
|
): ConciseTree {
|
|
48
49
|
const config: Required<TreeEncodingOptions> = {
|
|
49
|
-
|
|
50
|
+
keys: KeyEncodingOptions.usePropertyKeys,
|
|
50
51
|
...options,
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { assert, fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
|
|
@@ -36,24 +36,56 @@ import { isObjectNodeSchema } from "../node-kinds/index.js";
|
|
|
36
36
|
/**
|
|
37
37
|
* Options for how to interpret or encode a tree when schema information is available.
|
|
38
38
|
* @alpha
|
|
39
|
+
* @input
|
|
39
40
|
*/
|
|
40
|
-
export interface TreeEncodingOptions {
|
|
41
|
+
export interface TreeEncodingOptions<TKeyOptions = KeyEncodingOptions> {
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
-
* If false, use the property keys.
|
|
43
|
+
* How to handle field keys.
|
|
44
44
|
* @remarks
|
|
45
45
|
* Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.
|
|
46
46
|
*
|
|
47
47
|
* {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields|Unknown optional field} will be omitted when using property keys.
|
|
48
|
-
* @defaultValue
|
|
49
|
-
* @privateRemarks
|
|
50
|
-
* TODO AB#43548:
|
|
51
|
-
* Replace this with an enum that provides three options:
|
|
52
|
-
* - `usePropertyKeys`: use property keys. Supported for import and export.
|
|
53
|
-
* - `allStoredKeys`: use stored keys, and include unknown optional fields. Supported for export only, at least for the short term.
|
|
54
|
-
* - `knownStoredKeys`: use stored keys but do not include unknown optional fields. Supported for import and export.
|
|
48
|
+
* @defaultValue {@link KeyEncodingOptions.usePropertyKeys}.
|
|
55
49
|
*/
|
|
56
|
-
readonly
|
|
50
|
+
readonly keys?: TKeyOptions;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Options for how to interpret a tree when schema information is available.
|
|
55
|
+
* @alpha
|
|
56
|
+
* @input
|
|
57
|
+
*/
|
|
58
|
+
export type TreeParsingOptions = TreeEncodingOptions<
|
|
59
|
+
KeyEncodingOptions.usePropertyKeys | KeyEncodingOptions.knownStoredKeys
|
|
60
|
+
>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Options for how to encode keys in a tree.
|
|
64
|
+
* @alpha
|
|
65
|
+
* @input
|
|
66
|
+
*/
|
|
67
|
+
export enum KeyEncodingOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Use property keys.
|
|
70
|
+
* @remarks
|
|
71
|
+
* Supported for import and export.
|
|
72
|
+
* {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields|Unknown optional fields} will be omitted when using property keys.
|
|
73
|
+
*/
|
|
74
|
+
usePropertyKeys = "usePropertyKeys",
|
|
75
|
+
/**
|
|
76
|
+
* Use stored keys, and include {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields|Unknown optional fields}.
|
|
77
|
+
* @remarks
|
|
78
|
+
* Currently only supported for export.
|
|
79
|
+
*/
|
|
80
|
+
allStoredKeys = "allStoredKeys",
|
|
81
|
+
/**
|
|
82
|
+
* Use stored keys but do not include {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields|Unknown optional fields}.
|
|
83
|
+
* @remarks
|
|
84
|
+
* Supported for import and export.
|
|
85
|
+
* For export, this omits unknown optional fields.
|
|
86
|
+
* For import, any unexpected fields are errors, regardless of {@link SchemaFactoryObjectOptions.allowUnknownOptionalFields}.
|
|
87
|
+
*/
|
|
88
|
+
knownStoredKeys = "knownStoredKeys",
|
|
57
89
|
}
|
|
58
90
|
|
|
59
91
|
/**
|
|
@@ -140,27 +172,12 @@ export function customFromCursor<TChild>(
|
|
|
140
172
|
forEachField(reader, () => {
|
|
141
173
|
assert(reader.getFieldLength() === 1, 0xa19 /* invalid children number */);
|
|
142
174
|
const storedKey = reader.getFieldKey();
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (isObjectNodeSchema(viewSchema)) {
|
|
148
|
-
const propertyKey = viewSchema.storedKeyToPropertyKey.get(storedKey);
|
|
149
|
-
if (propertyKey === undefined) {
|
|
150
|
-
assert(
|
|
151
|
-
viewSchema.allowUnknownOptionalFields,
|
|
152
|
-
0xc00 /* found unknown field where not allowed */,
|
|
153
|
-
);
|
|
154
|
-
// Skip unknown optional fields when using property keys.
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
key = propertyKey;
|
|
158
|
-
} else {
|
|
159
|
-
key = storedKey;
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
key = storedKey;
|
|
175
|
+
const key = getKeyFromOptions(options.keys, type, storedKey, schema);
|
|
176
|
+
if (key === undefined) {
|
|
177
|
+
// Skip unknown optional fields when using property keys or only known stored keys.
|
|
178
|
+
return;
|
|
163
179
|
}
|
|
180
|
+
|
|
164
181
|
reader.enterNode(0);
|
|
165
182
|
fields[key] = childHandler(reader, options, storedSchema, schema);
|
|
166
183
|
reader.exitNode();
|
|
@@ -171,6 +188,59 @@ export function customFromCursor<TChild>(
|
|
|
171
188
|
}
|
|
172
189
|
}
|
|
173
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Returns the key if one should be used, and undefined if the field should be omitted/skipped.
|
|
193
|
+
*
|
|
194
|
+
* @param schema - Collection of known view schema.
|
|
195
|
+
* If `options` is not `KeyEncodingOptions.allStoredKeys`, this must provide the schema for the `type`.
|
|
196
|
+
* Note that if using this to perform a recursive walk, and `schema` has all view schema reachable from the starting type,
|
|
197
|
+
* then it should be safe to use the same schema map on every invocation since types missing from it will only be
|
|
198
|
+
* encountered after traversing unknown optional fields which for which this will return undefined.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* Asserts that if encountering an unknown optional field, the schema allows them.
|
|
202
|
+
* This is not robustly validated in all cases: when in allStoredKeys, it is not checked
|
|
203
|
+
* (since the view schema might not even be available).
|
|
204
|
+
*/
|
|
205
|
+
function getKeyFromOptions(
|
|
206
|
+
options: KeyEncodingOptions,
|
|
207
|
+
type: TreeNodeSchemaIdentifier,
|
|
208
|
+
storedKey: FieldKey,
|
|
209
|
+
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
210
|
+
): string | undefined {
|
|
211
|
+
switch (options) {
|
|
212
|
+
case KeyEncodingOptions.allStoredKeys:
|
|
213
|
+
// Since this case might be inside of an unknown optional field,
|
|
214
|
+
// it must not depend on there being a view schema.
|
|
215
|
+
// Fortunately, its possible to implement this case without one.
|
|
216
|
+
return storedKey;
|
|
217
|
+
case KeyEncodingOptions.usePropertyKeys:
|
|
218
|
+
case KeyEncodingOptions.knownStoredKeys: {
|
|
219
|
+
// Both these cases avoid traversing into unknown optional fields,
|
|
220
|
+
// so a view schema should be available.
|
|
221
|
+
const viewSchema =
|
|
222
|
+
schema.get(type) ?? fail(0xbff /* missing schema for type in cursor */);
|
|
223
|
+
if (isObjectNodeSchema(viewSchema)) {
|
|
224
|
+
const propertyKey = viewSchema.storedKeyToPropertyKey.get(storedKey);
|
|
225
|
+
if (propertyKey === undefined) {
|
|
226
|
+
assert(
|
|
227
|
+
viewSchema.allowUnknownOptionalFields,
|
|
228
|
+
0xc00 /* found unknown field where not allowed */,
|
|
229
|
+
);
|
|
230
|
+
// Skip unknown optional fields when using property keys or only known stored keys.
|
|
231
|
+
return undefined;
|
|
232
|
+
} else {
|
|
233
|
+
return options === KeyEncodingOptions.usePropertyKeys ? propertyKey : storedKey;
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
return storedKey;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
default:
|
|
240
|
+
unreachableCase(options);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
174
244
|
/**
|
|
175
245
|
* Builds an {@link CustomTree} from a cursor in Nodes mode.
|
|
176
246
|
* @remarks
|
|
@@ -6,14 +6,18 @@
|
|
|
6
6
|
import type { JsonTreeSchema } from "./jsonSchema.js";
|
|
7
7
|
import type { ImplicitAllowedTypes } from "../core/index.js";
|
|
8
8
|
import { toJsonSchema } from "./simpleSchemaToJsonSchema.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { TreeParsingOptions } from "./customTree.js";
|
|
10
10
|
import { TreeViewConfigurationAlpha } from "./configuration.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Options for how to interpret or encode a tree when schema information is available.
|
|
14
|
+
* @remarks
|
|
15
|
+
* This currently extends {@link TreeParsingOptions},
|
|
16
|
+
* removing the option to declare {@link KeyEncodingOptions.allStoredKeys} since this option is currently not supported.
|
|
17
|
+
* @input
|
|
14
18
|
* @alpha
|
|
15
19
|
*/
|
|
16
|
-
export interface TreeSchemaEncodingOptions extends
|
|
20
|
+
export interface TreeSchemaEncodingOptions extends TreeParsingOptions {
|
|
17
21
|
/**
|
|
18
22
|
* If true, fields with default providers (like {@link SchemaFactory.identifier}) will be required.
|
|
19
23
|
* If false, they will be optional.
|
|
@@ -75,6 +79,7 @@ export interface TreeSchemaEncodingOptions extends TreeEncodingOptions {
|
|
|
75
79
|
* 1. VerboseTree and (Done) ConciseTree
|
|
76
80
|
* 2. (Done) With and without requiring values with defaults (for insertion vs reading)
|
|
77
81
|
* 3. (Done) Using stored keys and property keys.
|
|
82
|
+
* 4. Control over unknown optional fields and staged allowed types (able to manually control them and/or get them from some context).
|
|
78
83
|
*
|
|
79
84
|
* This takes in `ImplicitAllowedTypes` since underlying `toJsonSchema` can't handle optional roots.
|
|
80
85
|
*
|
|
@@ -32,6 +32,7 @@ export {
|
|
|
32
32
|
type NodeSchemaOptions,
|
|
33
33
|
type NodeSchemaOptionsAlpha,
|
|
34
34
|
} from "./schemaFactory.js";
|
|
35
|
+
export { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
|
|
35
36
|
export { SchemaFactoryAlpha, type SchemaStaticsAlpha } from "./schemaFactoryAlpha.js";
|
|
36
37
|
export type {
|
|
37
38
|
ValidateRecursiveSchema,
|
|
@@ -101,6 +102,8 @@ export {
|
|
|
101
102
|
tryStoredSchemaAsArray,
|
|
102
103
|
replaceHandles,
|
|
103
104
|
type HandleConverter,
|
|
105
|
+
KeyEncodingOptions,
|
|
106
|
+
type TreeParsingOptions,
|
|
104
107
|
} from "./customTree.js";
|
|
105
108
|
|
|
106
109
|
export {
|
|
@@ -86,7 +86,7 @@ export function singletonSchema<TScope extends string, TName extends string | nu
|
|
|
86
86
|
* @remarks
|
|
87
87
|
* The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
|
|
88
88
|
* Numeric enums values have the value implicitly converted into a string.
|
|
89
|
-
* Consider making a dedicated schema factory with a nested scope (for example using {@link
|
|
89
|
+
* Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryBeta.scopedFactory}) to avoid the enum members colliding with other schema.
|
|
90
90
|
* @example
|
|
91
91
|
* ```typescript
|
|
92
92
|
* const schemaFactory = new SchemaFactory("com.myApp");
|
|
@@ -98,6 +98,7 @@ export function schemaFromValue(value: TreeValue): TreeNodeSchema {
|
|
|
98
98
|
/**
|
|
99
99
|
* Options when declaring an {@link SchemaFactory.object|object node}'s schema
|
|
100
100
|
*
|
|
101
|
+
* @input
|
|
101
102
|
* @alpha
|
|
102
103
|
*/
|
|
103
104
|
export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
@@ -147,7 +148,7 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
|
147
148
|
* It's only when application code reaches into a node
|
|
148
149
|
* (either by accessing its fields, spreading it, or some other means) that this problem arises.
|
|
149
150
|
*/
|
|
150
|
-
allowUnknownOptionalFields?: boolean;
|
|
151
|
+
readonly allowUnknownOptionalFields?: boolean;
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
/**
|
|
@@ -340,12 +341,6 @@ export class SchemaFactory<
|
|
|
340
341
|
public readonly scope: TScope,
|
|
341
342
|
) {}
|
|
342
343
|
|
|
343
|
-
private scoped<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {
|
|
344
|
-
return (
|
|
345
|
-
this.scope === undefined ? `${name}` : `${this.scope}.${name}`
|
|
346
|
-
) as ScopedSchemaName<TScope, Name>;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
344
|
/**
|
|
350
345
|
* {@inheritDoc SchemaStatics.string}
|
|
351
346
|
*/
|
|
@@ -435,7 +430,7 @@ export class SchemaFactory<
|
|
|
435
430
|
true,
|
|
436
431
|
T
|
|
437
432
|
> = objectSchema(
|
|
438
|
-
|
|
433
|
+
scoped(this, name),
|
|
439
434
|
fields,
|
|
440
435
|
true,
|
|
441
436
|
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
@@ -593,7 +588,7 @@ export class SchemaFactory<
|
|
|
593
588
|
T,
|
|
594
589
|
undefined
|
|
595
590
|
> = mapSchema(
|
|
596
|
-
|
|
591
|
+
scoped(this, name),
|
|
597
592
|
allowedTypes,
|
|
598
593
|
implicitlyConstructable,
|
|
599
594
|
// The current policy is customizable nodes don't get fake prototypes.
|
|
@@ -669,7 +664,7 @@ export class SchemaFactory<
|
|
|
669
664
|
>;
|
|
670
665
|
|
|
671
666
|
/**
|
|
672
|
-
* Define
|
|
667
|
+
* Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
673
668
|
*
|
|
674
669
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
675
670
|
* @param allowedTypes - The types that may appear in the array.
|
|
@@ -795,7 +790,7 @@ export class SchemaFactory<
|
|
|
795
790
|
undefined
|
|
796
791
|
> {
|
|
797
792
|
const array = arraySchema(
|
|
798
|
-
|
|
793
|
+
scoped(this, name),
|
|
799
794
|
allowedTypes,
|
|
800
795
|
implicitlyConstructable,
|
|
801
796
|
customizable,
|
|
@@ -1063,6 +1058,16 @@ export function structuralName<const T extends string>(
|
|
|
1063
1058
|
return `${collectionName}<${inner}>`;
|
|
1064
1059
|
}
|
|
1065
1060
|
|
|
1061
|
+
export function scoped<
|
|
1062
|
+
TScope extends string | undefined,
|
|
1063
|
+
TName extends number | string,
|
|
1064
|
+
Name extends TName | string,
|
|
1065
|
+
>(factory: SchemaFactory<TScope, TName>, name: Name): ScopedSchemaName<TScope, Name> {
|
|
1066
|
+
return (
|
|
1067
|
+
factory.scope === undefined ? `${name}` : `${factory.scope}.${name}`
|
|
1068
|
+
) as ScopedSchemaName<TScope, Name>;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1066
1071
|
/**
|
|
1067
1072
|
* Used to allocate default identifiers for unhydrated nodes when no context is available.
|
|
1068
1073
|
* @remarks
|
|
@@ -1077,7 +1082,7 @@ const globalIdentifierAllocator: IIdCompressor = createIdCompressor();
|
|
|
1077
1082
|
* @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.
|
|
1078
1083
|
* See {@link NodeSchemaMetadata.custom}.
|
|
1079
1084
|
*
|
|
1080
|
-
* @
|
|
1085
|
+
* @input
|
|
1081
1086
|
* @public
|
|
1082
1087
|
*/
|
|
1083
1088
|
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
@@ -1085,8 +1090,7 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
|
1085
1090
|
* Optional metadata to associate with the Node Schema.
|
|
1086
1091
|
*
|
|
1087
1092
|
* @remarks
|
|
1088
|
-
*
|
|
1089
|
-
* Different clients in the same collaborative session may see different metadata for the same field.
|
|
1093
|
+
* This specifies {@link SimpleNodeSchemaBase.metadata} which has more details about its use.
|
|
1090
1094
|
*/
|
|
1091
1095
|
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1092
1096
|
}
|
|
@@ -1097,12 +1101,15 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
|
1097
1101
|
* @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.
|
|
1098
1102
|
* See {@link NodeSchemaMetadata.custom}.
|
|
1099
1103
|
*
|
|
1104
|
+
* @input
|
|
1100
1105
|
* @alpha
|
|
1101
1106
|
*/
|
|
1102
1107
|
export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown>
|
|
1103
1108
|
extends NodeSchemaOptions<TCustomMetadata> {
|
|
1104
1109
|
/**
|
|
1105
1110
|
* The persisted metadata for this schema element.
|
|
1111
|
+
* @remarks
|
|
1112
|
+
* This gets exposed via {@link SimpleNodeSchemaBaseAlpha.persistedMetadata}.
|
|
1106
1113
|
*/
|
|
1107
1114
|
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
1108
1115
|
}
|