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