@fluidframework/tree 2.53.1 → 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 +21 -21
- 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/dist/tableSchema.js
CHANGED
|
@@ -63,7 +63,7 @@ var System_TableSchema;
|
|
|
63
63
|
*/
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
65
65
|
function createColumnSchema(inputSchemaFactory, cellSchema, propsSchema) {
|
|
66
|
-
const schemaFactory = inputSchemaFactory.
|
|
66
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
67
67
|
// Note: `columnFields` is broken into two parts to work around a TypeScript bug
|
|
68
68
|
// that results in broken `.d.ts` output.
|
|
69
69
|
// See definition of `ColumnInsertableType` below.
|
|
@@ -128,7 +128,7 @@ var System_TableSchema;
|
|
|
128
128
|
*/
|
|
129
129
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
130
130
|
function createRowSchema(inputSchemaFactory, cellSchema, propsSchema) {
|
|
131
|
-
const schemaFactory = inputSchemaFactory.
|
|
131
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
132
132
|
// Note: `rowFields` is broken into two parts to work around a TypeScript bug
|
|
133
133
|
// that results in broken `.d.ts` output.
|
|
134
134
|
// See definition of `RowInsertableType` below.
|
|
@@ -223,7 +223,7 @@ var System_TableSchema;
|
|
|
223
223
|
*/
|
|
224
224
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
225
225
|
function createTableSchema(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
|
|
226
|
-
const schemaFactory = inputSchemaFactory.
|
|
226
|
+
const schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);
|
|
227
227
|
/**
|
|
228
228
|
* {@link Table} fields.
|
|
229
229
|
* @remarks Extracted for re-use in returned type signature defined later in this function.
|
|
@@ -255,23 +255,16 @@ var System_TableSchema;
|
|
|
255
255
|
}
|
|
256
256
|
getCell(key) {
|
|
257
257
|
const { column: columnOrId, row: rowOrId } = key;
|
|
258
|
-
const row = this.
|
|
258
|
+
const row = this._tryGetRow(rowOrId);
|
|
259
259
|
if (row === undefined) {
|
|
260
260
|
return undefined;
|
|
261
261
|
}
|
|
262
|
-
const column = this.
|
|
262
|
+
const column = this._tryGetColumn(columnOrId);
|
|
263
263
|
if (column === undefined) {
|
|
264
264
|
return undefined;
|
|
265
265
|
}
|
|
266
266
|
return row.getCell(column);
|
|
267
267
|
}
|
|
268
|
-
insertColumn({ column, index, }) {
|
|
269
|
-
const inserted = this.insertColumns({
|
|
270
|
-
columns: [column],
|
|
271
|
-
index,
|
|
272
|
-
});
|
|
273
|
-
return inserted[0] ?? (0, internal_1.oob)();
|
|
274
|
-
}
|
|
275
268
|
insertColumns({ columns, index, }) {
|
|
276
269
|
// Ensure index is valid
|
|
277
270
|
if (index !== undefined) {
|
|
@@ -290,13 +283,6 @@ var System_TableSchema;
|
|
|
290
283
|
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
291
284
|
return columns;
|
|
292
285
|
}
|
|
293
|
-
insertRow({ row, index, }) {
|
|
294
|
-
const inserted = this.insertRows({
|
|
295
|
-
rows: [row],
|
|
296
|
-
index,
|
|
297
|
-
});
|
|
298
|
-
return inserted[0] ?? (0, internal_1.oob)();
|
|
299
|
-
}
|
|
300
286
|
insertRows({ index, rows, }) {
|
|
301
287
|
// #region Input validation
|
|
302
288
|
// Ensure index is valid
|
|
@@ -313,7 +299,7 @@ var System_TableSchema;
|
|
|
313
299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
314
300
|
const keys = Object.keys(newRow.cells);
|
|
315
301
|
for (const key of keys) {
|
|
316
|
-
if (!this.
|
|
302
|
+
if (!this._containsColumnWithId(key)) {
|
|
317
303
|
throw new internal_2.UsageError(`Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`);
|
|
318
304
|
}
|
|
319
305
|
}
|
|
@@ -336,113 +322,101 @@ var System_TableSchema;
|
|
|
336
322
|
setCell({ key, cell, }) {
|
|
337
323
|
const { column: columnOrId, row: rowOrId } = key;
|
|
338
324
|
const row = this._getRow(rowOrId);
|
|
339
|
-
if (row === undefined) {
|
|
340
|
-
const rowId = this._getRowId(rowOrId);
|
|
341
|
-
throw new internal_2.UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
342
|
-
}
|
|
343
325
|
const column = this._getColumn(columnOrId);
|
|
344
|
-
if (column === undefined) {
|
|
345
|
-
const columnId = this._getColumnId(columnOrId);
|
|
346
|
-
throw new internal_2.UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
347
|
-
}
|
|
348
326
|
row.setCell(column, cell);
|
|
349
327
|
}
|
|
350
|
-
removeColumns(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
328
|
+
removeColumns(indexOrColumns, count = undefined) {
|
|
329
|
+
if (typeof indexOrColumns === "number" || indexOrColumns === undefined) {
|
|
330
|
+
let removedColumns;
|
|
331
|
+
const startIndex = indexOrColumns ?? 0;
|
|
332
|
+
const _count = count ?? this.columns.length - startIndex;
|
|
333
|
+
// If there are no columns to remove, do nothing
|
|
334
|
+
if (_count === 0) {
|
|
335
|
+
return [];
|
|
336
|
+
}
|
|
337
|
+
Table._assertValidRange({ index: startIndex, count: _count }, this.columns);
|
|
338
|
+
this._applyEditsInBatch(() => {
|
|
339
|
+
const columnsToRemove = this.columns.slice(startIndex, startIndex + _count);
|
|
340
|
+
// First, remove all cells that correspond to each column from each row:
|
|
341
|
+
for (const column of columnsToRemove) {
|
|
342
|
+
this._removeCells(column);
|
|
343
|
+
}
|
|
344
|
+
// Second, remove the column nodes:
|
|
345
|
+
Table._removeRange({
|
|
346
|
+
index: startIndex,
|
|
347
|
+
count: _count,
|
|
348
|
+
}, this.columns);
|
|
349
|
+
removedColumns = columnsToRemove;
|
|
350
|
+
});
|
|
351
|
+
return removedColumns ?? (0, internal_1.fail)(0xc1f /* Transaction did not complete. */);
|
|
359
352
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
// So if we throw an error here for any row, no columns will be removed.
|
|
365
|
-
for (const columnToRemove of columns) {
|
|
366
|
-
const removedRow = this.removeColumn(columnToRemove);
|
|
367
|
-
removedColumns.push(removedRow);
|
|
353
|
+
else {
|
|
354
|
+
// If there are no columns to remove, do nothing
|
|
355
|
+
if (indexOrColumns.length === 0) {
|
|
356
|
+
return [];
|
|
368
357
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (index === -1) {
|
|
376
|
-
const columnId = this._getColumnId(columnOrId);
|
|
377
|
-
throw new internal_2.UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
378
|
-
}
|
|
379
|
-
(0, internal_1.assert)(column !== undefined, 0xc10 /* column should not be undefined */);
|
|
380
|
-
index_js_1.Tree.runTransaction(this, () => {
|
|
381
|
-
// Remove the corresponding cell from all rows.
|
|
382
|
-
for (const row of this.rows) {
|
|
383
|
-
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
384
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
385
|
-
row.removeCell(column);
|
|
358
|
+
// Resolve any IDs to actual nodes.
|
|
359
|
+
// This validates that all of the rows exist before starting transaction.
|
|
360
|
+
// This improves user-facing error experience.
|
|
361
|
+
const columnsToRemove = [];
|
|
362
|
+
for (const columnOrIdToRemove of indexOrColumns) {
|
|
363
|
+
columnsToRemove.push(this._getColumn(columnOrIdToRemove));
|
|
386
364
|
}
|
|
387
|
-
this.
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
365
|
+
this._applyEditsInBatch(() => {
|
|
366
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
367
|
+
// So if we throw an error here for any column, no columns will be removed.
|
|
368
|
+
for (const columnToRemove of columnsToRemove) {
|
|
369
|
+
// Remove the corresponding cell from all rows.
|
|
370
|
+
for (const row of this.rows) {
|
|
371
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
372
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
373
|
+
row.removeCell(columnToRemove);
|
|
374
|
+
}
|
|
375
|
+
// We have already validated that all of the columns exist above, so this is safe.
|
|
376
|
+
this.columns.removeAt(this.columns.indexOf(columnToRemove));
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
return columnsToRemove;
|
|
380
|
+
}
|
|
395
381
|
}
|
|
396
|
-
removeRows(
|
|
382
|
+
removeRows(indexOrRows, count) {
|
|
383
|
+
if (typeof indexOrRows === "number" || indexOrRows === undefined) {
|
|
384
|
+
const startIndex = indexOrRows ?? 0;
|
|
385
|
+
const _count = count ?? this.columns.length - startIndex;
|
|
386
|
+
// If there are no rows to remove, do nothing
|
|
387
|
+
if (_count === 0) {
|
|
388
|
+
return [];
|
|
389
|
+
}
|
|
390
|
+
return Table._removeRange({
|
|
391
|
+
index: startIndex,
|
|
392
|
+
count: _count,
|
|
393
|
+
}, this.rows);
|
|
394
|
+
}
|
|
397
395
|
// If there are no rows to remove, do nothing
|
|
398
|
-
if (
|
|
396
|
+
if (indexOrRows.length === 0) {
|
|
399
397
|
return [];
|
|
400
398
|
}
|
|
401
|
-
//
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
399
|
+
// Resolve any IDs to actual nodes.
|
|
400
|
+
// This validates that all of the rows exist before starting transaction.
|
|
401
|
+
// This improves user-facing error experience.
|
|
402
|
+
const rowsToRemove = [];
|
|
403
|
+
for (const rowToRemove of indexOrRows) {
|
|
404
|
+
rowsToRemove.push(this._getRow(rowToRemove));
|
|
405
405
|
}
|
|
406
|
-
|
|
407
|
-
const removedRows = [];
|
|
408
|
-
index_js_1.Tree.runTransaction(this, () => {
|
|
406
|
+
this._applyEditsInBatch(() => {
|
|
409
407
|
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
410
408
|
// So if we throw an error here for any row, no rows will be removed.
|
|
411
|
-
for (const rowToRemove of
|
|
412
|
-
|
|
413
|
-
|
|
409
|
+
for (const rowToRemove of rowsToRemove) {
|
|
410
|
+
// We have already validated that all of the rows exist above, so this is safe.
|
|
411
|
+
this.rows.removeAt(this.rows.indexOf(rowToRemove));
|
|
414
412
|
}
|
|
415
413
|
});
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
removeRow(rowOrId) {
|
|
419
|
-
const rowToRemove = this._getRow(rowOrId);
|
|
420
|
-
const index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);
|
|
421
|
-
// If the row does not exist in the table, throw an error.
|
|
422
|
-
if (index === -1) {
|
|
423
|
-
const rowId = this._getRowId(rowOrId);
|
|
424
|
-
throw new internal_2.UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
425
|
-
}
|
|
426
|
-
this.rows.removeAt(index);
|
|
427
|
-
return rowToRemove;
|
|
428
|
-
}
|
|
429
|
-
removeAllRows() {
|
|
430
|
-
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
431
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
432
|
-
return this.removeRows(this.rows);
|
|
414
|
+
return rowsToRemove;
|
|
433
415
|
}
|
|
434
416
|
removeCell(key) {
|
|
435
417
|
const { column: columnOrId, row: rowOrId } = key;
|
|
436
418
|
const row = this._getRow(rowOrId);
|
|
437
|
-
if (row === undefined) {
|
|
438
|
-
const rowId = this._getRowId(rowOrId);
|
|
439
|
-
throw new internal_2.UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
440
|
-
}
|
|
441
419
|
const column = this._getColumn(columnOrId);
|
|
442
|
-
if (column === undefined) {
|
|
443
|
-
const columnId = this._getColumnId(columnOrId);
|
|
444
|
-
throw new internal_2.UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
445
|
-
}
|
|
446
420
|
const cell = row.getCell(column.id);
|
|
447
421
|
if (cell === undefined) {
|
|
448
422
|
return undefined;
|
|
@@ -450,28 +424,137 @@ var System_TableSchema;
|
|
|
450
424
|
row.removeCell(column.id);
|
|
451
425
|
return cell;
|
|
452
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Removes the cell corresponding with the specified column from each row in the table.
|
|
429
|
+
*/
|
|
430
|
+
_removeCells(column) {
|
|
431
|
+
for (const row of this.rows) {
|
|
432
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
433
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
434
|
+
row.removeCell(column);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
static _assertValidRange(range, array) {
|
|
438
|
+
const { index, count } = range;
|
|
439
|
+
if (index < 0 || index >= array.length) {
|
|
440
|
+
throw new internal_2.UsageError(`Start index out of bounds. Expected index to be on [0, ${array.length - 1}], but got ${index}.`);
|
|
441
|
+
}
|
|
442
|
+
if (count < 0) {
|
|
443
|
+
throw new internal_2.UsageError(`Expected non-negative count. Got ${count}.`);
|
|
444
|
+
}
|
|
445
|
+
const end = index + count; // exclusive
|
|
446
|
+
if (end > array.length) {
|
|
447
|
+
throw new internal_2.UsageError(`End index out of bounds. Expected end to be on [${index}, ${array.length}], but got ${end}.`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Applies the provided edits in a "batch".
|
|
452
|
+
*
|
|
453
|
+
* @remarks
|
|
454
|
+
* For hydrated trees, this will be done in a transaction to ensure atomicity.
|
|
455
|
+
*
|
|
456
|
+
* Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.
|
|
457
|
+
* But since there are no collaborators, this is not an issue.
|
|
458
|
+
*/
|
|
459
|
+
_applyEditsInBatch(applyEdits) {
|
|
460
|
+
const branch = index_js_1.TreeAlpha.branch(this);
|
|
461
|
+
if (branch === undefined) {
|
|
462
|
+
// If this node does not have a corresponding branch, then it is unhydrated.
|
|
463
|
+
// I.e., it is not part of a collaborative session yet.
|
|
464
|
+
// Therefore, we don't need to run the edits as a transaction.
|
|
465
|
+
applyEdits();
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
branch.runTransaction(() => {
|
|
469
|
+
applyEdits();
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
475
|
+
* Returns `undefined` if there is no match.
|
|
476
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
477
|
+
*/
|
|
478
|
+
_tryGetColumn(columnOrId) {
|
|
479
|
+
const columnId = this._getColumnId(columnOrId);
|
|
480
|
+
return this.getColumn(columnId);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
484
|
+
* @throws Throws a `UsageError` if there is no match.
|
|
485
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
486
|
+
*/
|
|
453
487
|
_getColumn(columnOrId) {
|
|
454
|
-
|
|
488
|
+
const column = this._tryGetColumn(columnOrId);
|
|
489
|
+
if (column === undefined) {
|
|
490
|
+
this._throwMissingColumnError(this._getColumnId(columnOrId));
|
|
491
|
+
}
|
|
492
|
+
return column;
|
|
455
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* Resolves a Column node or ID to its ID.
|
|
496
|
+
* If an ID is provided, it is returned as-is.
|
|
497
|
+
* If a node is provided, its ID is returned.
|
|
498
|
+
*/
|
|
456
499
|
_getColumnId(columnOrId) {
|
|
457
500
|
return typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
458
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Checks if a Column with the specified ID exists in the table.
|
|
504
|
+
*/
|
|
505
|
+
_containsColumnWithId(columnId) {
|
|
506
|
+
return this._tryGetColumn(columnId) !== undefined;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Throw a `UsageError` for a missing Column by its ID.
|
|
510
|
+
*/
|
|
511
|
+
_throwMissingColumnError(columnId) {
|
|
512
|
+
throw new internal_2.UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
516
|
+
* Returns `undefined` if there is no match.
|
|
517
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
518
|
+
*/
|
|
519
|
+
_tryGetRow(rowOrId) {
|
|
520
|
+
const rowId = this._getRowId(rowOrId);
|
|
521
|
+
return this.getRow(rowId);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
525
|
+
* @throws Throws a `UsageError` if there is no match.
|
|
526
|
+
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
527
|
+
*/
|
|
459
528
|
_getRow(rowOrId) {
|
|
460
|
-
|
|
529
|
+
const row = this._tryGetRow(rowOrId);
|
|
530
|
+
if (row === undefined) {
|
|
531
|
+
this._throwMissingRowError(this._getRowId(rowOrId));
|
|
532
|
+
}
|
|
533
|
+
return row;
|
|
461
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Resolves a Row node or ID to its ID.
|
|
537
|
+
* If an ID is provided, it is returned as-is.
|
|
538
|
+
* If a node is provided, its ID is returned.
|
|
539
|
+
*/
|
|
462
540
|
_getRowId(rowOrId) {
|
|
463
541
|
return typeof rowOrId === "string" ? rowOrId : rowOrId.id;
|
|
464
542
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
543
|
+
/**
|
|
544
|
+
* Throw a `UsageError` for a missing Row by its ID.
|
|
545
|
+
*/
|
|
546
|
+
_throwMissingRowError(rowId) {
|
|
547
|
+
throw new internal_2.UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
469
548
|
}
|
|
470
|
-
|
|
471
|
-
|
|
549
|
+
static _removeRange(range, array) {
|
|
550
|
+
Table._assertValidRange(range, array);
|
|
551
|
+
const { index, count } = range;
|
|
552
|
+
const end = index + count; // exclusive
|
|
553
|
+
// TypeScript is unable to narrow the array element type correctly here, hence the cast.
|
|
472
554
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
473
|
-
|
|
474
|
-
|
|
555
|
+
const removedRows = array.slice(index, end);
|
|
556
|
+
array.removeRange(index, end);
|
|
557
|
+
return removedRows;
|
|
475
558
|
}
|
|
476
559
|
/**
|
|
477
560
|
* Ensure that the specified index is a valid location for item insertion in the destination list.
|