@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,13 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
7
|
import type { ErasedType } from "@fluidframework/core-interfaces";
|
|
9
8
|
|
|
10
|
-
import { NodeKind, type TreeNodeSchemaClass } from "./treeNodeSchema.js";
|
|
11
|
-
// eslint-disable-next-line import/no-deprecated
|
|
12
|
-
import { type WithType, typeNameSymbol, type typeSchemaSymbol } from "./withType.js";
|
|
13
|
-
import { tryGetTreeNodeSchema } from "./treeNodeKernel.js";
|
|
14
9
|
import { isFlexTreeNode, type FlexTreeNode } from "../../feature-libraries/index.js";
|
|
15
10
|
|
|
16
11
|
/**
|
|
@@ -29,235 +24,6 @@ import { isFlexTreeNode, type FlexTreeNode } from "../../feature-libraries/index
|
|
|
29
24
|
*/
|
|
30
25
|
export type Unhydrated<T> = T;
|
|
31
26
|
|
|
32
|
-
/**
|
|
33
|
-
* A collection of events that can be emitted by a {@link TreeNode}.
|
|
34
|
-
*
|
|
35
|
-
* @privateRemarks
|
|
36
|
-
* TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).
|
|
37
|
-
* Probably have object node and map node specific APIs for this.
|
|
38
|
-
*
|
|
39
|
-
* TODO: ensure that subscription API for fields aligns with API for subscribing to the root.
|
|
40
|
-
*
|
|
41
|
-
* TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.
|
|
42
|
-
* Some ideas:
|
|
43
|
-
*
|
|
44
|
-
* - treeChanged, but with some subtrees/fields/paths excluded
|
|
45
|
-
* - helper to batch several nodeChanged calls to a treeChanged scope
|
|
46
|
-
* - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)
|
|
47
|
-
* - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.
|
|
48
|
-
* Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)
|
|
49
|
-
* to allow efficiently searching for new content (and initial content) of a given type.
|
|
50
|
-
*
|
|
51
|
-
* @sealed @public
|
|
52
|
-
*/
|
|
53
|
-
export interface TreeChangeEvents {
|
|
54
|
-
/**
|
|
55
|
-
* Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.
|
|
56
|
-
*
|
|
57
|
-
* - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).
|
|
58
|
-
*
|
|
59
|
-
* - Array nodes define a change as when an element is added, removed, moved or replaced.
|
|
60
|
-
*
|
|
61
|
-
* - Map nodes define a change as when an entry is added, updated, or removed.
|
|
62
|
-
*
|
|
63
|
-
* @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.
|
|
64
|
-
* users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.
|
|
65
|
-
* This parameter exists to capture this fact in the type system.
|
|
66
|
-
* Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
* This event is not emitted when:
|
|
70
|
-
*
|
|
71
|
-
* - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing
|
|
72
|
-
* elements/entries) will emit this event on the array/map node itself, but not on the node that contains the
|
|
73
|
-
* array/map node as one of its properties.
|
|
74
|
-
*
|
|
75
|
-
* - The node is moved to a different location in the tree or removed from the tree.
|
|
76
|
-
* In this case the event is emitted on the _parent_ node, not the node itself.
|
|
77
|
-
*
|
|
78
|
-
* For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in
|
|
79
|
-
* the client that made the original edit.
|
|
80
|
-
*
|
|
81
|
-
* When the event is emitted, the tree is guaranteed to be in-schema.
|
|
82
|
-
*
|
|
83
|
-
* @privateRemarks
|
|
84
|
-
* This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.
|
|
85
|
-
* For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the
|
|
86
|
-
* node, or when the node has to be updated due to resolution of a merge conflict
|
|
87
|
-
* (for example a previously applied local change might be undone, then reapplied differently or not at all).
|
|
88
|
-
*
|
|
89
|
-
* TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).
|
|
90
|
-
*/
|
|
91
|
-
nodeChanged(unstable?: unknown): void;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the
|
|
95
|
-
* subtree rooted at it.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.
|
|
99
|
-
* In that case it is emitted on the _parent_ node, not the node itself.
|
|
100
|
-
*
|
|
101
|
-
* The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties
|
|
102
|
-
* of the node itself.
|
|
103
|
-
*
|
|
104
|
-
* For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in
|
|
105
|
-
* the client that made the original edit.
|
|
106
|
-
*
|
|
107
|
-
* When it is emitted, the tree is guaranteed to be in-schema.
|
|
108
|
-
*/
|
|
109
|
-
treeChanged(): void;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
|
|
114
|
-
*
|
|
115
|
-
* @remarks
|
|
116
|
-
* Base type which all nodes extend.
|
|
117
|
-
*
|
|
118
|
-
* This type can be used as a type to indicate/document values which should be tree nodes.
|
|
119
|
-
* Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.
|
|
120
|
-
*
|
|
121
|
-
* There are three ways to get instances of TreeNode:
|
|
122
|
-
*
|
|
123
|
-
* 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.
|
|
124
|
-
* This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.
|
|
125
|
-
* 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.
|
|
126
|
-
* Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.
|
|
127
|
-
* 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.
|
|
128
|
-
* These APIs internally call the constructor with the provided value, so it's really just a special case of the above option.
|
|
129
|
-
* Note that when constructing nodes, sometimes implicit construction is not allowed
|
|
130
|
-
* (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):
|
|
131
|
-
* in such cases, explicit construction must be used.
|
|
132
|
-
*
|
|
133
|
-
* @privateRemarks
|
|
134
|
-
* This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})
|
|
135
|
-
* and some runtime enforcement of schema class policy (see the the validation in the constructor).
|
|
136
|
-
* This class is however only `type` exported not value exported, preventing the class object from being used,
|
|
137
|
-
* similar to how interfaces work.
|
|
138
|
-
*
|
|
139
|
-
* Not all node implementations include this in their prototype chain (some hide it with a proxy),
|
|
140
|
-
* and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.
|
|
141
|
-
* This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.
|
|
142
|
-
* For now the type-only export prevents use of `instanceof` on this class (but allows it in subclasses like schema classes).
|
|
143
|
-
* @sealed @public
|
|
144
|
-
*/
|
|
145
|
-
export abstract class TreeNode implements WithType {
|
|
146
|
-
/**
|
|
147
|
-
* This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.
|
|
148
|
-
* @remarks
|
|
149
|
-
* This field forces TypeScript to use nominal instead of structural typing,
|
|
150
|
-
* preventing compiler error messages and tools like "add missing properties"
|
|
151
|
-
* from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.
|
|
152
|
-
* Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.
|
|
153
|
-
*
|
|
154
|
-
* @privateRemarks
|
|
155
|
-
* This is a JavaScript private field, so is not accessible from outside this class.
|
|
156
|
-
* This prevents it from having name collisions with object fields.
|
|
157
|
-
* Since this is private, the type of this field is stripped in the d.ts file.
|
|
158
|
-
* To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.
|
|
159
|
-
* To avoid this having any runtime impact, the field is uninitialized.
|
|
160
|
-
*
|
|
161
|
-
* Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.
|
|
162
|
-
* This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.
|
|
163
|
-
* To avoid all this mess, this field is required, not optional.
|
|
164
|
-
*
|
|
165
|
-
* Another option would be to use a symbol (possibly as a private field).
|
|
166
|
-
* That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.
|
|
167
|
-
*
|
|
168
|
-
* The [type] symbol provides a lot of the value this private brand does, but is not all of it:
|
|
169
|
-
* someone could manually (or via Intellisense auto-implement completion, or in response to a type error)
|
|
170
|
-
* make an object literal with the [type] field and pass it off as a node: this private brand prevents that.
|
|
171
|
-
*/
|
|
172
|
-
readonly #brand!: unknown;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Adds a type symbol for stronger typing.
|
|
176
|
-
* @privateRemarks
|
|
177
|
-
* Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.
|
|
178
|
-
* @deprecated Use {@link typeSchemaSymbol} instead.
|
|
179
|
-
*/
|
|
180
|
-
// eslint-disable-next-line import/no-deprecated
|
|
181
|
-
public abstract get [typeNameSymbol](): string;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Adds a type symbol for stronger typing.
|
|
185
|
-
* @privateRemarks
|
|
186
|
-
* Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.
|
|
187
|
-
*/
|
|
188
|
-
public abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Provides `instanceof` support for testing if a value is a `TreeNode`.
|
|
192
|
-
* @remarks
|
|
193
|
-
* For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.
|
|
194
|
-
* @privateRemarks
|
|
195
|
-
* Due to type-only export, this functionality is not available outside the package.
|
|
196
|
-
*/
|
|
197
|
-
public static [Symbol.hasInstance](value: unknown): value is TreeNode;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Provides `instanceof` support for all schema classes with public constructors.
|
|
201
|
-
* @remarks
|
|
202
|
-
* For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.
|
|
203
|
-
* @privateRemarks
|
|
204
|
-
* Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.
|
|
205
|
-
*/
|
|
206
|
-
public static [Symbol.hasInstance]<
|
|
207
|
-
TSchema extends abstract new (
|
|
208
|
-
...args: any[]
|
|
209
|
-
) => TreeNode,
|
|
210
|
-
>(this: TSchema, value: unknown): value is InstanceType<TSchema>;
|
|
211
|
-
|
|
212
|
-
public static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {
|
|
213
|
-
const schema = tryGetTreeNodeSchema(value);
|
|
214
|
-
|
|
215
|
-
if (schema === undefined || schema.kind === NodeKind.Leaf) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
assert("prototype" in schema, 0x98a /* expected class based schema */);
|
|
220
|
-
return inPrototypeChain(schema.prototype, this.prototype);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.
|
|
225
|
-
* @privateRemarks
|
|
226
|
-
* `token` must be the {@link privateToken} value, which is not package exported.
|
|
227
|
-
* This is used to detect invalid subclasses.
|
|
228
|
-
*
|
|
229
|
-
* All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.
|
|
230
|
-
*/
|
|
231
|
-
protected constructor(token: unknown) {
|
|
232
|
-
if (token !== privateToken) {
|
|
233
|
-
throw new UsageError("TreeNodes must extend schema classes created by SchemaFactory");
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.
|
|
240
|
-
*/
|
|
241
|
-
export const privateToken = {};
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Check if the prototype derived's prototype chain contains `base`.
|
|
245
|
-
* @param derived - prototype to check
|
|
246
|
-
* @param base - prototype to search for
|
|
247
|
-
* @returns true iff `base` is in the prototype chain starting at `derived`.
|
|
248
|
-
*/
|
|
249
|
-
// eslint-disable-next-line @rushstack/no-new-null
|
|
250
|
-
export function inPrototypeChain(derived: object | null, base: object): boolean {
|
|
251
|
-
let checking = derived;
|
|
252
|
-
while (checking !== null) {
|
|
253
|
-
if (base === checking) {
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
checking = Reflect.getPrototypeOf(checking);
|
|
257
|
-
}
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
27
|
/**
|
|
262
28
|
* A node type internal to `@fluidframework/tree`.
|
|
263
29
|
* @remarks
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ export {
|
|
|
12
12
|
type TreeNodeSchemaClass,
|
|
13
13
|
type TreeNodeSchemaNonClass,
|
|
14
14
|
type TreeNodeSchemaCore,
|
|
15
|
-
type TreeChangeEvents,
|
|
16
15
|
// TreeNode is only type exported, which prevents use of the class object for unsupported use-cases like direct sub-classing and instanceof.
|
|
17
16
|
// See docs on TreeNode for more details.
|
|
18
17
|
type TreeNode,
|
|
@@ -81,7 +80,7 @@ export {
|
|
|
81
80
|
comparePersistedSchema,
|
|
82
81
|
type ConciseTree,
|
|
83
82
|
comparePersistedSchemaInternal,
|
|
84
|
-
|
|
83
|
+
SchemaCompatibilityTester,
|
|
85
84
|
type Unenforced,
|
|
86
85
|
type System_Unsafe,
|
|
87
86
|
type ArrayNodeCustomizableSchemaUnsafe,
|
|
@@ -120,6 +119,10 @@ export {
|
|
|
120
119
|
allowUnused,
|
|
121
120
|
type FieldSchemaAlphaUnsafe,
|
|
122
121
|
type TreeSchema,
|
|
122
|
+
type ValidateRecursiveSchemaTemplate,
|
|
123
|
+
type FixRecursiveRecursionLimit,
|
|
124
|
+
schemaStatics,
|
|
125
|
+
type TreeChangeEvents,
|
|
123
126
|
} from "./api/index.js";
|
|
124
127
|
export type {
|
|
125
128
|
SimpleTreeSchema,
|
|
@@ -135,13 +138,26 @@ export type {
|
|
|
135
138
|
export {
|
|
136
139
|
type NodeFromSchema,
|
|
137
140
|
isTreeNodeSchemaClass,
|
|
141
|
+
type AnnotatedAllowedType,
|
|
142
|
+
type AnnotatedAllowedTypes,
|
|
138
143
|
type ImplicitFieldSchema,
|
|
144
|
+
type ImplicitAnnotatedFieldSchema,
|
|
139
145
|
type TreeFieldFromImplicitField,
|
|
140
146
|
type ImplicitAllowedTypes,
|
|
147
|
+
type ImplicitAnnotatedAllowedTypes,
|
|
148
|
+
type UnannotateImplicitAllowedTypes,
|
|
149
|
+
type UnannotateAllowedTypes,
|
|
150
|
+
type UnannotateAllowedType,
|
|
151
|
+
type UnannotateAllowedTypesList,
|
|
152
|
+
type UnannotateAllowedTypeOrLazyItem,
|
|
153
|
+
type UnannotateImplicitFieldSchema,
|
|
154
|
+
type UnannotateSchemaRecord,
|
|
141
155
|
type TreeNodeFromImplicitAllowedTypes,
|
|
142
156
|
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
143
157
|
type TreeLeafValue,
|
|
144
158
|
type AllowedTypes,
|
|
159
|
+
type AllowedTypeMetadata,
|
|
160
|
+
type AllowedTypesMetadata,
|
|
145
161
|
FieldKind,
|
|
146
162
|
FieldSchema,
|
|
147
163
|
type FieldSchemaAlpha,
|
|
@@ -191,6 +207,7 @@ export {
|
|
|
191
207
|
type FieldHasDefault,
|
|
192
208
|
type InsertableObjectFromSchemaRecord,
|
|
193
209
|
type ObjectFromSchemaRecord,
|
|
210
|
+
type InsertableObjectFromAnnotatedSchemaRecord,
|
|
194
211
|
type TreeObjectNode,
|
|
195
212
|
setField,
|
|
196
213
|
createUnknownOptionalFieldPolicy,
|
|
@@ -15,10 +15,13 @@ import {
|
|
|
15
15
|
createFieldSchema,
|
|
16
16
|
FieldKind,
|
|
17
17
|
normalizeAllowedTypes,
|
|
18
|
+
unannotateImplicitAllowedTypes,
|
|
18
19
|
type ImplicitAllowedTypes,
|
|
20
|
+
type ImplicitAnnotatedAllowedTypes,
|
|
19
21
|
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
20
22
|
type NodeSchemaMetadata,
|
|
21
23
|
type TreeNodeFromImplicitAllowedTypes,
|
|
24
|
+
type UnannotateImplicitAllowedTypes,
|
|
22
25
|
} from "./schemaTypes.js";
|
|
23
26
|
import {
|
|
24
27
|
getKernel,
|
|
@@ -233,7 +236,7 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
233
236
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
234
237
|
export function mapSchema<
|
|
235
238
|
TName extends string,
|
|
236
|
-
const T extends
|
|
239
|
+
const T extends ImplicitAnnotatedAllowedTypes,
|
|
237
240
|
const ImplicitlyConstructable extends boolean,
|
|
238
241
|
const TCustomMetadata = unknown,
|
|
239
242
|
>(
|
|
@@ -243,14 +246,19 @@ export function mapSchema<
|
|
|
243
246
|
useMapPrototype: boolean,
|
|
244
247
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
245
248
|
) {
|
|
246
|
-
const lazyChildTypes = new Lazy(() =>
|
|
249
|
+
const lazyChildTypes = new Lazy(() =>
|
|
250
|
+
normalizeAllowedTypes(unannotateImplicitAllowedTypes(info)),
|
|
251
|
+
);
|
|
247
252
|
const lazyAllowedTypesIdentifiers = new Lazy(
|
|
248
253
|
() => new Set([...lazyChildTypes.value].map((type) => type.identifier)),
|
|
249
254
|
);
|
|
250
255
|
|
|
251
256
|
let unhydratedContext: Context;
|
|
252
257
|
|
|
253
|
-
class Schema
|
|
258
|
+
class Schema
|
|
259
|
+
extends CustomMapNodeBase<UnannotateImplicitAllowedTypes<T>>
|
|
260
|
+
implements TreeMapNode<UnannotateImplicitAllowedTypes<T>>
|
|
261
|
+
{
|
|
254
262
|
public static override prepareInstance<T2>(
|
|
255
263
|
this: typeof TreeNodeValid<T2>,
|
|
256
264
|
instance: TreeNodeValid<T2>,
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { MapNodeInsertableData, TreeMapNode } from "./mapNode.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
ImplicitAnnotatedAllowedTypes,
|
|
9
|
+
UnannotateImplicitAllowedTypes,
|
|
10
|
+
} from "./schemaTypes.js";
|
|
8
11
|
import {
|
|
9
12
|
NodeKind,
|
|
10
13
|
type TreeNodeSchemaClass,
|
|
@@ -21,14 +24,14 @@ import type { SimpleMapNodeSchema } from "./simpleSchema.js";
|
|
|
21
24
|
*/
|
|
22
25
|
export interface MapNodeCustomizableSchema<
|
|
23
26
|
out TName extends string = string,
|
|
24
|
-
in out T extends
|
|
27
|
+
in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes,
|
|
25
28
|
out ImplicitlyConstructable extends boolean = true,
|
|
26
29
|
out TCustomMetadata = unknown,
|
|
27
30
|
> extends TreeNodeSchemaClass<
|
|
28
31
|
TName,
|
|
29
32
|
NodeKind.Map,
|
|
30
|
-
TreeMapNode<T
|
|
31
|
-
MapNodeInsertableData<T
|
|
33
|
+
TreeMapNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Map, T>,
|
|
34
|
+
MapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>,
|
|
32
35
|
ImplicitlyConstructable,
|
|
33
36
|
T,
|
|
34
37
|
undefined,
|
|
@@ -42,14 +45,14 @@ export interface MapNodeCustomizableSchema<
|
|
|
42
45
|
*/
|
|
43
46
|
export interface MapNodePojoEmulationSchema<
|
|
44
47
|
out TName extends string = string,
|
|
45
|
-
in out T extends
|
|
48
|
+
in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes,
|
|
46
49
|
out ImplicitlyConstructable extends boolean = true,
|
|
47
50
|
out TCustomMetadata = unknown,
|
|
48
51
|
> extends TreeNodeSchemaNonClass<
|
|
49
52
|
TName,
|
|
50
53
|
NodeKind.Map,
|
|
51
|
-
TreeMapNode<T
|
|
52
|
-
MapNodeInsertableData<T
|
|
54
|
+
TreeMapNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Map, T>,
|
|
55
|
+
MapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>,
|
|
53
56
|
ImplicitlyConstructable,
|
|
54
57
|
T,
|
|
55
58
|
undefined,
|
|
@@ -29,6 +29,9 @@ import {
|
|
|
29
29
|
type NodeSchemaMetadata,
|
|
30
30
|
type FieldSchemaAlpha,
|
|
31
31
|
ObjectFieldSchema,
|
|
32
|
+
type ImplicitAnnotatedFieldSchema,
|
|
33
|
+
unannotateSchemaRecord,
|
|
34
|
+
type UnannotateSchemaRecord,
|
|
32
35
|
} from "./schemaTypes.js";
|
|
33
36
|
import {
|
|
34
37
|
type TreeNodeSchema,
|
|
@@ -59,7 +62,7 @@ import type { SimpleObjectFieldSchema } from "./simpleSchema.js";
|
|
|
59
62
|
* @remarks
|
|
60
63
|
* Due to {@link https://github.com/microsoft/TypeScript/issues/43826}, we can't enable implicit construction of {@link TreeNode|TreeNodes} for setters.
|
|
61
64
|
* Therefore code assigning to these fields must explicitly construct nodes using the schema's constructor or create method,
|
|
62
|
-
* or using some other method like {@link TreeAlpha.create}.
|
|
65
|
+
* or using some other method like {@link (TreeAlpha:interface).create}.
|
|
63
66
|
* @system @public
|
|
64
67
|
*/
|
|
65
68
|
export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> =
|
|
@@ -92,7 +95,9 @@ export type TreeObjectNode<
|
|
|
92
95
|
> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
93
96
|
|
|
94
97
|
/**
|
|
95
|
-
* Type utility for determining
|
|
98
|
+
* Type utility for determining if an implicit field schema is known to have a default value.
|
|
99
|
+
*
|
|
100
|
+
* @remarks Yields `false` when unknown.
|
|
96
101
|
*
|
|
97
102
|
* @privateRemarks
|
|
98
103
|
* TODO: Account for field schemas with default value providers.
|
|
@@ -100,9 +105,9 @@ export type TreeObjectNode<
|
|
|
100
105
|
*
|
|
101
106
|
* @system @public
|
|
102
107
|
*/
|
|
103
|
-
export type FieldHasDefault<T extends ImplicitFieldSchema> = T extends
|
|
104
|
-
FieldKind.Optional | FieldKind.Identifier
|
|
105
|
-
|
|
108
|
+
export type FieldHasDefault<T extends ImplicitFieldSchema> = [T] extends [
|
|
109
|
+
FieldSchema<FieldKind.Optional | FieldKind.Identifier>,
|
|
110
|
+
]
|
|
106
111
|
? true
|
|
107
112
|
: false;
|
|
108
113
|
|
|
@@ -154,6 +159,18 @@ export type InsertableObjectFromSchemaRecord<
|
|
|
154
159
|
}
|
|
155
160
|
>;
|
|
156
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Helper used to remove annotations from a schema record and produce insertable objects,
|
|
164
|
+
*
|
|
165
|
+
* @privateremarks
|
|
166
|
+
* This calls {@link InsertableObjectFromSchemaRecord} in order to produce the insertable objects.
|
|
167
|
+
*
|
|
168
|
+
* @system @alpha
|
|
169
|
+
*/
|
|
170
|
+
export type InsertableObjectFromAnnotatedSchemaRecord<
|
|
171
|
+
T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,
|
|
172
|
+
> = InsertableObjectFromSchemaRecord<UnannotateSchemaRecord<T>>;
|
|
173
|
+
|
|
157
174
|
/**
|
|
158
175
|
* Maps from simple field keys ("property" keys) to information about the field.
|
|
159
176
|
*
|
|
@@ -354,7 +371,7 @@ abstract class CustomObjectNodeBase<
|
|
|
354
371
|
*/
|
|
355
372
|
export function objectSchema<
|
|
356
373
|
TName extends string,
|
|
357
|
-
const T extends RestrictiveStringRecord<
|
|
374
|
+
const T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,
|
|
358
375
|
const ImplicitlyConstructable extends boolean,
|
|
359
376
|
const TCustomMetadata = unknown,
|
|
360
377
|
>(
|
|
@@ -368,12 +385,14 @@ export function objectSchema<
|
|
|
368
385
|
// Field set can't be modified after this since derived data is stored in maps.
|
|
369
386
|
Object.freeze(info);
|
|
370
387
|
|
|
388
|
+
const unannotatedInfo = unannotateSchemaRecord(info);
|
|
389
|
+
|
|
371
390
|
// Ensure no collisions between final set of property keys, and final set of stored keys (including those
|
|
372
391
|
// implicitly derived from property keys)
|
|
373
|
-
assertUniqueKeys(identifier,
|
|
392
|
+
assertUniqueKeys(identifier, unannotatedInfo);
|
|
374
393
|
|
|
375
394
|
// Performance optimization: cache property key => stored key and schema.
|
|
376
|
-
const flexKeyMap: SimpleKeyMap = createFlexKeyMapping(
|
|
395
|
+
const flexKeyMap: SimpleKeyMap = createFlexKeyMapping(unannotatedInfo);
|
|
377
396
|
|
|
378
397
|
const identifierFieldKeys: FieldKey[] = [];
|
|
379
398
|
for (const item of flexKeyMap.values()) {
|
|
@@ -390,17 +409,22 @@ export function objectSchema<
|
|
|
390
409
|
let customizable: boolean;
|
|
391
410
|
let unhydratedContext: Context;
|
|
392
411
|
|
|
393
|
-
class CustomObjectNode extends CustomObjectNodeBase<T
|
|
412
|
+
class CustomObjectNode extends CustomObjectNodeBase<UnannotateSchemaRecord<T>> {
|
|
394
413
|
public static readonly fields: ReadonlyMap<
|
|
395
414
|
string,
|
|
396
415
|
FieldSchemaAlpha & SimpleObjectFieldSchema
|
|
397
416
|
> = new Map(
|
|
398
417
|
Array.from(flexKeyMap, ([key, value]) => [
|
|
399
418
|
key as string,
|
|
400
|
-
new ObjectFieldSchema(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
419
|
+
new ObjectFieldSchema(
|
|
420
|
+
value.schema.kind,
|
|
421
|
+
value.schema.allowedTypes,
|
|
422
|
+
(value.schema as FieldSchemaAlpha).annotatedAllowedTypes,
|
|
423
|
+
{
|
|
424
|
+
...value.schema.props,
|
|
425
|
+
key: getStoredKey(key as string, value.schema),
|
|
426
|
+
},
|
|
427
|
+
),
|
|
404
428
|
]),
|
|
405
429
|
);
|
|
406
430
|
public static readonly flexKeyMap: SimpleKeyMap = flexKeyMap;
|
|
@@ -513,8 +537,8 @@ export function objectSchema<
|
|
|
513
537
|
}
|
|
514
538
|
type Output = typeof CustomObjectNode &
|
|
515
539
|
(new (
|
|
516
|
-
input:
|
|
517
|
-
) => TreeObjectNode<T
|
|
540
|
+
input: InsertableObjectFromAnnotatedSchemaRecord<T> | InternalTreeNode,
|
|
541
|
+
) => TreeObjectNode<UnannotateSchemaRecord<T>, TName>);
|
|
518
542
|
return CustomObjectNode as Output;
|
|
519
543
|
}
|
|
520
544
|
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
import type { RestrictiveStringRecord } from "../util/index.js";
|
|
7
7
|
import type {
|
|
8
8
|
TreeObjectNode,
|
|
9
|
-
InsertableObjectFromSchemaRecord,
|
|
10
9
|
SimpleKeyMap,
|
|
10
|
+
InsertableObjectFromAnnotatedSchemaRecord,
|
|
11
11
|
} from "./objectNode.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
FieldSchemaAlpha,
|
|
14
|
+
ImplicitAnnotatedFieldSchema,
|
|
15
|
+
UnannotateSchemaRecord,
|
|
16
|
+
} from "./schemaTypes.js";
|
|
13
17
|
import { NodeKind, type TreeNodeSchemaClass, type TreeNodeSchema } from "./core/index.js";
|
|
14
18
|
import type { FieldKey } from "../core/index.js";
|
|
15
19
|
import type { SimpleObjectFieldSchema, SimpleObjectNodeSchema } from "./simpleSchema.js";
|
|
@@ -22,14 +26,14 @@ import type { SimpleObjectFieldSchema, SimpleObjectNodeSchema } from "./simpleSc
|
|
|
22
26
|
export interface ObjectNodeSchema<
|
|
23
27
|
out TName extends string = string,
|
|
24
28
|
in out T extends
|
|
25
|
-
RestrictiveStringRecord<
|
|
29
|
+
RestrictiveStringRecord<ImplicitAnnotatedFieldSchema> = RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,
|
|
26
30
|
ImplicitlyConstructable extends boolean = boolean,
|
|
27
31
|
out TCustomMetadata = unknown,
|
|
28
32
|
> extends TreeNodeSchemaClass<
|
|
29
33
|
TName,
|
|
30
34
|
NodeKind.Object,
|
|
31
|
-
TreeObjectNode<T
|
|
32
|
-
|
|
35
|
+
TreeObjectNode<UnannotateSchemaRecord<T>, TName>,
|
|
36
|
+
InsertableObjectFromAnnotatedSchemaRecord<T>,
|
|
33
37
|
ImplicitlyConstructable,
|
|
34
38
|
T,
|
|
35
39
|
never,
|