@fluidframework/tree 2.41.0-338186 → 2.41.0-338401
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/api-report/tree.alpha.api.md +164 -4
- package/dist/alpha.d.ts +2 -0
- package/dist/codec/codec.d.ts +42 -7
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +50 -8
- package/dist/codec/codec.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +2 -2
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/chunk.d.ts.map +1 -1
- package/dist/core/tree/chunk.js.map +1 -1
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +2 -2
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +2 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +4 -4
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +35 -26
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +3 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/initializeForest.d.ts.map +1 -1
- package/dist/feature-libraries/initializeForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +1 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
- package/dist/feature-libraries/valueUtilities.js +6 -6
- package/dist/feature-libraries/valueUtilities.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js.map +1 -1
- 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.map +1 -1
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +8 -0
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +14 -7
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts.map +1 -1
- package/dist/sharedTreeAttributes.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +8 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +3 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/arrayNode.js +1 -1
- package/dist/simple-tree/arrayNode.js.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/treeNodeKernel.d.ts +5 -17
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +17 -48
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/{proxies.d.ts → getTreeNodeForField.d.ts} +1 -1
- package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -0
- package/dist/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
- package/dist/simple-tree/getTreeNodeForField.js.map +1 -0
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.js +4 -4
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.js +3 -3
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +18 -6
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +51 -22
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +3 -8
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -22
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/tableSchema.d.ts +109 -62
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +83 -36
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +2 -2
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +2 -0
- package/lib/codec/codec.d.ts +42 -7
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +50 -8
- package/lib/codec/codec.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -2
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/chunk.d.ts.map +1 -1
- package/lib/core/tree/chunk.js.map +1 -1
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +2 -2
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -0
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +33 -25
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/initializeForest.d.ts.map +1 -1
- package/lib/feature-libraries/initializeForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
- package/lib/feature-libraries/valueUtilities.js +1 -1
- package/lib/feature-libraries/valueUtilities.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js.map +1 -1
- 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.map +1 -1
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +8 -0
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +16 -9
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts.map +1 -1
- package/lib/sharedTreeAttributes.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +2 -2
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +8 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.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.js +2 -2
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -17
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +16 -47
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/{proxies.d.ts → getTreeNodeForField.d.ts} +1 -1
- package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -0
- package/lib/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
- package/lib/simple-tree/getTreeNodeForField.js.map +1 -0
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/mapNode.js +1 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.js +1 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +18 -6
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +51 -22
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +3 -8
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +3 -21
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/tableSchema.d.ts +109 -62
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +83 -36
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -2
- package/lib/treeFactory.js.map +1 -1
- package/package.json +20 -20
- package/src/codec/codec.ts +54 -8
- package/src/core/change-family/editBuilder.ts +1 -0
- package/src/core/forest/forest.ts +1 -1
- package/src/core/schema-stored/schema.ts +2 -0
- package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
- package/src/core/tree/anchorSet.ts +4 -4
- package/src/core/tree/chunk.ts +2 -1
- package/src/core/tree/delta.ts +1 -0
- package/src/core/tree/deltaUtil.ts +1 -1
- package/src/core/tree/detachedFieldIndex.ts +1 -1
- package/src/core/tree/detachedFieldIndexCodec.ts +2 -2
- package/src/core/tree/pathTree.ts +1 -1
- package/src/core/tree/treeTextFormat.ts +1 -0
- package/src/core/tree/visitDelta.ts +1 -1
- package/src/core/tree/visitorUtils.ts +3 -2
- 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/chunkDecoding.ts +5 -5
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +15 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -0
- package/src/feature-libraries/chunked-forest/index.ts +1 -0
- package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -3
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
- package/src/feature-libraries/default-schema/index.ts +6 -1
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +1 -0
- package/src/feature-libraries/default-schema/schemaChecker.ts +37 -26
- package/src/feature-libraries/index.ts +2 -0
- package/src/feature-libraries/initializeForest.ts +1 -1
- package/src/feature-libraries/treeCursorUtils.ts +1 -1
- package/src/feature-libraries/valueUtilities.ts +1 -1
- package/src/jsonDomainSchema.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +1 -0
- package/src/shared-tree/treeAlpha.ts +29 -8
- package/src/sharedTreeAttributes.ts +1 -0
- package/src/simple-tree/api/create.ts +2 -1
- package/src/simple-tree/api/index.ts +7 -1
- package/src/simple-tree/api/treeNodeApi.ts +2 -2
- package/src/simple-tree/arrayNode.ts +2 -2
- package/src/simple-tree/core/getOrCreateNode.ts +2 -2
- package/src/simple-tree/core/treeNodeKernel.ts +22 -53
- package/src/simple-tree/index.ts +3 -1
- package/src/simple-tree/mapNode.ts +1 -1
- package/src/simple-tree/objectNode.ts +1 -1
- package/src/simple-tree/prepareForInsertion.ts +67 -27
- package/src/simple-tree/toMapTree.ts +2 -26
- package/src/tableSchema.ts +109 -62
- package/src/treeFactory.ts +2 -4
- package/dist/simple-tree/proxies.d.ts.map +0 -1
- package/dist/simple-tree/proxies.js.map +0 -1
- package/lib/simple-tree/proxies.d.ts.map +0 -1
- package/lib/simple-tree/proxies.js.map +0 -1
- /package/src/simple-tree/{proxies.ts → getTreeNodeForField.ts} +0 -0
package/src/packageVersion.ts
CHANGED
|
@@ -36,6 +36,9 @@ import {
|
|
|
36
36
|
extractPersistedSchema,
|
|
37
37
|
type TreeBranch,
|
|
38
38
|
TreeViewConfigurationAlpha,
|
|
39
|
+
getStoredKey,
|
|
40
|
+
getPropertyKeyFromStoredKey,
|
|
41
|
+
treeNodeApi,
|
|
39
42
|
mapTreeFromNodeData,
|
|
40
43
|
} from "../simple-tree/index.js";
|
|
41
44
|
import type { JsonCompatible } from "../util/index.js";
|
|
@@ -50,6 +53,7 @@ import {
|
|
|
50
53
|
TreeCompressionStrategy,
|
|
51
54
|
type FieldBatch,
|
|
52
55
|
type FieldBatchEncodingContext,
|
|
56
|
+
fluidVersionToFieldBatchCodecWriteVersion,
|
|
53
57
|
} from "../feature-libraries/index.js";
|
|
54
58
|
import { independentInitializedView, type ViewContent } from "./independentView.js";
|
|
55
59
|
import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
|
|
@@ -207,6 +211,15 @@ export interface TreeAlpha {
|
|
|
207
211
|
compressedData: JsonCompatible<IFluidHandle>,
|
|
208
212
|
options: { idCompressor?: IIdCompressor } & ICodecOptions,
|
|
209
213
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The key of the given node under its parent.
|
|
217
|
+
* @remarks
|
|
218
|
+
* If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).
|
|
219
|
+
* If `node` is the root node, this returns undefined.
|
|
220
|
+
* Otherwise, this returns the key of the field that it is under (a `string`).
|
|
221
|
+
*/
|
|
222
|
+
key2(node: TreeNode): string | number | undefined;
|
|
210
223
|
}
|
|
211
224
|
|
|
212
225
|
/**
|
|
@@ -307,7 +320,7 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
307
320
|
},
|
|
308
321
|
): JsonCompatible<IFluidHandle> {
|
|
309
322
|
const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
|
|
310
|
-
const format =
|
|
323
|
+
const format = fluidVersionToFieldBatchCodecWriteVersion(options.oldestCompatibleClient);
|
|
311
324
|
const codec = makeFieldBatchCodec({ jsonValidator: noopValidator }, format);
|
|
312
325
|
const cursor = borrowFieldCursorFromTreeNodeOrValue(node);
|
|
313
326
|
const batch: FieldBatch = [cursor];
|
|
@@ -339,6 +352,21 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
339
352
|
const view = independentInitializedView(config, options, content);
|
|
340
353
|
return TreeBeta.clone<TSchema>(view.root);
|
|
341
354
|
},
|
|
355
|
+
|
|
356
|
+
key2(node: TreeNode): string | number | undefined {
|
|
357
|
+
// If the parent is undefined, then this node is under the root field,
|
|
358
|
+
const parent = treeNodeApi.parent(node);
|
|
359
|
+
if (parent === undefined) {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// The flex-domain strictly operates in terms of "stored keys".
|
|
364
|
+
// To find the associated developer-facing "property key", we need to look up the field associated with
|
|
365
|
+
// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.
|
|
366
|
+
const storedKey = getStoredKey(node);
|
|
367
|
+
const parentSchema = treeNodeApi.schema(parent);
|
|
368
|
+
return getPropertyKeyFromStoredKey(parentSchema, storedKey);
|
|
369
|
+
},
|
|
342
370
|
};
|
|
343
371
|
|
|
344
372
|
function exportConcise(
|
|
@@ -390,10 +418,3 @@ function borrowFieldCursorFromTreeNodeOrValue(
|
|
|
390
418
|
const mapTree = mapTreeFromCursor(cursor);
|
|
391
419
|
return cursorForMapTreeField([mapTree]);
|
|
392
420
|
}
|
|
393
|
-
|
|
394
|
-
const versionToFormat = {
|
|
395
|
-
v2_0: 1,
|
|
396
|
-
v2_1: 1,
|
|
397
|
-
v2_2: 1,
|
|
398
|
-
v2_3: 1,
|
|
399
|
-
};
|
|
@@ -28,11 +28,12 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
cursorForMapTreeNode,
|
|
30
30
|
defaultSchemaPolicy,
|
|
31
|
+
inSchemaOrThrow,
|
|
31
32
|
mapTreeFromCursor,
|
|
32
33
|
type NodeIdentifierManager,
|
|
33
34
|
} from "../../feature-libraries/index.js";
|
|
34
35
|
import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
35
|
-
import {
|
|
36
|
+
import { mapTreeFromNodeData } from "../toMapTree.js";
|
|
36
37
|
import { getUnhydratedContext } from "../createContext.js";
|
|
37
38
|
import { createUnknownOptionalFieldPolicy } from "../objectNode.js";
|
|
38
39
|
|
|
@@ -44,7 +44,13 @@ export {
|
|
|
44
44
|
enumFromStrings,
|
|
45
45
|
singletonSchema,
|
|
46
46
|
} from "./schemaCreationUtilities.js";
|
|
47
|
-
export {
|
|
47
|
+
export {
|
|
48
|
+
treeNodeApi,
|
|
49
|
+
type TreeNodeApi,
|
|
50
|
+
tryGetSchema,
|
|
51
|
+
getStoredKey,
|
|
52
|
+
getPropertyKeyFromStoredKey,
|
|
53
|
+
} from "./treeNodeApi.js";
|
|
48
54
|
export {
|
|
49
55
|
createFromInsertable,
|
|
50
56
|
cursorFromInsertable,
|
|
@@ -288,7 +288,7 @@ export function tryGetSchema(value: unknown): undefined | TreeNodeSchema {
|
|
|
288
288
|
/**
|
|
289
289
|
* Gets the stored key with which the provided node is associated in the parent.
|
|
290
290
|
*/
|
|
291
|
-
function getStoredKey(node: TreeNode): string | number {
|
|
291
|
+
export function getStoredKey(node: TreeNode): string | number {
|
|
292
292
|
// Note: the flex domain strictly works with "stored keys", and knows nothing about the developer-facing
|
|
293
293
|
// "property keys".
|
|
294
294
|
const parentField = getOrCreateInnerNode(node).parentField;
|
|
@@ -309,7 +309,7 @@ function getStoredKey(node: TreeNode): string | number {
|
|
|
309
309
|
/**
|
|
310
310
|
* Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.
|
|
311
311
|
*/
|
|
312
|
-
function getPropertyKeyFromStoredKey(
|
|
312
|
+
export function getPropertyKeyFromStoredKey(
|
|
313
313
|
schema: TreeNodeSchema,
|
|
314
314
|
storedKey: string | number,
|
|
315
315
|
): string | number {
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
type TreeNodeSchemaClass,
|
|
40
40
|
} from "./core/index.js";
|
|
41
41
|
import { type InsertableContent, mapTreeFromNodeData } from "./toMapTree.js";
|
|
42
|
-
import {
|
|
42
|
+
import { prepareArrayContentForInsertion } from "./prepareForInsertion.js";
|
|
43
43
|
import {
|
|
44
44
|
getKernel,
|
|
45
45
|
UnhydratedFlexTreeNode,
|
|
@@ -862,7 +862,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
862
862
|
const contentArray = content.flatMap((c): InsertableContent[] =>
|
|
863
863
|
c instanceof IterableTreeArrayContent ? Array.from(c) : [c],
|
|
864
864
|
);
|
|
865
|
-
const mapTrees =
|
|
865
|
+
const mapTrees = prepareArrayContentForInsertion(
|
|
866
866
|
contentArray,
|
|
867
867
|
this.simpleSchema,
|
|
868
868
|
sequenceField.context,
|
|
@@ -7,7 +7,7 @@ import type { TreeValue } from "../../core/index.js";
|
|
|
7
7
|
import {
|
|
8
8
|
type InnerNode,
|
|
9
9
|
unhydratedFlexTreeNodeToTreeNode,
|
|
10
|
-
|
|
10
|
+
simpleTreeNodeSlot,
|
|
11
11
|
createTreeNodeFromInner,
|
|
12
12
|
} from "./treeNodeKernel.js";
|
|
13
13
|
import type { TreeNode } from "./treeNode.js";
|
|
@@ -23,7 +23,7 @@ export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | Tr
|
|
|
23
23
|
const cached =
|
|
24
24
|
flexNode instanceof UnhydratedFlexTreeNode
|
|
25
25
|
? unhydratedFlexTreeNodeToTreeNode.get(flexNode)
|
|
26
|
-
: flexNode.anchorNode.slots.get(
|
|
26
|
+
: flexNode.anchorNode.slots.get(simpleTreeNodeSlot);
|
|
27
27
|
|
|
28
28
|
if (cached !== undefined) {
|
|
29
29
|
return cached;
|
|
@@ -175,12 +175,7 @@ export class TreeNodeKernel {
|
|
|
175
175
|
};
|
|
176
176
|
} else {
|
|
177
177
|
// Hydrated case
|
|
178
|
-
|
|
179
|
-
assert(
|
|
180
|
-
!anchorNode.slots.has(proxySlot),
|
|
181
|
-
0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,
|
|
182
|
-
);
|
|
183
|
-
this.#hydrationState = this.createHydratedState(anchorNode);
|
|
178
|
+
this.#hydrationState = this.createHydratedState(innerNode.anchorNode);
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
181
|
|
|
@@ -197,16 +192,22 @@ export class TreeNodeKernel {
|
|
|
197
192
|
|
|
198
193
|
/**
|
|
199
194
|
* Transition from {@link Unhydrated} to hydrated.
|
|
200
|
-
* Bi-directionally associates the given hydrated TreeNode to the
|
|
195
|
+
* Bi-directionally associates the given hydrated TreeNode to the anchor node at the provided path.
|
|
201
196
|
* @remarks
|
|
202
197
|
* Happens at most once for any given node.
|
|
203
|
-
* Cleans up mappings to {@link UnhydratedFlexTreeNode} - it is assumed that they are no longer needed once
|
|
198
|
+
* Cleans up mappings to {@link UnhydratedFlexTreeNode} - it is assumed that they are no longer needed once this node has an anchor node.
|
|
204
199
|
*/
|
|
205
|
-
|
|
200
|
+
public hydrate(anchors: AnchorSet, path: UpPath): void {
|
|
206
201
|
assert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);
|
|
207
202
|
assert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);
|
|
208
203
|
unhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);
|
|
204
|
+
|
|
205
|
+
const anchor = anchors.track(path);
|
|
206
|
+
const anchorNode =
|
|
207
|
+
anchors.locate(anchor) ?? fail(0xb42 /* Expected anchor node to be present */);
|
|
208
|
+
|
|
209
209
|
this.#hydrationState = this.createHydratedState(anchorNode);
|
|
210
|
+
this.#hydrationState.offAnchorNode.add(() => anchors.forget(anchor));
|
|
210
211
|
|
|
211
212
|
// If needed, register forwarding emitters for events from before hydration
|
|
212
213
|
if (this.#unhydratedEvents.evaluated) {
|
|
@@ -224,7 +225,11 @@ export class TreeNodeKernel {
|
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
private createHydratedState(anchorNode: AnchorNode): HydratedState {
|
|
227
|
-
|
|
228
|
+
assert(
|
|
229
|
+
!anchorNode.slots.has(simpleTreeNodeSlot),
|
|
230
|
+
0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,
|
|
231
|
+
);
|
|
232
|
+
anchorNode.slots.set(simpleTreeNodeSlot, this.node);
|
|
228
233
|
return {
|
|
229
234
|
anchorNode,
|
|
230
235
|
offAnchorNode: new Set([
|
|
@@ -265,6 +270,7 @@ export class TreeNodeKernel {
|
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
public dispose(): void {
|
|
273
|
+
debugAssert(() => !this.disposed || "Cannot dispose a disposed node");
|
|
268
274
|
this.disposed = true;
|
|
269
275
|
if (isHydrated(this.#hydrationState)) {
|
|
270
276
|
for (const off of this.#hydrationState.offAnchorNode) {
|
|
@@ -305,7 +311,7 @@ export class TreeNodeKernel {
|
|
|
305
311
|
if (this.#hydrationState.innerNode === undefined) {
|
|
306
312
|
// Marinated case -> cooked
|
|
307
313
|
const anchorNode = this.#hydrationState.anchorNode;
|
|
308
|
-
//
|
|
314
|
+
// This TreeNode is bound to an anchor node, but it may or may not have an actual flex node yet
|
|
309
315
|
const flexNode = anchorNode.slots.get(flexTreeSlot);
|
|
310
316
|
if (flexNode !== undefined) {
|
|
311
317
|
// If the flex node already exists, use it...
|
|
@@ -318,8 +324,6 @@ export class TreeNodeKernel {
|
|
|
318
324
|
context.checkout.forest.moveCursorToPath(anchorNode, cursor);
|
|
319
325
|
this.#hydrationState.innerNode = makeTree(context, cursor);
|
|
320
326
|
cursor.free();
|
|
321
|
-
// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode
|
|
322
|
-
anchorForgetters?.get(this.node)?.();
|
|
323
327
|
if (!allowDeleted) {
|
|
324
328
|
assertFlexTreeEntityNotFreed(this.#hydrationState.innerNode);
|
|
325
329
|
}
|
|
@@ -335,35 +339,6 @@ export class TreeNodeKernel {
|
|
|
335
339
|
return this.#hydrationState.innerNode;
|
|
336
340
|
}
|
|
337
341
|
|
|
338
|
-
/**
|
|
339
|
-
* Creates an anchor node and associates it with the given proxy.
|
|
340
|
-
* @privateRemarks
|
|
341
|
-
* Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.
|
|
342
|
-
* In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.
|
|
343
|
-
*
|
|
344
|
-
* The FlexTreeNode holds a reference to the same anchor, and has a lifetime at least as long as the simple-tree,
|
|
345
|
-
* so this would be unnecessary except for the case of "marinated" nodes, which have an anchor,
|
|
346
|
-
* but might not have a FlexTreeNode.
|
|
347
|
-
* Handling this case is an optimization assuming that this extra anchor reference is cheaper than eagerly creating FlexTreeNodes.
|
|
348
|
-
*/
|
|
349
|
-
public anchorProxy(anchors: AnchorSet, path: UpPath): AnchorNode {
|
|
350
|
-
assert(!anchorForgetters.has(this.node), 0x91c /* Proxy anchor should not be set twice */);
|
|
351
|
-
const anchor = anchors.track(path);
|
|
352
|
-
const anchorNode =
|
|
353
|
-
anchors.locate(anchor) ?? fail(0xb42 /* Expected anchor node to be present */);
|
|
354
|
-
this.hydrate(anchorNode);
|
|
355
|
-
const forget = (): void => {
|
|
356
|
-
if (anchors.locate(anchor)) {
|
|
357
|
-
anchors.forget(anchor);
|
|
358
|
-
}
|
|
359
|
-
anchorForgetters.delete(this.node);
|
|
360
|
-
off();
|
|
361
|
-
};
|
|
362
|
-
anchorForgetters.set(this.node, forget);
|
|
363
|
-
const off = anchorNode.events.on("afterDestroy", forget);
|
|
364
|
-
return anchorNode;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
342
|
/**
|
|
368
343
|
* Retrieves the InnerNode associated with the given target via {@link setInnerNode}, if any.
|
|
369
344
|
* @remarks
|
|
@@ -383,11 +358,6 @@ export class TreeNodeKernel {
|
|
|
383
358
|
}
|
|
384
359
|
}
|
|
385
360
|
|
|
386
|
-
/**
|
|
387
|
-
* Used by {@link anchorProxy} as an optimization to ensure that only one anchor is remembered at a time for a given anchor node
|
|
388
|
-
*/
|
|
389
|
-
const anchorForgetters = new WeakMap<TreeNode, () => void>();
|
|
390
|
-
|
|
391
361
|
const kernelEvents = ["childrenChangedAfterBatch", "subtreeChangedAfterBatch"] as const;
|
|
392
362
|
|
|
393
363
|
type KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;
|
|
@@ -423,22 +393,22 @@ export const unhydratedFlexTreeNodeToTreeNode =
|
|
|
423
393
|
>;
|
|
424
394
|
|
|
425
395
|
/**
|
|
426
|
-
* An anchor slot which associates an anchor with its corresponding TreeNode, if there is one.
|
|
396
|
+
* An anchor slot which associates an anchor with its corresponding {@link TreeNode}, if there is one.
|
|
427
397
|
* @remarks
|
|
428
398
|
* For this to work, we have to require that there is at most a single view using a given AnchorSet.
|
|
429
399
|
* FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.
|
|
430
400
|
*/
|
|
431
|
-
export const
|
|
401
|
+
export const simpleTreeNodeSlot = anchorSlot<TreeNode>();
|
|
432
402
|
|
|
433
403
|
/**
|
|
434
404
|
* Dispose a TreeNode (if any) for an existing anchor without disposing the anchor.
|
|
435
405
|
*/
|
|
436
406
|
export function tryDisposeTreeNode(anchorNode: AnchorNode): void {
|
|
437
|
-
const treeNode = anchorNode.slots.get(
|
|
407
|
+
const treeNode = anchorNode.slots.get(simpleTreeNodeSlot);
|
|
438
408
|
if (treeNode !== undefined) {
|
|
439
409
|
const kernel = getKernel(treeNode);
|
|
440
410
|
kernel.dispose();
|
|
441
|
-
anchorNode.slots.delete(
|
|
411
|
+
anchorNode.slots.delete(simpleTreeNodeSlot);
|
|
442
412
|
}
|
|
443
413
|
}
|
|
444
414
|
|
|
@@ -483,7 +453,6 @@ export function getOrCreateInnerNode(treeNode: TreeNode, allowDeleted = false):
|
|
|
483
453
|
* Gets a flex node from an anchor node
|
|
484
454
|
*/
|
|
485
455
|
function flexNodeFromAnchor(anchorNode: AnchorNode): FlexTreeNode {
|
|
486
|
-
// the proxy is bound to an anchor node, but it may or may not have an actual flex node yet
|
|
487
456
|
const flexNode = anchorNode.slots.get(flexTreeSlot);
|
|
488
457
|
if (flexNode !== undefined) {
|
|
489
458
|
return flexNode; // If it does have a flex node, return it...
|
|
@@ -501,7 +470,7 @@ function flexNodeFromAnchor(anchorNode: AnchorNode): FlexTreeNode {
|
|
|
501
470
|
* Gets a tree node from an anchor node
|
|
502
471
|
*/
|
|
503
472
|
export function treeNodeFromAnchor(anchorNode: AnchorNode): TreeNode | TreeValue {
|
|
504
|
-
const cached = anchorNode.slots.get(
|
|
473
|
+
const cached = anchorNode.slots.get(simpleTreeNodeSlot);
|
|
505
474
|
if (cached !== undefined) {
|
|
506
475
|
return cached;
|
|
507
476
|
}
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -88,6 +88,8 @@ export {
|
|
|
88
88
|
type TreeBranch,
|
|
89
89
|
type TreeBranchEvents,
|
|
90
90
|
tryGetSchema,
|
|
91
|
+
getStoredKey,
|
|
92
|
+
getPropertyKeyFromStoredKey,
|
|
91
93
|
applySchemaToParserOptions,
|
|
92
94
|
cursorFromVerbose,
|
|
93
95
|
verboseFromCursor,
|
|
@@ -184,7 +186,7 @@ export {
|
|
|
184
186
|
type NodeSchemaMetadata,
|
|
185
187
|
evaluateLazySchema,
|
|
186
188
|
} from "./schemaTypes.js";
|
|
187
|
-
export { getTreeNodeForField } from "./
|
|
189
|
+
export { getTreeNodeForField } from "./getTreeNodeForField.js";
|
|
188
190
|
export {
|
|
189
191
|
TreeArrayNode,
|
|
190
192
|
IterableTreeArrayContent,
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
FlexTreeOptionalField,
|
|
10
10
|
OptionalFieldEditBuilder,
|
|
11
11
|
} from "../feature-libraries/index.js";
|
|
12
|
-
import { getTreeNodeForField } from "./
|
|
12
|
+
import { getTreeNodeForField } from "./getTreeNodeForField.js";
|
|
13
13
|
import {
|
|
14
14
|
createFieldSchema,
|
|
15
15
|
FieldKind,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type FlexTreeOptionalField,
|
|
15
15
|
type FlexTreeRequiredField,
|
|
16
16
|
} from "../feature-libraries/index.js";
|
|
17
|
-
import { getTreeNodeForField } from "./
|
|
17
|
+
import { getTreeNodeForField } from "./getTreeNodeForField.js";
|
|
18
18
|
import {
|
|
19
19
|
type ImplicitFieldSchema,
|
|
20
20
|
getStoredKey,
|
|
@@ -12,13 +12,19 @@ import type {
|
|
|
12
12
|
NodeIndex,
|
|
13
13
|
FieldKey,
|
|
14
14
|
DetachedField,
|
|
15
|
+
TreeFieldStoredSchema,
|
|
15
16
|
} from "../core/index.js";
|
|
16
17
|
import {
|
|
17
18
|
type FlexTreeContext,
|
|
18
19
|
getSchemaAndPolicy,
|
|
19
20
|
type FlexTreeHydratedContext,
|
|
21
|
+
FieldKinds,
|
|
20
22
|
} from "../feature-libraries/index.js";
|
|
21
|
-
import
|
|
23
|
+
import {
|
|
24
|
+
normalizeFieldSchema,
|
|
25
|
+
type ImplicitAllowedTypes,
|
|
26
|
+
type ImplicitFieldSchema,
|
|
27
|
+
} from "./schemaTypes.js";
|
|
22
28
|
import { type InsertableContent, mapTreeFromNodeData } from "./toMapTree.js";
|
|
23
29
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
24
30
|
import { brand } from "../util/index.js";
|
|
@@ -28,12 +34,17 @@ import {
|
|
|
28
34
|
tryUnhydratedFlexTreeNode,
|
|
29
35
|
unhydratedFlexTreeNodeToTreeNode,
|
|
30
36
|
} from "./core/index.js";
|
|
31
|
-
import { debugAssert } from "@fluidframework/core-utils/internal";
|
|
37
|
+
import { debugAssert, oob } from "@fluidframework/core-utils/internal";
|
|
38
|
+
import { inSchemaOrThrow, isFieldInSchema } from "../feature-libraries/index.js";
|
|
39
|
+
import { convertField } from "./toStoredSchema.js";
|
|
32
40
|
|
|
33
41
|
/**
|
|
34
42
|
* Prepare content from a user for insertion into a tree.
|
|
35
43
|
* @remarks
|
|
36
44
|
* This validates and converts the input, and if necessary invokes {@link prepareContentForHydration}.
|
|
45
|
+
*
|
|
46
|
+
* The next edit made to `destinationContext`'s forest must be the creation of a detached field containing this content,
|
|
47
|
+
* (Triggering {@link ForestEvents.afterRootFieldCreated}) otherwise hydration will break.
|
|
37
48
|
*/
|
|
38
49
|
export function prepareForInsertion<TIn extends InsertableContent | undefined>(
|
|
39
50
|
data: TIn,
|
|
@@ -50,13 +61,18 @@ export function prepareForInsertion<TIn extends InsertableContent | undefined>(
|
|
|
50
61
|
|
|
51
62
|
/**
|
|
52
63
|
* {@link prepareForInsertion} but batched for array content.
|
|
64
|
+
* @remarks
|
|
65
|
+
* This is for inserting items into an array, not a inserting a {@link TreeArrayNode} (that would use {@link prepareForInsertion}).
|
|
66
|
+
*
|
|
67
|
+
* The next edits made to `destinationContext`'s forest must be the creation of a detached field.
|
|
68
|
+
* One edit for each item in `data`, in order.
|
|
69
|
+
*
|
|
53
70
|
* @privateRemarks
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* If fixed, this function should be removed, and arrays can just map over prepareForInsertion.
|
|
71
|
+
* This has to be done as a single operation for all items in data
|
|
72
|
+
* (as opposed to mapping {@link prepareForInsertion} over the array)
|
|
73
|
+
* due to how the eventing in prepareContentForHydration works.
|
|
58
74
|
*/
|
|
59
|
-
export function
|
|
75
|
+
export function prepareArrayContentForInsertion(
|
|
60
76
|
data: readonly InsertableContent[],
|
|
61
77
|
schema: ImplicitAllowedTypes,
|
|
62
78
|
destinationContext: FlexTreeContext,
|
|
@@ -66,19 +82,27 @@ export function prepareArrayForInsertion(
|
|
|
66
82
|
item,
|
|
67
83
|
schema,
|
|
68
84
|
destinationContext.isHydrated() ? destinationContext.nodeKeyManager : undefined,
|
|
69
|
-
getSchemaAndPolicy(destinationContext),
|
|
70
85
|
),
|
|
71
86
|
);
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
const fieldSchema = convertField(normalizeFieldSchema(schema));
|
|
89
|
+
|
|
90
|
+
validateAndPrepare(
|
|
91
|
+
getSchemaAndPolicy(destinationContext),
|
|
92
|
+
destinationContext.isHydrated() ? destinationContext : undefined,
|
|
93
|
+
{ kind: FieldKinds.sequence.identifier, types: fieldSchema.types },
|
|
94
|
+
mapTrees,
|
|
95
|
+
);
|
|
76
96
|
|
|
77
97
|
return mapTrees;
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
/**
|
|
81
101
|
* Split out from {@link prepareForInsertion} as to allow use without a context.
|
|
102
|
+
*
|
|
103
|
+
* @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.
|
|
104
|
+
* `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.
|
|
105
|
+
*
|
|
82
106
|
* @remarks
|
|
83
107
|
* Adding this entry point is a workaround for initialize not currently having a context.
|
|
84
108
|
*/
|
|
@@ -88,20 +112,36 @@ export function prepareForInsertionContextless<TIn extends InsertableContent | u
|
|
|
88
112
|
schemaAndPolicy: SchemaAndPolicy,
|
|
89
113
|
hydratedData: Pick<FlexTreeHydratedContext, "checkout" | "nodeKeyManager"> | undefined,
|
|
90
114
|
): TIn extends undefined ? undefined : ExclusiveMapTree {
|
|
91
|
-
const mapTree = mapTreeFromNodeData(
|
|
92
|
-
data,
|
|
93
|
-
schema,
|
|
94
|
-
hydratedData?.nodeKeyManager,
|
|
95
|
-
schemaAndPolicy,
|
|
96
|
-
);
|
|
115
|
+
const mapTree = mapTreeFromNodeData(data, schema, hydratedData?.nodeKeyManager);
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
117
|
+
const contentArray = mapTree === undefined ? [] : [mapTree];
|
|
118
|
+
const fieldSchema = convertField(normalizeFieldSchema(schema));
|
|
119
|
+
validateAndPrepare(schemaAndPolicy, hydratedData, fieldSchema, contentArray);
|
|
101
120
|
|
|
102
121
|
return mapTree as TIn extends undefined ? undefined : ExclusiveMapTree;
|
|
103
122
|
}
|
|
104
123
|
|
|
124
|
+
/**
|
|
125
|
+
* If hydrating, do a final validation against the schema and prepare the content for hydration.
|
|
126
|
+
*
|
|
127
|
+
* @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.
|
|
128
|
+
* `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.
|
|
129
|
+
*/
|
|
130
|
+
function validateAndPrepare(
|
|
131
|
+
schemaAndPolicy: SchemaAndPolicy,
|
|
132
|
+
hydratedData: Pick<FlexTreeHydratedContext, "checkout" | "nodeKeyManager"> | undefined,
|
|
133
|
+
fieldSchema: TreeFieldStoredSchema,
|
|
134
|
+
mapTrees: ExclusiveMapTree[],
|
|
135
|
+
): void {
|
|
136
|
+
if (hydratedData !== undefined) {
|
|
137
|
+
if (schemaAndPolicy.policy.validateSchema === true) {
|
|
138
|
+
const maybeError = isFieldInSchema(mapTrees, fieldSchema, schemaAndPolicy);
|
|
139
|
+
inSchemaOrThrow(maybeError);
|
|
140
|
+
}
|
|
141
|
+
prepareContentForHydration(mapTrees, hydratedData.checkout.forest);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
105
145
|
/**
|
|
106
146
|
* An {@link UpPath} that is just index zero in a {@link DetachedField} which can be modified at a later time.
|
|
107
147
|
*/
|
|
@@ -164,7 +204,7 @@ function prepareContentForHydration(
|
|
|
164
204
|
});
|
|
165
205
|
}
|
|
166
206
|
|
|
167
|
-
|
|
207
|
+
scheduleHydration(batches, forest);
|
|
168
208
|
}
|
|
169
209
|
|
|
170
210
|
function walkMapTree(
|
|
@@ -206,12 +246,13 @@ function walkMapTree(
|
|
|
206
246
|
}
|
|
207
247
|
|
|
208
248
|
/**
|
|
209
|
-
* Register
|
|
249
|
+
* Register events which will hydrate batches of nodes when they are inserted.
|
|
250
|
+
* The next edits to forest must be their insertions, in order, or data corruption can occur.
|
|
210
251
|
* @param locatedNodes - the nodes to register with the forest.
|
|
211
252
|
* Each index in this array expects its content to be added and produce its own `afterRootFieldCreated` event.
|
|
212
253
|
* If array subsequence insertion is optimized to produce a single event, this will not work correctly as is, and will need to be modified to take in a single {@link LocatedNodesBatch}.
|
|
213
254
|
*/
|
|
214
|
-
function
|
|
255
|
+
function scheduleHydration(
|
|
215
256
|
locatedNodes: readonly LocatedNodesBatch[],
|
|
216
257
|
forest: IForestSubscription,
|
|
217
258
|
): void {
|
|
@@ -220,13 +261,12 @@ function bindTreeNodes(
|
|
|
220
261
|
// Creating a new array emits one event per element in the array, so listen to the event once for each element
|
|
221
262
|
let i = 0;
|
|
222
263
|
const off = forest.events.on("afterRootFieldCreated", (fieldKey) => {
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
const batch = locatedNodes[i]!;
|
|
264
|
+
// Indexing is safe here because of the length check above. This assumes the array has not been modified which should be the case.
|
|
265
|
+
const batch = locatedNodes[i] ?? oob();
|
|
226
266
|
debugAssert(() => batch.rootPath.parentField === placeholderKey);
|
|
227
267
|
batch.rootPath.parentField = brand(fieldKey);
|
|
228
268
|
for (const { path, node } of batch.paths) {
|
|
229
|
-
getKernel(node).
|
|
269
|
+
getKernel(node).hydrate(forest.anchors, path);
|
|
230
270
|
}
|
|
231
271
|
if (++i === locatedNodes.length) {
|
|
232
272
|
off();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
type MapTree,
|
|
14
14
|
type TreeValue,
|
|
15
15
|
type ValueSchema,
|
|
16
|
-
type SchemaAndPolicy,
|
|
17
16
|
type ExclusiveMapTree,
|
|
18
17
|
} from "../core/index.js";
|
|
19
18
|
import {
|
|
@@ -47,7 +46,6 @@ import {
|
|
|
47
46
|
type Unhydrated,
|
|
48
47
|
UnhydratedFlexTreeNode,
|
|
49
48
|
} from "./core/index.js";
|
|
50
|
-
import { SchemaValidationErrors, isNodeInSchema } from "../feature-libraries/index.js";
|
|
51
49
|
import { isObjectNodeSchema } from "./objectNodeTypes.js";
|
|
52
50
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
53
51
|
|
|
@@ -105,19 +103,16 @@ export function mapTreeFromNodeData(
|
|
|
105
103
|
data: InsertableContent,
|
|
106
104
|
allowedTypes: ImplicitAllowedTypes,
|
|
107
105
|
context?: NodeIdentifierManager,
|
|
108
|
-
schemaValidationPolicy?: SchemaAndPolicy,
|
|
109
106
|
): ExclusiveMapTree;
|
|
110
107
|
export function mapTreeFromNodeData(
|
|
111
108
|
data: InsertableContent | undefined,
|
|
112
109
|
allowedTypes: ImplicitFieldSchema,
|
|
113
110
|
context?: NodeIdentifierManager,
|
|
114
|
-
schemaValidationPolicy?: SchemaAndPolicy,
|
|
115
111
|
): ExclusiveMapTree | undefined;
|
|
116
112
|
export function mapTreeFromNodeData(
|
|
117
113
|
data: InsertableContent | undefined,
|
|
118
114
|
allowedTypes: ImplicitFieldSchema,
|
|
119
115
|
context?: NodeIdentifierManager,
|
|
120
|
-
schemaValidationPolicy?: SchemaAndPolicy,
|
|
121
116
|
): ExclusiveMapTree | undefined {
|
|
122
117
|
const normalizedFieldSchema = normalizeFieldSchema(allowedTypes);
|
|
123
118
|
|
|
@@ -133,16 +128,6 @@ export function mapTreeFromNodeData(
|
|
|
133
128
|
// Add what defaults can be provided. If no `context` is providing, some defaults may still be missing.
|
|
134
129
|
addDefaultsToMapTree(mapTree, normalizedFieldSchema.allowedTypes, context);
|
|
135
130
|
|
|
136
|
-
if (schemaValidationPolicy?.policy.validateSchema === true) {
|
|
137
|
-
// TODO: BUG: AB#9131
|
|
138
|
-
// Since some defaults may still be missing, this can give false positives when context is undefined but schemaValidationPolicy is provided.
|
|
139
|
-
// For now disable this check when context is undefined:
|
|
140
|
-
if (context !== undefined) {
|
|
141
|
-
const maybeError = isNodeInSchema(mapTree, schemaValidationPolicy);
|
|
142
|
-
inSchemaOrThrow(maybeError);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
131
|
return mapTree;
|
|
147
132
|
}
|
|
148
133
|
|
|
@@ -196,21 +181,12 @@ function nodeDataToMapTree(
|
|
|
196
181
|
result = objectToMapTree(data, schema);
|
|
197
182
|
break;
|
|
198
183
|
default:
|
|
199
|
-
|
|
184
|
+
unreachableCase(schema.kind);
|
|
200
185
|
}
|
|
201
186
|
|
|
202
187
|
return result;
|
|
203
188
|
}
|
|
204
189
|
|
|
205
|
-
/**
|
|
206
|
-
* Throws a UsageError if maybeError indicates a tree is out of schema.
|
|
207
|
-
*/
|
|
208
|
-
export function inSchemaOrThrow(maybeError: SchemaValidationErrors): void {
|
|
209
|
-
if (maybeError !== SchemaValidationErrors.NoError) {
|
|
210
|
-
throw new UsageError("Tree does not conform to schema.");
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
190
|
/**
|
|
215
191
|
* Transforms data under a Leaf schema.
|
|
216
192
|
* @param data - The tree data to be transformed. Must be a {@link TreeValue}.
|