@fluidframework/tree 2.40.0-336023 → 2.41.0-337492
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 +64 -0
- package/api-report/tree.alpha.api.md +4 -1
- package/dist/alpha.d.ts +1 -0
- package/dist/codec/codec.d.ts +5 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +6 -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/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -0
- package/dist/core/schema-stored/{format.js → formatV1.js} +1 -1
- package/dist/core/schema-stored/formatV1.js.map +1 -0
- package/dist/core/schema-stored/index.d.ts +3 -3
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js +3 -3
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +3 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +8 -6
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/schema-view/index.d.ts +1 -1
- package/dist/core/schema-view/index.d.ts.map +1 -1
- package/dist/core/schema-view/index.js +1 -2
- package/dist/core/schema-view/index.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -27
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js +1 -35
- package/dist/core/schema-view/view.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +0 -7
- package/dist/feature-libraries/default-schema/schemaChecker.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 +1 -1
- package/dist/feature-libraries/forest-summary/format.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts +3 -3
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +2 -2
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -5
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +34 -5
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +63 -9
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/{lib/feature-libraries/schema-index/format.d.ts → dist/feature-libraries/schema-index/formatV1.d.ts} +9 -9
- package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/schema-index/{format.js → formatV1.js} +4 -4
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -0
- package/dist/feature-libraries/schema-index/index.d.ts +2 -2
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +6 -3
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +4 -4
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- 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/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -1
- package/dist/shared-tree/independentView.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 +2 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +9 -10
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +10 -34
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +4 -6
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +28 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +29 -3
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/tree.d.ts +24 -0
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +2 -0
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -2
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +0 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +0 -1
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/transactionEnricher.d.ts +1 -1
- package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/transactionEnricher.js +4 -1
- package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +9 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +7 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +8 -7
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +13 -9
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +25 -0
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +4 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +83 -0
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
- package/dist/simple-tree/api/treeChangeEvents.js +7 -0
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts +2 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +28 -0
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +2 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +5 -5
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +94 -0
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -0
- package/dist/simple-tree/core/treeNode.js +123 -0
- package/dist/simple-tree/core/treeNode.js.map +1 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -1
- 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/types.d.ts +0 -165
- package/dist/simple-tree/core/types.d.ts.map +1 -1
- package/dist/simple-tree/core/types.js +1 -113
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +1 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.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 +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +1 -0
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +8 -8
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +27 -32
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +309 -91
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +319 -78
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +30 -75
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/codec/codec.d.ts +5 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +5 -1
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -0
- package/lib/core/schema-stored/{format.js → formatV1.js} +1 -1
- package/lib/core/schema-stored/formatV1.js.map +1 -0
- package/lib/core/schema-stored/index.d.ts +3 -3
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +2 -2
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +3 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/schema-view/index.d.ts +1 -1
- package/lib/core/schema-view/index.d.ts.map +1 -1
- package/lib/core/schema-view/index.js +1 -1
- package/lib/core/schema-view/index.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -27
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js +0 -34
- package/lib/core/schema-view/view.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js +2 -2
- package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +0 -7
- package/lib/feature-libraries/default-schema/schemaChecker.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 +2 -2
- package/lib/feature-libraries/forest-summary/format.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts +3 -3
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js +2 -2
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -6
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +34 -5
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +61 -9
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/{dist/feature-libraries/schema-index/format.d.ts → lib/feature-libraries/schema-index/formatV1.d.ts} +9 -9
- package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/schema-index/{format.js → formatV1.js} +5 -5
- package/lib/feature-libraries/schema-index/formatV1.js.map +1 -0
- package/lib/feature-libraries/schema-index/index.d.ts +2 -2
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +2 -2
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +5 -5
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- 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/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +2 -2
- package/lib/shared-tree/independentView.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/schematizeTree.d.ts +9 -10
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +11 -35
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +5 -7
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +28 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +29 -4
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/tree.d.ts +24 -0
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +2 -0
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +4 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +0 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +0 -1
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/transactionEnricher.d.ts +1 -1
- package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/transactionEnricher.js +4 -1
- package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +9 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +7 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +8 -7
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +17 -11
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +25 -0
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +4 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +83 -0
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
- package/lib/simple-tree/api/treeChangeEvents.js +6 -0
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts +2 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +28 -0
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +2 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +94 -0
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -0
- package/lib/simple-tree/core/treeNode.js +118 -0
- package/lib/simple-tree/core/treeNode.js.map +1 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -1
- 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/types.d.ts +0 -165
- package/lib/simple-tree/core/types.d.ts.map +1 -1
- package/lib/simple-tree/core/types.js +0 -110
- package/lib/simple-tree/core/types.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +1 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.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 +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +1 -0
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +8 -8
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +26 -31
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +309 -91
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +319 -78
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +30 -75
- package/lib/treeFactory.js.map +1 -1
- package/package.json +21 -21
- package/src/codec/codec.ts +6 -1
- package/src/codec/index.ts +1 -0
- package/src/core/index.ts +1 -2
- package/src/core/schema-stored/index.ts +3 -3
- package/src/core/schema-stored/schema.ts +3 -1
- package/src/core/schema-stored/storedSchemaRepository.ts +1 -1
- package/src/core/schema-view/index.ts +0 -1
- package/src/core/schema-view/view.ts +0 -31
- package/src/core/tree/persistedTreeTextFormat.ts +2 -2
- package/src/feature-libraries/default-schema/schemaChecker.ts +0 -8
- package/src/feature-libraries/forest-summary/format.ts +2 -2
- package/src/feature-libraries/index.ts +7 -1
- package/src/feature-libraries/mapTreeCursor.ts +3 -3
- package/src/feature-libraries/modular-schema/modularChangeFormat.ts +3 -3
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +38 -9
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -4
- package/src/feature-libraries/schema-index/codec.ts +80 -12
- package/src/feature-libraries/schema-index/{format.ts → formatV1.ts} +4 -4
- package/src/feature-libraries/schema-index/index.ts +7 -2
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +9 -9
- package/src/index.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +3 -2
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizeTree.ts +6 -36
- package/src/shared-tree/schematizingTreeView.ts +5 -12
- package/src/shared-tree/sharedTree.ts +67 -6
- package/src/shared-tree/tree.ts +24 -0
- package/src/shared-tree/treeAlpha.ts +6 -3
- package/src/shared-tree-core/branchCommitEnricher.ts +0 -1
- package/src/shared-tree-core/transactionEnricher.ts +4 -1
- package/src/simple-tree/api/index.ts +2 -0
- package/src/simple-tree/api/schemaFactory.ts +9 -0
- package/src/simple-tree/api/storedSchema.ts +24 -13
- package/src/simple-tree/api/tree.ts +25 -0
- package/src/simple-tree/api/treeBeta.ts +3 -1
- package/src/simple-tree/api/treeChangeEvents.ts +84 -0
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/arrayNode.ts +28 -0
- package/src/simple-tree/core/getOrCreateNode.ts +1 -1
- package/src/simple-tree/core/index.ts +5 -4
- package/src/simple-tree/core/treeNode.ts +163 -0
- package/src/simple-tree/core/treeNodeKernel.ts +2 -1
- package/src/simple-tree/core/treeNodeSchema.ts +3 -1
- package/src/simple-tree/core/types.ts +0 -234
- package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
- package/src/simple-tree/core/withType.ts +1 -1
- package/src/simple-tree/index.ts +2 -1
- package/src/simple-tree/schemaTypes.ts +1 -0
- package/src/simple-tree/toStoredSchema.ts +42 -41
- package/src/tableSchema.ts +713 -259
- package/src/treeFactory.ts +56 -173
- package/dist/core/schema-stored/format.d.ts.map +0 -1
- package/dist/core/schema-stored/format.js.map +0 -1
- package/dist/feature-libraries/schema-index/format.d.ts.map +0 -1
- package/dist/feature-libraries/schema-index/format.js.map +0 -1
- package/lib/core/schema-stored/format.d.ts.map +0 -1
- package/lib/core/schema-stored/format.js.map +0 -1
- package/lib/feature-libraries/schema-index/format.d.ts.map +0 -1
- package/lib/feature-libraries/schema-index/format.js.map +0 -1
- /package/src/core/schema-stored/{format.ts → formatV1.ts} +0 -0
package/lib/tableSchema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableSchema.d.ts","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"tableSchema.d.ts","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAEzB,KAAK,0CAA0C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AM,SAAS,MAAM,GAAG,SAAS,EACvC,KAAK,CAAC,KAAK,SAAS,oBAAoB,EACxC,KAAK,CAAC,OAAO,SAAS,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAEjE,MAAM,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG;QACvF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;KACzB,GACC,kBAAkB,CAAC,eAAe,CACpC,MAAM,EACN,KAAK,EACL,OAAO,EACP,kBAAkB,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CACpF,CAAC;IACF;;;OAGG;IACH,SAAgB,KAAK,CACpB,KAAK,CAAC,MAAM,SAAS,MAAM,GAAG,SAAS,EACvC,KAAK,CAAC,KAAK,SAAS,oBAAoB,EACxC,KAAK,CAAC,OAAO,SAAS,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EACjE,KAAK,CAAC,IAAI,SAAS,kBAAkB,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,EAElE,MAAM,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG;QACvF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;KACnB,GACC,kBAAkB,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;CA2BpE"}
|
package/lib/tableSchema.js
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
6
7
|
import { Tree } from "./shared-tree/index.js";
|
|
7
8
|
import { TreeArrayNode, SchemaFactory, } from "./simple-tree/index.js";
|
|
8
|
-
// Future improvement TODOs
|
|
9
|
+
// Future improvement TODOs:
|
|
10
|
+
// - Omit `cells` property from Row insertion type.
|
|
9
11
|
// - Record-like type parameters / input parameters?
|
|
10
12
|
// - Omit `props` properties from Row and Column schemas when not provided?
|
|
13
|
+
// Longer-term work:
|
|
14
|
+
// - Add constraint APIs to make it possible to avoid situations that could yield "orphaned" cells.
|
|
15
|
+
/**
|
|
16
|
+
* The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
|
|
17
|
+
*/
|
|
11
18
|
const tableSchemaFactorySubScope = "table";
|
|
12
19
|
/**
|
|
13
20
|
* Not intended for use outside of this package.
|
|
@@ -22,11 +29,11 @@ const tableSchemaFactorySubScope = "table";
|
|
|
22
29
|
export var System_TableSchema;
|
|
23
30
|
(function (System_TableSchema) {
|
|
24
31
|
/**
|
|
25
|
-
* Factory for creating
|
|
32
|
+
* Factory for creating column schema.
|
|
26
33
|
* @system @internal
|
|
27
34
|
*/
|
|
28
35
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
29
|
-
function
|
|
36
|
+
function createColumnSchema(inputSchemaFactory, propsSchema) {
|
|
30
37
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
31
38
|
// Note: `columnFields` is broken into two parts to work around a TypeScript bug
|
|
32
39
|
// that results in broken `.d.ts` output.
|
|
@@ -68,14 +75,13 @@ export var System_TableSchema;
|
|
|
68
75
|
const ColumnSchemaType = Column;
|
|
69
76
|
return ColumnSchemaType;
|
|
70
77
|
}
|
|
71
|
-
System_TableSchema.
|
|
78
|
+
System_TableSchema.createColumnSchema = createColumnSchema;
|
|
72
79
|
/**
|
|
73
|
-
* Factory for creating
|
|
74
|
-
*
|
|
80
|
+
* Factory for creating row schema.
|
|
75
81
|
* @sealed @internal
|
|
76
82
|
*/
|
|
77
83
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
78
|
-
function
|
|
84
|
+
function createRowSchema(inputSchemaFactory, cellSchema, propsSchema) {
|
|
79
85
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
80
86
|
// Note: `rowFields` is broken into two parts to work around a TypeScript bug
|
|
81
87
|
// that results in broken `.d.ts` output.
|
|
@@ -115,15 +121,19 @@ export var System_TableSchema;
|
|
|
115
121
|
return this.cells.get(columnId);
|
|
116
122
|
}
|
|
117
123
|
setCell(columnOrId, value) {
|
|
124
|
+
// TODO: throw if column does not exist in the owning table.
|
|
118
125
|
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
119
126
|
this.cells.set(columnId, value);
|
|
120
127
|
}
|
|
121
128
|
removeCell(columnOrId) {
|
|
129
|
+
// TODO: throw if column does not exist in the owning table.
|
|
122
130
|
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
const cell = this.cells.get(columnId);
|
|
132
|
+
if (cell === undefined) {
|
|
133
|
+
return undefined;
|
|
125
134
|
}
|
|
126
135
|
this.cells.delete(columnId);
|
|
136
|
+
return cell;
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
@@ -134,13 +144,13 @@ export var System_TableSchema;
|
|
|
134
144
|
const RowSchemaType = Row;
|
|
135
145
|
return RowSchemaType;
|
|
136
146
|
}
|
|
137
|
-
System_TableSchema.
|
|
147
|
+
System_TableSchema.createRowSchema = createRowSchema;
|
|
138
148
|
/**
|
|
139
|
-
* Factory for creating
|
|
149
|
+
* Factory for creating table schema.
|
|
140
150
|
* @system @internal
|
|
141
151
|
*/
|
|
142
152
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
143
|
-
function
|
|
153
|
+
function createTableSchema(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
|
|
144
154
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
145
155
|
/**
|
|
146
156
|
* {@link Table} fields.
|
|
@@ -169,98 +179,245 @@ export var System_TableSchema;
|
|
|
169
179
|
return this.rows.find((_row) => _row.id === id);
|
|
170
180
|
}
|
|
171
181
|
getCell(key) {
|
|
172
|
-
const {
|
|
173
|
-
const row = this.
|
|
174
|
-
if (row
|
|
175
|
-
|
|
176
|
-
if (column !== undefined) {
|
|
177
|
-
return row.getCell(column.id);
|
|
178
|
-
}
|
|
182
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
183
|
+
const row = this._getRow(rowOrId);
|
|
184
|
+
if (row === undefined) {
|
|
185
|
+
return undefined;
|
|
179
186
|
}
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
const column = this._getColumn(columnOrId);
|
|
188
|
+
if (column === undefined) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
return row.getCell(column);
|
|
182
192
|
}
|
|
183
193
|
insertColumn({ column, index, }) {
|
|
184
|
-
|
|
185
|
-
|
|
194
|
+
const inserted = this.insertColumns({
|
|
195
|
+
columns: [column],
|
|
196
|
+
index,
|
|
197
|
+
});
|
|
198
|
+
return inserted[0] ?? oob();
|
|
199
|
+
}
|
|
200
|
+
insertColumns({ columns, index, }) {
|
|
201
|
+
// #region Input validation
|
|
202
|
+
// Ensure index is valid
|
|
203
|
+
if (index !== undefined) {
|
|
204
|
+
Table.validateInsertionIndex(index, this.columns);
|
|
205
|
+
}
|
|
206
|
+
// Check all of the columns being inserted an ensure the table does not already contain any with the same ID.
|
|
207
|
+
for (const column of columns) {
|
|
208
|
+
// TypeScript is unable to narrow the type of the column type correctly here, hence the casts below.
|
|
186
209
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
210
|
+
const maybeId = column.id;
|
|
211
|
+
if (maybeId !== undefined && this.containsColumnWithId(maybeId)) {
|
|
212
|
+
throw new UsageError(`A column with ID "${column.id}" already exists in the table.`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// #endregion
|
|
216
|
+
// TypeScript is unable to narrow the column type correctly here, hence the casts below.
|
|
217
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
218
|
+
if (index === undefined) {
|
|
187
219
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
|
-
this.columns.insertAtEnd(
|
|
220
|
+
this.columns.insertAtEnd(TreeArrayNode.spread(columns));
|
|
189
221
|
}
|
|
190
222
|
else {
|
|
191
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
192
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
193
223
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
|
-
this.columns.insertAt(index,
|
|
224
|
+
this.columns.insertAt(index, TreeArrayNode.spread(columns));
|
|
195
225
|
}
|
|
196
|
-
// Inserting the input
|
|
197
|
-
return
|
|
226
|
+
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
227
|
+
return columns;
|
|
228
|
+
}
|
|
229
|
+
insertRow({ row, index, }) {
|
|
230
|
+
const inserted = this.insertRows({
|
|
231
|
+
rows: [row],
|
|
232
|
+
index,
|
|
233
|
+
});
|
|
234
|
+
return inserted[0] ?? oob();
|
|
198
235
|
}
|
|
199
236
|
insertRows({ index, rows, }) {
|
|
237
|
+
// #region Input validation
|
|
238
|
+
// Ensure index is valid
|
|
239
|
+
if (index !== undefined) {
|
|
240
|
+
Table.validateInsertionIndex(index, this.rows);
|
|
241
|
+
}
|
|
242
|
+
// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
|
|
243
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
244
|
+
for (const newRow of rows) {
|
|
245
|
+
// Check all of the rows being inserted an ensure the table does not already contain any with the same ID.
|
|
246
|
+
const maybeId = newRow.id;
|
|
247
|
+
if (maybeId !== undefined && this.containsRowWithId(maybeId)) {
|
|
248
|
+
throw new UsageError(`A row with ID "${newRow.id}" already exists in the table.`);
|
|
249
|
+
}
|
|
250
|
+
// If the row contains cells, verify that the table contains the columns for those cells.
|
|
251
|
+
// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
253
|
+
if (newRow.cells !== undefined) {
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
+
const keys = Object.keys(newRow.cells);
|
|
256
|
+
for (const key of keys) {
|
|
257
|
+
if (!this.containsColumnWithId(key)) {
|
|
258
|
+
throw new UsageError(`Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// #endregion
|
|
264
|
+
// TypeScript is unable to narrow the row type correctly here, hence the casts below.
|
|
265
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
200
266
|
if (index === undefined) {
|
|
201
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
202
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
203
267
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
268
|
this.rows.insertAtEnd(TreeArrayNode.spread(rows));
|
|
205
269
|
}
|
|
206
270
|
else {
|
|
207
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
208
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
209
271
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
210
272
|
this.rows.insertAt(index, TreeArrayNode.spread(rows));
|
|
211
273
|
}
|
|
212
274
|
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
213
275
|
return rows;
|
|
214
276
|
}
|
|
215
|
-
setCell({ key, cell }) {
|
|
216
|
-
const {
|
|
217
|
-
const row = this.
|
|
218
|
-
if (row
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
277
|
+
setCell({ key, cell, }) {
|
|
278
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
279
|
+
const row = this._getRow(rowOrId);
|
|
280
|
+
if (row === undefined) {
|
|
281
|
+
const rowId = this._getRowId(rowOrId);
|
|
282
|
+
throw new UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
283
|
+
}
|
|
284
|
+
const column = this._getColumn(columnOrId);
|
|
285
|
+
if (column === undefined) {
|
|
286
|
+
const columnId = this._getColumnId(columnOrId);
|
|
287
|
+
throw new UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
223
288
|
}
|
|
289
|
+
row.setCell(column, cell);
|
|
224
290
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
291
|
+
removeColumns(columns) {
|
|
292
|
+
// If there are no columns to remove, do nothing
|
|
293
|
+
if (columns.length === 0) {
|
|
294
|
+
return [];
|
|
295
|
+
}
|
|
296
|
+
// If there is only one column to remove, remove it (and don't incur cost of transaction)
|
|
297
|
+
if (columns.length === 1) {
|
|
298
|
+
const removedColumn = this.removeColumn(columns[0] ?? oob());
|
|
299
|
+
return [removedColumn];
|
|
300
|
+
}
|
|
301
|
+
// If there are multiple columns to remove, remove them in a transaction.
|
|
302
|
+
const removedColumns = [];
|
|
303
|
+
Tree.runTransaction(this, () => {
|
|
304
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
305
|
+
// So if we throw an error here for any row, no columns will be removed.
|
|
306
|
+
for (const columnToRemove of columns) {
|
|
307
|
+
const removedRow = this.removeColumn(columnToRemove);
|
|
308
|
+
removedColumns.push(removedRow);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
return removedColumns;
|
|
312
|
+
}
|
|
313
|
+
removeColumn(columnOrId) {
|
|
314
|
+
const column = this._getColumn(columnOrId);
|
|
315
|
+
const index = column === undefined ? -1 : this.columns.indexOf(column);
|
|
316
|
+
if (index === -1) {
|
|
317
|
+
const columnId = this._getColumnId(columnOrId);
|
|
318
|
+
throw new UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
319
|
+
}
|
|
230
320
|
this.columns.removeAt(index);
|
|
321
|
+
return column;
|
|
322
|
+
}
|
|
323
|
+
removeAllColumns() {
|
|
324
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
325
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
326
|
+
return this.removeColumns(this.columns);
|
|
231
327
|
}
|
|
232
328
|
removeRows(rows) {
|
|
233
329
|
// If there are no rows to remove, do nothing
|
|
234
330
|
if (rows.length === 0) {
|
|
235
|
-
return;
|
|
331
|
+
return [];
|
|
236
332
|
}
|
|
237
|
-
// If there is only one row to remove, remove it
|
|
333
|
+
// If there is only one row to remove, remove it (and don't incur cost of transaction)
|
|
238
334
|
if (rows.length === 1) {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
return;
|
|
335
|
+
const removedRow = this.removeRow(rows[0] ?? oob());
|
|
336
|
+
return [removedRow];
|
|
242
337
|
}
|
|
243
|
-
// If there are multiple rows to remove, remove them in a transaction
|
|
244
|
-
|
|
338
|
+
// If there are multiple rows to remove, remove them in a transaction.
|
|
339
|
+
const removedRows = [];
|
|
245
340
|
Tree.runTransaction(this, () => {
|
|
246
|
-
//
|
|
247
|
-
for
|
|
248
|
-
|
|
249
|
-
this.
|
|
341
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
342
|
+
// So if we throw an error here for any row, no rows will be removed.
|
|
343
|
+
for (const rowToRemove of rows) {
|
|
344
|
+
const removedRow = this.removeRow(rowToRemove);
|
|
345
|
+
removedRows.push(removedRow);
|
|
250
346
|
}
|
|
251
347
|
});
|
|
348
|
+
return removedRows;
|
|
349
|
+
}
|
|
350
|
+
removeRow(rowOrId) {
|
|
351
|
+
const rowToRemove = this._getRow(rowOrId);
|
|
352
|
+
const index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);
|
|
353
|
+
// If the row does not exist in the table, throw an error.
|
|
354
|
+
if (index === -1) {
|
|
355
|
+
const rowId = this._getRowId(rowOrId);
|
|
356
|
+
throw new UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
357
|
+
}
|
|
358
|
+
this.rows.removeAt(index);
|
|
359
|
+
return rowToRemove;
|
|
252
360
|
}
|
|
253
361
|
removeAllRows() {
|
|
254
|
-
|
|
362
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
363
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
364
|
+
return this.removeRows(this.rows);
|
|
255
365
|
}
|
|
256
366
|
removeCell(key) {
|
|
257
|
-
const {
|
|
258
|
-
const row = this.
|
|
259
|
-
if (row
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
367
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
368
|
+
const row = this._getRow(rowOrId);
|
|
369
|
+
if (row === undefined) {
|
|
370
|
+
const rowId = this._getRowId(rowOrId);
|
|
371
|
+
throw new UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
372
|
+
}
|
|
373
|
+
const column = this._getColumn(columnOrId);
|
|
374
|
+
if (column === undefined) {
|
|
375
|
+
const columnId = this._getColumnId(columnOrId);
|
|
376
|
+
throw new UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
377
|
+
}
|
|
378
|
+
const cell = row.getCell(column.id);
|
|
379
|
+
if (cell === undefined) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
row.removeCell(column.id);
|
|
383
|
+
return cell;
|
|
384
|
+
}
|
|
385
|
+
_getColumn(columnOrId) {
|
|
386
|
+
return typeof columnOrId === "string" ? this.getColumn(columnOrId) : columnOrId;
|
|
387
|
+
}
|
|
388
|
+
_getColumnId(columnOrId) {
|
|
389
|
+
return typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
390
|
+
}
|
|
391
|
+
_getRow(rowOrId) {
|
|
392
|
+
return typeof rowOrId === "string" ? this.getRow(rowOrId) : rowOrId;
|
|
393
|
+
}
|
|
394
|
+
_getRowId(rowOrId) {
|
|
395
|
+
return typeof rowOrId === "string" ? rowOrId : rowOrId.id;
|
|
396
|
+
}
|
|
397
|
+
containsColumnWithId(columnId) {
|
|
398
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
399
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
400
|
+
return (this.columns.find((column) => column.id === columnId) !==
|
|
401
|
+
undefined);
|
|
402
|
+
}
|
|
403
|
+
containsRowWithId(rowId) {
|
|
404
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
405
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
406
|
+
return this.rows.find((row) => row.id === rowId) !== undefined;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Ensure that the specified index is a valid location for item insertion in the destination list.
|
|
410
|
+
* @throws Throws a usage error if the destination is invalid.
|
|
411
|
+
*/
|
|
412
|
+
static validateInsertionIndex(index, destinationList) {
|
|
413
|
+
if (index < 0) {
|
|
414
|
+
throw new UsageError("The index must be greater than or equal to 0.");
|
|
415
|
+
}
|
|
416
|
+
if (index > destinationList.length) {
|
|
417
|
+
throw new UsageError("The index specified for insertion is out of bounds.");
|
|
418
|
+
}
|
|
419
|
+
if (!Number.isInteger(index)) {
|
|
420
|
+
throw new UsageError("The index must be an integer.");
|
|
264
421
|
}
|
|
265
422
|
}
|
|
266
423
|
}
|
|
@@ -273,12 +430,96 @@ export var System_TableSchema;
|
|
|
273
430
|
// Return the table schema
|
|
274
431
|
return TableSchemaType;
|
|
275
432
|
}
|
|
276
|
-
System_TableSchema.
|
|
433
|
+
System_TableSchema.createTableSchema = createTableSchema;
|
|
277
434
|
// #endregion
|
|
278
435
|
})(System_TableSchema || (System_TableSchema = {}));
|
|
279
436
|
/**
|
|
280
437
|
* Contains types and factories for creating schema to represent dynamic tabular data.
|
|
281
|
-
*
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
*
|
|
441
|
+
* Tables created using these APIs are...
|
|
442
|
+
*
|
|
443
|
+
* - sparse, meaning that cells may be omitted, and new rows are empty by default.
|
|
444
|
+
*
|
|
445
|
+
* - dynamic, meaning that their structure can be modified at runtime.
|
|
446
|
+
* Columns and rows can be inserted, removed, modified, and reordered.
|
|
447
|
+
* Cells can be inserted, removed, and modified.
|
|
448
|
+
*
|
|
449
|
+
* - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.
|
|
450
|
+
*
|
|
451
|
+
* Column and Row schema created using these APIs are extensible via the `props` field.
|
|
452
|
+
* This allows association of additional properties with column and row nodes.
|
|
453
|
+
*
|
|
454
|
+
* Note: for now it is possible for table cells to become "orphaned".
|
|
455
|
+
* That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.
|
|
456
|
+
* To help avoid this situation, you can manually remove corresponding cells when removing columns.
|
|
457
|
+
* Either way, it is possible to enter such a state via the merging of edits.
|
|
458
|
+
* For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.
|
|
459
|
+
*
|
|
460
|
+
* @example Using default Column and Row schema
|
|
461
|
+
*
|
|
462
|
+
* ```typescript
|
|
463
|
+
* class Cell extends schemaFactory.object("TableCell", {
|
|
464
|
+
* value: schemaFactory.string,
|
|
465
|
+
* }) {}
|
|
466
|
+
*
|
|
467
|
+
* class Table extends TableSchema.table({
|
|
468
|
+
* schemaFactory,
|
|
469
|
+
* cell: Cell,
|
|
470
|
+
* }) {}
|
|
471
|
+
*
|
|
472
|
+
* const table = new Table({
|
|
473
|
+
* columns: [{ id: "column-0" }],
|
|
474
|
+
* rows: [{ id: "row-0", cells: {} }],
|
|
475
|
+
* });
|
|
476
|
+
* ```
|
|
477
|
+
*
|
|
478
|
+
* @example Customizing Column and Row schema
|
|
479
|
+
*
|
|
480
|
+
* ```typescript
|
|
481
|
+
* class Cell extends schemaFactory.object("TableCell", {
|
|
482
|
+
* value: schemaFactory.string,
|
|
483
|
+
* }) {}
|
|
484
|
+
*
|
|
485
|
+
* class ColumnProps extends schemaFactory.object("TableColumnProps", {
|
|
486
|
+
* // Column label to display.
|
|
487
|
+
* label: schemaFactory.string,
|
|
488
|
+
* // The type of data represented by the cells. Default: string.
|
|
489
|
+
* dataType: schemaFactory.optional(schemaFactory.string),
|
|
490
|
+
* }) {}
|
|
491
|
+
*
|
|
492
|
+
* class Column extends TableSchema.column({
|
|
493
|
+
* schemaFactory,
|
|
494
|
+
* props: ColumnProps,
|
|
495
|
+
* }) {}
|
|
496
|
+
*
|
|
497
|
+
* class Row extends TableSchema.row({
|
|
498
|
+
* schemaFactory,
|
|
499
|
+
* cell: Cell,
|
|
500
|
+
* }) {}
|
|
501
|
+
*
|
|
502
|
+
* class Table extends TableSchema.table({
|
|
503
|
+
* schemaFactory,
|
|
504
|
+
* cell: Cell,
|
|
505
|
+
* column: Column,
|
|
506
|
+
* row: Row,
|
|
507
|
+
* }) {}
|
|
508
|
+
*
|
|
509
|
+
* const table = new Table({
|
|
510
|
+
* columns: [
|
|
511
|
+
* new Column({ props: { label: "Entry", dataType: "string" } }),
|
|
512
|
+
* new Column({ props: { label: "Date", dataType: "date" } }),
|
|
513
|
+
* new Column({ props: { label: "Amount", dataType: "number" } }),
|
|
514
|
+
* ],
|
|
515
|
+
* rows: [],
|
|
516
|
+
* });
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* @privateRemarks
|
|
520
|
+
* The above examples are backed by tests in `tableSchema.spec.ts`.
|
|
521
|
+
* Those tests and these examples should be kept in-sync to ensure that the examples are correct.
|
|
522
|
+
*
|
|
282
523
|
* @internal
|
|
283
524
|
*/
|
|
284
525
|
export var TableSchema;
|
|
@@ -287,29 +528,29 @@ export var TableSchema;
|
|
|
287
528
|
/**
|
|
288
529
|
* Overload implementation
|
|
289
530
|
*/
|
|
290
|
-
function
|
|
291
|
-
return System_TableSchema.
|
|
531
|
+
function column({ schemaFactory, props = SchemaFactory.optional(SchemaFactory.null), }) {
|
|
532
|
+
return System_TableSchema.createColumnSchema(schemaFactory, props);
|
|
292
533
|
}
|
|
293
|
-
TableSchema.
|
|
534
|
+
TableSchema.column = column;
|
|
294
535
|
/**
|
|
295
536
|
* Overload implementation
|
|
296
537
|
*/
|
|
297
|
-
function
|
|
298
|
-
return System_TableSchema.
|
|
538
|
+
function row({ schemaFactory, cell, props = SchemaFactory.optional(SchemaFactory.null), }) {
|
|
539
|
+
return System_TableSchema.createRowSchema(schemaFactory, cell, props);
|
|
299
540
|
}
|
|
300
|
-
TableSchema.
|
|
541
|
+
TableSchema.row = row;
|
|
301
542
|
/**
|
|
302
543
|
* Overload implementation
|
|
303
544
|
*/
|
|
304
|
-
function
|
|
545
|
+
function table({ schemaFactory, cell: cellSchema, column: columnSchema = column({
|
|
305
546
|
schemaFactory,
|
|
306
|
-
}), row =
|
|
547
|
+
}), row: rowSchema = row({
|
|
307
548
|
schemaFactory,
|
|
308
|
-
cell,
|
|
549
|
+
cell: cellSchema,
|
|
309
550
|
}), }) {
|
|
310
|
-
return System_TableSchema.
|
|
551
|
+
return System_TableSchema.createTableSchema(schemaFactory, cellSchema, columnSchema, rowSchema);
|
|
311
552
|
}
|
|
312
|
-
TableSchema.
|
|
553
|
+
TableSchema.table = table;
|
|
313
554
|
// #endregion
|
|
314
555
|
})(TableSchema || (TableSchema = {}));
|
|
315
556
|
//# sourceMappingURL=tableSchema.js.map
|