@fluidframework/tree 2.22.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +1 -0
- package/CHANGELOG.md +47 -0
- package/api-report/tree.alpha.api.md +31 -0
- package/dist/alpha.d.ts +1 -0
- package/dist/codec/codec.js +3 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.d.ts.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -3
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +18 -13
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +11 -8
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +6 -4
- package/dist/feature-libraries/chunked-forest/uniformChunk.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/default-schema/schemaChecker.js +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +4 -3
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +5 -4
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +6 -4
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -4
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -11
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +1 -1
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -1
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +6 -4
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +113 -0
- package/dist/jsonDomainSchema.d.ts.map +1 -0
- package/dist/jsonDomainSchema.js +101 -0
- package/dist/jsonDomainSchema.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +108 -0
- package/dist/serializableDomainSchema.d.ts.map +1 -0
- package/dist/serializableDomainSchema.js +90 -0
- package/dist/serializableDomainSchema.js.map +1 -0
- 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.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +37 -20
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +17 -17
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +4 -4
- package/dist/shared-tree/treeApiAlpha.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/editManager.d.ts +11 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +70 -34
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +10 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +42 -7
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +3 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +3 -3
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/tree.js +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +9 -5
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +5 -4
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.js +1 -1
- package/dist/simple-tree/api/view.js.map +1 -1
- package/dist/simple-tree/arrayNode.js +2 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +1 -1
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +6 -6
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/proxies.js +1 -1
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +2 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +5 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/idAllocator.js +1 -1
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +5 -4
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts +2 -10
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +9 -28
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/utils.d.ts +23 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +46 -13
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/codec/codec.js +3 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.d.ts.map +1 -1
- package/lib/codec/discriminatedUnions.js +1 -1
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -3
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +19 -14
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/treeTextFormat.js +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +11 -8
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +14 -14
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
- package/lib/feature-libraries/chunked-forest/uniformChunk.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/default-schema/schemaChecker.js +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +4 -3
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +5 -4
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +6 -4
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +4 -4
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +1 -1
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -1
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +1 -1
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +1 -1
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +6 -4
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +113 -0
- package/lib/jsonDomainSchema.d.ts.map +1 -0
- package/lib/jsonDomainSchema.js +98 -0
- package/lib/jsonDomainSchema.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +108 -0
- package/lib/serializableDomainSchema.d.ts.map +1 -0
- package/lib/serializableDomainSchema.js +87 -0
- package/lib/serializableDomainSchema.js.map +1 -0
- 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.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -1
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +37 -20
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +18 -18
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +4 -4
- package/lib/shared-tree/treeApiAlpha.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/editManager.d.ts +11 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +70 -34
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +10 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +42 -7
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/customTree.js +3 -3
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +3 -3
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/tree.js +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +9 -5
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +5 -4
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.js +1 -1
- package/lib/simple-tree/api/view.js.map +1 -1
- package/lib/simple-tree/arrayNode.js +2 -2
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +1 -1
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +6 -6
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +5 -5
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -2
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/proxies.js +1 -1
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +3 -3
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +2 -1
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +5 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/idAllocator.js +1 -1
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts +2 -10
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +5 -23
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/utils.d.ts +23 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +42 -11
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/codec/codec.ts +3 -3
- package/src/codec/discriminatedUnions.ts +2 -1
- package/src/core/schema-stored/schema.ts +5 -3
- package/src/core/tree/anchorSet.ts +37 -26
- package/src/core/tree/treeTextFormat.ts +1 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +11 -8
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts +4 -3
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +14 -14
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +1 -1
- package/src/feature-libraries/flex-tree/lazyField.ts +6 -8
- package/src/feature-libraries/flex-tree/lazyNode.ts +6 -4
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -1
- package/src/feature-libraries/modular-schema/comparison.ts +7 -5
- package/src/feature-libraries/modular-schema/isNeverTree.ts +6 -4
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -4
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +16 -12
- package/src/feature-libraries/node-key/mockNodeKeyManager.ts +1 -1
- package/src/feature-libraries/object-forest/objectForest.ts +1 -1
- package/src/feature-libraries/schema-index/codec.ts +1 -1
- package/src/feature-libraries/sequence-field/compose.ts +1 -1
- package/src/feature-libraries/sequence-field/invert.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/utils.ts +1 -1
- package/src/feature-libraries/treeCursorUtils.ts +6 -4
- package/src/index.ts +3 -1
- package/src/jsonDomainSchema.ts +129 -0
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +121 -0
- package/src/shared-tree/index.ts +0 -1
- package/src/shared-tree/schematizeTree.ts +1 -1
- package/src/shared-tree/sharedTree.ts +31 -41
- package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
- package/src/shared-tree/treeApiAlpha.ts +12 -4
- package/src/shared-tree/treeCheckout.ts +1 -1
- package/src/shared-tree-core/editManager.ts +85 -47
- package/src/shared-tree-core/resubmitMachine.ts +2 -0
- package/src/shared-tree-core/sharedTreeCore.ts +62 -14
- package/src/simple-tree/api/customTree.ts +3 -3
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
- package/src/simple-tree/api/simpleTreeIndex.ts +3 -3
- package/src/simple-tree/api/tree.ts +1 -1
- package/src/simple-tree/api/treeNodeApi.ts +11 -6
- package/src/simple-tree/api/verboseTree.ts +8 -4
- package/src/simple-tree/api/view.ts +1 -1
- package/src/simple-tree/arrayNode.ts +2 -2
- package/src/simple-tree/core/getOrCreateNode.ts +2 -1
- package/src/simple-tree/core/schemaCaching.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +9 -6
- package/src/simple-tree/core/unhydratedFlexTree.ts +7 -5
- package/src/simple-tree/objectNode.ts +2 -2
- package/src/simple-tree/proxies.ts +1 -1
- package/src/simple-tree/toMapTree.ts +3 -3
- package/src/simple-tree/toStoredSchema.ts +2 -1
- package/src/simple-tree/treeNodeValid.ts +5 -2
- package/src/util/idAllocator.ts +1 -1
- package/src/util/index.ts +3 -2
- package/src/util/nestedMap.ts +9 -33
- package/src/util/utils.ts +52 -12
|
@@ -310,7 +310,11 @@ export const TreeAlpha: {
|
|
|
310
310
|
};
|
|
311
311
|
|
|
312
312
|
const cursor = borrowCursorFromTreeNodeOrValue(node);
|
|
313
|
-
return conciseFromCursor(
|
|
313
|
+
return conciseFromCursor(
|
|
314
|
+
cursor,
|
|
315
|
+
tryGetSchema(node) ?? fail(0xacd /* invalid input */),
|
|
316
|
+
config,
|
|
317
|
+
);
|
|
314
318
|
},
|
|
315
319
|
|
|
316
320
|
exportVerbose<T>(
|
|
@@ -325,7 +329,11 @@ export const TreeAlpha: {
|
|
|
325
329
|
};
|
|
326
330
|
|
|
327
331
|
const cursor = borrowCursorFromTreeNodeOrValue(node);
|
|
328
|
-
return verboseFromCursor(
|
|
332
|
+
return verboseFromCursor(
|
|
333
|
+
cursor,
|
|
334
|
+
tryGetSchema(node) ?? fail(0xace /* invalid input */),
|
|
335
|
+
config,
|
|
336
|
+
);
|
|
329
337
|
},
|
|
330
338
|
|
|
331
339
|
exportCompressed(
|
|
@@ -335,7 +343,7 @@ export const TreeAlpha: {
|
|
|
335
343
|
idCompressor?: IIdCompressor;
|
|
336
344
|
},
|
|
337
345
|
): JsonCompatible<IFluidHandle> {
|
|
338
|
-
const schema = tryGetSchema(node) ?? fail(
|
|
346
|
+
const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
|
|
339
347
|
const format = versionToFormat[options.oldestCompatibleClient];
|
|
340
348
|
const codec = makeFieldBatchCodec({ jsonValidator: noopValidator }, format);
|
|
341
349
|
const cursor = borrowFieldCursorFromTreeNodeOrValue(node);
|
|
@@ -375,7 +383,7 @@ function borrowCursorFromTreeNodeOrValue(
|
|
|
375
383
|
): ITreeCursorSynchronous {
|
|
376
384
|
if (isTreeValue(node)) {
|
|
377
385
|
return cursorFromInsertable<UnsafeUnknownSchema>(
|
|
378
|
-
tryGetSchema(node) ?? fail(
|
|
386
|
+
tryGetSchema(node) ?? fail(0xad0 /* missing schema */),
|
|
379
387
|
node,
|
|
380
388
|
);
|
|
381
389
|
}
|
|
@@ -524,7 +524,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
524
524
|
// original (reinstated) schema.
|
|
525
525
|
this.storedSchema.apply(change.innerChange.schema.new);
|
|
526
526
|
} else {
|
|
527
|
-
fail(
|
|
527
|
+
fail(0xad1 /* Unknown Shared Tree change type. */);
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
530
|
}
|
|
@@ -242,7 +242,7 @@ export class EditManager<
|
|
|
242
242
|
private trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {
|
|
243
243
|
const trunkCommit =
|
|
244
244
|
findCommonAncestor(this.trunk.getHead(), b.getHead()) ??
|
|
245
|
-
fail(
|
|
245
|
+
fail(0xad2 /* Expected branch to be related to trunk */);
|
|
246
246
|
const sequenceId = this.getCommitSequenceId(trunkCommit);
|
|
247
247
|
const branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());
|
|
248
248
|
|
|
@@ -253,10 +253,10 @@ export class EditManager<
|
|
|
253
253
|
private untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {
|
|
254
254
|
const trunkCommit =
|
|
255
255
|
findCommonAncestor(this.trunk.getHead(), b.getHead()) ??
|
|
256
|
-
fail(
|
|
256
|
+
fail(0xad3 /* Expected branch to be related to trunk */);
|
|
257
257
|
const sequenceId = this.getCommitSequenceId(trunkCommit);
|
|
258
258
|
const branches =
|
|
259
|
-
this.trunkBranches.get(sequenceId) ?? fail(
|
|
259
|
+
this.trunkBranches.get(sequenceId) ?? fail(0xad4 /* Expected branch to be tracked */);
|
|
260
260
|
|
|
261
261
|
assert(branches.delete(b), 0x671 /* Expected branch to be tracked */);
|
|
262
262
|
if (branches.size === 0) {
|
|
@@ -472,7 +472,7 @@ export class EditManager<
|
|
|
472
472
|
// `EditManager` would have to be amended in one of two ways:
|
|
473
473
|
// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.
|
|
474
474
|
// B) The contents of such a branch should be computed on demand based on the trunk.
|
|
475
|
-
// Note that option (A) would be a simple change to `
|
|
475
|
+
// Note that option (A) would be a simple change to `addSequencedChanges` whereas (B) would likely require
|
|
476
476
|
// rebasing trunk changes over the inverse of trunk changes.
|
|
477
477
|
assert(
|
|
478
478
|
this.localBranch.getHead() === this.trunk.getHead(),
|
|
@@ -500,7 +500,8 @@ export class EditManager<
|
|
|
500
500
|
0xa61 /* Serialized trunk should not include the trunk base */,
|
|
501
501
|
);
|
|
502
502
|
const metadata =
|
|
503
|
-
this.trunkMetadata.get(c.revision) ??
|
|
503
|
+
this.trunkMetadata.get(c.revision) ??
|
|
504
|
+
fail(0xad5 /* Expected metadata for trunk commit */);
|
|
504
505
|
const commit: SequencedCommit<TChangeset> = {
|
|
505
506
|
change: c.change,
|
|
506
507
|
revision: c.revision,
|
|
@@ -519,7 +520,7 @@ export class EditManager<
|
|
|
519
520
|
const branchPath: GraphCommit<TChangeset>[] = [];
|
|
520
521
|
const ancestor =
|
|
521
522
|
findCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??
|
|
522
|
-
fail(
|
|
523
|
+
fail(0xad6 /* Expected branch to be based on trunk */);
|
|
523
524
|
|
|
524
525
|
const base = ancestor === this.trunkBase ? rootRevision : ancestor.revision;
|
|
525
526
|
return [
|
|
@@ -582,7 +583,7 @@ export class EditManager<
|
|
|
582
583
|
for (const [sessionId, branch] of data.peerLocalBranches) {
|
|
583
584
|
const commit =
|
|
584
585
|
trunkRevisionCache.get(branch.base) ??
|
|
585
|
-
fail(
|
|
586
|
+
fail(0xad7 /* Expected summary branch to be based off of a revision in the trunk */);
|
|
586
587
|
|
|
587
588
|
this.peerLocalBranches.set(
|
|
588
589
|
sessionId,
|
|
@@ -646,24 +647,45 @@ export class EditManager<
|
|
|
646
647
|
return Math.max(max, localPath.length);
|
|
647
648
|
}
|
|
648
649
|
|
|
649
|
-
|
|
650
|
-
|
|
650
|
+
/* eslint-disable jsdoc/check-indentation */
|
|
651
|
+
/**
|
|
652
|
+
* Add a bunch of sequenced changes. A bunch is a group of sequenced commits that have the following properties:
|
|
653
|
+
* - They are not interleaved with messages from other DDSes in the container.
|
|
654
|
+
* - They are all part of the same batch, which entails:
|
|
655
|
+
* - They are contiguous in sequencing order.
|
|
656
|
+
* - They are all from the same client.
|
|
657
|
+
* - They are all based on the same reference sequence number.
|
|
658
|
+
* - They are not interleaved with messages from other clients.
|
|
659
|
+
*/
|
|
660
|
+
/* eslint-enable jsdoc/check-indentation */
|
|
661
|
+
public addSequencedChanges(
|
|
662
|
+
newCommits: readonly GraphCommit<TChangeset>[],
|
|
663
|
+
sessionId: SessionId,
|
|
651
664
|
sequenceNumber: SeqNumber,
|
|
652
665
|
referenceSequenceNumber: SeqNumber,
|
|
653
666
|
): void {
|
|
667
|
+
assert(newCommits.length > 0, 0xad8 /* Expected at least one sequenced change */);
|
|
654
668
|
assert(
|
|
655
669
|
sequenceNumber > this.minimumSequenceNumber,
|
|
656
670
|
0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,
|
|
657
671
|
);
|
|
658
|
-
|
|
659
672
|
assert(
|
|
660
673
|
sequenceNumber >= // This is ">=", not ">" because changes in the same batch will have the same sequence number
|
|
661
674
|
(this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),
|
|
662
675
|
0xa64 /* Attempted to sequence change with an outdated sequence number */,
|
|
663
676
|
);
|
|
664
677
|
|
|
678
|
+
// Returns the sequence id for the next commit to be processed in the bunch. Since all the commits have the
|
|
679
|
+
// same sequence number, only the index in the batch needs to be incremented.
|
|
680
|
+
const getNextSequenceId = (sequenceId: SequenceId): SequenceId => {
|
|
681
|
+
return {
|
|
682
|
+
sequenceNumber: sequenceId.sequenceNumber,
|
|
683
|
+
indexInBatch: (sequenceId.indexInBatch ?? 0) + 1,
|
|
684
|
+
};
|
|
685
|
+
};
|
|
665
686
|
const commitsSequenceNumber = this.getBatch(sequenceNumber);
|
|
666
|
-
|
|
687
|
+
// The sequence id for the next commit to be processed in the bunch.
|
|
688
|
+
let nextSequenceId =
|
|
667
689
|
commitsSequenceNumber.length === 0
|
|
668
690
|
? {
|
|
669
691
|
sequenceNumber,
|
|
@@ -673,49 +695,65 @@ export class EditManager<
|
|
|
673
695
|
indexInBatch: commitsSequenceNumber.length,
|
|
674
696
|
};
|
|
675
697
|
|
|
676
|
-
|
|
677
|
-
|
|
698
|
+
// Local changes, i.e., changes from this client are applied by fast forwarding the local branch commit onto
|
|
699
|
+
// the trunk.
|
|
700
|
+
if (sessionId === this.localSessionId) {
|
|
701
|
+
for (const _ of newCommits) {
|
|
702
|
+
this.fastForwardNextLocalCommit(nextSequenceId);
|
|
703
|
+
nextSequenceId = getNextSequenceId(nextSequenceId);
|
|
704
|
+
}
|
|
705
|
+
return;
|
|
678
706
|
}
|
|
679
707
|
|
|
680
|
-
//
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
// If the branch is fully caught up and empty after being rebased, then push to the trunk directly
|
|
693
|
-
this.pushCommitToTrunk(sequenceId, newCommit);
|
|
694
|
-
peerLocalBranch.setHead(this.trunk.getHead());
|
|
695
|
-
} else {
|
|
696
|
-
// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
|
|
697
|
-
const { duration, output: newChangeFullyRebased } = measure(() =>
|
|
698
|
-
rebaseChange(
|
|
699
|
-
this.changeFamily.rebaser,
|
|
700
|
-
newCommit,
|
|
701
|
-
peerLocalBranch.getHead(),
|
|
702
|
-
this.trunk.getHead(),
|
|
703
|
-
this.mintRevisionTag,
|
|
704
|
-
),
|
|
708
|
+
// Remote changes, i.e., changes from remote clients are applied in three steps.
|
|
709
|
+
for (const newCommit of newCommits) {
|
|
710
|
+
// Step 1 - Recreate the peer remote client's local environment.
|
|
711
|
+
// Get the revision that the remote change is based on
|
|
712
|
+
const [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);
|
|
713
|
+
// Rebase that peer local branch over the part of the trunk up to the base revision
|
|
714
|
+
// This will be a no-op if the sending client has not advanced since the last time we received an edit from it
|
|
715
|
+
const peerLocalBranch = getOrCreate(
|
|
716
|
+
this.peerLocalBranches,
|
|
717
|
+
sessionId,
|
|
718
|
+
() =>
|
|
719
|
+
new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),
|
|
705
720
|
);
|
|
721
|
+
peerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);
|
|
706
722
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
723
|
+
// Step 2 - Append the change to the peer branch. Rebase the change to the tip of the trunk.
|
|
724
|
+
if (peerLocalBranch.getHead() === this.trunk.getHead()) {
|
|
725
|
+
// If the branch is fully caught up and empty after being rebased, then push to the trunk directly
|
|
726
|
+
this.pushCommitToTrunk(nextSequenceId, { ...newCommit, sessionId });
|
|
727
|
+
peerLocalBranch.setHead(this.trunk.getHead());
|
|
728
|
+
} else {
|
|
729
|
+
// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.
|
|
730
|
+
const { duration, output: newChangeFullyRebased } = measure(() =>
|
|
731
|
+
rebaseChange(
|
|
732
|
+
this.changeFamily.rebaser,
|
|
733
|
+
newCommit,
|
|
734
|
+
peerLocalBranch.getHead(),
|
|
735
|
+
this.trunk.getHead(),
|
|
736
|
+
this.mintRevisionTag,
|
|
737
|
+
),
|
|
738
|
+
);
|
|
711
739
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
740
|
+
this.telemetryEventBatcher?.accumulateAndLog({
|
|
741
|
+
duration,
|
|
742
|
+
...newChangeFullyRebased.telemetryProperties,
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
peerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));
|
|
746
|
+
this.pushCommitToTrunk(nextSequenceId, {
|
|
747
|
+
...newCommit,
|
|
748
|
+
sessionId,
|
|
749
|
+
change: newChangeFullyRebased.change,
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
nextSequenceId = getNextSequenceId(nextSequenceId);
|
|
717
754
|
}
|
|
718
755
|
|
|
756
|
+
// Step 3 - Rebase the local branch over the updated trunk.
|
|
719
757
|
this.localBranch.rebaseOnto(this.trunk);
|
|
720
758
|
}
|
|
721
759
|
|
|
@@ -39,6 +39,8 @@ export interface ResubmitMachine<TChange> {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Must be called after a sequenced commit is applied.
|
|
42
|
+
* Note that this may be called multiples times in a row after a number of sequenced commits have been applied
|
|
43
|
+
* (as opposed to always being called before the next sequenced commit is applied).
|
|
42
44
|
* @param isLocal - whether the sequenced commit was generated by the local session.
|
|
43
45
|
*/
|
|
44
46
|
onSequencedCommitApplied(isLocal: boolean): void;
|
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
8
|
+
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
9
9
|
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
10
10
|
import type {
|
|
11
11
|
IExperimentalIncrementalSummaryContext,
|
|
12
|
+
IRuntimeMessageCollection,
|
|
12
13
|
ISummaryTreeWithStats,
|
|
13
14
|
ITelemetryContext,
|
|
14
15
|
} from "@fluidframework/runtime-definitions/internal";
|
|
15
16
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
16
|
-
import type {
|
|
17
|
+
import type {
|
|
18
|
+
IChannelView,
|
|
19
|
+
IFluidSerializer,
|
|
20
|
+
} from "@fluidframework/shared-object-base/internal";
|
|
17
21
|
|
|
18
22
|
import type { ICodecOptions, IJsonCodec } from "../codec/index.js";
|
|
19
23
|
import {
|
|
@@ -50,7 +54,6 @@ import { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
|
|
|
50
54
|
import { BranchCommitEnricher } from "./branchCommitEnricher.js";
|
|
51
55
|
import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
|
|
52
56
|
import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
53
|
-
import type { IChannelView } from "../shared-tree/index.js";
|
|
54
57
|
|
|
55
58
|
// TODO: Organize this to be adjacent to persisted types.
|
|
56
59
|
const summarizablesTreeKey = "indexes";
|
|
@@ -301,8 +304,9 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
301
304
|
if (this.detachedRevision !== undefined) {
|
|
302
305
|
const newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);
|
|
303
306
|
this.detachedRevision = newRevision;
|
|
304
|
-
this.editManager.
|
|
305
|
-
|
|
307
|
+
this.editManager.addSequencedChanges(
|
|
308
|
+
[enrichedCommit],
|
|
309
|
+
this.editManager.localSessionId,
|
|
306
310
|
newRevision,
|
|
307
311
|
this.detachedRevision,
|
|
308
312
|
);
|
|
@@ -327,24 +331,68 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
327
331
|
this.resubmitMachine.onCommitSubmitted(enrichedCommit);
|
|
328
332
|
}
|
|
329
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Process a message from the runtime.
|
|
336
|
+
* @deprecated - Use processMessagesCore to process a bunch of messages together.
|
|
337
|
+
*/
|
|
330
338
|
public processCore(
|
|
331
339
|
message: ISequencedDocumentMessage,
|
|
332
340
|
local: boolean,
|
|
333
341
|
localOpMetadata: unknown,
|
|
334
342
|
): void {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
this.processMessagesCore({
|
|
344
|
+
envelope: message,
|
|
345
|
+
local,
|
|
346
|
+
messagesContent: [
|
|
347
|
+
{
|
|
348
|
+
clientSequenceNumber: message.clientSequenceNumber,
|
|
349
|
+
contents: message.contents,
|
|
350
|
+
localOpMetadata,
|
|
351
|
+
},
|
|
352
|
+
],
|
|
338
353
|
});
|
|
354
|
+
}
|
|
339
355
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
356
|
+
/**
|
|
357
|
+
* Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.
|
|
358
|
+
*/
|
|
359
|
+
public processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
|
|
360
|
+
const { envelope, local, messagesContent } = messagesCollection;
|
|
361
|
+
const commits: GraphCommit<TChange>[] = [];
|
|
362
|
+
let messagesSessionId: SessionId | undefined;
|
|
363
|
+
|
|
364
|
+
// Get a list of all the commits from the messages.
|
|
365
|
+
for (const messageContent of messagesContent) {
|
|
366
|
+
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
367
|
+
const { commit, sessionId } = this.messageCodec.decode(messageContent.contents, {
|
|
368
|
+
idCompressor: this.idCompressor,
|
|
369
|
+
});
|
|
370
|
+
commits.push(commit);
|
|
371
|
+
|
|
372
|
+
if (messagesSessionId !== undefined) {
|
|
373
|
+
assert(
|
|
374
|
+
messagesSessionId === sessionId,
|
|
375
|
+
0xad9 /* All messages in a bunch must have the same session ID */,
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
messagesSessionId = sessionId;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
assert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);
|
|
382
|
+
|
|
383
|
+
this.editManager.addSequencedChanges(
|
|
384
|
+
commits,
|
|
385
|
+
messagesSessionId,
|
|
386
|
+
brand(envelope.sequenceNumber),
|
|
387
|
+
brand(envelope.referenceSequenceNumber),
|
|
344
388
|
);
|
|
345
|
-
this.resubmitMachine.onSequencedCommitApplied(local);
|
|
346
389
|
|
|
347
|
-
|
|
390
|
+
// Update the resubmit machine for each commit applied.
|
|
391
|
+
for (const _ of messagesContent) {
|
|
392
|
+
this.resubmitMachine.onSequencedCommitApplied(local);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
this.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));
|
|
348
396
|
}
|
|
349
397
|
|
|
350
398
|
public getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
@@ -79,7 +79,7 @@ export function customFromCursor<TChild, THandle>(
|
|
|
79
79
|
) => TChild,
|
|
80
80
|
): CustomTree<TChild, THandle> {
|
|
81
81
|
const type = reader.type;
|
|
82
|
-
const nodeSchema = schema.get(type) ?? fail(
|
|
82
|
+
const nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);
|
|
83
83
|
|
|
84
84
|
switch (type) {
|
|
85
85
|
case numberSchema.identifier:
|
|
@@ -109,7 +109,7 @@ export function customFromCursor<TChild, THandle>(
|
|
|
109
109
|
const key =
|
|
110
110
|
isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
|
|
111
111
|
? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
|
|
112
|
-
fail(
|
|
112
|
+
fail(0xb2f /* missing property key */))
|
|
113
113
|
: storedKey;
|
|
114
114
|
// Length is checked above.
|
|
115
115
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -138,7 +138,7 @@ export function customFromCursorStored<TChild>(
|
|
|
138
138
|
) => TChild,
|
|
139
139
|
): CustomTree<TChild, IFluidHandle> {
|
|
140
140
|
const type = reader.type;
|
|
141
|
-
const nodeSchema = schema.get(type) ?? fail(
|
|
141
|
+
const nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);
|
|
142
142
|
|
|
143
143
|
if (nodeSchema instanceof LeafNodeStoredSchema) {
|
|
144
144
|
assert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);
|
|
@@ -138,7 +138,7 @@ export function adaptEnum<
|
|
|
138
138
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
139
139
|
const factoryOut = <TValue extends Values>(value: TValue) => {
|
|
140
140
|
return new out[
|
|
141
|
-
inverse.get(value) ?? fail(
|
|
141
|
+
inverse.get(value) ?? fail(0xb31 /* missing enum value */)
|
|
142
142
|
// "extends unknown" is required here to handle when TValue is an union: each member of the union should be processed independently.
|
|
143
143
|
]() as TValue extends unknown
|
|
144
144
|
? NodeFromSchema<ReturnType<typeof singletonSchema<TScope, TValue>>>
|
|
@@ -174,7 +174,7 @@ export type ValidateRecursiveSchema<
|
|
|
174
174
|
* ```typescript
|
|
175
175
|
* // Workaround to avoid
|
|
176
176
|
* // `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.
|
|
177
|
-
* export declare
|
|
177
|
+
* export declare type _RecursiveArrayWorkaround = FixRecursiveArraySchema<typeof RecursiveArray>;
|
|
178
178
|
* export class RecursiveArray extends schema.arrayRecursive("RA", [() => RecursiveArray]) {}
|
|
179
179
|
* {
|
|
180
180
|
* type _check = ValidateRecursiveSchema<typeof RecursiveArray>;
|
|
@@ -164,7 +164,7 @@ export function createSimpleTreeIndex<
|
|
|
164
164
|
return makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);
|
|
165
165
|
}
|
|
166
166
|
} else {
|
|
167
|
-
fail(
|
|
167
|
+
fail(0xb32 /* node is out of schema */);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
: (schemaIdentifier: TreeNodeSchemaIdentifier) => {
|
|
@@ -221,11 +221,11 @@ function makeGenericKeyFinder<TKey extends TreeIndexKey>(
|
|
|
221
221
|
cursor.exitField();
|
|
222
222
|
|
|
223
223
|
if (value === undefined) {
|
|
224
|
-
fail(
|
|
224
|
+
fail(0xb33 /* a value for the key does not exist */);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if (!isKeyValid(value)) {
|
|
228
|
-
fail(
|
|
228
|
+
fail(0xb34 /* the key is an unexpected type */);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
return value;
|
|
@@ -376,7 +376,7 @@ export function checkUnion(union: Iterable<TreeNodeSchema>, errors: string[]): v
|
|
|
376
376
|
// For each field of schema, remove schema from possiblyAmbiguous that do not have that field
|
|
377
377
|
for (const [key, field] of schema.fields) {
|
|
378
378
|
if (field.kind === FieldKind.Required) {
|
|
379
|
-
const withKey = allObjectKeys.get(key) ?? fail(
|
|
379
|
+
const withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);
|
|
380
380
|
for (const candidate of possiblyAmbiguous) {
|
|
381
381
|
if (!withKey.has(candidate)) {
|
|
382
382
|
possiblyAmbiguous.delete(candidate);
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
} from "../core/index.js";
|
|
41
41
|
import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
42
42
|
import { isLazy, type LazyItem } from "../flexList.js";
|
|
43
|
+
import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* Provides various functions for analyzing {@link TreeNode}s.
|
|
@@ -174,7 +175,7 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
174
175
|
changedFields,
|
|
175
176
|
(field) =>
|
|
176
177
|
nodeSchema.storedKeyToPropertyKey.get(field) ??
|
|
177
|
-
fail(
|
|
178
|
+
fail(0xb36 /* Could not find stored key in schema. */),
|
|
178
179
|
),
|
|
179
180
|
);
|
|
180
181
|
listener({ changedProperties });
|
|
@@ -203,6 +204,10 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
203
204
|
value: unknown,
|
|
204
205
|
schema: TSchema,
|
|
205
206
|
): value is TreeNodeFromImplicitAllowedTypes<TSchema> {
|
|
207
|
+
// This "is" utility would return false if the provided schema is a base type of the actual schema.
|
|
208
|
+
// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).
|
|
209
|
+
// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.
|
|
210
|
+
|
|
206
211
|
const actualSchema = tryGetSchema(value);
|
|
207
212
|
if (actualSchema === undefined) {
|
|
208
213
|
return false;
|
|
@@ -210,19 +215,19 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
210
215
|
if (isReadonlyArray<LazyItem<TreeNodeSchema>>(schema)) {
|
|
211
216
|
for (const singleSchema of schema) {
|
|
212
217
|
const testSchema = isLazy(singleSchema) ? singleSchema() : singleSchema;
|
|
218
|
+
markSchemaMostDerived(testSchema);
|
|
213
219
|
if (testSchema === actualSchema) {
|
|
214
220
|
return true;
|
|
215
221
|
}
|
|
216
222
|
}
|
|
217
223
|
return false;
|
|
218
224
|
} else {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return (schema as TreeNodeSchema) === actualSchema;
|
|
225
|
+
markSchemaMostDerived(schema);
|
|
226
|
+
return schema === actualSchema;
|
|
222
227
|
}
|
|
223
228
|
},
|
|
224
229
|
schema(node: TreeNode | TreeLeafValue): TreeNodeSchema {
|
|
225
|
-
return tryGetSchema(node) ?? fail(
|
|
230
|
+
return tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);
|
|
226
231
|
},
|
|
227
232
|
shortId(node: TreeNode): number | string | undefined {
|
|
228
233
|
const schema = node[typeSchemaSymbol];
|
|
@@ -341,7 +346,7 @@ function getPropertyKeyFromStoredKey(
|
|
|
341
346
|
}
|
|
342
347
|
|
|
343
348
|
if (fields[storedKey] === undefined) {
|
|
344
|
-
fail(
|
|
349
|
+
fail(0xb38 /* Existing stored key should always map to a property key */);
|
|
345
350
|
}
|
|
346
351
|
|
|
347
352
|
return storedKey;
|
|
@@ -172,7 +172,8 @@ export function applySchemaToParserOptions<TCustom>(
|
|
|
172
172
|
: {
|
|
173
173
|
encode: (type, key: FieldKey): string => {
|
|
174
174
|
// translate stored key into property key.
|
|
175
|
-
const simpleNodeSchema =
|
|
175
|
+
const simpleNodeSchema =
|
|
176
|
+
context.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);
|
|
176
177
|
if (isObjectNodeSchema(simpleNodeSchema)) {
|
|
177
178
|
const propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);
|
|
178
179
|
if (propertyKey !== undefined) {
|
|
@@ -193,10 +194,12 @@ export function applySchemaToParserOptions<TCustom>(
|
|
|
193
194
|
return key;
|
|
194
195
|
},
|
|
195
196
|
parse: (type, inputKey): FieldKey => {
|
|
196
|
-
const simpleNodeSchema =
|
|
197
|
+
const simpleNodeSchema =
|
|
198
|
+
context.schema.get(brand(type)) ?? fail(0xb3a /* missing schema */);
|
|
197
199
|
if (isObjectNodeSchema(simpleNodeSchema)) {
|
|
198
200
|
const info =
|
|
199
|
-
simpleNodeSchema.flexKeyMap.get(inputKey) ??
|
|
201
|
+
simpleNodeSchema.flexKeyMap.get(inputKey) ??
|
|
202
|
+
fail(0xb3b /* missing field info */);
|
|
200
203
|
return info.storedKey;
|
|
201
204
|
}
|
|
202
205
|
return brand(inputKey);
|
|
@@ -345,7 +348,8 @@ function verboseFromCursorInner<TCustom>(
|
|
|
345
348
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
346
349
|
): VerboseTree<TCustom> {
|
|
347
350
|
const fields = customFromCursor(reader, options, schema, verboseFromCursorInner);
|
|
348
|
-
const nodeSchema =
|
|
351
|
+
const nodeSchema =
|
|
352
|
+
schema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);
|
|
349
353
|
if (nodeSchema.kind === NodeKind.Leaf) {
|
|
350
354
|
return fields as CustomTreeValue<TCustom>;
|
|
351
355
|
}
|
|
@@ -250,7 +250,7 @@ export class ViewSchema {
|
|
|
250
250
|
this.viewSchemaAsStored.nodeSchema.get(adapter.output),
|
|
251
251
|
)
|
|
252
252
|
) {
|
|
253
|
-
fail(
|
|
253
|
+
fail(0xb3d /* tree adapter for stored adapter.output should not be never */);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -858,7 +858,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
858
858
|
// Therefore it must include `length`,
|
|
859
859
|
// even though this "length" is never invoked (due to being shadowed by the proxy provided own property).
|
|
860
860
|
public get length(): number {
|
|
861
|
-
return fail(
|
|
861
|
+
return fail(0xadb /* Proxy should intercept length */);
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
public [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {
|
|
@@ -1045,7 +1045,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
1045
1045
|
throw new UsageError(`Concurrent editing and iteration is not allowed.`);
|
|
1046
1046
|
}
|
|
1047
1047
|
for (let i = 0; i < this.length; i++) {
|
|
1048
|
-
yield this.at(i) ?? fail(
|
|
1048
|
+
yield this.at(i) ?? fail(0xadc /* Index is out of bounds */);
|
|
1049
1049
|
if (initialLastUpdatedStamp !== kernel.generationNumber) {
|
|
1050
1050
|
throw new UsageError(`Concurrent editing and iteration is not allowed.`);
|
|
1051
1051
|
}
|
|
@@ -31,7 +31,8 @@ export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | Tr
|
|
|
31
31
|
return cached;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const classSchema =
|
|
34
|
+
const classSchema =
|
|
35
|
+
getSimpleNodeSchemaFromInnerNode(flexNode) ?? fail(0xb3e /* Missing schema */);
|
|
35
36
|
const node = flexNode as unknown as InternalTreeNode;
|
|
36
37
|
// eslint-disable-next-line unicorn/prefer-ternary
|
|
37
38
|
if (typeof classSchema === "function") {
|
|
@@ -17,7 +17,7 @@ import { SimpleContextSlot, type Context } from "./context.js";
|
|
|
17
17
|
*/
|
|
18
18
|
export function getSimpleNodeSchemaFromInnerNode(innerNode: InnerNode): TreeNodeSchema {
|
|
19
19
|
const context: Context = getSimpleContextFromInnerNode(innerNode);
|
|
20
|
-
return context.schema.get(innerNode.schema) ?? fail(
|
|
20
|
+
return context.schema.get(innerNode.schema) ?? fail(0xb3f /* missing schema from context */);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|