@fluidframework/tree 2.63.0-359734 → 2.63.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 +81 -0
- package/api-report/tree.alpha.api.md +42 -8
- package/dist/alpha.d.ts +7 -0
- package/dist/codec/codec.d.ts +10 -27
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +9 -28
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +6 -5
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +4 -4
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +1 -1
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +70 -35
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -8
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +15 -0
- package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +3 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.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 +2 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +6 -5
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +3 -3
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- 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 +2 -2
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +5 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +37 -7
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +6 -8
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +7 -9
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/tree.js +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +3 -2
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +34 -14
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js +3 -0
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +4 -3
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +3 -3
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +2 -2
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +3 -3
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +60 -1
- 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/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -2
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +7 -11
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +24 -47
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.js +1 -1
- package/dist/simple-tree/getTreeNodeForField.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 +2 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +6 -6
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +36 -4
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +43 -15
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +13 -4
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +7 -0
- package/lib/codec/codec.d.ts +10 -27
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +8 -27
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +6 -5
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +4 -4
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +1 -1
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +68 -32
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -8
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +11 -0
- package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.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/schema-index/codec.d.ts +6 -5
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +3 -3
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- 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 +3 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +5 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +40 -10
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +6 -8
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +8 -10
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/tree.js +2 -2
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +4 -4
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +3 -2
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +34 -14
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js +3 -0
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +4 -3
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +3 -3
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +2 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +4 -4
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +60 -1
- 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/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -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/treeNodeKernel.d.ts +7 -11
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +23 -46
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/getTreeNodeForField.js +1 -1
- package/lib/simple-tree/getTreeNodeForField.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/node-kinds/array/arrayNode.js +3 -3
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +3 -3
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +4 -4
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +7 -7
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +36 -4
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +45 -17
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +13 -4
- package/lib/treeFactory.js.map +1 -1
- package/package.json +21 -20
- package/src/codec/codec.ts +11 -29
- package/src/codec/versioned/codec.ts +6 -6
- package/src/core/tree/detachedFieldIndex.ts +1 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +112 -45
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +7 -12
- package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +33 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +4 -7
- package/src/feature-libraries/chunked-forest/index.ts +2 -0
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +1 -1
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +8 -12
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +3 -12
- package/src/feature-libraries/index.ts +2 -0
- package/src/feature-libraries/schema-index/codec.ts +5 -5
- package/src/index.ts +7 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +3 -0
- package/src/shared-tree/schematizingTreeView.ts +63 -8
- package/src/shared-tree/sharedTree.ts +34 -21
- package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -1
- package/src/shared-tree/tree.ts +2 -2
- package/src/shared-tree/treeAlpha.ts +6 -12
- package/src/shared-tree/treeCheckout.ts +1 -1
- package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
- package/src/simple-tree/api/index.ts +7 -0
- package/src/simple-tree/api/schemaFactoryAlpha.ts +79 -19
- package/src/simple-tree/api/schemaStatics.ts +3 -0
- package/src/simple-tree/api/storedSchema.ts +5 -4
- package/src/simple-tree/api/treeBeta.ts +2 -2
- package/src/simple-tree/api/treeNodeApi.ts +4 -4
- package/src/simple-tree/api/typesUnsafe.ts +81 -0
- package/src/simple-tree/core/TreeNodeBinding.md +14 -70
- package/src/simple-tree/core/allowedTypes.ts +4 -1
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +25 -59
- package/src/simple-tree/getTreeNodeForField.ts +1 -1
- package/src/simple-tree/index.ts +8 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +3 -3
- package/src/simple-tree/node-kinds/map/mapNode.ts +3 -3
- package/src/simple-tree/node-kinds/object/objectNode.ts +4 -4
- package/src/simple-tree/node-kinds/record/recordNode.ts +7 -7
- package/src/simple-tree/prepareForInsertion.ts +87 -25
- package/src/treeFactory.ts +17 -4
|
@@ -12,10 +12,8 @@ import {
|
|
|
12
12
|
type ITreeCursorSynchronous,
|
|
13
13
|
LeafNodeStoredSchema,
|
|
14
14
|
ObjectNodeStoredSchema,
|
|
15
|
-
type StoredSchemaCollection,
|
|
16
15
|
type TreeFieldStoredSchema,
|
|
17
16
|
type TreeNodeSchemaIdentifier,
|
|
18
|
-
type TreeStoredSchema,
|
|
19
17
|
type TreeStoredSchemaSubscription,
|
|
20
18
|
type TreeValue,
|
|
21
19
|
type Value,
|
|
@@ -24,6 +22,7 @@ import {
|
|
|
24
22
|
ValueSchema,
|
|
25
23
|
type TreeChunk,
|
|
26
24
|
tryGetChunk,
|
|
25
|
+
type SchemaAndPolicy,
|
|
27
26
|
} from "../../core/index.js";
|
|
28
27
|
import { getOrCreate } from "../../util/index.js";
|
|
29
28
|
import type { FullSchemaPolicy } from "../modular-schema/index.js";
|
|
@@ -32,6 +31,7 @@ import { isStableNodeIdentifier } from "../node-identifier/index.js";
|
|
|
32
31
|
import { BasicChunk } from "./basicChunk.js";
|
|
33
32
|
import { SequenceChunk } from "./sequenceChunk.js";
|
|
34
33
|
import { type FieldShape, TreeShape, UniformChunk } from "./uniformChunk.js";
|
|
34
|
+
import type { IncrementalEncodingPolicy } from "./codec/index.js";
|
|
35
35
|
|
|
36
36
|
export interface Disposable {
|
|
37
37
|
/**
|
|
@@ -39,13 +39,13 @@ export interface Disposable {
|
|
|
39
39
|
*/
|
|
40
40
|
dispose(): void;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
42
|
/**
|
|
44
43
|
* Creates a ChunkPolicy which responds to schema changes.
|
|
45
44
|
*/
|
|
46
45
|
export function makeTreeChunker(
|
|
47
46
|
schema: TreeStoredSchemaSubscription,
|
|
48
47
|
policy: FullSchemaPolicy,
|
|
48
|
+
shouldEncodeIncrementally: IncrementalEncodingPolicy,
|
|
49
49
|
): IChunker {
|
|
50
50
|
return new Chunker(
|
|
51
51
|
schema,
|
|
@@ -53,7 +53,16 @@ export function makeTreeChunker(
|
|
|
53
53
|
defaultChunkPolicy.sequenceChunkInlineThreshold,
|
|
54
54
|
defaultChunkPolicy.sequenceChunkInlineThreshold,
|
|
55
55
|
defaultChunkPolicy.uniformChunkNodeCount,
|
|
56
|
-
|
|
56
|
+
(type: TreeNodeSchemaIdentifier, shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>) =>
|
|
57
|
+
tryShapeFromNodeSchema(
|
|
58
|
+
{
|
|
59
|
+
schema,
|
|
60
|
+
policy,
|
|
61
|
+
shouldEncodeIncrementally,
|
|
62
|
+
shapes,
|
|
63
|
+
},
|
|
64
|
+
type,
|
|
65
|
+
),
|
|
57
66
|
);
|
|
58
67
|
}
|
|
59
68
|
|
|
@@ -73,7 +82,7 @@ export interface IChunker extends ChunkPolicy, Disposable {
|
|
|
73
82
|
*
|
|
74
83
|
* @remarks
|
|
75
84
|
* For example, a schema transitively containing a sequence field, optional field, or allowing multiple child types will be Polymorphic.
|
|
76
|
-
* See `
|
|
85
|
+
* See `tryShapeFromNodeSchema` for how to tell if a type is Polymorphic.
|
|
77
86
|
*
|
|
78
87
|
* TODO: cache some of the possible shapes here.
|
|
79
88
|
*/
|
|
@@ -109,9 +118,7 @@ export class Chunker implements IChunker {
|
|
|
109
118
|
public readonly sequenceChunkInlineThreshold: number,
|
|
110
119
|
public readonly uniformChunkNodeCount: number,
|
|
111
120
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
112
|
-
private readonly
|
|
113
|
-
schema: TreeStoredSchema,
|
|
114
|
-
policy: FullSchemaPolicy,
|
|
121
|
+
private readonly tryShapeFromNodeSchema: (
|
|
115
122
|
type: TreeNodeSchemaIdentifier,
|
|
116
123
|
shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
|
|
117
124
|
) => ShapeInfo,
|
|
@@ -126,7 +133,7 @@ export class Chunker implements IChunker {
|
|
|
126
133
|
this.sequenceChunkSplitThreshold,
|
|
127
134
|
this.sequenceChunkInlineThreshold,
|
|
128
135
|
this.uniformChunkNodeCount,
|
|
129
|
-
this.
|
|
136
|
+
this.tryShapeFromNodeSchema,
|
|
130
137
|
);
|
|
131
138
|
}
|
|
132
139
|
|
|
@@ -138,7 +145,7 @@ export class Chunker implements IChunker {
|
|
|
138
145
|
this.unregisterSchemaCallback = this.schema.events.on("afterSchemaChange", () =>
|
|
139
146
|
this.schemaChanged(),
|
|
140
147
|
);
|
|
141
|
-
return this.
|
|
148
|
+
return this.tryShapeFromNodeSchema(schema, this.typeShapes);
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
public dispose(): void {
|
|
@@ -226,75 +233,126 @@ export function makePolicy(policy?: Partial<ChunkPolicy>): ChunkPolicy {
|
|
|
226
233
|
return withDefaults;
|
|
227
234
|
}
|
|
228
235
|
|
|
229
|
-
export
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
export interface ShapeFromSchemaParameters extends SchemaAndPolicy {
|
|
237
|
+
/**
|
|
238
|
+
* Policy function to determine if a field should be encoded incrementally.
|
|
239
|
+
* Incrementally encoding requires the subtree to not start in the middle of a larger uniform chunk.
|
|
240
|
+
* Thus returning true from this callback indicates that shapes should not be produced which could
|
|
241
|
+
*contain the incremental portion as a part of a larger shape.
|
|
242
|
+
*/
|
|
243
|
+
readonly shouldEncodeIncrementally: IncrementalEncodingPolicy;
|
|
244
|
+
/**
|
|
245
|
+
* A cache for shapes which may be read and/or updated.
|
|
246
|
+
* As the shape is a function of the other members of `ShapeFromSchemaParameters`,
|
|
247
|
+
* it must be replaced or cleared if any of the properties other than this cache are modified.
|
|
248
|
+
*/
|
|
249
|
+
readonly shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* A TreeFieldStoredSchema with some additional context about where it is in the tree.
|
|
254
|
+
*/
|
|
255
|
+
export interface FieldSchemaWithContext {
|
|
256
|
+
/**
|
|
257
|
+
* The identifier of the specific field schema to analyze for shape uniformity.
|
|
258
|
+
*/
|
|
259
|
+
readonly fieldSchema: TreeFieldStoredSchema;
|
|
260
|
+
/**
|
|
261
|
+
* The identifier of the parent node schema containing this field.
|
|
262
|
+
* If undefined, this is a root field.
|
|
263
|
+
*/
|
|
264
|
+
readonly parentNodeSchema?: TreeNodeSchemaIdentifier;
|
|
265
|
+
/**
|
|
266
|
+
* The field key/name used to identify this field within the parent node.
|
|
267
|
+
*/
|
|
268
|
+
readonly key: FieldKey;
|
|
238
269
|
}
|
|
239
270
|
|
|
240
271
|
/**
|
|
241
|
-
*
|
|
272
|
+
* Analyzes a tree node schema to determine if it has a single, uniform shape that can be optimized for chunking.
|
|
273
|
+
* If the schema defines a tree structure with a deterministic, fixed shape (no optional fields, no sequences,
|
|
274
|
+
* single child types), returns a TreeShape that can be used for efficient uniform chunking. Otherwise,
|
|
275
|
+
* returns Polymorphic to indicate the shape varies and should use basic chunking.
|
|
276
|
+
*
|
|
277
|
+
* @param context - {@link ShapeFromSchemaParameters}.
|
|
278
|
+
* @param nodeSchema - The identifier of the specific node schema to analyze for shape uniformity.
|
|
279
|
+
* @returns TreeShape if the schema has a uniform shape, or Polymorphic if shape varies.
|
|
242
280
|
*
|
|
243
|
-
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* The determination here is conservative. `shouldEncodeIncrementally` is used to split up shapes so incrementally
|
|
283
|
+
* encoded schema are not part of larger shapes. It also does not tolerate optional or sequence fields, nor does it
|
|
284
|
+
* optimize for patterns of specific values.
|
|
244
285
|
*/
|
|
245
|
-
export function
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
type: TreeNodeSchemaIdentifier,
|
|
249
|
-
shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
|
|
286
|
+
export function tryShapeFromNodeSchema(
|
|
287
|
+
context: ShapeFromSchemaParameters,
|
|
288
|
+
nodeSchema: TreeNodeSchemaIdentifier,
|
|
250
289
|
): ShapeInfo {
|
|
251
|
-
|
|
252
|
-
|
|
290
|
+
const { schema, shapes } = context;
|
|
291
|
+
return getOrCreate(shapes, nodeSchema, () => {
|
|
292
|
+
const treeSchema = schema.nodeSchema.get(nodeSchema) ?? fail(0xaf9 /* missing schema */);
|
|
253
293
|
if (treeSchema instanceof LeafNodeStoredSchema) {
|
|
254
294
|
// Allow all string values (but only string values) to be compressed by the id compressor.
|
|
255
295
|
// This allows compressing all compressible identifiers without requiring additional context to know which values could be identifiers.
|
|
256
296
|
// Attempting to compress other string shouldn't have significant overhead,
|
|
257
297
|
// and if any of them do end up compressing, that's a benefit not a bug.
|
|
258
298
|
return treeSchema.leafValue === ValueSchema.String
|
|
259
|
-
? new TreeShape(
|
|
260
|
-
: new TreeShape(
|
|
299
|
+
? new TreeShape(nodeSchema, true, [], true)
|
|
300
|
+
: new TreeShape(nodeSchema, true, [], false);
|
|
261
301
|
}
|
|
262
302
|
if (treeSchema instanceof ObjectNodeStoredSchema) {
|
|
263
303
|
const fieldsArray: FieldShape[] = [];
|
|
264
|
-
for (const [key,
|
|
265
|
-
const fieldShape = tryShapeFromFieldSchema(
|
|
304
|
+
for (const [key, fieldSchema] of treeSchema.objectNodeFields) {
|
|
305
|
+
const fieldShape = tryShapeFromFieldSchema(context, {
|
|
306
|
+
fieldSchema,
|
|
307
|
+
parentNodeSchema: nodeSchema,
|
|
308
|
+
key,
|
|
309
|
+
});
|
|
266
310
|
if (fieldShape === undefined) {
|
|
267
311
|
return polymorphic;
|
|
268
312
|
}
|
|
269
313
|
fieldsArray.push(fieldShape);
|
|
270
314
|
}
|
|
271
|
-
return new TreeShape(
|
|
315
|
+
return new TreeShape(nodeSchema, false, fieldsArray);
|
|
272
316
|
}
|
|
273
317
|
return polymorphic;
|
|
274
318
|
});
|
|
275
319
|
}
|
|
276
320
|
|
|
277
321
|
/**
|
|
278
|
-
*
|
|
322
|
+
* Same as {@link tryShapeFromNodeSchema} but for fields with {@link FieldSchemaWithContext} instead of a nodeSchema.
|
|
279
323
|
*
|
|
280
|
-
*
|
|
324
|
+
* @param context - {@link ShapeFromFieldSchemaParameters}.
|
|
325
|
+
* @param fieldSchemaWithContext - {@link FieldSchemaWithContext}.
|
|
326
|
+
* @returns FieldShape if the field has a uniform shape, or undefined if the field is polymorphic.
|
|
281
327
|
*/
|
|
282
328
|
export function tryShapeFromFieldSchema(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
type: TreeFieldStoredSchema,
|
|
286
|
-
key: FieldKey,
|
|
287
|
-
shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
|
|
329
|
+
context: ShapeFromSchemaParameters,
|
|
330
|
+
fieldSchemaWithContext: FieldSchemaWithContext,
|
|
288
331
|
): FieldShape | undefined {
|
|
289
|
-
const
|
|
332
|
+
const { schema, policy, shouldEncodeIncrementally, shapes } = context;
|
|
333
|
+
const { fieldSchema, parentNodeSchema, key } = fieldSchemaWithContext;
|
|
334
|
+
// If this field should be encoded incrementally, use polymorphic shape so that they
|
|
335
|
+
// are chunked separately and can be re-used across encodings if they do not change.
|
|
336
|
+
if (shouldEncodeIncrementally(parentNodeSchema, key)) {
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
339
|
+
const kind = policy.fieldKinds.get(fieldSchema.kind) ?? fail(0xafa /* missing FieldKind */);
|
|
290
340
|
if (kind.multiplicity !== Multiplicity.Single) {
|
|
291
341
|
return undefined;
|
|
292
342
|
}
|
|
293
|
-
if (
|
|
343
|
+
if (fieldSchema.types?.size !== 1) {
|
|
294
344
|
return undefined;
|
|
295
345
|
}
|
|
296
|
-
const childType = [...
|
|
297
|
-
const childShape =
|
|
346
|
+
const childType = [...fieldSchema.types][0] ?? oob();
|
|
347
|
+
const childShape = tryShapeFromNodeSchema(
|
|
348
|
+
{
|
|
349
|
+
schema,
|
|
350
|
+
policy,
|
|
351
|
+
shouldEncodeIncrementally,
|
|
352
|
+
shapes,
|
|
353
|
+
},
|
|
354
|
+
childType,
|
|
355
|
+
);
|
|
298
356
|
if (childShape instanceof Polymorphic) {
|
|
299
357
|
return undefined;
|
|
300
358
|
}
|
|
@@ -490,7 +548,16 @@ export function chunkRange(
|
|
|
490
548
|
return output;
|
|
491
549
|
}
|
|
492
550
|
/**
|
|
493
|
-
*
|
|
551
|
+
* Extracts values from the current cursor position according to the provided tree shape.
|
|
552
|
+
*
|
|
553
|
+
* Walks through the tree structure defined by the shape, extracting values from leaf nodes
|
|
554
|
+
* and recursively processing child fields. If an ID compressor is provided, compressible
|
|
555
|
+
* string values (stable node identifiers) will be recompressed for optimal storage.
|
|
556
|
+
*
|
|
557
|
+
* @param cursor - Tree cursor positioned at the node to extract values from
|
|
558
|
+
* @param shape - The tree shape defining the structure to extract
|
|
559
|
+
* @param values - Array to append the extracted values to
|
|
560
|
+
* @param idCompressor - Optional compressor used to encode string values that are compressible by the idCompressor for in-memory representation.
|
|
494
561
|
* If the idCompressor is not provided, the values will be the original uncompressed values.
|
|
495
562
|
*/
|
|
496
563
|
export function insertValues(
|
|
@@ -8,18 +8,15 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
type CodecTree,
|
|
11
|
-
type FluidClientVersion,
|
|
12
11
|
type ICodecOptions,
|
|
13
12
|
type IJsonCodec,
|
|
14
13
|
makeVersionedValidatedCodec,
|
|
15
14
|
} from "../../../codec/index.js";
|
|
16
15
|
import {
|
|
17
16
|
CursorLocationType,
|
|
18
|
-
type FieldKey,
|
|
19
17
|
type ITreeCursorSynchronous,
|
|
20
18
|
type SchemaAndPolicy,
|
|
21
19
|
type TreeChunk,
|
|
22
|
-
type TreeNodeSchemaIdentifier,
|
|
23
20
|
} from "../../../core/index.js";
|
|
24
21
|
import {
|
|
25
22
|
brandedNumberType,
|
|
@@ -37,6 +34,8 @@ import type { FieldBatch } from "./fieldBatch.js";
|
|
|
37
34
|
import { EncodedFieldBatch, validVersions, type FieldBatchFormatVersion } from "./format.js";
|
|
38
35
|
import { schemaCompressedEncode } from "./schemaBasedEncode.js";
|
|
39
36
|
import { uncompressedEncode } from "./uncompressedEncode.js";
|
|
37
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
38
|
+
import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Reference ID for a chunk that is incrementally encoded.
|
|
@@ -55,14 +54,10 @@ const ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, mi
|
|
|
55
54
|
*/
|
|
56
55
|
export interface IncrementalEncoder {
|
|
57
56
|
/**
|
|
58
|
-
* Returns whether a field should be incrementally encoded.
|
|
59
|
-
* @
|
|
60
|
-
* @param fieldKey - The key of the field to check.
|
|
57
|
+
* Returns whether a node / field should be incrementally encoded.
|
|
58
|
+
* @remarks See {@link IncrementalEncodingPolicy}.
|
|
61
59
|
*/
|
|
62
|
-
|
|
63
|
-
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
64
|
-
fieldKey: FieldKey,
|
|
65
|
-
): boolean;
|
|
60
|
+
shouldEncodeIncrementally: IncrementalEncodingPolicy;
|
|
66
61
|
/**
|
|
67
62
|
* Called to encode an incremental field at the cursor.
|
|
68
63
|
* The chunks for this field are encoded separately from the main buffer.
|
|
@@ -120,12 +115,12 @@ export type FieldBatchCodec = IJsonCodec<
|
|
|
120
115
|
>;
|
|
121
116
|
|
|
122
117
|
/**
|
|
123
|
-
* Get the write version for {@link makeFieldBatchCodec} based on the `
|
|
118
|
+
* Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.
|
|
124
119
|
* @privateRemarks
|
|
125
120
|
* TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
|
|
126
121
|
*/
|
|
127
122
|
export function fluidVersionToFieldBatchCodecWriteVersion(
|
|
128
|
-
|
|
123
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
129
124
|
): number {
|
|
130
125
|
// There is currently on only 1 version.
|
|
131
126
|
return 1;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FieldKey, TreeNodeSchemaIdentifier } from "../../../core/index.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Policy to determine whether a node / field should be incrementally encoded.
|
|
10
|
+
* @param nodeIdentifier - The identifier of the node containing the field.
|
|
11
|
+
* If undefined, the field is a root field.
|
|
12
|
+
* @param fieldKey - The key of the field to check.
|
|
13
|
+
* @returns whether the node / field should be incrementally encoded.
|
|
14
|
+
* @remarks
|
|
15
|
+
* Incremental encoding has a significant size overhead,
|
|
16
|
+
* but allows reuse of previously encoded unchanged subtrees.
|
|
17
|
+
* Thus it should only be enabled for large subtrees which are modified infrequently.
|
|
18
|
+
* TODO: AB#9068: Measure the actual overhead.
|
|
19
|
+
*/
|
|
20
|
+
export type IncrementalEncodingPolicy = (
|
|
21
|
+
nodeIdentifier: TreeNodeSchemaIdentifier | undefined,
|
|
22
|
+
fieldKey: FieldKey,
|
|
23
|
+
) => boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Default policy for incremental encoding is to not encode incrementally.
|
|
27
|
+
*/
|
|
28
|
+
export const defaultIncrementalEncodingPolicy: IncrementalEncodingPolicy = (
|
|
29
|
+
nodeIdentifier: TreeNodeSchemaIdentifier | undefined,
|
|
30
|
+
fieldKey: FieldKey,
|
|
31
|
+
): boolean => {
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
ValueSchema,
|
|
17
17
|
Multiplicity,
|
|
18
18
|
identifierFieldKindIdentifier,
|
|
19
|
-
type FieldKey,
|
|
20
19
|
} from "../../../core/index.js";
|
|
21
20
|
import type { FullSchemaPolicy } from "../../modular-schema/index.js";
|
|
22
21
|
|
|
@@ -35,6 +34,7 @@ import type { FieldBatch } from "./fieldBatch.js";
|
|
|
35
34
|
import { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from "./format.js";
|
|
36
35
|
import type { IncrementalEncoder } from "./codecs.js";
|
|
37
36
|
import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
|
|
37
|
+
import { defaultIncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Encode data from `fieldBatch` in into an `EncodedChunk`.
|
|
@@ -134,14 +134,11 @@ export function getNodeEncoder(
|
|
|
134
134
|
// consider moving some optional and sequence fields to extra fields if they are commonly empty
|
|
135
135
|
// to reduce encoded size.
|
|
136
136
|
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
fieldKey: FieldKey,
|
|
140
|
-
): boolean =>
|
|
141
|
-
incrementalEncoder?.shouldEncodeFieldIncrementally(nodeIdentifier, fieldKey) ?? false;
|
|
137
|
+
const shouldEncodeIncrementally =
|
|
138
|
+
incrementalEncoder?.shouldEncodeIncrementally ?? defaultIncrementalEncodingPolicy;
|
|
142
139
|
const objectNodeFields: KeyedFieldEncoder[] = [];
|
|
143
140
|
for (const [key, field] of schema.objectNodeFields ?? []) {
|
|
144
|
-
const fieldEncoder =
|
|
141
|
+
const fieldEncoder = shouldEncodeIncrementally(schemaName, key)
|
|
145
142
|
? incrementalFieldEncoder
|
|
146
143
|
: fieldBuilder.fieldEncoderFromSchema(field);
|
|
147
144
|
objectNodeFields.push({
|
|
@@ -25,5 +25,7 @@ export {
|
|
|
25
25
|
fluidVersionToFieldBatchCodecWriteVersion,
|
|
26
26
|
type IncrementalEncoderDecoder,
|
|
27
27
|
type ChunkReferenceId,
|
|
28
|
+
type IncrementalEncodingPolicy,
|
|
29
|
+
defaultIncrementalEncodingPolicy,
|
|
28
30
|
} from "./codec/index.js";
|
|
29
31
|
export { emptyChunk } from "./emptyChunk.js";
|
|
@@ -262,7 +262,7 @@ export function getCodecTreeForModularChangeFormat(
|
|
|
262
262
|
version: ModularChangeFormatVersion,
|
|
263
263
|
): CodecTree {
|
|
264
264
|
const dependencies =
|
|
265
|
-
fieldKindConfigurations.get(version) ?? fail(
|
|
265
|
+
fieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);
|
|
266
266
|
const children: CodecTree[] = Array.from(dependencies.entries()).map(
|
|
267
267
|
([key, { formatVersion }]) => ({
|
|
268
268
|
name: `FieldKind:${key}`,
|
|
@@ -398,7 +398,7 @@ export interface FlexTreeOptionalField extends FlexTreeField {
|
|
|
398
398
|
export type FlexTreeTypedField<Kind extends FlexFieldKind> =
|
|
399
399
|
Kind extends typeof FieldKinds.sequence
|
|
400
400
|
? FlexTreeSequenceField
|
|
401
|
-
: Kind extends typeof FieldKinds.required
|
|
401
|
+
: Kind extends typeof FieldKinds.required | typeof FieldKinds.identifier
|
|
402
402
|
? FlexTreeRequiredField
|
|
403
403
|
: Kind extends typeof FieldKinds.optional
|
|
404
404
|
? FlexTreeOptionalField
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
type ITreeSubscriptionCursor,
|
|
24
24
|
type RevisionTagCodec,
|
|
25
25
|
TreeNavigationResult,
|
|
26
|
-
type TreeNodeSchemaIdentifier,
|
|
27
26
|
applyDelta,
|
|
28
27
|
forEachField,
|
|
29
28
|
makeDetachedFieldIndex,
|
|
@@ -36,7 +35,12 @@ import type {
|
|
|
36
35
|
import { idAllocatorFromMaxId, type JsonCompatible } from "../../util/index.js";
|
|
37
36
|
// eslint-disable-next-line import/no-internal-modules
|
|
38
37
|
import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
|
|
39
|
-
import
|
|
38
|
+
import {
|
|
39
|
+
defaultIncrementalEncodingPolicy,
|
|
40
|
+
type FieldBatchCodec,
|
|
41
|
+
type FieldBatchEncodingContext,
|
|
42
|
+
type IncrementalEncodingPolicy,
|
|
43
|
+
} from "../chunked-forest/index.js";
|
|
40
44
|
|
|
41
45
|
import { type ForestCodec, makeForestSummarizerCodec } from "./codec.js";
|
|
42
46
|
import {
|
|
@@ -74,23 +78,15 @@ export class ForestSummarizer implements Summarizable {
|
|
|
74
78
|
private readonly encoderContext: FieldBatchEncodingContext,
|
|
75
79
|
options: CodecWriteOptions,
|
|
76
80
|
private readonly idCompressor: IIdCompressor,
|
|
77
|
-
|
|
78
|
-
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
79
|
-
fieldKey: FieldKey,
|
|
80
|
-
) => boolean,
|
|
81
|
+
shouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,
|
|
81
82
|
) {
|
|
82
83
|
// TODO: this should take in CodecWriteOptions, and use it to pick the write version.
|
|
83
84
|
this.codec = makeForestSummarizerCodec(options, fieldBatchCodec);
|
|
84
|
-
|
|
85
|
-
const shouldEncodeFieldIncrementallyLocal = (
|
|
86
|
-
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
87
|
-
fieldKey: FieldKey,
|
|
88
|
-
): boolean => shouldEncodeFieldIncrementally?.(nodeIdentifier, fieldKey) ?? false;
|
|
89
85
|
this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(
|
|
90
86
|
encoderContext.encodeType ===
|
|
91
87
|
TreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,
|
|
92
88
|
(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),
|
|
93
|
-
|
|
89
|
+
shouldEncodeIncrementally,
|
|
94
90
|
);
|
|
95
91
|
}
|
|
96
92
|
|
|
@@ -20,13 +20,10 @@ import type {
|
|
|
20
20
|
ChunkReferenceId,
|
|
21
21
|
EncodedFieldBatch,
|
|
22
22
|
IncrementalEncoderDecoder,
|
|
23
|
+
IncrementalEncodingPolicy,
|
|
23
24
|
TreeChunk,
|
|
24
25
|
} from "../chunked-forest/index.js";
|
|
25
|
-
import type {
|
|
26
|
-
FieldKey,
|
|
27
|
-
ITreeCursorSynchronous,
|
|
28
|
-
TreeNodeSchemaIdentifier,
|
|
29
|
-
} from "../../core/index.js";
|
|
26
|
+
import type { ITreeCursorSynchronous } from "../../core/index.js";
|
|
30
27
|
import { SummaryType } from "@fluidframework/driver-definitions";
|
|
31
28
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
32
29
|
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
@@ -263,13 +260,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
|
|
|
263
260
|
public constructor(
|
|
264
261
|
private readonly enableIncrementalSummary: boolean,
|
|
265
262
|
private readonly getChunkAtCursor: (cursor: ITreeCursorSynchronous) => TreeChunk,
|
|
266
|
-
|
|
267
|
-
* {@link IncrementalEncoder.shouldEncodeFieldIncrementally}
|
|
268
|
-
*/
|
|
269
|
-
public readonly shouldEncodeFieldIncrementally: (
|
|
270
|
-
nodeIdentifier: TreeNodeSchemaIdentifier,
|
|
271
|
-
fieldKey: FieldKey,
|
|
272
|
-
) => boolean,
|
|
263
|
+
public readonly shouldEncodeIncrementally: IncrementalEncodingPolicy,
|
|
273
264
|
) {}
|
|
274
265
|
|
|
275
266
|
/**
|
|
@@ -7,7 +7,6 @@ import { fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type CodecTree,
|
|
10
|
-
type FluidClientVersion,
|
|
11
10
|
type ICodecFamily,
|
|
12
11
|
type ICodecOptions,
|
|
13
12
|
type IJsonCodec,
|
|
@@ -29,14 +28,15 @@ import { brand, type JsonCompatible } from "../../util/index.js";
|
|
|
29
28
|
|
|
30
29
|
import { Format as FormatV1 } from "./formatV1.js";
|
|
31
30
|
import { Format as FormatV2 } from "./formatV2.js";
|
|
31
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Convert a
|
|
35
|
-
* @param clientVersion - The
|
|
36
|
-
* @returns The SchemaVersion that corresponds to the provided
|
|
34
|
+
* Convert a MinimumVersionForCollab to a SchemaVersion.
|
|
35
|
+
* @param clientVersion - The MinimumVersionForCollab to convert.
|
|
36
|
+
* @returns The SchemaVersion that corresponds to the provided MinimumVersionForCollab.
|
|
37
37
|
*/
|
|
38
38
|
export function clientVersionToSchemaVersion(
|
|
39
|
-
clientVersion:
|
|
39
|
+
clientVersion: MinimumVersionForCollab,
|
|
40
40
|
): SchemaVersion {
|
|
41
41
|
// Only one version of the schema codec is currently supported.
|
|
42
42
|
return SchemaVersion.v1;
|
package/src/index.ts
CHANGED
|
@@ -137,6 +137,13 @@ export {
|
|
|
137
137
|
type ArrayNodeCustomizableSchemaUnsafe,
|
|
138
138
|
type MapNodeCustomizableSchemaUnsafe,
|
|
139
139
|
type TreeRecordNodeUnsafe,
|
|
140
|
+
type UnannotateAllowedTypeUnsafe,
|
|
141
|
+
type AnnotatedAllowedTypeUnsafe,
|
|
142
|
+
type AnnotatedAllowedTypesUnsafe,
|
|
143
|
+
type AllowedTypesFullUnsafe,
|
|
144
|
+
type AllowedTypesFullFromMixedUnsafe,
|
|
145
|
+
type UnannotateAllowedTypesListUnsafe,
|
|
146
|
+
type AnnotateAllowedTypesListUnsafe,
|
|
140
147
|
// System types (not in Internal types for various reasons, like doc links or cannot be named errors).
|
|
141
148
|
type typeSchemaSymbol,
|
|
142
149
|
type TreeNodeSchemaNonClass,
|
package/src/packageVersion.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type FieldBatchEncodingContext,
|
|
27
27
|
defaultSchemaPolicy,
|
|
28
28
|
TreeCompressionStrategy,
|
|
29
|
+
defaultIncrementalEncodingPolicy,
|
|
29
30
|
} from "../feature-libraries/index.js";
|
|
30
31
|
// eslint-disable-next-line import/no-internal-modules
|
|
31
32
|
import type { Format } from "../feature-libraries/schema-index/formatV1.js";
|
|
@@ -67,6 +68,7 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
|
|
|
67
68
|
options.forest ?? defaultSharedTreeOptions.forest,
|
|
68
69
|
schema,
|
|
69
70
|
idCompressor,
|
|
71
|
+
defaultIncrementalEncodingPolicy,
|
|
70
72
|
);
|
|
71
73
|
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
72
74
|
forest,
|
|
@@ -144,6 +146,7 @@ export function independentInitializedViewInternal<const TSchema extends Implici
|
|
|
144
146
|
options.forest ?? defaultSharedTreeOptions.forest,
|
|
145
147
|
schemaRepository,
|
|
146
148
|
idCompressor,
|
|
149
|
+
defaultIncrementalEncodingPolicy,
|
|
147
150
|
);
|
|
148
151
|
|
|
149
152
|
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|