@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
|
@@ -4,18 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import type { CommitMetadata, RevertibleAlphaFactory, RevertibleFactory } from "../../core/index.js";
|
|
7
|
-
import
|
|
8
|
-
import { type TreeNodeSchema } from "../core/index.js";
|
|
9
|
-
import type { MakeNominal } from "../../util/index.js";
|
|
7
|
+
import type { ImplicitFieldSchema, InsertableField, InsertableTreeFieldFromImplicitField, ReadableField, ReadSchema, TreeFieldFromImplicitField, UnsafeUnknownSchema } from "../schemaTypes.js";
|
|
10
8
|
import type { VerboseTree } from "./verboseTree.js";
|
|
11
|
-
import type {
|
|
9
|
+
import type { SimpleTreeSchema } from "../simpleSchema.js";
|
|
12
10
|
import type { RunTransactionParams, TransactionCallbackStatus, TransactionResult, TransactionResultExt, VoidTransactionCallbackStatus } from "./transactionTypes.js";
|
|
11
|
+
import type { TreeViewConfiguration } from "./configuration.js";
|
|
13
12
|
/**
|
|
14
13
|
* A tree from which a {@link TreeView} can be created.
|
|
15
14
|
*
|
|
16
15
|
* @privateRemarks
|
|
17
16
|
* TODO:
|
|
18
|
-
* Add stored key versions of {@link TreeAlpha.(exportVerbose:2)}, {@link TreeAlpha.(exportConcise:2)} and {@link TreeAlpha.exportCompressed} here so tree content can be accessed without a view schema.
|
|
17
|
+
* Add stored key versions of {@link (TreeAlpha:interface).(exportVerbose:2)}, {@link (TreeAlpha:interface).(exportConcise:2)} and {@link (TreeAlpha:interface).exportCompressed} here so tree content can be accessed without a view schema.
|
|
19
18
|
* Add exportSimpleSchema and exportJsonSchema methods (which should exactly match the concise format, and match the free functions for exporting view schema).
|
|
20
19
|
* Maybe rename "exportJsonSchema" to align on "concise" terminology.
|
|
21
20
|
* Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
|
|
@@ -58,7 +57,7 @@ export interface ITree extends ViewableTree, IFluidLoadable {
|
|
|
58
57
|
*/
|
|
59
58
|
export interface ITreeAlpha extends ITree {
|
|
60
59
|
/**
|
|
61
|
-
* Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
|
|
60
|
+
* Exports root in the same format as {@link (TreeAlpha:interface).(exportVerbose:1)} using stored keys.
|
|
62
61
|
* @remarks
|
|
63
62
|
* This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).
|
|
64
63
|
*/
|
|
@@ -70,174 +69,6 @@ export interface ITreeAlpha extends ITree {
|
|
|
70
69
|
*/
|
|
71
70
|
exportSimpleSchema(): SimpleTreeSchema;
|
|
72
71
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Options when constructing a tree view.
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
export interface ITreeConfigurationOptions {
|
|
78
|
-
/**
|
|
79
|
-
* If `true`, the tree will validate new content against its stored schema at insertion time
|
|
80
|
-
* and throw an error if the new content doesn't match the expected schema.
|
|
81
|
-
*
|
|
82
|
-
* @defaultValue `false`.
|
|
83
|
-
*
|
|
84
|
-
* @remarks Enabling schema validation has a performance penalty when inserting new content into the tree because
|
|
85
|
-
* additional checks are done. Enable this option only in scenarios where you are ok with that operation being a
|
|
86
|
-
* bit slower.
|
|
87
|
-
*/
|
|
88
|
-
enableSchemaValidation?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* A flag used to opt into strict rules ensuring that the schema avoids cases which can make the type of nodes ambiguous when importing or exporting data.
|
|
91
|
-
* @defaultValue `false`.
|
|
92
|
-
*
|
|
93
|
-
* @remarks
|
|
94
|
-
* When this is true, it ensures that the compile time type safety for data when constructing nodes is sufficient to ensure that the runtime behavior will not give node data ambiguity errors.
|
|
95
|
-
*
|
|
96
|
-
* This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.
|
|
97
|
-
* This canonical JSON-like representation consists of arrays, plain old JavaScript objects with string keys, booleans, numbers (excluding NaN, -0 and infinities), strings, null and {@link @fluidframework/core-interfaces#IFluidHandle}s.
|
|
98
|
-
* It is compatible with the node creation APIs (such as schema class constructors) and is also compatible with JSON assuming any IFluidHandles get special handling (since they are not JSON compatible).
|
|
99
|
-
* Currently these cases can cause ambiguity in a union:
|
|
100
|
-
*
|
|
101
|
-
* - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).
|
|
102
|
-
*
|
|
103
|
-
* - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).
|
|
104
|
-
*
|
|
105
|
-
* - Both a MapNode and an ArrayNode: this case is not a problem for the canonical JSON representation, but is an issue when constructing from an Iterable, which is supported for both MapNode and ArrayNode.
|
|
106
|
-
*
|
|
107
|
-
* - Both a MapNode and an ObjectNode: when the input is valid for the ObjectNode, the current parser always considers it ambiguous with being a MapNode.
|
|
108
|
-
*
|
|
109
|
-
* - ObjectNodes which have fields (required or optional) which include all required fields of another ObjectNode: currently each ObjectNode is differentiated by the presence of its required fields.
|
|
110
|
-
*
|
|
111
|
-
* This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.
|
|
112
|
-
* This check may become more permissive over time.
|
|
113
|
-
*
|
|
114
|
-
* @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const schemaFactory = new SchemaFactory("com.example");
|
|
117
|
-
* class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
|
|
118
|
-
* class Meters extends schemaFactory.object("Meters", { length: schemaFactory.number }) {}
|
|
119
|
-
* const config = new TreeViewConfiguration({
|
|
120
|
-
* // This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.
|
|
121
|
-
* schema: [Feet, Meters],
|
|
122
|
-
* preventAmbiguity: false,
|
|
123
|
-
* });
|
|
124
|
-
* const view = tree.viewWith(config);
|
|
125
|
-
* // This is invalid since it is ambiguous which type of node is being constructed:
|
|
126
|
-
* // view.initialize({ length: 5 });
|
|
127
|
-
* // To work, an explicit type can be provided by using an {@link Unhydrated} Node:
|
|
128
|
-
* view.initialize(new Meters({ length: 5 }));
|
|
129
|
-
* ```
|
|
130
|
-
*
|
|
131
|
-
* @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`
|
|
132
|
-
* ```typescript
|
|
133
|
-
* const schemaFactory = new SchemaFactory("com.example");
|
|
134
|
-
* class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
|
|
135
|
-
* class Meters extends schemaFactory.object("Meters", {
|
|
136
|
-
* // To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to "meters".
|
|
137
|
-
* // To preserve compatibility with existing data from the ambiguous case,
|
|
138
|
-
* // `{ key: "length" }` is set, so when persisted in the tree "length" is used as the field name.
|
|
139
|
-
* meters: schemaFactory.required(schemaFactory.number, { key: "length" }),
|
|
140
|
-
* }) {}
|
|
141
|
-
* const config = new TreeViewConfiguration({
|
|
142
|
-
* // This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.
|
|
143
|
-
* schema: [Feet, Meters],
|
|
144
|
-
* preventAmbiguity: true,
|
|
145
|
-
* });
|
|
146
|
-
* const view = tree.viewWith(config);
|
|
147
|
-
* // This now works, since the field is sufficient to determine this is a `Meters` node.
|
|
148
|
-
* view.initialize({ meters: 5 });
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* @privateRemarks
|
|
152
|
-
* In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.
|
|
153
|
-
* This could be done via methods added to `Tree` to export and import such objects, which would give us a place to explicitly define the type of this representation.
|
|
154
|
-
*
|
|
155
|
-
* To make this more permissive in the future we can:
|
|
156
|
-
*
|
|
157
|
-
* - Make toMapTree more permissive (ex: allow disambiguation based on leaf type)
|
|
158
|
-
* - Update this check to more tightly match toMapTree
|
|
159
|
-
* - Add options to help schema authors disambiguate their types, such as "constant fields" which are not persisted, and always have a constant value.
|
|
160
|
-
*
|
|
161
|
-
* The above examples exist in executable form in this files tests, and should be updated there then copied back here.
|
|
162
|
-
*/
|
|
163
|
-
readonly preventAmbiguity?: boolean;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Property-bag configuration for {@link TreeViewConfiguration} construction.
|
|
167
|
-
* @public
|
|
168
|
-
*/
|
|
169
|
-
export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> extends ITreeConfigurationOptions {
|
|
170
|
-
/**
|
|
171
|
-
* The schema which the application wants to view the tree with.
|
|
172
|
-
*/
|
|
173
|
-
readonly schema: TSchema;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Configuration for {@link ViewableTree.viewWith}.
|
|
177
|
-
* @sealed @public
|
|
178
|
-
*/
|
|
179
|
-
export declare class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
180
|
-
protected _typeCheck: MakeNominal;
|
|
181
|
-
/**
|
|
182
|
-
* {@inheritDoc ITreeViewConfiguration.schema}
|
|
183
|
-
*/
|
|
184
|
-
readonly schema: TSchema;
|
|
185
|
-
/**
|
|
186
|
-
* {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}
|
|
187
|
-
*/
|
|
188
|
-
readonly enableSchemaValidation: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}
|
|
191
|
-
*/
|
|
192
|
-
readonly preventAmbiguity: boolean;
|
|
193
|
-
/**
|
|
194
|
-
* Construct a new {@link TreeViewConfiguration}.
|
|
195
|
-
*
|
|
196
|
-
* @param props - Property bag of configuration options.
|
|
197
|
-
*
|
|
198
|
-
* @remarks
|
|
199
|
-
* Performing this construction deeply validates the provided schema.
|
|
200
|
-
* This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).
|
|
201
|
-
* This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.
|
|
202
|
-
*
|
|
203
|
-
* For example, a schema reachable from this configuration cannot reference this configuration during its declaration,
|
|
204
|
-
* since this would be a cyclic dependency that will cause an error when constructing this configuration.
|
|
205
|
-
*/
|
|
206
|
-
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* {@link TreeViewConfiguration} extended with some alpha APIs.
|
|
210
|
-
* @sealed @alpha
|
|
211
|
-
*/
|
|
212
|
-
export declare class TreeViewConfigurationAlpha<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> extends TreeViewConfiguration<TSchema> implements TreeSchema {
|
|
213
|
-
/**
|
|
214
|
-
* {@inheritDoc TreeSchema.root}
|
|
215
|
-
*/
|
|
216
|
-
readonly root: FieldSchemaAlpha;
|
|
217
|
-
/**
|
|
218
|
-
* {@inheritDoc TreeSchema.definitions}
|
|
219
|
-
*/
|
|
220
|
-
readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
|
|
221
|
-
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* {@link TreeViewConfigurationAlpha}
|
|
225
|
-
* @sealed @alpha
|
|
226
|
-
*/
|
|
227
|
-
export interface TreeSchema extends SimpleTreeSchema {
|
|
228
|
-
/**
|
|
229
|
-
* {@inheritDoc SimpleTreeSchema.root}
|
|
230
|
-
*/
|
|
231
|
-
readonly root: FieldSchemaAlpha;
|
|
232
|
-
/**
|
|
233
|
-
* {@inheritDoc SimpleTreeSchema.definitions}
|
|
234
|
-
*/
|
|
235
|
-
readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}.
|
|
239
|
-
*/
|
|
240
|
-
export declare function checkUnion(union: Iterable<TreeNodeSchema>, errors: string[]): void;
|
|
241
72
|
/**
|
|
242
73
|
* A collection of functionality associated with a (version-control-style) branch of a SharedTree.
|
|
243
74
|
* @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.
|
|
@@ -402,14 +233,18 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
|
|
|
402
233
|
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
403
234
|
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
404
235
|
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
236
|
+
*
|
|
405
237
|
* - A "success" flag indicating whether the transaction was successful or not.
|
|
238
|
+
*
|
|
406
239
|
* - The success of failure value as returned by the transaction function.
|
|
407
240
|
* @remarks
|
|
408
241
|
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
409
242
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
410
243
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
411
244
|
* However, using a transaction has the following additional consequences:
|
|
245
|
+
*
|
|
412
246
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
247
|
+
*
|
|
413
248
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
414
249
|
*
|
|
415
250
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -417,19 +252,25 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
|
|
|
417
252
|
*
|
|
418
253
|
* Nested transactions:
|
|
419
254
|
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
255
|
+
*
|
|
420
256
|
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
257
|
+
*
|
|
421
258
|
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
422
259
|
* for the outermost transaction which includes all inner transactions.
|
|
260
|
+
*
|
|
423
261
|
* - Undo will undo the outermost transaction and all inner transactions.
|
|
424
262
|
*/
|
|
425
263
|
runTransaction<TSuccessValue, TFailureValue>(transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>, params?: RunTransactionParams): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
426
264
|
/**
|
|
427
265
|
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
428
266
|
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
267
|
+
*
|
|
429
268
|
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
269
|
+
*
|
|
430
270
|
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
431
271
|
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
432
272
|
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
273
|
+
*
|
|
433
274
|
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
434
275
|
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
435
276
|
* transaction was successful or not.
|
|
@@ -438,7 +279,9 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
|
|
|
438
279
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
439
280
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
440
281
|
* However, using a transaction has the following additional consequences:
|
|
282
|
+
*
|
|
441
283
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
284
|
+
*
|
|
442
285
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
443
286
|
*
|
|
444
287
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -446,9 +289,12 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
|
|
|
446
289
|
*
|
|
447
290
|
* Nested transactions:
|
|
448
291
|
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
292
|
+
*
|
|
449
293
|
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
294
|
+
*
|
|
450
295
|
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
451
296
|
* for the outermost transaction which includes all inner transactions.
|
|
297
|
+
*
|
|
452
298
|
* - Undo will undo the outermost transaction and all inner transactions.
|
|
453
299
|
*/
|
|
454
300
|
runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult;
|
|
@@ -468,7 +314,9 @@ export interface SchemaCompatibilityStatus {
|
|
|
468
314
|
* exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.
|
|
469
315
|
*
|
|
470
316
|
* Examples which are expressible where this may occur include:
|
|
317
|
+
*
|
|
471
318
|
* - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)
|
|
319
|
+
*
|
|
472
320
|
* - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (ex: an object node type containing a required field with no allowed types)
|
|
473
321
|
*
|
|
474
322
|
* These cases are typically not interesting to applications.
|
|
@@ -537,11 +385,15 @@ export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied">
|
|
|
537
385
|
changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
|
|
538
386
|
/**
|
|
539
387
|
* Fired when:
|
|
388
|
+
*
|
|
540
389
|
* - a local commit is applied outside of a transaction
|
|
390
|
+
*
|
|
541
391
|
* - a local transaction is committed
|
|
542
392
|
*
|
|
543
393
|
* The event is not fired when:
|
|
394
|
+
*
|
|
544
395
|
* - a local commit is applied within a transaction
|
|
396
|
+
*
|
|
545
397
|
* - a remote commit is applied
|
|
546
398
|
*
|
|
547
399
|
* @param data - information about the commit that was applied
|
|
@@ -574,11 +426,15 @@ export interface TreeViewEvents {
|
|
|
574
426
|
schemaChanged(): void;
|
|
575
427
|
/**
|
|
576
428
|
* Fired when:
|
|
429
|
+
*
|
|
577
430
|
* - a local commit is applied outside of a transaction
|
|
431
|
+
*
|
|
578
432
|
* - a local transaction is committed
|
|
579
433
|
*
|
|
580
434
|
* The event is not fired when:
|
|
435
|
+
*
|
|
581
436
|
* - a local commit is applied within a transaction
|
|
437
|
+
*
|
|
582
438
|
* - a remote commit is applied
|
|
583
439
|
*
|
|
584
440
|
* @param data - information about the commit that was applied
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,162 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.asTreeViewAlpha =
|
|
8
|
-
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
|
-
const schemaTypes_js_1 = require("../schemaTypes.js");
|
|
11
|
-
const index_js_1 = require("../core/index.js");
|
|
12
|
-
const toStoredSchema_js_1 = require("../toStoredSchema.js");
|
|
13
|
-
const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
|
|
14
|
-
const objectNodeTypes_js_1 = require("../objectNodeTypes.js");
|
|
15
|
-
const index_js_2 = require("../../util/index.js");
|
|
16
|
-
const walkFieldSchema_js_1 = require("../walkFieldSchema.js");
|
|
17
|
-
const defaultTreeConfigurationOptions = {
|
|
18
|
-
enableSchemaValidation: false,
|
|
19
|
-
preventAmbiguity: false,
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Configuration for {@link ViewableTree.viewWith}.
|
|
23
|
-
* @sealed @public
|
|
24
|
-
*/
|
|
25
|
-
class TreeViewConfiguration {
|
|
26
|
-
/**
|
|
27
|
-
* Construct a new {@link TreeViewConfiguration}.
|
|
28
|
-
*
|
|
29
|
-
* @param props - Property bag of configuration options.
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* Performing this construction deeply validates the provided schema.
|
|
33
|
-
* This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).
|
|
34
|
-
* This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.
|
|
35
|
-
*
|
|
36
|
-
* For example, a schema reachable from this configuration cannot reference this configuration during its declaration,
|
|
37
|
-
* since this would be a cyclic dependency that will cause an error when constructing this configuration.
|
|
38
|
-
*/
|
|
39
|
-
constructor(props) {
|
|
40
|
-
const config = { ...defaultTreeConfigurationOptions, ...props };
|
|
41
|
-
this.schema = config.schema;
|
|
42
|
-
this.enableSchemaValidation = config.enableSchemaValidation;
|
|
43
|
-
this.preventAmbiguity = config.preventAmbiguity;
|
|
44
|
-
// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.
|
|
45
|
-
const ambiguityErrors = [];
|
|
46
|
-
(0, walkFieldSchema_js_1.walkFieldSchema)(config.schema, {
|
|
47
|
-
// Ensure all reachable schema are marked as most derived.
|
|
48
|
-
// This ensures if multiple schema extending the same schema factory generated class are present (or have been constructed, or get constructed in the future),
|
|
49
|
-
// an error is reported.
|
|
50
|
-
node: (schema) => (0, schemaTypes_js_1.markSchemaMostDerived)(schema, true),
|
|
51
|
-
allowedTypes(types) {
|
|
52
|
-
if (config.preventAmbiguity) {
|
|
53
|
-
checkUnion(types, ambiguityErrors);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
if (ambiguityErrors.length !== 0) {
|
|
58
|
-
// Duplicate errors are common since when two types conflict, both orders error:
|
|
59
|
-
const deduplicated = new Set(ambiguityErrors);
|
|
60
|
-
throw new internal_2.UsageError(`Ambiguous schema found:\n${[...deduplicated].join("\n")}`);
|
|
61
|
-
}
|
|
62
|
-
// Eagerly perform this conversion to surface errors sooner.
|
|
63
|
-
(0, toStoredSchema_js_1.toStoredSchema)(config.schema);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.TreeViewConfiguration = TreeViewConfiguration;
|
|
67
|
-
/**
|
|
68
|
-
* {@link TreeViewConfiguration} extended with some alpha APIs.
|
|
69
|
-
* @sealed @alpha
|
|
70
|
-
*/
|
|
71
|
-
class TreeViewConfigurationAlpha extends TreeViewConfiguration {
|
|
72
|
-
constructor(props) {
|
|
73
|
-
super(props);
|
|
74
|
-
this.root = (0, schemaTypes_js_1.normalizeFieldSchema)(props.schema);
|
|
75
|
-
const definitions = new Map();
|
|
76
|
-
(0, walkFieldSchema_js_1.walkFieldSchema)(props.schema, {
|
|
77
|
-
node: (schema) => definitions.set(schema.identifier, schema),
|
|
78
|
-
});
|
|
79
|
-
this.definitions = definitions;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.TreeViewConfigurationAlpha = TreeViewConfigurationAlpha;
|
|
83
|
-
/**
|
|
84
|
-
* Pretty print a set of types for use in error messages.
|
|
85
|
-
*/
|
|
86
|
-
function formatTypes(allowed) {
|
|
87
|
-
// Use JSON.stringify to quote and escape identifiers.
|
|
88
|
-
// Don't just use a single array JSON.stringify since that omits spaces between items
|
|
89
|
-
return `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(", ")}]`;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}.
|
|
93
|
-
*/
|
|
94
|
-
function checkUnion(union, errors) {
|
|
95
|
-
const checked = new Set();
|
|
96
|
-
const maps = [];
|
|
97
|
-
const arrays = [];
|
|
98
|
-
const objects = [];
|
|
99
|
-
// Map from key to schema using that key
|
|
100
|
-
const allObjectKeys = new Map();
|
|
101
|
-
for (const schema of union) {
|
|
102
|
-
if (checked.has(schema)) {
|
|
103
|
-
throw new internal_2.UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);
|
|
104
|
-
}
|
|
105
|
-
checked.add(schema);
|
|
106
|
-
if (schema instanceof leafNodeSchema_js_1.LeafNodeSchema) {
|
|
107
|
-
// nothing to do
|
|
108
|
-
}
|
|
109
|
-
else if ((0, objectNodeTypes_js_1.isObjectNodeSchema)(schema)) {
|
|
110
|
-
objects.push(schema);
|
|
111
|
-
for (const key of schema.fields.keys()) {
|
|
112
|
-
(0, index_js_2.getOrCreate)(allObjectKeys, key, () => new Set()).add(schema);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (schema.kind === index_js_1.NodeKind.Array) {
|
|
116
|
-
arrays.push(schema);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
(0, internal_1.assert)(schema.kind === index_js_1.NodeKind.Map, 0x9e7 /* invalid schema */);
|
|
120
|
-
maps.push(schema);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (arrays.length > 1) {
|
|
124
|
-
errors.push(`More than one kind of array allowed within union (${formatTypes(arrays)}). This would require type disambiguation which is not supported by arrays during import or export.`);
|
|
125
|
-
}
|
|
126
|
-
if (maps.length > 1) {
|
|
127
|
-
errors.push(`More than one kind of map allowed within union (${formatTypes(maps)}). This would require type disambiguation which is not supported by maps during import or export.`);
|
|
128
|
-
}
|
|
129
|
-
if (maps.length > 0 && arrays.length > 0) {
|
|
130
|
-
errors.push(`Both a map and an array allowed within union (${formatTypes([...arrays, ...maps])}). Both can be implicitly constructed from iterables like arrays, which are ambiguous when the array is empty.`);
|
|
131
|
-
}
|
|
132
|
-
if (objects.length > 0 && maps.length > 0) {
|
|
133
|
-
errors.push(`Both a object and a map allowed within union (${formatTypes([...objects, ...maps])}). Both can be constructed from objects and can be ambiguous.`);
|
|
134
|
-
}
|
|
135
|
-
// Check for objects which fully overlap:
|
|
136
|
-
for (const schema of objects) {
|
|
137
|
-
// All objects which might be ambiguous relative to `schema`.
|
|
138
|
-
const possiblyAmbiguous = new Set(objects);
|
|
139
|
-
// A schema can't be ambiguous with itself
|
|
140
|
-
possiblyAmbiguous.delete(schema);
|
|
141
|
-
// For each field of schema, remove schema from possiblyAmbiguous that do not have that field
|
|
142
|
-
for (const [key, field] of schema.fields) {
|
|
143
|
-
if (field.kind === schemaTypes_js_1.FieldKind.Required) {
|
|
144
|
-
const withKey = allObjectKeys.get(key) ?? (0, internal_1.fail)(0xb35 /* missing schema */);
|
|
145
|
-
for (const candidate of possiblyAmbiguous) {
|
|
146
|
-
if (!withKey.has(candidate)) {
|
|
147
|
-
possiblyAmbiguous.delete(candidate);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (possiblyAmbiguous.size > 0) {
|
|
153
|
-
// TODO: make this check more permissive.
|
|
154
|
-
// Allow using the type of the field to disambiguate, at least for leaf types.
|
|
155
|
-
// Add "constant" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?
|
|
156
|
-
// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).
|
|
157
|
-
// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/toMapTree.ts.
|
|
158
|
-
errors.push(`The required fields of ${JSON.stringify(schema.identifier)} are insufficient to differentiate it from the following types: ${formatTypes(possiblyAmbiguous)}. For objects to be considered unambiguous, each must have required fields that do not all occur on any other object in the union.`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
exports.checkUnion = checkUnion;
|
|
7
|
+
exports.asTreeViewAlpha = void 0;
|
|
163
8
|
/**
|
|
164
9
|
* Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.
|
|
165
10
|
* @alpha
|