@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
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
AllowedUpdateType,
|
|
10
9
|
CursorLocationType,
|
|
11
10
|
type ITreeCursorSynchronous,
|
|
12
11
|
type TreeStoredSchema,
|
|
@@ -21,9 +20,8 @@ import {
|
|
|
21
20
|
mapTreeFromCursor,
|
|
22
21
|
} from "../feature-libraries/index.js";
|
|
23
22
|
import { isReadonlyArray } from "../util/index.js";
|
|
24
|
-
|
|
25
23
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
26
|
-
import {
|
|
24
|
+
import type { SchemaCompatibilityTester } from "../simple-tree/index.js";
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.
|
|
@@ -98,10 +96,6 @@ export enum UpdateType {
|
|
|
98
96
|
* Already compatible, no update needed.
|
|
99
97
|
*/
|
|
100
98
|
None,
|
|
101
|
-
/**
|
|
102
|
-
* Empty: needs initializing.
|
|
103
|
-
*/
|
|
104
|
-
Initialize,
|
|
105
99
|
/**
|
|
106
100
|
* Schema can be upgraded leaving tree as is.
|
|
107
101
|
*/
|
|
@@ -112,9 +106,11 @@ export enum UpdateType {
|
|
|
112
106
|
Incompatible,
|
|
113
107
|
}
|
|
114
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Returns how compatible updating checkout's schema is with the viewSchema.
|
|
111
|
+
*/
|
|
115
112
|
export function evaluateUpdate(
|
|
116
|
-
viewSchema:
|
|
117
|
-
allowedSchemaModifications: AllowedUpdateType,
|
|
113
|
+
viewSchema: SchemaCompatibilityTester,
|
|
118
114
|
checkout: ITreeCheckout,
|
|
119
115
|
): UpdateType {
|
|
120
116
|
const compatibility = viewSchema.checkCompatibility(checkout.storedSchema);
|
|
@@ -124,11 +120,6 @@ export function evaluateUpdate(
|
|
|
124
120
|
return UpdateType.None;
|
|
125
121
|
}
|
|
126
122
|
|
|
127
|
-
// eslint-disable-next-line no-bitwise
|
|
128
|
-
if (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {
|
|
129
|
-
return UpdateType.Initialize;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
123
|
if (!compatibility.canUpgrade) {
|
|
133
124
|
// Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated
|
|
134
125
|
return UpdateType.Incompatible;
|
|
@@ -137,10 +128,7 @@ export function evaluateUpdate(
|
|
|
137
128
|
assert(!compatibility.canView, 0x8bd /* unexpected case */);
|
|
138
129
|
assert(compatibility.canUpgrade, 0x8be /* unexpected case */);
|
|
139
130
|
|
|
140
|
-
|
|
141
|
-
return allowedSchemaModifications & AllowedUpdateType.SchemaCompatible
|
|
142
|
-
? UpdateType.SchemaCompatible
|
|
143
|
-
: UpdateType.Incompatible;
|
|
131
|
+
return UpdateType.SchemaCompatible;
|
|
144
132
|
}
|
|
145
133
|
|
|
146
134
|
export function canInitialize(checkout: ITreeCheckout): boolean {
|
|
@@ -209,7 +197,7 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
209
197
|
}
|
|
210
198
|
|
|
211
199
|
/**
|
|
212
|
-
* Ensure a {@link ITreeCheckout} can be used with a given {@link
|
|
200
|
+
* Ensure a {@link ITreeCheckout} can be used with a given {@link SchemaCompatibilityTester}.
|
|
213
201
|
*
|
|
214
202
|
* @remarks
|
|
215
203
|
* It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.
|
|
@@ -221,18 +209,10 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
221
209
|
* @returns true iff checkout now is compatible with `viewSchema`.
|
|
222
210
|
*/
|
|
223
211
|
export function ensureSchema(
|
|
224
|
-
viewSchema:
|
|
225
|
-
allowedSchemaModifications: AllowedUpdateType,
|
|
212
|
+
viewSchema: SchemaCompatibilityTester,
|
|
226
213
|
checkout: ITreeCheckout,
|
|
227
|
-
treeContent: TreeStoredContent | undefined,
|
|
228
214
|
): boolean {
|
|
229
|
-
|
|
230
|
-
if (treeContent === undefined) {
|
|
231
|
-
// Clear bit for Initialize if initial tree is not provided.
|
|
232
|
-
// eslint-disable-next-line no-bitwise
|
|
233
|
-
possibleModifications &= ~AllowedUpdateType.Initialize;
|
|
234
|
-
}
|
|
235
|
-
const updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);
|
|
215
|
+
const updatedNeeded = evaluateUpdate(viewSchema, checkout);
|
|
236
216
|
switch (updatedNeeded) {
|
|
237
217
|
case UpdateType.None: {
|
|
238
218
|
return true;
|
|
@@ -241,17 +221,7 @@ export function ensureSchema(
|
|
|
241
221
|
return false;
|
|
242
222
|
}
|
|
243
223
|
case UpdateType.SchemaCompatible: {
|
|
244
|
-
checkout.updateSchema(
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
case UpdateType.Initialize: {
|
|
248
|
-
if (treeContent === undefined) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
// TODO:
|
|
252
|
-
// When this becomes a more proper out of schema adapter, editing should be made lazy.
|
|
253
|
-
// This will improve support for readonly documents, cross version collaboration and attribution.
|
|
254
|
-
initialize(checkout, treeContent);
|
|
224
|
+
checkout.updateSchema(viewSchema.viewSchemaAsStored);
|
|
255
225
|
return true;
|
|
256
226
|
}
|
|
257
227
|
default: {
|
|
@@ -12,7 +12,7 @@ import { createEmitter } from "@fluid-internal/client-utils";
|
|
|
12
12
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
13
13
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { anchorSlot, type SchemaPolicy } from "../core/index.js";
|
|
16
16
|
import {
|
|
17
17
|
type NodeIdentifierManager,
|
|
18
18
|
defaultSchemaPolicy,
|
|
@@ -30,13 +30,12 @@ import {
|
|
|
30
30
|
getTreeNodeForField,
|
|
31
31
|
setField,
|
|
32
32
|
normalizeFieldSchema,
|
|
33
|
-
|
|
33
|
+
SchemaCompatibilityTester,
|
|
34
34
|
type InsertableContent,
|
|
35
35
|
type TreeViewConfiguration,
|
|
36
36
|
mapTreeFromNodeData,
|
|
37
37
|
prepareContentForHydration,
|
|
38
38
|
comparePersistedSchemaInternal,
|
|
39
|
-
toStoredSchema,
|
|
40
39
|
type TreeViewAlpha,
|
|
41
40
|
type InsertableField,
|
|
42
41
|
type ReadableField,
|
|
@@ -98,7 +97,7 @@ export class SchematizingSimpleTreeView<
|
|
|
98
97
|
IEmitter<TreeViewEvents & TreeBranchEvents> &
|
|
99
98
|
HasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();
|
|
100
99
|
|
|
101
|
-
private readonly viewSchema:
|
|
100
|
+
private readonly viewSchema: SchemaCompatibilityTester;
|
|
102
101
|
|
|
103
102
|
private readonly unregisterCallbacks = new Set<() => void>();
|
|
104
103
|
|
|
@@ -133,7 +132,11 @@ export class SchematizingSimpleTreeView<
|
|
|
133
132
|
allowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),
|
|
134
133
|
};
|
|
135
134
|
|
|
136
|
-
this.viewSchema = new
|
|
135
|
+
this.viewSchema = new SchemaCompatibilityTester(
|
|
136
|
+
this.schemaPolicy,
|
|
137
|
+
{},
|
|
138
|
+
this.rootFieldSchema,
|
|
139
|
+
);
|
|
137
140
|
// This must be initialized before `update` can be called.
|
|
138
141
|
this.currentCompatibility = {
|
|
139
142
|
canView: false,
|
|
@@ -182,7 +185,7 @@ export class SchematizingSimpleTreeView<
|
|
|
182
185
|
|
|
183
186
|
prepareContentForHydration(mapTree, this.checkout.forest);
|
|
184
187
|
initialize(this.checkout, {
|
|
185
|
-
schema:
|
|
188
|
+
schema: this.viewSchema.viewSchemaAsStored,
|
|
186
189
|
initialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),
|
|
187
190
|
});
|
|
188
191
|
});
|
|
@@ -204,15 +207,7 @@ export class SchematizingSimpleTreeView<
|
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
this.runSchemaEdit(() => {
|
|
207
|
-
const result = ensureSchema(
|
|
208
|
-
this.viewSchema,
|
|
209
|
-
AllowedUpdateType.SchemaCompatible,
|
|
210
|
-
this.checkout,
|
|
211
|
-
{
|
|
212
|
-
schema: toStoredSchema(this.viewSchema.schema),
|
|
213
|
-
initialTree: undefined,
|
|
214
|
-
},
|
|
215
|
-
);
|
|
210
|
+
const result = ensureSchema(this.viewSchema, this.checkout);
|
|
216
211
|
assert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);
|
|
217
212
|
});
|
|
218
213
|
}
|
|
@@ -502,12 +497,12 @@ export function getCheckout(context: TreeBranch): TreeCheckout {
|
|
|
502
497
|
}
|
|
503
498
|
|
|
504
499
|
/**
|
|
505
|
-
* Creates a view that self-disposes
|
|
500
|
+
* Creates a view that self-disposes whenever the stored schema changes.
|
|
506
501
|
* This may only be called when the schema is already known to be compatible (typically via ensureSchema).
|
|
507
502
|
*/
|
|
508
503
|
export function requireSchema(
|
|
509
504
|
checkout: ITreeCheckout,
|
|
510
|
-
viewSchema:
|
|
505
|
+
viewSchema: SchemaCompatibilityTester,
|
|
511
506
|
onDispose: () => void,
|
|
512
507
|
nodeKeyManager: NodeIdentifierManager,
|
|
513
508
|
schemaPolicy: FullSchemaPolicy,
|
|
@@ -13,6 +13,7 @@ import type { IChannelStorageService } from "@fluidframework/datastore-definitio
|
|
|
13
13
|
import type {
|
|
14
14
|
IChannelView,
|
|
15
15
|
IFluidSerializer,
|
|
16
|
+
SharedKernel,
|
|
16
17
|
} from "@fluidframework/shared-object-base/internal";
|
|
17
18
|
import {
|
|
18
19
|
UsageError,
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
DetachedFieldIndexSummarizer,
|
|
47
48
|
FieldKinds,
|
|
48
49
|
ForestSummarizer,
|
|
50
|
+
SchemaCodecVersion,
|
|
49
51
|
SchemaSummarizer,
|
|
50
52
|
TreeCompressionStrategy,
|
|
51
53
|
buildChunkedForest,
|
|
@@ -54,6 +56,7 @@ import {
|
|
|
54
56
|
jsonableTreeFromFieldCursor,
|
|
55
57
|
makeFieldBatchCodec,
|
|
56
58
|
makeMitigatedChangeFamily,
|
|
59
|
+
makeSchemaCodec,
|
|
57
60
|
makeTreeChunker,
|
|
58
61
|
} from "../feature-libraries/index.js";
|
|
59
62
|
import {
|
|
@@ -90,7 +93,14 @@ import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
|
|
|
90
93
|
import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
|
|
91
94
|
import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
92
95
|
import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
|
|
93
|
-
import {
|
|
96
|
+
import {
|
|
97
|
+
type Breakable,
|
|
98
|
+
breakingClass,
|
|
99
|
+
type JsonCompatible,
|
|
100
|
+
throwIfBroken,
|
|
101
|
+
} from "../util/index.js";
|
|
102
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
103
|
+
import type { Format } from "../feature-libraries/schema-index/index.js";
|
|
94
104
|
|
|
95
105
|
/**
|
|
96
106
|
* Copy of data from an {@link ITreePrivate} at some point in time.
|
|
@@ -156,7 +166,7 @@ export interface ITreePrivate extends ITreeInternal {
|
|
|
156
166
|
*/
|
|
157
167
|
interface ExplicitCodecVersions extends ExplicitCoreCodecVersions {
|
|
158
168
|
forest: number;
|
|
159
|
-
schema:
|
|
169
|
+
schema: SchemaCodecVersion;
|
|
160
170
|
detachedFieldIndex: number;
|
|
161
171
|
fieldBatch: number;
|
|
162
172
|
}
|
|
@@ -186,18 +196,35 @@ function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
|
|
|
186
196
|
return versions;
|
|
187
197
|
}
|
|
188
198
|
|
|
199
|
+
/**
|
|
200
|
+
* The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).
|
|
201
|
+
*/
|
|
202
|
+
export type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;
|
|
203
|
+
|
|
189
204
|
/**
|
|
190
205
|
* SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.
|
|
191
206
|
*
|
|
192
207
|
* TODO: detail compatibility requirements.
|
|
193
208
|
*/
|
|
194
209
|
@breakingClass
|
|
195
|
-
export class SharedTreeKernel
|
|
210
|
+
export class SharedTreeKernel
|
|
211
|
+
extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>
|
|
212
|
+
implements SharedKernel
|
|
213
|
+
{
|
|
196
214
|
public readonly checkout: TreeCheckout;
|
|
197
215
|
public get storedSchema(): TreeStoredSchemaRepository {
|
|
198
216
|
return this.checkout.storedSchema;
|
|
199
217
|
}
|
|
200
218
|
|
|
219
|
+
/**
|
|
220
|
+
* The app-facing API for SharedTree implemented by this Kernel.
|
|
221
|
+
* @remarks
|
|
222
|
+
* This is the API grafted onto the ISharedObject which apps can access.
|
|
223
|
+
* It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).
|
|
224
|
+
* Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.
|
|
225
|
+
*/
|
|
226
|
+
public readonly view: SharedTreeKernelView;
|
|
227
|
+
|
|
201
228
|
public constructor(
|
|
202
229
|
breaker: Breakable,
|
|
203
230
|
sharedObject: IChannelView & IFluidLoadable,
|
|
@@ -219,9 +246,14 @@ export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, Shar
|
|
|
219
246
|
idCompressor,
|
|
220
247
|
options,
|
|
221
248
|
);
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
249
|
+
const schemaCodec = makeSchemaCodec(options, codecVersions.schema);
|
|
250
|
+
const schemaSummarizer = new SchemaSummarizer(
|
|
251
|
+
schema,
|
|
252
|
+
{
|
|
253
|
+
getCurrentSeq: lastSequenceNumber,
|
|
254
|
+
},
|
|
255
|
+
schemaCodec,
|
|
256
|
+
);
|
|
225
257
|
const fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);
|
|
226
258
|
|
|
227
259
|
const encoderContext = {
|
|
@@ -331,6 +363,14 @@ export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, Shar
|
|
|
331
363
|
}
|
|
332
364
|
}
|
|
333
365
|
});
|
|
366
|
+
|
|
367
|
+
this.view = {
|
|
368
|
+
contentSnapshot: () => this.contentSnapshot(),
|
|
369
|
+
exportSimpleSchema: () => this.exportSimpleSchema(),
|
|
370
|
+
exportVerbose: () => this.exportVerbose(),
|
|
371
|
+
viewWith: this.viewWith.bind(this),
|
|
372
|
+
kernel: this,
|
|
373
|
+
};
|
|
334
374
|
}
|
|
335
375
|
|
|
336
376
|
public exportVerbose(): VerboseTree | undefined {
|
|
@@ -450,6 +490,27 @@ export function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSc
|
|
|
450
490
|
};
|
|
451
491
|
}
|
|
452
492
|
|
|
493
|
+
/**
|
|
494
|
+
* A way to parse schema in the persisted format from {@link extractPersistedSchema}.
|
|
495
|
+
* @remarks
|
|
496
|
+
* This behaves identically to {@link ITreeAlpha.exportSimpleSchema},
|
|
497
|
+
* except that it gets the schema from the caller instead of from an existing tree.
|
|
498
|
+
*
|
|
499
|
+
* This can be useful for inspecting the contents of persisted schema,
|
|
500
|
+
* such as those generated by {@link extractPersistedSchema} for use in testing.
|
|
501
|
+
* Since that data format is otherwise unspecified,
|
|
502
|
+
* this provides a way to inspect its contents with documented semantics.
|
|
503
|
+
* @alpha
|
|
504
|
+
*/
|
|
505
|
+
export function persistedToSimpleSchema(
|
|
506
|
+
persisted: JsonCompatible,
|
|
507
|
+
options: ICodecOptions,
|
|
508
|
+
): SimpleTreeSchema {
|
|
509
|
+
const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
|
|
510
|
+
const stored = schemaCodec.decode(persisted as Format);
|
|
511
|
+
return exportSimpleSchema(stored);
|
|
512
|
+
}
|
|
513
|
+
|
|
453
514
|
/**
|
|
454
515
|
* Get a {@link BranchableTree} from a {@link ITree}.
|
|
455
516
|
* @remarks The branch can be used for "version control"-style coordination of edits on the tree.
|
|
@@ -22,6 +22,56 @@ import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
|
22
22
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
23
23
|
import { getCheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Provides various functions for interacting with {@link TreeNode}s.
|
|
27
|
+
* @remarks
|
|
28
|
+
* This type should only be used via the {@link (Tree:variable)} export.
|
|
29
|
+
* @system @sealed @public
|
|
30
|
+
*/
|
|
31
|
+
export interface Tree extends TreeNodeApi {
|
|
32
|
+
/**
|
|
33
|
+
* Run a {@link RunTransaction | transaction}.
|
|
34
|
+
*/
|
|
35
|
+
readonly runTransaction: RunTransaction;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the subtree defined by `node` contains `other`.
|
|
38
|
+
*
|
|
39
|
+
* @returns true if `other` is an inclusive descendant of `node`, and false otherwise.
|
|
40
|
+
* @remarks
|
|
41
|
+
* This includes direct and indirect children:
|
|
42
|
+
* as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.
|
|
43
|
+
*
|
|
44
|
+
* `node` is considered to contain itself, so the case where `node === other` returns true.
|
|
45
|
+
*
|
|
46
|
+
* This is handy when checking if moving `node` into `other` would create a cycle and would thus be invalid.
|
|
47
|
+
*
|
|
48
|
+
* This check walks the parents of `other` looking for `node`,
|
|
49
|
+
* and thus runs in time proportional to the depth of child in the tree.
|
|
50
|
+
*/
|
|
51
|
+
contains(node: TreeNode, other: TreeNode): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The {@link (Tree:interface)} singleton which holds various functions for interacting with {@link TreeNode}s.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export const Tree: Tree = {
|
|
59
|
+
...treeNodeApi,
|
|
60
|
+
|
|
61
|
+
runTransaction: createRunTransaction(),
|
|
62
|
+
|
|
63
|
+
contains(parent: TreeNode, child: TreeNode): boolean {
|
|
64
|
+
let toCheck: TreeNode | undefined = child;
|
|
65
|
+
while (toCheck !== undefined) {
|
|
66
|
+
if (toCheck === parent) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
toCheck = Tree.parent(toCheck);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
25
75
|
/**
|
|
26
76
|
* A function which runs a transaction in a SharedTree.
|
|
27
77
|
* @privateRemarks
|
|
@@ -46,7 +96,9 @@ export interface RunTransaction {
|
|
|
46
96
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
47
97
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
48
98
|
* However, using a transaction has the following additional consequences:
|
|
99
|
+
*
|
|
49
100
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
101
|
+
*
|
|
50
102
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
51
103
|
*
|
|
52
104
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -67,7 +119,9 @@ export interface RunTransaction {
|
|
|
67
119
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
68
120
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
69
121
|
* However, using a transaction has the following additional consequences:
|
|
122
|
+
*
|
|
70
123
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
124
|
+
*
|
|
71
125
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
72
126
|
*
|
|
73
127
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -93,7 +147,9 @@ export interface RunTransaction {
|
|
|
93
147
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
94
148
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
95
149
|
* However, using a transaction has the following additional consequences:
|
|
150
|
+
*
|
|
96
151
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
152
|
+
*
|
|
97
153
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
98
154
|
*
|
|
99
155
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -115,7 +171,9 @@ export interface RunTransaction {
|
|
|
115
171
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
116
172
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
117
173
|
* However, using a transaction has the following additional consequences:
|
|
174
|
+
*
|
|
118
175
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
176
|
+
*
|
|
119
177
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
120
178
|
*
|
|
121
179
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -138,7 +196,9 @@ export interface RunTransaction {
|
|
|
138
196
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
139
197
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
140
198
|
* However, using a transaction has the following additional consequences:
|
|
199
|
+
*
|
|
141
200
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
201
|
+
*
|
|
142
202
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
143
203
|
*
|
|
144
204
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -155,7 +215,9 @@ export interface RunTransaction {
|
|
|
155
215
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
156
216
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
157
217
|
* However, using a transaction has the following additional consequences:
|
|
218
|
+
*
|
|
158
219
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
220
|
+
*
|
|
159
221
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
160
222
|
*
|
|
161
223
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -179,7 +241,9 @@ export interface RunTransaction {
|
|
|
179
241
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
180
242
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
181
243
|
* However, using a transaction has the following additional consequences:
|
|
244
|
+
*
|
|
182
245
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
246
|
+
*
|
|
183
247
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
184
248
|
*
|
|
185
249
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -204,7 +268,9 @@ export interface RunTransaction {
|
|
|
204
268
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
205
269
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
206
270
|
* However, using a transaction has the following additional consequences:
|
|
271
|
+
*
|
|
207
272
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
273
|
+
*
|
|
208
274
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
209
275
|
*
|
|
210
276
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -233,7 +299,9 @@ export interface RunTransaction {
|
|
|
233
299
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
234
300
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
235
301
|
* However, using a transaction has the following additional consequences:
|
|
302
|
+
*
|
|
236
303
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
304
|
+
*
|
|
237
305
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
238
306
|
*
|
|
239
307
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -259,7 +327,9 @@ export interface RunTransaction {
|
|
|
259
327
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
260
328
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
261
329
|
* However, using a transaction has the following additional consequences:
|
|
330
|
+
*
|
|
262
331
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
332
|
+
*
|
|
263
333
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
264
334
|
*
|
|
265
335
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -286,7 +356,9 @@ export interface RunTransaction {
|
|
|
286
356
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
287
357
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
288
358
|
* However, using a transaction has the following additional consequences:
|
|
359
|
+
*
|
|
289
360
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
361
|
+
*
|
|
290
362
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
291
363
|
*
|
|
292
364
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -310,7 +382,9 @@ export interface RunTransaction {
|
|
|
310
382
|
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
311
383
|
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
312
384
|
* However, using a transaction has the following additional consequences:
|
|
385
|
+
*
|
|
313
386
|
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
387
|
+
*
|
|
314
388
|
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
315
389
|
*
|
|
316
390
|
* Local change events will be emitted for each change as the transaction is being applied.
|
|
@@ -326,56 +400,6 @@ export interface RunTransaction {
|
|
|
326
400
|
): void;
|
|
327
401
|
}
|
|
328
402
|
|
|
329
|
-
/**
|
|
330
|
-
* Provides various functions for interacting with {@link TreeNode}s.
|
|
331
|
-
* @remarks
|
|
332
|
-
* This type should only be used via the public `Tree` export.
|
|
333
|
-
* @system @sealed @public
|
|
334
|
-
*/
|
|
335
|
-
export interface TreeApi extends TreeNodeApi {
|
|
336
|
-
/**
|
|
337
|
-
* Run a {@link RunTransaction | transaction}.
|
|
338
|
-
*/
|
|
339
|
-
readonly runTransaction: RunTransaction;
|
|
340
|
-
/**
|
|
341
|
-
* Check if the subtree defined by `node` contains `other`.
|
|
342
|
-
*
|
|
343
|
-
* @returns true if `other` is an inclusive descendant of `node`, and false otherwise.
|
|
344
|
-
* @remarks
|
|
345
|
-
* This includes direct and indirect children:
|
|
346
|
-
* as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.
|
|
347
|
-
*
|
|
348
|
-
* `node` is considered to contain itself, so the case where `node === other` returns true.
|
|
349
|
-
*
|
|
350
|
-
* This is handy when checking if moving `node` into `other` would create a cycle and thus is invalid.
|
|
351
|
-
*
|
|
352
|
-
* This check walks the parents of `other` looking for `node`,
|
|
353
|
-
* and thus runs in time proportional to the depth of child in the tree.
|
|
354
|
-
*/
|
|
355
|
-
contains(node: TreeNode, other: TreeNode): boolean;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* The `Tree` object holds various functions for interacting with {@link TreeNode}s.
|
|
360
|
-
* @public
|
|
361
|
-
*/
|
|
362
|
-
export const treeApi: TreeApi = {
|
|
363
|
-
...treeNodeApi,
|
|
364
|
-
|
|
365
|
-
runTransaction: createRunTransaction(),
|
|
366
|
-
|
|
367
|
-
contains(parent: TreeNode, child: TreeNode): boolean {
|
|
368
|
-
let toCheck: TreeNode | undefined = child;
|
|
369
|
-
while (toCheck !== undefined) {
|
|
370
|
-
if (toCheck === parent) {
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
toCheck = treeApi.parent(toCheck);
|
|
374
|
-
}
|
|
375
|
-
return false;
|
|
376
|
-
},
|
|
377
|
-
};
|
|
378
|
-
|
|
379
403
|
// TODO: Add more constraint types here
|
|
380
404
|
|
|
381
405
|
/** Creates a copy of `runTransaction` with the `rollback` property added so as to satisfy the `RunTransaction` interface. */
|
|
@@ -443,7 +467,7 @@ function runTransactionInCheckout<TResult>(
|
|
|
443
467
|
switch (constraint.type) {
|
|
444
468
|
case "nodeInDocument": {
|
|
445
469
|
const node = getOrCreateInnerNode(constraint.node);
|
|
446
|
-
const nodeStatus =
|
|
470
|
+
const nodeStatus = Tree.status(constraint.node);
|
|
447
471
|
if (nodeStatus !== TreeStatus.InDocument) {
|
|
448
472
|
throw new UsageError(
|
|
449
473
|
`Attempted to add a "nodeInDocument" constraint, but the node is not currently in the document. Node status: ${nodeStatus}`,
|