@fluidframework/tree 2.33.2 → 2.40.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/.vscode/settings.json +2 -0
- package/CHANGELOG.md +64 -0
- package/api-report/tree.alpha.api.md +124 -51
- package/api-report/tree.beta.api.md +31 -27
- package/api-report/tree.legacy.alpha.api.md +24 -23
- package/api-report/tree.legacy.public.api.md +24 -23
- package/api-report/tree.public.api.md +24 -23
- package/dist/alpha.d.ts +17 -1
- package/dist/beta.d.ts +2 -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/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 +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +0 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +2 -2
- package/dist/jsonDomainSchema.js +2 -2
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/serializableDomainSchema.d.ts +3 -3
- package/dist/serializableDomainSchema.js +2 -2
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +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 +4 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -5
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +10 -11
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +11 -36
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +3 -3
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +4 -7
- 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/{treeApi.d.ts → tree.d.ts} +58 -34
- package/dist/shared-tree/tree.d.ts.map +1 -0
- package/dist/shared-tree/{treeApi.js → tree.js} +6 -6
- package/dist/shared-tree/tree.js.map +1 -0
- package/{lib/shared-tree/treeApiAlpha.d.ts → dist/shared-tree/treeAlpha.d.ts} +24 -14
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -0
- package/dist/shared-tree/{treeApiAlpha.js → treeAlpha.js} +7 -5
- package/dist/shared-tree/treeAlpha.js.map +1 -0
- 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/conciseTree.d.ts +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +177 -0
- package/dist/simple-tree/api/configuration.d.ts.map +1 -0
- package/dist/simple-tree/api/configuration.js +163 -0
- package/dist/simple-tree/api/configuration.js.map +1 -0
- package/dist/simple-tree/api/getJsonSchema.js +2 -2
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +9 -5
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +9 -7
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/{view.d.ts → schemaCompatibilityTester.d.ts} +8 -10
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -0
- package/dist/simple-tree/api/{view.js → schemaCompatibilityTester.js} +9 -9
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -0
- package/dist/simple-tree/api/schemaFactory.d.ts +25 -10
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +27 -12
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +12 -6
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +67 -4
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +11 -10
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +16 -11
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +30 -174
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +1 -156
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/{lib/simple-tree/api/treeApiBeta.d.ts → dist/simple-tree/api/treeBeta.d.ts} +17 -6
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/{treeApiBeta.js → treeBeta.js} +5 -4
- package/dist/simple-tree/api/treeBeta.js.map +1 -0
- 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/api/typesUnsafe.d.ts +4 -9
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +30 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +3 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.d.ts +3 -3
- package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.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/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 +4 -4
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +1 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/mapNodeTypes.d.ts +3 -3
- package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +18 -5
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +4 -3
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +4 -4
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +164 -13
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +107 -8
- 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/simple-tree/treeNodeValid.js +2 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/tableSchema.d.ts +455 -125
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +398 -101
- 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/dist/util/typeUtils.d.ts +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/lib/alpha.d.ts +17 -1
- package/lib/beta.d.ts +2 -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/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 +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +0 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +2 -2
- package/lib/jsonDomainSchema.js +2 -2
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/serializableDomainSchema.d.ts +3 -3
- package/lib/serializableDomainSchema.js +2 -2
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +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 +4 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +3 -3
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +10 -11
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +12 -37
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +3 -3
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +6 -9
- 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/{treeApi.d.ts → tree.d.ts} +58 -34
- package/lib/shared-tree/tree.d.ts.map +1 -0
- package/lib/shared-tree/{treeApi.js → tree.js} +5 -5
- package/lib/shared-tree/tree.js.map +1 -0
- package/{dist/shared-tree/treeApiAlpha.d.ts → lib/shared-tree/treeAlpha.d.ts} +24 -14
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -0
- package/lib/shared-tree/{treeApiAlpha.js → treeAlpha.js} +8 -6
- package/lib/shared-tree/treeAlpha.js.map +1 -0
- 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/conciseTree.d.ts +1 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +177 -0
- package/lib/simple-tree/api/configuration.d.ts.map +1 -0
- package/lib/simple-tree/api/configuration.js +157 -0
- package/lib/simple-tree/api/configuration.js.map +1 -0
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +9 -5
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +5 -4
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/{view.d.ts → schemaCompatibilityTester.d.ts} +8 -10
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -0
- package/lib/simple-tree/api/{view.js → schemaCompatibilityTester.js} +7 -7
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -0
- package/lib/simple-tree/api/schemaFactory.d.ts +25 -10
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +27 -12
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +12 -6
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +67 -4
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +11 -10
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +20 -13
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +30 -174
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +0 -152
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/{dist/simple-tree/api/treeApiBeta.d.ts → lib/simple-tree/api/treeBeta.d.ts} +17 -6
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/{treeApiBeta.js → treeBeta.js} +5 -4
- package/lib/simple-tree/api/treeBeta.js.map +1 -0
- 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/api/typesUnsafe.d.ts +4 -9
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +30 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +4 -3
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.d.ts +3 -3
- package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.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/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 +4 -4
- 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/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -2
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/mapNodeTypes.d.ts +3 -3
- package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +18 -5
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +5 -4
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +4 -4
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +164 -13
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +96 -8
- 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/simple-tree/treeNodeValid.js +2 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/tableSchema.d.ts +455 -125
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +398 -101
- 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/lib/util/typeUtils.d.ts +1 -1
- package/lib/util/typeUtils.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/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 +18 -1
- package/src/internalTypes.ts +0 -2
- package/src/jsonDomainSchema.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +3 -3
- package/src/shared-tree/independentView.ts +4 -3
- package/src/shared-tree/index.ts +5 -6
- package/src/shared-tree/schematizeTree.ts +10 -40
- package/src/shared-tree/schematizingTreeView.ts +12 -17
- package/src/shared-tree/sharedTree.ts +67 -6
- package/src/shared-tree/{treeApi.ts → tree.ts} +75 -51
- package/src/shared-tree/{treeApiAlpha.ts → treeAlpha.ts} +28 -16
- package/src/shared-tree-core/branchCommitEnricher.ts +0 -1
- package/src/shared-tree-core/transactionEnricher.ts +4 -1
- package/src/simple-tree/api/conciseTree.ts +1 -1
- package/src/simple-tree/api/configuration.ts +353 -0
- package/src/simple-tree/api/getJsonSchema.ts +1 -1
- package/src/simple-tree/api/index.ts +23 -15
- package/src/simple-tree/api/{view.ts → schemaCompatibilityTester.ts} +8 -15
- package/src/simple-tree/api/schemaFactory.ts +139 -19
- package/src/simple-tree/api/schemaFactoryAlpha.ts +7 -5
- package/src/simple-tree/api/schemaFactoryRecursive.ts +102 -38
- package/src/simple-tree/api/schemaFromSimple.ts +2 -2
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
- package/src/simple-tree/api/storedSchema.ts +32 -17
- package/src/simple-tree/api/tree.ts +38 -354
- package/src/simple-tree/api/{treeApiBeta.ts → treeBeta.ts} +20 -6
- package/src/simple-tree/api/treeChangeEvents.ts +84 -0
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/api/typesUnsafe.ts +15 -11
- package/src/simple-tree/arrayNode.ts +38 -5
- package/src/simple-tree/arrayNodeTypes.ts +8 -7
- 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/withType.ts +1 -1
- package/src/simple-tree/index.ts +19 -2
- package/src/simple-tree/mapNode.ts +11 -3
- package/src/simple-tree/mapNodeTypes.ts +10 -7
- package/src/simple-tree/objectNode.ts +39 -15
- package/src/simple-tree/objectNodeTypes.ts +9 -5
- package/src/simple-tree/schemaTypes.ts +354 -25
- package/src/simple-tree/toStoredSchema.ts +42 -41
- package/src/simple-tree/treeNodeValid.ts +2 -2
- package/src/tableSchema.ts +1206 -434
- package/src/treeFactory.ts +56 -173
- package/src/util/typeUtils.ts +1 -1
- 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/dist/shared-tree/treeApi.d.ts.map +0 -1
- package/dist/shared-tree/treeApi.js.map +0 -1
- package/dist/shared-tree/treeApiAlpha.d.ts.map +0 -1
- package/dist/shared-tree/treeApiAlpha.js.map +0 -1
- package/dist/simple-tree/api/treeApiBeta.d.ts.map +0 -1
- package/dist/simple-tree/api/treeApiBeta.js.map +0 -1
- package/dist/simple-tree/api/view.d.ts.map +0 -1
- package/dist/simple-tree/api/view.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/lib/shared-tree/treeApi.d.ts.map +0 -1
- package/lib/shared-tree/treeApi.js.map +0 -1
- package/lib/shared-tree/treeApiAlpha.d.ts.map +0 -1
- package/lib/shared-tree/treeApiAlpha.js.map +0 -1
- package/lib/simple-tree/api/treeApiBeta.d.ts.map +0 -1
- package/lib/simple-tree/api/treeApiBeta.js.map +0 -1
- package/lib/simple-tree/api/view.d.ts.map +0 -1
- package/lib/simple-tree/api/view.js.map +0 -1
- /package/src/core/schema-stored/{format.ts → formatV1.ts} +0 -0
package/dist/tableSchema.js
CHANGED
|
@@ -4,51 +4,71 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TableSchema = void 0;
|
|
7
|
+
exports.TableSchema = exports.System_TableSchema = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
9
10
|
const index_js_1 = require("./shared-tree/index.js");
|
|
10
11
|
const index_js_2 = require("./simple-tree/index.js");
|
|
11
|
-
// Future improvement TODOs
|
|
12
|
-
// -
|
|
13
|
-
// - Overloads to make Column/Row schema optional when constructing Tables
|
|
12
|
+
// Future improvement TODOs:
|
|
13
|
+
// - Omit `cells` property from Row insertion type.
|
|
14
14
|
// - Record-like type parameters / input parameters?
|
|
15
|
-
// -
|
|
15
|
+
// - Omit `props` properties from Row and Column schemas when not provided?
|
|
16
|
+
// Longer-term work:
|
|
17
|
+
// - Add constraint APIs to make it possible to avoid situations that could yield "orphaned" cells.
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @privateRemarks TODO: document in more detail and add `@example`s.
|
|
19
|
-
* @internal
|
|
19
|
+
* The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const tableSchemaFactorySubScope = "table";
|
|
22
|
+
/**
|
|
23
|
+
* Not intended for use outside of this package.
|
|
24
|
+
*
|
|
25
|
+
* @privateRemarks
|
|
26
|
+
* This namespace is a collection of internal system types relate to {@link TableSchema}.
|
|
27
|
+
* This namespace should be strictly type-exported by the package.
|
|
28
|
+
* All members should be tagged with `@system`.
|
|
29
|
+
*
|
|
30
|
+
* @system @internal
|
|
31
|
+
*/
|
|
32
|
+
var System_TableSchema;
|
|
33
|
+
(function (System_TableSchema) {
|
|
24
34
|
/**
|
|
25
35
|
* Factory for creating new table column schema.
|
|
26
|
-
* @
|
|
27
|
-
* TODO:
|
|
28
|
-
* - Add overloads to make propsSchema optional.
|
|
29
|
-
* - Take field schema rather than node schema for `propsSchema`, in particular to allow making
|
|
30
|
-
* the additional properties optional.
|
|
31
|
-
* @internal
|
|
36
|
+
* @system @internal
|
|
32
37
|
*/
|
|
33
38
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
34
|
-
function
|
|
39
|
+
function createColumnInternal(inputSchemaFactory, propsSchema) {
|
|
35
40
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
41
|
+
// Note: `columnFields` is broken into two parts to work around a TypeScript bug
|
|
42
|
+
// that results in broken `.d.ts` output.
|
|
43
|
+
// See definition of `ColumnInsertableType` below.
|
|
44
|
+
const columnFieldsBuiltInParts = {
|
|
45
|
+
id: schemaFactory.identifier,
|
|
46
|
+
};
|
|
47
|
+
const columnFieldsPropsPart = {
|
|
48
|
+
props: propsSchema,
|
|
49
|
+
};
|
|
36
50
|
/**
|
|
37
51
|
* {@link Column} fields.
|
|
38
|
-
*
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Extracted for re-use in returned type signature defined later in this function.
|
|
39
55
|
* The implicit typing is intentional.
|
|
56
|
+
*
|
|
40
57
|
* Note: ideally we would add a satisfies clause here to ensure that this satisfies
|
|
41
58
|
* `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.
|
|
42
59
|
* Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394
|
|
43
60
|
*/
|
|
44
61
|
const columnFields = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
62
|
+
...columnFieldsBuiltInParts,
|
|
63
|
+
...columnFieldsPropsPart,
|
|
64
|
+
}; // satisfies Record<string, ImplicitFieldSchema>;
|
|
48
65
|
/**
|
|
49
66
|
* A column in a table.
|
|
50
67
|
*/
|
|
51
|
-
class Column extends schemaFactory.
|
|
68
|
+
class Column extends schemaFactory.objectAlpha("Column", columnFields, {
|
|
69
|
+
// Will make it easier to evolve this schema in the future.
|
|
70
|
+
allowUnknownOptionalFields: true,
|
|
71
|
+
}) {
|
|
52
72
|
}
|
|
53
73
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
54
74
|
// for the private brand field of TreeNode.
|
|
@@ -58,21 +78,29 @@ var TableSchema;
|
|
|
58
78
|
const ColumnSchemaType = Column;
|
|
59
79
|
return ColumnSchemaType;
|
|
60
80
|
}
|
|
61
|
-
|
|
81
|
+
System_TableSchema.createColumnInternal = createColumnInternal;
|
|
62
82
|
/**
|
|
63
83
|
* Factory for creating new table row schema.
|
|
64
84
|
*
|
|
65
|
-
* @privateRemarks
|
|
66
|
-
* TODO:
|
|
67
|
-
* - Add overloads to make propsSchema optional.
|
|
68
|
-
* - Take field schema rather than node schema for `propsSchema`, in particular to allow making
|
|
69
|
-
* the additional properties optional.
|
|
70
|
-
*
|
|
71
85
|
* @sealed @internal
|
|
72
86
|
*/
|
|
73
87
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
74
|
-
function
|
|
88
|
+
function createRowInternal(inputSchemaFactory, cellSchema, propsSchema) {
|
|
75
89
|
const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
|
|
90
|
+
// Note: `rowFields` is broken into two parts to work around a TypeScript bug
|
|
91
|
+
// that results in broken `.d.ts` output.
|
|
92
|
+
// See definition of `RowInsertableType` below.
|
|
93
|
+
const rowFieldsBuiltInParts = {
|
|
94
|
+
id: schemaFactory.identifier,
|
|
95
|
+
cells: schemaFactory.required(schemaFactory.map("Row.cells", cellSchema), {
|
|
96
|
+
metadata: {
|
|
97
|
+
description: "The cells of the table row, keyed by column ID.",
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
const rowFieldsPropsPart = {
|
|
102
|
+
props: propsSchema,
|
|
103
|
+
};
|
|
76
104
|
/**
|
|
77
105
|
* {@link Row} fields.
|
|
78
106
|
* @remarks Extracted for re-use in returned type signature defined later in this function.
|
|
@@ -82,28 +110,34 @@ var TableSchema;
|
|
|
82
110
|
* Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394
|
|
83
111
|
*/
|
|
84
112
|
const rowFields = {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
113
|
+
...rowFieldsBuiltInParts,
|
|
114
|
+
...rowFieldsPropsPart,
|
|
115
|
+
}; // satisfies Record<string, ImplicitFieldSchema>;
|
|
89
116
|
/**
|
|
90
117
|
* The Row schema - this is a map of Cells where the key is the column id
|
|
91
118
|
*/
|
|
92
|
-
class Row extends schemaFactory.
|
|
119
|
+
class Row extends schemaFactory.objectAlpha("Row", rowFields, {
|
|
120
|
+
// Will make it easier to evolve this schema in the future.
|
|
121
|
+
allowUnknownOptionalFields: true,
|
|
122
|
+
}) {
|
|
93
123
|
getCell(columnOrId) {
|
|
94
124
|
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
95
125
|
return this.cells.get(columnId);
|
|
96
126
|
}
|
|
97
127
|
setCell(columnOrId, value) {
|
|
128
|
+
// TODO: throw if column does not exist in the owning table.
|
|
98
129
|
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
99
130
|
this.cells.set(columnId, value);
|
|
100
131
|
}
|
|
101
132
|
removeCell(columnOrId) {
|
|
133
|
+
// TODO: throw if column does not exist in the owning table.
|
|
102
134
|
const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
103
|
-
|
|
104
|
-
|
|
135
|
+
const cell = this.cells.get(columnId);
|
|
136
|
+
if (cell === undefined) {
|
|
137
|
+
return undefined;
|
|
105
138
|
}
|
|
106
139
|
this.cells.delete(columnId);
|
|
140
|
+
return cell;
|
|
107
141
|
}
|
|
108
142
|
}
|
|
109
143
|
// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
|
|
@@ -114,14 +148,7 @@ var TableSchema;
|
|
|
114
148
|
const RowSchemaType = Row;
|
|
115
149
|
return RowSchemaType;
|
|
116
150
|
}
|
|
117
|
-
|
|
118
|
-
/** `createTable` implementation */
|
|
119
|
-
function createTable(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
|
|
120
|
-
const column = columnSchema ?? createColumn(inputSchemaFactory, inputSchemaFactory.null);
|
|
121
|
-
return createTableInternal(inputSchemaFactory, _cellSchema, column, rowSchema ??
|
|
122
|
-
createRow(inputSchemaFactory, _cellSchema, inputSchemaFactory.null));
|
|
123
|
-
}
|
|
124
|
-
TableSchema.createTable = createTable;
|
|
151
|
+
System_TableSchema.createRowInternal = createRowInternal;
|
|
125
152
|
/**
|
|
126
153
|
* Factory for creating new table schema.
|
|
127
154
|
* @system @internal
|
|
@@ -141,7 +168,10 @@ var TableSchema;
|
|
|
141
168
|
/**
|
|
142
169
|
* The Table schema
|
|
143
170
|
*/
|
|
144
|
-
class Table extends schemaFactory.
|
|
171
|
+
class Table extends schemaFactory.objectAlpha("Table", tableFields, {
|
|
172
|
+
// Will make it easier to evolve this schema in the future.
|
|
173
|
+
allowUnknownOptionalFields: true,
|
|
174
|
+
}) {
|
|
145
175
|
getColumn(id) {
|
|
146
176
|
// TypeScript is unable to narrow the types correctly here, hence the casts.
|
|
147
177
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
@@ -153,98 +183,245 @@ var TableSchema;
|
|
|
153
183
|
return this.rows.find((_row) => _row.id === id);
|
|
154
184
|
}
|
|
155
185
|
getCell(key) {
|
|
156
|
-
const {
|
|
157
|
-
const row = this.
|
|
158
|
-
if (row
|
|
159
|
-
|
|
160
|
-
if (column !== undefined) {
|
|
161
|
-
return row.getCell(column.id);
|
|
162
|
-
}
|
|
186
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
187
|
+
const row = this._getRow(rowOrId);
|
|
188
|
+
if (row === undefined) {
|
|
189
|
+
return undefined;
|
|
163
190
|
}
|
|
164
|
-
|
|
165
|
-
|
|
191
|
+
const column = this._getColumn(columnOrId);
|
|
192
|
+
if (column === undefined) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
return row.getCell(column);
|
|
166
196
|
}
|
|
167
197
|
insertColumn({ column, index, }) {
|
|
168
|
-
|
|
169
|
-
|
|
198
|
+
const inserted = this.insertColumns({
|
|
199
|
+
columns: [column],
|
|
200
|
+
index,
|
|
201
|
+
});
|
|
202
|
+
return inserted[0] ?? (0, internal_1.oob)();
|
|
203
|
+
}
|
|
204
|
+
insertColumns({ columns, index, }) {
|
|
205
|
+
// #region Input validation
|
|
206
|
+
// Ensure index is valid
|
|
207
|
+
if (index !== undefined) {
|
|
208
|
+
Table.validateInsertionIndex(index, this.columns);
|
|
209
|
+
}
|
|
210
|
+
// Check all of the columns being inserted an ensure the table does not already contain any with the same ID.
|
|
211
|
+
for (const column of columns) {
|
|
212
|
+
// TypeScript is unable to narrow the type of the column type correctly here, hence the casts below.
|
|
170
213
|
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
214
|
+
const maybeId = column.id;
|
|
215
|
+
if (maybeId !== undefined && this.containsColumnWithId(maybeId)) {
|
|
216
|
+
throw new internal_2.UsageError(`A column with ID "${column.id}" already exists in the table.`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// #endregion
|
|
220
|
+
// TypeScript is unable to narrow the column type correctly here, hence the casts below.
|
|
221
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
222
|
+
if (index === undefined) {
|
|
171
223
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
172
|
-
this.columns.insertAtEnd(
|
|
224
|
+
this.columns.insertAtEnd(index_js_2.TreeArrayNode.spread(columns));
|
|
173
225
|
}
|
|
174
226
|
else {
|
|
175
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
176
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
177
227
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178
|
-
this.columns.insertAt(index,
|
|
228
|
+
this.columns.insertAt(index, index_js_2.TreeArrayNode.spread(columns));
|
|
179
229
|
}
|
|
180
|
-
// Inserting the input
|
|
181
|
-
return
|
|
230
|
+
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
231
|
+
return columns;
|
|
232
|
+
}
|
|
233
|
+
insertRow({ row, index, }) {
|
|
234
|
+
const inserted = this.insertRows({
|
|
235
|
+
rows: [row],
|
|
236
|
+
index,
|
|
237
|
+
});
|
|
238
|
+
return inserted[0] ?? (0, internal_1.oob)();
|
|
182
239
|
}
|
|
183
240
|
insertRows({ index, rows, }) {
|
|
241
|
+
// #region Input validation
|
|
242
|
+
// Ensure index is valid
|
|
243
|
+
if (index !== undefined) {
|
|
244
|
+
Table.validateInsertionIndex(index, this.rows);
|
|
245
|
+
}
|
|
246
|
+
// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
|
|
247
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
248
|
+
for (const newRow of rows) {
|
|
249
|
+
// Check all of the rows being inserted an ensure the table does not already contain any with the same ID.
|
|
250
|
+
const maybeId = newRow.id;
|
|
251
|
+
if (maybeId !== undefined && this.containsRowWithId(maybeId)) {
|
|
252
|
+
throw new internal_2.UsageError(`A row with ID "${newRow.id}" already exists in the table.`);
|
|
253
|
+
}
|
|
254
|
+
// If the row contains cells, verify that the table contains the columns for those cells.
|
|
255
|
+
// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
257
|
+
if (newRow.cells !== undefined) {
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
|
+
const keys = Object.keys(newRow.cells);
|
|
260
|
+
for (const key of keys) {
|
|
261
|
+
if (!this.containsColumnWithId(key)) {
|
|
262
|
+
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.`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// #endregion
|
|
268
|
+
// TypeScript is unable to narrow the row type correctly here, hence the casts below.
|
|
269
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
184
270
|
if (index === undefined) {
|
|
185
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
186
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
187
271
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
272
|
this.rows.insertAtEnd(index_js_2.TreeArrayNode.spread(rows));
|
|
189
273
|
}
|
|
190
274
|
else {
|
|
191
|
-
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
192
|
-
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
193
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
276
|
this.rows.insertAt(index, index_js_2.TreeArrayNode.spread(rows));
|
|
195
277
|
}
|
|
196
278
|
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
197
279
|
return rows;
|
|
198
280
|
}
|
|
199
|
-
setCell({ key, cell }) {
|
|
200
|
-
const {
|
|
201
|
-
const row = this.
|
|
202
|
-
if (row
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
row.setCell(column.id, cell);
|
|
206
|
-
}
|
|
281
|
+
setCell({ key, cell, }) {
|
|
282
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
283
|
+
const row = this._getRow(rowOrId);
|
|
284
|
+
if (row === undefined) {
|
|
285
|
+
const rowId = this._getRowId(rowOrId);
|
|
286
|
+
throw new internal_2.UsageError(`No row with ID "${rowId}" exists in the table.`);
|
|
207
287
|
}
|
|
288
|
+
const column = this._getColumn(columnOrId);
|
|
289
|
+
if (column === undefined) {
|
|
290
|
+
const columnId = this._getColumnId(columnOrId);
|
|
291
|
+
throw new internal_2.UsageError(`No column with ID "${columnId}" exists in the table.`);
|
|
292
|
+
}
|
|
293
|
+
row.setCell(column, cell);
|
|
294
|
+
}
|
|
295
|
+
removeColumns(columns) {
|
|
296
|
+
// If there are no columns to remove, do nothing
|
|
297
|
+
if (columns.length === 0) {
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
// If there is only one column to remove, remove it (and don't incur cost of transaction)
|
|
301
|
+
if (columns.length === 1) {
|
|
302
|
+
const removedColumn = this.removeColumn(columns[0] ?? (0, internal_1.oob)());
|
|
303
|
+
return [removedColumn];
|
|
304
|
+
}
|
|
305
|
+
// If there are multiple columns to remove, remove them in a transaction.
|
|
306
|
+
const removedColumns = [];
|
|
307
|
+
index_js_1.Tree.runTransaction(this, () => {
|
|
308
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
309
|
+
// So if we throw an error here for any row, no columns will be removed.
|
|
310
|
+
for (const columnToRemove of columns) {
|
|
311
|
+
const removedRow = this.removeColumn(columnToRemove);
|
|
312
|
+
removedColumns.push(removedRow);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
return removedColumns;
|
|
208
316
|
}
|
|
209
|
-
removeColumn(
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
if (index === -1)
|
|
213
|
-
|
|
317
|
+
removeColumn(columnOrId) {
|
|
318
|
+
const column = this._getColumn(columnOrId);
|
|
319
|
+
const index = column === undefined ? -1 : this.columns.indexOf(column);
|
|
320
|
+
if (index === -1) {
|
|
321
|
+
const columnId = this._getColumnId(columnOrId);
|
|
322
|
+
throw new internal_2.UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
323
|
+
}
|
|
214
324
|
this.columns.removeAt(index);
|
|
325
|
+
return column;
|
|
326
|
+
}
|
|
327
|
+
removeAllColumns() {
|
|
328
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
329
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
330
|
+
return this.removeColumns(this.columns);
|
|
215
331
|
}
|
|
216
332
|
removeRows(rows) {
|
|
217
333
|
// If there are no rows to remove, do nothing
|
|
218
334
|
if (rows.length === 0) {
|
|
219
|
-
return;
|
|
335
|
+
return [];
|
|
220
336
|
}
|
|
221
|
-
// If there is only one row to remove, remove it
|
|
337
|
+
// If there is only one row to remove, remove it (and don't incur cost of transaction)
|
|
222
338
|
if (rows.length === 1) {
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
return;
|
|
339
|
+
const removedRow = this.removeRow(rows[0] ?? (0, internal_1.oob)());
|
|
340
|
+
return [removedRow];
|
|
226
341
|
}
|
|
227
|
-
// If there are multiple rows to remove, remove them in a transaction
|
|
228
|
-
|
|
342
|
+
// If there are multiple rows to remove, remove them in a transaction.
|
|
343
|
+
const removedRows = [];
|
|
229
344
|
index_js_1.Tree.runTransaction(this, () => {
|
|
230
|
-
//
|
|
231
|
-
for
|
|
232
|
-
|
|
233
|
-
this.
|
|
345
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
346
|
+
// So if we throw an error here for any row, no rows will be removed.
|
|
347
|
+
for (const rowToRemove of rows) {
|
|
348
|
+
const removedRow = this.removeRow(rowToRemove);
|
|
349
|
+
removedRows.push(removedRow);
|
|
234
350
|
}
|
|
235
351
|
});
|
|
352
|
+
return removedRows;
|
|
353
|
+
}
|
|
354
|
+
removeRow(rowOrId) {
|
|
355
|
+
const rowToRemove = this._getRow(rowOrId);
|
|
356
|
+
const index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);
|
|
357
|
+
// If the row does not exist in the table, throw an error.
|
|
358
|
+
if (index === -1) {
|
|
359
|
+
const rowId = this._getRowId(rowOrId);
|
|
360
|
+
throw new internal_2.UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
361
|
+
}
|
|
362
|
+
this.rows.removeAt(index);
|
|
363
|
+
return rowToRemove;
|
|
236
364
|
}
|
|
237
365
|
removeAllRows() {
|
|
238
|
-
|
|
366
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
367
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
368
|
+
return this.removeRows(this.rows);
|
|
239
369
|
}
|
|
240
370
|
removeCell(key) {
|
|
241
|
-
const {
|
|
242
|
-
const row = this.
|
|
243
|
-
if (row
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
371
|
+
const { column: columnOrId, row: rowOrId } = key;
|
|
372
|
+
const row = this._getRow(rowOrId);
|
|
373
|
+
if (row === undefined) {
|
|
374
|
+
const rowId = this._getRowId(rowOrId);
|
|
375
|
+
throw new internal_2.UsageError(`Specified row with ID "${rowId}" does not exist in the table.`);
|
|
376
|
+
}
|
|
377
|
+
const column = this._getColumn(columnOrId);
|
|
378
|
+
if (column === undefined) {
|
|
379
|
+
const columnId = this._getColumnId(columnOrId);
|
|
380
|
+
throw new internal_2.UsageError(`Specified column with ID "${columnId}" does not exist in the table.`);
|
|
381
|
+
}
|
|
382
|
+
const cell = row.getCell(column.id);
|
|
383
|
+
if (cell === undefined) {
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
row.removeCell(column.id);
|
|
387
|
+
return cell;
|
|
388
|
+
}
|
|
389
|
+
_getColumn(columnOrId) {
|
|
390
|
+
return typeof columnOrId === "string" ? this.getColumn(columnOrId) : columnOrId;
|
|
391
|
+
}
|
|
392
|
+
_getColumnId(columnOrId) {
|
|
393
|
+
return typeof columnOrId === "string" ? columnOrId : columnOrId.id;
|
|
394
|
+
}
|
|
395
|
+
_getRow(rowOrId) {
|
|
396
|
+
return typeof rowOrId === "string" ? this.getRow(rowOrId) : rowOrId;
|
|
397
|
+
}
|
|
398
|
+
_getRowId(rowOrId) {
|
|
399
|
+
return typeof rowOrId === "string" ? rowOrId : rowOrId.id;
|
|
400
|
+
}
|
|
401
|
+
containsColumnWithId(columnId) {
|
|
402
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
403
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
404
|
+
return (this.columns.find((column) => column.id === columnId) !==
|
|
405
|
+
undefined);
|
|
406
|
+
}
|
|
407
|
+
containsRowWithId(rowId) {
|
|
408
|
+
// TypeScript is unable to narrow the types correctly here, hence the cast.
|
|
409
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
410
|
+
return this.rows.find((row) => row.id === rowId) !== undefined;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Ensure that the specified index is a valid location for item insertion in the destination list.
|
|
414
|
+
* @throws Throws a usage error if the destination is invalid.
|
|
415
|
+
*/
|
|
416
|
+
static validateInsertionIndex(index, destinationList) {
|
|
417
|
+
if (index < 0) {
|
|
418
|
+
throw new internal_2.UsageError("The index must be greater than or equal to 0.");
|
|
419
|
+
}
|
|
420
|
+
if (index > destinationList.length) {
|
|
421
|
+
throw new internal_2.UsageError("The index specified for insertion is out of bounds.");
|
|
422
|
+
}
|
|
423
|
+
if (!Number.isInteger(index)) {
|
|
424
|
+
throw new internal_2.UsageError("The index must be an integer.");
|
|
248
425
|
}
|
|
249
426
|
}
|
|
250
427
|
}
|
|
@@ -257,7 +434,127 @@ var TableSchema;
|
|
|
257
434
|
// Return the table schema
|
|
258
435
|
return TableSchemaType;
|
|
259
436
|
}
|
|
260
|
-
|
|
437
|
+
System_TableSchema.createTableInternal = createTableInternal;
|
|
438
|
+
// #endregion
|
|
439
|
+
})(System_TableSchema || (exports.System_TableSchema = System_TableSchema = {}));
|
|
440
|
+
/**
|
|
441
|
+
* Contains types and factories for creating schema to represent dynamic tabular data.
|
|
442
|
+
*
|
|
443
|
+
* @remarks
|
|
444
|
+
*
|
|
445
|
+
* Tables created using these APIs are...
|
|
446
|
+
*
|
|
447
|
+
* - sparse, meaning that cells may be omitted, and new rows are empty by default.
|
|
448
|
+
*
|
|
449
|
+
* - dynamic, meaning that their structure can be modified at runtime.
|
|
450
|
+
* Columns and rows can be inserted, removed, modified, and reordered.
|
|
451
|
+
* Cells can be inserted, removed, and modified.
|
|
452
|
+
*
|
|
453
|
+
* - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.
|
|
454
|
+
*
|
|
455
|
+
* Column and Row schema created using these APIs are extensible via the `props` field.
|
|
456
|
+
* This allows association of additional properties with column and row nodes.
|
|
457
|
+
*
|
|
458
|
+
* Note: for now it is possible for table cells to become "orphaned".
|
|
459
|
+
* That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.
|
|
460
|
+
* To help avoid this situation, you can manually remove corresponding cells when removing columns.
|
|
461
|
+
* Either way, it is possible to enter such a state via the merging of edits.
|
|
462
|
+
* For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.
|
|
463
|
+
*
|
|
464
|
+
* @example Using default Column and Row schema
|
|
465
|
+
*
|
|
466
|
+
* ```typescript
|
|
467
|
+
* class Cell extends schemaFactory.object("TableCell", {
|
|
468
|
+
* value: schemaFactory.string,
|
|
469
|
+
* }) {}
|
|
470
|
+
*
|
|
471
|
+
* class Table extends TableSchema.createTable({
|
|
472
|
+
* schemaFactory,
|
|
473
|
+
* cell: Cell,
|
|
474
|
+
* }) {}
|
|
475
|
+
*
|
|
476
|
+
* const table = new Table({
|
|
477
|
+
* columns: [{ id: "column-0" }],
|
|
478
|
+
* rows: [{ id: "row-0", cells: {} }],
|
|
479
|
+
* });
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @example Customizing Column and Row schema
|
|
483
|
+
*
|
|
484
|
+
* ```typescript
|
|
485
|
+
* class Cell extends schemaFactory.object("TableCell", {
|
|
486
|
+
* value: schemaFactory.string,
|
|
487
|
+
* }) {}
|
|
488
|
+
*
|
|
489
|
+
* class ColumnProps extends schemaFactory.object("TableColumnProps", {
|
|
490
|
+
* // Column label to display.
|
|
491
|
+
* label: schemaFactory.string,
|
|
492
|
+
* // The type of data represented by the cells. Default: string.
|
|
493
|
+
* dataType: schemaFactory.optional(schemaFactory.string),
|
|
494
|
+
* }) {}
|
|
495
|
+
*
|
|
496
|
+
* class Column extends TableSchema.createColumn({
|
|
497
|
+
* schemaFactory,
|
|
498
|
+
* props: ColumnProps,
|
|
499
|
+
* }) {}
|
|
500
|
+
*
|
|
501
|
+
* class Row extends TableSchema.createRow({
|
|
502
|
+
* schemaFactory,
|
|
503
|
+
* cell: Cell,
|
|
504
|
+
* }) {}
|
|
505
|
+
*
|
|
506
|
+
* class Table extends TableSchema.createTable({
|
|
507
|
+
* schemaFactory,
|
|
508
|
+
* cell: Cell,
|
|
509
|
+
* column: Column,
|
|
510
|
+
* row: Row,
|
|
511
|
+
* }) {}
|
|
512
|
+
*
|
|
513
|
+
* const table = new Table({
|
|
514
|
+
* columns: [
|
|
515
|
+
* new Column({ props: { label: "Entry", dataType: "string" } }),
|
|
516
|
+
* new Column({ props: { label: "Date", dataType: "date" } }),
|
|
517
|
+
* new Column({ props: { label: "Amount", dataType: "number" } }),
|
|
518
|
+
* ],
|
|
519
|
+
* rows: [],
|
|
520
|
+
* });
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @privateRemarks
|
|
524
|
+
* The above examples are backed by tests in `tableSchema.spec.ts`.
|
|
525
|
+
* Those tests and these examples should be kept in-sync to ensure that the examples are correct.
|
|
526
|
+
*
|
|
527
|
+
* @internal
|
|
528
|
+
*/
|
|
529
|
+
var TableSchema;
|
|
530
|
+
(function (TableSchema) {
|
|
531
|
+
// #region Column
|
|
532
|
+
/**
|
|
533
|
+
* Overload implementation
|
|
534
|
+
*/
|
|
535
|
+
function createColumn({ schemaFactory, props = index_js_2.SchemaFactory.optional(index_js_2.SchemaFactory.null), }) {
|
|
536
|
+
return System_TableSchema.createColumnInternal(schemaFactory, props);
|
|
537
|
+
}
|
|
538
|
+
TableSchema.createColumn = createColumn;
|
|
539
|
+
/**
|
|
540
|
+
* Overload implementation
|
|
541
|
+
*/
|
|
542
|
+
function createRow({ schemaFactory, cell, props = index_js_2.SchemaFactory.optional(index_js_2.SchemaFactory.null), }) {
|
|
543
|
+
return System_TableSchema.createRowInternal(schemaFactory, cell, props);
|
|
544
|
+
}
|
|
545
|
+
TableSchema.createRow = createRow;
|
|
546
|
+
/**
|
|
547
|
+
* Overload implementation
|
|
548
|
+
*/
|
|
549
|
+
function createTable({ schemaFactory, cell, column = createColumn({
|
|
550
|
+
schemaFactory,
|
|
551
|
+
}), row = createRow({
|
|
552
|
+
schemaFactory,
|
|
553
|
+
cell,
|
|
554
|
+
}), }) {
|
|
555
|
+
return System_TableSchema.createTableInternal(schemaFactory, cell, column, row);
|
|
556
|
+
}
|
|
557
|
+
TableSchema.createTable = createTable;
|
|
261
558
|
// #endregion
|
|
262
559
|
})(TableSchema || (exports.TableSchema = TableSchema = {}));
|
|
263
560
|
//# sourceMappingURL=tableSchema.js.map
|