@fluidframework/tree 2.23.0 → 2.30.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/CHANGELOG.md +38 -0
- package/api-report/tree.alpha.api.md +28 -12
- package/dist/alpha.d.ts +6 -0
- package/dist/core/forest/editableForest.d.ts +1 -14
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js +1 -28
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.d.ts +16 -3
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js +4 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/forest/index.d.ts +1 -1
- package/dist/core/forest/index.d.ts.map +1 -1
- package/dist/core/forest/index.js +1 -2
- package/dist/core/forest/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -3
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +12 -5
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +8 -23
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +3 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +54 -1
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +8 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +7 -5
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +19 -9
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +5 -23
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +8 -5
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +10 -7
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +5 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -0
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +3 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/deltaUtils.js +1 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +5 -4
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +9 -6
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +9 -7
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/initializeForest.d.ts +18 -0
- package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
- package/dist/feature-libraries/initializeForest.js +35 -0
- package/dist/feature-libraries/initializeForest.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +9 -15
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
- package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/index.js +16 -0
- package/dist/feature-libraries/node-identifier/index.js.map +1 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +6 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +1 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +3 -18
- package/dist/shared-tree/independentView.js.map +1 -1
- 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 +2 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +3 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +1 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +11 -7
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +6 -31
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +3 -18
- 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/simple-tree/api/conciseTree.d.ts +8 -2
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +10 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +3 -3
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +42 -12
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +30 -2
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +6 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +12 -9
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +16 -26
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFromSimple.js +60 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -0
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +11 -5
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +11 -2
- 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 +2 -17
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +16 -25
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +15 -10
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/flexList.d.ts +4 -5
- package/dist/simple-tree/flexList.d.ts.map +1 -1
- package/dist/simple-tree/flexList.js +1 -14
- package/dist/simple-tree/flexList.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -0
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +34 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +55 -2
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -4
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- 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 +1 -5
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +7 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +13 -5
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/cloneWithReplacements.d.ts +21 -0
- package/dist/util/cloneWithReplacements.d.ts.map +1 -0
- package/dist/util/cloneWithReplacements.js +38 -0
- package/dist/util/cloneWithReplacements.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/referenceCounting.d.ts +18 -0
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/lib/alpha.d.ts +6 -0
- package/lib/core/forest/editableForest.d.ts +1 -14
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js +0 -26
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/forest/forest.d.ts +16 -3
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js +4 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/forest/index.d.ts +1 -1
- package/lib/core/forest/index.d.ts.map +1 -1
- package/lib/core/forest/index.js +1 -1
- package/lib/core/forest/index.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +8 -3
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +12 -5
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +8 -23
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +3 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +54 -1
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +6 -0
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +7 -5
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +19 -9
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +5 -23
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +8 -5
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +11 -8
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -3
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -0
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -0
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/deltaUtils.js +1 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +5 -4
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +11 -8
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/initializeForest.d.ts +18 -0
- package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
- package/lib/feature-libraries/initializeForest.js +31 -0
- package/lib/feature-libraries/initializeForest.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -16
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
- package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/index.js +8 -0
- package/lib/feature-libraries/node-identifier/index.js.map +1 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +16 -16
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +6 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +5 -20
- package/lib/shared-tree/independentView.js.map +1 -1
- 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 +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +1 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -6
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +6 -31
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +3 -18
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +8 -2
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +9 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +3 -3
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +42 -12
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +29 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +4 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +12 -9
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +14 -23
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFromSimple.js +56 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -0
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +11 -5
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +12 -3
- 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 +4 -19
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +16 -25
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +14 -10
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/flexList.d.ts +4 -5
- package/lib/simple-tree/flexList.d.ts.map +1 -1
- package/lib/simple-tree/flexList.js +0 -12
- package/lib/simple-tree/flexList.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -0
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +34 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +54 -3
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -4
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- 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 +3 -7
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +7 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +13 -5
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/cloneWithReplacements.d.ts +21 -0
- package/lib/util/cloneWithReplacements.d.ts.map +1 -0
- package/lib/util/cloneWithReplacements.js +34 -0
- package/lib/util/cloneWithReplacements.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/referenceCounting.d.ts +18 -0
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/package.json +22 -22
- package/src/core/forest/editableForest.ts +1 -52
- package/src/core/forest/forest.ts +17 -2
- package/src/core/forest/index.ts +0 -1
- package/src/core/index.ts +4 -2
- package/src/core/tree/anchorSet.ts +41 -10
- package/src/core/tree/delta.ts +8 -25
- package/src/core/tree/deltaUtil.ts +5 -5
- package/src/core/tree/index.ts +4 -1
- package/src/core/tree/pathTree.ts +72 -1
- package/src/core/tree/visitDelta.ts +38 -17
- package/src/core/tree/visitorUtils.ts +22 -36
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +19 -8
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +9 -4
- package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -2
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
- package/src/feature-libraries/default-schema/index.ts +2 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
- package/src/feature-libraries/deltaUtils.ts +1 -1
- package/src/feature-libraries/flex-tree/context.ts +4 -4
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
- package/src/feature-libraries/flex-tree/lazyField.ts +19 -10
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
- package/src/feature-libraries/index.ts +10 -8
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
- package/src/feature-libraries/initializeForest.ts +55 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +12 -28
- package/src/feature-libraries/node-identifier/README.md +11 -0
- package/src/feature-libraries/node-identifier/index.ts +17 -0
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
- package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
- package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
- package/src/feature-libraries/object-forest/objectForest.ts +10 -3
- package/src/feature-libraries/treeCursorUtils.ts +1 -1
- package/src/index.ts +17 -10
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
- package/src/shared-tree/independentView.ts +5 -29
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizeTree.ts +3 -2
- package/src/shared-tree/schematizingTreeView.ts +3 -3
- package/src/shared-tree/sharedTree.ts +13 -9
- package/src/shared-tree/sharedTreeChangeFamily.ts +0 -1
- package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
- package/src/shared-tree/treeApiAlpha.ts +15 -78
- package/src/shared-tree/treeCheckout.ts +2 -2
- package/src/simple-tree/api/conciseTree.ts +25 -8
- package/src/simple-tree/api/create.ts +3 -3
- package/src/simple-tree/api/customTree.ts +59 -16
- package/src/simple-tree/api/index.ts +10 -1
- package/src/simple-tree/api/schemaFactory.ts +18 -32
- package/src/simple-tree/api/schemaFactoryAlpha.ts +12 -0
- package/src/simple-tree/api/schemaFromSimple.ts +68 -0
- package/src/simple-tree/api/simpleSchema.ts +10 -0
- package/src/simple-tree/api/tree.ts +13 -8
- package/src/simple-tree/api/treeNodeApi.ts +4 -17
- package/src/simple-tree/api/typesUnsafe.ts +15 -15
- package/src/simple-tree/api/verboseTree.ts +43 -55
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
- package/src/simple-tree/flexList.ts +4 -14
- package/src/simple-tree/index.ts +6 -0
- package/src/simple-tree/objectNode.ts +3 -0
- package/src/simple-tree/schemaTypes.ts +70 -4
- package/src/simple-tree/toMapTree.ts +6 -6
- package/src/simple-tree/toStoredSchema.ts +3 -6
- package/src/simple-tree/treeNodeValid.ts +16 -5
- package/src/util/cloneWithReplacements.ts +41 -0
- package/src/util/index.ts +2 -0
- package/src/util/referenceCounting.ts +18 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/dist/feature-libraries/node-key/index.d.ts +0 -8
- package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/index.js +0 -16
- package/dist/feature-libraries/node-key/index.js.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.js +0 -26
- package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
- package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/lib/feature-libraries/node-key/index.d.ts +0 -8
- package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/index.js +0 -8
- package/lib/feature-libraries/node-key/index.js.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.js +0 -22
- package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
- package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/src/feature-libraries/node-key/README.md +0 -11
- package/src/feature-libraries/node-key/index.ts +0 -17
- package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
- package/src/feature-libraries/node-key/nodeKey.ts +0 -47
- package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
- /package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexList.js","sourceRoot":"","sources":["../../src/simple-tree/flexList.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAiD;AACjD,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAU/C,gFAAgF;AAChF,SAAgB,MAAM,CAAO,IAAoB;IAChD,OAAO,OAAO,IAAI,KAAK,UAAU,IAAK,IAA6B,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AAC7F,CAAC;AAFD,wBAEC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAI,CAAI;IAChC,OAAO,MAAM,CAAC,CAAC,CAAC;QACf,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE;YACxC,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;SACf,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AATD,8BASC
|
|
1
|
+
{"version":3,"file":"flexList.js","sourceRoot":"","sources":["../../src/simple-tree/flexList.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAiD;AACjD,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAU/C,gFAAgF;AAChF,SAAgB,MAAM,CAAO,IAAoB;IAChD,OAAO,OAAO,IAAI,KAAK,UAAU,IAAK,IAA6B,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AAC7F,CAAC;AAFD,wBAEC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAI,CAAI;IAChC,OAAO,MAAM,CAAC,CAAC,CAAC;QACf,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE;YACxC,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;SACf,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AATD,8BASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/** A symbol used to identify a `MarkedEager`. */\nconst flexListEager = Symbol(\"FlexList Eager\");\n\n/**\n * An object that has been marked as eager (as opposed to lazy) when used as an item in a `FlexList`.\n * It will be considered to be an eager item in a `FlexList` even if it is a function.\n */\ninterface MarkedEager {\n\t[flexListEager]: true;\n}\n\n/** Returns true iff the given item is a function and is not a `MarkedEager`. */\nexport function isLazy<Item>(item: LazyItem<Item>): item is () => Item {\n\treturn typeof item === \"function\" && (item as Partial<MarkedEager>)[flexListEager] !== true;\n}\n\n/**\n * Mark the given object as an eager item in a `FlexList`.\n * @remarks\n * This only has an effect on function objects that would otherwise be considered to be lazy items in a `FlexList`.\n * @param t - The object to mark as eager.\n * @returns `t`, marked as eager if applicable.\n */\nexport function markEager<T>(t: T): T {\n\treturn isLazy(t)\n\t\t? Object.defineProperty(t, flexListEager, {\n\t\t\t\tvalue: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t})\n\t\t: t;\n}\n\n/**\n * A flexible way to list values.\n * Each item in the list can either be an \"eager\" **value** or a \"lazy\" **function that returns a value** (the latter allows cyclic references to work).\n * @privateRemarks\n * By default, items that are of type `\"function\"` will be considered lazy and all other items will be considered eager.\n * To force a `\"function\"` item to be treated as an eager item, call `markEager` before putting it in the list.\n * This is necessary e.g. when the eager list items are function types and the lazy items are functions that _return_ function types.\n * Our one use of FlexList has some special normalization logic, see {@link normalizeAllowedTypes}.\n * @system @public\n */\nexport type FlexList<Item = unknown> = readonly LazyItem<Item>[];\n\n/**\n * An \"eager\" or \"lazy\" Item in a `FlexList`.\n * Lazy items are wrapped in a function to allow referring to themselves before they are declared.\n * This makes recursive and co-recursive items possible.\n * @privateRemarks\n * `schemaTypes.ts`'s `evaluateLazySchema` (via {@link normalizeAllowedTypes})\n * applies caching for the only current use of this type.\n * @public\n */\nexport type LazyItem<Item = unknown> = Item | (() => Item);\n\n/**\n * Get the `Item` type from a `LazyItem<Item>`.\n * @system @public\n */\nexport type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result\n\t? Result\n\t: Item;\n\n/**\n * Normalize FlexList type to a union.\n * @system @public\n */\nexport type FlexListToUnion<TList extends FlexList> = ExtractItemType<TList[number]>;\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { typeNameSymbol, typeSchemaSymbol, type WithType, type TreeNodeSchema, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, type TreeChangeEvents, type TreeNode, type Unhydrated, type InternalTreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getOrCreateInnerNode, getKernel, } from "./core/index.js";
|
|
6
|
-
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, treeNodeApi, type TreeNodeApi, cursorFromInsertable, createFromInsertable, type NodeChangedData, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, comparePersistedSchemaInternal, ViewSchema, type Unenforced, type FieldHasDefaultUnsafe, type ObjectFromSchemaRecordUnsafe, type TreeObjectNodeUnsafe, type TreeFieldFromImplicitFieldUnsafe, type TreeNodeFromImplicitAllowedTypesUnsafe, type FieldSchemaUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type InsertableTypedNodeUnsafe, type NodeBuilderDataUnsafe, type NodeFromSchemaUnsafe, type ReadonlyMapInlined, type TreeNodeSchemaClassUnsafe, type TreeNodeSchemaUnsafe, type AllowedTypesUnsafe, type TreeNodeSchemaNonClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type TreeViewAlpha, type TreeBranch, type TreeBranchEvents, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type schemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, } from "./api/index.js";
|
|
7
|
-
export { type NodeFromSchema, isTreeNodeSchemaClass, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type ImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, FieldKind, FieldSchema, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, type NodeBuilderData, type DefaultProvider, type FieldProps, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type Insertable, type UnsafeUnknownSchema, normalizeAllowedTypes, type ApplyKindInput, type InsertableTreeNodeFromAllowedTypes, type Input, type ReadableField, type ReadSchema, type NodeSchemaOptions, type NodeSchemaMetadata, } from "./schemaTypes.js";
|
|
6
|
+
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, treeNodeApi, type TreeNodeApi, cursorFromInsertable, createFromInsertable, type NodeChangedData, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, comparePersistedSchemaInternal, ViewSchema, type Unenforced, type FieldHasDefaultUnsafe, type ObjectFromSchemaRecordUnsafe, type TreeObjectNodeUnsafe, type TreeFieldFromImplicitFieldUnsafe, type TreeNodeFromImplicitAllowedTypesUnsafe, type FieldSchemaUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type InsertableTypedNodeUnsafe, type NodeBuilderDataUnsafe, type NodeFromSchemaUnsafe, type ReadonlyMapInlined, type TreeNodeSchemaClassUnsafe, type TreeNodeSchemaUnsafe, type AllowedTypesUnsafe, type TreeNodeSchemaNonClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type TreeViewAlpha, type TreeBranch, type TreeBranchEvents, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type schemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, } from "./api/index.js";
|
|
7
|
+
export { type NodeFromSchema, isTreeNodeSchemaClass, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type ImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, FieldKind, FieldSchema, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, type NodeBuilderData, type DefaultProvider, type FieldProps, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type Insertable, type UnsafeUnknownSchema, normalizeAllowedTypes, type ApplyKindInput, type InsertableTreeNodeFromAllowedTypes, type Input, type ReadableField, type ReadSchema, type NodeSchemaOptions, type NodeSchemaMetadata, evaluateLazySchema, } from "./schemaTypes.js";
|
|
8
8
|
export { getTreeNodeForField, prepareContentForHydration, } from "./proxies.js";
|
|
9
9
|
export { TreeArrayNode, IterableTreeArrayContent, type ReadonlyArrayNode, } from "./arrayNode.js";
|
|
10
10
|
export { type FieldHasDefault, type InsertableObjectFromSchemaRecord, type ObjectFromSchemaRecord, type TreeObjectNode, setField, createUnknownOptionalFieldPolicy, } from "./objectNode.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAGrB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,aAAa,EACb,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAA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ACvB,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,sBAAsB,EACtB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAGrB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,aAAa,EACb,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,SAAS,EACT,eAAe,EACf,eAAe,EACf,oBA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AAC;AACtB,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,KAAK,iBAAiB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,QAAQ,EACR,gCAAgC,GAChC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EACN,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getStoredSchema = exports.toStoredSchema = exports.mapTreeFromNodeData = exports.createUnknownOptionalFieldPolicy = exports.setField = exports.IterableTreeArrayContent = void 0;
|
|
7
|
+
exports.areImplicitFieldSchemaEqual = exports.areFieldSchemaEqual = exports.normalizeFieldSchema = exports.FieldSchema = exports.FieldKind = exports.isTreeNodeSchemaClass = exports.replaceVerboseTreeHandles = exports.replaceHandles = exports.replaceConciseTreeHandles = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.asTreeViewAlpha = exports.createFromCursor = exports.conciseFromCursor = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.tryGetSchema = exports.ViewSchema = exports.comparePersistedSchemaInternal = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.createFromInsertable = exports.cursorFromInsertable = exports.treeNodeApi = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.getKernel = exports.getOrCreateInnerNode = exports.SimpleContextSlot = exports.HydratedContext = exports.tryDisposeTreeNode = exports.isTreeNode = exports.NodeKind = exports.typeSchemaSymbol = exports.typeNameSymbol = void 0;
|
|
8
|
+
exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getStoredSchema = exports.toStoredSchema = exports.mapTreeFromNodeData = exports.createUnknownOptionalFieldPolicy = exports.setField = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.prepareContentForHydration = exports.getTreeNodeForField = exports.evaluateLazySchema = exports.normalizeAllowedTypes = void 0;
|
|
9
9
|
var index_js_1 = require("./core/index.js");
|
|
10
10
|
Object.defineProperty(exports, "typeNameSymbol", { enumerable: true, get: function () { return index_js_1.typeNameSymbol; } });
|
|
11
11
|
Object.defineProperty(exports, "typeSchemaSymbol", { enumerable: true, get: function () { return index_js_1.typeSchemaSymbol; } });
|
|
@@ -48,6 +48,10 @@ Object.defineProperty(exports, "asTreeViewAlpha", { enumerable: true, get: funct
|
|
|
48
48
|
Object.defineProperty(exports, "customFromCursorStored", { enumerable: true, get: function () { return index_js_2.customFromCursorStored; } });
|
|
49
49
|
Object.defineProperty(exports, "tryStoredSchemaAsArray", { enumerable: true, get: function () { return index_js_2.tryStoredSchemaAsArray; } });
|
|
50
50
|
Object.defineProperty(exports, "rollback", { enumerable: true, get: function () { return index_js_2.rollback; } });
|
|
51
|
+
Object.defineProperty(exports, "generateSchemaFromSimpleSchema", { enumerable: true, get: function () { return index_js_2.generateSchemaFromSimpleSchema; } });
|
|
52
|
+
Object.defineProperty(exports, "replaceConciseTreeHandles", { enumerable: true, get: function () { return index_js_2.replaceConciseTreeHandles; } });
|
|
53
|
+
Object.defineProperty(exports, "replaceHandles", { enumerable: true, get: function () { return index_js_2.replaceHandles; } });
|
|
54
|
+
Object.defineProperty(exports, "replaceVerboseTreeHandles", { enumerable: true, get: function () { return index_js_2.replaceVerboseTreeHandles; } });
|
|
51
55
|
var schemaTypes_js_1 = require("./schemaTypes.js");
|
|
52
56
|
Object.defineProperty(exports, "isTreeNodeSchemaClass", { enumerable: true, get: function () { return schemaTypes_js_1.isTreeNodeSchemaClass; } });
|
|
53
57
|
Object.defineProperty(exports, "FieldKind", { enumerable: true, get: function () { return schemaTypes_js_1.FieldKind; } });
|
|
@@ -56,6 +60,7 @@ Object.defineProperty(exports, "normalizeFieldSchema", { enumerable: true, get:
|
|
|
56
60
|
Object.defineProperty(exports, "areFieldSchemaEqual", { enumerable: true, get: function () { return schemaTypes_js_1.areFieldSchemaEqual; } });
|
|
57
61
|
Object.defineProperty(exports, "areImplicitFieldSchemaEqual", { enumerable: true, get: function () { return schemaTypes_js_1.areImplicitFieldSchemaEqual; } });
|
|
58
62
|
Object.defineProperty(exports, "normalizeAllowedTypes", { enumerable: true, get: function () { return schemaTypes_js_1.normalizeAllowedTypes; } });
|
|
63
|
+
Object.defineProperty(exports, "evaluateLazySchema", { enumerable: true, get: function () { return schemaTypes_js_1.evaluateLazySchema; } });
|
|
59
64
|
var proxies_js_1 = require("./proxies.js");
|
|
60
65
|
Object.defineProperty(exports, "getTreeNodeForField", { enumerable: true, get: function () { return proxies_js_1.getTreeNodeForField; } });
|
|
61
66
|
Object.defineProperty(exports, "prepareContentForHydration", { enumerable: true, get: function () { return proxies_js_1.prepareContentForHydration; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,4CAqByB;AApBxB,0GAAA,cAAc,OAAA;AACd,4GAAA,gBAAgB,OAAA;AAGhB,oGAAA,QAAQ,OAAA;AAUR,sGAAA,UAAU,OAAA;AACV,8GAAA,kBAAkB,OAAA;AAClB,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AACpB,qGAAA,SAAS,OAAA;AAEV,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,4CAqByB;AApBxB,0GAAA,cAAc,OAAA;AACd,4GAAA,gBAAgB,OAAA;AAGhB,oGAAA,QAAQ,OAAA;AAUR,sGAAA,UAAU,OAAA;AACV,8GAAA,kBAAkB,OAAA;AAClB,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AACpB,qGAAA,SAAS,OAAA;AAEV,2CAoHwB;AA/GvB,iHAAA,qBAAqB,OAAA;AAIrB,yGAAA,aAAa,OAAA;AACb,8GAAA,kBAAkB,OAAA;AAKlB,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAC5B,uGAAA,WAAW,OAAA;AAEX,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AAEpB,oGAAA,QAAQ,OAAA;AAIR,iHAAA,qBAAqB,OAAA;AACrB,iHAAA,qBAAqB,OAAA;AAsBrB,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA;AAKf,kHAAA,sBAAsB,OAAA;AACtB,kHAAA,sBAAsB,OAAA;AAEtB,0HAAA,8BAA8B,OAAA;AAC9B,sGAAA,UAAU,OAAA;AAyBV,wGAAA,YAAY,OAAA;AACZ,sHAAA,0BAA0B,OAAA;AAC1B,6GAAA,iBAAiB,OAAA;AACjB,6GAAA,iBAAiB,OAAA;AACjB,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,2GAAA,eAAe,OAAA;AACf,kHAAA,sBAAsB,OAAA;AAGtB,kHAAA,sBAAsB,OAAA;AAYtB,oGAAA,QAAQ,OAAA;AACR,0HAAA,8BAA8B,OAAA;AAC9B,qHAAA,yBAAyB,OAAA;AACzB,0GAAA,cAAc,OAAA;AACd,qHAAA,yBAAyB,OAAA;AAG1B,mDAkC0B;AAhCzB,uHAAA,qBAAqB,OAAA;AAQrB,2GAAA,SAAS,OAAA;AACT,6GAAA,WAAW,OAAA;AAMX,sHAAA,oBAAoB,OAAA;AACpB,qHAAA,mBAAmB,OAAA;AACnB,6HAAA,2BAA2B,OAAA;AAM3B,uHAAA,qBAAqB,OAAA;AAQrB,oHAAA,kBAAkB,OAAA;AAEnB,2CAGsB;AAFrB,iHAAA,mBAAmB,OAAA;AACnB,wHAAA,0BAA0B,OAAA;AAE3B,+CAIwB;AAHvB,6GAAA,aAAa,OAAA;AACb,wHAAA,wBAAwB,OAAA;AAGzB,iDAOyB;AAFxB,yGAAA,QAAQ,OAAA;AACR,iIAAA,gCAAgC,OAAA;AAGjC,+CAKwB;AAJvB,mHAAA,mBAAmB,OAAA;AAKpB,yDAAsE;AAA7D,mHAAA,cAAc,OAAA;AAAE,oHAAA,eAAe,OAAA;AACxC,yDAM6B;AAL5B,iHAAA,YAAY,OAAA;AACZ,iHAAA,YAAY,OAAA;AACZ,kHAAA,aAAa,OAAA;AACb,iHAAA,YAAY,OAAA;AACZ,+GAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype TreeNodeSchemaCore,\n\ttype TreeChangeEvents,\n\t// TreeNode is only type exported, which prevents use of the class object for unsupported use-cases like direct sub-classing and instanceof.\n\t// See docs on TreeNode for more details.\n\ttype TreeNode,\n\ttype Unhydrated,\n\ttype InternalTreeNode,\n\tisTreeNode,\n\ttryDisposeTreeNode,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tgetOrCreateInnerNode,\n\tgetKernel,\n} from \"./core/index.js\";\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\tcursorFromInsertable,\n\tcreateFromInsertable,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\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\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\tgetSimpleSchema,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\tcomparePersistedSchemaInternal,\n\tViewSchema,\n\ttype Unenforced,\n\ttype FieldHasDefaultUnsafe,\n\ttype ObjectFromSchemaRecordUnsafe,\n\ttype TreeObjectNodeUnsafe,\n\ttype TreeFieldFromImplicitFieldUnsafe,\n\ttype TreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype InsertableTypedNodeUnsafe,\n\ttype NodeBuilderDataUnsafe,\n\ttype NodeFromSchemaUnsafe,\n\ttype ReadonlyMapInlined,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype TreeNodeSchemaUnsafe,\n\ttype AllowedTypesUnsafe,\n\ttype TreeNodeSchemaNonClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\ttryGetSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\tconciseFromCursor,\n\tcreateFromCursor,\n\tasTreeViewAlpha,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\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\tgenerateSchemaFromSimpleSchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n} from \"./api/index.js\";\nexport {\n\ttype NodeFromSchema,\n\tisTreeNodeSchemaClass,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\ttype AllowedTypes,\n\tFieldKind,\n\tFieldSchema,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\ttype NodeBuilderData,\n\ttype DefaultProvider,\n\ttype FieldProps,\n\tnormalizeFieldSchema,\n\tareFieldSchemaEqual,\n\tareImplicitFieldSchemaEqual,\n\ttype ApplyKind,\n\ttype FieldSchemaMetadata,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype UnsafeUnknownSchema,\n\tnormalizeAllowedTypes,\n\ttype ApplyKindInput,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n\tevaluateLazySchema,\n} from \"./schemaTypes.js\";\nexport {\n\tgetTreeNodeForField,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nexport {\n\tTreeArrayNode,\n\tIterableTreeArrayContent,\n\ttype ReadonlyArrayNode,\n} from \"./arrayNode.js\";\nexport {\n\ttype FieldHasDefault,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype ObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tsetField,\n\tcreateUnknownOptionalFieldPolicy,\n} from \"./objectNode.js\";\nexport type { TreeMapNode, MapNodeInsertableData } from \"./mapNode.js\";\nexport {\n\tmapTreeFromNodeData,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n} from \"./toMapTree.js\";\nexport { toStoredSchema, getStoredSchema } from \"./toStoredSchema.js\";\nexport {\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n} from \"./leafNodeSchema.js\";\nexport type { LazyItem, FlexList, FlexListToUnion, ExtractItemType } from \"./flexList.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAEN,KAAK,aAAa,EAKlB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,KAAK,mBAAmB,EAGxB,KAAK,0BAA0B,EAC/B,KAAK,oCAAoC,EACzC,KAAK,WAAW,EAGhB,SAAS,EACT,KAAK,kBAAkB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,QAAQ,EACR,KAAK,QAAQ,EAKb,KAAK,QAAQ,EAIb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,KAAK,uBAAuB,EAAQ,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,MAAM,sBAAsB,CAAC;AAI9B;;;GAGG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,uBAAuB,CAAC,mBAAmB,CAAC,IAAI;IAC5F,CAAC,UAAU,QAAQ,IAAI,MAAM,CAA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KAAK,GAAG,oCAAoC,CAAC,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC;CACrE,CACD,CAAC;AAEJ;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,CACrC,MAAM,GAAG,MAAM,EACf;IAAE,SAAS,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAC5C,CAAC;AA2IF,wBAAgB,QAAQ,CACvB,KAAK,EAAE,aAAa,EACpB,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAClC,IAAI,CA4BN;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC3B,KAAK,SAAS,MAAM,EACpB,KAAK,CAAC,CAAC,SAAS,uBAAuB,CAAC,mBAAmB,CAAC,EAC5D,KAAK,CAAC,uBAAuB,SAAS,OAAO,EAC7C,KAAK,CAAC,eAAe,GAAG,OAAO,EAE/B,UAAU,EAAE,KAAK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,0BAA0B,EAAE,OAAO,EACnC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAC5C,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,uBAAuB,EAAE,eAAe,CAAC,GACtE,4BAA4B,CAgJ5B;AA0CD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,EAAE,mBAAmB,GACzB,YAAY,CAAC,4BAA4B,CAAC,CAU5C"}
|
|
@@ -156,6 +156,8 @@ CustomObjectNodeBase.kind = index_js_2.NodeKind.Object;
|
|
|
156
156
|
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
157
157
|
*/
|
|
158
158
|
function objectSchema(identifier, info, implicitlyConstructable, allowUnknownOptionalFields, metadata) {
|
|
159
|
+
// Field set can't be modified after this since derived data is stored in maps.
|
|
160
|
+
Object.freeze(info);
|
|
159
161
|
// Ensure no collisions between final set of property keys, and final set of stored keys (including those
|
|
160
162
|
// implicitly derived from property keys)
|
|
161
163
|
assertUniqueKeys(identifier, info);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectNode.js","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,uEAAsE;AAGtE,4DAOuC;AACvC,6CAA+E;AAC/E,qDAW0B;AAC1B,8CAYyB;AACzB,iDAA6E;AAC7E,+CAAwF;AACxF,6DAI8B;AAC9B,yDAAyE;AACzE,yDAA0D;AA+F1D;;GAEG;AACH,SAAS,oBAAoB,CAAC,MAA2C;IACxE,MAAM,MAAM,GAAuE,IAAI,GAAG,EAAE,CAAC;IAC7F,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,IAAA,qCAAoB,EAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,SAAS,kBAAkB,CAC1B,MAAuD,EACvD,yBAAkC;IAElC,kGAAkG;IAClG,kGAAkG;IAClG,sEAAsE;IACtE,EAAE;IACF,sGAAsG;IACtG,wFAAwF;IAExF,kGAAkG;IAClG,uDAAuD;IACvD,MAAM,OAAO,GAA2B;QACvC,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK;YAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAErD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,IAAA,+BAAoB,EAAC,KAAK,CA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ED;;;GAGG;AACH,SAAgB,gCAAgC,CAC/C,MAA2B;IAE3B,MAAM,OAAO,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,UAAU,EAAE,EAAE;QACrB,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACpD,OAAO,CACN,YAAY,KAAK,SAAS;YAC1B,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAChC,YAAY,CAAC,0BAA0B,CACvC,CAAC;IACH,CAAC,CAAC;AACH,CAAC;AAZD,4EAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { FieldKey, SchemaPolicy } from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\tgetSchemaAndPolicy,\n} from \"../feature-libraries/index.js\";\nimport { getTreeNodeForField, prepareContentForHydration } from \"./proxies.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\tgetStoredKey,\n\tgetExplicitStoredKey,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype FieldSchema,\n\tnormalizeFieldSchema,\n\ttype ImplicitAllowedTypes,\n\tFieldKind,\n\ttype NodeSchemaMetadata,\n} from \"./schemaTypes.js\";\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype InternalTreeNode,\n\ttype TreeNode,\n\ttype Context,\n\tUnhydratedFlexTreeNode,\n\tgetOrCreateInnerNode,\n} from \"./core/index.js\";\nimport { mapTreeFromNodeData, type InsertableContent } from \"./toMapTree.js\";\nimport { type RestrictiveStringRecord, fail, type FlattenKeys } from \"../util/index.js\";\nimport {\n\tisObjectNodeSchema,\n\ttype ObjectNodeSchema,\n\ttype ObjectNodeSchemaInternalData,\n} from \"./objectNodeTypes.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * Generates the properties for an ObjectNode from its field schema object.\n * @system @public\n */\nexport type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {\n\t-readonly [Property in keyof T]: Property extends string\n\t\t? TreeFieldFromImplicitField<T[Property]>\n\t\t: unknown;\n};\n\n/**\n * A {@link TreeNode} which modules a JavaScript object.\n * @remarks\n * Object nodes consist of a type which specifies which {@link TreeNodeSchema} they use (see {@link TreeNodeApi.schema}), and a collections of fields, each with a distinct `key` and its own {@link FieldSchema} defining what can be placed under that key.\n *\n * All fields on an object node are exposed as own properties with string keys.\n * Non-empty fields are enumerable and empty optional fields are non-enumerable own properties with the value `undefined`.\n * No other own `own` or `enumerable` properties are included on object nodes unless the user of the node manually adds custom session only state.\n * This allows a majority of general purpose JavaScript object processing operations (like `for...in`, `Reflect.ownKeys()` and `Object.entries()`) to enumerate all the children.\n * @public\n */\nexport type TreeObjectNode<\n\tT extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;\n\n/**\n * Type utility for determining whether or not an implicit field schema has a default value.\n *\n * @privateRemarks\n * TODO: Account for field schemas with default value providers.\n * For now, this only captures field kinds that we know always have defaults - optional fields and identifier fields.\n *\n * @system @public\n */\nexport type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<\n\tFieldKind.Optional | FieldKind.Identifier\n>\n\t? true\n\t: false;\n\n/**\n * Helper used to produce types for:\n *\n * 1. Insertable content which can be used to construct an object node.\n * In this case, only own properties are considered.\n * This reduces the risk of incorrectly interpreting data at the cost of occasionally requiring users to convert data into a compatible format.\n *\n * 2. Insertable content which is an unhydrated object node.\n *\n * 3. Union of 1 and 2.\n *\n * @see {@link Input}\n *\n * @privateRemarks\n * TODO: consider separating these cases into different types.\n *\n * Empty objects don't get \"no excess property\" checks in literals.\n * To prevent extraneous properties in literals for the fields of an empty object from compiling, the empty case is special cased to produce `Record<string, never>`.\n * More details at {@link https://mercury.com/blog/creating-an-emptyobject-type-in-typescript}.\n *\n * @system @public\n */\nexport type InsertableObjectFromSchemaRecord<\n\tT extends RestrictiveStringRecord<ImplicitFieldSchema>,\n> = Record<string, never> extends T\n\t? Record<string, never>\n\t: FlattenKeys<\n\t\t\t{\n\t\t\t\treadonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\tT[Property & string]\n\t\t\t\t>;\n\t\t\t} & {\n\t\t\t\t// Field does not have a known default, make it required:\n\t\t\t\treadonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;\n\t\t\t}\n\t\t>;\n\n/**\n * Maps from simple field keys (\"property\" keys) to information about the field.\n *\n * @remarks\n * A missing entry for a given property key indicates that no such field exists.\n * Keys with symbols are currently never used, but allowed to make lookups on non-field things\n * (returning undefined) easier.\n */\nexport type SimpleKeyMap = ReadonlyMap<\n\tstring | symbol,\n\t{ storedKey: FieldKey; schema: FieldSchema }\n>;\n\n/**\n * Caches the mappings from property keys to stored keys for the provided object field schemas in {@link simpleKeyToFlexKeyCache}.\n */\nfunction createFlexKeyMapping(fields: Record<string, ImplicitFieldSchema>): SimpleKeyMap {\n\tconst keyMap: Map<string | symbol, { storedKey: FieldKey; schema: FieldSchema }> = new Map();\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(propertyKey, fieldSchema);\n\t\tkeyMap.set(propertyKey, { storedKey, schema: normalizeFieldSchema(fieldSchema) });\n\t}\n\n\treturn keyMap;\n}\n\n/**\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * TODO: consider implementing this using `Object.preventExtension` instead.\n * @param customTargetObject - Target object of the proxy.\n * If not provided `{}` is used for the target.\n */\nfunction createProxyHandler(\n\tschema: ObjectNodeSchema & ObjectNodeSchemaInternalData,\n\tallowAdditionalProperties: boolean,\n): ProxyHandler<TreeNode> {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an object with the same\n\t// prototype as an object literal '{}'. This is because 'deepEquals' uses 'Object.getPrototypeOf'\n\t// as a way to quickly reject objects with different prototype chains.\n\t//\n\t// (Note that the prototype of an object literal appears as '[Object: null prototype] {}', not because\n\t// the prototype is null, but because the prototype object itself has a null prototype.)\n\n\t// TODO: Although the target is an object literal, it's still worthwhile to try experimenting with\n\t// a dispatch object to see if it improves performance.\n\tconst handler: ProxyHandler<TreeNode> = {\n\t\tget(target, propertyKey, proxy): unknown {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\n\t\t\tif (fieldInfo !== undefined) {\n\t\t\t\tconst flexNode = getOrCreateInnerNode(proxy);\n\t\t\t\tconst field = flexNode.tryGetField(fieldInfo.storedKey);\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn getTreeNodeForField(field);\n\t\t\t\t}\n\n\t\t\t\t// TODO: this special case logic should move to the inner node (who's schema claims it has an identifier), rather than here, after we already read undefined out of a required field.\n\t\t\t\t// Check if the user is trying to read an identifier field of an unhydrated node, but the identifier is not present.\n\t\t\t\t// This means the identifier is an \"auto-generated identifier\", because otherwise it would have been supplied by the user at construction time and would have been successfully read just above.\n\t\t\t\t// In this case, it is categorically impossible to provide an identifier (auto-generated identifiers can't be created until hydration/insertion time), so we emit an error.\n\t\t\t\tif (\n\t\t\t\t\tfieldInfo.schema.kind === FieldKind.Identifier &&\n\t\t\t\t\tflexNode instanceof UnhydratedFlexTreeNode\n\t\t\t\t) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"An automatically generated node identifier may not be queried until the node is inserted into the tree\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// POJO mode objects don't have TreeNode's build in members on their targets, so special case them:\n\t\t\tif (propertyKey === typeSchemaSymbol) {\n\t\t\t\treturn schema;\n\t\t\t}\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tif (propertyKey === typeNameSymbol) {\n\t\t\t\treturn schema.identifier;\n\t\t\t}\n\n\t\t\t// Pass the proxy as the receiver here, so that any methods on the prototype receive `proxy` as `this`.\n\t\t\treturn Reflect.get(target, propertyKey, proxy);\n\t\t},\n\t\tset(target, propertyKey, value: InsertableContent | undefined, proxy) {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\t// Pass the proxy as the receiver here, so that setters on the prototype receive `proxy` as `this`.\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.set(target, propertyKey, value, proxy)\n\t\t\t\t\t: false;\n\t\t\t}\n\n\t\t\tsetField(\n\t\t\t\tgetOrCreateInnerNode(proxy).getBoxed(fieldInfo.storedKey),\n\t\t\t\tfieldInfo.schema,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, propertyKey): boolean {\n\t\t\t// TODO: supporting delete when it makes sense (custom local fields, and optional field) could be added as a feature in the future.\n\t\t\tthrow new UsageError(\n\t\t\t\t`Object nodes do not support the delete operator. Optional fields can be assigned to undefined instead.`,\n\t\t\t);\n\t\t},\n\t\thas: (target, propertyKey) => {\n\t\t\treturn (\n\t\t\t\tschema.flexKeyMap.has(propertyKey) ||\n\t\t\t\t(allowAdditionalProperties ? Reflect.has(target, propertyKey) : false)\n\t\t\t);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\treturn [\n\t\t\t\t...schema.flexKeyMap.keys(),\n\t\t\t\t...(allowAdditionalProperties ? Reflect.ownKeys(target) : []),\n\t\t\t];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, propertyKey) => {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.getOwnPropertyDescriptor(target, propertyKey)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\n\t\t\t// For some reason, the getOwnPropertyDescriptor is not passed in the receiver, so use a weak map.\n\t\t\t// If a refactoring is done to associated flex tree data with the target not the proxy, this extra map could be removed,\n\t\t\t// and the design would be more compatible with proxyless nodes.\n\t\t\tconst proxy = targetToProxy.get(target) ?? fail(0xadd /* missing proxy */);\n\t\t\tconst field = getOrCreateInnerNode(proxy).tryGetField(fieldInfo.storedKey);\n\n\t\t\tconst p: PropertyDescriptor = {\n\t\t\t\tvalue: field === undefined ? undefined : getTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\t// Report empty fields as own properties so they shadow inherited properties (even when empty) to match TypeScript typing.\n\t\t\t\t// Make empty fields not enumerable so they get skipped when iterating over an object to better align with\n\t\t\t\t// JSON and deep equals with JSON compatible object (which can't have undefined fields).\n\t\t\t\tenumerable: field !== undefined,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\n\t\t\treturn p;\n\t\t},\n\t};\n\treturn handler;\n}\n\nexport function setField(\n\tfield: FlexTreeField,\n\tsimpleFieldSchema: FieldSchema,\n\tvalue: InsertableContent | undefined,\n): void {\n\tconst mapTree = mapTreeFromNodeData(\n\t\tvalue,\n\t\tsimpleFieldSchema,\n\t\tfield.context.isHydrated() ? field.context.nodeKeyManager : undefined,\n\t\tgetSchemaAndPolicy(field),\n\t);\n\n\tif (field.context.isHydrated()) {\n\t\tprepareContentForHydration(mapTree, field.context.checkout.forest);\n\t}\n\n\tswitch (field.schema) {\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tassert(mapTree !== undefined, 0xa04 /* Cannot set a required field to undefined */);\n\t\t\tconst typedField = field as FlexTreeRequiredField;\n\t\t\ttypedField.editor.set(mapTree);\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tconst typedField = field as FlexTreeOptionalField;\n\t\t\ttypedField.editor.set(mapTree, typedField.length === 0);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(0xade /* invalid FieldKind */);\n\t}\n}\n\nabstract class CustomObjectNodeBase<\n\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n> extends TreeNodeValid<InsertableObjectFromSchemaRecord<T>> {\n\tpublic static readonly kind = NodeKind.Object;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeObjectNode}.\n *\n * @param name - Unique identifier for this schema within this factory's scope.\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n */\nexport function objectSchema<\n\tTName extends string,\n\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tallowUnknownOptionalFields: boolean,\n\tmetadata?: NodeSchemaMetadata<TCustomMetadata>,\n): ObjectNodeSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\tObjectNodeSchemaInternalData {\n\t// Ensure no collisions between final set of property keys, and final set of stored keys (including those\n\t// implicitly derived from property keys)\n\tassertUniqueKeys(identifier, info);\n\n\t// Performance optimization: cache property key => stored key and schema.\n\tconst flexKeyMap: SimpleKeyMap = createFlexKeyMapping(info);\n\n\tconst identifierFieldKeys: FieldKey[] = [];\n\tfor (const item of flexKeyMap.values()) {\n\t\tif (item.schema.kind === FieldKind.Identifier) {\n\t\t\tidentifierFieldKeys.push(item.storedKey);\n\t\t}\n\t}\n\n\tconst lazyChildTypes = new Lazy(\n\t\t() => new Set(Array.from(flexKeyMap.values(), (f) => [...f.schema.allowedTypeSet]).flat()),\n\t);\n\n\tlet handler: ProxyHandler<object>;\n\tlet customizable: boolean;\n\tlet unhydratedContext: Context;\n\n\tclass CustomObjectNode extends CustomObjectNodeBase<T> {\n\t\tpublic static readonly fields: ReadonlyMap<string, FieldSchema> = new Map(\n\t\t\tArray.from(flexKeyMap, ([key, value]) => [key as string, value.schema]),\n\t\t);\n\t\tpublic static readonly flexKeyMap: SimpleKeyMap = flexKeyMap;\n\t\tpublic static readonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string> = new Map<\n\t\t\tFieldKey,\n\t\t\tstring\n\t\t>(\n\t\t\tArray.from(flexKeyMap, ([key, value]): [FieldKey, string] => [\n\t\t\t\tvalue.storedKey,\n\t\t\t\tkey as string,\n\t\t\t]),\n\t\t);\n\t\tpublic static readonly identifierFieldKeys: readonly FieldKey[] = identifierFieldKeys;\n\t\tpublic static readonly allowUnknownOptionalFields: boolean = allowUnknownOptionalFields;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.object(\"Foo\", {bar: schemaFactory.number});\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Object)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.object(\"Foo\", {bar: schemaFactory.number}) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\tconst proxy = new Proxy(proxyTarget, handler) as CustomObjectNode;\n\t\t\ttargetToProxy.set(proxyTarget, proxy);\n\t\t\treturn proxy;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn UnhydratedFlexTreeNode.getOrCreate(\n\t\t\t\tunhydratedContext,\n\t\t\t\tmapTreeFromNodeData(input as object, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {\n\t\t\t// One time initialization that required knowing the most derived type (from this.constructor) and thus has to be lazy.\n\t\t\tcustomizable = (this as unknown) !== CustomObjectNode;\n\t\t\tconst schema = this as unknown as ObjectNodeSchema & ObjectNodeSchemaInternalData;\n\t\t\thandler = createProxyHandler(schema, customizable);\n\t\t\tunhydratedContext = getUnhydratedContext(schema);\n\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== CustomObjectNode.prototype) {\n\t\t\t\t\tfor (const [key] of flexKeyMap) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which shadows a field. Since fields are exposed as own properties, this shadowing will not work, and is an error.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomObjectNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomObjectNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unhydratedContext;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> | undefined =\n\t\t\tmetadata;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn CustomObjectNode.constructorCached?.constructor as unknown as Output;\n\t\t}\n\t}\n\ttype Output = typeof CustomObjectNode &\n\t\t(new (\n\t\t\tinput: InsertableObjectFromSchemaRecord<T> | InternalTreeNode,\n\t\t) => TreeObjectNode<T, TName>);\n\treturn CustomObjectNode as Output;\n}\n\nconst targetToProxy: WeakMap<object, TreeNode> = new WeakMap();\n\n/**\n * Ensures that the set of property keys in the schema is unique.\n * Also ensure that the final set of stored keys (including those implicitly derived from property keys) is unique.\n * @throws Throws a `UsageError` if either of the key uniqueness invariants is violated.\n */\nfunction assertUniqueKeys<\n\tconst Name extends number | string,\n\tconst Fields extends RestrictiveStringRecord<ImplicitFieldSchema>,\n>(schemaName: Name, fields: Fields): void {\n\t// Verify that there are no duplicates among the explicitly specified stored keys.\n\tconst explicitStoredKeys = new Set<string>();\n\tfor (const schema of Object.values(fields)) {\n\t\tconst storedKey = getExplicitStoredKey(schema);\n\t\tif (storedKey === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (explicitStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Duplicate stored key \"${storedKey}\" in schema \"${schemaName}\". Stored keys must be unique within an object schema.`,\n\t\t\t);\n\t\t}\n\t\texplicitStoredKeys.add(storedKey);\n\t}\n\n\t// Verify that there are no duplicates among the derived\n\t// (including those implicitly derived from property keys) stored keys.\n\tconst derivedStoredKeys = new Set<string>();\n\tfor (const [propertyKey, schema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(propertyKey, schema);\n\t\tif (derivedStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Stored key \"${storedKey}\" in schema \"${schemaName}\" conflicts with a property key of the same name, which is not overridden by a stored key. The final set of stored keys in an object schema must be unique.`,\n\t\t\t);\n\t\t}\n\t\tderivedStoredKeys.add(storedKey);\n\t}\n}\n\n/**\n * Creates a policy for allowing unknown optional fields on an object node which delegates to the policy defined\n * on the object node's internal schema data.\n */\nexport function createUnknownOptionalFieldPolicy(\n\tschema: ImplicitFieldSchema,\n): SchemaPolicy[\"allowUnknownOptionalFields\"] {\n\tconst context = getUnhydratedContext(schema);\n\treturn (identifier) => {\n\t\tconst storedSchema = context.schema.get(identifier);\n\t\treturn (\n\t\t\tstoredSchema !== undefined &&\n\t\t\tisObjectNodeSchema(storedSchema) &&\n\t\t\tstoredSchema.allowUnknownOptionalFields\n\t\t);\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"objectNode.js","source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AAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,UAAU,EAAE,EAAE;QACrB,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACpD,OAAO,CACN,YAAY,KAAK,SAAS;YAC1B,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAChC,YAAY,CAAC,0BAA0B,CACvC,CAAC;IACH,CAAC,CAAC;AACH,CAAC;AAZD,4EAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { FieldKey, SchemaPolicy } from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\tgetSchemaAndPolicy,\n} from \"../feature-libraries/index.js\";\nimport { getTreeNodeForField, prepareContentForHydration } from \"./proxies.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\tgetStoredKey,\n\tgetExplicitStoredKey,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype FieldSchema,\n\tnormalizeFieldSchema,\n\ttype ImplicitAllowedTypes,\n\tFieldKind,\n\ttype NodeSchemaMetadata,\n} from \"./schemaTypes.js\";\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype InternalTreeNode,\n\ttype TreeNode,\n\ttype Context,\n\tUnhydratedFlexTreeNode,\n\tgetOrCreateInnerNode,\n} from \"./core/index.js\";\nimport { mapTreeFromNodeData, type InsertableContent } from \"./toMapTree.js\";\nimport { type RestrictiveStringRecord, fail, type FlattenKeys } from \"../util/index.js\";\nimport {\n\tisObjectNodeSchema,\n\ttype ObjectNodeSchema,\n\ttype ObjectNodeSchemaInternalData,\n} from \"./objectNodeTypes.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * Generates the properties for an ObjectNode from its field schema object.\n * @system @public\n */\nexport type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {\n\t-readonly [Property in keyof T]: Property extends string\n\t\t? TreeFieldFromImplicitField<T[Property]>\n\t\t: unknown;\n};\n\n/**\n * A {@link TreeNode} which modules a JavaScript object.\n * @remarks\n * Object nodes consist of a type which specifies which {@link TreeNodeSchema} they use (see {@link TreeNodeApi.schema}), and a collections of fields, each with a distinct `key` and its own {@link FieldSchema} defining what can be placed under that key.\n *\n * All fields on an object node are exposed as own properties with string keys.\n * Non-empty fields are enumerable and empty optional fields are non-enumerable own properties with the value `undefined`.\n * No other own `own` or `enumerable` properties are included on object nodes unless the user of the node manually adds custom session only state.\n * This allows a majority of general purpose JavaScript object processing operations (like `for...in`, `Reflect.ownKeys()` and `Object.entries()`) to enumerate all the children.\n * @public\n */\nexport type TreeObjectNode<\n\tT extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;\n\n/**\n * Type utility for determining whether or not an implicit field schema has a default value.\n *\n * @privateRemarks\n * TODO: Account for field schemas with default value providers.\n * For now, this only captures field kinds that we know always have defaults - optional fields and identifier fields.\n *\n * @system @public\n */\nexport type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<\n\tFieldKind.Optional | FieldKind.Identifier\n>\n\t? true\n\t: false;\n\n/**\n * Helper used to produce types for:\n *\n * 1. Insertable content which can be used to construct an object node.\n * In this case, only own properties are considered.\n * This reduces the risk of incorrectly interpreting data at the cost of occasionally requiring users to convert data into a compatible format.\n *\n * 2. Insertable content which is an unhydrated object node.\n *\n * 3. Union of 1 and 2.\n *\n * @see {@link Input}\n *\n * @privateRemarks\n * TODO: consider separating these cases into different types.\n *\n * Empty objects don't get \"no excess property\" checks in literals.\n * To prevent extraneous properties in literals for the fields of an empty object from compiling, the empty case is special cased to produce `Record<string, never>`.\n * More details at {@link https://mercury.com/blog/creating-an-emptyobject-type-in-typescript}.\n *\n * @system @public\n */\nexport type InsertableObjectFromSchemaRecord<\n\tT extends RestrictiveStringRecord<ImplicitFieldSchema>,\n> = Record<string, never> extends T\n\t? Record<string, never>\n\t: FlattenKeys<\n\t\t\t{\n\t\t\t\treadonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\tT[Property & string]\n\t\t\t\t>;\n\t\t\t} & {\n\t\t\t\t// Field does not have a known default, make it required:\n\t\t\t\treadonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;\n\t\t\t}\n\t\t>;\n\n/**\n * Maps from simple field keys (\"property\" keys) to information about the field.\n *\n * @remarks\n * A missing entry for a given property key indicates that no such field exists.\n * Keys with symbols are currently never used, but allowed to make lookups on non-field things\n * (returning undefined) easier.\n */\nexport type SimpleKeyMap = ReadonlyMap<\n\tstring | symbol,\n\t{ storedKey: FieldKey; schema: FieldSchema }\n>;\n\n/**\n * Caches the mappings from property keys to stored keys for the provided object field schemas in {@link simpleKeyToFlexKeyCache}.\n */\nfunction createFlexKeyMapping(fields: Record<string, ImplicitFieldSchema>): SimpleKeyMap {\n\tconst keyMap: Map<string | symbol, { storedKey: FieldKey; schema: FieldSchema }> = new Map();\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(propertyKey, fieldSchema);\n\t\tkeyMap.set(propertyKey, { storedKey, schema: normalizeFieldSchema(fieldSchema) });\n\t}\n\n\treturn keyMap;\n}\n\n/**\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * TODO: consider implementing this using `Object.preventExtension` instead.\n * @param customTargetObject - Target object of the proxy.\n * If not provided `{}` is used for the target.\n */\nfunction createProxyHandler(\n\tschema: ObjectNodeSchema & ObjectNodeSchemaInternalData,\n\tallowAdditionalProperties: boolean,\n): ProxyHandler<TreeNode> {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an object with the same\n\t// prototype as an object literal '{}'. This is because 'deepEquals' uses 'Object.getPrototypeOf'\n\t// as a way to quickly reject objects with different prototype chains.\n\t//\n\t// (Note that the prototype of an object literal appears as '[Object: null prototype] {}', not because\n\t// the prototype is null, but because the prototype object itself has a null prototype.)\n\n\t// TODO: Although the target is an object literal, it's still worthwhile to try experimenting with\n\t// a dispatch object to see if it improves performance.\n\tconst handler: ProxyHandler<TreeNode> = {\n\t\tget(target, propertyKey, proxy): unknown {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\n\t\t\tif (fieldInfo !== undefined) {\n\t\t\t\tconst flexNode = getOrCreateInnerNode(proxy);\n\t\t\t\tconst field = flexNode.tryGetField(fieldInfo.storedKey);\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn getTreeNodeForField(field);\n\t\t\t\t}\n\n\t\t\t\t// TODO: this special case logic should move to the inner node (who's schema claims it has an identifier), rather than here, after we already read undefined out of a required field.\n\t\t\t\t// Check if the user is trying to read an identifier field of an unhydrated node, but the identifier is not present.\n\t\t\t\t// This means the identifier is an \"auto-generated identifier\", because otherwise it would have been supplied by the user at construction time and would have been successfully read just above.\n\t\t\t\t// In this case, it is categorically impossible to provide an identifier (auto-generated identifiers can't be created until hydration/insertion time), so we emit an error.\n\t\t\t\tif (\n\t\t\t\t\tfieldInfo.schema.kind === FieldKind.Identifier &&\n\t\t\t\t\tflexNode instanceof UnhydratedFlexTreeNode\n\t\t\t\t) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"An automatically generated node identifier may not be queried until the node is inserted into the tree\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// POJO mode objects don't have TreeNode's build in members on their targets, so special case them:\n\t\t\tif (propertyKey === typeSchemaSymbol) {\n\t\t\t\treturn schema;\n\t\t\t}\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tif (propertyKey === typeNameSymbol) {\n\t\t\t\treturn schema.identifier;\n\t\t\t}\n\n\t\t\t// Pass the proxy as the receiver here, so that any methods on the prototype receive `proxy` as `this`.\n\t\t\treturn Reflect.get(target, propertyKey, proxy);\n\t\t},\n\t\tset(target, propertyKey, value: InsertableContent | undefined, proxy) {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\t// Pass the proxy as the receiver here, so that setters on the prototype receive `proxy` as `this`.\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.set(target, propertyKey, value, proxy)\n\t\t\t\t\t: false;\n\t\t\t}\n\n\t\t\tsetField(\n\t\t\t\tgetOrCreateInnerNode(proxy).getBoxed(fieldInfo.storedKey),\n\t\t\t\tfieldInfo.schema,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, propertyKey): boolean {\n\t\t\t// TODO: supporting delete when it makes sense (custom local fields, and optional field) could be added as a feature in the future.\n\t\t\tthrow new UsageError(\n\t\t\t\t`Object nodes do not support the delete operator. Optional fields can be assigned to undefined instead.`,\n\t\t\t);\n\t\t},\n\t\thas: (target, propertyKey) => {\n\t\t\treturn (\n\t\t\t\tschema.flexKeyMap.has(propertyKey) ||\n\t\t\t\t(allowAdditionalProperties ? Reflect.has(target, propertyKey) : false)\n\t\t\t);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\treturn [\n\t\t\t\t...schema.flexKeyMap.keys(),\n\t\t\t\t...(allowAdditionalProperties ? Reflect.ownKeys(target) : []),\n\t\t\t];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, propertyKey) => {\n\t\t\tconst fieldInfo = schema.flexKeyMap.get(propertyKey);\n\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.getOwnPropertyDescriptor(target, propertyKey)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\n\t\t\t// For some reason, the getOwnPropertyDescriptor is not passed in the receiver, so use a weak map.\n\t\t\t// If a refactoring is done to associated flex tree data with the target not the proxy, this extra map could be removed,\n\t\t\t// and the design would be more compatible with proxyless nodes.\n\t\t\tconst proxy = targetToProxy.get(target) ?? fail(0xadd /* missing proxy */);\n\t\t\tconst field = getOrCreateInnerNode(proxy).tryGetField(fieldInfo.storedKey);\n\n\t\t\tconst p: PropertyDescriptor = {\n\t\t\t\tvalue: field === undefined ? undefined : getTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\t// Report empty fields as own properties so they shadow inherited properties (even when empty) to match TypeScript typing.\n\t\t\t\t// Make empty fields not enumerable so they get skipped when iterating over an object to better align with\n\t\t\t\t// JSON and deep equals with JSON compatible object (which can't have undefined fields).\n\t\t\t\tenumerable: field !== undefined,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\n\t\t\treturn p;\n\t\t},\n\t};\n\treturn handler;\n}\n\nexport function setField(\n\tfield: FlexTreeField,\n\tsimpleFieldSchema: FieldSchema,\n\tvalue: InsertableContent | undefined,\n): void {\n\tconst mapTree = mapTreeFromNodeData(\n\t\tvalue,\n\t\tsimpleFieldSchema,\n\t\tfield.context.isHydrated() ? field.context.nodeKeyManager : undefined,\n\t\tgetSchemaAndPolicy(field),\n\t);\n\n\tif (field.context.isHydrated()) {\n\t\tprepareContentForHydration(mapTree, field.context.checkout.forest);\n\t}\n\n\tswitch (field.schema) {\n\t\tcase FieldKinds.required.identifier: {\n\t\t\tassert(mapTree !== undefined, 0xa04 /* Cannot set a required field to undefined */);\n\t\t\tconst typedField = field as FlexTreeRequiredField;\n\t\t\ttypedField.editor.set(mapTree);\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional.identifier: {\n\t\t\tconst typedField = field as FlexTreeOptionalField;\n\t\t\ttypedField.editor.set(mapTree, typedField.length === 0);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(0xade /* invalid FieldKind */);\n\t}\n}\n\nabstract class CustomObjectNodeBase<\n\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n> extends TreeNodeValid<InsertableObjectFromSchemaRecord<T>> {\n\tpublic static readonly kind = NodeKind.Object;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeObjectNode}.\n *\n * @param name - Unique identifier for this schema within this factory's scope.\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n */\nexport function objectSchema<\n\tTName extends string,\n\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tallowUnknownOptionalFields: boolean,\n\tmetadata?: NodeSchemaMetadata<TCustomMetadata>,\n): ObjectNodeSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\tObjectNodeSchemaInternalData {\n\t// Field set can't be modified after this since derived data is stored in maps.\n\tObject.freeze(info);\n\n\t// Ensure no collisions between final set of property keys, and final set of stored keys (including those\n\t// implicitly derived from property keys)\n\tassertUniqueKeys(identifier, info);\n\n\t// Performance optimization: cache property key => stored key and schema.\n\tconst flexKeyMap: SimpleKeyMap = createFlexKeyMapping(info);\n\n\tconst identifierFieldKeys: FieldKey[] = [];\n\tfor (const item of flexKeyMap.values()) {\n\t\tif (item.schema.kind === FieldKind.Identifier) {\n\t\t\tidentifierFieldKeys.push(item.storedKey);\n\t\t}\n\t}\n\n\tconst lazyChildTypes = new Lazy(\n\t\t() => new Set(Array.from(flexKeyMap.values(), (f) => [...f.schema.allowedTypeSet]).flat()),\n\t);\n\n\tlet handler: ProxyHandler<object>;\n\tlet customizable: boolean;\n\tlet unhydratedContext: Context;\n\n\tclass CustomObjectNode extends CustomObjectNodeBase<T> {\n\t\tpublic static readonly fields: ReadonlyMap<string, FieldSchema> = new Map(\n\t\t\tArray.from(flexKeyMap, ([key, value]) => [key as string, value.schema]),\n\t\t);\n\t\tpublic static readonly flexKeyMap: SimpleKeyMap = flexKeyMap;\n\t\tpublic static readonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string> = new Map<\n\t\t\tFieldKey,\n\t\t\tstring\n\t\t>(\n\t\t\tArray.from(flexKeyMap, ([key, value]): [FieldKey, string] => [\n\t\t\t\tvalue.storedKey,\n\t\t\t\tkey as string,\n\t\t\t]),\n\t\t);\n\t\tpublic static readonly identifierFieldKeys: readonly FieldKey[] = identifierFieldKeys;\n\t\tpublic static readonly allowUnknownOptionalFields: boolean = allowUnknownOptionalFields;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.object(\"Foo\", {bar: schemaFactory.number});\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Object)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.object(\"Foo\", {bar: schemaFactory.number}) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\tconst proxy = new Proxy(proxyTarget, handler) as CustomObjectNode;\n\t\t\ttargetToProxy.set(proxyTarget, proxy);\n\t\t\treturn proxy;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn UnhydratedFlexTreeNode.getOrCreate(\n\t\t\t\tunhydratedContext,\n\t\t\t\tmapTreeFromNodeData(input as object, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {\n\t\t\t// One time initialization that required knowing the most derived type (from this.constructor) and thus has to be lazy.\n\t\t\tcustomizable = (this as unknown) !== CustomObjectNode;\n\t\t\tconst schema = this as unknown as ObjectNodeSchema & ObjectNodeSchemaInternalData;\n\t\t\thandler = createProxyHandler(schema, customizable);\n\t\t\tunhydratedContext = getUnhydratedContext(schema);\n\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== CustomObjectNode.prototype) {\n\t\t\t\t\tfor (const [key] of flexKeyMap) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which shadows a field. Since fields are exposed as own properties, this shadowing will not work, and is an error.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomObjectNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomObjectNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unhydratedContext;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> | undefined =\n\t\t\tmetadata;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn CustomObjectNode.constructorCached?.constructor as unknown as Output;\n\t\t}\n\t}\n\ttype Output = typeof CustomObjectNode &\n\t\t(new (\n\t\t\tinput: InsertableObjectFromSchemaRecord<T> | InternalTreeNode,\n\t\t) => TreeObjectNode<T, TName>);\n\treturn CustomObjectNode as Output;\n}\n\nconst targetToProxy: WeakMap<object, TreeNode> = new WeakMap();\n\n/**\n * Ensures that the set of property keys in the schema is unique.\n * Also ensure that the final set of stored keys (including those implicitly derived from property keys) is unique.\n * @throws Throws a `UsageError` if either of the key uniqueness invariants is violated.\n */\nfunction assertUniqueKeys<\n\tconst Name extends number | string,\n\tconst Fields extends RestrictiveStringRecord<ImplicitFieldSchema>,\n>(schemaName: Name, fields: Fields): void {\n\t// Verify that there are no duplicates among the explicitly specified stored keys.\n\tconst explicitStoredKeys = new Set<string>();\n\tfor (const schema of Object.values(fields)) {\n\t\tconst storedKey = getExplicitStoredKey(schema);\n\t\tif (storedKey === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (explicitStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Duplicate stored key \"${storedKey}\" in schema \"${schemaName}\". Stored keys must be unique within an object schema.`,\n\t\t\t);\n\t\t}\n\t\texplicitStoredKeys.add(storedKey);\n\t}\n\n\t// Verify that there are no duplicates among the derived\n\t// (including those implicitly derived from property keys) stored keys.\n\tconst derivedStoredKeys = new Set<string>();\n\tfor (const [propertyKey, schema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(propertyKey, schema);\n\t\tif (derivedStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Stored key \"${storedKey}\" in schema \"${schemaName}\" conflicts with a property key of the same name, which is not overridden by a stored key. The final set of stored keys in an object schema must be unique.`,\n\t\t\t);\n\t\t}\n\t\tderivedStoredKeys.add(storedKey);\n\t}\n}\n\n/**\n * Creates a policy for allowing unknown optional fields on an object node which delegates to the policy defined\n * on the object node's internal schema data.\n */\nexport function createUnknownOptionalFieldPolicy(\n\tschema: ImplicitFieldSchema,\n): SchemaPolicy[\"allowUnknownOptionalFields\"] {\n\tconst context = getUnhydratedContext(schema);\n\treturn (identifier) => {\n\t\tconst storedSchema = context.schema.get(identifier);\n\t\treturn (\n\t\t\tstoredSchema !== undefined &&\n\t\t\tisObjectNodeSchema(storedSchema) &&\n\t\t\tstoredSchema.allowUnknownOptionalFields\n\t\t);\n\t};\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
|
-
import type {
|
|
6
|
+
import type { NodeIdentifierManager } from "../feature-libraries/index.js";
|
|
7
7
|
import { type MakeNominal, type UnionToIntersection } from "../util/index.js";
|
|
8
8
|
import type { Unhydrated, NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNode, TreeNodeSchemaCore, TreeNodeSchemaNonClass } from "./core/index.js";
|
|
9
9
|
import type { FieldKey } from "../core/index.js";
|
|
@@ -27,6 +27,8 @@ export declare function isTreeNodeSchemaClass<Name extends string, Kind extends
|
|
|
27
27
|
* way to declare and manipulate unordered sets of types in TypeScript.
|
|
28
28
|
*
|
|
29
29
|
* Not intended for direct use outside of package.
|
|
30
|
+
* @privateRemarks
|
|
31
|
+
* Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
|
|
30
32
|
* @system @public
|
|
31
33
|
*/
|
|
32
34
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
@@ -148,7 +150,7 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
148
150
|
/**
|
|
149
151
|
* A {@link FieldProvider} which requires additional context in order to produce its content
|
|
150
152
|
*/
|
|
151
|
-
export type ContextualFieldProvider = (context:
|
|
153
|
+
export type ContextualFieldProvider = (context: NodeIdentifierManager) => InsertableContent | undefined;
|
|
152
154
|
/**
|
|
153
155
|
* A {@link FieldProvider} which can produce its content in a vacuum
|
|
154
156
|
*/
|
|
@@ -282,6 +284,34 @@ export declare function areImplicitFieldSchemaEqual(a: ImplicitFieldSchema, b: I
|
|
|
282
284
|
* 3. They have the same exact set of allowed types. The allowed types must be reference equal.
|
|
283
285
|
*/
|
|
284
286
|
export declare function areFieldSchemaEqual(a: FieldSchema, b: FieldSchema): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Returns the schema referenced by the {@link LazyItem}.
|
|
289
|
+
* @remarks
|
|
290
|
+
* Caches results to handle {@link LazyItem}s which compute their resulting schema.
|
|
291
|
+
* @alpha
|
|
292
|
+
*/
|
|
293
|
+
export declare function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>): T;
|
|
294
|
+
/**
|
|
295
|
+
* Indicates that the provided schema is the "most derived" version in its class hierarchy.
|
|
296
|
+
*
|
|
297
|
+
* @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.
|
|
298
|
+
* `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.
|
|
299
|
+
* When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.
|
|
300
|
+
* @remarks
|
|
301
|
+
* See {@link MostDerivedData} and {@link SchemaFactory} for details on what a "most derived" schema is and why it matters.
|
|
302
|
+
*
|
|
303
|
+
* This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.
|
|
304
|
+
*
|
|
305
|
+
* Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).
|
|
306
|
+
* Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema
|
|
307
|
+
* (using two different schema derived from the same {@link SchemaFactory} produced base class).
|
|
308
|
+
*
|
|
309
|
+
* Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,
|
|
310
|
+
* so any calls to this that is unconditionally after that point for the given schema is not needed.
|
|
311
|
+
* Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally
|
|
312
|
+
* pass in a base class of a schema instead of the most derived one.
|
|
313
|
+
*/
|
|
314
|
+
export declare function markSchemaMostDerived(schema: TreeNodeSchema, oneTimeInitialize?: boolean): void;
|
|
285
315
|
/**
|
|
286
316
|
* Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree.
|
|
287
317
|
* @remarks
|
|
@@ -311,6 +341,8 @@ export declare function areFieldSchemaEqual(a: FieldSchema, b: FieldSchema): boo
|
|
|
311
341
|
* class A extends sf.array("example", [() => B]) {}
|
|
312
342
|
* class B extends sf.array("Inner", sf.number) {}
|
|
313
343
|
* ```
|
|
344
|
+
* @privateRemarks
|
|
345
|
+
* Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
|
|
314
346
|
* @public
|
|
315
347
|
*/
|
|
316
348
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaTypes.d.ts","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"schemaTypes.d.ts","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EACN,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EAKxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAU,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI5E;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,SAAS,MAAM,EACnB,IAAI,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AAI,CAAC,GAChF,eAAe,CAAC,CAAC,CAAC,GAClB,KAAK,CAAC,GACR,CAAC,CAAC,SAAS,cAAc,GACvB,UAAU,CAAC,QAAQ,SAAS,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAC1E,KAAK,CAAC,CAAC;AAEZ;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,IAClF,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,GAC3E,MAAM,GACN,KAAK,CAAC;AAEV;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO;IAC/D;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;CACpE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO;IAChE;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAE9C;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C"}
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.UnsafeUnknownSchema = exports.areFieldSchemaEqual = exports.areImplicitFieldSchemaEqual = exports.normalizeAllowedTypes = exports.normalizeFieldSchema = exports.FieldSchema = exports.createFieldSchema = exports.getDefaultProvider = exports.extractFieldProvider = exports.isConstant = exports.getExplicitStoredKey = exports.getStoredKey = exports.FieldKind = exports.isTreeNodeSchemaClass = void 0;
|
|
7
|
+
exports.UnsafeUnknownSchema = exports.markSchemaMostDerived = exports.evaluateLazySchema = exports.areFieldSchemaEqual = exports.areImplicitFieldSchemaEqual = exports.normalizeAllowedTypes = exports.normalizeFieldSchema = exports.FieldSchema = exports.createFieldSchema = exports.getDefaultProvider = exports.extractFieldProvider = exports.isConstant = exports.getExplicitStoredKey = exports.getStoredKey = exports.FieldKind = exports.isTreeNodeSchemaClass = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
10
|
const index_js_1 = require("../util/index.js");
|
|
11
|
+
const index_js_2 = require("./core/index.js");
|
|
11
12
|
const flexList_js_1 = require("./flexList.js");
|
|
13
|
+
const leafNodeSchema_js_1 = require("./leafNodeSchema.js");
|
|
14
|
+
const treeNodeValid_js_1 = require("./treeNodeValid.js");
|
|
12
15
|
/**
|
|
13
16
|
* Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
|
|
14
17
|
* @internal
|
|
@@ -156,6 +159,8 @@ exports.normalizeFieldSchema = normalizeFieldSchema;
|
|
|
156
159
|
function normalizeAllowedTypes(types) {
|
|
157
160
|
const normalized = new Set();
|
|
158
161
|
if ((0, index_js_1.isReadonlyArray)(types)) {
|
|
162
|
+
// Types array must not be modified after it is normalized since that would result in the user of the normalized data having wrong (out of date) content.
|
|
163
|
+
Object.freeze(types);
|
|
159
164
|
for (const lazyType of types) {
|
|
160
165
|
normalized.add(evaluateLazySchema(lazyType));
|
|
161
166
|
}
|
|
@@ -226,13 +231,61 @@ function areMetadataEqual(a, b) {
|
|
|
226
231
|
}
|
|
227
232
|
return a?.custom === b?.custom && a?.description === b?.description;
|
|
228
233
|
}
|
|
234
|
+
const cachedLazyItem = new WeakMap();
|
|
235
|
+
/**
|
|
236
|
+
* Returns the schema referenced by the {@link LazyItem}.
|
|
237
|
+
* @remarks
|
|
238
|
+
* Caches results to handle {@link LazyItem}s which compute their resulting schema.
|
|
239
|
+
* @alpha
|
|
240
|
+
*/
|
|
229
241
|
function evaluateLazySchema(value) {
|
|
230
|
-
const evaluatedSchema = (0, flexList_js_1.isLazy)(value)
|
|
242
|
+
const evaluatedSchema = (0, flexList_js_1.isLazy)(value)
|
|
243
|
+
? (0, index_js_1.getOrCreate)(cachedLazyItem, value, value)
|
|
244
|
+
: value;
|
|
231
245
|
if (evaluatedSchema === undefined) {
|
|
232
246
|
throw new internal_2.UsageError(`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`);
|
|
233
247
|
}
|
|
248
|
+
markSchemaMostDerived(evaluatedSchema);
|
|
234
249
|
return evaluatedSchema;
|
|
235
250
|
}
|
|
251
|
+
exports.evaluateLazySchema = evaluateLazySchema;
|
|
252
|
+
/**
|
|
253
|
+
* Indicates that the provided schema is the "most derived" version in its class hierarchy.
|
|
254
|
+
*
|
|
255
|
+
* @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.
|
|
256
|
+
* `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.
|
|
257
|
+
* When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.
|
|
258
|
+
* @remarks
|
|
259
|
+
* See {@link MostDerivedData} and {@link SchemaFactory} for details on what a "most derived" schema is and why it matters.
|
|
260
|
+
*
|
|
261
|
+
* This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.
|
|
262
|
+
*
|
|
263
|
+
* Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).
|
|
264
|
+
* Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema
|
|
265
|
+
* (using two different schema derived from the same {@link SchemaFactory} produced base class).
|
|
266
|
+
*
|
|
267
|
+
* Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,
|
|
268
|
+
* so any calls to this that is unconditionally after that point for the given schema is not needed.
|
|
269
|
+
* Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally
|
|
270
|
+
* pass in a base class of a schema instead of the most derived one.
|
|
271
|
+
*/
|
|
272
|
+
function markSchemaMostDerived(schema, oneTimeInitialize = false) {
|
|
273
|
+
if (schema instanceof leafNodeSchema_js_1.LeafNodeSchema) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (!(0, index_js_2.inPrototypeChain)(schema, treeNodeValid_js_1.TreeNodeValid)) {
|
|
277
|
+
// Use JSON.stringify to quote and escape identifier string.
|
|
278
|
+
throw new internal_2.UsageError(`Schema for ${JSON.stringify(schema.identifier)} does not extend a SchemaFactory generated class. This is invalid.`);
|
|
279
|
+
}
|
|
280
|
+
const schemaValid = schema;
|
|
281
|
+
if (oneTimeInitialize) {
|
|
282
|
+
schemaValid.oneTimeInitialize();
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
schemaValid.markMostDerived();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
exports.markSchemaMostDerived = markSchemaMostDerived;
|
|
236
289
|
/**
|
|
237
290
|
* {@inheritdoc (UnsafeUnknownSchema:type)}
|
|
238
291
|
* @alpha
|