@fluidframework/tree 2.72.0 → 2.73.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/CHANGELOG.md +99 -0
- package/api-report/tree.alpha.api.md +17 -30
- package/dist/alpha.d.ts +3 -1
- package/dist/api.d.ts +6 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2 -11
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +9 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +9 -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 +2 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +7 -2
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +24 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -1
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +12 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +5 -3
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +31 -17
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +7 -3
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.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 +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.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 +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +53 -55
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -3
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -8
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/format.js +4 -2
- package/dist/feature-libraries/forest-summary/format.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +8 -7
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +1 -2
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +1 -3
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +3 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +5 -3
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
- package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
- package/dist/feature-libraries/schemaChecker.js.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.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/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +0 -44
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +1 -52
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +12 -6
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +5 -8
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +20 -9
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +4 -6
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +9 -7
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +2 -0
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +10 -0
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +5 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +7 -1
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +4 -6
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
- package/dist/simple-tree/api/tree.d.ts +1 -1
- package/dist/simple-tree/api/tree.js +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +3 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +3 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +12 -5
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +26 -10
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +1 -2
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +1 -8
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +9 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +13 -49
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +1 -5
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +2 -10
- package/dist/simple-tree/node-kinds/object/objectNode.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 +1 -5
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +15 -3
- 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 +20 -8
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +27 -22
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts +22 -52
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +141 -277
- package/dist/tableSchema.js.map +1 -1
- package/dist/util/arrayUtilities.d.ts +45 -0
- package/dist/util/arrayUtilities.d.ts.map +1 -0
- package/dist/util/arrayUtilities.js +76 -0
- package/dist/util/arrayUtilities.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +7 -2
- package/dist/util/index.js.map +1 -1
- package/lib/alpha.d.ts +3 -1
- package/lib/api.d.ts +6 -2
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +2 -13
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +9 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +9 -2
- 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/codec/versioned/codec.d.ts +7 -2
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +22 -0
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +12 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +5 -3
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +34 -20
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +6 -2
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.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 +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.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 +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +55 -57
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -3
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -3
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/format.js +4 -2
- package/lib/feature-libraries/forest-summary/format.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +4 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +1 -2
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +0 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +5 -3
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
- package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
- package/lib/feature-libraries/schemaChecker.js.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.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/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +0 -44
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +0 -51
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +13 -7
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +4 -7
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +21 -10
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +4 -6
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +8 -6
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +2 -0
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +10 -0
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +8 -2
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +5 -7
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
- package/lib/simple-tree/api/tree.d.ts +1 -1
- package/lib/simple-tree/api/tree.js +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +3 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +2 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +12 -5
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +25 -9
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +1 -2
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +2 -9
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +1 -2
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +15 -51
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +3 -7
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -11
- package/lib/simple-tree/node-kinds/object/objectNode.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 +3 -7
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +15 -3
- 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 +20 -8
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +28 -24
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts +22 -52
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +143 -279
- package/lib/tableSchema.js.map +1 -1
- package/lib/util/arrayUtilities.d.ts +45 -0
- package/lib/util/arrayUtilities.d.ts.map +1 -0
- package/lib/util/arrayUtilities.js +69 -0
- package/lib/util/arrayUtilities.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/package.json +21 -21
- package/src/api.ts +22 -11
- package/src/codec/codec.ts +10 -2
- package/src/codec/index.ts +1 -0
- package/src/codec/versioned/codec.ts +40 -2
- package/src/codec/versioned/index.ts +1 -0
- package/src/core/schema-stored/schema.ts +12 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +10 -3
- package/src/feature-libraries/README.md +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +52 -19
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +8 -3
- package/src/feature-libraries/chunked-forest/codec/format.ts +14 -4
- package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -4
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
- package/src/feature-libraries/chunked-forest/index.ts +1 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +86 -74
- package/src/feature-libraries/default-schema/index.ts +1 -9
- package/src/feature-libraries/forest-summary/format.ts +15 -9
- package/src/feature-libraries/index.ts +7 -5
- package/src/feature-libraries/modular-schema/comparison.ts +2 -3
- package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
- package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
- package/src/feature-libraries/modular-schema/index.ts +0 -1
- package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
- package/src/feature-libraries/object-forest/objectForest.ts +2 -6
- package/src/feature-libraries/optional-field/index.ts +1 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
- package/src/feature-libraries/schema-index/codec.ts +10 -3
- package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
- package/src/index.ts +3 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +0 -1
- package/src/shared-tree/sharedTree.ts +0 -70
- package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -6
- package/src/shared-tree-core/editManagerCodecs.ts +19 -7
- package/src/shared-tree-core/editManagerFormatCommons.ts +11 -12
- package/src/shared-tree-core/index.ts +6 -2
- package/src/shared-tree-core/messageCodecs.ts +32 -17
- package/src/shared-tree-core/messageFormat.ts +8 -6
- package/src/simple-tree/api/configuration.ts +17 -4
- package/src/simple-tree/api/index.ts +5 -0
- package/src/simple-tree/api/schemaFromSimple.ts +14 -6
- package/src/simple-tree/api/simpleSchemaCodec.ts +10 -9
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
- package/src/simple-tree/api/tree.ts +1 -1
- package/src/simple-tree/core/allowedTypes.ts +1 -1
- package/src/simple-tree/core/index.ts +3 -1
- package/src/simple-tree/core/toStored.ts +42 -18
- package/src/simple-tree/core/treeNodeSchema.ts +1 -7
- package/src/simple-tree/core/treeNodeValid.ts +0 -2
- package/src/simple-tree/fieldSchema.ts +2 -11
- package/src/simple-tree/index.ts +6 -1
- package/src/simple-tree/leafNodeSchema.ts +1 -2
- package/src/simple-tree/node-kinds/array/arrayNode.ts +26 -75
- package/src/simple-tree/node-kinds/map/mapNode.ts +1 -15
- package/src/simple-tree/node-kinds/object/objectNode.ts +2 -17
- package/src/simple-tree/node-kinds/record/recordNode.ts +1 -15
- package/src/simple-tree/simpleSchema.ts +16 -3
- package/src/simple-tree/toStoredSchema.ts +54 -38
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
- package/src/tableSchema.ts +110 -334
- package/src/util/arrayUtilities.ts +88 -0
- package/src/util/index.ts +6 -0
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
- package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
- package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
- package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
- package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
- package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
package/lib/tableSchema.js
CHANGED
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
6
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
8
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9
|
+
};
|
|
5
10
|
import { fail } from "@fluidframework/core-utils/internal";
|
|
6
11
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
-
import {
|
|
8
|
-
import { TreeArrayNode, SchemaFactory,
|
|
12
|
+
import { TreeAlpha } from "./shared-tree/index.js";
|
|
13
|
+
import { TreeArrayNode, SchemaFactory, withBufferedTreeEvents, } from "./simple-tree/index.js";
|
|
14
|
+
import { validateIndex, validateIndexRange } from "./util/index.js";
|
|
9
15
|
// Future improvement TODOs:
|
|
10
16
|
// - Omit `cells` property from Row insertion type.
|
|
11
17
|
// - Record-like type parameters / input parameters?
|
|
@@ -16,32 +22,10 @@ import { TreeArrayNode, SchemaFactory, isArrayNodeSchema, withBufferedTreeEvents
|
|
|
16
22
|
* The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
|
|
17
23
|
*/
|
|
18
24
|
const tableSchemaFactorySubScope = "table";
|
|
19
|
-
/**
|
|
20
|
-
* Gets the table containing the provided row/column node, if the node is part of a table.
|
|
21
|
-
* @remarks Assumes that the table is the grandparent of the row/column node.
|
|
22
|
-
*/
|
|
23
|
-
function getParentTable(rowOrColumnNode) {
|
|
24
|
-
const rowListNode = Tree.parent(rowOrColumnNode);
|
|
25
|
-
if (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
const tableNode = Tree.parent(rowListNode);
|
|
29
|
-
if (tableNode === undefined || !isTableNode(tableNode)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
return tableNode;
|
|
33
|
-
}
|
|
34
25
|
/**
|
|
35
26
|
* A private symbol put on table schema to help identify them.
|
|
36
27
|
*/
|
|
37
28
|
const tableSchemaSymbol = Symbol("tableNode");
|
|
38
|
-
/**
|
|
39
|
-
* Type-guard to determine if a node is a table node.
|
|
40
|
-
* @remarks Uses {@link tableSchemaSymbol} to identify table nodes.
|
|
41
|
-
*/
|
|
42
|
-
function isTableNode(node) {
|
|
43
|
-
return tableSchemaSymbol in Tree.schema(node);
|
|
44
|
-
}
|
|
45
29
|
/**
|
|
46
30
|
* Not intended for use outside of this package.
|
|
47
31
|
*
|
|
@@ -59,7 +43,7 @@ export var System_TableSchema;
|
|
|
59
43
|
* @system @alpha
|
|
60
44
|
*/
|
|
61
45
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
62
|
-
function createColumnSchema(inputSchemaFactory,
|
|
46
|
+
function createColumnSchema(inputSchemaFactory, propsSchema) {
|
|
63
47
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
64
48
|
// Note: `columnFields` is broken into two parts to work around a TypeScript bug
|
|
65
49
|
// that results in broken `.d.ts` output.
|
|
@@ -92,23 +76,6 @@ export var System_TableSchema;
|
|
|
92
76
|
// Will make it easier to evolve this schema in the future.
|
|
93
77
|
allowUnknownOptionalFields: true,
|
|
94
78
|
}) {
|
|
95
|
-
getCells() {
|
|
96
|
-
const tableNode = getParentTable(this);
|
|
97
|
-
if (tableNode === undefined) {
|
|
98
|
-
throw new UsageError(`Column with ID "${this.id}" is not contained in a table.`);
|
|
99
|
-
}
|
|
100
|
-
const result = [];
|
|
101
|
-
for (const row of tableNode.rows) {
|
|
102
|
-
const cell = row.getCell(this.id);
|
|
103
|
-
if (cell !== undefined) {
|
|
104
|
-
if (!Tree.is(cell, cellSchema)) {
|
|
105
|
-
throw new UsageError("Parent table contains a cell with incompatible with this column.");
|
|
106
|
-
}
|
|
107
|
-
result.push({ rowId: row.id, cell });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
79
|
}
|
|
113
80
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
114
81
|
// for the private brand field of TreeNode.
|
|
@@ -146,7 +113,7 @@ export var System_TableSchema;
|
|
|
146
113
|
props: propsSchema,
|
|
147
114
|
};
|
|
148
115
|
/**
|
|
149
|
-
* {@link
|
|
116
|
+
* {@link RowSchema} fields.
|
|
150
117
|
* @remarks Extracted for re-use in returned type signature defined later in this function.
|
|
151
118
|
* The implicit typing is intentional.
|
|
152
119
|
* Note: ideally we would add a satisfies clause here to ensure that this satisfies
|
|
@@ -160,57 +127,17 @@ export var System_TableSchema;
|
|
|
160
127
|
/**
|
|
161
128
|
* The Row schema - this is a map of Cells where the key is the column id
|
|
162
129
|
*/
|
|
163
|
-
class
|
|
130
|
+
class RowSchema extends schemaFactory.object("Row", rowFields, {
|
|
164
131
|
// Will make it easier to evolve this schema in the future.
|
|
165
132
|
allowUnknownOptionalFields: true,
|
|
166
133
|
}) {
|
|
167
|
-
getCell(columnOrId) {
|
|
168
|
-
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
169
|
-
// Unlike most objects, RecordNodes don't have the default inherited object properties, so this is safe
|
|
170
|
-
return this.cells[columnId];
|
|
171
|
-
}
|
|
172
|
-
setCell(columnOrId, value) {
|
|
173
|
-
// TODO: throw if column does not exist in the owning table.
|
|
174
|
-
if (value === undefined) {
|
|
175
|
-
this.removeCell(columnOrId);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
179
|
-
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
180
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
181
|
-
this.cells[columnId] = TreeAlpha.create(cellSchema, value);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
removeCell(columnOrId) {
|
|
185
|
-
// TODO: throw if column does not exist in the owning table.
|
|
186
|
-
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
187
|
-
const cell = this.getCell(columnId);
|
|
188
|
-
if (cell === undefined) {
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- The record's values are non-optional, so setting `undefined` as a means to remove the cell is not supported.
|
|
192
|
-
delete this.cells[columnId];
|
|
193
|
-
return cell;
|
|
194
|
-
}
|
|
195
|
-
getCells() {
|
|
196
|
-
const result = [];
|
|
197
|
-
for (const [columnId, cell] of Object.entries(this.cells)) {
|
|
198
|
-
if (cell !== undefined) {
|
|
199
|
-
result.push({
|
|
200
|
-
columnId,
|
|
201
|
-
cell,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return result;
|
|
206
|
-
}
|
|
207
134
|
}
|
|
208
135
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
209
136
|
// for the private brand field of TreeNode.
|
|
210
137
|
// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
|
|
211
138
|
// This is avoided by doing this type conversion.
|
|
212
139
|
// The conversion is done via assignment instead of `as` to get stronger type safety.
|
|
213
|
-
const RowSchemaType =
|
|
140
|
+
const RowSchemaType = RowSchema;
|
|
214
141
|
return RowSchemaType;
|
|
215
142
|
}
|
|
216
143
|
System_TableSchema.createRowSchema = createRowSchema;
|
|
@@ -220,6 +147,7 @@ export var System_TableSchema;
|
|
|
220
147
|
*/
|
|
221
148
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
222
149
|
function createTableSchema(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
|
|
150
|
+
var _Table_instances, _a, _Table_removeCells, _Table_applyEditsInBatch, _Table_tryGetColumn, _Table_getColumn, _Table_containsColumnWithId, _Table_tryGetRow, _Table_getRow;
|
|
223
151
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
224
152
|
/**
|
|
225
153
|
* {@link Table} fields.
|
|
@@ -237,32 +165,32 @@ export var System_TableSchema;
|
|
|
237
165
|
// Will make it easier to evolve this schema in the future.
|
|
238
166
|
allowUnknownOptionalFields: true,
|
|
239
167
|
}) {
|
|
168
|
+
constructor() {
|
|
169
|
+
super(...arguments);
|
|
170
|
+
_Table_instances.add(this);
|
|
171
|
+
}
|
|
240
172
|
static empty() {
|
|
241
173
|
return new this({ columns: [], rows: [] });
|
|
242
174
|
}
|
|
243
175
|
getColumn(indexOrId) {
|
|
244
|
-
return this.
|
|
176
|
+
return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, indexOrId);
|
|
245
177
|
}
|
|
246
178
|
getRow(indexOrId) {
|
|
247
|
-
return this.
|
|
179
|
+
return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, indexOrId);
|
|
248
180
|
}
|
|
249
181
|
getCell(key) {
|
|
250
182
|
const { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;
|
|
251
|
-
const row = this.
|
|
183
|
+
const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, rowOrIdOrIndex);
|
|
252
184
|
if (row === undefined) {
|
|
253
185
|
return undefined;
|
|
254
186
|
}
|
|
255
|
-
const column = this.
|
|
187
|
+
const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnOrIdOrIndex);
|
|
256
188
|
if (column === undefined) {
|
|
257
189
|
return undefined;
|
|
258
190
|
}
|
|
259
|
-
return row.
|
|
191
|
+
return row.cells[column.id];
|
|
260
192
|
}
|
|
261
193
|
insertColumns({ columns, index, }) {
|
|
262
|
-
// Ensure index is valid
|
|
263
|
-
if (index !== undefined) {
|
|
264
|
-
Table.validateInsertionIndex(index, this.columns);
|
|
265
|
-
}
|
|
266
194
|
// TypeScript is unable to narrow the column type correctly here, hence the casts below.
|
|
267
195
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
268
196
|
if (index === undefined) {
|
|
@@ -270,6 +198,8 @@ export var System_TableSchema;
|
|
|
270
198
|
this.columns.insertAtEnd(TreeArrayNode.spread(columns));
|
|
271
199
|
}
|
|
272
200
|
else {
|
|
201
|
+
// Ensure specified index is valid
|
|
202
|
+
validateIndex(index, this.columns, "Table.insertColumns", true);
|
|
273
203
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
274
204
|
this.columns.insertAt(index, TreeArrayNode.spread(columns));
|
|
275
205
|
}
|
|
@@ -278,9 +208,9 @@ export var System_TableSchema;
|
|
|
278
208
|
}
|
|
279
209
|
insertRows({ index, rows, }) {
|
|
280
210
|
// #region Input validation
|
|
281
|
-
// Ensure index is valid
|
|
211
|
+
// Ensure specified index is valid
|
|
282
212
|
if (index !== undefined) {
|
|
283
|
-
|
|
213
|
+
validateIndex(index, this.rows, "Table.insertRows", true);
|
|
284
214
|
}
|
|
285
215
|
// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
|
|
286
216
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
@@ -292,7 +222,7 @@ export var System_TableSchema;
|
|
|
292
222
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
293
223
|
const keys = Object.keys(newRow.cells);
|
|
294
224
|
for (const key of keys) {
|
|
295
|
-
if (!this.
|
|
225
|
+
if (!__classPrivateFieldGet(this, _Table_instances, "m", _Table_containsColumnWithId).call(this, key)) {
|
|
296
226
|
throw new UsageError(`Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`);
|
|
297
227
|
}
|
|
298
228
|
}
|
|
@@ -314,31 +244,28 @@ export var System_TableSchema;
|
|
|
314
244
|
}
|
|
315
245
|
setCell({ key, cell, }) {
|
|
316
246
|
const { column: columnOrId, row: rowOrId } = key;
|
|
317
|
-
const row = this.
|
|
318
|
-
const column = this.
|
|
319
|
-
row.
|
|
247
|
+
const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowOrId);
|
|
248
|
+
const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrId);
|
|
249
|
+
row.cells[column.id] = cell;
|
|
320
250
|
}
|
|
321
251
|
removeColumns(indexOrColumns, count = undefined) {
|
|
322
252
|
if (typeof indexOrColumns === "number" || indexOrColumns === undefined) {
|
|
323
253
|
let removedColumns;
|
|
324
254
|
const startIndex = indexOrColumns ?? 0;
|
|
325
|
-
const
|
|
255
|
+
const endIndex = count === undefined ? this.columns.length : startIndex + count;
|
|
326
256
|
// If there are no columns to remove, do nothing
|
|
327
|
-
if (
|
|
257
|
+
if (startIndex === endIndex) {
|
|
328
258
|
return [];
|
|
329
259
|
}
|
|
330
|
-
|
|
331
|
-
this.
|
|
332
|
-
const columnsToRemove = this.columns.slice(startIndex,
|
|
260
|
+
validateIndexRange(startIndex, endIndex, this.columns, "Table.removeColumns");
|
|
261
|
+
__classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
|
|
262
|
+
const columnsToRemove = this.columns.slice(startIndex, endIndex);
|
|
333
263
|
// First, remove all cells that correspond to each column from each row:
|
|
334
264
|
for (const column of columnsToRemove) {
|
|
335
|
-
this.
|
|
265
|
+
__classPrivateFieldGet(this, _Table_instances, "m", _Table_removeCells).call(this, column);
|
|
336
266
|
}
|
|
337
267
|
// Second, remove the column nodes:
|
|
338
|
-
Table.
|
|
339
|
-
index: startIndex,
|
|
340
|
-
count: _count,
|
|
341
|
-
}, this.columns);
|
|
268
|
+
removeRangeFromArray(startIndex, endIndex, this.columns, "Table.removeColumns");
|
|
342
269
|
removedColumns = columnsToRemove;
|
|
343
270
|
});
|
|
344
271
|
return removedColumns ?? fail(0xc1f /* Transaction did not complete. */);
|
|
@@ -353,9 +280,9 @@ export var System_TableSchema;
|
|
|
353
280
|
// This improves user-facing error experience.
|
|
354
281
|
const columnsToRemove = [];
|
|
355
282
|
for (const columnOrIdToRemove of indexOrColumns) {
|
|
356
|
-
columnsToRemove.push(this.
|
|
283
|
+
columnsToRemove.push(__classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrIdToRemove));
|
|
357
284
|
}
|
|
358
|
-
this.
|
|
285
|
+
__classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
|
|
359
286
|
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
360
287
|
// So if we throw an error here for any column, no columns will be removed.
|
|
361
288
|
for (const columnToRemove of columnsToRemove) {
|
|
@@ -363,7 +290,10 @@ export var System_TableSchema;
|
|
|
363
290
|
for (const row of this.rows) {
|
|
364
291
|
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
365
292
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
366
|
-
|
|
293
|
+
this.removeCell({
|
|
294
|
+
column: columnToRemove,
|
|
295
|
+
row: row,
|
|
296
|
+
});
|
|
367
297
|
}
|
|
368
298
|
// We have already validated that all of the columns exist above, so this is safe.
|
|
369
299
|
this.columns.removeAt(this.columns.indexOf(columnToRemove));
|
|
@@ -375,15 +305,12 @@ export var System_TableSchema;
|
|
|
375
305
|
removeRows(indexOrRows, count) {
|
|
376
306
|
if (typeof indexOrRows === "number" || indexOrRows === undefined) {
|
|
377
307
|
const startIndex = indexOrRows ?? 0;
|
|
378
|
-
const
|
|
308
|
+
const endIndex = count === undefined ? this.columns.length : startIndex + count;
|
|
379
309
|
// If there are no rows to remove, do nothing
|
|
380
|
-
if (
|
|
310
|
+
if (startIndex === endIndex) {
|
|
381
311
|
return [];
|
|
382
312
|
}
|
|
383
|
-
return Table.
|
|
384
|
-
index: startIndex,
|
|
385
|
-
count: _count,
|
|
386
|
-
}, this.rows);
|
|
313
|
+
return removeRangeFromArray(startIndex, endIndex, this.rows, "Table.removeRows");
|
|
387
314
|
}
|
|
388
315
|
// If there are no rows to remove, do nothing
|
|
389
316
|
if (indexOrRows.length === 0) {
|
|
@@ -394,9 +321,9 @@ export var System_TableSchema;
|
|
|
394
321
|
// This improves user-facing error experience.
|
|
395
322
|
const rowsToRemove = [];
|
|
396
323
|
for (const rowToRemove of indexOrRows) {
|
|
397
|
-
rowsToRemove.push(this.
|
|
324
|
+
rowsToRemove.push(__classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowToRemove));
|
|
398
325
|
}
|
|
399
|
-
this.
|
|
326
|
+
__classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
|
|
400
327
|
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
401
328
|
// So if we throw an error here for any row, no rows will be removed.
|
|
402
329
|
for (const rowToRemove of rowsToRemove) {
|
|
@@ -409,110 +336,16 @@ export var System_TableSchema;
|
|
|
409
336
|
}
|
|
410
337
|
removeCell(key) {
|
|
411
338
|
const { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;
|
|
412
|
-
const row = this.
|
|
413
|
-
const column = this.
|
|
414
|
-
const cell = row.
|
|
339
|
+
const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowOrIdOrIndex);
|
|
340
|
+
const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrIdOrIndex);
|
|
341
|
+
const cell = row.cells[column.id];
|
|
415
342
|
if (cell === undefined) {
|
|
416
343
|
return undefined;
|
|
417
344
|
}
|
|
418
|
-
|
|
345
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
346
|
+
delete row.cells[column.id];
|
|
419
347
|
return cell;
|
|
420
348
|
}
|
|
421
|
-
/**
|
|
422
|
-
* Removes the cell corresponding with the specified column from each row in the table.
|
|
423
|
-
*/
|
|
424
|
-
_removeCells(column) {
|
|
425
|
-
for (const row of this.rows) {
|
|
426
|
-
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
427
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
428
|
-
row.removeCell(column);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
static _assertValidRange(range, array) {
|
|
432
|
-
const { index, count } = range;
|
|
433
|
-
if (index < 0 || index >= array.length) {
|
|
434
|
-
throw new UsageError(`Start index out of bounds. Expected index to be on [0, ${array.length - 1}], but got ${index}.`);
|
|
435
|
-
}
|
|
436
|
-
if (count < 0) {
|
|
437
|
-
throw new UsageError(`Expected non-negative count. Got ${count}.`);
|
|
438
|
-
}
|
|
439
|
-
const end = index + count; // exclusive
|
|
440
|
-
if (end > array.length) {
|
|
441
|
-
throw new UsageError(`End index out of bounds. Expected end to be on [${index}, ${array.length}], but got ${end}.`);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Applies the provided edits in a "batch".
|
|
446
|
-
*
|
|
447
|
-
* @remarks
|
|
448
|
-
* For hydrated trees, this will be done in a transaction to ensure atomicity.
|
|
449
|
-
*
|
|
450
|
-
* Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.
|
|
451
|
-
* But since there are no collaborators, this is not an issue.
|
|
452
|
-
*/
|
|
453
|
-
_applyEditsInBatch(applyEdits) {
|
|
454
|
-
const branch = TreeAlpha.branch(this);
|
|
455
|
-
// Ensure events are paused until all of the edits are applied.
|
|
456
|
-
// This ensures that the user sees the corresponding table-level edit as atomic,
|
|
457
|
-
// and ensures they are not spammed with intermediate events.
|
|
458
|
-
withBufferedTreeEvents(() => {
|
|
459
|
-
if (branch === undefined) {
|
|
460
|
-
// If this node does not have a corresponding branch, then it is unhydrated.
|
|
461
|
-
// I.e., it is not part of a collaborative session yet.
|
|
462
|
-
// Therefore, we don't need to run the edits as a transaction.
|
|
463
|
-
applyEdits();
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
branch.runTransaction(() => {
|
|
467
|
-
applyEdits();
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
474
|
-
* Returns `undefined` if there is no match.
|
|
475
|
-
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
476
|
-
*/
|
|
477
|
-
_tryGetColumn(columnOrIdOrIndex) {
|
|
478
|
-
if (typeof columnOrIdOrIndex === "number") {
|
|
479
|
-
if (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.columns.length) {
|
|
480
|
-
return undefined;
|
|
481
|
-
}
|
|
482
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
483
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
484
|
-
return this.columns[columnOrIdOrIndex];
|
|
485
|
-
}
|
|
486
|
-
if (typeof columnOrIdOrIndex === "string") {
|
|
487
|
-
const columnId = columnOrIdOrIndex;
|
|
488
|
-
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
489
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
490
|
-
return this.columns.find((col) => col.id === columnId);
|
|
491
|
-
}
|
|
492
|
-
// If the user provided a node, ensure it actually exists in this table.
|
|
493
|
-
if (!this.columns.includes(columnOrIdOrIndex)) {
|
|
494
|
-
return undefined;
|
|
495
|
-
}
|
|
496
|
-
return columnOrIdOrIndex;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Attempts to resolve the provided Column node or ID to a Column node in the table.
|
|
500
|
-
* @throws Throws a `UsageError` if there is no match.
|
|
501
|
-
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
502
|
-
*/
|
|
503
|
-
_getColumn(columnOrIdOrIndex) {
|
|
504
|
-
const column = this._tryGetColumn(columnOrIdOrIndex);
|
|
505
|
-
if (column === undefined) {
|
|
506
|
-
Table._throwMissingColumnError(columnOrIdOrIndex);
|
|
507
|
-
}
|
|
508
|
-
return column;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Checks if a Column with the specified ID exists in the table.
|
|
512
|
-
*/
|
|
513
|
-
_containsColumnWithId(columnId) {
|
|
514
|
-
return this._tryGetColumn(columnId) !== undefined;
|
|
515
|
-
}
|
|
516
349
|
/**
|
|
517
350
|
* Throw a `UsageError` for a missing Column by its ID or index.
|
|
518
351
|
*/
|
|
@@ -525,44 +358,6 @@ export var System_TableSchema;
|
|
|
525
358
|
}
|
|
526
359
|
throw new UsageError(`The specified column node with ID "${columnOrIdOrIndex.id}" does not exist in the table.`);
|
|
527
360
|
}
|
|
528
|
-
/**
|
|
529
|
-
* Attempts to resolve the provided Row node or ID to a Row node in the table.
|
|
530
|
-
* Returns `undefined` if there is no match.
|
|
531
|
-
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
532
|
-
*/
|
|
533
|
-
_tryGetRow(rowOrIdOrIndex) {
|
|
534
|
-
if (typeof rowOrIdOrIndex === "number") {
|
|
535
|
-
if (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.rows.length) {
|
|
536
|
-
return undefined;
|
|
537
|
-
}
|
|
538
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
539
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
540
|
-
return this.rows[rowOrIdOrIndex];
|
|
541
|
-
}
|
|
542
|
-
if (typeof rowOrIdOrIndex === "string") {
|
|
543
|
-
const rowId = rowOrIdOrIndex;
|
|
544
|
-
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
545
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
546
|
-
return this.rows.find((row) => row.id === rowId);
|
|
547
|
-
}
|
|
548
|
-
// If the user provided a node, ensure it actually exists in this table.
|
|
549
|
-
if (!this.rows.includes(rowOrIdOrIndex)) {
|
|
550
|
-
return undefined;
|
|
551
|
-
}
|
|
552
|
-
return rowOrIdOrIndex;
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* Attempts to resolve the provided Row node, ID, or index to a Row node in the table.
|
|
556
|
-
* @throws Throws a `UsageError` if there is no match.
|
|
557
|
-
* @remarks Searches for a match based strictly on the ID and returns that result.
|
|
558
|
-
*/
|
|
559
|
-
_getRow(rowOrIdOrIndex) {
|
|
560
|
-
const row = this._tryGetRow(rowOrIdOrIndex);
|
|
561
|
-
if (row === undefined) {
|
|
562
|
-
Table._throwMissingRowError(rowOrIdOrIndex);
|
|
563
|
-
}
|
|
564
|
-
return row;
|
|
565
|
-
}
|
|
566
361
|
/**
|
|
567
362
|
* Throw a `UsageError` for a missing Row by its ID or index.
|
|
568
363
|
*/
|
|
@@ -575,32 +370,89 @@ export var System_TableSchema;
|
|
|
575
370
|
}
|
|
576
371
|
throw new UsageError(`The specified row node with ID "${rowOrIdOrIndex.id}" does not exist in the table.`);
|
|
577
372
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
// TypeScript is unable to narrow the array element type correctly here, hence the cast.
|
|
373
|
+
}
|
|
374
|
+
_a = Table, _Table_instances = new WeakSet(), _Table_removeCells = function _Table_removeCells(column) {
|
|
375
|
+
for (const row of this.rows) {
|
|
376
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
583
377
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
378
|
+
this.removeCell({
|
|
379
|
+
column,
|
|
380
|
+
row: row,
|
|
381
|
+
});
|
|
587
382
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
383
|
+
}, _Table_applyEditsInBatch = function _Table_applyEditsInBatch(applyEdits) {
|
|
384
|
+
const branch = TreeAlpha.branch(this);
|
|
385
|
+
// Ensure events are paused until all of the edits are applied.
|
|
386
|
+
// This ensures that the user sees the corresponding table-level edit as atomic,
|
|
387
|
+
// and ensures they are not spammed with intermediate events.
|
|
388
|
+
withBufferedTreeEvents(() => {
|
|
389
|
+
if (branch === undefined) {
|
|
390
|
+
// If this node does not have a corresponding branch, then it is unhydrated.
|
|
391
|
+
// I.e., it is not part of a collaborative session yet.
|
|
392
|
+
// Therefore, we don't need to run the edits as a transaction.
|
|
393
|
+
applyEdits();
|
|
595
394
|
}
|
|
596
|
-
|
|
597
|
-
|
|
395
|
+
else {
|
|
396
|
+
branch.runTransaction(() => {
|
|
397
|
+
applyEdits();
|
|
398
|
+
});
|
|
598
399
|
}
|
|
599
|
-
|
|
600
|
-
|
|
400
|
+
});
|
|
401
|
+
}, _Table_tryGetColumn = function _Table_tryGetColumn(columnOrIdOrIndex) {
|
|
402
|
+
if (typeof columnOrIdOrIndex === "number") {
|
|
403
|
+
if (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.columns.length) {
|
|
404
|
+
return undefined;
|
|
601
405
|
}
|
|
406
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
407
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
408
|
+
return this.columns[columnOrIdOrIndex];
|
|
602
409
|
}
|
|
603
|
-
|
|
410
|
+
if (typeof columnOrIdOrIndex === "string") {
|
|
411
|
+
const columnId = columnOrIdOrIndex;
|
|
412
|
+
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
413
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
414
|
+
return this.columns.find((col) => col.id === columnId);
|
|
415
|
+
}
|
|
416
|
+
// If the user provided a node, ensure it actually exists in this table.
|
|
417
|
+
if (!this.columns.includes(columnOrIdOrIndex)) {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
return columnOrIdOrIndex;
|
|
421
|
+
}, _Table_getColumn = function _Table_getColumn(columnOrIdOrIndex) {
|
|
422
|
+
const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnOrIdOrIndex);
|
|
423
|
+
if (column === undefined) {
|
|
424
|
+
_a._throwMissingColumnError(columnOrIdOrIndex);
|
|
425
|
+
}
|
|
426
|
+
return column;
|
|
427
|
+
}, _Table_containsColumnWithId = function _Table_containsColumnWithId(columnId) {
|
|
428
|
+
return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnId) !== undefined;
|
|
429
|
+
}, _Table_tryGetRow = function _Table_tryGetRow(rowOrIdOrIndex) {
|
|
430
|
+
if (typeof rowOrIdOrIndex === "number") {
|
|
431
|
+
if (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.rows.length) {
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
435
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
436
|
+
return this.rows[rowOrIdOrIndex];
|
|
437
|
+
}
|
|
438
|
+
if (typeof rowOrIdOrIndex === "string") {
|
|
439
|
+
const rowId = rowOrIdOrIndex;
|
|
440
|
+
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
441
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
442
|
+
return this.rows.find((row) => row.id === rowId);
|
|
443
|
+
}
|
|
444
|
+
// If the user provided a node, ensure it actually exists in this table.
|
|
445
|
+
if (!this.rows.includes(rowOrIdOrIndex)) {
|
|
446
|
+
return undefined;
|
|
447
|
+
}
|
|
448
|
+
return rowOrIdOrIndex;
|
|
449
|
+
}, _Table_getRow = function _Table_getRow(rowOrIdOrIndex) {
|
|
450
|
+
const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, rowOrIdOrIndex);
|
|
451
|
+
if (row === undefined) {
|
|
452
|
+
_a._throwMissingRowError(rowOrIdOrIndex);
|
|
453
|
+
}
|
|
454
|
+
return row;
|
|
455
|
+
};
|
|
604
456
|
// Set a private symbol on the schema class that marks it as having been generated by this factory.
|
|
605
457
|
// Column / Row functionality use this to validate that they are being used in a table.
|
|
606
458
|
// This is effectively a work-around that allows columns and rows to invoke table methods
|
|
@@ -619,6 +471,18 @@ export var System_TableSchema;
|
|
|
619
471
|
System_TableSchema.createTableSchema = createTableSchema;
|
|
620
472
|
// #endregion
|
|
621
473
|
})(System_TableSchema || (System_TableSchema = {}));
|
|
474
|
+
/**
|
|
475
|
+
* Removes the specified range of elements from the array.
|
|
476
|
+
* @returns The removed elements.
|
|
477
|
+
*/
|
|
478
|
+
function removeRangeFromArray(startIndex, endIndex, array, methodName) {
|
|
479
|
+
validateIndexRange(startIndex, endIndex, array, methodName);
|
|
480
|
+
// TypeScript is unable to narrow the array element type correctly here, hence the cast.
|
|
481
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
482
|
+
const removedRows = array.slice(startIndex, endIndex);
|
|
483
|
+
array.removeRange(startIndex, endIndex);
|
|
484
|
+
return removedRows;
|
|
485
|
+
}
|
|
622
486
|
/**
|
|
623
487
|
* Contains types and factories for creating schema to represent dynamic tabular data.
|
|
624
488
|
*
|
|
@@ -740,7 +604,7 @@ export var TableSchema;
|
|
|
740
604
|
* Overload implementation
|
|
741
605
|
*/
|
|
742
606
|
function column({ schemaFactory, cell, props = SchemaFactory.optional(SchemaFactory.null), }) {
|
|
743
|
-
return System_TableSchema.createColumnSchema(schemaFactory,
|
|
607
|
+
return System_TableSchema.createColumnSchema(schemaFactory, props);
|
|
744
608
|
}
|
|
745
609
|
TableSchema.column = column;
|
|
746
610
|
/**
|