@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
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
type VerboseTree,
|
|
35
35
|
toStoredSchema,
|
|
36
36
|
extractPersistedSchema,
|
|
37
|
-
TreeViewConfiguration,
|
|
38
37
|
type TreeBranch,
|
|
38
|
+
TreeViewConfigurationAlpha,
|
|
39
39
|
} from "../simple-tree/index.js";
|
|
40
40
|
import type { JsonCompatible } from "../util/index.js";
|
|
41
41
|
import { noopValidator, type FluidClientVersion, type ICodecOptions } from "../codec/index.js";
|
|
@@ -52,12 +52,15 @@ import {
|
|
|
52
52
|
} from "../feature-libraries/index.js";
|
|
53
53
|
import { independentInitializedView, type ViewContent } from "./independentView.js";
|
|
54
54
|
import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
|
|
55
|
+
import { currentVersion } from "../codec/index.js";
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
|
-
* Extensions to {@link Tree} and {@link TreeBeta} which are not yet stable.
|
|
58
|
-
* @
|
|
58
|
+
* Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.
|
|
59
|
+
* @remarks
|
|
60
|
+
* Use via the {@link (TreeAlpha:variable)} singleton.
|
|
61
|
+
* @system @sealed @alpha
|
|
59
62
|
*/
|
|
60
|
-
export
|
|
63
|
+
export interface TreeAlpha {
|
|
61
64
|
/**
|
|
62
65
|
* Retrieve the {@link TreeBranch | branch}, if any, for the given node.
|
|
63
66
|
* @param node - The node to query
|
|
@@ -79,7 +82,7 @@ export const TreeAlpha: {
|
|
|
79
82
|
* such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.
|
|
80
83
|
*
|
|
81
84
|
* Like with {@link TreeNodeSchemaClass}'s constructor, it's an error to provide an existing node to this API.
|
|
82
|
-
* For that case, use {@link TreeBeta.clone}.
|
|
85
|
+
* For that case, use {@link (TreeBeta:interface).clone}.
|
|
83
86
|
* @privateRemarks
|
|
84
87
|
* There should be a way to provide a source for defaulted identifiers, wither via this API or some way to add them to its output later.
|
|
85
88
|
*/
|
|
@@ -95,7 +98,7 @@ export const TreeAlpha: {
|
|
|
95
98
|
>;
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
|
-
* Less type safe version of {@link TreeAlpha.create}, suitable for importing data.
|
|
101
|
+
* Less type safe version of {@link (TreeAlpha:interface).create}, suitable for importing data.
|
|
99
102
|
* @remarks
|
|
100
103
|
* Due to {@link ConciseTree} relying on type inference from the data, its use is somewhat limited.
|
|
101
104
|
* This does not support {@link ConciseTree|ConciseTrees} with customized handle encodings or using persisted keys.
|
|
@@ -103,8 +106,8 @@ export const TreeAlpha: {
|
|
|
103
106
|
*
|
|
104
107
|
* When using this function,
|
|
105
108
|
* it is recommend to ensure your schema is unambiguous with {@link ITreeConfigurationOptions.preventAmbiguity}.
|
|
106
|
-
* If the schema is ambiguous, consider using {@link TreeAlpha.create} and {@link Unhydrated} nodes where needed,
|
|
107
|
-
* or using {@link TreeAlpha.(importVerbose:1)} and specify all types.
|
|
109
|
+
* If the schema is ambiguous, consider using {@link (TreeAlpha:interface).create} and {@link Unhydrated} nodes where needed,
|
|
110
|
+
* or using {@link (TreeAlpha:interface).(importVerbose:1)} and specify all types.
|
|
108
111
|
*
|
|
109
112
|
* Documented (and thus recoverable) error handling/reporting for this is not yet implemented,
|
|
110
113
|
* but for now most invalid inputs will throw a recoverable error.
|
|
@@ -123,7 +126,7 @@ export const TreeAlpha: {
|
|
|
123
126
|
/**
|
|
124
127
|
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
125
128
|
* @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
|
|
126
|
-
* @param data - The data used to construct the field content. See {@link TreeAlpha.(exportVerbose:1)}.
|
|
129
|
+
* @param data - The data used to construct the field content. See {@link (TreeAlpha:interface).(exportVerbose:1)}.
|
|
127
130
|
*/
|
|
128
131
|
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
129
132
|
schema: TSchema,
|
|
@@ -149,7 +152,7 @@ export const TreeAlpha: {
|
|
|
149
152
|
* Uses the {@link VerboseTree} format, with an explicit type on every node.
|
|
150
153
|
*
|
|
151
154
|
* @remarks
|
|
152
|
-
* There are several cases this may be preferred to {@link TreeAlpha.(exportConcise:1)}:
|
|
155
|
+
* There are several cases this may be preferred to {@link (TreeAlpha:interface).(exportConcise:1)}:
|
|
153
156
|
*
|
|
154
157
|
* 1. When not using {@link ITreeConfigurationOptions.preventAmbiguity} (or when using `useStableFieldKeys`), `exportConcise` can produce ambiguous data (the type may be unclear on some nodes).
|
|
155
158
|
* `exportVerbose` will always be unambiguous and thus lossless.
|
|
@@ -182,11 +185,11 @@ export const TreeAlpha: {
|
|
|
182
185
|
): JsonCompatible<IFluidHandle>;
|
|
183
186
|
|
|
184
187
|
/**
|
|
185
|
-
* Import data encoded by {@link TreeAlpha.exportCompressed}.
|
|
188
|
+
* Import data encoded by {@link (TreeAlpha:interface).exportCompressed}.
|
|
186
189
|
*
|
|
187
190
|
* @param schema - Schema with which the data must be compatible. This compatibility is not verified and must be ensured by the caller.
|
|
188
|
-
* @param compressedData - Data compressed by {@link TreeAlpha.exportCompressed}.
|
|
189
|
-
* @param options - If {@link TreeAlpha.exportCompressed} was given an `idCompressor`, it must be provided here.
|
|
191
|
+
* @param compressedData - Data compressed by {@link (TreeAlpha:interface).exportCompressed}.
|
|
192
|
+
* @param options - If {@link (TreeAlpha:interface).exportCompressed} was given an `idCompressor`, it must be provided here.
|
|
190
193
|
*
|
|
191
194
|
* @remarks
|
|
192
195
|
* If the data could have been encoded with a different schema, consider encoding the schema along side it using {@link extractPersistedSchema} and loading the data using {@link independentView}.
|
|
@@ -195,7 +198,9 @@ export const TreeAlpha: {
|
|
|
195
198
|
* This API could be improved:
|
|
196
199
|
*
|
|
197
200
|
* 1. It could validate that the schema is compatible, and return or throw an error in the invalid case (maybe add a "try" version).
|
|
201
|
+
*
|
|
198
202
|
* 2. A "try" version of this could return an error if the data isn't in a supported format (as determined by version and/or JasonValidator).
|
|
203
|
+
*
|
|
199
204
|
* 3. Requiring the caller provide a JsonValidator isn't the most friendly API. It might be practical to provide a default.
|
|
200
205
|
*/
|
|
201
206
|
importCompressed<const TSchema extends ImplicitFieldSchema>(
|
|
@@ -203,7 +208,14 @@ export const TreeAlpha: {
|
|
|
203
208
|
compressedData: JsonCompatible<IFluidHandle>,
|
|
204
209
|
options: { idCompressor?: IIdCompressor } & ICodecOptions,
|
|
205
210
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
206
|
-
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Extensions to {@link (Tree:variable)} and {@link (TreeBeta:variable)} which are not yet stable.
|
|
215
|
+
* @see {@link (TreeAlpha:interface)}.
|
|
216
|
+
* @alpha
|
|
217
|
+
*/
|
|
218
|
+
export const TreeAlpha: TreeAlpha = {
|
|
207
219
|
branch(node: TreeNode): TreeBranch | undefined {
|
|
208
220
|
const kernel = getKernel(node);
|
|
209
221
|
if (!kernel.isHydrated()) {
|
|
@@ -302,12 +314,12 @@ export const TreeAlpha: {
|
|
|
302
314
|
idCompressor?: IIdCompressor;
|
|
303
315
|
} & ICodecOptions,
|
|
304
316
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
317
|
+
const config = new TreeViewConfigurationAlpha({ schema });
|
|
305
318
|
const content: ViewContent = {
|
|
306
|
-
schema: extractPersistedSchema(
|
|
319
|
+
schema: extractPersistedSchema(config, currentVersion),
|
|
307
320
|
tree: compressedData,
|
|
308
321
|
idCompressor: options.idCompressor ?? createIdCompressor(),
|
|
309
322
|
};
|
|
310
|
-
const config = new TreeViewConfiguration({ schema });
|
|
311
323
|
const view = independentInitializedView(config, options, content);
|
|
312
324
|
return TreeBeta.clone<TSchema>(view.root);
|
|
313
325
|
},
|
|
@@ -47,7 +47,6 @@ export class BranchCommitEnricher<TChange> {
|
|
|
47
47
|
/**
|
|
48
48
|
* Process the given change, preparing new commits for {@link BranchCommitEnricher.enrich | enrichment}.
|
|
49
49
|
* @param change - The change to process.
|
|
50
|
-
* @param isAttached - Whether or not the SharedTree is attached to the service.
|
|
51
50
|
*/
|
|
52
51
|
public processChange(change: SharedTreeBranchChange<TChange>): void {
|
|
53
52
|
if (change.type === "append") {
|
|
@@ -40,12 +40,15 @@ export class TransactionEnricher<TChange> {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Commits the current transaction.
|
|
43
|
-
* @returns
|
|
43
|
+
* @returns A function which can be used to compute the composed change for that transaction's commits. Undefined if the transaction is still ongoing or contained no committed changes.
|
|
44
44
|
*/
|
|
45
45
|
public commitTransaction(): ((revision: RevisionTag) => TChange) | undefined {
|
|
46
46
|
const commitsCommitted = this.#transactionScopesStart.pop();
|
|
47
47
|
assert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);
|
|
48
48
|
if (this.#transactionScopesStart.length === 0) {
|
|
49
|
+
if (this.#transactionCommits.length === 0) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
49
52
|
const transactionCommits = this.#transactionCommits;
|
|
50
53
|
this.#transactionCommits = [];
|
|
51
54
|
return (revision: RevisionTag) =>
|
|
@@ -21,7 +21,7 @@ import { getUnhydratedContext } from "../createContext.js";
|
|
|
21
21
|
* @remarks
|
|
22
22
|
* This is "concise" meaning that explicit type information is omitted.
|
|
23
23
|
* If the schema is compatible with {@link ITreeConfigurationOptions.preventAmbiguity},
|
|
24
|
-
* types will be lossless and compatible with {@link TreeAlpha.create} (unless the options are used to customize it).
|
|
24
|
+
* types will be lossless and compatible with {@link (TreeAlpha:interface).create} (unless the options are used to customize it).
|
|
25
25
|
*
|
|
26
26
|
* Every {@link TreeNode} is an array or object.
|
|
27
27
|
* Any IFluidHandle values have been replaced by `THandle`.
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type FieldSchemaAlpha,
|
|
11
|
+
type ImplicitFieldSchema,
|
|
12
|
+
FieldKind,
|
|
13
|
+
markSchemaMostDerived,
|
|
14
|
+
normalizeFieldSchema,
|
|
15
|
+
} from "../schemaTypes.js";
|
|
16
|
+
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
17
|
+
import { toStoredSchema } from "../toStoredSchema.js";
|
|
18
|
+
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
19
|
+
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
20
|
+
import { getOrCreate } from "../../util/index.js";
|
|
21
|
+
import type { MakeNominal } from "../../util/index.js";
|
|
22
|
+
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
23
|
+
import type { SimpleNodeSchema, SimpleTreeSchema } from "../simpleSchema.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Options when constructing a tree view.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export interface ITreeConfigurationOptions {
|
|
30
|
+
/**
|
|
31
|
+
* If `true`, the tree will validate new content against its stored schema at insertion time
|
|
32
|
+
* and throw an error if the new content doesn't match the expected schema.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue `false`.
|
|
35
|
+
*
|
|
36
|
+
* @remarks Enabling schema validation has a performance penalty when inserting new content into the tree because
|
|
37
|
+
* additional checks are done. Enable this option only in scenarios where you are ok with that operation being a
|
|
38
|
+
* bit slower.
|
|
39
|
+
*/
|
|
40
|
+
enableSchemaValidation?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 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.
|
|
44
|
+
* @defaultValue `false`.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* 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.
|
|
48
|
+
*
|
|
49
|
+
* This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.
|
|
50
|
+
* 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.
|
|
51
|
+
* 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).
|
|
52
|
+
* Currently these cases can cause ambiguity in a union:
|
|
53
|
+
*
|
|
54
|
+
* - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).
|
|
55
|
+
*
|
|
56
|
+
* - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).
|
|
57
|
+
*
|
|
58
|
+
* - 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.
|
|
59
|
+
*
|
|
60
|
+
* - 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.
|
|
61
|
+
*
|
|
62
|
+
* - 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.
|
|
63
|
+
*
|
|
64
|
+
* This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.
|
|
65
|
+
* This check may become more permissive over time.
|
|
66
|
+
*
|
|
67
|
+
* @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const schemaFactory = new SchemaFactory("com.example");
|
|
70
|
+
* class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
|
|
71
|
+
* class Meters extends schemaFactory.object("Meters", { length: schemaFactory.number }) {}
|
|
72
|
+
* const config = new TreeViewConfiguration({
|
|
73
|
+
* // This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.
|
|
74
|
+
* schema: [Feet, Meters],
|
|
75
|
+
* preventAmbiguity: false,
|
|
76
|
+
* });
|
|
77
|
+
* const view = tree.viewWith(config);
|
|
78
|
+
* // This is invalid since it is ambiguous which type of node is being constructed:
|
|
79
|
+
* // view.initialize({ length: 5 });
|
|
80
|
+
* // To work, an explicit type can be provided by using an {@link Unhydrated} Node:
|
|
81
|
+
* view.initialize(new Meters({ length: 5 }));
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const schemaFactory = new SchemaFactory("com.example");
|
|
87
|
+
* class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
|
|
88
|
+
* class Meters extends schemaFactory.object("Meters", {
|
|
89
|
+
* // To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to "meters".
|
|
90
|
+
* // To preserve compatibility with existing data from the ambiguous case,
|
|
91
|
+
* // `{ key: "length" }` is set, so when persisted in the tree "length" is used as the field name.
|
|
92
|
+
* meters: schemaFactory.required(schemaFactory.number, { key: "length" }),
|
|
93
|
+
* }) {}
|
|
94
|
+
* const config = new TreeViewConfiguration({
|
|
95
|
+
* // This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.
|
|
96
|
+
* schema: [Feet, Meters],
|
|
97
|
+
* preventAmbiguity: true,
|
|
98
|
+
* });
|
|
99
|
+
* const view = tree.viewWith(config);
|
|
100
|
+
* // This now works, since the field is sufficient to determine this is a `Meters` node.
|
|
101
|
+
* view.initialize({ meters: 5 });
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @privateRemarks
|
|
105
|
+
* In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.
|
|
106
|
+
* 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.
|
|
107
|
+
*
|
|
108
|
+
* To make this more permissive in the future we can:
|
|
109
|
+
*
|
|
110
|
+
* - Make toMapTree more permissive (ex: allow disambiguation based on leaf type)
|
|
111
|
+
* - Update this check to more tightly match toMapTree
|
|
112
|
+
* - Add options to help schema authors disambiguate their types, such as "constant fields" which are not persisted, and always have a constant value.
|
|
113
|
+
*
|
|
114
|
+
* The above examples exist in executable form in this files tests, and should be updated there then copied back here.
|
|
115
|
+
*/
|
|
116
|
+
readonly preventAmbiguity?: boolean;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const defaultTreeConfigurationOptions: Required<ITreeConfigurationOptions> = {
|
|
120
|
+
enableSchemaValidation: false,
|
|
121
|
+
preventAmbiguity: false,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Property-bag configuration for {@link TreeViewConfiguration} construction.
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export interface ITreeViewConfiguration<
|
|
129
|
+
TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
|
|
130
|
+
> extends ITreeConfigurationOptions {
|
|
131
|
+
/**
|
|
132
|
+
* The schema which the application wants to view the tree with.
|
|
133
|
+
*/
|
|
134
|
+
readonly schema: TSchema;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Configuration for {@link ViewableTree.viewWith}.
|
|
139
|
+
* @sealed @public
|
|
140
|
+
*/
|
|
141
|
+
export class TreeViewConfiguration<
|
|
142
|
+
const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
|
|
143
|
+
> implements Required<ITreeViewConfiguration<TSchema>>
|
|
144
|
+
{
|
|
145
|
+
protected _typeCheck!: MakeNominal;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* {@inheritDoc ITreeViewConfiguration.schema}
|
|
149
|
+
*/
|
|
150
|
+
public readonly schema: TSchema;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}
|
|
154
|
+
*/
|
|
155
|
+
public readonly enableSchemaValidation: boolean;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}
|
|
159
|
+
*/
|
|
160
|
+
public readonly preventAmbiguity: boolean;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Construct a new {@link TreeViewConfiguration}.
|
|
164
|
+
*
|
|
165
|
+
* @param props - Property bag of configuration options.
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* Performing this construction deeply validates the provided schema.
|
|
169
|
+
* This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).
|
|
170
|
+
* This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.
|
|
171
|
+
*
|
|
172
|
+
* For example, a schema reachable from this configuration cannot reference this configuration during its declaration,
|
|
173
|
+
* since this would be a cyclic dependency that will cause an error when constructing this configuration.
|
|
174
|
+
*/
|
|
175
|
+
public constructor(props: ITreeViewConfiguration<TSchema>) {
|
|
176
|
+
const config = { ...defaultTreeConfigurationOptions, ...props };
|
|
177
|
+
this.schema = config.schema;
|
|
178
|
+
this.enableSchemaValidation = config.enableSchemaValidation;
|
|
179
|
+
this.preventAmbiguity = config.preventAmbiguity;
|
|
180
|
+
|
|
181
|
+
// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.
|
|
182
|
+
const ambiguityErrors: string[] = [];
|
|
183
|
+
|
|
184
|
+
walkFieldSchema(config.schema, {
|
|
185
|
+
// Ensure all reachable schema are marked as most derived.
|
|
186
|
+
// This ensures if multiple schema extending the same schema factory generated class are present (or have been constructed, or get constructed in the future),
|
|
187
|
+
// an error is reported.
|
|
188
|
+
|
|
189
|
+
node: (schema) => markSchemaMostDerived(schema, true),
|
|
190
|
+
allowedTypes(types): void {
|
|
191
|
+
if (config.preventAmbiguity) {
|
|
192
|
+
checkUnion(types, ambiguityErrors);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (ambiguityErrors.length !== 0) {
|
|
198
|
+
// Duplicate errors are common since when two types conflict, both orders error:
|
|
199
|
+
const deduplicated = new Set(ambiguityErrors);
|
|
200
|
+
throw new UsageError(`Ambiguous schema found:\n${[...deduplicated].join("\n")}`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Eagerly perform this conversion to surface errors sooner.
|
|
204
|
+
toStoredSchema(config.schema);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* {@link TreeViewConfiguration} extended with some alpha APIs.
|
|
210
|
+
* @sealed @alpha
|
|
211
|
+
*/
|
|
212
|
+
export class TreeViewConfigurationAlpha<
|
|
213
|
+
const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
|
|
214
|
+
>
|
|
215
|
+
extends TreeViewConfiguration<TSchema>
|
|
216
|
+
implements TreeSchema
|
|
217
|
+
{
|
|
218
|
+
/**
|
|
219
|
+
* {@inheritDoc TreeSchema.root}
|
|
220
|
+
*/
|
|
221
|
+
public readonly root: FieldSchemaAlpha;
|
|
222
|
+
/**
|
|
223
|
+
* {@inheritDoc TreeSchema.definitions}
|
|
224
|
+
*/
|
|
225
|
+
public readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
|
|
226
|
+
|
|
227
|
+
public constructor(props: ITreeViewConfiguration<TSchema>) {
|
|
228
|
+
super(props);
|
|
229
|
+
this.root = normalizeFieldSchema(props.schema);
|
|
230
|
+
const definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();
|
|
231
|
+
walkFieldSchema(props.schema, {
|
|
232
|
+
node: (schema) =>
|
|
233
|
+
definitions.set(schema.identifier, schema as SimpleNodeSchema & TreeNodeSchema),
|
|
234
|
+
});
|
|
235
|
+
this.definitions = definitions;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* {@link TreeViewConfigurationAlpha}
|
|
241
|
+
* @sealed @alpha
|
|
242
|
+
*/
|
|
243
|
+
export interface TreeSchema extends SimpleTreeSchema {
|
|
244
|
+
/**
|
|
245
|
+
* {@inheritDoc SimpleTreeSchema.root}
|
|
246
|
+
*/
|
|
247
|
+
readonly root: FieldSchemaAlpha;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* {@inheritDoc SimpleTreeSchema.definitions}
|
|
251
|
+
*/
|
|
252
|
+
readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Pretty print a set of types for use in error messages.
|
|
257
|
+
*/
|
|
258
|
+
function formatTypes(allowed: Iterable<TreeNodeSchema>): string {
|
|
259
|
+
// Use JSON.stringify to quote and escape identifiers.
|
|
260
|
+
// Don't just use a single array JSON.stringify since that omits spaces between items
|
|
261
|
+
return `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(", ")}]`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}.
|
|
266
|
+
*/
|
|
267
|
+
export function checkUnion(union: Iterable<TreeNodeSchema>, errors: string[]): void {
|
|
268
|
+
const checked: Set<TreeNodeSchema> = new Set();
|
|
269
|
+
const maps: TreeNodeSchema[] = [];
|
|
270
|
+
const arrays: TreeNodeSchema[] = [];
|
|
271
|
+
|
|
272
|
+
const objects: ObjectNodeSchema[] = [];
|
|
273
|
+
// Map from key to schema using that key
|
|
274
|
+
const allObjectKeys: Map<string, Set<TreeNodeSchema>> = new Map();
|
|
275
|
+
|
|
276
|
+
for (const schema of union) {
|
|
277
|
+
if (checked.has(schema)) {
|
|
278
|
+
throw new UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);
|
|
279
|
+
}
|
|
280
|
+
checked.add(schema);
|
|
281
|
+
|
|
282
|
+
if (schema instanceof LeafNodeSchema) {
|
|
283
|
+
// nothing to do
|
|
284
|
+
} else if (isObjectNodeSchema(schema)) {
|
|
285
|
+
objects.push(schema);
|
|
286
|
+
for (const key of schema.fields.keys()) {
|
|
287
|
+
getOrCreate(allObjectKeys, key, () => new Set()).add(schema);
|
|
288
|
+
}
|
|
289
|
+
} else if (schema.kind === NodeKind.Array) {
|
|
290
|
+
arrays.push(schema);
|
|
291
|
+
} else {
|
|
292
|
+
assert(schema.kind === NodeKind.Map, 0x9e7 /* invalid schema */);
|
|
293
|
+
maps.push(schema);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (arrays.length > 1) {
|
|
298
|
+
errors.push(
|
|
299
|
+
`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.`,
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (maps.length > 1) {
|
|
304
|
+
errors.push(
|
|
305
|
+
`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.`,
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (maps.length > 0 && arrays.length > 0) {
|
|
310
|
+
errors.push(
|
|
311
|
+
`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.`,
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (objects.length > 0 && maps.length > 0) {
|
|
316
|
+
errors.push(
|
|
317
|
+
`Both a object and a map allowed within union (${formatTypes([...objects, ...maps])}). Both can be constructed from objects and can be ambiguous.`,
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Check for objects which fully overlap:
|
|
322
|
+
for (const schema of objects) {
|
|
323
|
+
// All objects which might be ambiguous relative to `schema`.
|
|
324
|
+
const possiblyAmbiguous = new Set(objects);
|
|
325
|
+
|
|
326
|
+
// A schema can't be ambiguous with itself
|
|
327
|
+
possiblyAmbiguous.delete(schema);
|
|
328
|
+
|
|
329
|
+
// For each field of schema, remove schema from possiblyAmbiguous that do not have that field
|
|
330
|
+
for (const [key, field] of schema.fields) {
|
|
331
|
+
if (field.kind === FieldKind.Required) {
|
|
332
|
+
const withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);
|
|
333
|
+
for (const candidate of possiblyAmbiguous) {
|
|
334
|
+
if (!withKey.has(candidate)) {
|
|
335
|
+
possiblyAmbiguous.delete(candidate);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (possiblyAmbiguous.size > 0) {
|
|
342
|
+
// TODO: make this check more permissive.
|
|
343
|
+
// Allow using the type of the field to disambiguate, at least for leaf types.
|
|
344
|
+
// Add "constant" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?
|
|
345
|
+
// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).
|
|
346
|
+
// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/toMapTree.ts.
|
|
347
|
+
|
|
348
|
+
errors.push(
|
|
349
|
+
`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.`,
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -7,7 +7,7 @@ import type { JsonTreeSchema } from "./jsonSchema.js";
|
|
|
7
7
|
import type { ImplicitAllowedTypes } from "../schemaTypes.js";
|
|
8
8
|
import { toJsonSchema } from "./simpleSchemaToJsonSchema.js";
|
|
9
9
|
import type { TreeEncodingOptions } from "./customTree.js";
|
|
10
|
-
import { TreeViewConfigurationAlpha } from "./
|
|
10
|
+
import { TreeViewConfigurationAlpha } from "./configuration.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Options for how to interpret or encode a tree when schema information is available.
|
|
@@ -3,33 +3,40 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
export type {
|
|
7
|
+
TreeSchema,
|
|
8
|
+
ITreeViewConfiguration,
|
|
9
|
+
ITreeConfigurationOptions,
|
|
10
|
+
} from "./configuration.js";
|
|
6
11
|
export {
|
|
7
|
-
type ITree,
|
|
8
|
-
type TreeView,
|
|
9
|
-
type ViewableTree,
|
|
10
|
-
type TreeViewEvents,
|
|
11
12
|
TreeViewConfiguration,
|
|
12
13
|
TreeViewConfigurationAlpha,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
} from "./configuration.js";
|
|
15
|
+
export type {
|
|
16
|
+
ITree,
|
|
17
|
+
TreeView,
|
|
18
|
+
ViewableTree,
|
|
19
|
+
TreeViewEvents,
|
|
20
|
+
SchemaCompatibilityStatus,
|
|
21
|
+
TreeViewAlpha,
|
|
22
|
+
TreeBranch,
|
|
23
|
+
TreeBranchEvents,
|
|
24
|
+
ITreeAlpha,
|
|
22
25
|
} from "./tree.js";
|
|
26
|
+
export { asTreeViewAlpha } from "./tree.js";
|
|
23
27
|
export {
|
|
24
28
|
SchemaFactory,
|
|
25
29
|
type ScopedSchemaName,
|
|
26
30
|
type SchemaFactoryObjectOptions,
|
|
27
31
|
type SchemaStatics,
|
|
32
|
+
schemaStatics,
|
|
28
33
|
} from "./schemaFactory.js";
|
|
29
34
|
export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
|
|
30
35
|
export type {
|
|
31
36
|
ValidateRecursiveSchema,
|
|
32
37
|
FixRecursiveArraySchema,
|
|
38
|
+
ValidateRecursiveSchemaTemplate,
|
|
39
|
+
FixRecursiveRecursionLimit,
|
|
33
40
|
} from "./schemaFactoryRecursive.js";
|
|
34
41
|
export { allowUnused } from "./schemaFactoryRecursive.js";
|
|
35
42
|
export {
|
|
@@ -57,7 +64,7 @@ export {
|
|
|
57
64
|
export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
|
|
58
65
|
export { getJsonSchema } from "./getJsonSchema.js";
|
|
59
66
|
export { getSimpleSchema } from "./getSimpleSchema.js";
|
|
60
|
-
export {
|
|
67
|
+
export { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
|
|
61
68
|
export type {
|
|
62
69
|
Unenforced,
|
|
63
70
|
FieldSchemaAlphaUnsafe,
|
|
@@ -91,7 +98,7 @@ export {
|
|
|
91
98
|
replaceConciseTreeHandles,
|
|
92
99
|
} from "./conciseTree.js";
|
|
93
100
|
|
|
94
|
-
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./
|
|
101
|
+
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeBeta.js";
|
|
95
102
|
export { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
|
|
96
103
|
export {
|
|
97
104
|
createIdentifierIndex,
|
|
@@ -119,6 +126,7 @@ export {
|
|
|
119
126
|
|
|
120
127
|
export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
|
|
121
128
|
export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
|
|
129
|
+
export type { TreeChangeEvents } from "./treeChangeEvents.js";
|
|
122
130
|
|
|
123
131
|
// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
|
|
124
132
|
// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
|
|
@@ -22,37 +22,30 @@ import {
|
|
|
22
22
|
fieldRealizer,
|
|
23
23
|
comparePosetElements,
|
|
24
24
|
} from "../../feature-libraries/index.js";
|
|
25
|
-
import {
|
|
26
|
-
normalizeFieldSchema,
|
|
27
|
-
type FieldSchema,
|
|
28
|
-
type ImplicitFieldSchema,
|
|
29
|
-
} from "../schemaTypes.js";
|
|
25
|
+
import type { FieldSchema } from "../schemaTypes.js";
|
|
30
26
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
31
27
|
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
* A collection of View information for schema, including policy.
|
|
31
|
+
* @remarks
|
|
32
|
+
* This contains everything needed to determine compatibility with a given stored schema.
|
|
35
33
|
*/
|
|
36
|
-
export class
|
|
34
|
+
export class SchemaCompatibilityTester {
|
|
37
35
|
/**
|
|
38
36
|
* Cached conversion of the view schema in the stored schema format.
|
|
39
37
|
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Normalized view schema (implicitly allowed view schema types are converted to their canonical form).
|
|
43
|
-
*/
|
|
44
|
-
public readonly schema: FieldSchema;
|
|
38
|
+
public readonly viewSchemaAsStored: TreeStoredSchema;
|
|
45
39
|
|
|
46
40
|
/**
|
|
47
|
-
* @param
|
|
41
|
+
* @param viewSchemaRoot - Schema for the root field.
|
|
48
42
|
*/
|
|
49
43
|
public constructor(
|
|
50
44
|
public readonly policy: FullSchemaPolicy,
|
|
51
45
|
public readonly adapters: Adapters,
|
|
52
|
-
|
|
46
|
+
viewSchemaRoot: FieldSchema,
|
|
53
47
|
) {
|
|
54
|
-
this.
|
|
55
|
-
this.viewSchemaAsStored = toStoredSchema(this.schema);
|
|
48
|
+
this.viewSchemaAsStored = toStoredSchema(viewSchemaRoot);
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
/**
|