@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAiF;AAEjF,kDAa6B;AAC7B,kDAA0E;AAC1E,8DAAuF;AAGvF,uEAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAiB,EAAE,MAAmB;IAClE,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAFD,oCAEC;AAED;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,+BAAoB;IAErD;;;;;OAKG;IACH,YACQ,KAAiB,EACjB,MAAmB,EAC1B,YAA4B;QAE5B,KAAK,EAAE,CAAC;QAJD,UAAK,GAAL,KAAK,CAAY;QACjB,WAAM,GAAN,MAAM,CAAa;QAI1B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAA,iBAAM,EACL,KAAK,CAAC,SAAS,CAAC,qBAAqB,GAAG,KAAK,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AAC,+BAA+B,EAAE,CAAC;YACvE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC7D,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, fail, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = idCompressor;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, this.values.slice());\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t// TODO: this is only needed at chunk roots. Optimize it base on that.\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t *\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeDecompressedStringAsNumber - used to check whether or not the value could have been compressed by the idCompressor.\n\t * This flag can only be set on string leaf nodes, and will throw a usage error otherwise.\n\t * If set to true, an additional check can be made (example: getting the value of {@link Cursor}) to return the original uncompressed value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tpublic readonly maybeDecompressedStringAsNumber: boolean = false,\n\t) {\n\t\tif (\n\t\t\tmaybeDecompressedStringAsNumber &&\n\t\t\t!(hasValue && type === \"com.fluidframework.leaf.string\")\n\t\t) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"maybeDecompressedStringAsNumber flag can only be set to true for string leaf node.\",\n\t\t\t);\n\t\t}\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.type === other.type && this.hasValue === other.hasValue;\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * This shape is optimized (by caching derived data like the positions array),\n * so that when paired with a value array it can be efficiently traversed like a tree by an {@link ITreeCursorSynchronous}.\n * See {@link uniformChunk} for how to do this.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\n\t\t// TODO: avoid duplication from inner loop\n\t\tconst positions: (NodePositionInfo | undefined)[] = [undefined];\n\t\tclonePositions(0, [dummyRoot, treeShape, topLevelLength], 0, 0, positions);\n\t\tthis.positions = positions;\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree\n\t * @param key - field key\n\t * @param indexOfParentField - index of node with this shape\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within a uniform chunk.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - TODO\n\t * @param parentField - TODO\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of parent NodePositionInfo in positions array. TODO: use offsets to avoid copying at top level?\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param valueOffset - TODO\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * Works by tracking its location in the chunk's `positions` array.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\t// Undefined when in root field\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t// Cached constants for faster access\n\tprivate readonly shape: ChunkShape;\n\tprivate readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.positions = this.shape.positions;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t * @param positionIndex - index of the position of the newly selected node in `positions`.\n\t * This is NOT an index within a field, and is not bounds checked.\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.nodePositionInfo = this.positions[positionIndex];\n\t\tthis.positionIndex = positionIndex;\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(positionIndex === 0, 0x561 /* expected root at start */);\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t}\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(\"not in a field\");\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" at the beginning of the positions array, then stride by top level tree shape.\n\t\tthis.moveToPosition(1 + childIndex * this.shape.treeShape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.nodePositionInfo,\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\treturn prefixPath(prefix, this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\tpublic get chunkLength(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).topLevelLength;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + info.parentIndex;\n\t\tif (index >= 0 && index < info.topLevelLength) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = info.parentIndex + 1;\n\t\tif (index === info.topLevelLength) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tthis.indexOfField =\n\t\t\tinfo.indexOfParentField ?? fail(\"navigation up to root field not yet supported\"); // TODO;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition ?? fail(\"navigation up to root field not yet supported\"),\n\t\t); // TODO\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(\"children should have parents\"));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst idCompressor = this.chunk.idCompressor;\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\t// If the maybeDecompressedStringAsNumber flag is set to true, we check if the value is a number.\n\t\t// This flag can only ever be set on string leaf nodes, so if the value is a number, we can assume it is a compressible, known stable id.\n\t\tif (info.shape.hasValue && info.shape.maybeDecompressedStringAsNumber) {\n\t\t\tconst value = this.chunk.values[info.valueOffset];\n\t\t\tif (typeof value === \"number\" && idCompressor !== undefined) {\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t}\n\t\treturn info.shape.hasValue ? this.chunk.values[info.valueOffset] : undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAiF;AAEjF,kDAa6B;AAC7B,kDAA0E;AAC1E,8DAAuF;AAGvF,uEAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAiB,EAAE,MAAmB;IAClE,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAFD,oCAEC;AAED;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,+BAAoB;IAErD;;;;;OAKG;IACH,YACQ,KAAiB,EACjB,MAAmB,EAC1B,YAA4B;QAE5B,KAAK,EAAE,CAAC;QAJD,UAAK,GAAL,KAAK,CAAY;QACjB,WAAM,GAAN,MAAM,CAAa;QAI1B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAA,iBAAM,EACL,KAAK,CAAC,SAAS,CAAC,qBAAqB,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC,MAAM,EAC9E,KAAK,CAAC,wCAAwC,CAC9C,CAAC;IACH,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;IAClC,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,YAAY,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,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC7D,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, fail, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = idCompressor;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, this.values.slice());\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t// TODO: this is only needed at chunk roots. Optimize it base on that.\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t *\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeDecompressedStringAsNumber - used to check whether or not the value could have been compressed by the idCompressor.\n\t * This flag can only be set on string leaf nodes, and will throw a usage error otherwise.\n\t * If set to true, an additional check can be made (example: getting the value of {@link Cursor}) to return the original uncompressed value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tpublic readonly maybeDecompressedStringAsNumber: boolean = false,\n\t) {\n\t\tif (\n\t\t\tmaybeDecompressedStringAsNumber &&\n\t\t\t!(hasValue && type === \"com.fluidframework.leaf.string\")\n\t\t) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"maybeDecompressedStringAsNumber flag can only be set to true for string leaf node.\",\n\t\t\t);\n\t\t}\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.type === other.type && this.hasValue === other.hasValue;\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * This shape is optimized (by caching derived data like the positions array),\n * so that when paired with a value array it can be efficiently traversed like a tree by an {@link ITreeCursorSynchronous}.\n * See {@link uniformChunk} for how to do this.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\n\t\t// TODO: avoid duplication from inner loop\n\t\tconst positions: (NodePositionInfo | undefined)[] = [undefined];\n\t\tclonePositions(0, [dummyRoot, treeShape, topLevelLength], 0, 0, positions);\n\t\tthis.positions = positions;\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree\n\t * @param key - field key\n\t * @param indexOfParentField - index of node with this shape\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within a uniform chunk.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - TODO\n\t * @param parentField - TODO\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of parent NodePositionInfo in positions array. TODO: use offsets to avoid copying at top level?\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param valueOffset - TODO\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * Works by tracking its location in the chunk's `positions` array.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\t// Undefined when in root field\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t// Cached constants for faster access\n\tprivate readonly shape: ChunkShape;\n\tprivate readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.positions = this.shape.positions;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t * @param positionIndex - index of the position of the newly selected node in `positions`.\n\t * This is NOT an index within a field, and is not bounds checked.\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.nodePositionInfo = this.positions[positionIndex];\n\t\tthis.positionIndex = positionIndex;\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(positionIndex === 0, 0x561 /* expected root at start */);\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t}\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(0xb09 /* not in a field */);\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" at the beginning of the positions array, then stride by top level tree shape.\n\t\tthis.moveToPosition(1 + childIndex * this.shape.treeShape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.nodePositionInfo,\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\treturn prefixPath(prefix, this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\tpublic get chunkLength(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).topLevelLength;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + info.parentIndex;\n\t\tif (index >= 0 && index < info.topLevelLength) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = info.parentIndex + 1;\n\t\tif (index === info.topLevelLength) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tthis.indexOfField =\n\t\t\tinfo.indexOfParentField ??\n\t\t\tfail(0xb0a /* navigation up to root field not yet supported */); // TODO;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition ??\n\t\t\t\tfail(0xb0b /* navigation up to root field not yet supported */),\n\t\t); // TODO\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst idCompressor = this.chunk.idCompressor;\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\t// If the maybeDecompressedStringAsNumber flag is set to true, we check if the value is a number.\n\t\t// This flag can only ever be set on string leaf nodes, so if the value is a number, we can assume it is a compressible, known stable id.\n\t\tif (info.shape.hasValue && info.shape.maybeDecompressedStringAsNumber) {\n\t\t\tconst value = this.chunk.values[info.valueOffset];\n\t\t\tif (typeof value === \"number\" && idCompressor !== undefined) {\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t}\n\t\treturn info.shape.hasValue ? this.chunk.values[info.valueOffset] : undefined;\n\t}\n}\n"]}
|
|
@@ -21,7 +21,7 @@ exports.noChangeHandler = {
|
|
|
21
21
|
rebase: (change, over) => 0,
|
|
22
22
|
}),
|
|
23
23
|
codecsFactory: () => noChangeCodecs_js_1.noChangeCodecFamily,
|
|
24
|
-
editor: { buildChildChanges: () => (0, index_js_2.fail)(
|
|
24
|
+
editor: { buildChildChanges: () => (0, index_js_2.fail)(0xb0d /* Child changes not supported */) },
|
|
25
25
|
intoDelta: (change, deltaFromChild) => ({}),
|
|
26
26
|
relevantRemovedRoots: (change) => [],
|
|
27
27
|
isEmpty: (change) => true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAM6B;AAC7B,kDAA2C;AAC3C,yDAWoC;AACpC,yDAIoC;AACpC,yDAAwE;AAExE,2DAA0D;AAE1D;;GAEG;AACU,QAAA,eAAe,GAA0B;IACrD,OAAO,EAAE,IAAA,0CAA+B,EAAC;QACxC,OAAO,EAAE,CAAC,OAAU,EAAE,OAAU,EAAE,EAAE,CAAC,CAAC;QACtC,MAAM,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,MAAS,EAAE,IAAO,EAAE,EAAE,CAAC,CAAC;KACjC,CAAC;IACF,aAAa,EAAE,GAAG,EAAE,CAAC,uCAAmB;IACxC,MAAM,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,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AAQ,EAAR,gBAAQ,EAAE,QAAQ,EAAR,gBAAQ,EAAE,QAAQ,EAAR,gBAAQ,EAAE,UAAU,EAAV,kBAAU,EAAE,SAAS,EAAT,iBAAS,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFieldKindWithEditor,\n\ttype FlexFieldKind,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport { sequenceFieldChangeHandler } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(\"Child changes not supported\") },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\nexport interface ValueFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = \"Optional\";\n/**\n * 0 or 1 items.\n */\nexport const optional = new FieldKindWithEditor(\n\toptionalIdentifier,\n\tMultiplicity.Optional,\n\toptionalChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set([]),\n);\n\nexport const valueFieldEditor: ValueFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const valueChangeHandler: FieldChangeHandler<OptionalChangeset, ValueFieldEditor> = {\n\t...optional.changeHandler,\n\teditor: valueFieldEditor,\n};\n\nconst requiredIdentifier = \"Value\";\n\n/**\n * Exactly one item.\n */\nexport const required = new FieldKindWithEditor(\n\trequiredIdentifier,\n\tMultiplicity.Single,\n\tvalueChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKey.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst sequenceIdentifier = \"Sequence\";\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FieldKindWithEditor(\n\tsequenceIdentifier,\n\tMultiplicity.Sequence,\n\tsequenceFieldChangeHandler,\n\t(types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\t// TODO: add normalizer/importers for handling ops from other kinds.\n\tnew Set([]),\n);\n\nconst nodeKeyIdentifier = \"NodeKey\";\n\n/**\n * Exactly one identifier.\n */\nexport const nodeKey = new FieldKindWithEditor(\n\tnodeKeyIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKeyIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst identifierFieldIdentifier = \"Identifier\";\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FieldKindWithEditor(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FieldKindWithEditor(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\tnoChangeHandler,\n\t// All multiplicities other than Value support empty.\n\t(types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\tnew Set(),\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration> = new Map([\n\t[\n\t\t1,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 1 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 1 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t2,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(\n\t[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\n/**\n */\nexport interface Required extends FlexFieldKind<\"Value\", Multiplicity.Single> {}\n/**\n */\nexport interface Optional extends FlexFieldKind<\"Optional\", Multiplicity.Optional> {}\n/**\n */\nexport interface Sequence extends FlexFieldKind<\"Sequence\", Multiplicity.Sequence> {}\n/**\n */\nexport interface Identifier extends FlexFieldKind<\"Identifier\", Multiplicity.Single> {}\n/**\n */\nexport interface Forbidden\n\textends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n"]}
|
|
1
|
+
{"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.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UAAU,EAAE,EAAE,IAAI,EAAE,iBAAS,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAC7D,CAAC,kBAAU,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,kBAAU,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;SAC/D,CAAC;KACF;CACD,CAAC,CAAC;AAEH;;;;;;GAMG;AACU,QAAA,UAAU,GAA0D,IAAI,GAAG,CACvF,CAAC,gBAAQ,EAAE,gBAAQ,EAAE,gBAAQ,EAAE,eAAO,EAAE,kBAAU,EAAE,iBAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAC5F,CAAC;AAwBF;;GAEG;AACU,QAAA,UAAU,GAOnB,EAAE,QAAQ,EAAR,gBAAQ,EAAE,QAAQ,EAAR,gBAAQ,EAAE,QAAQ,EAAR,gBAAQ,EAAE,UAAU,EAAV,kBAAU,EAAE,SAAS,EAAT,iBAAS,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFieldKindWithEditor,\n\ttype FlexFieldKind,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport { sequenceFieldChangeHandler } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\nexport interface ValueFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = \"Optional\";\n/**\n * 0 or 1 items.\n */\nexport const optional = new FieldKindWithEditor(\n\toptionalIdentifier,\n\tMultiplicity.Optional,\n\toptionalChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set([]),\n);\n\nexport const valueFieldEditor: ValueFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const valueChangeHandler: FieldChangeHandler<OptionalChangeset, ValueFieldEditor> = {\n\t...optional.changeHandler,\n\teditor: valueFieldEditor,\n};\n\nconst requiredIdentifier = \"Value\";\n\n/**\n * Exactly one item.\n */\nexport const required = new FieldKindWithEditor(\n\trequiredIdentifier,\n\tMultiplicity.Single,\n\tvalueChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKey.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst sequenceIdentifier = \"Sequence\";\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FieldKindWithEditor(\n\tsequenceIdentifier,\n\tMultiplicity.Sequence,\n\tsequenceFieldChangeHandler,\n\t(types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\t// TODO: add normalizer/importers for handling ops from other kinds.\n\tnew Set([]),\n);\n\nconst nodeKeyIdentifier = \"NodeKey\";\n\n/**\n * Exactly one identifier.\n */\nexport const nodeKey = new FieldKindWithEditor(\n\tnodeKeyIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKeyIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst identifierFieldIdentifier = \"Identifier\";\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FieldKindWithEditor(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FieldKindWithEditor(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\tnoChangeHandler,\n\t// All multiplicities other than Value support empty.\n\t(types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\tnew Set(),\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration> = new Map([\n\t[\n\t\t1,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 1 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 1 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t2,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(\n\t[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\n/**\n */\nexport interface Required extends FlexFieldKind<\"Value\", Multiplicity.Single> {}\n/**\n */\nexport interface Optional extends FlexFieldKind<\"Optional\", Multiplicity.Optional> {}\n/**\n */\nexport interface Sequence extends FlexFieldKind<\"Sequence\", Multiplicity.Sequence> {}\n/**\n */\nexport interface Identifier extends FlexFieldKind<\"Identifier\", Multiplicity.Single> {}\n/**\n */\nexport interface Forbidden\n\textends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n"]}
|
|
@@ -78,7 +78,7 @@ function isNodeInSchema(node, schemaAndPolicy) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
(0, index_js_2.fail)(
|
|
81
|
+
(0, index_js_2.fail)(0xb0e /* Unknown TreeNodeStoredSchema type */);
|
|
82
82
|
}
|
|
83
83
|
return 0 /* SchemaValidationErrors.NoError */;
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,kDAQ6B;AAC7B,4DAAmD;AACnD,kDAA2C;AAE3C,IAAkB,sBAWjB;AAXD,WAAkB,sBAAsB;IACvC,yEAAO,CAAA;IACP,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,2GAAwB,CAAA;IACxB,qGAAqB,CAAA;IACrB,6GAAyB,CAAA;IACzB,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,+FAAkB,CAAA;IAClB,mFAAY,CAAA;AACb,CAAC,EAXiB,sBAAsB,sCAAtB,sBAAsB,QAWvC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC7B,IAAa,EACb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AAM,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,2GAA2G;QAC3G,IACC,uBAAuB,CAAC,IAAI,KAAK,CAAC;YAClC,CAAC,eAAe,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5D,CAAC;YACF,kEAA0D;QAC3D,CAAC;IACF,CAAC;SAAM,IAAI,MAAM,YAAY,8BAAmB,EAAE,CAAC;QAClD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,kEAA0D;QAC3D,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1C,MAAM,mBAAmB,GAAG,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;YACtF,IAAI,mBAAmB,2CAAmC,EAAE,CAAC;gBAC5D,OAAO,mBAAmB,CAAC;YAC5B,CAAC;QACF,CAAC;IACF,CAAC;SAAM,CAAC;QACP,IAAA,eAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,kDAQ6B;AAC7B,4DAAmD;AACnD,kDAA2C;AAE3C,IAAkB,sBAWjB;AAXD,WAAkB,sBAAsB;IACvC,yEAAO,CAAA;IACP,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,2GAAwB,CAAA;IACxB,qGAAqB,CAAA;IACrB,6GAAyB,CAAA;IACzB,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,+FAAkB,CAAA;IAClB,mFAAY,CAAA;AACb,CAAC,EAXiB,sBAAsB,sCAAtB,sBAAsB,QAWvC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC7B,IAAa,EACb,eAAgC;IAEhC,mHAAmH;IACnH,+BAA+B;IAC/B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AAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,+DAAuD;QACxD,CAAC;QAED,8DAA8D;QAC9D,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,kBAAkB,2CAAmC,EAAE,CAAC;YAC3D,OAAO,kBAAkB,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,8CAAsC;AACvC,CAAC;AA9BD,0CA8BC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACvC,aAAqB,EACrB,YAA0B;IAE1B,QAAQ,YAAY,EAAE,CAAC;QACtB,KAAK,uBAAY,CAAC,MAAM;YACvB,OAAO,aAAa,KAAK,CAAC,CAAC;QAC5B,KAAK,uBAAY,CAAC,QAAQ;YACzB,OAAO,aAAa,IAAI,CAAC,CAAC;QAC3B,KAAK,uBAAY,CAAC,QAAQ;YACzB,OAAO,IAAI,CAAC;QACb,KAAK,uBAAY,CAAC,SAAS;YAC1B,OAAO,aAAa,KAAK,CAAC,CAAC;QAC5B;YACC,IAAA,0BAAe,EAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACF,CAAC;AAhBD,4DAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype MapTree,\n\ttype TreeFieldStoredSchema,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tMultiplicity,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\nimport { allowsValue } from \"../valueUtilities.js\";\nimport { fail } from \"../../util/index.js\";\n\nexport const enum SchemaValidationErrors {\n\tNoError,\n\tField_KindNotInSchemaPolicy,\n\tField_IncorrectMultiplicity,\n\tField_NodeTypeNotAllowed,\n\tLeafNode_InvalidValue,\n\tLeafNode_FieldsNotAllowed,\n\tObjectNode_FieldNotInSchema,\n\tNonLeafNode_ValueNotAllowed,\n\tNode_MissingSchema,\n\tUnknownError,\n}\n\n/**\n * Deeply checks that the provided node complies with the schema based on its identifier.\n */\nexport function isNodeInSchema(\n\tnode: MapTree,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationErrors {\n\t// If the stored schema is completely empty it _probably_ (in almost all cases?) means the tree is brand new and we\n\t// shouldn't validate the data.\n\t// TODO: AB#8197\n\t// See https://github.com/microsoft/FluidFramework/pull/21305#discussion_r1626595991 for further discussion.\n\tif (schemaAndPolicy.schema.nodeSchema.size === 0) {\n\t\treturn SchemaValidationErrors.NoError;\n\t}\n\n\t// Validate the schema declared by the node exists\n\tconst schema = schemaAndPolicy.schema.nodeSchema.get(node.type);\n\tif (schema === undefined) {\n\t\treturn SchemaValidationErrors.Node_MissingSchema;\n\t}\n\n\t// Validate the node is well formed according to its schema\n\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tif (node.fields.size !== 0) {\n\t\t\treturn SchemaValidationErrors.LeafNode_FieldsNotAllowed;\n\t\t}\n\t\tif (!allowsValue(schema.leafValue, node.value)) {\n\t\t\treturn SchemaValidationErrors.LeafNode_InvalidValue;\n\t\t}\n\t} else if (schema instanceof ObjectNodeStoredSchema) {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationErrors.NonLeafNode_ValueNotAllowed;\n\t\t}\n\t\tconst uncheckedFieldsFromNode = new Set(node.fields.keys());\n\t\tfor (const [fieldKey, fieldSchema] of schema.objectNodeFields) {\n\t\t\tconst nodeField = node.fields.get(fieldKey) ?? [];\n\t\t\tconst fieldInSchemaResult = isFieldInSchema(nodeField, fieldSchema, schemaAndPolicy);\n\t\t\tif (fieldInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\t\treturn fieldInSchemaResult;\n\t\t\t}\n\t\t\tuncheckedFieldsFromNode.delete(fieldKey);\n\t\t}\n\t\t// The node has fields that we did not check as part of looking at every field defined in the node's schema\n\t\tif (\n\t\t\tuncheckedFieldsFromNode.size !== 0 &&\n\t\t\t!schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)\n\t\t) {\n\t\t\treturn SchemaValidationErrors.ObjectNode_FieldNotInSchema;\n\t\t}\n\t} else if (schema instanceof MapNodeStoredSchema) {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationErrors.NonLeafNode_ValueNotAllowed;\n\t\t}\n\t\tfor (const field of node.fields.values()) {\n\t\t\tconst fieldInSchemaResult = isFieldInSchema(field, schema.mapFields, schemaAndPolicy);\n\t\t\tif (fieldInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\t\treturn fieldInSchemaResult;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfail(0xb0e /* Unknown TreeNodeStoredSchema type */);\n\t}\n\n\treturn SchemaValidationErrors.NoError;\n}\n\n/**\n * Deeply checks that the nodes comply with the field schema and included schema.\n */\nexport function isFieldInSchema(\n\tchildNodes: readonly MapTree[],\n\tschema: TreeFieldStoredSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationErrors {\n\t// Validate that the field kind is handled by the schema policy\n\tconst kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);\n\tif (kind === undefined) {\n\t\treturn SchemaValidationErrors.Field_KindNotInSchemaPolicy;\n\t}\n\n\t// Validate that the field doesn't contain more nodes than its type supports\n\tif (!compliesWithMultiplicity(childNodes.length, kind.multiplicity)) {\n\t\treturn SchemaValidationErrors.Field_IncorrectMultiplicity;\n\t}\n\n\tfor (const node of childNodes) {\n\t\t// Validate the type declared by the node is allowed in this field\n\t\tif (schema.types !== undefined && !schema.types.has(node.type)) {\n\t\t\treturn SchemaValidationErrors.Field_NodeTypeNotAllowed;\n\t\t}\n\n\t\t// Validate the node complies with the type it declares to be.\n\t\tconst nodeInSchemaResult = isNodeInSchema(node, schemaAndPolicy);\n\t\tif (nodeInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\treturn nodeInSchemaResult;\n\t\t}\n\t}\n\n\treturn SchemaValidationErrors.NoError;\n}\n\n/**\n * Validates that a given number of items complies with the specified {@link Multiplicity | multiplicity}.\n * @param numberOfItems - Number of items.\n * @param multiplicity - Kind of multiplicity to validate against.\n * @returns `true` if the specified number of items complies with the specified multiplicity; otherwise, `false`.\n */\nexport function compliesWithMultiplicity(\n\tnumberOfItems: number,\n\tmultiplicity: Multiplicity,\n): boolean {\n\tswitch (multiplicity) {\n\t\tcase Multiplicity.Single:\n\t\t\treturn numberOfItems === 1;\n\t\tcase Multiplicity.Optional:\n\t\t\treturn numberOfItems <= 1;\n\t\tcase Multiplicity.Sequence:\n\t\t\treturn true;\n\t\tcase Multiplicity.Forbidden:\n\t\t\treturn numberOfItems === 0;\n\t\tdefault:\n\t\t\tunreachableCase(multiplicity);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyField.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAGN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEhB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAIzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEN,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAE3B,cAAc,EAEd,MAAM,oBAAoB,CA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c;CAItB;AAED,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,qBAAqB;IAC9E,MAAM,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAIpD;IAEF,IAAW,OAAO,IAAI,sBAAsB,CAE3C;CACD;AAED,qBAAa,cAAe,SAAQ,sBAAuB,YAAW,qBAAqB;IAC1E,MAAM,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAI7D;IAEF,OAAO,CAAC,gBAAgB;IAMxB,IAAoB,OAAO,IAAI,sBAAsB,CAEpD;CACD;AAED,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,qBAAqB;IACzE,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAOvD;IAEF,OAAO,CAAC,cAAc;IAMtB,IAAW,OAAO,IAAI,sBAAsB,GAAG,SAAS,CAEvD;CACD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AAoBpD;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,GACtB,sBAAsB,CA8BxB"}
|
|
@@ -35,14 +35,15 @@ function makeField(context, schema, cursor) {
|
|
|
35
35
|
let usedAnchor = false;
|
|
36
36
|
const makeFlexTreeField = () => {
|
|
37
37
|
usedAnchor = true;
|
|
38
|
-
const field = new (kindToClass.get(schema) ?? (0, index_js_2.fail)(
|
|
38
|
+
const field = new (kindToClass.get(schema) ?? (0, index_js_2.fail)(0xb0f /* missing field implementation */))(context, schema, cursor, fieldAnchor);
|
|
39
39
|
return field;
|
|
40
40
|
};
|
|
41
41
|
if (fieldAnchor.parent === undefined) {
|
|
42
42
|
return makeFlexTreeField();
|
|
43
43
|
}
|
|
44
44
|
// For the common case (all but roots), cache field associated with its node's anchor and field key.
|
|
45
|
-
const anchorNode = context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
45
|
+
const anchorNode = context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
46
|
+
(0, index_js_2.fail)(0xb10 /* missing anchor */);
|
|
46
47
|
// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.
|
|
47
48
|
const cacheKey = anchorNode.slots.get(flexTreeTypes_js_1.flexTreeSlot);
|
|
48
49
|
// If there is no flex tree parent node, skip caching: this is not expected to be a hot path, but should probably be fixed at some point.
|
|
@@ -75,7 +76,7 @@ class LazyField extends lazyEntity_js_1.LazyEntity {
|
|
|
75
76
|
// For root fields, this means forever, but other cases can be cleaned up when their parent anchor is deleted.
|
|
76
77
|
if (fieldAnchor.parent !== undefined) {
|
|
77
78
|
const anchorNode = context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
78
|
-
(0, index_js_2.fail)(
|
|
79
|
+
(0, index_js_2.fail)(0xb11 /* parent anchor node should always exist since field is under a node */);
|
|
79
80
|
this.offAfterDestroy = anchorNode.events.on("afterDestroy", () => {
|
|
80
81
|
this[index_js_2.disposeSymbol]();
|
|
81
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyField.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,kDAc6B;AAC7B,kDAAuE;AACvE,yDAKoC;AAIpC,yDAY4B;AAC5B,mDAOyB;AACzB,+CAA4D;AAC5D,iDAAuE;AACvE,0DAAkF;AAElF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,GAAwD,IAAI,OAAO,EAAE,CAAC;AAEtF,SAAgB,SAAS,CACxB,OAAgB,EAChB,MAA2B,EAC3B,MAA+B;IAE/B,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC9C,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,MAAM,iBAAiB,GAAG,GAAkB,EAAE;QAC7C,UAAU,GAAG,IAAI,CAAC;QAClB,MAAM,KAAK,GAAG,IA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AAC,OAAO,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,WAAW,CAAC,QAAQ;YACjC,WAAW,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IAED,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AAlCD,0CAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype ExclusiveMapTree,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\tinCursorNode,\n\titerateCursorField,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport {\n\tFieldKinds,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\ttype ValueFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\tTreeStatus,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\tisFreedSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { type LazyTreeNode, makeTree } from \"./lazyNode.js\";\nimport { indexForAt, treeStatusFromAnchorCache } from \"./utilities.js\";\nimport { cursorForMapTreeField, cursorForMapTreeNode } from \"../mapTreeCursor.js\";\n\n/**\n * Reuse fields.\n * Since field currently own cursors and register themselves for disposal when the node hit end of life,\n * not reusing them results in memory leaks every time the field is accessed.\n * Since the fields stay alive until the node is end of life reusing them this way is safe.\n *\n * This ins't a perfect solution:\n *\n * - This can cause leaks, like map nodes will keep all accessed field objects around. Since other things cause this same leak already, its not too bad.\n * - This does not cache the root.\n * - Finding the parent anchor to do the caching on has significant cost.\n *\n * Despite these limitations, this cache provides a large performance win in some common cases (over 10x), especially with how simple tree requests far more field objects than necessary currently.\n */\nconst fieldCache: WeakMap<LazyTreeNode, Map<FieldKey, FlexTreeField>> = new WeakMap();\n\nexport function makeField(\n\tcontext: Context,\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeField {\n\tconst fieldAnchor = cursor.buildFieldAnchor();\n\tlet usedAnchor = false;\n\n\tconst makeFlexTreeField = (): FlexTreeField => {\n\t\tusedAnchor = true;\n\t\tconst field = new (kindToClass.get(schema) ?? fail(\"missing field implementation\"))(\n\t\t\tcontext,\n\t\t\tschema,\n\t\t\tcursor,\n\t\t\tfieldAnchor,\n\t\t);\n\t\treturn field;\n\t};\n\n\tif (fieldAnchor.parent === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\t// For the common case (all but roots), cache field associated with its node's anchor and field key.\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ?? fail(\"missing anchor\");\n\n\t// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.\n\tconst cacheKey = anchorNode.slots.get(flexTreeSlot);\n\n\t// If there is no flex tree parent node, skip caching: this is not expected to be a hot path, but should probably be fixed at some point.\n\tif (cacheKey === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\tconst innerCache = getOrCreate(\n\t\tfieldCache,\n\t\tcacheKey,\n\t\t() => new Map<FieldKey, FlexTreeField>(),\n\t);\n\tconst result = getOrCreate(innerCache, fieldAnchor.fieldKey, makeFlexTreeField);\n\tif (!usedAnchor) {\n\t\t// The anchor must be disposed to avoid leaking. In the case of a cache hit,\n\t\t// we are not transferring ownership to a new FlexTreeField, so it must be disposed of here to avoid the leak.\n\t\tcontext.checkout.forest.anchors.forget(fieldAnchor.parent);\n\t}\n\treturn result;\n}\n\n/**\n * Base type for fields implementing {@link FlexTreeField} using cursors.\n */\nexport abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexTreeField {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Field {\n\t\treturn FlexTreeEntityKind.Field;\n\t}\n\tpublic readonly key: FieldKey;\n\n\t/**\n\t * If this field ends its lifetime before the Anchor does, this needs to be invoked to avoid a double free\n\t * if/when the Anchor is destroyed.\n\t */\n\tprivate readonly offAfterDestroy?: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: FieldKindIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tfieldAnchor: FieldAnchor,\n\t) {\n\t\tsuper(context, cursor, fieldAnchor);\n\t\tassert(cursor.mode === CursorLocationType.Fields, 0x77b /* must be in fields mode */);\n\t\tthis.key = cursor.getFieldKey();\n\t\t// Fields currently live as long as their parent does.\n\t\t// For root fields, this means forever, but other cases can be cleaned up when their parent anchor is deleted.\n\t\tif (fieldAnchor.parent !== undefined) {\n\t\t\tconst anchorNode =\n\t\t\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\t\t\tfail(\"parent anchor node should always exist since field is under a node\");\n\t\t\tthis.offAfterDestroy = anchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis[disposeSymbol]();\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\tassert(\n\t\t\tthis.context.schemaPolicy.fieldKinds.get(kind.identifier) === kind,\n\t\t\t0xa26 /* Narrowing must be done to a kind that exists in this context */,\n\t\t);\n\n\t\treturn this.schema === kind.identifier;\n\t}\n\n\tpublic get parent(): FlexTreeNode | undefined {\n\t\tif (this[anchorSymbol].parent === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst cursor = this[cursorSymbol];\n\t\tcursor.exitField();\n\t\tconst output = makeTree(this.context, cursor);\n\t\tcursor.enterField(this.key);\n\t\treturn output;\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToField(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\tthis.offAfterDestroy?.();\n\t\tif (this[anchorSymbol].parent === undefined) return;\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol].parent);\n\t}\n\n\tpublic get length(): number {\n\t\treturn this[cursorSymbol].getFieldLength();\n\t}\n\n\tpublic atIndex(index: number): FlexTreeUnknownUnboxed {\n\t\treturn inCursorNode(this[cursorSymbol], index, (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this[anchorSymbol]),\n\t\t);\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeNode | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn inCursorNode(this[cursorSymbol], finalIndex, (cursor) =>\n\t\t\tmakeTree(this.context, cursor),\n\t\t);\n\t}\n\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeNode> {\n\t\treturn iterateCursorField(this[cursorSymbol], (cursor) => makeTree(this.context, cursor));\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {\n\t\treturn iterateCursorField(this[cursorSymbol], (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this[anchorSymbol]),\n\t\t);\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\treturn this[cursorSymbol].getFieldPath();\n\t}\n\n\t/**\n\t * Returns the path to this field to use for editing. Throws iff this path is not {@link TreeStatus#InDocument}.\n\t * This path is not valid to hold onto across edits: this must be recalled for each edit.\n\t */\n\tpublic getFieldPathForEditing(): FieldUpPath {\n\t\tif (!this[isFreedSymbol]()) {\n\t\t\tif (\n\t\t\t\t// Only allow editing if we are the root document field...\n\t\t\t\t(this.parent === undefined && this[anchorSymbol].fieldKey === rootFieldKey) ||\n\t\t\t\t// ...or are under a node in the document\n\t\t\t\t(this.parent !== undefined &&\n\t\t\t\t\ttreeStatusFromAnchorCache(this.parent.anchorNode) === TreeStatus.InDocument)\n\t\t\t) {\n\t\t\t\treturn this.getFieldPath();\n\t\t\t}\n\t\t}\n\n\t\tthrow new UsageError(\"Editing only allowed on fields with TreeStatus.InDocument status\");\n\t}\n}\n\nexport class LazySequence extends LazyField implements FlexTreeSequenceField {\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.atIndex(finalIndex);\n\t}\n\tpublic get asArray(): readonly FlexTreeUnknownUnboxed[] {\n\t\treturn this.map((x) => x);\n\t}\n\n\tpublic editor: SequenceFieldEditBuilder<ExclusiveMapTree[]> = {\n\t\tinsert: (index, newContent) => {\n\t\t\tthis.sequenceEditor().insert(index, cursorForMapTreeField(newContent));\n\t\t},\n\t\tremove: (index, count) => {\n\t\t\tthis.sequenceEditor().remove(index, count);\n\t\t},\n\t};\n\n\tprivate sequenceEditor(): SequenceFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\treturn this.context.checkout.editor.sequenceField(fieldPath);\n\t}\n}\n\nexport class ReadonlyLazyValueField extends LazyField implements FlexTreeRequiredField {\n\tpublic editor: ValueFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent) => {\n\t\t\tassert(false, 0xa0c /* Unexpected set of readonly field */);\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyValueField extends ReadonlyLazyValueField implements FlexTreeRequiredField {\n\tpublic override editor: ValueFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent) => {\n\t\t\tthis.valueFieldEditor().set(cursorForMapTreeNode(newContent));\n\t\t},\n\t};\n\n\tprivate valueFieldEditor(): ValueFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.context.checkout.editor.valueField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic override get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyOptionalField extends LazyField implements FlexTreeOptionalField {\n\tpublic editor: OptionalFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent, wasEmpty) => {\n\t\t\tthis.optionalEditor().set(\n\t\t\t\tnewContent !== undefined ? cursorForMapTreeNode(newContent) : newContent,\n\t\t\t\twasEmpty,\n\t\t\t);\n\t\t},\n\t};\n\n\tprivate optionalEditor(): OptionalFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.context.checkout.editor.optionalField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\treturn this.length === 0 ? undefined : this.atIndex(0);\n\t}\n}\n\nexport class LazyForbiddenField extends LazyField {}\n\ntype Builder = new (\n\tcontext: Context,\n\t// Correct use of these builders requires the builder of the matching type to be used.\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n) => LazyField;\n\nconst builderList: [FieldKindIdentifier, Builder][] = [\n\t[FieldKinds.forbidden.identifier, LazyForbiddenField],\n\t[FieldKinds.optional.identifier, LazyOptionalField],\n\t[FieldKinds.sequence.identifier, LazySequence],\n\t[FieldKinds.required.identifier, LazyValueField],\n\t[FieldKinds.identifier.identifier, LazyValueField],\n];\n\nconst kindToClass: ReadonlyMap<FieldKindIdentifier, Builder> = new Map(builderList);\n\n/**\n * Returns the flex tree node, or the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\t// Try accessing cached child node via anchors.\n\t// This avoids O(depth) related costs from makeTree in the cached case.\n\tconst anchor = fieldAnchor.parent;\n\tlet child: AnchorNode | undefined;\n\tif (anchor !== undefined) {\n\t\tconst anchorNode = context.checkout.forest.anchors.locate(anchor);\n\t\tassert(anchorNode !== undefined, 0xa4c /* missing anchor */);\n\t\tchild = anchorNode.childIfAnchored(fieldAnchor.fieldKey, cursor.fieldIndex);\n\t} else {\n\t\tchild = context.checkout.forest.anchors.find({\n\t\t\tparent: undefined,\n\t\t\tparentField: fieldAnchor.fieldKey,\n\t\t\tparentIndex: cursor.fieldIndex,\n\t\t});\n\t}\n\n\tif (child !== undefined) {\n\t\tconst cached = child.slots.get(flexTreeSlot);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\t}\n\n\treturn makeTree(context, cursor);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"lazyField.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,kDAc6B;AAC7B,kDAAuE;AACvE,yDAKoC;AAIpC,yDAY4B;AAC5B,mDAOyB;AACzB,+CAA4D;AAC5D,iDAAuE;AACvE,0DAAkF;AAElF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,GAAwD,IAAI,OAAO,EAAE,CAAC;AAEtF,SAAgB,SAAS,CACxB,OAAgB,EAChB,MAA2B,EAC3B,MAA+B;IAE/B,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC9C,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,MAAM,iBAAiB,GAAG,GAAkB,EAAE;QAC7C,UAAU,GAAG,IAAI,CAAC;QAClB,MAAM,KAAK,GAAG,IAAI,CACjB,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,kCAAkC,CAAC,CACzE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;IAEF,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,iBAAiB,EAAE,CAAC;IAC5B,CAAC;IAED,oGAAoG;IACpG,MAAM,UAAU,GACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1D,IAAA,eAAI,EAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAElC,2HAA2H;IAC3H,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;IAEpD,yIAAyI;IACzI,IAAI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B,OAAgB,EAChB,MAA+B,EAC/B,WAAwB;IAExB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,+CAA+C;IAC/C,uEAAuE;IACvE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,IAAI,KAA6B,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClE,IAAA,iBAAM,EAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC7D,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,WAAW,CAAC,QAAQ;YACjC,WAAW,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;QAC7C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QACf,CAAC;IACF,CAAC;IAED,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AAlCD,0CAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype ExclusiveMapTree,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\tinCursorNode,\n\titerateCursorField,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport {\n\tFieldKinds,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\ttype ValueFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\tTreeStatus,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\tisFreedSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { type LazyTreeNode, makeTree } from \"./lazyNode.js\";\nimport { indexForAt, treeStatusFromAnchorCache } from \"./utilities.js\";\nimport { cursorForMapTreeField, cursorForMapTreeNode } from \"../mapTreeCursor.js\";\n\n/**\n * Reuse fields.\n * Since field currently own cursors and register themselves for disposal when the node hit end of life,\n * not reusing them results in memory leaks every time the field is accessed.\n * Since the fields stay alive until the node is end of life reusing them this way is safe.\n *\n * This ins't a perfect solution:\n *\n * - This can cause leaks, like map nodes will keep all accessed field objects around. Since other things cause this same leak already, its not too bad.\n * - This does not cache the root.\n * - Finding the parent anchor to do the caching on has significant cost.\n *\n * Despite these limitations, this cache provides a large performance win in some common cases (over 10x), especially with how simple tree requests far more field objects than necessary currently.\n */\nconst fieldCache: WeakMap<LazyTreeNode, Map<FieldKey, FlexTreeField>> = new WeakMap();\n\nexport function makeField(\n\tcontext: Context,\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeField {\n\tconst fieldAnchor = cursor.buildFieldAnchor();\n\tlet usedAnchor = false;\n\n\tconst makeFlexTreeField = (): FlexTreeField => {\n\t\tusedAnchor = true;\n\t\tconst field = new (\n\t\t\tkindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)\n\t\t)(context, schema, cursor, fieldAnchor);\n\t\treturn field;\n\t};\n\n\tif (fieldAnchor.parent === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\t// For the common case (all but roots), cache field associated with its node's anchor and field key.\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\tfail(0xb10 /* missing anchor */);\n\n\t// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.\n\tconst cacheKey = anchorNode.slots.get(flexTreeSlot);\n\n\t// If there is no flex tree parent node, skip caching: this is not expected to be a hot path, but should probably be fixed at some point.\n\tif (cacheKey === undefined) {\n\t\treturn makeFlexTreeField();\n\t}\n\n\tconst innerCache = getOrCreate(\n\t\tfieldCache,\n\t\tcacheKey,\n\t\t() => new Map<FieldKey, FlexTreeField>(),\n\t);\n\tconst result = getOrCreate(innerCache, fieldAnchor.fieldKey, makeFlexTreeField);\n\tif (!usedAnchor) {\n\t\t// The anchor must be disposed to avoid leaking. In the case of a cache hit,\n\t\t// we are not transferring ownership to a new FlexTreeField, so it must be disposed of here to avoid the leak.\n\t\tcontext.checkout.forest.anchors.forget(fieldAnchor.parent);\n\t}\n\treturn result;\n}\n\n/**\n * Base type for fields implementing {@link FlexTreeField} using cursors.\n */\nexport abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexTreeField {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Field {\n\t\treturn FlexTreeEntityKind.Field;\n\t}\n\tpublic readonly key: FieldKey;\n\n\t/**\n\t * If this field ends its lifetime before the Anchor does, this needs to be invoked to avoid a double free\n\t * if/when the Anchor is destroyed.\n\t */\n\tprivate readonly offAfterDestroy?: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: FieldKindIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tfieldAnchor: FieldAnchor,\n\t) {\n\t\tsuper(context, cursor, fieldAnchor);\n\t\tassert(cursor.mode === CursorLocationType.Fields, 0x77b /* must be in fields mode */);\n\t\tthis.key = cursor.getFieldKey();\n\t\t// Fields currently live as long as their parent does.\n\t\t// For root fields, this means forever, but other cases can be cleaned up when their parent anchor is deleted.\n\t\tif (fieldAnchor.parent !== undefined) {\n\t\t\tconst anchorNode =\n\t\t\t\tcontext.checkout.forest.anchors.locate(fieldAnchor.parent) ??\n\t\t\t\tfail(0xb11 /* parent anchor node should always exist since field is under a node */);\n\t\t\tthis.offAfterDestroy = anchorNode.events.on(\"afterDestroy\", () => {\n\t\t\t\tthis[disposeSymbol]();\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\tassert(\n\t\t\tthis.context.schemaPolicy.fieldKinds.get(kind.identifier) === kind,\n\t\t\t0xa26 /* Narrowing must be done to a kind that exists in this context */,\n\t\t);\n\n\t\treturn this.schema === kind.identifier;\n\t}\n\n\tpublic get parent(): FlexTreeNode | undefined {\n\t\tif (this[anchorSymbol].parent === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst cursor = this[cursorSymbol];\n\t\tcursor.exitField();\n\t\tconst output = makeTree(this.context, cursor);\n\t\tcursor.enterField(this.key);\n\t\treturn output;\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToField(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\tthis.offAfterDestroy?.();\n\t\tif (this[anchorSymbol].parent === undefined) return;\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol].parent);\n\t}\n\n\tpublic get length(): number {\n\t\treturn this[cursorSymbol].getFieldLength();\n\t}\n\n\tpublic atIndex(index: number): FlexTreeUnknownUnboxed {\n\t\treturn inCursorNode(this[cursorSymbol], index, (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this[anchorSymbol]),\n\t\t);\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeNode | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn inCursorNode(this[cursorSymbol], finalIndex, (cursor) =>\n\t\t\tmakeTree(this.context, cursor),\n\t\t);\n\t}\n\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeNode> {\n\t\treturn iterateCursorField(this[cursorSymbol], (cursor) => makeTree(this.context, cursor));\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {\n\t\treturn iterateCursorField(this[cursorSymbol], (cursor) =>\n\t\t\tunboxedFlexNode(this.context, cursor, this[anchorSymbol]),\n\t\t);\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\treturn this[cursorSymbol].getFieldPath();\n\t}\n\n\t/**\n\t * Returns the path to this field to use for editing. Throws iff this path is not {@link TreeStatus#InDocument}.\n\t * This path is not valid to hold onto across edits: this must be recalled for each edit.\n\t */\n\tpublic getFieldPathForEditing(): FieldUpPath {\n\t\tif (!this[isFreedSymbol]()) {\n\t\t\tif (\n\t\t\t\t// Only allow editing if we are the root document field...\n\t\t\t\t(this.parent === undefined && this[anchorSymbol].fieldKey === rootFieldKey) ||\n\t\t\t\t// ...or are under a node in the document\n\t\t\t\t(this.parent !== undefined &&\n\t\t\t\t\ttreeStatusFromAnchorCache(this.parent.anchorNode) === TreeStatus.InDocument)\n\t\t\t) {\n\t\t\t\treturn this.getFieldPath();\n\t\t\t}\n\t\t}\n\n\t\tthrow new UsageError(\"Editing only allowed on fields with TreeStatus.InDocument status\");\n\t}\n}\n\nexport class LazySequence extends LazyField implements FlexTreeSequenceField {\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst finalIndex = indexForAt(index, this.length);\n\n\t\tif (finalIndex === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.atIndex(finalIndex);\n\t}\n\tpublic get asArray(): readonly FlexTreeUnknownUnboxed[] {\n\t\treturn this.map((x) => x);\n\t}\n\n\tpublic editor: SequenceFieldEditBuilder<ExclusiveMapTree[]> = {\n\t\tinsert: (index, newContent) => {\n\t\t\tthis.sequenceEditor().insert(index, cursorForMapTreeField(newContent));\n\t\t},\n\t\tremove: (index, count) => {\n\t\t\tthis.sequenceEditor().remove(index, count);\n\t\t},\n\t};\n\n\tprivate sequenceEditor(): SequenceFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\treturn this.context.checkout.editor.sequenceField(fieldPath);\n\t}\n}\n\nexport class ReadonlyLazyValueField extends LazyField implements FlexTreeRequiredField {\n\tpublic editor: ValueFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent) => {\n\t\t\tassert(false, 0xa0c /* Unexpected set of readonly field */);\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyValueField extends ReadonlyLazyValueField implements FlexTreeRequiredField {\n\tpublic override editor: ValueFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent) => {\n\t\t\tthis.valueFieldEditor().set(cursorForMapTreeNode(newContent));\n\t\t},\n\t};\n\n\tprivate valueFieldEditor(): ValueFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.context.checkout.editor.valueField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic override get content(): FlexTreeUnknownUnboxed {\n\t\treturn this.atIndex(0);\n\t}\n}\n\nexport class LazyOptionalField extends LazyField implements FlexTreeOptionalField {\n\tpublic editor: OptionalFieldEditBuilder<ExclusiveMapTree> = {\n\t\tset: (newContent, wasEmpty) => {\n\t\t\tthis.optionalEditor().set(\n\t\t\t\tnewContent !== undefined ? cursorForMapTreeNode(newContent) : newContent,\n\t\t\t\twasEmpty,\n\t\t\t);\n\t\t},\n\t};\n\n\tprivate optionalEditor(): OptionalFieldEditBuilder<ITreeCursorSynchronous> {\n\t\tconst fieldPath = this.getFieldPathForEditing();\n\t\tconst fieldEditor = this.context.checkout.editor.optionalField(fieldPath);\n\t\treturn fieldEditor;\n\t}\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\treturn this.length === 0 ? undefined : this.atIndex(0);\n\t}\n}\n\nexport class LazyForbiddenField extends LazyField {}\n\ntype Builder = new (\n\tcontext: Context,\n\t// Correct use of these builders requires the builder of the matching type to be used.\n\tschema: FieldKindIdentifier,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n) => LazyField;\n\nconst builderList: [FieldKindIdentifier, Builder][] = [\n\t[FieldKinds.forbidden.identifier, LazyForbiddenField],\n\t[FieldKinds.optional.identifier, LazyOptionalField],\n\t[FieldKinds.sequence.identifier, LazySequence],\n\t[FieldKinds.required.identifier, LazyValueField],\n\t[FieldKinds.identifier.identifier, LazyValueField],\n];\n\nconst kindToClass: ReadonlyMap<FieldKindIdentifier, Builder> = new Map(builderList);\n\n/**\n * Returns the flex tree node, or the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tfieldAnchor: FieldAnchor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\t// Try accessing cached child node via anchors.\n\t// This avoids O(depth) related costs from makeTree in the cached case.\n\tconst anchor = fieldAnchor.parent;\n\tlet child: AnchorNode | undefined;\n\tif (anchor !== undefined) {\n\t\tconst anchorNode = context.checkout.forest.anchors.locate(anchor);\n\t\tassert(anchorNode !== undefined, 0xa4c /* missing anchor */);\n\t\tchild = anchorNode.childIfAnchored(fieldAnchor.fieldKey, cursor.fieldIndex);\n\t} else {\n\t\tchild = context.checkout.forest.anchors.find({\n\t\t\tparent: undefined,\n\t\t\tparentField: fieldAnchor.fieldKey,\n\t\t\tparentIndex: cursor.fieldIndex,\n\t\t});\n\t}\n\n\tif (child !== undefined) {\n\t\tconst cached = child.slots.get(flexTreeSlot);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\t}\n\n\treturn makeTree(context, cursor);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAE3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAE7B,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,cAAc,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,UAAU,EAGV,kBAAkB,EAClB,2BAA2B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B,oBAAoB;cAIJ,CAAC,kBAAkB,CAAC,IAAI,IAAI;IAS/C,IAAW,KAAK,IAAI,KAAK,CAExB;IAEM,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS;IAU1D,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa;IAOtC,aAAa,IAAI,gBAAgB,CAAC,aAAa,CAAC;IAUvD,IAAW,WAAW,IAAI;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CA8CnF;IAEM,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAAC;CAGzC"}
|
|
@@ -30,7 +30,7 @@ const lazyField_js_1 = require("./lazyField.js");
|
|
|
30
30
|
function makeTree(context, cursor) {
|
|
31
31
|
const anchor = cursor.buildAnchor();
|
|
32
32
|
const anchorNode = context.checkout.forest.anchors.locate(anchor) ??
|
|
33
|
-
(0, index_js_2.fail)(
|
|
33
|
+
(0, index_js_2.fail)(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);
|
|
34
34
|
const cached = anchorNode.slots.get(flexTreeTypes_js_1.flexTreeSlot);
|
|
35
35
|
if (cached !== undefined) {
|
|
36
36
|
context.checkout.forest.anchors.forget(anchor);
|
|
@@ -42,7 +42,7 @@ function makeTree(context, cursor) {
|
|
|
42
42
|
}
|
|
43
43
|
exports.makeTree = makeTree;
|
|
44
44
|
function cleanupTree(anchor) {
|
|
45
|
-
const cached = anchor.slots.get(flexTreeTypes_js_1.flexTreeSlot) ?? (0, index_js_2.fail)(
|
|
45
|
+
const cached = anchor.slots.get(flexTreeTypes_js_1.flexTreeSlot) ?? (0, index_js_2.fail)(0xb13 /* tree should only be cleaned up once */);
|
|
46
46
|
(0, internal_1.assert)(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
|
|
47
47
|
cached[index_js_2.disposeSymbol]();
|
|
48
48
|
}
|
|
@@ -59,7 +59,8 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
59
59
|
this.anchorNode = anchorNode;
|
|
60
60
|
// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.
|
|
61
61
|
_LazyTreeNode_removeDeleteCallback.set(this, void 0);
|
|
62
|
-
this.storedSchema =
|
|
62
|
+
this.storedSchema =
|
|
63
|
+
context.schema.nodeSchema.get(this.schema) ?? (0, index_js_2.fail)(0xb14 /* missing schema */);
|
|
63
64
|
(0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0x783 /* must be in nodes mode */);
|
|
64
65
|
anchorNode.slots.set(flexTreeTypes_js_1.flexTreeSlot, this);
|
|
65
66
|
__classPrivateFieldSet(this, _LazyTreeNode_removeDeleteCallback, anchorNode.events.on("afterDestroy", cleanupTree), "f");
|
|
@@ -136,7 +137,7 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
136
137
|
const parentType = cursor.type;
|
|
137
138
|
cursor.enterField(key);
|
|
138
139
|
const nodeSchema = this.context.schema.nodeSchema.get(parentType) ??
|
|
139
|
-
(0, index_js_2.fail)(
|
|
140
|
+
(0, index_js_2.fail)(0xb15 /* requested schema that does not exist */);
|
|
140
141
|
fieldSchema = nodeSchema.getFieldSchema(key).kind;
|
|
141
142
|
}
|
|
142
143
|
const proxifiedField = (0, lazyField_js_1.makeField)(this.context, fieldSchema, cursor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA6D;AAE7D,kDAe6B;AAC7B,kDAA0D;AAC1D,yDAAwD;AAGxD,yDAM4B;AAC5B,mDAMyB;AACzB,iDAA2C;AAE3C;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC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AAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,IAAA,0BAAe,EAAC,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IACvF,CAAC;CACD;AA7HD,oCA6HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype FieldKindIdentifier,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(\"cursor should point to a node that is not the root of the AnchorSet\");\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached;\n\t}\n\treturn new LazyTreeNode(context, cursor.type, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tprivate readonly storedSchema: TreeNodeStoredSchema;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: TreeNodeSchemaIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, cursor, anchor);\n\t\tthis.storedSchema = context.schema.nodeSchema.get(this.schema) ?? fail(\"missing schema\");\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.events.on(\"afterDestroy\", cleanupTree);\n\t}\n\n\tpublic borrowCursor(): ITreeCursorSynchronous {\n\t\treturn this[cursorSymbol] as ITreeCursorSynchronous;\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.storedSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.storedSchema.getFieldSchema(key);\n\t\treturn inCursorField(this[cursorSymbol], key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(\n\t\t\t\tthis.context,\n\t\t\t\tthis.storedSchema.getFieldSchema(cursor.getFieldKey()).kind,\n\t\t\t\tcursor,\n\t\t\t),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FieldKindIdentifier;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema.kind;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FieldKinds.sequence.identifier;\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key).kind;\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA6D;AAE7D,kDAe6B;AAC7B,kDAA0D;AAC1D,yDAAwD;AAGxD,yDAM4B;AAC5B,mDAMyB;AACzB,iDAA2C;AAE3C;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,UAAU,GACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;IAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAA,iBAAM,EAAC,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACpE,IAAA,iBAAM,EAAC,MAAM,YAAY,YAAY,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC1E,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC3E,CAAC;AAbD,4BAaC;AAED,SAAS,WAAW,CAAC,MAAkB;IACtC,MAAM,MAAM,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CAAC,QAAQ,CAAC,UAAU,CAAC;YAC9C,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;YAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACxD,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,IAAA,0BAAe,EAAC,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IACvF,CAAC;CACD;AA9HD,oCA8HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype FieldKindIdentifier,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached;\n\t}\n\treturn new LazyTreeNode(context, cursor.type, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached =\n\t\tanchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tprivate readonly storedSchema: TreeNodeStoredSchema;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tpublic readonly schema: TreeNodeSchemaIdentifier,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, cursor, anchor);\n\t\tthis.storedSchema =\n\t\t\tcontext.schema.nodeSchema.get(this.schema) ?? fail(0xb14 /* missing schema */);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.events.on(\"afterDestroy\", cleanupTree);\n\t}\n\n\tpublic borrowCursor(): ITreeCursorSynchronous {\n\t\treturn this[cursorSymbol] as ITreeCursorSynchronous;\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.storedSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.storedSchema.getFieldSchema(key);\n\t\treturn inCursorField(this[cursorSymbol], key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema.kind, cursor);\n\t\t});\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(\n\t\t\t\tthis.context,\n\t\t\t\tthis.storedSchema.getFieldSchema(cursor.getFieldKey()).kind,\n\t\t\t\tcursor,\n\t\t\t),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FieldKindIdentifier;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema.kind;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FieldKinds.sequence.identifier;\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(0xb15 /* requested schema that does not exist */);\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key).kind;\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchorTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/indexing/anchorTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAEN,KAAK,UAAU,EAEf,KAAK,wBAAwB,EAG7B,KAAK,uBAAuB,EAE5B,KAAK,mBAAmB,EASxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,YAAY,IAAI,CAAC,IAAI,EAAE,uBAAuB,KAAK,IAAI,C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