@fluidframework/tree 2.22.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +1 -0
- package/CHANGELOG.md +47 -0
- package/api-report/tree.alpha.api.md +31 -0
- package/dist/alpha.d.ts +1 -0
- package/dist/codec/codec.js +3 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.d.ts.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -3
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +18 -13
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +11 -8
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +6 -4
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +4 -3
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +5 -4
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +6 -4
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -4
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -11
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +1 -1
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -1
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +6 -4
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +113 -0
- package/dist/jsonDomainSchema.d.ts.map +1 -0
- package/dist/jsonDomainSchema.js +101 -0
- package/dist/jsonDomainSchema.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +108 -0
- package/dist/serializableDomainSchema.d.ts.map +1 -0
- package/dist/serializableDomainSchema.js +90 -0
- package/dist/serializableDomainSchema.js.map +1 -0
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +37 -20
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +17 -17
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +4 -4
- package/dist/shared-tree/treeApiAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +11 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +70 -34
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +10 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +42 -7
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +3 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +3 -3
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/tree.js +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +9 -5
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +5 -4
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.js +1 -1
- package/dist/simple-tree/api/view.js.map +1 -1
- package/dist/simple-tree/arrayNode.js +2 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +1 -1
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +6 -6
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/proxies.js +1 -1
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +2 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +5 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/idAllocator.js +1 -1
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +5 -4
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts +2 -10
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +9 -28
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/utils.d.ts +23 -6
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +46 -13
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/codec/codec.js +3 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.d.ts.map +1 -1
- package/lib/codec/discriminatedUnions.js +1 -1
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -3
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +19 -14
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/treeTextFormat.js +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +11 -8
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +14 -14
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +4 -3
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +5 -4
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +6 -4
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +4 -4
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +1 -1
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -1
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +1 -1
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +1 -1
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +6 -4
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +113 -0
- package/lib/jsonDomainSchema.d.ts.map +1 -0
- package/lib/jsonDomainSchema.js +98 -0
- package/lib/jsonDomainSchema.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +108 -0
- package/lib/serializableDomainSchema.d.ts.map +1 -0
- package/lib/serializableDomainSchema.js +87 -0
- package/lib/serializableDomainSchema.js.map +1 -0
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -1
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +37 -20
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +18 -18
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +4 -4
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +11 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +70 -34
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +10 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +42 -7
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/customTree.js +3 -3
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +3 -3
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/tree.js +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +9 -5
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +5 -4
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.js +1 -1
- package/lib/simple-tree/api/view.js.map +1 -1
- package/lib/simple-tree/arrayNode.js +2 -2
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +1 -1
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +6 -6
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +5 -5
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -2
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/proxies.js +1 -1
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +3 -3
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +2 -1
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +5 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/idAllocator.js +1 -1
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts +2 -10
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +5 -23
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/utils.d.ts +23 -6
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +42 -11
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/codec/codec.ts +3 -3
- package/src/codec/discriminatedUnions.ts +2 -1
- package/src/core/schema-stored/schema.ts +5 -3
- package/src/core/tree/anchorSet.ts +37 -26
- package/src/core/tree/treeTextFormat.ts +1 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +11 -8
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts +4 -3
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +14 -14
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +1 -1
- package/src/feature-libraries/flex-tree/lazyField.ts +6 -8
- package/src/feature-libraries/flex-tree/lazyNode.ts +6 -4
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -1
- package/src/feature-libraries/modular-schema/comparison.ts +7 -5
- package/src/feature-libraries/modular-schema/isNeverTree.ts +6 -4
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -4
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +16 -12
- package/src/feature-libraries/node-key/mockNodeKeyManager.ts +1 -1
- package/src/feature-libraries/object-forest/objectForest.ts +1 -1
- package/src/feature-libraries/schema-index/codec.ts +1 -1
- package/src/feature-libraries/sequence-field/compose.ts +1 -1
- package/src/feature-libraries/sequence-field/invert.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/utils.ts +1 -1
- package/src/feature-libraries/treeCursorUtils.ts +6 -4
- package/src/index.ts +3 -1
- package/src/jsonDomainSchema.ts +129 -0
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +121 -0
- package/src/shared-tree/index.ts +0 -1
- package/src/shared-tree/schematizeTree.ts +1 -1
- package/src/shared-tree/sharedTree.ts +31 -41
- package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
- package/src/shared-tree/treeApiAlpha.ts +12 -4
- package/src/shared-tree/treeCheckout.ts +1 -1
- package/src/shared-tree-core/editManager.ts +85 -47
- package/src/shared-tree-core/resubmitMachine.ts +2 -0
- package/src/shared-tree-core/sharedTreeCore.ts +62 -14
- package/src/simple-tree/api/customTree.ts +3 -3
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
- package/src/simple-tree/api/simpleTreeIndex.ts +3 -3
- package/src/simple-tree/api/tree.ts +1 -1
- package/src/simple-tree/api/treeNodeApi.ts +11 -6
- package/src/simple-tree/api/verboseTree.ts +8 -4
- package/src/simple-tree/api/view.ts +1 -1
- package/src/simple-tree/arrayNode.ts +2 -2
- package/src/simple-tree/core/getOrCreateNode.ts +2 -1
- package/src/simple-tree/core/schemaCaching.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +9 -6
- package/src/simple-tree/core/unhydratedFlexTree.ts +7 -5
- package/src/simple-tree/objectNode.ts +2 -2
- package/src/simple-tree/proxies.ts +1 -1
- package/src/simple-tree/toMapTree.ts +3 -3
- package/src/simple-tree/toStoredSchema.ts +2 -1
- package/src/simple-tree/treeNodeValid.ts +5 -2
- package/src/util/idAllocator.ts +1 -1
- package/src/util/index.ts +3 -2
- package/src/util/nestedMap.ts +9 -33
- package/src/util/utils.ts +52 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA+E;AAE/E,+CAa0B;AAC1B,+CAAwC;AACxC,uEAAsE;AAwBtE;;;;GAIG;AACH,SAAgB,mBAAmB,CAClC,OAA6B,EAC7B,IAAW;IAEX,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AALD,kDAKC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CACnC,OAA6B,EAC7B,IAAW,EACX,gBAA+B,oBAAS;IAExC,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,+FAA+F;IAC/F,kGAAkG;IAClG,MAAM,CAAC,UAAU,CAAC,IAAA,6BAAkB,EAAC,aAAa,CAAC,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;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M,cAAc,GAAmB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7E,OAAO,IAAI,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACP,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,MAAa,YAAY;IAGxB,YACiB,MAAsB,EACtB,IAAY;QADZ,WAAM,GAAN,MAAM,CAAgB;QACtB,SAAI,GAAJ,IAAI,CAAQ;QAE5B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,IAAI,IAAI,CAAC,WAAW,CAAC;YAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,CAAC;IACF,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD;AAlBD,oCAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\tdebugAssert(() =>\n\t\t\tthis.mode === CursorLocationType.Fields ? true : \"must be in fields mode\",\n\t\t);\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"A child does not exist at the specified index, check the status of a node using `Tree.status()`.\",\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings = this.siblingStack.pop() ?? fail(\"Unexpected siblingStack.length\");\n\t\tthis.index = this.indexStack.pop() ?? fail(\"Unexpected indexStack.length\");\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA+E;AAE/E,+CAa0B;AAC1B,+CAAwC;AACxC,uEAAsE;AAwBtE;;;;GAIG;AACH,SAAgB,mBAAmB,CAClC,OAA6B,EAC7B,IAAW;IAEX,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AALD,kDAKC;AAED;;;;GAIG;AAC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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\tdebugAssert(() =>\n\t\t\tthis.mode === CursorLocationType.Fields ? true : \"must be in fields mode\",\n\t\t);\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"A child does not exist at the specified index, check the status of a node using `Tree.status()`.\",\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac3 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac4 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac5 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac6 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * @returns the value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * @returns the type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type Listenable<T extends object> = EventListenable<T>;
|
|
|
29
29
|
*/
|
|
30
30
|
export type Off = EventOff;
|
|
31
31
|
export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
|
|
32
|
-
export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference,
|
|
32
|
+
export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
|
|
33
33
|
export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, type schemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, } from "./simple-tree/index.js";
|
|
34
34
|
export { SharedTree, configuredSharedTree, SharedTreeAttributes, SharedTreeFactoryType, } from "./treeFactory.js";
|
|
35
35
|
export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
|
|
@@ -45,4 +45,6 @@ export {
|
|
|
45
45
|
InternalTypes, };
|
|
46
46
|
export type { MapNodeInsertableData } from "./simple-tree/index.js";
|
|
47
47
|
export type { JsonCompatible, JsonCompatibleObject } from "./util/index.js";
|
|
48
|
+
export { JsonAsTree } from "./jsonDomainSchema.js";
|
|
49
|
+
export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
|
|
48
50
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,UAAU,IAAI,eAAe,EAC7B,GAAG,IAAI,QAAQ,EACf,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAC5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC/C;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC9D;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC;AAE3B,OAAO,EACN,UAAU,EACV,uBAAuB,EACvB,KAAK,SAAS,EACd,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C1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACN,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,QAAQ,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.InternalTypes = exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.SharedTreeFactoryType = exports.SharedTreeAttributes = exports.configuredSharedTree = exports.SharedTree = exports.rollback = exports.asTreeViewAlpha = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.Tree = exports.SharedTreeFormatVersion = exports.TreeCompressionStrategy = exports.TreeStatus = exports.RevertibleStatus = exports.CommitKind = exports.ValueSchema = void 0;
|
|
30
|
+
exports.FluidSerializableAsTree = exports.JsonAsTree = exports.InternalTypes = exports.typeboxValidator = exports.noopValidator = exports.FluidClientVersion = exports.SharedTreeFactoryType = exports.SharedTreeAttributes = exports.configuredSharedTree = exports.SharedTree = exports.rollback = exports.asTreeViewAlpha = exports.getSimpleSchema = exports.normalizeAllowedTypes = exports.getJsonSchema = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.independentView = exports.TreeAlpha = exports.independentInitializedView = exports.getBranch = exports.Tree = exports.SharedTreeFormatVersion = exports.TreeCompressionStrategy = exports.TreeStatus = exports.RevertibleStatus = exports.CommitKind = exports.ValueSchema = void 0;
|
|
31
31
|
var index_js_1 = require("./core/index.js");
|
|
32
32
|
Object.defineProperty(exports, "ValueSchema", { enumerable: true, get: function () { return index_js_1.ValueSchema; } });
|
|
33
33
|
Object.defineProperty(exports, "CommitKind", { enumerable: true, get: function () { return index_js_1.CommitKind; } });
|
|
@@ -86,4 +86,8 @@ var index_js_7 = require("./external-utilities/index.js");
|
|
|
86
86
|
Object.defineProperty(exports, "typeboxValidator", { enumerable: true, get: function () { return index_js_7.typeboxValidator; } });
|
|
87
87
|
const InternalTypes = __importStar(require("./internalTypes.js"));
|
|
88
88
|
exports.InternalTypes = InternalTypes;
|
|
89
|
+
var jsonDomainSchema_js_1 = require("./jsonDomainSchema.js");
|
|
90
|
+
Object.defineProperty(exports, "JsonAsTree", { enumerable: true, get: function () { return jsonDomainSchema_js_1.JsonAsTree; } });
|
|
91
|
+
var serializableDomainSchema_js_1 = require("./serializableDomainSchema.js");
|
|
92
|
+
Object.defineProperty(exports, "FluidSerializableAsTree", { enumerable: true, get: function () { return serializableDomainSchema_js_1.FluidSerializableAsTree; } });
|
|
89
93
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CASyB;AARxB,uGAAA,WAAW,OAAA;AAEX,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAuCjB,yDAMsC;AALrC,sGAAA,UAAU,OAAA;AACV,mHAAA,uBAAuB,OAAA;AAMxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CASyB;AARxB,uGAAA,WA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8GAAA,kBAAkB,OAAA;AAEnB,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAYzB,kEAAoD;AAMnD,sCAAa;AAUd,6DAAmD;AAA1C,iHAAA,UAAU,OAAA;AACnB,6EAAwE;AAA/D,sIAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\tindependentView,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n\ttype schemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n\tSharedTreeAttributes,\n\tSharedTreeFactoryType,\n} from \"./treeFactory.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype RestrictiveReadonlyRecord,\n\ttype RestrictiveStringRecord,\n\ttype MakeNominal,\n\ttype IsUnion,\n\ttype UnionToIntersection,\n\ttype UnionToTuple,\n\ttype PopUnion,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport type { JsonCompatible, JsonCompatibleObject } from \"./util/index.js\";\n\nexport { JsonAsTree } from \"./jsonDomainSchema.js\";\nexport { FluidSerializableAsTree } from \"./serializableDomainSchema.js\";\n"]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { type FixRecursiveArraySchema, type TreeNodeFromImplicitAllowedTypes } from "./simple-tree/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Utilities for storing JSON data in {@link TreeNode}s.
|
|
8
|
+
* @remarks
|
|
9
|
+
* Schema which replicate the JSON data model with {@link TreeNode}s.
|
|
10
|
+
*
|
|
11
|
+
* This allows JSON to be losslessly round-tripped through a tree with the following limitations:
|
|
12
|
+
*
|
|
13
|
+
* 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.
|
|
14
|
+
*
|
|
15
|
+
* 2. The order of fields on an object is not preserved. The resulting order is arbitrary.
|
|
16
|
+
*
|
|
17
|
+
* JSON data can be imported from JSON into this format using `JSON.parse` then {@link TreeAlpha.importConcise} with the {@link JsonAsTree.(Tree:variable)} schema.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare namespace JsonAsTree {
|
|
22
|
+
/**
|
|
23
|
+
* {@link AllowedTypes} for primitives types allowed in JSON.
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
const Primitive: readonly [import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>];
|
|
27
|
+
/**
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;
|
|
31
|
+
/**
|
|
32
|
+
* {@link AllowedTypes} for any content allowed in the {@link JsonAsTree} domain.
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const tree = TreeAlpha.importConcise(JsonAsTree.Union, { example: { nested: true }, value: 5 });
|
|
36
|
+
* ```
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
const Tree: readonly [() => typeof JsonObject, () => typeof Array, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>];
|
|
40
|
+
/**
|
|
41
|
+
* @alpha
|
|
42
|
+
*/
|
|
43
|
+
type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
|
|
44
|
+
/**
|
|
45
|
+
* 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}.
|
|
46
|
+
* @system @alpha
|
|
47
|
+
*/
|
|
48
|
+
const _APIExtractorWorkaroundObjectBase: import("./simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.json.object", import("./simple-tree/index.js").NodeKind.Map, import("./simple-tree/index.js").TreeMapNodeUnsafe<readonly [() => typeof JsonObject, () => typeof Array, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>]> & import("./simple-tree/index.js").WithType<"com.fluidframework.json.object", import("./simple-tree/index.js").NodeKind.Map, unknown>, {
|
|
49
|
+
[Symbol.iterator](): Iterator<[string, string | number | JsonObject | Array | import("./simple-tree/index.js").InsertableTypedNodeUnsafe<import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, true, unknown, boolean, unknown> & {
|
|
50
|
+
create(data: boolean): boolean;
|
|
51
|
+
}> | null], any, undefined>;
|
|
52
|
+
} | {
|
|
53
|
+
readonly [x: string]: string | number | JsonObject | Array | import("./simple-tree/index.js").InsertableTypedNodeUnsafe<import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, true, unknown, boolean, unknown> & {
|
|
54
|
+
create(data: boolean): boolean;
|
|
55
|
+
}> | null;
|
|
56
|
+
}, false, readonly [() => typeof JsonObject, () => typeof Array, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>], undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Arbitrary JSON object as a {@link TreeNode}.
|
|
59
|
+
* @remarks
|
|
60
|
+
* API of the tree node is more aligned with an es6 map than a JS object using its properties like a map.
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Due to TypeScript restrictions on recursive types, the constructor and be somewhat limiting.
|
|
64
|
+
* const fromArray = new JsonAsTreeObject([["a", 0]]);
|
|
65
|
+
* // Using `importConcise` can work better for JSON data:
|
|
66
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Object, { a: 0 });
|
|
67
|
+
* // Node API is like a Map:
|
|
68
|
+
* const value = imported.get("a");
|
|
69
|
+
* ```
|
|
70
|
+
* @privateRemarks
|
|
71
|
+
* Due to https://github.com/microsoft/TypeScript/issues/61270 this can't be named `Object`.
|
|
72
|
+
* @sealed @alpha
|
|
73
|
+
*/
|
|
74
|
+
class JsonObject extends _APIExtractorWorkaroundObjectBase {
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* D.ts bug workaround, see {@link FixRecursiveArraySchema}.
|
|
78
|
+
* @privateRemarks
|
|
79
|
+
* In the past this this had to reference the base type (_APIExtractorWorkaroundArrayBase).
|
|
80
|
+
* Testing for this in examples/utils/import-testing now shows it has to reference JsonAsTree.Array instead.
|
|
81
|
+
* @system @alpha
|
|
82
|
+
*/
|
|
83
|
+
type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<typeof Array>;
|
|
84
|
+
/**
|
|
85
|
+
* 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}.
|
|
86
|
+
* @system @alpha
|
|
87
|
+
*/
|
|
88
|
+
const _APIExtractorWorkaroundArrayBase: import("./simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.json.array", import("./simple-tree/index.js").NodeKind.Array, import("./simple-tree/index.js").TreeArrayNodeUnsafe<readonly [() => typeof JsonObject, () => typeof Array, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>]> & import("./simple-tree/index.js").WithType<"com.fluidframework.json.array", import("./simple-tree/index.js").NodeKind.Array, unknown>, {
|
|
89
|
+
[Symbol.iterator](): Iterator<string | number | JsonObject | Array | import("./simple-tree/index.js").InsertableTypedNodeUnsafe<import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, true, unknown, boolean, unknown> & {
|
|
90
|
+
create(data: boolean): boolean;
|
|
91
|
+
}> | null, any, undefined>;
|
|
92
|
+
}, false, readonly [() => typeof JsonObject, () => typeof Array, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", import("./simple-tree/index.js").NodeKind.Leaf, null, null, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", import("./simple-tree/index.js").NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", import("./simple-tree/index.js").NodeKind.Leaf, number, number, true, unknown, never, unknown>, import("./simple-tree/index.js").TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", import("./simple-tree/index.js").NodeKind.Leaf, string, string, true, unknown, never, unknown>], undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* Arbitrary JSON array as a {@link TreeNode}.
|
|
95
|
+
* @remarks
|
|
96
|
+
* This can be imported using {@link TreeAlpha.importConcise}.
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
|
|
100
|
+
* const usingConstructor = new JsonAsTree.Array(["a", 0, new JsonAsTree.Array([1])]);
|
|
101
|
+
* // Using `importConcise` can work better for JSON data:
|
|
102
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Array, ["a", 0, [1]]);
|
|
103
|
+
* // Node API is like an Array:
|
|
104
|
+
* const inner: JsonAsTree.Tree = imported[2];
|
|
105
|
+
* assert(Tree.is(inner, JsonAsTree.Array));
|
|
106
|
+
* const leaf = inner[0];
|
|
107
|
+
* ```
|
|
108
|
+
* @sealed @alpha
|
|
109
|
+
*/
|
|
110
|
+
class Array extends _APIExtractorWorkaroundArrayBase {
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=jsonDomainSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonDomainSchema.d.ts","sourceRoot":"","sources":["../src/jsonDomainSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EAErC,MAAM,wBAAwB,CAAC;AAIhC;;;;;;;;;;;;;;GAcG;AACH,yBAAiB,UAAU,CAAC;IAC3B;;;OAGG;IACI,MAAM,SAAS,gvBAKW,CAAC;IAElC;;OAEG;IACH,KAAY,SAAS,GAAG,gCAAgC,CAAC,OAAO,SAAS,CAAC,CAAC;IAE3E;;;;;;;OAOG;IACI,MAAM,IAAI,6xBAAyD,CAAC;IAE3E;;OAEG;IACH,KAAY,IAAI,GAAG,gCAAgC,CAAC,OAAO,IAAI,CAAC,CAAC;IAEjE;;;OAGG;IACI,MAAM,iCAAiC;;;;;;;;qzBAAkC,CAAC;IAEjF;;;;;;;;;;;;;;;;OAgBG;IACH,MAAa,UAAW,SAAQ,iCAAiC;KAAG;IAKpE;;;;;;OAMG;IACH,KAAoB,kCAAkC,GAAG,uBAAuB,CAC/E,OAAO,KAAK,CACZ,CAAC;IAEF;;;OAGG;IACI,MAAM,gCAAgC;;;;qzBAAmC,CAAC;IAEjF;;;;;;;;;;;;;;;;OAgBG;IACH,MAAa,KAAM,SAAQ,gCAAgC;KAAG;CAI9D"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.JsonAsTree = void 0;
|
|
8
|
+
const index_js_1 = require("./simple-tree/index.js");
|
|
9
|
+
const sf = new index_js_1.SchemaFactory("com.fluidframework.json");
|
|
10
|
+
/**
|
|
11
|
+
* Utilities for storing JSON data in {@link TreeNode}s.
|
|
12
|
+
* @remarks
|
|
13
|
+
* Schema which replicate the JSON data model with {@link TreeNode}s.
|
|
14
|
+
*
|
|
15
|
+
* This allows JSON to be losslessly round-tripped through a tree with the following limitations:
|
|
16
|
+
*
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* 2. The order of fields on an object is not preserved. The resulting order is arbitrary.
|
|
20
|
+
*
|
|
21
|
+
* JSON data can be imported from JSON into this format using `JSON.parse` then {@link TreeAlpha.importConcise} with the {@link JsonAsTree.(Tree:variable)} schema.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
var JsonAsTree;
|
|
26
|
+
(function (JsonAsTree) {
|
|
27
|
+
/**
|
|
28
|
+
* {@link AllowedTypes} for primitives types allowed in JSON.
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
JsonAsTree.Primitive = [
|
|
32
|
+
sf.null,
|
|
33
|
+
sf.boolean,
|
|
34
|
+
sf.number,
|
|
35
|
+
sf.string,
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* {@link AllowedTypes} for any content allowed in the {@link JsonAsTree} domain.
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const tree = TreeAlpha.importConcise(JsonAsTree.Union, { example: { nested: true }, value: 5 });
|
|
42
|
+
* ```
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
JsonAsTree.Tree = [() => JsonObject, () => Array, ...JsonAsTree.Primitive];
|
|
46
|
+
/**
|
|
47
|
+
* 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}.
|
|
48
|
+
* @system @alpha
|
|
49
|
+
*/
|
|
50
|
+
JsonAsTree._APIExtractorWorkaroundObjectBase = sf.mapRecursive("object", JsonAsTree.Tree);
|
|
51
|
+
/**
|
|
52
|
+
* Arbitrary JSON object as a {@link TreeNode}.
|
|
53
|
+
* @remarks
|
|
54
|
+
* API of the tree node is more aligned with an es6 map than a JS object using its properties like a map.
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Due to TypeScript restrictions on recursive types, the constructor and be somewhat limiting.
|
|
58
|
+
* const fromArray = new JsonAsTreeObject([["a", 0]]);
|
|
59
|
+
* // Using `importConcise` can work better for JSON data:
|
|
60
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Object, { a: 0 });
|
|
61
|
+
* // Node API is like a Map:
|
|
62
|
+
* const value = imported.get("a");
|
|
63
|
+
* ```
|
|
64
|
+
* @privateRemarks
|
|
65
|
+
* Due to https://github.com/microsoft/TypeScript/issues/61270 this can't be named `Object`.
|
|
66
|
+
* @sealed @alpha
|
|
67
|
+
*/
|
|
68
|
+
class JsonObject extends JsonAsTree._APIExtractorWorkaroundObjectBase {
|
|
69
|
+
}
|
|
70
|
+
JsonAsTree.JsonObject = JsonObject;
|
|
71
|
+
{
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 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}.
|
|
75
|
+
* @system @alpha
|
|
76
|
+
*/
|
|
77
|
+
JsonAsTree._APIExtractorWorkaroundArrayBase = sf.arrayRecursive("array", JsonAsTree.Tree);
|
|
78
|
+
/**
|
|
79
|
+
* Arbitrary JSON array as a {@link TreeNode}.
|
|
80
|
+
* @remarks
|
|
81
|
+
* This can be imported using {@link TreeAlpha.importConcise}.
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
|
|
85
|
+
* const usingConstructor = new JsonAsTree.Array(["a", 0, new JsonAsTree.Array([1])]);
|
|
86
|
+
* // Using `importConcise` can work better for JSON data:
|
|
87
|
+
* const imported = TreeAlpha.importConcise(JsonAsTree.Array, ["a", 0, [1]]);
|
|
88
|
+
* // Node API is like an Array:
|
|
89
|
+
* const inner: JsonAsTree.Tree = imported[2];
|
|
90
|
+
* assert(Tree.is(inner, JsonAsTree.Array));
|
|
91
|
+
* const leaf = inner[0];
|
|
92
|
+
* ```
|
|
93
|
+
* @sealed @alpha
|
|
94
|
+
*/
|
|
95
|
+
class Array extends JsonAsTree._APIExtractorWorkaroundArrayBase {
|
|
96
|
+
}
|
|
97
|
+
JsonAsTree.Array = Array;
|
|
98
|
+
{
|
|
99
|
+
}
|
|
100
|
+
})(JsonAsTree || (exports.JsonAsTree = JsonAsTree = {}));
|
|
101
|
+
//# sourceMappingURL=jsonDomainSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonDomainSchema.js","sourceRoot":"","sources":["../src/jsonDomainSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAMgC;AAEhC,MAAM,EAAE,GAAG,IAAI,wBAAa,CAAC,yBAAyB,CAAC,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,UAAU,CAkG1B;AAlGD,WAAiB,UAAU;IAC1B;;;OAGG;IACU,oBAAS,GAAG;QACxB,EAAE,CAAC,IAAI;QACP,EAAE,CAAC,OAAO;QACV,EAAE,CAAC,MAAM;QACT,EAAE,CAAC,MAAM;KACuB,CAAC;IAOlC;;;;;;;OAOG;IACU,eAAI,GAAG,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,WAAA,SAAS,CAAU,CAAC;IAO3E;;;OAGG;IACU,4CAAiC,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,WAAA,IAAI,CAAC,CAAC;IAEjF;;;;;;;;;;;;;;;;OAgBG;IACH,MAAa,UAAW,SAAQ,WAAA,iCAAiC;KAAG;IAAvD,qBAAU,aAA6C,CAAA;IACpE,CAAC;IAED,CAAC;IAaD;;;OAGG;IACU,2CAAgC,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,WAAA,IAAI,CAAC,CAAC;IAEjF;;;;;;;;;;;;;;;;OAgBG;IACH,MAAa,KAAM,SAAQ,WAAA,gCAAgC;KAAG;IAAjD,gBAAK,QAA4C,CAAA;IAC9D,CAAC;IAED,CAAC;AACF,CAAC,EAlGgB,UAAU,0BAAV,UAAU,QAkG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tSchemaFactory,\n\ttype AllowedTypes,\n\ttype FixRecursiveArraySchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype ValidateRecursiveSchema,\n} from \"./simple-tree/index.js\";\n\nconst sf = new SchemaFactory(\"com.fluidframework.json\");\n\n/**\n * Utilities for storing JSON data in {@link TreeNode}s.\n * @remarks\n * Schema which replicate the JSON data model with {@link TreeNode}s.\n *\n * This allows JSON to be losslessly round-tripped through a tree with the following limitations:\n *\n * 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.\n *\n * 2. The order of fields on an object is not preserved. The resulting order is arbitrary.\n *\n * JSON data can be imported from JSON into this format using `JSON.parse` then {@link TreeAlpha.importConcise} with the {@link JsonAsTree.(Tree:variable)} schema.\n *\n * @alpha\n */\nexport namespace JsonAsTree {\n\t/**\n\t * {@link AllowedTypes} for primitives types allowed in JSON.\n\t * @alpha\n\t */\n\texport const Primitive = [\n\t\tsf.null,\n\t\tsf.boolean,\n\t\tsf.number,\n\t\tsf.string,\n\t] as const satisfies AllowedTypes;\n\n\t/**\n\t * @alpha\n\t */\n\texport type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;\n\n\t/**\n\t * {@link AllowedTypes} for any content allowed in the {@link JsonAsTree} domain.\n\t * @example\n\t * ```typescript\n\t * const tree = TreeAlpha.importConcise(JsonAsTree.Union, { example: { nested: true }, value: 5 });\n\t * ```\n\t * @alpha\n\t */\n\texport const Tree = [() => JsonObject, () => Array, ...Primitive] as const;\n\n\t/**\n\t * @alpha\n\t */\n\texport type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;\n\n\t/**\n\t * 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}.\n\t * @system @alpha\n\t */\n\texport const _APIExtractorWorkaroundObjectBase = sf.mapRecursive(\"object\", Tree);\n\n\t/**\n\t * Arbitrary JSON object as a {@link TreeNode}.\n\t * @remarks\n\t * API of the tree node is more aligned with an es6 map than a JS object using its properties like a map.\n\t * @example\n\t * ```typescript\n\t * // Due to TypeScript restrictions on recursive types, the constructor and be somewhat limiting.\n\t * const fromArray = new JsonAsTreeObject([[\"a\", 0]]);\n\t * // Using `importConcise` can work better for JSON data:\n\t * const imported = TreeAlpha.importConcise(JsonAsTree.Object, { a: 0 });\n\t * // Node API is like a Map:\n\t * const value = imported.get(\"a\");\n\t * ```\n\t * @privateRemarks\n\t * Due to https://github.com/microsoft/TypeScript/issues/61270 this can't be named `Object`.\n\t * @sealed @alpha\n\t */\n\texport class JsonObject extends _APIExtractorWorkaroundObjectBase {}\n\t{\n\t\ttype _check = ValidateRecursiveSchema<typeof JsonObject>;\n\t}\n\n\t/**\n\t * D.ts bug workaround, see {@link FixRecursiveArraySchema}.\n\t * @privateRemarks\n\t * In the past this this had to reference the base type (_APIExtractorWorkaroundArrayBase).\n\t * Testing for this in examples/utils/import-testing now shows it has to reference JsonAsTree.Array instead.\n\t * @system @alpha\n\t */\n\texport declare type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<\n\t\ttypeof Array\n\t>;\n\n\t/**\n\t * 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}.\n\t * @system @alpha\n\t */\n\texport const _APIExtractorWorkaroundArrayBase = sf.arrayRecursive(\"array\", Tree);\n\n\t/**\n\t * Arbitrary JSON array as a {@link TreeNode}.\n\t * @remarks\n\t * This can be imported using {@link TreeAlpha.importConcise}.\n\t * @example\n\t * ```typescript\n\t * // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.\n\t * const usingConstructor = new JsonAsTree.Array([\"a\", 0, new JsonAsTree.Array([1])]);\n\t * // Using `importConcise` can work better for JSON data:\n\t * const imported = TreeAlpha.importConcise(JsonAsTree.Array, [\"a\", 0, [1]]);\n\t * // Node API is like an Array:\n\t * const inner: JsonAsTree.Tree = imported[2];\n\t * assert(Tree.is(inner, JsonAsTree.Array));\n\t * const leaf = inner[0];\n\t * ```\n\t * @sealed @alpha\n\t */\n\texport class Array extends _APIExtractorWorkaroundArrayBase {}\n\t{\n\t\ttype _check = ValidateRecursiveSchema<typeof Array>;\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/tree";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.23.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.23.0\";\n"]}
|