@fluidframework/tree 2.23.0-323641 → 2.23.0-325054
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/.vscode/settings.json +1 -0
- package/CHANGELOG.md +47 -0
- package/api-report/tree.alpha.api.md +169 -10
- package/api-report/tree.beta.api.md +101 -9
- package/api-report/tree.legacy.alpha.api.md +101 -9
- package/api-report/tree.legacy.public.api.md +101 -9
- package/api-report/tree.public.api.md +101 -9
- package/dist/alpha.d.ts +20 -0
- package/dist/beta.d.ts +15 -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 +5 -4
- 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 +5 -5
- 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 +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -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/legacy.d.ts +15 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +15 -0
- 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 +35 -19
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +14 -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.map +1 -1
- package/dist/shared-tree-core/editManager.js +8 -7
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -2
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +2 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/component.d.ts +30 -0
- package/dist/simple-tree/api/component.d.ts.map +1 -0
- package/dist/simple-tree/api/component.js +26 -0
- package/dist/simple-tree/api/component.js.map +1 -0
- package/dist/simple-tree/api/customTree.js +3 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -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/schemaCreationUtilities.js +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +0 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +4 -25
- package/dist/simple-tree/api/schemaFactory.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.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +2 -3
- 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 +7 -18
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +127 -19
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js +17 -0
- package/dist/simple-tree/api/typesUnsafe.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.d.ts +1 -1
- package/dist/simple-tree/arrayNode.d.ts.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/flexList.d.ts +4 -5
- package/dist/simple-tree/flexList.d.ts.map +1 -1
- package/dist/simple-tree/flexList.js +1 -14
- package/dist/simple-tree/flexList.js.map +1 -1
- package/dist/simple-tree/index.d.ts +4 -4
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +25 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +4 -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/schemaTypes.d.ts +211 -9
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +83 -2
- package/dist/simple-tree/schemaTypes.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 +3 -6
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +7 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +18 -7
- 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 +4 -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 +7 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +18 -13
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +20 -0
- package/lib/beta.d.ts +15 -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 +5 -4
- 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 +6 -6
- 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 +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- 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/legacy.d.ts +15 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +15 -0
- 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 +35 -19
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +15 -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.map +1 -1
- package/lib/shared-tree-core/editManager.js +8 -7
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -2
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +2 -2
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/component.d.ts +30 -0
- package/lib/simple-tree/api/component.d.ts.map +1 -0
- package/lib/simple-tree/api/component.js +23 -0
- package/lib/simple-tree/api/component.js.map +1 -0
- package/lib/simple-tree/api/customTree.js +3 -3
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.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/schemaFactory.d.ts +0 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -22
- package/lib/simple-tree/api/schemaFactory.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.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +3 -4
- 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 -20
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +127 -19
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js +15 -1
- package/lib/simple-tree/api/typesUnsafe.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.d.ts +1 -1
- package/lib/simple-tree/arrayNode.d.ts.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/flexList.d.ts +4 -5
- package/lib/simple-tree/flexList.d.ts.map +1 -1
- package/lib/simple-tree/flexList.js +0 -12
- package/lib/simple-tree/flexList.js.map +1 -1
- package/lib/simple-tree/index.d.ts +4 -4
- 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/objectNode.d.ts +25 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +4 -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/schemaTypes.d.ts +211 -9
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +81 -3
- package/lib/simple-tree/schemaTypes.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 +5 -8
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +7 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +18 -7
- 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 +7 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +15 -11
- package/lib/util/utils.js.map +1 -1
- package/package.json +27 -23
- 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 +5 -4
- 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 +7 -6
- 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 +22 -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 +26 -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 +8 -7
- package/src/shared-tree-core/sharedTreeCore.ts +6 -4
- package/src/simple-tree/api/component.ts +42 -0
- package/src/simple-tree/api/customTree.ts +3 -3
- package/src/simple-tree/api/index.ts +7 -0
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
- package/src/simple-tree/api/schemaFactory.ts +1 -28
- 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 +3 -3
- package/src/simple-tree/api/treeNodeApi.ts +10 -18
- package/src/simple-tree/api/typesUnsafe.ts +193 -18
- 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/flexList.ts +4 -14
- package/src/simple-tree/index.ts +25 -1
- package/src/simple-tree/objectNode.ts +50 -5
- package/src/simple-tree/proxies.ts +1 -1
- package/src/simple-tree/schemaTypes.ts +322 -23
- package/src/simple-tree/toMapTree.ts +3 -3
- package/src/simple-tree/toStoredSchema.ts +5 -7
- package/src/simple-tree/treeNodeValid.ts +21 -7
- package/src/util/idAllocator.ts +1 -1
- package/src/util/index.ts +2 -2
- package/src/util/nestedMap.ts +9 -33
- package/src/util/utils.ts +20 -12
|
@@ -52,10 +52,10 @@ export const emptyCursor: ChunkedCursor = {
|
|
|
52
52
|
mode: CursorLocationType.Fields,
|
|
53
53
|
[cursorChunk]: emptyChunk,
|
|
54
54
|
nextField(): boolean {
|
|
55
|
-
fail(
|
|
55
|
+
fail(0xafb /* cannot navigate above root */);
|
|
56
56
|
},
|
|
57
57
|
exitField(): void {
|
|
58
|
-
fail(
|
|
58
|
+
fail(0xafc /* cannot navigate above root */);
|
|
59
59
|
},
|
|
60
60
|
skipPendingFields(): boolean {
|
|
61
61
|
return true;
|
|
@@ -70,43 +70,43 @@ export const emptyCursor: ChunkedCursor = {
|
|
|
70
70
|
return false;
|
|
71
71
|
},
|
|
72
72
|
enterNode(childIndex: number): void {
|
|
73
|
-
fail(
|
|
73
|
+
fail(0xafd /* empty cursor has no nodes */);
|
|
74
74
|
},
|
|
75
75
|
getFieldPath(prefix?: PathRootPrefix): FieldUpPath {
|
|
76
76
|
return prefixFieldPath(prefix, emptyPath);
|
|
77
77
|
},
|
|
78
78
|
getPath(): UpPath | undefined {
|
|
79
|
-
fail(
|
|
79
|
+
fail(0xafe /* empty cursor has no nodes */);
|
|
80
80
|
},
|
|
81
81
|
get fieldIndex(): never {
|
|
82
|
-
return fail(
|
|
82
|
+
return fail(0xaff /* empty cursor has no nodes */);
|
|
83
83
|
},
|
|
84
84
|
get chunkStart(): never {
|
|
85
|
-
return fail(
|
|
85
|
+
return fail(0xb00 /* empty cursor has no nodes */);
|
|
86
86
|
},
|
|
87
87
|
get chunkLength(): never {
|
|
88
|
-
return fail(
|
|
88
|
+
return fail(0xb01 /* empty cursor has no nodes */);
|
|
89
89
|
},
|
|
90
90
|
seekNodes(offset: number): boolean {
|
|
91
|
-
fail(
|
|
91
|
+
fail(0xb02 /* empty cursor has no nodes */);
|
|
92
92
|
},
|
|
93
93
|
nextNode(): boolean {
|
|
94
|
-
fail(
|
|
94
|
+
fail(0xb03 /* empty cursor has no nodes */);
|
|
95
95
|
},
|
|
96
96
|
exitNode(): void {
|
|
97
|
-
fail(
|
|
97
|
+
fail(0xb04 /* empty cursor has no nodes */);
|
|
98
98
|
},
|
|
99
99
|
firstField(): boolean {
|
|
100
|
-
fail(
|
|
100
|
+
fail(0xb05 /* empty cursor has no nodes */);
|
|
101
101
|
},
|
|
102
102
|
enterField(key: FieldKey): void {
|
|
103
|
-
fail(
|
|
103
|
+
fail(0xb06 /* empty cursor has no nodes */);
|
|
104
104
|
},
|
|
105
105
|
get type(): never {
|
|
106
|
-
return fail(
|
|
106
|
+
return fail(0xb07 /* empty cursor has no nodes */);
|
|
107
107
|
},
|
|
108
108
|
get value(): never {
|
|
109
|
-
return fail(
|
|
109
|
+
return fail(0xb08 /* empty cursor has no nodes */);
|
|
110
110
|
},
|
|
111
111
|
atChunkRoot(): boolean {
|
|
112
112
|
return true;
|
|
@@ -382,7 +382,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
public getFieldKey(): FieldKey {
|
|
385
|
-
return this.fieldKey ?? fail(
|
|
385
|
+
return this.fieldKey ?? fail(0xb09 /* not in a field */);
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
public getFieldLength(): number {
|
|
@@ -510,11 +510,13 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
510
510
|
public exitNode(): void {
|
|
511
511
|
const info = this.nodeInfo(CursorLocationType.Nodes);
|
|
512
512
|
this.indexOfField =
|
|
513
|
-
info.indexOfParentField ??
|
|
513
|
+
info.indexOfParentField ??
|
|
514
|
+
fail(0xb0a /* navigation up to root field not yet supported */); // TODO;
|
|
514
515
|
this.fieldKey = info.parentField;
|
|
515
516
|
this.mode = CursorLocationType.Fields;
|
|
516
517
|
this.moveToPosition(
|
|
517
|
-
info.indexOfParentPosition ??
|
|
518
|
+
info.indexOfParentPosition ??
|
|
519
|
+
fail(0xb0b /* navigation up to root field not yet supported */),
|
|
518
520
|
); // TODO
|
|
519
521
|
}
|
|
520
522
|
|
|
@@ -536,7 +538,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
|
|
|
536
538
|
this.indexOfField =
|
|
537
539
|
fieldInfo === undefined
|
|
538
540
|
? fieldMap.size
|
|
539
|
-
: (fieldInfo.indexOfParentField ?? fail(
|
|
541
|
+
: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));
|
|
540
542
|
this.fieldKey = key;
|
|
541
543
|
this.mode = CursorLocationType.Fields;
|
|
542
544
|
}
|
|
@@ -42,7 +42,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
|
|
|
42
42
|
rebase: (change: 0, over: 0) => 0,
|
|
43
43
|
}),
|
|
44
44
|
codecsFactory: () => noChangeCodecFamily,
|
|
45
|
-
editor: { buildChildChanges: () => fail(
|
|
45
|
+
editor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },
|
|
46
46
|
intoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),
|
|
47
47
|
relevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],
|
|
48
48
|
isEmpty: (change: 0) => true,
|
|
@@ -82,12 +82,9 @@ export function makeField(
|
|
|
82
82
|
|
|
83
83
|
const makeFlexTreeField = (): FlexTreeField => {
|
|
84
84
|
usedAnchor = true;
|
|
85
|
-
const field = new (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
cursor,
|
|
89
|
-
fieldAnchor,
|
|
90
|
-
);
|
|
85
|
+
const field = new (
|
|
86
|
+
kindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)
|
|
87
|
+
)(context, schema, cursor, fieldAnchor);
|
|
91
88
|
return field;
|
|
92
89
|
};
|
|
93
90
|
|
|
@@ -97,7 +94,8 @@ export function makeField(
|
|
|
97
94
|
|
|
98
95
|
// For the common case (all but roots), cache field associated with its node's anchor and field key.
|
|
99
96
|
const anchorNode =
|
|
100
|
-
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
97
|
+
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
98
|
+
fail(0xb10 /* missing anchor */);
|
|
101
99
|
|
|
102
100
|
// Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.
|
|
103
101
|
const cacheKey = anchorNode.slots.get(flexTreeSlot);
|
|
@@ -150,7 +148,7 @@ export abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexT
|
|
|
150
148
|
if (fieldAnchor.parent !== undefined) {
|
|
151
149
|
const anchorNode =
|
|
152
150
|
context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
|
|
153
|
-
fail(
|
|
151
|
+
fail(0xb11 /* parent anchor node should always exist since field is under a node */);
|
|
154
152
|
this.offAfterDestroy = anchorNode.events.on("afterDestroy", () => {
|
|
155
153
|
this[disposeSymbol]();
|
|
156
154
|
});
|
|
@@ -48,7 +48,7 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
|
|
|
48
48
|
const anchor = cursor.buildAnchor();
|
|
49
49
|
const anchorNode =
|
|
50
50
|
context.checkout.forest.anchors.locate(anchor) ??
|
|
51
|
-
fail(
|
|
51
|
+
fail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);
|
|
52
52
|
const cached = anchorNode.slots.get(flexTreeSlot);
|
|
53
53
|
if (cached !== undefined) {
|
|
54
54
|
context.checkout.forest.anchors.forget(anchor);
|
|
@@ -60,7 +60,8 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function cleanupTree(anchor: AnchorNode): void {
|
|
63
|
-
const cached =
|
|
63
|
+
const cached =
|
|
64
|
+
anchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);
|
|
64
65
|
assert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
|
|
65
66
|
cached[disposeSymbol]();
|
|
66
67
|
}
|
|
@@ -86,7 +87,8 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
|
|
|
86
87
|
anchor: Anchor,
|
|
87
88
|
) {
|
|
88
89
|
super(context, cursor, anchor);
|
|
89
|
-
this.storedSchema =
|
|
90
|
+
this.storedSchema =
|
|
91
|
+
context.schema.nodeSchema.get(this.schema) ?? fail(0xb14 /* missing schema */);
|
|
90
92
|
assert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);
|
|
91
93
|
anchorNode.slots.set(flexTreeSlot, this);
|
|
92
94
|
this.#removeDeleteCallback = anchorNode.events.on("afterDestroy", cleanupTree);
|
|
@@ -180,7 +182,7 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
|
|
|
180
182
|
cursor.enterField(key);
|
|
181
183
|
const nodeSchema =
|
|
182
184
|
this.context.schema.nodeSchema.get(parentType) ??
|
|
183
|
-
fail(
|
|
185
|
+
fail(0xb15 /* requested schema that does not exist */);
|
|
184
186
|
fieldSchema = nodeSchema.getFieldSchema(key).kind;
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -359,7 +359,8 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
|
|
|
359
359
|
throw new Error("key finder should be pure and functional");
|
|
360
360
|
}
|
|
361
361
|
const anchor = nodeCursor.buildAnchor();
|
|
362
|
-
const anchorNode =
|
|
362
|
+
const anchorNode =
|
|
363
|
+
this.forest.anchors.locate(anchor) ?? fail(0xb16 /* expected anchor node */);
|
|
363
364
|
|
|
364
365
|
// check if this anchor node already exists in the index
|
|
365
366
|
const existingKey = this.nodeToKey.get(anchorNode);
|
|
@@ -104,7 +104,8 @@ export function allowsTreeSuperset(
|
|
|
104
104
|
allowsFieldSuperset(
|
|
105
105
|
policy,
|
|
106
106
|
originalData,
|
|
107
|
-
original.objectNodeFields.get(originalField) ??
|
|
107
|
+
original.objectNodeFields.get(originalField) ??
|
|
108
|
+
fail(0xb17 /* missing expected field */),
|
|
108
109
|
normalizeField(undefined),
|
|
109
110
|
),
|
|
110
111
|
bExtra: (supersetField) =>
|
|
@@ -112,14 +113,15 @@ export function allowsTreeSuperset(
|
|
|
112
113
|
policy,
|
|
113
114
|
originalData,
|
|
114
115
|
normalizeField(undefined),
|
|
115
|
-
superset.objectNodeFields.get(supersetField) ??
|
|
116
|
+
superset.objectNodeFields.get(supersetField) ??
|
|
117
|
+
fail(0xb18 /* missing expected field */),
|
|
116
118
|
),
|
|
117
119
|
same: (sameField) =>
|
|
118
120
|
allowsFieldSuperset(
|
|
119
121
|
policy,
|
|
120
122
|
originalData,
|
|
121
|
-
original.objectNodeFields.get(sameField) ?? fail(
|
|
122
|
-
superset.objectNodeFields.get(sameField) ?? fail(
|
|
123
|
+
original.objectNodeFields.get(sameField) ?? fail(0xb19 /* missing expected field */),
|
|
124
|
+
superset.objectNodeFields.get(sameField) ?? fail(0xb1a /* missing expected field */),
|
|
123
125
|
),
|
|
124
126
|
});
|
|
125
127
|
}
|
|
@@ -148,7 +150,7 @@ export function allowsFieldSuperset(
|
|
|
148
150
|
superset: TreeFieldStoredSchema,
|
|
149
151
|
): boolean {
|
|
150
152
|
return withEditor(
|
|
151
|
-
policy.fieldKinds.get(original.kind) ?? fail(
|
|
153
|
+
policy.fieldKinds.get(original.kind) ?? fail(0xb1b /* missing kind */),
|
|
152
154
|
).allowsFieldSuperset(policy, originalData, original.types, superset);
|
|
153
155
|
}
|
|
154
156
|
|
|
@@ -35,8 +35,8 @@ export function isNeverFieldRecursive(
|
|
|
35
35
|
parentTypeStack: Set<TreeNodeStoredSchema>,
|
|
36
36
|
): boolean {
|
|
37
37
|
if (
|
|
38
|
-
(policy.fieldKinds.get(field.kind) ?? fail(
|
|
39
|
-
Multiplicity.Single &&
|
|
38
|
+
(policy.fieldKinds.get(field.kind) ?? fail(0xb1c /* missing field kind */))
|
|
39
|
+
.multiplicity === Multiplicity.Single &&
|
|
40
40
|
field.types !== undefined
|
|
41
41
|
) {
|
|
42
42
|
for (const type of field.types) {
|
|
@@ -94,8 +94,10 @@ export function isNeverTreeRecursive(
|
|
|
94
94
|
parentTypeStack.add(treeNode);
|
|
95
95
|
if (treeNode instanceof MapNodeStoredSchema) {
|
|
96
96
|
return (
|
|
97
|
-
(
|
|
98
|
-
.
|
|
97
|
+
(
|
|
98
|
+
policy.fieldKinds.get(treeNode.mapFields.kind) ??
|
|
99
|
+
fail(0xb1d /* missing field kind */)
|
|
100
|
+
).multiplicity === Multiplicity.Single
|
|
99
101
|
);
|
|
100
102
|
} else if (treeNode instanceof ObjectNodeStoredSchema) {
|
|
101
103
|
for (const field of treeNode.objectNodeFields.values()) {
|
|
@@ -177,7 +177,7 @@ function makeModularChangeCodec(
|
|
|
177
177
|
return encodeNodeChangesForJson(node, fieldContext);
|
|
178
178
|
},
|
|
179
179
|
|
|
180
|
-
decodeNode: () => fail(
|
|
180
|
+
decodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
return encodeFieldChangesForJsonI(change, fieldContext);
|
|
@@ -193,7 +193,7 @@ function makeModularChangeCodec(
|
|
|
193
193
|
const { codec, compiledSchema } = getFieldChangesetCodec(fieldChange.fieldKind);
|
|
194
194
|
const encodedChange = codec.json.encode(fieldChange.change, context);
|
|
195
195
|
if (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {
|
|
196
|
-
fail(
|
|
196
|
+
fail(0xb1f /* Encoded change didn't pass schema validation. */);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
const fieldKey: FieldKey = field;
|
|
@@ -238,7 +238,7 @@ function makeModularChangeCodec(
|
|
|
238
238
|
for (const field of encodedChange) {
|
|
239
239
|
const { codec, compiledSchema } = getFieldChangesetCodec(field.fieldKind);
|
|
240
240
|
if (compiledSchema !== undefined && !compiledSchema.check(field.change)) {
|
|
241
|
-
fail(
|
|
241
|
+
fail(0xb20 /* Encoded change didn't pass schema validation. */);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
const fieldId: FieldId = {
|
|
@@ -249,7 +249,7 @@ function makeModularChangeCodec(
|
|
|
249
249
|
const fieldContext: FieldChangeEncodingContext = {
|
|
250
250
|
baseContext: context,
|
|
251
251
|
|
|
252
|
-
encodeNode: () => fail(
|
|
252
|
+
encodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),
|
|
253
253
|
|
|
254
254
|
decodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {
|
|
255
255
|
const nodeId: NodeId = {
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
idAllocatorFromMaxId,
|
|
53
53
|
idAllocatorFromState,
|
|
54
54
|
type RangeQueryResult,
|
|
55
|
-
|
|
55
|
+
getOrCreate,
|
|
56
56
|
newTupleBTree,
|
|
57
57
|
mergeTupleBTrees,
|
|
58
58
|
type TupleBTree,
|
|
@@ -321,7 +321,7 @@ export class ModularChangeFamily
|
|
|
321
321
|
crossFieldTable.pendingCompositions.nodeIdsToCompose.push([child1, child2]);
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
return child1 ?? child2 ?? fail(
|
|
324
|
+
return child1 ?? child2 ?? fail(0xb22 /* Should not compose two undefined nodes */);
|
|
325
325
|
};
|
|
326
326
|
|
|
327
327
|
const amendedChange = rebaser.compose(
|
|
@@ -566,7 +566,7 @@ export class ModularChangeFamily
|
|
|
566
566
|
setInChangeAtomIdMap(crossFieldTable.newToBaseNodeId, child2, child1);
|
|
567
567
|
crossFieldTable.pendingCompositions.nodeIdsToCompose.push([child1, child2]);
|
|
568
568
|
}
|
|
569
|
-
return child1 ?? child2 ?? fail(
|
|
569
|
+
return child1 ?? child2 ?? fail(0xb23 /* Should not compose two undefined nodes */);
|
|
570
570
|
},
|
|
571
571
|
idAllocator,
|
|
572
572
|
manager,
|
|
@@ -1426,7 +1426,8 @@ export class ModularChangeFamily
|
|
|
1426
1426
|
constraintState: ConstraintState,
|
|
1427
1427
|
revertConstraintState: ConstraintState,
|
|
1428
1428
|
): void {
|
|
1429
|
-
const node =
|
|
1429
|
+
const node =
|
|
1430
|
+
nodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);
|
|
1430
1431
|
if (node.nodeExistsConstraint !== undefined) {
|
|
1431
1432
|
const isNowViolated = inputAttachState === NodeAttachState.Detached;
|
|
1432
1433
|
if (node.nodeExistsConstraint.violated !== isNowViolated) {
|
|
@@ -1924,7 +1925,7 @@ export function updateRefreshers(
|
|
|
1924
1925
|
|
|
1925
1926
|
if (change.builds !== undefined) {
|
|
1926
1927
|
for (const [[revision, id], chunk] of change.builds.entries()) {
|
|
1927
|
-
const lengthTree =
|
|
1928
|
+
const lengthTree = getOrCreate(chunkLengths, revision, () => new BTree());
|
|
1928
1929
|
lengthTree.set(id, chunk.topLevelLength);
|
|
1929
1930
|
}
|
|
1930
1931
|
}
|
|
@@ -3002,7 +3003,7 @@ function fieldChangeFromId(
|
|
|
3002
3003
|
id: FieldId,
|
|
3003
3004
|
): FieldChange {
|
|
3004
3005
|
const fieldMap = fieldMapFromNodeId(fields, nodes, id.nodeId);
|
|
3005
|
-
return fieldMap.get(id.field) ?? fail(
|
|
3006
|
+
return fieldMap.get(id.field) ?? fail(0xb25 /* No field exists for the given ID */);
|
|
3006
3007
|
}
|
|
3007
3008
|
|
|
3008
3009
|
function fieldMapFromNodeId(
|
|
@@ -27,7 +27,7 @@ export class MockNodeKeyManager implements NodeKeyManager {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
public localizeNodeKey(key: StableNodeKey): LocalNodeKey {
|
|
30
|
-
return this.tryLocalizeNodeKey(key) ?? fail(
|
|
30
|
+
return this.tryLocalizeNodeKey(key) ?? fail(0xb26 /* Key is not compressible */);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
public stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {
|
|
@@ -439,7 +439,7 @@ class Cursor extends SynchronousCursor implements ITreeSubscriptionCursor {
|
|
|
439
439
|
}
|
|
440
440
|
public getPath(prefix?: PathRootPrefix): UpPath {
|
|
441
441
|
assert(this.innerCursor !== undefined, 0x436 /* Cursor must be current to be used */);
|
|
442
|
-
return this.innerCursor.getPath(prefix) ?? fail(
|
|
442
|
+
return this.innerCursor.getPath(prefix) ?? fail(0xb27 /* no path when at root */);
|
|
443
443
|
}
|
|
444
444
|
public get fieldIndex(): number {
|
|
445
445
|
assert(this.innerCursor !== undefined, 0x437 /* Cursor must be current to be used */);
|
|
@@ -27,7 +27,7 @@ export function encodeRepo(repo: TreeStoredSchema): Format {
|
|
|
27
27
|
Object.create(null);
|
|
28
28
|
const rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);
|
|
29
29
|
for (const name of [...repo.nodeSchema.keys()].sort()) {
|
|
30
|
-
const schema = repo.nodeSchema.get(name) ?? fail(
|
|
30
|
+
const schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);
|
|
31
31
|
Object.defineProperty(nodeSchema, name, {
|
|
32
32
|
enumerable: true,
|
|
33
33
|
configurable: true,
|
|
@@ -540,7 +540,7 @@ export class ComposeQueue {
|
|
|
540
540
|
return this.dequeueBase();
|
|
541
541
|
} else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {
|
|
542
542
|
const baseCellId: ChangeAtomId =
|
|
543
|
-
getOutputCellId(baseMark) ?? fail(
|
|
543
|
+
getOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);
|
|
544
544
|
|
|
545
545
|
if (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {
|
|
546
546
|
// The base revision should always be defined except when squashing changes into a transaction.
|
|
@@ -176,7 +176,7 @@ function invertMark(
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
const cellId = getDetachOutputCellId(mark) ?? {
|
|
179
|
-
revision: mark.revision ?? fail(
|
|
179
|
+
revision: mark.revision ?? fail(0xb2a /* Revision must be defined */),
|
|
180
180
|
localId: mark.id,
|
|
181
181
|
};
|
|
182
182
|
|
|
@@ -132,7 +132,7 @@ export function makeV2CodecHelpers(
|
|
|
132
132
|
context,
|
|
133
133
|
);
|
|
134
134
|
case NoopMarkType:
|
|
135
|
-
fail(
|
|
135
|
+
fail(0xb2c /* Mark type: NoopMarkType should not be encoded. */);
|
|
136
136
|
default:
|
|
137
137
|
unreachableCase(type);
|
|
138
138
|
}
|
|
@@ -747,7 +747,7 @@ export function splitMark<TMark extends Mark>(mark: TMark, length: number): [TMa
|
|
|
747
747
|
const markLength = mark.count;
|
|
748
748
|
const remainder = markLength - length;
|
|
749
749
|
if (length < 1 || remainder < 1) {
|
|
750
|
-
fail(
|
|
750
|
+
fail(0xb2d /* Unable to split mark due to lengths */);
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
const [effect1, effect2] = splitMarkEffect(mark, length);
|
|
@@ -345,14 +345,16 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
|
|
|
345
345
|
|
|
346
346
|
public exitField(): void {
|
|
347
347
|
// assert(this.mode === CursorLocationType.Fields, "can only navigate up from field when in field");
|
|
348
|
-
this.siblings =
|
|
349
|
-
|
|
348
|
+
this.siblings =
|
|
349
|
+
this.siblingStack.pop() ?? fail(0xac3 /* Unexpected siblingStack.length */);
|
|
350
|
+
this.index = this.indexStack.pop() ?? fail(0xac4 /* Unexpected indexStack.length */);
|
|
350
351
|
}
|
|
351
352
|
|
|
352
353
|
public exitNode(): void {
|
|
353
354
|
// assert(this.mode === CursorLocationType.Nodes, "can only navigate up from node when in node");
|
|
354
|
-
this.siblings =
|
|
355
|
-
|
|
355
|
+
this.siblings =
|
|
356
|
+
this.siblingStack.pop() ?? fail(0xac5 /* Unexpected siblingStack.length */);
|
|
357
|
+
this.index = this.indexStack.pop() ?? fail(0xac6 /* Unexpected indexStack.length */);
|
|
356
358
|
}
|
|
357
359
|
|
|
358
360
|
public getNode(): TNode {
|
package/src/index.ts
CHANGED
|
@@ -73,7 +73,6 @@ export {
|
|
|
73
73
|
ForestTypeOptimized,
|
|
74
74
|
ForestTypeExpensiveDebug,
|
|
75
75
|
ForestTypeReference,
|
|
76
|
-
type IChannelView,
|
|
77
76
|
} from "./shared-tree/index.js";
|
|
78
77
|
|
|
79
78
|
export {
|
|
@@ -205,6 +204,23 @@ export {
|
|
|
205
204
|
asTreeViewAlpha,
|
|
206
205
|
type NodeSchemaOptions,
|
|
207
206
|
type NodeSchemaMetadata,
|
|
207
|
+
type AssignableTreeFieldFromImplicitField,
|
|
208
|
+
type ApplyKindAssignment,
|
|
209
|
+
type DefaultTreeNodeFromImplicitAllowedTypes,
|
|
210
|
+
type Customizer,
|
|
211
|
+
type GetTypes,
|
|
212
|
+
type StrictTypes,
|
|
213
|
+
type CustomTypes,
|
|
214
|
+
type CustomizedSchemaTyping,
|
|
215
|
+
CustomizedTyping,
|
|
216
|
+
type DefaultInsertableTreeNodeFromImplicitAllowedTypes,
|
|
217
|
+
customizeSchemaTyping,
|
|
218
|
+
type GetTypesUnsafe,
|
|
219
|
+
type DefaultInsertableTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
220
|
+
type DefaultTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
221
|
+
type StrictTypesUnsafe,
|
|
222
|
+
type AssignableTreeFieldFromImplicitFieldUnsafe,
|
|
223
|
+
type SchemaUnionToIntersection,
|
|
208
224
|
type schemaStatics,
|
|
209
225
|
type ITreeAlpha,
|
|
210
226
|
type TransactionConstraint,
|
|
@@ -217,6 +233,8 @@ export {
|
|
|
217
233
|
type TransactionResultSuccess,
|
|
218
234
|
type TransactionResultFailed,
|
|
219
235
|
rollback,
|
|
236
|
+
evaluateLazySchema,
|
|
237
|
+
Component,
|
|
220
238
|
} from "./simple-tree/index.js";
|
|
221
239
|
export {
|
|
222
240
|
SharedTree,
|
|
@@ -259,3 +277,6 @@ export {
|
|
|
259
277
|
export type { MapNodeInsertableData } from "./simple-tree/index.js";
|
|
260
278
|
|
|
261
279
|
export type { JsonCompatible, JsonCompatibleObject } from "./util/index.js";
|
|
280
|
+
|
|
281
|
+
export { JsonAsTree } from "./jsonDomainSchema.js";
|
|
282
|
+
export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
SchemaFactory,
|
|
8
|
+
type AllowedTypes,
|
|
9
|
+
type FixRecursiveArraySchema,
|
|
10
|
+
type TreeNodeFromImplicitAllowedTypes,
|
|
11
|
+
type ValidateRecursiveSchema,
|
|
12
|
+
} from "./simple-tree/index.js";
|
|
13
|
+
|
|
14
|
+
const sf = new SchemaFactory("com.fluidframework.json");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Utilities for storing JSON data in {@link TreeNode}s.
|
|
18
|
+
* @remarks
|
|
19
|
+
* Schema which replicate the JSON data model with {@link TreeNode}s.
|
|
20
|
+
*
|
|
21
|
+
* This allows JSON to be losslessly round-tripped through a tree with the following limitations:
|
|
22
|
+
*
|
|
23
|
+
* 1. Only information that would be preserved by JSON.parse is preserved. This means (among other things) that numbers are limited to JavasScript's numeric precision.
|
|
24
|
+
*
|
|
25
|
+
* 2. The order of fields on an object is not preserved. The resulting order is arbitrary.
|
|
26
|
+
*
|
|
27
|
+
* JSON data can be imported from JSON into this format using `JSON.parse` then {@link TreeAlpha.importConcise} with the {@link JsonAsTree.(Tree:variable)} schema.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export namespace JsonAsTree {
|
|
32
|
+
/**
|
|
33
|
+
* {@link AllowedTypes} for primitives types allowed in JSON.
|
|
34
|
+
* @alpha
|
|
35
|
+
*/
|
|
36
|
+
export const Primitive = [
|
|
37
|
+
sf.null,
|
|
38
|
+
sf.boolean,
|
|
39
|
+
sf.number,
|
|
40
|
+
sf.string,
|
|
41
|
+
] as const satisfies AllowedTypes;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
export type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* {@link AllowedTypes} for any content allowed in the {@link JsonAsTree} domain.
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const tree = TreeAlpha.importConcise(JsonAsTree.Union, { example: { nested: true }, value: 5 });
|
|
53
|
+
* ```
|
|
54
|
+
* @alpha
|
|
55
|
+
*/
|
|
56
|
+
export const Tree = [() => JsonObject, () => Array, ...Primitive] as const;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @alpha
|
|
60
|
+
*/
|
|
61
|
+
export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Do not use. Exists only as a workaround for {@link https://github.com/microsoft/TypeScript/issues/59550} and {@link https://github.com/microsoft/rushstack/issues/4429}.
|
|
65
|
+
* @system @alpha
|
|
66
|
+
*/
|
|
67
|
+
export const _APIExtractorWorkaroundObjectBase = sf.mapRecursive("object", Tree);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Arbitrary JSON object as a {@link TreeNode}.
|
|
71
|
+
* @remarks
|
|
72
|
+
* API of the tree node is more aligned with an es6 map than a JS object using its properties like a map.
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* // Due to TypeScript restrictions on recursive types, the constructor and be somewhat limiting.
|
|
76
|
+
* const fromArray = new JsonAsTreeObject([["a", 0]]);
|
|
77
|
+
* // Using `importConcise` can work better for JSON data:
|
|
78
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Object, { a: 0 });
|
|
79
|
+
* // Node API is like a Map:
|
|
80
|
+
* const value = imported.get("a");
|
|
81
|
+
* ```
|
|
82
|
+
* @privateRemarks
|
|
83
|
+
* Due to https://github.com/microsoft/TypeScript/issues/61270 this can't be named `Object`.
|
|
84
|
+
* @sealed @alpha
|
|
85
|
+
*/
|
|
86
|
+
export class JsonObject extends _APIExtractorWorkaroundObjectBase {}
|
|
87
|
+
{
|
|
88
|
+
type _check = ValidateRecursiveSchema<typeof JsonObject>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* D.ts bug workaround, see {@link FixRecursiveArraySchema}.
|
|
93
|
+
* @privateRemarks
|
|
94
|
+
* In the past this this had to reference the base type (_APIExtractorWorkaroundArrayBase).
|
|
95
|
+
* Testing for this in examples/utils/import-testing now shows it has to reference JsonAsTree.Array instead.
|
|
96
|
+
* @system @alpha
|
|
97
|
+
*/
|
|
98
|
+
export declare type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<
|
|
99
|
+
typeof Array
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Do not use. Exists only as a workaround for {@link https://github.com/microsoft/TypeScript/issues/59550} and {@link https://github.com/microsoft/rushstack/issues/4429}.
|
|
104
|
+
* @system @alpha
|
|
105
|
+
*/
|
|
106
|
+
export const _APIExtractorWorkaroundArrayBase = sf.arrayRecursive("array", Tree);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Arbitrary JSON array as a {@link TreeNode}.
|
|
110
|
+
* @remarks
|
|
111
|
+
* This can be imported using {@link TreeAlpha.importConcise}.
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
|
|
115
|
+
* const usingConstructor = new JsonAsTree.Array(["a", 0, new JsonAsTree.Array([1])]);
|
|
116
|
+
* // Using `importConcise` can work better for JSON data:
|
|
117
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Array, ["a", 0, [1]]);
|
|
118
|
+
* // Node API is like an Array:
|
|
119
|
+
* const inner: JsonAsTree.Tree = imported[2];
|
|
120
|
+
* assert(Tree.is(inner, JsonAsTree.Array));
|
|
121
|
+
* const leaf = inner[0];
|
|
122
|
+
* ```
|
|
123
|
+
* @sealed @alpha
|
|
124
|
+
*/
|
|
125
|
+
export class Array extends _APIExtractorWorkaroundArrayBase {}
|
|
126
|
+
{
|
|
127
|
+
type _check = ValidateRecursiveSchema<typeof Array>;
|
|
128
|
+
}
|
|
129
|
+
}
|
package/src/packageVersion.ts
CHANGED