@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
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
brand,
|
|
19
19
|
brandedSlot,
|
|
20
20
|
fail,
|
|
21
|
+
getOrAddEmptyToMap,
|
|
22
|
+
getOrCreate,
|
|
21
23
|
} from "../../util/index.js";
|
|
22
24
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
23
25
|
|
|
@@ -474,7 +476,7 @@ export class AnchorSet implements AnchorLocator {
|
|
|
474
476
|
}
|
|
475
477
|
}
|
|
476
478
|
|
|
477
|
-
return path ?? fail(
|
|
479
|
+
return path ?? fail(0xaea /* internalize path must be a path */);
|
|
478
480
|
}
|
|
479
481
|
|
|
480
482
|
/**
|
|
@@ -711,15 +713,7 @@ export class AnchorSet implements AnchorLocator {
|
|
|
711
713
|
/**
|
|
712
714
|
* Events collected during the visit which get sent as a batch during "free".
|
|
713
715
|
*/
|
|
714
|
-
bufferedEvents: [] as
|
|
715
|
-
node: PathNode;
|
|
716
|
-
event: keyof AnchorEvents;
|
|
717
|
-
/**
|
|
718
|
-
* The key for the impacted field, if the event is associated with a key.
|
|
719
|
-
* Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
|
|
720
|
-
*/
|
|
721
|
-
changedField?: FieldKey;
|
|
722
|
-
}[],
|
|
716
|
+
bufferedEvents: [] as BufferedEvent[],
|
|
723
717
|
|
|
724
718
|
// 'currentDepth' and 'depthThresholdForSubtreeChanged' serve to keep track of when do we need to emit
|
|
725
719
|
// subtreeChangedAfterBatch events.
|
|
@@ -751,25 +745,31 @@ export class AnchorSet implements AnchorLocator {
|
|
|
751
745
|
node.removeRef();
|
|
752
746
|
}
|
|
753
747
|
this.anchorSet.activeVisitor = undefined;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
748
|
+
|
|
749
|
+
// Aggregate changedFields by node.
|
|
750
|
+
const eventsByNode: Map<PathNode, Set<FieldKey>> = new Map();
|
|
751
|
+
for (const { node, event, changedField } of this.bufferedEvents) {
|
|
752
|
+
if (event === "childrenChangedAfterBatch") {
|
|
753
|
+
const keys = getOrCreate(eventsByNode, node, () => new Set());
|
|
754
|
+
keys.add(
|
|
755
|
+
changedField ??
|
|
756
|
+
fail(0xb57 /* childrenChangedAfterBatch events should have a changedField */),
|
|
757
|
+
);
|
|
758
758
|
}
|
|
759
|
-
|
|
760
|
-
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const alreadyEmitted = new Map<PathNode, (keyof AnchorEvents)[]>();
|
|
762
|
+
for (const { node, event } of this.bufferedEvents) {
|
|
763
|
+
const emittedEvents = getOrAddEmptyToMap(alreadyEmitted, node);
|
|
764
|
+
if (emittedEvents.includes(event)) {
|
|
761
765
|
continue;
|
|
762
766
|
}
|
|
763
|
-
emittedEvents
|
|
767
|
+
emittedEvents.push(event);
|
|
764
768
|
if (event === "childrenChangedAfterBatch") {
|
|
765
|
-
const
|
|
766
|
-
.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
e.changedField ??
|
|
770
|
-
fail("childrenChangedAfterBatch events should have a changedField"),
|
|
771
|
-
);
|
|
772
|
-
node.events.emit(event, { changedFields: new Set(fieldKeys) });
|
|
769
|
+
const changedFields =
|
|
770
|
+
eventsByNode.get(node) ??
|
|
771
|
+
fail(0xaeb /* childrenChangedAfterBatch events should have changedFields */);
|
|
772
|
+
node.events.emit(event, { changedFields });
|
|
773
773
|
} else {
|
|
774
774
|
node.events.emit(event);
|
|
775
775
|
}
|
|
@@ -1031,7 +1031,8 @@ class PathNode extends ReferenceCountedBase implements UpPath<PathNode>, AnchorN
|
|
|
1031
1031
|
public getOrCreateChildRef(key: FieldKey, index: number): [Anchor, AnchorNode] {
|
|
1032
1032
|
const anchor = this.anchorSet.track(this.child(key, index));
|
|
1033
1033
|
const node =
|
|
1034
|
-
this.anchorSet.locate(anchor) ??
|
|
1034
|
+
this.anchorSet.locate(anchor) ??
|
|
1035
|
+
fail(0xaec /* cannot reference child that does not exist */);
|
|
1035
1036
|
return [anchor, node];
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
@@ -1194,3 +1195,13 @@ function binaryFind(sorted: readonly PathNode[], index: number): PathNode | unde
|
|
|
1194
1195
|
}
|
|
1195
1196
|
return undefined; // If we reach here, target is not in array (or array was not sorted)
|
|
1196
1197
|
}
|
|
1198
|
+
|
|
1199
|
+
interface BufferedEvent {
|
|
1200
|
+
node: PathNode;
|
|
1201
|
+
event: keyof AnchorEvents;
|
|
1202
|
+
/**
|
|
1203
|
+
* The key for the impacted field, if the event is associated with a key.
|
|
1204
|
+
* Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
|
|
1205
|
+
*/
|
|
1206
|
+
changedField?: FieldKey;
|
|
1207
|
+
}
|
|
@@ -90,7 +90,7 @@ export function getGenericTreeField<T>(
|
|
|
90
90
|
|
|
91
91
|
// Do not just read field and check for undefined: see warning on FieldMapObject.
|
|
92
92
|
if (Object.prototype.hasOwnProperty.call(children, key)) {
|
|
93
|
-
return children[key] ?? fail(
|
|
93
|
+
return children[key] ?? fail(0xaed /* This wont be undefined due to the check above */);
|
|
94
94
|
}
|
|
95
95
|
// Handle missing field:
|
|
96
96
|
if (createIfMissing === false) {
|
|
@@ -234,7 +234,7 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
|
|
|
234
234
|
if (this.nestedCursor !== undefined) {
|
|
235
235
|
return (
|
|
236
236
|
this.nestedCursor.getPath(this.nestedPathPrefix(prefix)) ??
|
|
237
|
-
fail(
|
|
237
|
+
fail(0xaee /* nested cursors should not be root */)
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
assert(this.mode === CursorLocationType.Nodes, 0x524 /* must be in nodes mode */);
|
|
@@ -247,7 +247,7 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
|
|
|
247
247
|
// This uses index offset for actual node, when it should use offset for start of chunk.
|
|
248
248
|
// To compensate, subtract this.indexWithinChunk below.
|
|
249
249
|
const rootPath: UpPath =
|
|
250
|
-
this.getOffsetPath(0, prefix) ?? fail(
|
|
250
|
+
this.getOffsetPath(0, prefix) ?? fail(0xaef /* nested cursors should not be root */);
|
|
251
251
|
return {
|
|
252
252
|
indexOffset: rootPath.parentIndex - this.indexWithinChunk,
|
|
253
253
|
rootFieldOverride: rootPath.parentField,
|
|
@@ -483,8 +483,9 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
|
|
|
483
483
|
this.mode === CursorLocationType.Fields,
|
|
484
484
|
0x52d /* can only navigate up from field when in field */,
|
|
485
485
|
);
|
|
486
|
-
this.siblings =
|
|
487
|
-
|
|
486
|
+
this.siblings =
|
|
487
|
+
this.siblingStack.pop() ?? fail(0xaf0 /* Unexpected siblingStack.length */);
|
|
488
|
+
this.index = this.indexStack.pop() ?? fail(0xaf1 /* Unexpected indexStack.length */);
|
|
488
489
|
}
|
|
489
490
|
|
|
490
491
|
public exitNode(): void {
|
|
@@ -498,12 +499,14 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
|
|
|
498
499
|
this.mode === CursorLocationType.Nodes,
|
|
499
500
|
0x52e /* can only navigate up from node when in node */,
|
|
500
501
|
);
|
|
501
|
-
this.siblings =
|
|
502
|
-
|
|
502
|
+
this.siblings =
|
|
503
|
+
this.siblingStack.pop() ?? fail(0xaf2 /* Unexpected siblingStack.length */);
|
|
504
|
+
this.index = this.indexStack.pop() ?? fail(0xaf3 /* Unexpected indexStack.length */);
|
|
503
505
|
this.indexOfChunk =
|
|
504
|
-
this.indexOfChunkStack.pop() ?? fail(
|
|
506
|
+
this.indexOfChunkStack.pop() ?? fail(0xaf4 /* Unexpected indexOfChunkStack.length */);
|
|
505
507
|
this.indexWithinChunk =
|
|
506
|
-
this.indexWithinChunkStack.pop() ??
|
|
508
|
+
this.indexWithinChunkStack.pop() ??
|
|
509
|
+
fail(0xaf5 /* Unexpected indexWithinChunkStack.length */);
|
|
507
510
|
}
|
|
508
511
|
|
|
509
512
|
private getNode(): BasicChunk {
|
|
@@ -247,7 +247,7 @@ export function tryShapeFromSchema(
|
|
|
247
247
|
shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
|
|
248
248
|
): ShapeInfo {
|
|
249
249
|
return getOrCreate(shapes, type, () => {
|
|
250
|
-
const treeSchema = schema.nodeSchema.get(type) ?? fail(
|
|
250
|
+
const treeSchema = schema.nodeSchema.get(type) ?? fail(0xaf9 /* missing schema */);
|
|
251
251
|
if (treeSchema instanceof LeafNodeStoredSchema) {
|
|
252
252
|
// Allow all string values (but only string values) to be compressed by the id compressor.
|
|
253
253
|
// This allows compressing all compressible identifiers without requiring additional context to know which values could be identifiers.
|
|
@@ -284,7 +284,7 @@ export function tryShapeFromFieldSchema(
|
|
|
284
284
|
key: FieldKey,
|
|
285
285
|
shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
|
|
286
286
|
): FieldShape | undefined {
|
|
287
|
-
const kind = policy.fieldKinds.get(type.kind) ?? fail(
|
|
287
|
+
const kind = policy.fieldKinds.get(type.kind) ?? fail(0xafa /* missing FieldKind */);
|
|
288
288
|
if (kind.multiplicity !== Multiplicity.Single) {
|
|
289
289
|
return undefined;
|
|
290
290
|
}
|
|
@@ -227,7 +227,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
227
227
|
assert(this.mutableChunk === undefined, 0x535 /* should be in field */);
|
|
228
228
|
const parent = this.getParent();
|
|
229
229
|
const chunks =
|
|
230
|
-
parent.mutableChunk.fields.get(parent.key) ?? fail(
|
|
230
|
+
parent.mutableChunk.fields.get(parent.key) ?? fail(0xaf6 /* missing edited field */);
|
|
231
231
|
let indexWithinChunk = index;
|
|
232
232
|
let indexOfChunk = 0;
|
|
233
233
|
let chunk = chunks[indexOfChunk] ?? oob();
|
|
@@ -236,7 +236,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
236
236
|
indexWithinChunk -= chunk.topLevelLength;
|
|
237
237
|
indexOfChunk++;
|
|
238
238
|
if (indexOfChunk === chunks.length) {
|
|
239
|
-
fail(
|
|
239
|
+
fail(0xaf7 /* missing edited node */);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
let found = chunks[indexOfChunk] ?? oob();
|
|
@@ -277,7 +277,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
277
277
|
this.mutableChunk = undefined;
|
|
278
278
|
},
|
|
279
279
|
exitField(key: FieldKey): void {
|
|
280
|
-
const top = this.mutableChunkStack.pop() ?? fail(
|
|
280
|
+
const top = this.mutableChunkStack.pop() ?? fail(0xaf8 /* should not be at root */);
|
|
281
281
|
assert(this.mutableChunk === undefined, 0x539 /* should be in field */);
|
|
282
282
|
this.mutableChunk = top.mutableChunk;
|
|
283
283
|
},
|
|
@@ -85,7 +85,7 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
85
85
|
) {
|
|
86
86
|
// because "serializable" is allowed in buffer and it has type `any`, its very easy to mess up including of shapes in the buffer.
|
|
87
87
|
// This catches the easiest way to get it wrong.
|
|
88
|
-
fail(
|
|
88
|
+
fail(0xb4b /* encoder interface instead of shape written to stream */);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -108,7 +108,7 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
108
108
|
if (item instanceof IdentifierToken) {
|
|
109
109
|
array[index] = identifierTable.valueToIndex.get(item.identifier) ?? item.identifier;
|
|
110
110
|
} else if (item instanceof Shape) {
|
|
111
|
-
array[index] = shapeTable.valueToIndex.get(item) ?? fail(
|
|
111
|
+
array[index] = shapeTable.valueToIndex.get(item) ?? fail(0xb4c /* missing shape */);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -273,7 +273,7 @@ export class InlineArrayShape
|
|
|
273
273
|
shapes: EncoderCache,
|
|
274
274
|
outputBuffer: BufferFormat,
|
|
275
275
|
): void {
|
|
276
|
-
fail(
|
|
276
|
+
fail(0xb4d /* Empty array should not encode any nodes */);
|
|
277
277
|
},
|
|
278
278
|
});
|
|
279
279
|
|
|
@@ -324,7 +324,7 @@ export class InlineArrayShape
|
|
|
324
324
|
return {
|
|
325
325
|
b: {
|
|
326
326
|
length: this.length,
|
|
327
|
-
shape: shapes.valueToIndex.get(this.inner.shape) ?? fail(
|
|
327
|
+
shape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),
|
|
328
328
|
},
|
|
329
329
|
};
|
|
330
330
|
}
|
|
@@ -380,7 +380,8 @@ export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> implements
|
|
|
380
380
|
shapes: DeduplicationTable<Shape>,
|
|
381
381
|
): EncodedChunkShape {
|
|
382
382
|
const shape: EncodedNestedArray =
|
|
383
|
-
shapes.valueToIndex.get(this.inner.shape) ??
|
|
383
|
+
shapes.valueToIndex.get(this.inner.shape) ??
|
|
384
|
+
fail(0xb4f /* index for shape not found in table */);
|
|
384
385
|
return {
|
|
385
386
|
a: shape,
|
|
386
387
|
};
|
|
@@ -138,7 +138,7 @@ export function encodeFieldShapes(
|
|
|
138
138
|
// key
|
|
139
139
|
encodeIdentifier(field.key, identifiers),
|
|
140
140
|
// shape
|
|
141
|
-
shapes.valueToIndex.get(field.shape.shape) ?? fail(
|
|
141
|
+
shapes.valueToIndex.get(field.shape.shape) ?? fail(0xb50 /* missing shape */),
|
|
142
142
|
]);
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -167,5 +167,5 @@ function dedupShape(
|
|
|
167
167
|
shape: Shape<EncodedChunkShape>,
|
|
168
168
|
shapes: DeduplicationTable<Shape<EncodedChunkShape>>,
|
|
169
169
|
): number {
|
|
170
|
-
return shapes.valueToIndex.get(shape) ?? fail(
|
|
170
|
+
return shapes.valueToIndex.get(shape) ?? fail(0xb51 /* missing shape */);
|
|
171
171
|
}
|
|
@@ -74,7 +74,7 @@ export function fieldShaper(
|
|
|
74
74
|
cache: EncoderCache,
|
|
75
75
|
storedSchema: StoredSchemaCollection,
|
|
76
76
|
): FieldEncoder {
|
|
77
|
-
const kind = cache.fieldShapes.get(field.kind) ?? fail(
|
|
77
|
+
const kind = cache.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);
|
|
78
78
|
const type = oneFromSet(field.types);
|
|
79
79
|
const nodeEncoder = type !== undefined ? treeHandler.shapeFromTree(type) : anyNodeEncoder;
|
|
80
80
|
if (kind.multiplicity === Multiplicity.Single) {
|
|
@@ -113,7 +113,8 @@ export function treeShaper(
|
|
|
113
113
|
fieldHandler: FieldShaper,
|
|
114
114
|
schemaName: TreeNodeSchemaIdentifier,
|
|
115
115
|
): NodeShape {
|
|
116
|
-
const schema =
|
|
116
|
+
const schema =
|
|
117
|
+
fullSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);
|
|
117
118
|
|
|
118
119
|
if (schema instanceof ObjectNodeStoredSchema) {
|
|
119
120
|
// TODO:Performance:
|
|
@@ -146,7 +147,7 @@ export function treeShaper(
|
|
|
146
147
|
);
|
|
147
148
|
return shape;
|
|
148
149
|
}
|
|
149
|
-
fail(
|
|
150
|
+
fail(0xb54 /* unsupported node kind */);
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
export function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {
|
|
@@ -52,10 +52,10 @@ export const emptyCursor: ChunkedCursor = {
|
|
|
52
52
|
mode: CursorLocationType.Fields,
|
|
53
53
|
[cursorChunk]: emptyChunk,
|
|
54
54
|
nextField(): boolean {
|
|
55
|
-
fail(
|
|
55
|
+
fail(0xafb /* cannot navigate above root */);
|
|
56
56
|
},
|
|
57
57
|
exitField(): void {
|
|
58
|
-
fail(
|
|
58
|
+
fail(0xafc /* cannot navigate above root */);
|
|
59
59
|
},
|
|
60
60
|
skipPendingFields(): boolean {
|
|
61
61
|
return true;
|
|
@@ -70,43 +70,43 @@ export const emptyCursor: ChunkedCursor = {
|
|
|
70
70
|
return false;
|
|
71
71
|
},
|
|
72
72
|
enterNode(childIndex: number): void {
|
|
73
|
-
fail(
|
|
73
|
+
fail(0xafd /* empty cursor has no nodes */);
|
|
74
74
|
},
|
|
75
75
|
getFieldPath(prefix?: PathRootPrefix): FieldUpPath {
|
|
76
76
|
return prefixFieldPath(prefix, emptyPath);
|
|
77
77
|
},
|
|
78
78
|
getPath(): UpPath | undefined {
|
|
79
|
-
fail(
|
|
79
|
+
fail(0xafe /* empty cursor has no nodes */);
|
|
80
80
|
},
|
|
81
81
|
get fieldIndex(): never {
|
|
82
|
-
return fail(
|
|
82
|
+
return fail(0xaff /* empty cursor has no nodes */);
|
|
83
83
|
},
|
|
84
84
|
get chunkStart(): never {
|
|
85
|
-
return fail(
|
|
85
|
+
return fail(0xb00 /* empty cursor has no nodes */);
|
|
86
86
|
},
|
|
87
87
|
get chunkLength(): never {
|
|
88
|
-
return fail(
|
|
88
|
+
return fail(0xb01 /* empty cursor has no nodes */);
|
|
89
89
|
},
|
|
90
90
|
seekNodes(offset: number): boolean {
|
|
91
|
-
fail(
|
|
91
|
+
fail(0xb02 /* empty cursor has no nodes */);
|
|
92
92
|
},
|
|
93
93
|
nextNode(): boolean {
|
|
94
|
-
fail(
|
|
94
|
+
fail(0xb03 /* empty cursor has no nodes */);
|
|
95
95
|
},
|
|
96
96
|
exitNode(): void {
|
|
97
|
-
fail(
|
|
97
|
+
fail(0xb04 /* empty cursor has no nodes */);
|
|
98
98
|
},
|
|
99
99
|
firstField(): boolean {
|
|
100
|
-
fail(
|
|
100
|
+
fail(0xb05 /* empty cursor has no nodes */);
|
|
101
101
|
},
|
|
102
102
|
enterField(key: FieldKey): void {
|
|
103
|
-
fail(
|
|
103
|
+
fail(0xb06 /* empty cursor has no nodes */);
|
|
104
104
|
},
|
|
105
105
|
get type(): never {
|
|
106
|
-
return fail(
|
|
106
|
+
return fail(0xb07 /* empty cursor has no nodes */);
|
|
107
107
|
},
|
|
108
108
|
get value(): never {
|
|
109
|
-
return fail(
|
|
109
|
+
return fail(0xb08 /* empty cursor has no nodes */);
|
|
110
110
|
},
|
|
111
111
|
atChunkRoot(): boolean {
|
|
112
112
|
return true;
|
|
@@ -382,7 +382,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
public getFieldKey(): FieldKey {
|
|
385
|
-
return this.fieldKey ?? fail(
|
|
385
|
+
return this.fieldKey ?? fail(0xb09 /* not in a field */);
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
public getFieldLength(): number {
|
|
@@ -510,11 +510,13 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
510
510
|
public exitNode(): void {
|
|
511
511
|
const info = this.nodeInfo(CursorLocationType.Nodes);
|
|
512
512
|
this.indexOfField =
|
|
513
|
-
info.indexOfParentField ??
|
|
513
|
+
info.indexOfParentField ??
|
|
514
|
+
fail(0xb0a /* navigation up to root field not yet supported */); // TODO;
|
|
514
515
|
this.fieldKey = info.parentField;
|
|
515
516
|
this.mode = CursorLocationType.Fields;
|
|
516
517
|
this.moveToPosition(
|
|
517
|
-
info.indexOfParentPosition ??
|
|
518
|
+
info.indexOfParentPosition ??
|
|
519
|
+
fail(0xb0b /* navigation up to root field not yet supported */),
|
|
518
520
|
); // TODO
|
|
519
521
|
}
|
|
520
522
|
|
|
@@ -536,7 +538,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
536
538
|
this.indexOfField =
|
|
537
539
|
fieldInfo === undefined
|
|
538
540
|
? fieldMap.size
|
|
539
|
-
: (fieldInfo.indexOfParentField ?? fail(
|
|
541
|
+
: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));
|
|
540
542
|
this.fieldKey = key;
|
|
541
543
|
this.mode = CursorLocationType.Fields;
|
|
542
544
|
}
|
|
@@ -42,7 +42,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
|
|
|
42
42
|
rebase: (change: 0, over: 0) => 0,
|
|
43
43
|
}),
|
|
44
44
|
codecsFactory: () => noChangeCodecFamily,
|
|
45
|
-
editor: { buildChildChanges: () => fail(
|
|
45
|
+
editor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },
|
|
46
46
|
intoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),
|
|
47
47
|
relevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],
|
|
48
48
|
isEmpty: (change: 0) => true,
|
|
@@ -82,12 +82,9 @@ export function makeField(
|
|
|
82
82
|
|
|
83
83
|
const makeFlexTreeField = (): FlexTreeField => {
|
|
84
84
|
usedAnchor = true;
|
|
85
|
-
const field = new (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
cursor,
|
|
89
|
-
fieldAnchor,
|
|
90
|
-
);
|
|
85
|
+
const field = new (
|
|
86
|
+
kindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)
|
|
87
|
+
)(context, schema, cursor, fieldAnchor);
|
|
91
88
|
return field;
|
|
92
89
|
};
|
|
93
90
|
|
|
@@ -97,7 +94,8 @@ export function makeField(
|
|
|
97
94
|
|
|
98
95
|
// For the common case (all but roots), cache field associated with its node's anchor and field key.
|
|
99
96
|
const anchorNode =
|
|
100
|
-
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
97
|
+
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
98
|
+
fail(0xb10 /* missing anchor */);
|
|
101
99
|
|
|
102
100
|
// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.
|
|
103
101
|
const cacheKey = anchorNode.slots.get(flexTreeSlot);
|
|
@@ -150,7 +148,7 @@ export abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexT
|
|
|
150
148
|
if (fieldAnchor.parent !== undefined) {
|
|
151
149
|
const anchorNode =
|
|
152
150
|
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
153
|
-
fail(
|
|
151
|
+
fail(0xb11 /* parent anchor node should always exist since field is under a node */);
|
|
154
152
|
this.offAfterDestroy = anchorNode.events.on("afterDestroy", () => {
|
|
155
153
|
this[disposeSymbol]();
|
|
156
154
|
});
|
|
@@ -48,7 +48,7 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
|
|
|
48
48
|
const anchor = cursor.buildAnchor();
|
|
49
49
|
const anchorNode =
|
|
50
50
|
context.checkout.forest.anchors.locate(anchor) ??
|
|
51
|
-
fail(
|
|
51
|
+
fail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);
|
|
52
52
|
const cached = anchorNode.slots.get(flexTreeSlot);
|
|
53
53
|
if (cached !== undefined) {
|
|
54
54
|
context.checkout.forest.anchors.forget(anchor);
|
|
@@ -60,7 +60,8 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function cleanupTree(anchor: AnchorNode): void {
|
|
63
|
-
const cached =
|
|
63
|
+
const cached =
|
|
64
|
+
anchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);
|
|
64
65
|
assert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
|
|
65
66
|
cached[disposeSymbol]();
|
|
66
67
|
}
|
|
@@ -86,7 +87,8 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
|
|
|
86
87
|
anchor: Anchor,
|
|
87
88
|
) {
|
|
88
89
|
super(context, cursor, anchor);
|
|
89
|
-
this.storedSchema =
|
|
90
|
+
this.storedSchema =
|
|
91
|
+
context.schema.nodeSchema.get(this.schema) ?? fail(0xb14 /* missing schema */);
|
|
90
92
|
assert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);
|
|
91
93
|
anchorNode.slots.set(flexTreeSlot, this);
|
|
92
94
|
this.#removeDeleteCallback = anchorNode.events.on("afterDestroy", cleanupTree);
|
|
@@ -180,7 +182,7 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
|
|
|
180
182
|
cursor.enterField(key);
|
|
181
183
|
const nodeSchema =
|
|
182
184
|
this.context.schema.nodeSchema.get(parentType) ??
|
|
183
|
-
fail(
|
|
185
|
+
fail(0xb15 /* requested schema that does not exist */);
|
|
184
186
|
fieldSchema = nodeSchema.getFieldSchema(key).kind;
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -359,7 +359,8 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
|
|
|
359
359
|
throw new Error("key finder should be pure and functional");
|
|
360
360
|
}
|
|
361
361
|
const anchor = nodeCursor.buildAnchor();
|
|
362
|
-
const anchorNode =
|
|
362
|
+
const anchorNode =
|
|
363
|
+
this.forest.anchors.locate(anchor) ?? fail(0xb16 /* expected anchor node */);
|
|
363
364
|
|
|
364
365
|
// check if this anchor node already exists in the index
|
|
365
366
|
const existingKey = this.nodeToKey.get(anchorNode);
|
|
@@ -104,7 +104,8 @@ export function allowsTreeSuperset(
|
|
|
104
104
|
allowsFieldSuperset(
|
|
105
105
|
policy,
|
|
106
106
|
originalData,
|
|
107
|
-
original.objectNodeFields.get(originalField) ??
|
|
107
|
+
original.objectNodeFields.get(originalField) ??
|
|
108
|
+
fail(0xb17 /* missing expected field */),
|
|
108
109
|
normalizeField(undefined),
|
|
109
110
|
),
|
|
110
111
|
bExtra: (supersetField) =>
|
|
@@ -112,14 +113,15 @@ export function allowsTreeSuperset(
|
|
|
112
113
|
policy,
|
|
113
114
|
originalData,
|
|
114
115
|
normalizeField(undefined),
|
|
115
|
-
superset.objectNodeFields.get(supersetField) ??
|
|
116
|
+
superset.objectNodeFields.get(supersetField) ??
|
|
117
|
+
fail(0xb18 /* missing expected field */),
|
|
116
118
|
),
|
|
117
119
|
same: (sameField) =>
|
|
118
120
|
allowsFieldSuperset(
|
|
119
121
|
policy,
|
|
120
122
|
originalData,
|
|
121
|
-
original.objectNodeFields.get(sameField) ?? fail(
|
|
122
|
-
superset.objectNodeFields.get(sameField) ?? fail(
|
|
123
|
+
original.objectNodeFields.get(sameField) ?? fail(0xb19 /* missing expected field */),
|
|
124
|
+
superset.objectNodeFields.get(sameField) ?? fail(0xb1a /* missing expected field */),
|
|
123
125
|
),
|
|
124
126
|
});
|
|
125
127
|
}
|
|
@@ -148,7 +150,7 @@ export function allowsFieldSuperset(
|
|
|
148
150
|
superset: TreeFieldStoredSchema,
|
|
149
151
|
): boolean {
|
|
150
152
|
return withEditor(
|
|
151
|
-
policy.fieldKinds.get(original.kind) ?? fail(
|
|
153
|
+
policy.fieldKinds.get(original.kind) ?? fail(0xb1b /* missing kind */),
|
|
152
154
|
).allowsFieldSuperset(policy, originalData, original.types, superset);
|
|
153
155
|
}
|
|
154
156
|
|
|
@@ -35,8 +35,8 @@ export function isNeverFieldRecursive(
|
|
|
35
35
|
parentTypeStack: Set<TreeNodeStoredSchema>,
|
|
36
36
|
): boolean {
|
|
37
37
|
if (
|
|
38
|
-
(policy.fieldKinds.get(field.kind) ?? fail(
|
|
39
|
-
Multiplicity.Single &&
|
|
38
|
+
(policy.fieldKinds.get(field.kind) ?? fail(0xb1c /* missing field kind */))
|
|
39
|
+
.multiplicity === Multiplicity.Single &&
|
|
40
40
|
field.types !== undefined
|
|
41
41
|
) {
|
|
42
42
|
for (const type of field.types) {
|
|
@@ -94,8 +94,10 @@ export function isNeverTreeRecursive(
|
|
|
94
94
|
parentTypeStack.add(treeNode);
|
|
95
95
|
if (treeNode instanceof MapNodeStoredSchema) {
|
|
96
96
|
return (
|
|
97
|
-
(
|
|
98
|
-
.
|
|
97
|
+
(
|
|
98
|
+
policy.fieldKinds.get(treeNode.mapFields.kind) ??
|
|
99
|
+
fail(0xb1d /* missing field kind */)
|
|
100
|
+
).multiplicity === Multiplicity.Single
|
|
99
101
|
);
|
|
100
102
|
} else if (treeNode instanceof ObjectNodeStoredSchema) {
|
|
101
103
|
for (const field of treeNode.objectNodeFields.values()) {
|
|
@@ -177,7 +177,7 @@ function makeModularChangeCodec(
|
|
|
177
177
|
return encodeNodeChangesForJson(node, fieldContext);
|
|
178
178
|
},
|
|
179
179
|
|
|
180
|
-
decodeNode: () => fail(
|
|
180
|
+
decodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
return encodeFieldChangesForJsonI(change, fieldContext);
|
|
@@ -193,7 +193,7 @@ function makeModularChangeCodec(
|
|
|
193
193
|
const { codec, compiledSchema } = getFieldChangesetCodec(fieldChange.fieldKind);
|
|
194
194
|
const encodedChange = codec.json.encode(fieldChange.change, context);
|
|
195
195
|
if (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {
|
|
196
|
-
fail(
|
|
196
|
+
fail(0xb1f /* Encoded change didn't pass schema validation. */);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
const fieldKey: FieldKey = field;
|
|
@@ -238,7 +238,7 @@ function makeModularChangeCodec(
|
|
|
238
238
|
for (const field of encodedChange) {
|
|
239
239
|
const { codec, compiledSchema } = getFieldChangesetCodec(field.fieldKind);
|
|
240
240
|
if (compiledSchema !== undefined && !compiledSchema.check(field.change)) {
|
|
241
|
-
fail(
|
|
241
|
+
fail(0xb20 /* Encoded change didn't pass schema validation. */);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
const fieldId: FieldId = {
|
|
@@ -249,7 +249,7 @@ function makeModularChangeCodec(
|
|
|
249
249
|
const fieldContext: FieldChangeEncodingContext = {
|
|
250
250
|
baseContext: context,
|
|
251
251
|
|
|
252
|
-
encodeNode: () => fail(
|
|
252
|
+
encodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),
|
|
253
253
|
|
|
254
254
|
decodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {
|
|
255
255
|
const nodeId: NodeId = {
|