@fluidframework/tree 2.40.0-336023 → 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/CHANGELOG.md +64 -0
- package/api-report/tree.alpha.api.md +4 -1
- package/dist/alpha.d.ts +1 -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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +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 +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +8 -9
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +9 -33
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +1 -4
- 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/tree.d.ts +24 -0
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +2 -0
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -2
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- 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/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +9 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +7 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +8 -7
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +13 -9
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +25 -0
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +4 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- 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/arrayNode.d.ts +28 -0
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.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 +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +1 -0
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- 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/tableSchema.d.ts +302 -83
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +299 -57
- 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/lib/alpha.d.ts +1 -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 +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +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 +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +8 -9
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +10 -34
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +2 -5
- 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/tree.d.ts +24 -0
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +2 -0
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +4 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- 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/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +9 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +7 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +8 -7
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +17 -11
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +25 -0
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +4 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- 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/arrayNode.d.ts +28 -0
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.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 +2 -2
- 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/schemaTypes.d.ts +1 -0
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- 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/tableSchema.d.ts +302 -83
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +299 -57
- 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/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 +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +3 -2
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizeTree.ts +5 -35
- package/src/shared-tree/schematizingTreeView.ts +2 -10
- package/src/shared-tree/sharedTree.ts +67 -6
- package/src/shared-tree/tree.ts +24 -0
- package/src/shared-tree/treeAlpha.ts +6 -3
- package/src/shared-tree-core/branchCommitEnricher.ts +0 -1
- package/src/shared-tree-core/transactionEnricher.ts +4 -1
- package/src/simple-tree/api/index.ts +2 -0
- package/src/simple-tree/api/schemaFactory.ts +9 -0
- package/src/simple-tree/api/storedSchema.ts +24 -13
- package/src/simple-tree/api/tree.ts +25 -0
- package/src/simple-tree/api/treeBeta.ts +3 -1
- package/src/simple-tree/api/treeChangeEvents.ts +84 -0
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/arrayNode.ts +28 -0
- 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 +2 -1
- package/src/simple-tree/schemaTypes.ts +1 -0
- package/src/simple-tree/toStoredSchema.ts +42 -41
- package/src/tableSchema.ts +665 -197
- package/src/treeFactory.ts +56 -173
- 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/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/src/core/schema-stored/{format.ts → formatV1.ts} +0 -0
|
@@ -9,7 +9,7 @@ import type { Listenable } from "@fluidframework/core-interfaces/internal";
|
|
|
9
9
|
import { createEmitter } from "@fluid-internal/client-utils";
|
|
10
10
|
import { compareStrings } from "../../util/index.js";
|
|
11
11
|
|
|
12
|
-
import type { TreeNodeSchemaIdentifier } from "./
|
|
12
|
+
import type { TreeNodeSchemaIdentifier } from "./formatV1.js";
|
|
13
13
|
import {
|
|
14
14
|
type StoredSchemaCollection,
|
|
15
15
|
type TreeFieldStoredSchema,
|
|
@@ -9,37 +9,6 @@ import type { TreeNodeSchemaIdentifier, TreeStoredSchema } from "../schema-store
|
|
|
9
9
|
* APIs for applying `view schema` to documents.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* What kinds of updates to stored schema to permit.
|
|
14
|
-
*
|
|
15
|
-
* Bit flags enum.
|
|
16
|
-
*/
|
|
17
|
-
export enum AllowedUpdateType {
|
|
18
|
-
/**
|
|
19
|
-
* Do not update the stored schema to match view schema.
|
|
20
|
-
*/
|
|
21
|
-
None = 0,
|
|
22
|
-
/**
|
|
23
|
-
* Update the stored schema as part of initializing an empty document.
|
|
24
|
-
*
|
|
25
|
-
* Includes "Initialize".
|
|
26
|
-
*/
|
|
27
|
-
// eslint-disable-next-line no-bitwise
|
|
28
|
-
Initialize = 1 << 0,
|
|
29
|
-
/**
|
|
30
|
-
* Update the stored schema to match the view schema if the current document contents are compatible with the view schema.
|
|
31
|
-
* TODO: support this option.
|
|
32
|
-
*/
|
|
33
|
-
// DataCompatible,
|
|
34
|
-
/**
|
|
35
|
-
* Update the stored schema to match view schema if all possible documents based on the current stored schema would be compatible with the view schema.
|
|
36
|
-
*
|
|
37
|
-
* Includes "Initialize".
|
|
38
|
-
*/
|
|
39
|
-
// eslint-disable-next-line no-bitwise
|
|
40
|
-
SchemaCompatible = 1 << 1,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
12
|
/**
|
|
44
13
|
*/
|
|
45
14
|
export interface TreeAdapter {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type Static, type TSchema, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { schemaFormatV1 } from "../schema-stored/index.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* This module contains persisted types for a simple, human-readable tree format.
|
|
@@ -58,7 +58,7 @@ const EncodedFieldMapObject = <Schema extends TSchema>(tChild: Schema) =>
|
|
|
58
58
|
type EncodedNodeData = Static<typeof EncodedNodeData>;
|
|
59
59
|
const EncodedNodeData = Type.Object({
|
|
60
60
|
value: Type.Optional(Type.Any()),
|
|
61
|
-
type: Type.Readonly(
|
|
61
|
+
type: Type.Readonly(schemaFormatV1.TreeNodeSchemaIdentifierSchema),
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
import { type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
8
|
import { Versioned } from "../../codec/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { schemaFormatV1 } from "../../core/index.js";
|
|
10
10
|
|
|
11
11
|
export const version = 1.0;
|
|
12
12
|
|
|
13
13
|
export const Format = Type.Object(
|
|
14
14
|
{
|
|
15
15
|
version: Type.Literal(version),
|
|
16
|
-
keys: Type.Array(
|
|
16
|
+
keys: Type.Array(schemaFormatV1.FieldKeySchema),
|
|
17
17
|
fields: Versioned,
|
|
18
18
|
},
|
|
19
19
|
{ additionalProperties: false },
|
|
@@ -17,7 +17,13 @@ export {
|
|
|
17
17
|
mapTreeFieldFromCursor,
|
|
18
18
|
} from "./mapTreeCursor.js";
|
|
19
19
|
export { buildForest } from "./object-forest/index.js";
|
|
20
|
-
export {
|
|
20
|
+
export {
|
|
21
|
+
SchemaSummarizer,
|
|
22
|
+
encodeTreeSchema,
|
|
23
|
+
makeSchemaCodec,
|
|
24
|
+
makeSchemaCodecs,
|
|
25
|
+
SchemaCodecVersion,
|
|
26
|
+
} from "./schema-index/index.js";
|
|
21
27
|
export {
|
|
22
28
|
stackTreeNodeCursor,
|
|
23
29
|
type CursorAdapter,
|
|
@@ -26,17 +26,17 @@ import {
|
|
|
26
26
|
} from "./treeCursorUtils.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Returns an {@link ITreeCursorSynchronous} in nodes mode for a single {@link MapTree}.
|
|
30
30
|
*/
|
|
31
31
|
export function cursorForMapTreeNode(root: MapTree): CursorWithNode<MapTree> {
|
|
32
32
|
return stackTreeNodeCursor(adapter, root);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Returns an {@link ITreeCursorSynchronous} in fields mode for a MapTree field.
|
|
37
37
|
*/
|
|
38
38
|
export function cursorForMapTreeField(
|
|
39
|
-
root: MapTree[],
|
|
39
|
+
root: readonly MapTree[],
|
|
40
40
|
detachedField: DetachedField = rootField,
|
|
41
41
|
): CursorWithNode<MapTree> {
|
|
42
42
|
const key = detachedFieldAsKey(detachedField);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import { type ChangesetLocalId, RevisionTagSchema,
|
|
8
|
+
import { type ChangesetLocalId, RevisionTagSchema, schemaFormatV1 } from "../../core/index.js";
|
|
9
9
|
import {
|
|
10
10
|
type JsonCompatibleReadOnly,
|
|
11
11
|
JsonCompatibleReadOnlySchema,
|
|
@@ -27,8 +27,8 @@ export type EncodedChangeAtomId = Static<typeof EncodedChangeAtomId>;
|
|
|
27
27
|
|
|
28
28
|
const EncodedFieldChange = Type.Object(
|
|
29
29
|
{
|
|
30
|
-
fieldKey:
|
|
31
|
-
fieldKind:
|
|
30
|
+
fieldKey: schemaFormatV1.FieldKeySchema,
|
|
31
|
+
fieldKind: schemaFormatV1.FieldKindIdentifierSchema,
|
|
32
32
|
// Implementation note: node and field change encoding is mutually recursive.
|
|
33
33
|
// This field marks a boundary in that recursion to avoid constructing excessively complex
|
|
34
34
|
// recursive types. Encoded changes are validated at this boundary at runtime--see modularChangeCodecs.ts.
|
|
@@ -10,21 +10,50 @@ import {
|
|
|
10
10
|
type ICodecOptions,
|
|
11
11
|
type IJsonCodec,
|
|
12
12
|
makeCodecFamily,
|
|
13
|
+
makeVersionDispatchingCodec,
|
|
13
14
|
withSchemaValidation,
|
|
14
15
|
} from "../../codec/index.js";
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
makeSchemaCodec,
|
|
18
|
+
SchemaCodecVersion,
|
|
19
|
+
type Format as FormatV1,
|
|
20
|
+
} from "../schema-index/index.js";
|
|
16
21
|
|
|
17
22
|
import { EncodedSchemaChange } from "./schemaChangeFormat.js";
|
|
18
23
|
import type { SchemaChange } from "./schemaChangeTypes.js";
|
|
19
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Create a family of schema change codecs.
|
|
27
|
+
* @param options - Specifies common codec options, including which `validator` to use.
|
|
28
|
+
* @returns The composed codec family.
|
|
29
|
+
*/
|
|
20
30
|
export function makeSchemaChangeCodecs(options: ICodecOptions): ICodecFamily<SchemaChange> {
|
|
21
|
-
return makeCodecFamily([[
|
|
31
|
+
return makeCodecFamily([[SchemaCodecVersion.v1, makeSchemaChangeCodecV1(options)]]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a schema change codec.
|
|
36
|
+
* @param options - Specifies common codec options, including which `validator` to use.
|
|
37
|
+
* @param writeVersion - The schema change write version.
|
|
38
|
+
* @returns The composed codec.
|
|
39
|
+
*/
|
|
40
|
+
export function makeSchemaChangeCodec(
|
|
41
|
+
options: ICodecOptions,
|
|
42
|
+
writeVersion: SchemaCodecVersion,
|
|
43
|
+
): IJsonCodec<SchemaChange> {
|
|
44
|
+
const family = makeSchemaChangeCodecs(options);
|
|
45
|
+
return makeVersionDispatchingCodec(family, { ...options, writeVersion });
|
|
22
46
|
}
|
|
23
47
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Compose the v1 schema change codec.
|
|
50
|
+
* @param options - The codec options.
|
|
51
|
+
* @returns The composed schema change codec.
|
|
52
|
+
*/
|
|
53
|
+
function makeSchemaChangeCodecV1(
|
|
54
|
+
options: ICodecOptions,
|
|
55
|
+
): IJsonCodec<SchemaChange, EncodedSchemaChange> {
|
|
56
|
+
const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
|
|
28
57
|
const schemaChangeCodec: IJsonCodec<SchemaChange, EncodedSchemaChange> = {
|
|
29
58
|
encode: (schemaChange) => {
|
|
30
59
|
assert(
|
|
@@ -32,8 +61,8 @@ function makeSchemaChangeCodec({
|
|
|
32
61
|
0x933 /* Inverse schema changes should never be transmitted */,
|
|
33
62
|
);
|
|
34
63
|
return {
|
|
35
|
-
new: schemaCodec.encode(schemaChange.schema.new),
|
|
36
|
-
old: schemaCodec.encode(schemaChange.schema.old),
|
|
64
|
+
new: schemaCodec.encode(schemaChange.schema.new) as FormatV1,
|
|
65
|
+
old: schemaCodec.encode(schemaChange.schema.old) as FormatV1,
|
|
37
66
|
};
|
|
38
67
|
},
|
|
39
68
|
decode: (encoded) => {
|
|
@@ -48,5 +77,5 @@ function makeSchemaChangeCodec({
|
|
|
48
77
|
encodedSchema: EncodedSchemaChange,
|
|
49
78
|
};
|
|
50
79
|
|
|
51
|
-
return withSchemaValidation(EncodedSchemaChange, schemaChangeCodec,
|
|
80
|
+
return withSchemaValidation(EncodedSchemaChange, schemaChangeCodec, options.jsonValidator);
|
|
52
81
|
}
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { type Static, Type } from "@sinclair/typebox";
|
|
7
|
-
|
|
8
|
-
import { Format } from "../schema-index/index.js";
|
|
7
|
+
import { Format as FormatV1 } from "../schema-index/index.js";
|
|
9
8
|
|
|
10
9
|
export const EncodedSchemaChange = Type.Object({
|
|
11
|
-
new:
|
|
12
|
-
old:
|
|
10
|
+
new: FormatV1,
|
|
11
|
+
old: FormatV1,
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
export type EncodedSchemaChange = Static<typeof EncodedSchemaChange>;
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { fail } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import {
|
|
8
|
+
type FluidClientVersion,
|
|
9
|
+
type ICodecFamily,
|
|
8
10
|
type ICodecOptions,
|
|
9
11
|
type IJsonCodec,
|
|
12
|
+
makeCodecFamily,
|
|
13
|
+
makeVersionDispatchingCodec,
|
|
10
14
|
makeVersionedValidatedCodec,
|
|
11
15
|
} from "../../codec/index.js";
|
|
12
16
|
import {
|
|
@@ -15,15 +19,77 @@ import {
|
|
|
15
19
|
type TreeStoredSchema,
|
|
16
20
|
decodeFieldSchema,
|
|
17
21
|
encodeFieldSchema,
|
|
18
|
-
|
|
22
|
+
schemaFormatV1,
|
|
19
23
|
storedSchemaDecodeDispatcher,
|
|
20
24
|
} from "../../core/index.js";
|
|
21
|
-
import { brand } from "../../util/index.js";
|
|
25
|
+
import { brand, type JsonCompatible } from "../../util/index.js";
|
|
22
26
|
|
|
23
|
-
import { Format } from "./
|
|
27
|
+
import { Format as FormatV1 } from "./formatV1.js";
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Versions for the codec that encodes an in-memory representation of a stored schema {@link TreeStoredSchema} into a persisted format (or decodes it in the opposite direction).
|
|
31
|
+
*/
|
|
32
|
+
export enum SchemaCodecVersion {
|
|
33
|
+
v1 = 1,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Convert a FluidClientVersion to a SchemaCodecVersion.
|
|
38
|
+
* @param clientVersion - The FluidClientVersion to convert.
|
|
39
|
+
* @returns The SchemaCodecVersion that corresponds to the provided FluidClientVersion.
|
|
40
|
+
*/
|
|
41
|
+
export function clientVersionToSchemaVersion(
|
|
42
|
+
clientVersion: FluidClientVersion,
|
|
43
|
+
): SchemaCodecVersion {
|
|
44
|
+
// Only one version of the schema codec is currently supported.
|
|
45
|
+
return SchemaCodecVersion.v1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Create a schema codec.
|
|
50
|
+
* @param options - Specifies common codec options, including which `validator` to use.
|
|
51
|
+
* @param writeVersion - The schema write version.
|
|
52
|
+
* @returns The composed codec.
|
|
53
|
+
*
|
|
54
|
+
* @privateRemarks We should consider using the Shared Tree format version instead as it may be more valuable for application authors than the schema version.
|
|
55
|
+
*/
|
|
56
|
+
export function makeSchemaCodec(
|
|
57
|
+
options: ICodecOptions,
|
|
58
|
+
writeVersion: SchemaCodecVersion,
|
|
59
|
+
): IJsonCodec<TreeStoredSchema> {
|
|
60
|
+
const family = makeSchemaCodecs(options);
|
|
61
|
+
return makeVersionDispatchingCodec(family, { ...options, writeVersion });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Create a family of schema codecs.
|
|
66
|
+
* @param options - Specifies common codec options, including which `validator` to use.
|
|
67
|
+
* @returns The composed codec family.
|
|
68
|
+
*/
|
|
69
|
+
export function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStoredSchema> {
|
|
70
|
+
return makeCodecFamily([[SchemaCodecVersion.v1, makeSchemaCodecV1(options)]]);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Encode an in-memory TreeStoredSchema into the specified format version.
|
|
75
|
+
* @param repo - The in-memory schema.
|
|
76
|
+
* @param version - The schema write version.
|
|
77
|
+
* @returns The encoded schema.
|
|
78
|
+
*/
|
|
79
|
+
export function encodeRepo(
|
|
80
|
+
repo: TreeStoredSchema,
|
|
81
|
+
version: SchemaCodecVersion,
|
|
82
|
+
): JsonCompatible {
|
|
83
|
+
switch (version) {
|
|
84
|
+
case SchemaCodecVersion.v1:
|
|
85
|
+
return encodeRepoV1(repo);
|
|
86
|
+
default:
|
|
87
|
+
unreachableCase(version);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function encodeRepoV1(repo: TreeStoredSchema): FormatV1 {
|
|
92
|
+
const nodeSchema: Record<string, schemaFormatV1.TreeNodeSchemaDataFormat> =
|
|
27
93
|
Object.create(null);
|
|
28
94
|
const rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);
|
|
29
95
|
for (const name of [...repo.nodeSchema.keys()].sort()) {
|
|
@@ -36,13 +102,13 @@ export function encodeRepo(repo: TreeStoredSchema): Format {
|
|
|
36
102
|
});
|
|
37
103
|
}
|
|
38
104
|
return {
|
|
39
|
-
version:
|
|
105
|
+
version: schemaFormatV1.version,
|
|
40
106
|
nodes: nodeSchema,
|
|
41
107
|
root: rootFieldSchema,
|
|
42
108
|
};
|
|
43
109
|
}
|
|
44
110
|
|
|
45
|
-
function decode(f:
|
|
111
|
+
function decode(f: FormatV1): TreeStoredSchema {
|
|
46
112
|
const nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();
|
|
47
113
|
for (const [key, schema] of Object.entries(f.nodes)) {
|
|
48
114
|
nodeSchema.set(brand(key), storedSchemaDecodeDispatcher.dispatch(schema));
|
|
@@ -55,10 +121,12 @@ function decode(f: Format): TreeStoredSchema {
|
|
|
55
121
|
|
|
56
122
|
/**
|
|
57
123
|
* Creates a codec which performs synchronous monolithic encoding of schema content.
|
|
124
|
+
* @param options - Specifies common codec options, including which `validator` to use.
|
|
125
|
+
* @returns The codec.
|
|
58
126
|
*/
|
|
59
|
-
|
|
60
|
-
return makeVersionedValidatedCodec(options, new Set([
|
|
61
|
-
encode: (data: TreeStoredSchema) =>
|
|
62
|
-
decode: (data:
|
|
127
|
+
function makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV1> {
|
|
128
|
+
return makeVersionedValidatedCodec(options, new Set([schemaFormatV1.version]), FormatV1, {
|
|
129
|
+
encode: (data: TreeStoredSchema) => encodeRepoV1(data),
|
|
130
|
+
decode: (data: FormatV1) => decode(data),
|
|
63
131
|
});
|
|
64
132
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { schemaFormatV1 } from "../../core/index.js";
|
|
9
9
|
|
|
10
10
|
const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
11
11
|
|
|
@@ -21,9 +21,9 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
|
|
|
21
21
|
*/
|
|
22
22
|
export const Format = Type.Object(
|
|
23
23
|
{
|
|
24
|
-
version: Type.Literal(
|
|
25
|
-
nodes: Type.Record(Type.String(),
|
|
26
|
-
root:
|
|
24
|
+
version: Type.Literal(schemaFormatV1.version),
|
|
25
|
+
nodes: Type.Record(Type.String(), schemaFormatV1.TreeNodeSchemaDataFormat),
|
|
26
|
+
root: schemaFormatV1.FieldSchemaFormat,
|
|
27
27
|
},
|
|
28
28
|
noAdditionalProps,
|
|
29
29
|
);
|
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export { SchemaSummarizer, encodeTreeSchema } from "./schemaSummarizer.js";
|
|
7
|
-
export {
|
|
8
|
-
|
|
7
|
+
export {
|
|
8
|
+
makeSchemaCodec,
|
|
9
|
+
makeSchemaCodecs,
|
|
10
|
+
SchemaCodecVersion,
|
|
11
|
+
clientVersionToSchemaVersion,
|
|
12
|
+
} from "./codec.js";
|
|
13
|
+
export { Format } from "./formatV1.js";
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
} from "@fluidframework/runtime-definitions/internal";
|
|
15
15
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
16
16
|
|
|
17
|
-
import type {
|
|
17
|
+
import type { IJsonCodec } from "../../codec/index.js";
|
|
18
18
|
import {
|
|
19
19
|
type MutableTreeStoredSchema,
|
|
20
20
|
type TreeStoredSchema,
|
|
@@ -27,8 +27,8 @@ import type {
|
|
|
27
27
|
} from "../../shared-tree-core/index.js";
|
|
28
28
|
import type { CollabWindow } from "../incrementalSummarizationUtils.js";
|
|
29
29
|
|
|
30
|
-
import { encodeRepo
|
|
31
|
-
import type {
|
|
30
|
+
import { encodeRepo } from "./codec.js";
|
|
31
|
+
import type { JsonCompatible } from "../../util/index.js";
|
|
32
32
|
|
|
33
33
|
const schemaStringKey = "SchemaString";
|
|
34
34
|
/**
|
|
@@ -37,16 +37,13 @@ const schemaStringKey = "SchemaString";
|
|
|
37
37
|
export class SchemaSummarizer implements Summarizable {
|
|
38
38
|
public readonly key = "Schema";
|
|
39
39
|
|
|
40
|
-
private readonly codec: IJsonCodec<TreeStoredSchema, Format>;
|
|
41
|
-
|
|
42
40
|
private schemaIndexLastChangedSeq: number | undefined;
|
|
43
41
|
|
|
44
42
|
public constructor(
|
|
45
43
|
private readonly schema: MutableTreeStoredSchema,
|
|
46
|
-
options: ICodecOptions,
|
|
47
44
|
collabWindow: CollabWindow,
|
|
45
|
+
private readonly codec: IJsonCodec<TreeStoredSchema>,
|
|
48
46
|
) {
|
|
49
|
-
this.codec = makeSchemaCodec(options);
|
|
50
47
|
this.schema.events.on("afterSchemaChange", () => {
|
|
51
48
|
// Invalidate the cache, as we need to regenerate the blob if the schema changes
|
|
52
49
|
// We are assuming that schema changes from remote ops are valid, as we are in a summarization context.
|
|
@@ -116,6 +113,9 @@ export class SchemaSummarizer implements Summarizable {
|
|
|
116
113
|
* @remarks
|
|
117
114
|
* This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.
|
|
118
115
|
*/
|
|
119
|
-
export function encodeTreeSchema(
|
|
120
|
-
|
|
116
|
+
export function encodeTreeSchema(
|
|
117
|
+
schema: TreeStoredSchema,
|
|
118
|
+
writeVersion: number,
|
|
119
|
+
): JsonCompatible {
|
|
120
|
+
return encodeRepo(schema, writeVersion);
|
|
121
121
|
}
|
package/src/index.ts
CHANGED
|
@@ -254,6 +254,7 @@ export {
|
|
|
254
254
|
configuredSharedTree,
|
|
255
255
|
} from "./treeFactory.js";
|
|
256
256
|
export { SharedTreeAttributes, SharedTreeFactoryType } from "./sharedTreeAttributes.js";
|
|
257
|
+
export { persistedToSimpleSchema } from "./shared-tree/index.js";
|
|
257
258
|
|
|
258
259
|
export {
|
|
259
260
|
type ICodecOptions,
|
package/src/packageVersion.ts
CHANGED
|
@@ -23,9 +23,10 @@ import {
|
|
|
23
23
|
defaultSchemaPolicy,
|
|
24
24
|
TreeCompressionStrategy,
|
|
25
25
|
initializeForest,
|
|
26
|
+
SchemaCodecVersion,
|
|
26
27
|
} from "../feature-libraries/index.js";
|
|
27
28
|
// eslint-disable-next-line import/no-internal-modules
|
|
28
|
-
import type { Format } from "../feature-libraries/schema-index/
|
|
29
|
+
import type { Format } from "../feature-libraries/schema-index/formatV1.js";
|
|
29
30
|
import type {
|
|
30
31
|
TreeViewConfiguration,
|
|
31
32
|
ImplicitFieldSchema,
|
|
@@ -92,7 +93,7 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
|
|
|
92
93
|
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
93
94
|
|
|
94
95
|
const fieldBatchCodec = makeFieldBatchCodec(options, 1);
|
|
95
|
-
const schemaCodec = makeSchemaCodec(options);
|
|
96
|
+
const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
|
|
96
97
|
|
|
97
98
|
const schema = new TreeStoredSchemaRepository(schemaCodec.decode(content.schema as Format));
|
|
98
99
|
const forest = buildConfiguredForest(
|
package/src/shared-tree/index.ts
CHANGED
|
@@ -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,7 +20,6 @@ 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
24
|
import type { SchemaCompatibilityTester } from "../simple-tree/index.js";
|
|
27
25
|
|
|
@@ -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
113
|
viewSchema: SchemaCompatibilityTester,
|
|
117
|
-
allowedSchemaModifications: AllowedUpdateType,
|
|
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 {
|
|
@@ -222,17 +210,9 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
222
210
|
*/
|
|
223
211
|
export function ensureSchema(
|
|
224
212
|
viewSchema: SchemaCompatibilityTester,
|
|
225
|
-
allowedSchemaModifications: AllowedUpdateType,
|
|
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;
|
|
@@ -244,16 +224,6 @@ export function ensureSchema(
|
|
|
244
224
|
checkout.updateSchema(viewSchema.viewSchemaAsStored);
|
|
245
225
|
return true;
|
|
246
226
|
}
|
|
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);
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
227
|
default: {
|
|
258
228
|
unreachableCase(updatedNeeded);
|
|
259
229
|
}
|
|
@@ -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,
|
|
@@ -207,15 +207,7 @@ export class SchematizingSimpleTreeView<
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
this.runSchemaEdit(() => {
|
|
210
|
-
const result = ensureSchema(
|
|
211
|
-
this.viewSchema,
|
|
212
|
-
AllowedUpdateType.SchemaCompatible,
|
|
213
|
-
this.checkout,
|
|
214
|
-
{
|
|
215
|
-
schema: this.viewSchema.viewSchemaAsStored,
|
|
216
|
-
initialTree: undefined,
|
|
217
|
-
},
|
|
218
|
-
);
|
|
210
|
+
const result = ensureSchema(this.viewSchema, this.checkout);
|
|
219
211
|
assert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);
|
|
220
212
|
});
|
|
221
213
|
}
|