@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
package/src/tableSchema.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import { Tree, TreeAlpha } from "./shared-tree/index.js";
|
|
@@ -166,7 +166,7 @@ export namespace System_TableSchema {
|
|
|
166
166
|
cellSchema: TCellSchema,
|
|
167
167
|
propsSchema: TPropsSchema,
|
|
168
168
|
) {
|
|
169
|
-
const schemaFactory = inputSchemaFactory.
|
|
169
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
170
170
|
type Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;
|
|
171
171
|
|
|
172
172
|
type CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;
|
|
@@ -342,7 +342,7 @@ export namespace System_TableSchema {
|
|
|
342
342
|
cellSchema: TCellSchema,
|
|
343
343
|
propsSchema: TPropsSchema,
|
|
344
344
|
) {
|
|
345
|
-
const schemaFactory = inputSchemaFactory.
|
|
345
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
346
346
|
type Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;
|
|
347
347
|
|
|
348
348
|
type CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;
|
|
@@ -566,7 +566,7 @@ export namespace System_TableSchema {
|
|
|
566
566
|
columnSchema: TColumnSchema,
|
|
567
567
|
rowSchema: TRowSchema,
|
|
568
568
|
) {
|
|
569
|
-
const schemaFactory = inputSchemaFactory.
|
|
569
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
570
570
|
type Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;
|
|
571
571
|
|
|
572
572
|
type CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;
|
|
@@ -619,12 +619,12 @@ export namespace System_TableSchema {
|
|
|
619
619
|
key: TableSchema.CellKey<TColumnSchema, TRowSchema>,
|
|
620
620
|
): CellValueType | undefined {
|
|
621
621
|
const { column: columnOrId, row: rowOrId } = key;
|
|
622
|
-
const row = this.
|
|
622
|
+
const row = this._tryGetRow(rowOrId);
|
|
623
623
|
if (row === undefined) {
|
|
624
624
|
return undefined;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
const column = this.
|
|
627
|
+
const column = this._tryGetColumn(columnOrId);
|
|
628
628
|
if (column === undefined) {
|
|
629
629
|
return undefined;
|
|
630
630
|
}
|
|
@@ -632,17 +632,6 @@ export namespace System_TableSchema {
|
|
|
632
632
|
return row.getCell(column);
|
|
633
633
|
}
|
|
634
634
|
|
|
635
|
-
public insertColumn({
|
|
636
|
-
column,
|
|
637
|
-
index,
|
|
638
|
-
}: TableSchema.InsertColumnParameters<TColumnSchema>): ColumnValueType {
|
|
639
|
-
const inserted = this.insertColumns({
|
|
640
|
-
columns: [column],
|
|
641
|
-
index,
|
|
642
|
-
});
|
|
643
|
-
return inserted[0] ?? oob();
|
|
644
|
-
}
|
|
645
|
-
|
|
646
635
|
public insertColumns({
|
|
647
636
|
columns,
|
|
648
637
|
index,
|
|
@@ -666,17 +655,6 @@ export namespace System_TableSchema {
|
|
|
666
655
|
return columns as unknown as ColumnValueType[];
|
|
667
656
|
}
|
|
668
657
|
|
|
669
|
-
public insertRow({
|
|
670
|
-
row,
|
|
671
|
-
index,
|
|
672
|
-
}: TableSchema.InsertRowParameters<TRowSchema>): RowValueType {
|
|
673
|
-
const inserted = this.insertRows({
|
|
674
|
-
rows: [row],
|
|
675
|
-
index,
|
|
676
|
-
});
|
|
677
|
-
return inserted[0] ?? oob();
|
|
678
|
-
}
|
|
679
|
-
|
|
680
658
|
public insertRows({
|
|
681
659
|
index,
|
|
682
660
|
rows,
|
|
@@ -698,7 +676,7 @@ export namespace System_TableSchema {
|
|
|
698
676
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
699
677
|
const keys: string[] = Object.keys((newRow as any).cells);
|
|
700
678
|
for (const key of keys) {
|
|
701
|
-
if (!this.
|
|
679
|
+
if (!this._containsColumnWithId(key)) {
|
|
702
680
|
throw new UsageError(
|
|
703
681
|
`Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`,
|
|
704
682
|
);
|
|
@@ -730,187 +708,306 @@ export namespace System_TableSchema {
|
|
|
730
708
|
const { column: columnOrId, row: rowOrId } = key;
|
|
731
709
|
|
|
732
710
|
const row = this._getRow(rowOrId);
|
|
733
|
-
if (row === undefined) {
|
|
734
|
-
const rowId = this._getRowId(rowOrId);
|
|
735
|
-
throw new UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
711
|
const column = this._getColumn(columnOrId);
|
|
739
|
-
if (column === undefined) {
|
|
740
|
-
const columnId = this._getColumnId(columnOrId);
|
|
741
|
-
throw new UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
742
|
-
}
|
|
743
712
|
|
|
744
713
|
row.setCell(column, cell);
|
|
745
714
|
}
|
|
746
715
|
|
|
747
716
|
public removeColumns(
|
|
748
|
-
|
|
717
|
+
indexOrColumns: number | undefined | readonly string[] | readonly ColumnValueType[],
|
|
718
|
+
count: number | undefined = undefined,
|
|
749
719
|
): ColumnValueType[] {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
720
|
+
if (typeof indexOrColumns === "number" || indexOrColumns === undefined) {
|
|
721
|
+
let removedColumns: ColumnValueType[] | undefined;
|
|
722
|
+
const startIndex = indexOrColumns ?? 0;
|
|
723
|
+
const _count = count ?? this.columns.length - startIndex;
|
|
724
|
+
|
|
725
|
+
// If there are no columns to remove, do nothing
|
|
726
|
+
if (_count === 0) {
|
|
727
|
+
return [];
|
|
728
|
+
}
|
|
754
729
|
|
|
755
|
-
|
|
756
|
-
if (columns.length === 1) {
|
|
757
|
-
const removedColumn = this.removeColumn(columns[0] ?? oob());
|
|
758
|
-
return [removedColumn];
|
|
759
|
-
}
|
|
730
|
+
Table._assertValidRange({ index: startIndex, count: _count }, this.columns);
|
|
760
731
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
732
|
+
this._applyEditsInBatch(() => {
|
|
733
|
+
const columnsToRemove = this.columns.slice(
|
|
734
|
+
startIndex,
|
|
735
|
+
startIndex + _count,
|
|
736
|
+
) as ColumnValueType[];
|
|
737
|
+
|
|
738
|
+
// First, remove all cells that correspond to each column from each row:
|
|
739
|
+
for (const column of columnsToRemove) {
|
|
740
|
+
this._removeCells(column);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// Second, remove the column nodes:
|
|
744
|
+
Table._removeRange(
|
|
745
|
+
{
|
|
746
|
+
index: startIndex,
|
|
747
|
+
count: _count,
|
|
748
|
+
},
|
|
749
|
+
this.columns,
|
|
750
|
+
);
|
|
751
|
+
removedColumns = columnsToRemove;
|
|
752
|
+
});
|
|
753
|
+
return removedColumns ?? fail(0xc1f /* Transaction did not complete. */);
|
|
754
|
+
} else {
|
|
755
|
+
// If there are no columns to remove, do nothing
|
|
756
|
+
if (indexOrColumns.length === 0) {
|
|
757
|
+
return [];
|
|
769
758
|
}
|
|
770
|
-
});
|
|
771
|
-
return removedColumns;
|
|
772
|
-
}
|
|
773
759
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
`Specified column with ID "${columnId}" does not exist in the table.`,
|
|
781
|
-
);
|
|
782
|
-
}
|
|
783
|
-
assert(column !== undefined, 0xc10 /* column should not be undefined */);
|
|
784
|
-
|
|
785
|
-
Tree.runTransaction(this, () => {
|
|
786
|
-
// Remove the corresponding cell from all rows.
|
|
787
|
-
for (const row of this.rows) {
|
|
788
|
-
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
789
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
790
|
-
(row as RowValueType).removeCell(column);
|
|
760
|
+
// Resolve any IDs to actual nodes.
|
|
761
|
+
// This validates that all of the rows exist before starting transaction.
|
|
762
|
+
// This improves user-facing error experience.
|
|
763
|
+
const columnsToRemove: ColumnValueType[] = [];
|
|
764
|
+
for (const columnOrIdToRemove of indexOrColumns) {
|
|
765
|
+
columnsToRemove.push(this._getColumn(columnOrIdToRemove));
|
|
791
766
|
}
|
|
792
767
|
|
|
793
|
-
this.
|
|
794
|
-
|
|
768
|
+
this._applyEditsInBatch(() => {
|
|
769
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
770
|
+
// So if we throw an error here for any column, no columns will be removed.
|
|
771
|
+
for (const columnToRemove of columnsToRemove) {
|
|
772
|
+
// Remove the corresponding cell from all rows.
|
|
773
|
+
for (const row of this.rows) {
|
|
774
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
775
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
776
|
+
(row as RowValueType).removeCell(columnToRemove);
|
|
777
|
+
}
|
|
795
778
|
|
|
796
|
-
|
|
779
|
+
// We have already validated that all of the columns exist above, so this is safe.
|
|
780
|
+
this.columns.removeAt(this.columns.indexOf(columnToRemove));
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
return columnsToRemove;
|
|
784
|
+
}
|
|
797
785
|
}
|
|
798
786
|
|
|
799
|
-
public
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
787
|
+
public removeRows(
|
|
788
|
+
indexOrRows: number | undefined | readonly string[] | readonly RowValueType[],
|
|
789
|
+
count?: number | undefined,
|
|
790
|
+
): RowValueType[] {
|
|
791
|
+
if (typeof indexOrRows === "number" || indexOrRows === undefined) {
|
|
792
|
+
const startIndex = indexOrRows ?? 0;
|
|
793
|
+
const _count = count ?? this.columns.length - startIndex;
|
|
794
|
+
|
|
795
|
+
// If there are no rows to remove, do nothing
|
|
796
|
+
if (_count === 0) {
|
|
797
|
+
return [];
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return Table._removeRange(
|
|
801
|
+
{
|
|
802
|
+
index: startIndex,
|
|
803
|
+
count: _count,
|
|
804
|
+
},
|
|
805
|
+
this.rows,
|
|
806
|
+
);
|
|
807
|
+
}
|
|
804
808
|
|
|
805
|
-
public removeRows(rows: readonly string[] | readonly RowValueType[]): RowValueType[] {
|
|
806
809
|
// If there are no rows to remove, do nothing
|
|
807
|
-
if (
|
|
810
|
+
if (indexOrRows.length === 0) {
|
|
808
811
|
return [];
|
|
809
812
|
}
|
|
810
813
|
|
|
811
|
-
//
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
814
|
+
// Resolve any IDs to actual nodes.
|
|
815
|
+
// This validates that all of the rows exist before starting transaction.
|
|
816
|
+
// This improves user-facing error experience.
|
|
817
|
+
const rowsToRemove: RowValueType[] = [];
|
|
818
|
+
for (const rowToRemove of indexOrRows) {
|
|
819
|
+
rowsToRemove.push(this._getRow(rowToRemove));
|
|
815
820
|
}
|
|
816
821
|
|
|
817
|
-
|
|
818
|
-
const removedRows: RowValueType[] = [];
|
|
819
|
-
Tree.runTransaction(this, () => {
|
|
822
|
+
this._applyEditsInBatch(() => {
|
|
820
823
|
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
821
824
|
// So if we throw an error here for any row, no rows will be removed.
|
|
822
|
-
for (const rowToRemove of
|
|
823
|
-
|
|
824
|
-
|
|
825
|
+
for (const rowToRemove of rowsToRemove) {
|
|
826
|
+
// We have already validated that all of the rows exist above, so this is safe.
|
|
827
|
+
this.rows.removeAt(this.rows.indexOf(rowToRemove));
|
|
825
828
|
}
|
|
826
829
|
});
|
|
827
|
-
return
|
|
830
|
+
return rowsToRemove;
|
|
828
831
|
}
|
|
829
832
|
|
|
830
|
-
public
|
|
831
|
-
|
|
832
|
-
|
|
833
|
+
public removeCell(
|
|
834
|
+
key: TableSchema.CellKey<TColumnSchema, TRowSchema>,
|
|
835
|
+
): CellValueType | undefined {
|
|
836
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
837
|
+
const row = this._getRow(rowOrId);
|
|
838
|
+
const column = this._getColumn(columnOrId);
|
|
833
839
|
|
|
834
|
-
|
|
835
|
-
if (
|
|
836
|
-
|
|
837
|
-
throw new UsageError(
|
|
838
|
-
`Specified row with ID "${rowId}" does not exist in the table.`,
|
|
839
|
-
);
|
|
840
|
+
const cell: CellValueType | undefined = row.getCell(column.id);
|
|
841
|
+
if (cell === undefined) {
|
|
842
|
+
return undefined;
|
|
840
843
|
}
|
|
841
844
|
|
|
842
|
-
|
|
843
|
-
return
|
|
845
|
+
row.removeCell(column.id);
|
|
846
|
+
return cell;
|
|
844
847
|
}
|
|
845
848
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
849
|
+
/**
|
|
850
|
+
* Removes the cell corresponding with the specified column from each row in the table.
|
|
851
|
+
*/
|
|
852
|
+
private _removeCells(column: ColumnValueType): void {
|
|
853
|
+
for (const row of this.rows) {
|
|
854
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
855
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
856
|
+
(row as RowValueType).removeCell(column);
|
|
857
|
+
}
|
|
850
858
|
}
|
|
851
859
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
858
|
-
const rowId = this._getRowId(rowOrId);
|
|
860
|
+
private static _assertValidRange<T>(
|
|
861
|
+
range: { index: number; count: number },
|
|
862
|
+
array: readonly T[],
|
|
863
|
+
): void {
|
|
864
|
+
const { index, count } = range;
|
|
865
|
+
if (index < 0 || index >= array.length) {
|
|
859
866
|
throw new UsageError(
|
|
860
|
-
`
|
|
867
|
+
`Start index out of bounds. Expected index to be on [0, ${array.length - 1}], but got ${index}.`,
|
|
861
868
|
);
|
|
862
869
|
}
|
|
870
|
+
if (count < 0) {
|
|
871
|
+
throw new UsageError(`Expected non-negative count. Got ${count}.`);
|
|
872
|
+
}
|
|
863
873
|
|
|
864
|
-
const
|
|
865
|
-
if (
|
|
866
|
-
const columnId = this._getColumnId(columnOrId);
|
|
874
|
+
const end = index + count; // exclusive
|
|
875
|
+
if (end > array.length) {
|
|
867
876
|
throw new UsageError(
|
|
868
|
-
`
|
|
877
|
+
`End index out of bounds. Expected end to be on [${index}, ${array.length}], but got ${end}.`,
|
|
869
878
|
);
|
|
870
879
|
}
|
|
880
|
+
}
|
|
871
881
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
882
|
+
/**
|
|
883
|
+
* Applies the provided edits in a "batch".
|
|
884
|
+
*
|
|
885
|
+
* @remarks
|
|
886
|
+
* For hydrated trees, this will be done in a transaction to ensure atomicity.
|
|
887
|
+
*
|
|
888
|
+
* Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.
|
|
889
|
+
* But since there are no collaborators, this is not an issue.
|
|
890
|
+
*/
|
|
891
|
+
private _applyEditsInBatch(applyEdits: () => void): void {
|
|
892
|
+
const branch = TreeAlpha.branch(this);
|
|
893
|
+
|
|
894
|
+
if (branch === undefined) {
|
|
895
|
+
// If this node does not have a corresponding branch, then it is unhydrated.
|
|
896
|
+
// I.e., it is not part of a collaborative session yet.
|
|
897
|
+
// Therefore, we don't need to run the edits as a transaction.
|
|
898
|
+
applyEdits();
|
|
899
|
+
} else {
|
|
900
|
+
branch.runTransaction(() => {
|
|
901
|
+
applyEdits();
|
|
902
|
+
});
|
|
875
903
|
}
|
|
904
|
+
}
|
|
876
905
|
|
|
877
|
-
|
|
878
|
-
|
|
906
|
+
/**
|
|
907
|
+
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
908
|
+
* Returns `undefined` if there is no match.
|
|
909
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
910
|
+
*/
|
|
911
|
+
private _tryGetColumn(
|
|
912
|
+
columnOrId: string | ColumnValueType,
|
|
913
|
+
): ColumnValueType | undefined {
|
|
914
|
+
const columnId = this._getColumnId(columnOrId);
|
|
915
|
+
return this.getColumn(columnId);
|
|
879
916
|
}
|
|
880
917
|
|
|
881
|
-
|
|
882
|
-
|
|
918
|
+
/**
|
|
919
|
+
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
920
|
+
* @throws Throws a `UsageError` if there is no match.
|
|
921
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
922
|
+
*/
|
|
923
|
+
private _getColumn(columnOrId: string | ColumnValueType): ColumnValueType {
|
|
924
|
+
const column = this._tryGetColumn(columnOrId);
|
|
925
|
+
if (column === undefined) {
|
|
926
|
+
this._throwMissingColumnError(this._getColumnId(columnOrId));
|
|
927
|
+
}
|
|
928
|
+
return column;
|
|
883
929
|
}
|
|
884
930
|
|
|
931
|
+
/**
|
|
932
|
+
* Resolves a Column node or ID to its ID.
|
|
933
|
+
* If an ID is provided, it is returned as-is.
|
|
934
|
+
* If a node is provided, its ID is returned.
|
|
935
|
+
*/
|
|
885
936
|
private _getColumnId(columnOrId: string | ColumnValueType): string {
|
|
886
937
|
return typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
887
938
|
}
|
|
888
939
|
|
|
889
|
-
|
|
890
|
-
|
|
940
|
+
/**
|
|
941
|
+
* Checks if a Column with the specified ID exists in the table.
|
|
942
|
+
*/
|
|
943
|
+
private _containsColumnWithId(columnId: string): boolean {
|
|
944
|
+
return this._tryGetColumn(columnId) !== undefined;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Throw a `UsageError` for a missing Column by its ID.
|
|
949
|
+
*/
|
|
950
|
+
private _throwMissingColumnError(columnId: string): never {
|
|
951
|
+
throw new UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
891
952
|
}
|
|
892
953
|
|
|
954
|
+
/**
|
|
955
|
+
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
956
|
+
* Returns `undefined` if there is no match.
|
|
957
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
958
|
+
*/
|
|
959
|
+
private _tryGetRow(rowOrId: string | RowValueType): RowValueType | undefined {
|
|
960
|
+
const rowId = this._getRowId(rowOrId);
|
|
961
|
+
return this.getRow(rowId);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
966
|
+
* @throws Throws a `UsageError` if there is no match.
|
|
967
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
968
|
+
*/
|
|
969
|
+
private _getRow(rowOrId: string | RowValueType): RowValueType {
|
|
970
|
+
const row = this._tryGetRow(rowOrId);
|
|
971
|
+
if (row === undefined) {
|
|
972
|
+
this._throwMissingRowError(this._getRowId(rowOrId));
|
|
973
|
+
}
|
|
974
|
+
return row;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Resolves a Row node or ID to its ID.
|
|
979
|
+
* If an ID is provided, it is returned as-is.
|
|
980
|
+
* If a node is provided, its ID is returned.
|
|
981
|
+
*/
|
|
893
982
|
private _getRowId(rowOrId: string | RowValueType): string {
|
|
894
983
|
return typeof rowOrId === "string" ? rowOrId : rowOrId.id;
|
|
895
984
|
}
|
|
896
985
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
(column) => (column as TableSchema.Column<TCellSchema>).id === columnId,
|
|
903
|
-
) !== undefined
|
|
904
|
-
);
|
|
986
|
+
/**
|
|
987
|
+
* Throw a `UsageError` for a missing Row by its ID.
|
|
988
|
+
*/
|
|
989
|
+
private _throwMissingRowError(rowId: string): never {
|
|
990
|
+
throw new UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
905
991
|
}
|
|
906
992
|
|
|
907
|
-
private
|
|
908
|
-
|
|
993
|
+
private static _removeRange<TNodeSchema extends ImplicitAllowedTypes>(
|
|
994
|
+
range: { index: number; count: number },
|
|
995
|
+
array: TreeArrayNode<TNodeSchema>,
|
|
996
|
+
): TreeNodeFromImplicitAllowedTypes<TNodeSchema>[] {
|
|
997
|
+
Table._assertValidRange(range, array);
|
|
998
|
+
|
|
999
|
+
const { index, count } = range;
|
|
1000
|
+
const end = index + count; // exclusive
|
|
1001
|
+
|
|
1002
|
+
// TypeScript is unable to narrow the array element type correctly here, hence the cast.
|
|
909
1003
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
);
|
|
1004
|
+
const removedRows = array.slice(
|
|
1005
|
+
index,
|
|
1006
|
+
end,
|
|
1007
|
+
) as TreeNodeFromImplicitAllowedTypes<TNodeSchema>[];
|
|
1008
|
+
array.removeRange(index, end);
|
|
1009
|
+
|
|
1010
|
+
return removedRows;
|
|
914
1011
|
}
|
|
915
1012
|
|
|
916
1013
|
/**
|
|
@@ -1333,23 +1430,6 @@ export namespace TableSchema {
|
|
|
1333
1430
|
readonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;
|
|
1334
1431
|
}
|
|
1335
1432
|
|
|
1336
|
-
/**
|
|
1337
|
-
* {@link TableSchema.Table.insertColumn} parameters.
|
|
1338
|
-
* @alpha
|
|
1339
|
-
*/
|
|
1340
|
-
export interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {
|
|
1341
|
-
/**
|
|
1342
|
-
* The index at which to insert the new column.
|
|
1343
|
-
* @remarks If not provided, the column will be appended to the end of the table.
|
|
1344
|
-
*/
|
|
1345
|
-
readonly index?: number | undefined;
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* The column to insert.
|
|
1349
|
-
*/
|
|
1350
|
-
readonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1433
|
/**
|
|
1354
1434
|
* {@link TableSchema.Table.insertColumns} parameters.
|
|
1355
1435
|
* @alpha
|
|
@@ -1367,23 +1447,6 @@ export namespace TableSchema {
|
|
|
1367
1447
|
readonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];
|
|
1368
1448
|
}
|
|
1369
1449
|
|
|
1370
|
-
/**
|
|
1371
|
-
* {@link TableSchema.Table.insertRow} parameters.
|
|
1372
|
-
* @alpha
|
|
1373
|
-
*/
|
|
1374
|
-
export interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {
|
|
1375
|
-
/**
|
|
1376
|
-
* The index at which to insert the new row.
|
|
1377
|
-
* @remarks If not provided, the row will be appended to the end of the table.
|
|
1378
|
-
*/
|
|
1379
|
-
readonly index?: number | undefined;
|
|
1380
|
-
|
|
1381
|
-
/**
|
|
1382
|
-
* The row to insert.
|
|
1383
|
-
*/
|
|
1384
|
-
readonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
1450
|
/**
|
|
1388
1451
|
* {@link TableSchema.Table.insertRows} parameters.
|
|
1389
1452
|
* @alpha
|
|
@@ -1461,17 +1524,6 @@ export namespace TableSchema {
|
|
|
1461
1524
|
*/
|
|
1462
1525
|
getCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
|
|
1463
1526
|
|
|
1464
|
-
/**
|
|
1465
|
-
* Inserts a column into the table.
|
|
1466
|
-
*
|
|
1467
|
-
* @throws Throws an error if the specified index is out of range.
|
|
1468
|
-
*
|
|
1469
|
-
* No column is inserted in this case.
|
|
1470
|
-
*/
|
|
1471
|
-
insertColumn(
|
|
1472
|
-
params: InsertColumnParameters<TColumn>,
|
|
1473
|
-
): TreeNodeFromImplicitAllowedTypes<TColumn>;
|
|
1474
|
-
|
|
1475
1527
|
/**
|
|
1476
1528
|
* Inserts 0 or more columns into the table.
|
|
1477
1529
|
*
|
|
@@ -1483,20 +1535,6 @@ export namespace TableSchema {
|
|
|
1483
1535
|
params: InsertColumnsParameters<TColumn>,
|
|
1484
1536
|
): TreeNodeFromImplicitAllowedTypes<TColumn>[];
|
|
1485
1537
|
|
|
1486
|
-
/**
|
|
1487
|
-
* Inserts a row into the table.
|
|
1488
|
-
*
|
|
1489
|
-
* @throws
|
|
1490
|
-
* Throws an error in the following cases:
|
|
1491
|
-
*
|
|
1492
|
-
* - The row contains cells, but the table does not contain matching columns for one or more of those cells.
|
|
1493
|
-
*
|
|
1494
|
-
* - The specified index is out of range.
|
|
1495
|
-
*
|
|
1496
|
-
* No row is inserted in these cases.
|
|
1497
|
-
*/
|
|
1498
|
-
insertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;
|
|
1499
|
-
|
|
1500
1538
|
/**
|
|
1501
1539
|
* Inserts 0 or more rows into the table.
|
|
1502
1540
|
*
|
|
@@ -1518,22 +1556,22 @@ export namespace TableSchema {
|
|
|
1518
1556
|
setCell(params: SetCellParameters<TCell, TColumn, TRow>): void;
|
|
1519
1557
|
|
|
1520
1558
|
/**
|
|
1521
|
-
* Removes
|
|
1559
|
+
* Removes a range of columns from the table.
|
|
1560
|
+
*
|
|
1522
1561
|
* @remarks
|
|
1523
1562
|
* Also removes any corresponding cells from the table's rows.
|
|
1524
1563
|
*
|
|
1525
1564
|
* Note: this operation can be slow for tables with many rows.
|
|
1526
1565
|
* We are actively working on improving the performance of this operation, but for now it may have a negative
|
|
1527
1566
|
* impact on performance.
|
|
1528
|
-
*
|
|
1529
|
-
* @param
|
|
1530
|
-
* @throws Throws an error if the
|
|
1531
|
-
* In this case, no columns are removed.
|
|
1567
|
+
* @param index - The starting index of the range to remove. Default: `0`.
|
|
1568
|
+
* @param count - The number of columns to remove. Default: all remaining columns starting from `index`.
|
|
1569
|
+
* @throws Throws an error if the specified range is invalid. In this case, no columns are removed.
|
|
1532
1570
|
*/
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1571
|
+
removeColumns(
|
|
1572
|
+
index?: number | undefined,
|
|
1573
|
+
count?: number | undefined,
|
|
1574
|
+
): TreeNodeFromImplicitAllowedTypes<TColumn>[];
|
|
1537
1575
|
/**
|
|
1538
1576
|
* Removes 0 or more columns from the table.
|
|
1539
1577
|
* @remarks
|
|
@@ -1567,29 +1605,15 @@ export namespace TableSchema {
|
|
|
1567
1605
|
removeColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];
|
|
1568
1606
|
|
|
1569
1607
|
/**
|
|
1570
|
-
* Removes
|
|
1571
|
-
*
|
|
1572
|
-
* @
|
|
1573
|
-
*
|
|
1574
|
-
*
|
|
1575
|
-
* Note: this operation can be slow for tables with many rows.
|
|
1576
|
-
* We are actively working on improving the performance of this operation, but for now it may have a negative
|
|
1577
|
-
* impact on performance.
|
|
1578
|
-
*
|
|
1579
|
-
* @returns The removed columns.
|
|
1580
|
-
*/
|
|
1581
|
-
removeAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];
|
|
1582
|
-
|
|
1583
|
-
/**
|
|
1584
|
-
* Removes the specified row from the table.
|
|
1585
|
-
* @param row - The {@link TableSchema.Row | row} or {@link TableSchema.Row.id | row ID} to remove.
|
|
1586
|
-
* @throws Throws an error if the row is not in the table.
|
|
1587
|
-
* In this case, no rows are removed.
|
|
1608
|
+
* Removes a range of rows from the table.
|
|
1609
|
+
* @param index - The starting index of the range to remove. Default: `0`.
|
|
1610
|
+
* @param count - The number of rows to remove. Default: all remaining rows starting from `index`.
|
|
1611
|
+
* @throws Throws an error if the specified range is invalid. In this case, no rows are removed.
|
|
1588
1612
|
*/
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1613
|
+
removeRows(
|
|
1614
|
+
index?: number | undefined,
|
|
1615
|
+
count?: number | undefined,
|
|
1616
|
+
): TreeNodeFromImplicitAllowedTypes<TRow>[];
|
|
1593
1617
|
/**
|
|
1594
1618
|
* Removes 0 or more rows from the table.
|
|
1595
1619
|
* @param rows - The rows to remove.
|
|
@@ -1607,12 +1631,6 @@ export namespace TableSchema {
|
|
|
1607
1631
|
*/
|
|
1608
1632
|
removeRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];
|
|
1609
1633
|
|
|
1610
|
-
/**
|
|
1611
|
-
* Removes all rows from the table.
|
|
1612
|
-
* @returns The removed rows.
|
|
1613
|
-
*/
|
|
1614
|
-
removeAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];
|
|
1615
|
-
|
|
1616
1634
|
/**
|
|
1617
1635
|
* Removes the cell at the specified location in the table.
|
|
1618
1636
|
* @returns The cell if it exists, otherwise undefined.
|