@fluidframework/tree 2.51.0 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +0 -1
- package/CHANGELOG.md +43 -0
- package/api-report/tree.alpha.api.md +3 -2
- package/dist/codec/codec.d.ts +2 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +4 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +3 -1
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +2 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +1 -23
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +2 -2
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +2 -3
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +17 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.js +68 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.js +55 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.js +49 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecs.js +26 -0
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +37 -0
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -0
- package/dist/core/tree/{detachedFieldIndexFormat.js → detachedFieldIndexFormatCommon.js} +18 -13
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +13 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.js +12 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +14 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.js +14 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +9 -9
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +21 -21
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +50 -31
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +74 -61
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +20 -14
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +18 -12
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/{lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts → dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts} +20 -14
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/{nodeShape.js → nodeEncoder.js} +23 -17
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -22
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +14 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +0 -2
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts +14 -4
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +31 -26
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts +5 -6
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +15 -16
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -3
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -3
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- 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/independentView.d.ts +8 -0
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +23 -11
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +0 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +7 -10
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +1 -29
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +20 -6
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +9 -4
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +2 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +32 -0
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +2 -2
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +6 -6
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +8 -2
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +8 -7
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +35 -22
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +25 -4
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +42 -16
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +98 -0
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -0
- package/dist/simple-tree/api/discrepancies.js +255 -0
- package/dist/simple-tree/api/discrepancies.js.map +1 -0
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -7
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +18 -117
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +7 -4
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +5 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +2 -2
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +10 -4
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +2 -2
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +15 -15
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +20 -4
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +45 -13
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +13 -2
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js +22 -9
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +2 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +3 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +8 -1
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +3 -0
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +2 -0
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts +2 -0
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +3 -1
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +1 -0
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +1 -0
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +4 -4
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -8
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js +1 -2
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js +1 -2
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +2 -7
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +4 -18
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +5 -5
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +9 -3
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +3 -0
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +3 -0
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.d.ts +1 -0
- package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -0
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/lib/codec/codec.d.ts +2 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +4 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +3 -1
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +1 -23
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +2 -2
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +2 -3
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +17 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.js +64 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js +51 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js +45 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecs.js +21 -0
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +37 -0
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -0
- package/lib/core/tree/{detachedFieldIndexFormat.js → detachedFieldIndexFormatCommon.js} +13 -10
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +13 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.js +9 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +14 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.js +11 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +9 -9
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +19 -19
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +50 -31
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +70 -57
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +20 -14
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +17 -11
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/{dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts → lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts} +20 -14
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/{nodeShape.js → nodeEncoder.js} +21 -15
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +19 -19
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +14 -2
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +0 -2
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts +14 -4
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +29 -24
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts +5 -6
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +14 -14
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -3
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +3 -4
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- 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/independentView.d.ts +8 -0
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +21 -10
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -1
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +0 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +8 -11
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -30
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +20 -6
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +10 -5
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +2 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +33 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +2 -2
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +6 -6
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +8 -2
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +8 -7
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +38 -25
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +25 -4
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +43 -17
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +98 -0
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -0
- package/lib/simple-tree/{discrepancies.js → api/discrepancies.js} +80 -206
- package/lib/simple-tree/api/discrepancies.js.map +1 -0
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -7
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +19 -118
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +7 -4
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +6 -2
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +2 -2
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +8 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +2 -2
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +9 -9
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +20 -4
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +42 -12
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +13 -2
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js +22 -9
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +2 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +2 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +8 -1
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +3 -0
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +2 -0
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts +2 -0
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +3 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +1 -0
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +1 -0
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +4 -4
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +4 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +2 -7
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -16
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +5 -5
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +11 -5
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +3 -0
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +3 -0
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.d.ts +1 -0
- package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/walkFieldSchema.js +1 -0
- package/lib/simple-tree/walkFieldSchema.js.map +1 -1
- package/package.json +23 -23
- package/src/codec/codec.ts +4 -3
- package/src/core/index.ts +2 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +4 -0
- package/src/core/schema-stored/schema.ts +2 -26
- package/src/core/tree/detachedFieldIndex.ts +4 -6
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +87 -0
- package/src/core/tree/{detachedFieldIndexCodec.ts → detachedFieldIndexCodecV1.ts} +22 -68
- package/src/core/tree/detachedFieldIndexCodecV2.ts +72 -0
- package/src/core/tree/detachedFieldIndexCodecs.ts +44 -0
- package/src/core/tree/{detachedFieldIndexFormat.ts → detachedFieldIndexFormatCommon.ts} +32 -23
- package/src/core/tree/detachedFieldIndexFormatV1.ts +15 -0
- package/src/core/tree/detachedFieldIndexFormatV2.ts +17 -0
- package/src/feature-libraries/chunked-forest/codec/README.md +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +25 -25
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +10 -6
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +96 -73
- package/src/feature-libraries/chunked-forest/codec/format.ts +20 -14
- package/src/feature-libraries/chunked-forest/codec/{nodeShape.ts → nodeEncoder.ts} +23 -17
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +34 -34
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +5 -5
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +10 -0
- package/src/feature-libraries/default-schema/defaultSchema.ts +0 -2
- package/src/feature-libraries/default-schema/index.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +47 -30
- package/src/feature-libraries/index.ts +1 -3
- package/src/feature-libraries/modular-schema/comparison.ts +14 -29
- package/src/feature-libraries/object-forest/objectForest.ts +10 -6
- package/src/index.ts +5 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +45 -19
- package/src/shared-tree/schematizeTree.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +16 -13
- package/src/shared-tree/sharedTree.ts +2 -42
- package/src/shared-tree/treeAlpha.ts +30 -18
- package/src/shared-tree/treeCheckout.ts +54 -10
- package/src/shared-tree-core/branch.ts +1 -6
- package/src/simple-tree/api/conciseTree.ts +9 -7
- package/src/simple-tree/api/configuration.ts +8 -2
- package/src/simple-tree/api/create.ts +49 -36
- package/src/simple-tree/api/customTree.ts +59 -20
- package/src/simple-tree/{discrepancies.ts → api/discrepancies.ts} +128 -303
- package/src/simple-tree/api/schemaCompatibilityTester.ts +27 -151
- package/src/simple-tree/api/schemaFactory.ts +7 -4
- package/src/simple-tree/api/storedSchema.ts +6 -9
- package/src/simple-tree/api/treeBeta.ts +17 -4
- package/src/simple-tree/api/verboseTree.ts +17 -8
- package/src/simple-tree/core/allowedTypes.ts +54 -21
- package/src/simple-tree/core/context.ts +24 -22
- package/src/simple-tree/core/index.ts +2 -1
- package/src/simple-tree/core/treeNodeKernel.ts +1 -1
- package/src/simple-tree/core/treeNodeValid.ts +9 -2
- package/src/simple-tree/core/walkSchema.ts +3 -0
- package/src/simple-tree/createContext.ts +6 -1
- package/src/simple-tree/fieldSchema.ts +1 -0
- package/src/simple-tree/index.ts +5 -10
- package/src/simple-tree/node-kinds/array/arrayNode.ts +32 -19
- package/src/simple-tree/node-kinds/index.ts +0 -1
- package/src/simple-tree/node-kinds/object/index.ts +0 -1
- package/src/simple-tree/node-kinds/object/objectNode.ts +9 -27
- package/src/simple-tree/prepareForInsertion.ts +17 -9
- package/src/simple-tree/toStoredSchema.ts +3 -0
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +6 -2
- package/src/simple-tree/walkFieldSchema.ts +1 -0
- package/dist/core/tree/detachedFieldIndexCodec.d.ts +0 -11
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +0 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +0 -100
- package/dist/core/tree/detachedFieldIndexCodec.js.map +0 -1
- package/dist/core/tree/detachedFieldIndexFormat.d.ts +0 -33
- package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +0 -1
- package/dist/core/tree/detachedFieldIndexFormat.js.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +0 -1
- package/dist/feature-libraries/initializeForest.d.ts +0 -18
- package/dist/feature-libraries/initializeForest.d.ts.map +0 -1
- package/dist/feature-libraries/initializeForest.js +0 -35
- package/dist/feature-libraries/initializeForest.js.map +0 -1
- package/dist/simple-tree/discrepancies.d.ts +0 -167
- package/dist/simple-tree/discrepancies.d.ts.map +0 -1
- package/dist/simple-tree/discrepancies.js +0 -382
- package/dist/simple-tree/discrepancies.js.map +0 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts +0 -11
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +0 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +0 -96
- package/lib/core/tree/detachedFieldIndexCodec.js.map +0 -1
- package/lib/core/tree/detachedFieldIndexFormat.d.ts +0 -33
- package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +0 -1
- package/lib/core/tree/detachedFieldIndexFormat.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +0 -1
- package/lib/feature-libraries/initializeForest.d.ts +0 -18
- package/lib/feature-libraries/initializeForest.d.ts.map +0 -1
- package/lib/feature-libraries/initializeForest.js +0 -31
- package/lib/feature-libraries/initializeForest.js.map +0 -1
- package/lib/simple-tree/discrepancies.d.ts +0 -167
- package/lib/simple-tree/discrepancies.d.ts.map +0 -1
- package/lib/simple-tree/discrepancies.js.map +0 -1
- package/src/feature-libraries/initializeForest.ts +0 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kDAA4C;AAI5C,mDAAmD;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/simple-tree/core/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kDAA4C;AAI5C,mDAAmD;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IACZ,MAAM,CAAC,uBAAuB,CACpC,UAA2C;QAE3C,MAAM,MAAM,GAAkD,IAAI,GAAG,EAAE,CAAC;QACxE,IAAA,gCAAgB,EAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,UAAU;gBACd,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;YACtD,CAAC;SACD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,YACiB,WAA4B;IAC5C;;;;;;;;OAQG;IACa,MAA6D;QAV7D,gBAAW,GAAX,WAAW,CAAiB;QAU5B,WAAM,GAAN,MAAM,CAAuD;IAC3E,CAAC;CACJ;AA/BD,0BA+BC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,OAAO;IAC3C,YAC0B,WAAoC,EAC7D,MAA6D;QAE7D,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAHF,gBAAW,GAAX,WAAW,CAAyB;IAI9D,CAAC;CACD;AAPD,0CAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeHydratedContext,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { NormalizedAnnotatedAllowedTypes } from \"./allowedTypes.js\";\n\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\nimport { walkAllowedTypes } from \"./walkSchema.js\";\n\n/**\n * Additional information about a collection of {@link TreeNode}s.\n * @remarks\n * Each TreeNode provides a way to navigate to a context for it with additional information.\n *\n * For unhydrated nodes, this information is rather limited since the node doesn't know what tree it might get inserted into (if any),\n * and thus is limited to information derived about that particular unhydrated tree and its schema.\n *\n * Hydrated nodes have more contextual information, and thus can provide a single {@link HydratedContext} for all nodes in the document which can have additional information.\n *\n * @privateRemarks\n * This design is the same as {@link FlexTreeContext} with its base type and {@link FlexTreeHydratedContext} extending it.\n */\nexport class Context {\n\tpublic static schemaMapFromRootSchema(\n\t\trootSchema: NormalizedAnnotatedAllowedTypes,\n\t): ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema> {\n\t\tconst schema: Map<TreeNodeSchemaIdentifier, TreeNodeSchema> = new Map();\n\t\twalkAllowedTypes(rootSchema, {\n\t\t\tnode(nodeSchema) {\n\t\t\t\tschema.set(brand(nodeSchema.identifier), nodeSchema);\n\t\t\t},\n\t\t});\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Builds the context.\n\t * @remarks\n\t * Since this walks the schema, it must not be invoked during schema declaration or schema forward references could fail to be resolved.\n\t */\n\tpublic constructor(\n\t\tpublic readonly flexContext: FlexTreeContext,\n\t\t/**\n\t\t * All schema which could transitively be used under the associated node.\n\t\t * @remarks\n\t\t * While generally {@link TreeNodeSchema} are referenced as objects and thus do not need to be looked up by identifier,\n\t\t * there are a few cases (mainly constructing new TreeNodes from existing tree data) where such a lookup is useful.\n\t\t * Having this map in the context addresses this use-case.\n\t\t * @privateRemarks\n\t\t * This design mirrors how {@link FlexTreeSchema} are accessed off the {@link FlexTreeContext}, making the migration away from them simpler.\n\t\t */\n\t\tpublic readonly schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema>,\n\t) {}\n}\n\n/**\n * Extends {@link Context} with additional information from the view and/or tree which becomes known when a {@link TreeNode} is hydrated,\n * associating it with the containing {@link TreeView}.\n */\nexport class HydratedContext extends Context {\n\tpublic constructor(\n\t\tpublic override readonly flexContext: FlexTreeHydratedContext,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema>,\n\t) {\n\t\tsuper(flexContext, schema);\n\t}\n}\n"]}
|
|
@@ -8,9 +8,9 @@ export { type Unhydrated, type InternalTreeNode, } from "./types.js";
|
|
|
8
8
|
export { TreeNode, privateToken, inPrototypeChain, } from "./treeNode.js";
|
|
9
9
|
export { NodeKind, isTreeNodeSchemaClass, privateDataSymbol, getTreeNodeSchemaPrivateData, CompatibilityLevel, } from "./treeNodeSchema.js";
|
|
10
10
|
export type { TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, TreeNodeSchemaCore, TreeNodeSchemaBoth, NodeSchemaMetadata, TreeLeafValue, InsertableTypedNode, NodeBuilderData, NodeFromSchema, TreeNodeSchemaCorePrivate, TreeNodeSchemaPrivateData, TreeNodeSchemaInitializedData, FlexContent, } from "./treeNodeSchema.js";
|
|
11
|
-
export { isAnnotatedAllowedTypes, isAnnotatedAllowedType, normalizeAllowedTypes, normalizeAnnotatedAllowedTypes, unannotateImplicitAllowedTypes, markSchemaMostDerived, evaluateLazySchema, } from "./allowedTypes.js";
|
|
11
|
+
export { isAnnotatedAllowedTypes, isAnnotatedAllowedType, normalizeAllowedTypes, normalizeAnnotatedAllowedTypes, normalizeToAnnotatedAllowedType, unannotateImplicitAllowedTypes, markSchemaMostDerived, evaluateLazySchema, } from "./allowedTypes.js";
|
|
12
12
|
export type { AnnotatedAllowedType, NormalizedAnnotatedAllowedTypes, ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, UnannotateImplicitAllowedTypes, AllowedTypesMetadata, AllowedTypes, TreeNodeFromImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, InsertableTreeNodeFromAllowedTypes, Input, UnannotateAllowedTypes, UnannotateAllowedType, UnannotateAllowedTypesList, UnannotateAllowedTypeOrLazyItem, AllowedTypeMetadata, AnnotatedAllowedTypes, } from "./allowedTypes.js";
|
|
13
|
-
export { walkAllowedTypes, type SchemaVisitor } from "./walkSchema.js";
|
|
13
|
+
export { walkAllowedTypes, walkNodeSchema, type SchemaVisitor } from "./walkSchema.js";
|
|
14
14
|
export { Context, HydratedContext } from "./context.js";
|
|
15
15
|
export { getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, } from "./getOrCreateNode.js";
|
|
16
16
|
export { UnhydratedFlexTreeField, UnhydratedFlexTreeNode, UnhydratedSequenceField, UnhydratedContext, createField, } from "./unhydratedFlexTree.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/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AK,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,KAAK,SAAS,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,gCAAgC,EAChC,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EACN,KAAK,UAAU,EACf,KAAK,gBAAgB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,gBAAgB,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACX,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,WAAW,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAC/B,8BAA8B,EAC9B,qBAAqB,EACrB,kBAAkB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,oBAAoB,EACpB,6BAA6B,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,YAAY,EACZ,gCAAgC,EAChC,0CAA0C,EAC1C,kCAAkC,EAClC,KAAK,EACL,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EACN,4BAA4B,EAC5B,mCAAmC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,GACX,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,eAAe,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EACN,aAAa,EACb,KAAK,eAAe,EACpB,+BAA+B,GAC/B,MAAM,oBAAoB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createTreeNodeSchemaPrivateData = exports.TreeNodeValid = exports.isLazy = exports.createField = exports.UnhydratedContext = exports.UnhydratedSequenceField = exports.UnhydratedFlexTreeNode = exports.UnhydratedFlexTreeField = exports.getOrCreateNodeFromInnerUnboxedNode = exports.getOrCreateNodeFromInnerNode = exports.HydratedContext = exports.Context = exports.walkAllowedTypes = exports.evaluateLazySchema = exports.markSchemaMostDerived = exports.unannotateImplicitAllowedTypes = exports.normalizeAnnotatedAllowedTypes = exports.normalizeAllowedTypes = exports.isAnnotatedAllowedType = exports.isAnnotatedAllowedTypes = exports.CompatibilityLevel = exports.getTreeNodeSchemaPrivateData = exports.privateDataSymbol = exports.isTreeNodeSchemaClass = exports.NodeKind = exports.inPrototypeChain = exports.privateToken = exports.TreeNode = exports.typeSchemaSymbol = exports.typeNameSymbol = exports.SimpleContextSlot = exports.getSimpleNodeSchemaFromInnerNode = exports.treeNodeFromAnchor = exports.getOrCreateInnerNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeSchema = exports.getKernel = exports.TreeNodeKernel = exports.isTreeNode = void 0;
|
|
7
|
+
exports.createTreeNodeSchemaPrivateData = exports.TreeNodeValid = exports.isLazy = exports.createField = exports.UnhydratedContext = exports.UnhydratedSequenceField = exports.UnhydratedFlexTreeNode = exports.UnhydratedFlexTreeField = exports.getOrCreateNodeFromInnerUnboxedNode = exports.getOrCreateNodeFromInnerNode = exports.HydratedContext = exports.Context = exports.walkNodeSchema = exports.walkAllowedTypes = exports.evaluateLazySchema = exports.markSchemaMostDerived = exports.unannotateImplicitAllowedTypes = exports.normalizeToAnnotatedAllowedType = exports.normalizeAnnotatedAllowedTypes = exports.normalizeAllowedTypes = exports.isAnnotatedAllowedType = exports.isAnnotatedAllowedTypes = exports.CompatibilityLevel = exports.getTreeNodeSchemaPrivateData = exports.privateDataSymbol = exports.isTreeNodeSchemaClass = exports.NodeKind = exports.inPrototypeChain = exports.privateToken = exports.TreeNode = exports.typeSchemaSymbol = exports.typeNameSymbol = exports.SimpleContextSlot = exports.getSimpleNodeSchemaFromInnerNode = exports.treeNodeFromAnchor = exports.getOrCreateInnerNode = exports.tryDisposeTreeNode = exports.tryGetTreeNodeSchema = exports.getKernel = exports.TreeNodeKernel = exports.isTreeNode = void 0;
|
|
8
8
|
var treeNodeKernel_js_1 = require("./treeNodeKernel.js");
|
|
9
9
|
Object.defineProperty(exports, "isTreeNode", { enumerable: true, get: function () { return treeNodeKernel_js_1.isTreeNode; } });
|
|
10
10
|
Object.defineProperty(exports, "TreeNodeKernel", { enumerable: true, get: function () { return treeNodeKernel_js_1.TreeNodeKernel; } });
|
|
@@ -33,11 +33,13 @@ Object.defineProperty(exports, "isAnnotatedAllowedTypes", { enumerable: true, ge
|
|
|
33
33
|
Object.defineProperty(exports, "isAnnotatedAllowedType", { enumerable: true, get: function () { return allowedTypes_js_1.isAnnotatedAllowedType; } });
|
|
34
34
|
Object.defineProperty(exports, "normalizeAllowedTypes", { enumerable: true, get: function () { return allowedTypes_js_1.normalizeAllowedTypes; } });
|
|
35
35
|
Object.defineProperty(exports, "normalizeAnnotatedAllowedTypes", { enumerable: true, get: function () { return allowedTypes_js_1.normalizeAnnotatedAllowedTypes; } });
|
|
36
|
+
Object.defineProperty(exports, "normalizeToAnnotatedAllowedType", { enumerable: true, get: function () { return allowedTypes_js_1.normalizeToAnnotatedAllowedType; } });
|
|
36
37
|
Object.defineProperty(exports, "unannotateImplicitAllowedTypes", { enumerable: true, get: function () { return allowedTypes_js_1.unannotateImplicitAllowedTypes; } });
|
|
37
38
|
Object.defineProperty(exports, "markSchemaMostDerived", { enumerable: true, get: function () { return allowedTypes_js_1.markSchemaMostDerived; } });
|
|
38
39
|
Object.defineProperty(exports, "evaluateLazySchema", { enumerable: true, get: function () { return allowedTypes_js_1.evaluateLazySchema; } });
|
|
39
40
|
var walkSchema_js_1 = require("./walkSchema.js");
|
|
40
41
|
Object.defineProperty(exports, "walkAllowedTypes", { enumerable: true, get: function () { return walkSchema_js_1.walkAllowedTypes; } });
|
|
42
|
+
Object.defineProperty(exports, "walkNodeSchema", { enumerable: true, get: function () { return walkSchema_js_1.walkNodeSchema; } });
|
|
41
43
|
var context_js_1 = require("./context.js");
|
|
42
44
|
Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_js_1.Context; } });
|
|
43
45
|
Object.defineProperty(exports, "HydratedContext", { enumerable: true, get: function () { return context_js_1.HydratedContext; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/core/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAW6B;AAV5B,+GAAA,UAAU,OAAA;AACV,mHAAA,cAAc,OAAA;AACd,8GAAA,SAAS,OAAA;AACT,yHAAA,oBAAoB,OAAA;AAEpB,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ACrB,iIAAA,8BAA8B,OAAA;AAC9B,kIAAA,+BAA+B,OAAA;AAC/B,iIAAA,8BAA8B,OAAA;AAC9B,wHAAA,qBAAqB,OAAA;AACrB,qHAAA,kBAAkB,OAAA;AAqBnB,iDAAuF;AAA9E,iHAAA,gBAAgB,OAAA;AAAE,+GAAA,cAAc,OAAA;AACzC,2CAAwD;AAA/C,qGAAA,OAAO,OAAA;AAAE,6GAAA,eAAe,OAAA;AACjC,2DAG8B;AAF7B,kIAAA,4BAA4B,OAAA;AAC5B,yIAAA,mCAAmC,OAAA;AAEpC,iEAMiC;AALhC,gIAAA,uBAAuB,OAAA;AACvB,+HAAA,sBAAsB,OAAA;AACtB,gIAAA,uBAAuB,OAAA;AACvB,0HAAA,iBAAiB,OAAA;AACjB,oHAAA,WAAW,OAAA;AAQZ,6CAAuC;AAA9B,qGAAA,MAAM,OAAA;AACf,uDAI4B;AAH3B,iHAAA,aAAa,OAAA;AAEb,mIAAA,+BAA+B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tisTreeNode,\n\tTreeNodeKernel,\n\tgetKernel,\n\ttryGetTreeNodeSchema,\n\ttype InnerNode,\n\ttryDisposeTreeNode,\n\tgetOrCreateInnerNode,\n\ttreeNodeFromAnchor,\n\tgetSimpleNodeSchemaFromInnerNode,\n\tSimpleContextSlot,\n} from \"./treeNodeKernel.js\";\nexport { type WithType, typeNameSymbol, typeSchemaSymbol } from \"./withType.js\";\nexport {\n\ttype Unhydrated,\n\ttype InternalTreeNode,\n} from \"./types.js\";\nexport {\n\tTreeNode,\n\tprivateToken,\n\tinPrototypeChain,\n} from \"./treeNode.js\";\nexport {\n\tNodeKind,\n\tisTreeNodeSchemaClass,\n\tprivateDataSymbol,\n\tgetTreeNodeSchemaPrivateData,\n\tCompatibilityLevel,\n} from \"./treeNodeSchema.js\";\nexport type {\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaCore,\n\tTreeNodeSchemaBoth,\n\tNodeSchemaMetadata,\n\tTreeLeafValue,\n\tInsertableTypedNode,\n\tNodeBuilderData,\n\tNodeFromSchema,\n\tTreeNodeSchemaCorePrivate,\n\tTreeNodeSchemaPrivateData,\n\tTreeNodeSchemaInitializedData,\n\tFlexContent,\n} from \"./treeNodeSchema.js\";\nexport {\n\tisAnnotatedAllowedTypes,\n\tisAnnotatedAllowedType,\n\tnormalizeAllowedTypes,\n\tnormalizeAnnotatedAllowedTypes,\n\tnormalizeToAnnotatedAllowedType,\n\tunannotateImplicitAllowedTypes,\n\tmarkSchemaMostDerived,\n\tevaluateLazySchema,\n} from \"./allowedTypes.js\";\nexport type {\n\tAnnotatedAllowedType,\n\tNormalizedAnnotatedAllowedTypes,\n\tImplicitAllowedTypes,\n\tImplicitAnnotatedAllowedTypes,\n\tUnannotateImplicitAllowedTypes,\n\tAllowedTypesMetadata,\n\tAllowedTypes,\n\tTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeNodeFromAllowedTypes,\n\tInput,\n\tUnannotateAllowedTypes,\n\tUnannotateAllowedType,\n\tUnannotateAllowedTypesList,\n\tUnannotateAllowedTypeOrLazyItem,\n\tAllowedTypeMetadata,\n\tAnnotatedAllowedTypes,\n} from \"./allowedTypes.js\";\nexport { walkAllowedTypes, walkNodeSchema, type SchemaVisitor } from \"./walkSchema.js\";\nexport { Context, HydratedContext } from \"./context.js\";\nexport {\n\tgetOrCreateNodeFromInnerNode,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n} from \"./getOrCreateNode.js\";\nexport {\n\tUnhydratedFlexTreeField,\n\tUnhydratedFlexTreeNode,\n\tUnhydratedSequenceField,\n\tUnhydratedContext,\n\tcreateField,\n} from \"./unhydratedFlexTree.js\";\nexport type {\n\tLazyItem,\n\tFlexList,\n\tFlexListToUnion,\n\tExtractItemType,\n} from \"./flexList.js\";\nexport { isLazy } from \"./flexList.js\";\nexport {\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\tcreateTreeNodeSchemaPrivateData,\n} from \"./treeNodeValid.js\";\n"]}
|
|
@@ -59,7 +59,7 @@ export declare class TreeNodeKernel {
|
|
|
59
59
|
/**
|
|
60
60
|
* Create a TreeNodeKernel which can be looked up with {@link getKernel}.
|
|
61
61
|
*
|
|
62
|
-
* @param initialContext - context from when this node was originally
|
|
62
|
+
* @param initialContext - context from when this node was originally created. Only used when unhydrated.
|
|
63
63
|
* @param innerNode - When unhydrated/raw or marinated the MapTreeNode. FlexTreeNode when cooked.
|
|
64
64
|
* @remarks
|
|
65
65
|
* Exactly one kernel per TreeNode should be created.
|
|
@@ -74,7 +74,7 @@ class TreeNodeKernel {
|
|
|
74
74
|
/**
|
|
75
75
|
* Create a TreeNodeKernel which can be looked up with {@link getKernel}.
|
|
76
76
|
*
|
|
77
|
-
* @param initialContext - context from when this node was originally
|
|
77
|
+
* @param initialContext - context from when this node was originally created. Only used when unhydrated.
|
|
78
78
|
* @param innerNode - When unhydrated/raw or marinated the MapTreeNode. FlexTreeNode when cooked.
|
|
79
79
|
* @remarks
|
|
80
80
|
* Exactly one kernel per TreeNode should be created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeKernel.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAAsF;AACtF,uEAAsE;AAEtE,kDAO6B;AAC7B,+DAAmF;AACnF,+DAS0C;AAM1C,mEAAiE;AAEjE,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAA4B,CAAC;AAEjE,SAAgB,SAAS,CAAC,IAAc;IACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAA,iBAAM,EAAC,MAAM,KAAK,SAAS,EAAE,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AACpB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAsB;IACxD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,0BAAkB,CAAC,CAAC;IACxD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AARD,gDAQC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,SAAoB;IAC3D,MAAM,WAAW,GAAG,gCAAgC,CAAC,SAAS,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,SAAwC,CAAC;IAC1D,OAAO,OAAO,WAAW,KAAK,UAAU;QACvC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC;QAC3B,CAAC,CAAE,WAAwE,CAAC,MAAM,CAChF,QAAQ,CACR,CAAC;AACL,CAAC;AARD,0DAQC;AAED;;;;;GAKG;AACU,QAAA,iBAAiB,GAAG,IAAA,qBAAU,GAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable, Off } from \"@fluidframework/core-interfaces\";\nimport { assert, Lazy, fail, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorNode,\n\ttype AnchorSet,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../../core/index.js\";\nimport { getOrCreateHydratedFlexTreeNode } from \"../../feature-libraries/index.js\";\nimport {\n\tassertFlexTreeEntityNotFreed,\n\tContextSlot,\n\tflexTreeSlot,\n\tLazyEntity,\n\tTreeStatus,\n\ttreeStatusFromAnchorCache,\n\ttype FlexTreeNode,\n\ttype HydratedFlexTreeNode,\n} from \"../../feature-libraries/index.js\";\n\nimport type { Context, HydratedContext } from \"./context.js\";\nimport type { TreeNode } from \"./treeNode.js\";\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\nimport type { InternalTreeNode, Unhydrated } from \"./types.js\";\nimport { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\n\nconst treeNodeToKernel = new WeakMap<TreeNode, TreeNodeKernel>();\n\nexport function getKernel(node: TreeNode): TreeNodeKernel {\n\tconst kernel = treeNodeToKernel.get(node);\n\tassert(kernel !== undefined, 0x9b1 /* Expected tree node to have kernel */);\n\treturn kernel;\n}\n\n/**\n * Detects if the given 'candidate' is a TreeNode.\n *\n * @remarks\n * Supports both Hydrated and {@link Unhydrated} TreeNodes, both of which return true.\n *\n * Because the common usage is to check if a value being inserted/set is a TreeNode,\n * this function permits calling with primitives as well as objects.\n *\n * Primitives will always return false (as they are copies of data, not references to nodes).\n *\n * @param candidate - Value which may be a TreeNode\n * @returns true if the given 'candidate' is a hydrated TreeNode.\n */\nexport function isTreeNode(candidate: unknown): candidate is TreeNode | Unhydrated<TreeNode> {\n\treturn treeNodeToKernel.has(candidate as TreeNode);\n}\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode}.\n *\n * Returns undefined for other values.\n * @remarks\n * Does not give schema for a {@link TreeLeafValue}.\n */\nexport function tryGetTreeNodeSchema(value: unknown): undefined | TreeNodeSchema {\n\tconst kernel = treeNodeToKernel.get(value as TreeNode);\n\treturn kernel?.schema;\n}\n\n/** The {@link HydrationState} of a {@link TreeNodeKernel} before the kernel is hydrated */\ninterface UnhydratedState {\n\toff: Off;\n\treadonly innerNode: UnhydratedFlexTreeNode;\n}\n\n/** The {@link HydrationState} of a {@link TreeNodeKernel} after the kernel is hydrated */\ninterface HydratedState {\n\t/** The flex node for this kernel (lazy - undefined if it has not yet been demanded) */\n\tinnerNode?: FlexTreeNode;\n\t/** The {@link AnchorNode} that this node is associated with. */\n\treadonly anchorNode: AnchorNode;\n\t/** All {@link Off | event deregistration functions} that should be run when the kernel is disposed. */\n\treadonly offAnchorNode: Set<Off>;\n}\n\n/** State within a {@link TreeNodeKernel} that is related to the hydration process */\ntype HydrationState = UnhydratedState | HydratedState;\n\n/** True if and only if the given {@link HydrationState} is post-hydration */\nfunction isHydrated(state: HydrationState): state is HydratedState {\n\treturn (state as Partial<HydratedState>).anchorNode !== undefined;\n}\n\n/**\n * Contains state and an internal API for managing {@link TreeNode}s.\n * @remarks All {@link TreeNode}s have an associated kernel object.\n * The kernel has the same lifetime as the node and spans both its unhydrated and hydrated states.\n */\nexport class TreeNodeKernel {\n\tprivate disposed = false;\n\n\t/**\n\t * Generation number which is incremented any time we have an edit on the node.\n\t * Used during iteration to make sure there has been no edits that were concurrently made.\n\t * @remarks\n\t * This is updated monotonically by this class when edits are applied.\n\t * TODO: update this when applying edits to unhydrated trees.\n\t *\n\t * If TypeScript supported making this immutable from outside the class without making it readonly from inside, that would be used here,\n\t * but they only way to do that is add a separate public accessor and make it private, which was deemed not worth the boilerplate, runtime overhead and bundle size.\n\t */\n\tpublic generationNumber: number = 0;\n\n\t#hydrationState: HydrationState;\n\n\t/**\n\t * Events registered before hydration.\n\t * @remarks\n\t * Since these are usually not used, they are allocated lazily as an optimization.\n\t * The laziness also avoids extra forwarding overhead for events from this kernel's anchor node and also avoids registering for events that are unneeded.\n\t * This means optimizations like skipping processing data in subtrees where no subtreeChanged events are subscribed to would be able to work,\n\t * since the kernel does not unconditionally subscribe to those events (like a design which simply forwards all events would).\n\t */\n\treadonly #unhydratedEvents = new Lazy(createEmitter<KernelEvents>);\n\n\t/**\n\t * Create a TreeNodeKernel which can be looked up with {@link getKernel}.\n\t *\n\t * @param initialContext - context from when this node was originally crated.\n\t * @param innerNode - When unhydrated/raw or marinated the MapTreeNode. FlexTreeNode when cooked.\n\t * @remarks\n\t * Exactly one kernel per TreeNode should be created.\n\t */\n\tpublic constructor(\n\t\tpublic readonly node: TreeNode,\n\t\tpublic readonly schema: TreeNodeSchema,\n\t\tinnerNode: InnerNode,\n\t\tprivate readonly initialContext: Context,\n\t) {\n\t\tsplitInnerNodeType(innerNode);\n\n\t\tassert(!treeNodeToKernel.has(node), 0xa1a /* only one kernel per node can be made */);\n\t\ttreeNodeToKernel.set(node, this);\n\n\t\tif (innerNode instanceof UnhydratedFlexTreeNode) {\n\t\t\t// Unhydrated case\n\t\t\tdebugAssert(() => innerNode.treeNode === undefined);\n\t\t\tinnerNode.treeNode = node;\n\t\t\t// Register for change events from the unhydrated flex node.\n\t\t\t// These will be fired if the unhydrated node is edited, and will also be forwarded later to the hydrated node.\n\t\t\tthis.#hydrationState = {\n\t\t\t\tinnerNode,\n\t\t\t\toff: innerNode.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\tthis.#unhydratedEvents.value.emit(\"childrenChangedAfterBatch\", {\n\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t});\n\n\t\t\t\t\tlet unhydratedNode: UnhydratedFlexTreeNode | undefined = innerNode;\n\t\t\t\t\twhile (unhydratedNode !== undefined) {\n\t\t\t\t\t\tconst treeNode = unhydratedNode.treeNode;\n\t\t\t\t\t\tif (treeNode !== undefined) {\n\t\t\t\t\t\t\tconst kernel = getKernel(treeNode);\n\t\t\t\t\t\t\tkernel.#unhydratedEvents.value.emit(\"subtreeChangedAfterBatch\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parentNode: FlexTreeNode | undefined =\n\t\t\t\t\t\t\tunhydratedNode.parentField.parent.parent;\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tparentNode === undefined || parentNode instanceof UnhydratedFlexTreeNode,\n\t\t\t\t\t\t\t0xb76 /* Unhydrated node's parent should be an unhydrated node */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tunhydratedNode = parentNode;\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t};\n\t\t} else {\n\t\t\t// Hydrated case\n\t\t\tthis.#hydrationState = this.createHydratedState(innerNode.anchorNode);\n\t\t\tthis.#hydrationState.innerNode = innerNode;\n\t\t}\n\t}\n\n\tpublic get context(): Context {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\t// This can't be cached on this.#hydrated during hydration since initial tree is hydrated before the context is cached on the anchorSet.\n\t\t\treturn (\n\t\t\t\tthis.#hydrationState?.anchorNode.anchorSet.slots.get(SimpleContextSlot) ??\n\t\t\t\tfail(0xb40 /* missing simple-tree context */)\n\t\t\t);\n\t\t}\n\t\treturn this.initialContext;\n\t}\n\n\t/**\n\t * Transition from {@link Unhydrated} to hydrated.\n\t * Bi-directionally associates the given hydrated TreeNode to the anchor node at the provided path.\n\t * @remarks\n\t * Happens at most once for any given node.\n\t * Cleans up mappings to {@link UnhydratedFlexTreeNode} - it is assumed that they are no longer needed once this node has an anchor node.\n\t */\n\tpublic hydrate(anchors: AnchorSet, path: UpPath): void {\n\t\tassert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);\n\t\tassert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);\n\n\t\tconst anchor = anchors.track(path);\n\t\tconst anchorNode =\n\t\t\tanchors.locate(anchor) ?? fail(0xb42 /* Expected anchor node to be present */);\n\n\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\n\t\tthis.#hydrationState.offAnchorNode.add(() => anchors.forget(anchor));\n\n\t\t// If needed, register forwarding emitters for events from before hydration\n\t\tif (this.#unhydratedEvents.evaluated) {\n\t\t\tconst events = this.#unhydratedEvents.value;\n\t\t\tfor (const eventName of kernelEvents) {\n\t\t\t\tif (events.hasListeners(eventName)) {\n\t\t\t\t\tthis.#hydrationState.offAnchorNode.add(\n\t\t\t\t\t\t// Argument is forwarded between matching events, so the type should be correct.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tanchorNode.events.on(eventName, (arg: any) => events.emit(eventName, arg)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate createHydratedState(anchorNode: AnchorNode): HydratedState {\n\t\tassert(\n\t\t\t!anchorNode.slots.has(simpleTreeNodeSlot),\n\t\t\t0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,\n\t\t);\n\t\tanchorNode.slots.set(simpleTreeNodeSlot, this.node);\n\t\treturn {\n\t\t\tanchorNode,\n\t\t\toffAnchorNode: new Set([\n\t\t\t\tanchorNode.events.on(\"afterDestroy\", () => this.dispose()),\n\t\t\t\t// TODO: this should be triggered on change even for unhydrated nodes.\n\t\t\t\tanchorNode.events.on(\"childrenChanging\", () => {\n\t\t\t\t\tthis.generationNumber += 1;\n\t\t\t\t}),\n\t\t\t]),\n\t\t};\n\t}\n\n\tpublic getStatus(): TreeStatus {\n\t\tif (this.disposed) {\n\t\t\treturn TreeStatus.Deleted;\n\t\t}\n\t\tif (!isHydrated(this.#hydrationState)) {\n\t\t\treturn TreeStatus.New;\n\t\t}\n\n\t\t// TODO: Replace this check with the proper check against the cursor state when the cursor becomes part of the kernel\n\t\tconst flex = this.#hydrationState.anchorNode.slots.get(flexTreeSlot);\n\t\tif (flex !== undefined) {\n\t\t\tassert(flex instanceof LazyEntity, 0x9b4 /* Unexpected flex node implementation */);\n\t\t\tif (flex.isFreed()) {\n\t\t\t\treturn TreeStatus.Deleted;\n\t\t\t}\n\t\t}\n\n\t\treturn treeStatusFromAnchorCache(this.#hydrationState.anchorNode);\n\t}\n\n\tpublic get events(): Listenable<KernelEvents> {\n\t\t// Retrieve the correct events object based on whether this node is pre or post hydration.\n\t\treturn isHydrated(this.#hydrationState)\n\t\t\t? this.#hydrationState.anchorNode.events\n\t\t\t: this.#unhydratedEvents.value;\n\t}\n\n\tpublic dispose(): void {\n\t\tdebugAssert(() => !this.disposed || \"Cannot dispose a disposed node\");\n\t\tthis.disposed = true;\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\tfor (const off of this.#hydrationState.offAnchorNode) {\n\t\t\t\toff();\n\t\t\t}\n\t\t}\n\t\t// TODO: go to the context and remove myself from withAnchors\n\t}\n\n\tpublic isHydrated(): this is { anchorNode: AnchorNode; context: HydratedContext } {\n\t\treturn isHydrated(this.#hydrationState);\n\t}\n\n\tpublic get anchorNode(): AnchorNode | undefined {\n\t\treturn isHydrated(this.#hydrationState) ? this.#hydrationState.anchorNode : undefined;\n\t}\n\n\t/**\n\t * Retrieves the flex node associated with the given target.\n\t * @remarks\n\t * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n\t *\n\t * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n\t * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been deleted.\n\t */\n\tpublic getOrCreateInnerNode(): InnerNode {\n\t\tif (!isHydrated(this.#hydrationState)) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tthis.#hydrationState.innerNode?.context.isDisposed() === false ||\n\t\t\t\t\t\"Unhydrated node should never be disposed\",\n\t\t\t);\n\t\t\treturn this.#hydrationState.innerNode; // Unhydrated case\n\t\t}\n\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Cannot access a deleted node.\");\n\t\t}\n\n\t\tif (this.#hydrationState.innerNode === undefined) {\n\t\t\t// Marinated case -> cooked\n\t\t\tconst anchorNode = this.#hydrationState.anchorNode;\n\t\t\t// This TreeNode is bound to an anchor node, but it may or may not have an actual flex node yet\n\t\t\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\t\tif (flexNode !== undefined) {\n\t\t\t\t// If the flex node already exists, use it...\n\t\t\t\tthis.#hydrationState.innerNode = flexNode;\n\t\t\t} else {\n\t\t\t\t// ...otherwise, the flex node must be created\n\t\t\t\tconst context =\n\t\t\t\t\tanchorNode.anchorSet.slots.get(ContextSlot) ?? fail(0xb41 /* missing context */);\n\t\t\t\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\t\t\t\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\t\t\t\tthis.#hydrationState.innerNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\t\t\t\tcursor.free();\n\t\t\t\tassertFlexTreeEntityNotFreed(this.#hydrationState.innerNode);\n\t\t\t}\n\t\t}\n\n\t\treturn this.#hydrationState.innerNode;\n\t}\n\n\t/**\n\t * Retrieves the {@link UnhydratedFlexTreeNode} if unhydrated. otherwise undefined.\n\t */\n\tpublic getInnerNodeIfUnhydrated(): UnhydratedFlexTreeNode | undefined {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.#hydrationState.innerNode;\n\t}\n}\n\nconst kernelEvents = [\"childrenChangedAfterBatch\", \"subtreeChangedAfterBatch\"] as const;\n\ntype KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;\n\n/**\n * For \"cooked\" nodes this is a HydratedFlexTreeNode thats a projection of forest content.\n * For {@link Unhydrated} nodes this is a UnhydratedFlexTreeNode.\n *\n * For \"marinated\" nodes, some code (ex: getOrCreateInnerNode) returns the FlexTreeNode thats a projection of forest content, and some code (ex: tryGetInnerNode) returns undefined.\n */\nexport type InnerNode = FlexTreeNode;\n\n/**\n * Narrows innerNode to either {@link UnhydratedFlexTreeNode} or {@link HydratedFlexTreeNode}.\n */\nexport function splitInnerNodeType(\n\tinnerNode: InnerNode,\n): asserts innerNode is UnhydratedFlexTreeNode | HydratedFlexTreeNode {\n\tassert(\n\t\tinnerNode instanceof UnhydratedFlexTreeNode || innerNode.isHydrated(),\n\t\t0xbc8 /* Invalid inner node type */,\n\t);\n}\n\n/**\n * An anchor slot which associates an anchor with its corresponding {@link TreeNode}, if there is one.\n * @remarks\n * For this to work, we have to require that there is at most a single view using a given AnchorSet.\n * FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.\n */\nexport const simpleTreeNodeSlot = anchorSlot<TreeNode>();\n\n/**\n * Dispose a TreeNode (if any) for an existing anchor without disposing the anchor.\n */\nexport function tryDisposeTreeNode(anchorNode: AnchorNode): void {\n\tconst treeNode = anchorNode.slots.get(simpleTreeNodeSlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = getKernel(treeNode);\n\t\tkernel.dispose();\n\t\tanchorNode.slots.delete(simpleTreeNodeSlot);\n\t}\n}\n\n/**\n * Gets the {@link TreeNodeSchema} for the {@link InnerNode}.\n */\nexport function getSimpleNodeSchemaFromInnerNode(innerNode: InnerNode): TreeNodeSchema {\n\tconst context: Context = getSimpleContextFromInnerNode(innerNode);\n\treturn context.schema.get(innerNode.type) ?? fail(0xb3f /* missing schema from context */);\n}\n\n/**\n * Gets the {@link Context} for the {@link InnerNode}.\n */\nexport function getSimpleContextFromInnerNode(innerNode: InnerNode): Context {\n\tsplitInnerNodeType(innerNode);\n\tif (innerNode instanceof UnhydratedFlexTreeNode) {\n\t\treturn innerNode.simpleContext;\n\t}\n\n\tconst context = innerNode.anchorNode.anchorSet.slots.get(SimpleContextSlot);\n\tassert(context !== undefined, 0xa55 /* missing simple tree context */);\n\n\treturn context;\n}\n\n/**\n * Retrieves the flex node associated with the given target.\n * @remarks\n * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n *\n * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n *\n * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been deleted.\n */\nexport function getOrCreateInnerNode(treeNode: TreeNode): InnerNode {\n\tconst kernel = getKernel(treeNode);\n\treturn kernel.getOrCreateInnerNode();\n}\n\n/**\n * Gets a flex node from an anchor node\n */\nfunction flexNodeFromAnchor(anchorNode: AnchorNode): HydratedFlexTreeNode {\n\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\tif (flexNode !== undefined) {\n\t\treturn flexNode; // If it does have a flex node, return it...\n\t} // ...otherwise, the flex node must be created\n\tconst context =\n\t\tanchorNode.anchorSet.slots.get(ContextSlot) ?? fail(0xb45 /* missing context */);\n\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\tconst newFlexNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\tcursor.free();\n\treturn newFlexNode;\n}\n\n/**\n * Gets a tree node from an anchor node\n */\nexport function treeNodeFromAnchor(anchorNode: AnchorNode): TreeNode | TreeValue {\n\tconst cached = anchorNode.slots.get(simpleTreeNodeSlot);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tconst flexNode = flexNodeFromAnchor(anchorNode);\n\treturn createTreeNodeFromInner(flexNode);\n}\n\n/**\n * Constructs a TreeNode from an InnerNode.\n * @remarks\n * This does not do caching or validation: caller must ensure duplicate nodes for a given inner node are not created, and that the inner node is valid.\n */\nexport function createTreeNodeFromInner(innerNode: InnerNode): TreeNode | TreeValue {\n\tconst classSchema = getSimpleNodeSchemaFromInnerNode(innerNode);\n\tconst internal = innerNode as unknown as InternalTreeNode;\n\treturn typeof classSchema === \"function\"\n\t\t? new classSchema(internal)\n\t\t: (classSchema as { create(data: InternalTreeNode): TreeNode | TreeValue }).create(\n\t\t\t\tinternal,\n\t\t\t);\n}\n\n/**\n * Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n * @remarks\n * See also {@link ContextSlot} in which the flex-tree context is stored.\n */\nexport const SimpleContextSlot = anchorSlot<HydratedContext>();\n"]}
|
|
1
|
+
{"version":3,"file":"treeNodeKernel.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAAsF;AACtF,uEAAsE;AAEtE,kDAO6B;AAC7B,+DAAmF;AACnF,+DAS0C;AAM1C,mEAAiE;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QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC7D,MAAM,WAAW,GAAG,IAAA,0CAA+B,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,OAAO,WAAW,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAsB;IACxD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,0BAAkB,CAAC,CAAC;IACxD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AARD,gDAQC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,SAAoB;IAC3D,MAAM,WAAW,GAAG,gCAAgC,CAAC,SAAS,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,SAAwC,CAAC;IAC1D,OAAO,OAAO,WAAW,KAAK,UAAU;QACvC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC;QAC3B,CAAC,CAAE,WAAwE,CAAC,MAAM,CAChF,QAAQ,CACR,CAAC;AACL,CAAC;AARD,0DAQC;AAED;;;;;GAKG;AACU,QAAA,iBAAiB,GAAG,IAAA,qBAAU,GAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable, Off } from \"@fluidframework/core-interfaces\";\nimport { assert, Lazy, fail, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorNode,\n\ttype AnchorSet,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../../core/index.js\";\nimport { getOrCreateHydratedFlexTreeNode } from \"../../feature-libraries/index.js\";\nimport {\n\tassertFlexTreeEntityNotFreed,\n\tContextSlot,\n\tflexTreeSlot,\n\tLazyEntity,\n\tTreeStatus,\n\ttreeStatusFromAnchorCache,\n\ttype FlexTreeNode,\n\ttype HydratedFlexTreeNode,\n} from \"../../feature-libraries/index.js\";\n\nimport type { Context, HydratedContext } from \"./context.js\";\nimport type { TreeNode } from \"./treeNode.js\";\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\nimport type { InternalTreeNode, Unhydrated } from \"./types.js\";\nimport { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\n\nconst treeNodeToKernel = new WeakMap<TreeNode, TreeNodeKernel>();\n\nexport function getKernel(node: TreeNode): TreeNodeKernel {\n\tconst kernel = treeNodeToKernel.get(node);\n\tassert(kernel !== undefined, 0x9b1 /* Expected tree node to have kernel */);\n\treturn kernel;\n}\n\n/**\n * Detects if the given 'candidate' is a TreeNode.\n *\n * @remarks\n * Supports both Hydrated and {@link Unhydrated} TreeNodes, both of which return true.\n *\n * Because the common usage is to check if a value being inserted/set is a TreeNode,\n * this function permits calling with primitives as well as objects.\n *\n * Primitives will always return false (as they are copies of data, not references to nodes).\n *\n * @param candidate - Value which may be a TreeNode\n * @returns true if the given 'candidate' is a hydrated TreeNode.\n */\nexport function isTreeNode(candidate: unknown): candidate is TreeNode | Unhydrated<TreeNode> {\n\treturn treeNodeToKernel.has(candidate as TreeNode);\n}\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode}.\n *\n * Returns undefined for other values.\n * @remarks\n * Does not give schema for a {@link TreeLeafValue}.\n */\nexport function tryGetTreeNodeSchema(value: unknown): undefined | TreeNodeSchema {\n\tconst kernel = treeNodeToKernel.get(value as TreeNode);\n\treturn kernel?.schema;\n}\n\n/** The {@link HydrationState} of a {@link TreeNodeKernel} before the kernel is hydrated */\ninterface UnhydratedState {\n\toff: Off;\n\treadonly innerNode: UnhydratedFlexTreeNode;\n}\n\n/** The {@link HydrationState} of a {@link TreeNodeKernel} after the kernel is hydrated */\ninterface HydratedState {\n\t/** The flex node for this kernel (lazy - undefined if it has not yet been demanded) */\n\tinnerNode?: FlexTreeNode;\n\t/** The {@link AnchorNode} that this node is associated with. */\n\treadonly anchorNode: AnchorNode;\n\t/** All {@link Off | event deregistration functions} that should be run when the kernel is disposed. */\n\treadonly offAnchorNode: Set<Off>;\n}\n\n/** State within a {@link TreeNodeKernel} that is related to the hydration process */\ntype HydrationState = UnhydratedState | HydratedState;\n\n/** True if and only if the given {@link HydrationState} is post-hydration */\nfunction isHydrated(state: HydrationState): state is HydratedState {\n\treturn (state as Partial<HydratedState>).anchorNode !== undefined;\n}\n\n/**\n * Contains state and an internal API for managing {@link TreeNode}s.\n * @remarks All {@link TreeNode}s have an associated kernel object.\n * The kernel has the same lifetime as the node and spans both its unhydrated and hydrated states.\n */\nexport class TreeNodeKernel {\n\tprivate disposed = false;\n\n\t/**\n\t * Generation number which is incremented any time we have an edit on the node.\n\t * Used during iteration to make sure there has been no edits that were concurrently made.\n\t * @remarks\n\t * This is updated monotonically by this class when edits are applied.\n\t * TODO: update this when applying edits to unhydrated trees.\n\t *\n\t * If TypeScript supported making this immutable from outside the class without making it readonly from inside, that would be used here,\n\t * but they only way to do that is add a separate public accessor and make it private, which was deemed not worth the boilerplate, runtime overhead and bundle size.\n\t */\n\tpublic generationNumber: number = 0;\n\n\t#hydrationState: HydrationState;\n\n\t/**\n\t * Events registered before hydration.\n\t * @remarks\n\t * Since these are usually not used, they are allocated lazily as an optimization.\n\t * The laziness also avoids extra forwarding overhead for events from this kernel's anchor node and also avoids registering for events that are unneeded.\n\t * This means optimizations like skipping processing data in subtrees where no subtreeChanged events are subscribed to would be able to work,\n\t * since the kernel does not unconditionally subscribe to those events (like a design which simply forwards all events would).\n\t */\n\treadonly #unhydratedEvents = new Lazy(createEmitter<KernelEvents>);\n\n\t/**\n\t * Create a TreeNodeKernel which can be looked up with {@link getKernel}.\n\t *\n\t * @param initialContext - context from when this node was originally created. Only used when unhydrated.\n\t * @param innerNode - When unhydrated/raw or marinated the MapTreeNode. FlexTreeNode when cooked.\n\t * @remarks\n\t * Exactly one kernel per TreeNode should be created.\n\t */\n\tpublic constructor(\n\t\tpublic readonly node: TreeNode,\n\t\tpublic readonly schema: TreeNodeSchema,\n\t\tinnerNode: InnerNode,\n\t\tprivate readonly initialContext: Context,\n\t) {\n\t\tsplitInnerNodeType(innerNode);\n\n\t\tassert(!treeNodeToKernel.has(node), 0xa1a /* only one kernel per node can be made */);\n\t\ttreeNodeToKernel.set(node, this);\n\n\t\tif (innerNode instanceof UnhydratedFlexTreeNode) {\n\t\t\t// Unhydrated case\n\t\t\tdebugAssert(() => innerNode.treeNode === undefined);\n\t\t\tinnerNode.treeNode = node;\n\t\t\t// Register for change events from the unhydrated flex node.\n\t\t\t// These will be fired if the unhydrated node is edited, and will also be forwarded later to the hydrated node.\n\t\t\tthis.#hydrationState = {\n\t\t\t\tinnerNode,\n\t\t\t\toff: innerNode.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\tthis.#unhydratedEvents.value.emit(\"childrenChangedAfterBatch\", {\n\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t});\n\n\t\t\t\t\tlet unhydratedNode: UnhydratedFlexTreeNode | undefined = innerNode;\n\t\t\t\t\twhile (unhydratedNode !== undefined) {\n\t\t\t\t\t\tconst treeNode = unhydratedNode.treeNode;\n\t\t\t\t\t\tif (treeNode !== undefined) {\n\t\t\t\t\t\t\tconst kernel = getKernel(treeNode);\n\t\t\t\t\t\t\tkernel.#unhydratedEvents.value.emit(\"subtreeChangedAfterBatch\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst parentNode: FlexTreeNode | undefined =\n\t\t\t\t\t\t\tunhydratedNode.parentField.parent.parent;\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tparentNode === undefined || parentNode instanceof UnhydratedFlexTreeNode,\n\t\t\t\t\t\t\t0xb76 /* Unhydrated node's parent should be an unhydrated node */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tunhydratedNode = parentNode;\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t};\n\t\t} else {\n\t\t\t// Hydrated case\n\t\t\tthis.#hydrationState = this.createHydratedState(innerNode.anchorNode);\n\t\t\tthis.#hydrationState.innerNode = innerNode;\n\t\t}\n\t}\n\n\tpublic get context(): Context {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\t// This can't be cached on this.#hydrated during hydration since initial tree is hydrated before the context is cached on the anchorSet.\n\t\t\treturn (\n\t\t\t\tthis.#hydrationState?.anchorNode.anchorSet.slots.get(SimpleContextSlot) ??\n\t\t\t\tfail(0xb40 /* missing simple-tree context */)\n\t\t\t);\n\t\t}\n\t\treturn this.initialContext;\n\t}\n\n\t/**\n\t * Transition from {@link Unhydrated} to hydrated.\n\t * Bi-directionally associates the given hydrated TreeNode to the anchor node at the provided path.\n\t * @remarks\n\t * Happens at most once for any given node.\n\t * Cleans up mappings to {@link UnhydratedFlexTreeNode} - it is assumed that they are no longer needed once this node has an anchor node.\n\t */\n\tpublic hydrate(anchors: AnchorSet, path: UpPath): void {\n\t\tassert(!this.disposed, 0xa2a /* cannot hydrate a disposed node */);\n\t\tassert(!isHydrated(this.#hydrationState), 0xa2b /* hydration should only happen once */);\n\n\t\tconst anchor = anchors.track(path);\n\t\tconst anchorNode =\n\t\t\tanchors.locate(anchor) ?? fail(0xb42 /* Expected anchor node to be present */);\n\n\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\n\t\tthis.#hydrationState.offAnchorNode.add(() => anchors.forget(anchor));\n\n\t\t// If needed, register forwarding emitters for events from before hydration\n\t\tif (this.#unhydratedEvents.evaluated) {\n\t\t\tconst events = this.#unhydratedEvents.value;\n\t\t\tfor (const eventName of kernelEvents) {\n\t\t\t\tif (events.hasListeners(eventName)) {\n\t\t\t\t\tthis.#hydrationState.offAnchorNode.add(\n\t\t\t\t\t\t// Argument is forwarded between matching events, so the type should be correct.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tanchorNode.events.on(eventName, (arg: any) => events.emit(eventName, arg)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate createHydratedState(anchorNode: AnchorNode): HydratedState {\n\t\tassert(\n\t\t\t!anchorNode.slots.has(simpleTreeNodeSlot),\n\t\t\t0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,\n\t\t);\n\t\tanchorNode.slots.set(simpleTreeNodeSlot, this.node);\n\t\treturn {\n\t\t\tanchorNode,\n\t\t\toffAnchorNode: new Set([\n\t\t\t\tanchorNode.events.on(\"afterDestroy\", () => this.dispose()),\n\t\t\t\t// TODO: this should be triggered on change even for unhydrated nodes.\n\t\t\t\tanchorNode.events.on(\"childrenChanging\", () => {\n\t\t\t\t\tthis.generationNumber += 1;\n\t\t\t\t}),\n\t\t\t]),\n\t\t};\n\t}\n\n\tpublic getStatus(): TreeStatus {\n\t\tif (this.disposed) {\n\t\t\treturn TreeStatus.Deleted;\n\t\t}\n\t\tif (!isHydrated(this.#hydrationState)) {\n\t\t\treturn TreeStatus.New;\n\t\t}\n\n\t\t// TODO: Replace this check with the proper check against the cursor state when the cursor becomes part of the kernel\n\t\tconst flex = this.#hydrationState.anchorNode.slots.get(flexTreeSlot);\n\t\tif (flex !== undefined) {\n\t\t\tassert(flex instanceof LazyEntity, 0x9b4 /* Unexpected flex node implementation */);\n\t\t\tif (flex.isFreed()) {\n\t\t\t\treturn TreeStatus.Deleted;\n\t\t\t}\n\t\t}\n\n\t\treturn treeStatusFromAnchorCache(this.#hydrationState.anchorNode);\n\t}\n\n\tpublic get events(): Listenable<KernelEvents> {\n\t\t// Retrieve the correct events object based on whether this node is pre or post hydration.\n\t\treturn isHydrated(this.#hydrationState)\n\t\t\t? this.#hydrationState.anchorNode.events\n\t\t\t: this.#unhydratedEvents.value;\n\t}\n\n\tpublic dispose(): void {\n\t\tdebugAssert(() => !this.disposed || \"Cannot dispose a disposed node\");\n\t\tthis.disposed = true;\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\tfor (const off of this.#hydrationState.offAnchorNode) {\n\t\t\t\toff();\n\t\t\t}\n\t\t}\n\t\t// TODO: go to the context and remove myself from withAnchors\n\t}\n\n\tpublic isHydrated(): this is { anchorNode: AnchorNode; context: HydratedContext } {\n\t\treturn isHydrated(this.#hydrationState);\n\t}\n\n\tpublic get anchorNode(): AnchorNode | undefined {\n\t\treturn isHydrated(this.#hydrationState) ? this.#hydrationState.anchorNode : undefined;\n\t}\n\n\t/**\n\t * Retrieves the flex node associated with the given target.\n\t * @remarks\n\t * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n\t *\n\t * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n\t * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been deleted.\n\t */\n\tpublic getOrCreateInnerNode(): InnerNode {\n\t\tif (!isHydrated(this.#hydrationState)) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tthis.#hydrationState.innerNode?.context.isDisposed() === false ||\n\t\t\t\t\t\"Unhydrated node should never be disposed\",\n\t\t\t);\n\t\t\treturn this.#hydrationState.innerNode; // Unhydrated case\n\t\t}\n\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Cannot access a deleted node.\");\n\t\t}\n\n\t\tif (this.#hydrationState.innerNode === undefined) {\n\t\t\t// Marinated case -> cooked\n\t\t\tconst anchorNode = this.#hydrationState.anchorNode;\n\t\t\t// This TreeNode is bound to an anchor node, but it may or may not have an actual flex node yet\n\t\t\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\t\tif (flexNode !== undefined) {\n\t\t\t\t// If the flex node already exists, use it...\n\t\t\t\tthis.#hydrationState.innerNode = flexNode;\n\t\t\t} else {\n\t\t\t\t// ...otherwise, the flex node must be created\n\t\t\t\tconst context =\n\t\t\t\t\tanchorNode.anchorSet.slots.get(ContextSlot) ?? fail(0xb41 /* missing context */);\n\t\t\t\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\t\t\t\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\t\t\t\tthis.#hydrationState.innerNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\t\t\t\tcursor.free();\n\t\t\t\tassertFlexTreeEntityNotFreed(this.#hydrationState.innerNode);\n\t\t\t}\n\t\t}\n\n\t\treturn this.#hydrationState.innerNode;\n\t}\n\n\t/**\n\t * Retrieves the {@link UnhydratedFlexTreeNode} if unhydrated. otherwise undefined.\n\t */\n\tpublic getInnerNodeIfUnhydrated(): UnhydratedFlexTreeNode | undefined {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.#hydrationState.innerNode;\n\t}\n}\n\nconst kernelEvents = [\"childrenChangedAfterBatch\", \"subtreeChangedAfterBatch\"] as const;\n\ntype KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;\n\n/**\n * For \"cooked\" nodes this is a HydratedFlexTreeNode thats a projection of forest content.\n * For {@link Unhydrated} nodes this is a UnhydratedFlexTreeNode.\n *\n * For \"marinated\" nodes, some code (ex: getOrCreateInnerNode) returns the FlexTreeNode thats a projection of forest content, and some code (ex: tryGetInnerNode) returns undefined.\n */\nexport type InnerNode = FlexTreeNode;\n\n/**\n * Narrows innerNode to either {@link UnhydratedFlexTreeNode} or {@link HydratedFlexTreeNode}.\n */\nexport function splitInnerNodeType(\n\tinnerNode: InnerNode,\n): asserts innerNode is UnhydratedFlexTreeNode | HydratedFlexTreeNode {\n\tassert(\n\t\tinnerNode instanceof UnhydratedFlexTreeNode || innerNode.isHydrated(),\n\t\t0xbc8 /* Invalid inner node type */,\n\t);\n}\n\n/**\n * An anchor slot which associates an anchor with its corresponding {@link TreeNode}, if there is one.\n * @remarks\n * For this to work, we have to require that there is at most a single view using a given AnchorSet.\n * FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.\n */\nexport const simpleTreeNodeSlot = anchorSlot<TreeNode>();\n\n/**\n * Dispose a TreeNode (if any) for an existing anchor without disposing the anchor.\n */\nexport function tryDisposeTreeNode(anchorNode: AnchorNode): void {\n\tconst treeNode = anchorNode.slots.get(simpleTreeNodeSlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = getKernel(treeNode);\n\t\tkernel.dispose();\n\t\tanchorNode.slots.delete(simpleTreeNodeSlot);\n\t}\n}\n\n/**\n * Gets the {@link TreeNodeSchema} for the {@link InnerNode}.\n */\nexport function getSimpleNodeSchemaFromInnerNode(innerNode: InnerNode): TreeNodeSchema {\n\tconst context: Context = getSimpleContextFromInnerNode(innerNode);\n\treturn context.schema.get(innerNode.type) ?? fail(0xb3f /* missing schema from context */);\n}\n\n/**\n * Gets the {@link Context} for the {@link InnerNode}.\n */\nexport function getSimpleContextFromInnerNode(innerNode: InnerNode): Context {\n\tsplitInnerNodeType(innerNode);\n\tif (innerNode instanceof UnhydratedFlexTreeNode) {\n\t\treturn innerNode.simpleContext;\n\t}\n\n\tconst context = innerNode.anchorNode.anchorSet.slots.get(SimpleContextSlot);\n\tassert(context !== undefined, 0xa55 /* missing simple tree context */);\n\n\treturn context;\n}\n\n/**\n * Retrieves the flex node associated with the given target.\n * @remarks\n * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n *\n * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n *\n * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been deleted.\n */\nexport function getOrCreateInnerNode(treeNode: TreeNode): InnerNode {\n\tconst kernel = getKernel(treeNode);\n\treturn kernel.getOrCreateInnerNode();\n}\n\n/**\n * Gets a flex node from an anchor node\n */\nfunction flexNodeFromAnchor(anchorNode: AnchorNode): HydratedFlexTreeNode {\n\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\tif (flexNode !== undefined) {\n\t\treturn flexNode; // If it does have a flex node, return it...\n\t} // ...otherwise, the flex node must be created\n\tconst context =\n\t\tanchorNode.anchorSet.slots.get(ContextSlot) ?? fail(0xb45 /* missing context */);\n\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\tconst newFlexNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\tcursor.free();\n\treturn newFlexNode;\n}\n\n/**\n * Gets a tree node from an anchor node\n */\nexport function treeNodeFromAnchor(anchorNode: AnchorNode): TreeNode | TreeValue {\n\tconst cached = anchorNode.slots.get(simpleTreeNodeSlot);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tconst flexNode = flexNodeFromAnchor(anchorNode);\n\treturn createTreeNodeFromInner(flexNode);\n}\n\n/**\n * Constructs a TreeNode from an InnerNode.\n * @remarks\n * This does not do caching or validation: caller must ensure duplicate nodes for a given inner node are not created, and that the inner node is valid.\n */\nexport function createTreeNodeFromInner(innerNode: InnerNode): TreeNode | TreeValue {\n\tconst classSchema = getSimpleNodeSchemaFromInnerNode(innerNode);\n\tconst internal = innerNode as unknown as InternalTreeNode;\n\treturn typeof classSchema === \"function\"\n\t\t? new classSchema(internal)\n\t\t: (classSchema as { create(data: InternalTreeNode): TreeNode | TreeValue }).create(\n\t\t\t\tinternal,\n\t\t\t);\n}\n\n/**\n * Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n * @remarks\n * See also {@link ContextSlot} in which the flex-tree context is stored.\n */\nexport const SimpleContextSlot = anchorSlot<HydratedContext>();\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type FlexTreeNode } from "../../feature-libraries/index.js";
|
|
6
6
|
import { TreeNode } from "./treeNode.js";
|
|
7
|
-
import
|
|
7
|
+
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
8
8
|
import { NodeKind, type TreeNodeSchema, type TreeNodeSchemaCore, type TreeNodeSchemaInitializedData, type TreeNodeSchemaPrivateData } from "./treeNodeSchema.js";
|
|
9
9
|
import type { InternalTreeNode } from "./types.js";
|
|
10
10
|
import type { ImplicitAnnotatedAllowedTypes } from "./allowedTypes.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeValid.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAGrF,OAAO,EAAkC,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"treeNodeValid.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAGrF,OAAO,EAAkC,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACN,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;;;;GAOG;AACH,8BAAsB,aAAa,CAAC,MAAM,CAAE,SAAQ,QAAQ;IAC3D;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M,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,EAAE,OAAO,aAAa,GAAG,cAAc,CAAC;IAC5D,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,GACnD,OAAO,aAAa,GAAG,cAAc,CAWvC;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EACrD,0BAA0B,EAAE,SAAS,6BAA6B,EAAE,GAClE,yBAAyB,CAU3B"}
|
|
@@ -10,6 +10,7 @@ const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
|
10
10
|
const index_js_1 = require("../../feature-libraries/index.js");
|
|
11
11
|
const flexList_js_1 = require("./flexList.js");
|
|
12
12
|
const treeNode_js_1 = require("./treeNode.js");
|
|
13
|
+
const unhydratedFlexTree_js_1 = require("./unhydratedFlexTree.js");
|
|
13
14
|
const treeNodeSchema_js_1 = require("./treeNodeSchema.js");
|
|
14
15
|
const treeNodeKernel_js_1 = require("./treeNodeKernel.js");
|
|
15
16
|
const withType_js_1 = require("./withType.js");
|
|
@@ -114,10 +115,16 @@ class TreeNodeValid extends treeNode_js_1.TreeNode {
|
|
|
114
115
|
const node = (0, index_js_1.isFlexTreeNode)(input) ? input : schema.buildRawNode(this, input);
|
|
115
116
|
(0, internal_1.assert)((0, treeNodeKernel_js_1.getSimpleNodeSchemaFromInnerNode)(node) === schema, 0x83b /* building node with wrong schema */);
|
|
116
117
|
const result = schema.prepareInstance(this, node);
|
|
118
|
+
// For unhydrated nodes, grab the context from the `simpleContext` (which likely is from cache.oneTimeInitialized.context,
|
|
119
|
+
// but might be customized for better schema evolution support like unknown optional fields like in clone)
|
|
120
|
+
// For hydrated nodes, this context is unused, so using the default from cache.oneTimeInitialized.context is always fine.
|
|
121
|
+
const context = node instanceof unhydratedFlexTree_js_1.UnhydratedFlexTreeNode
|
|
122
|
+
? node.simpleContext
|
|
123
|
+
: cache.oneTimeInitialized.context;
|
|
117
124
|
// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.
|
|
118
125
|
// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,
|
|
119
126
|
// so just relying on the WeakMap seems like the cleanest approach.
|
|
120
|
-
new treeNodeKernel_js_1.TreeNodeKernel(result, schema, node,
|
|
127
|
+
new treeNodeKernel_js_1.TreeNodeKernel(result, schema, node, context);
|
|
121
128
|
return result;
|
|
122
129
|
}
|
|
123
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,uEAAsE;AAEtE,+DAAqF;AAErF,+CAA0C;AAC1C,+CAAyE;AAEzE,2DAM6B;AAC7B,2DAK6B;AAE7B,+CAAiD;AAGjD;;;;;;;GAOG;AACH,MAAsB,aAAsB,SAAQ,sBAAQ;IAC3D;;;;;;;OAOG;IACO,MAAM,CAAC,eAAe,CAE/B,QAA0B,EAC1B,KAAmB;QAEnB,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,YAAY,CAE5B,QAA0B,EAC1B,KAAQ;QAER,OAAO,IAAA,eAAI,EAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACO,MAAM,CAAC,YAAY;QAG5B,IAAA,eAAI,EAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAsBD;;OAEG;IACI,MAAM,CAAC,eAAe;QAC5B,IAAA,iBAAM,EAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE/E,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AC/D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,QAAQ;QACR,+HAA+H;QAC/H,qDAAqD;QACrD,qCAAqC;QACrC,2DAA2D;QAE3D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type FlexTreeNode, isFlexTreeNode } from \"../../feature-libraries/index.js\";\n\nimport { markEager } from \"./flexList.js\";\nimport { inPrototypeChain, privateToken, TreeNode } from \"./treeNode.js\";\nimport type { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCore,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaPrivateData,\n} from \"./treeNodeSchema.js\";\nimport {\n\tgetSimpleNodeSchemaFromInnerNode,\n\tisTreeNode,\n\tTreeNodeKernel,\n\ttype InnerNode,\n} from \"./treeNodeKernel.js\";\nimport type { InternalTreeNode } from \"./types.js\";\nimport { typeSchemaSymbol } from \"./withType.js\";\nimport type { ImplicitAnnotatedAllowedTypes } from \"./allowedTypes.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t * @remarks\n\t * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).\n\t */\n\tprotected static oneTimeSetup<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t): TreeNodeSchemaInitializedData {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * See {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tpublic static oneTimeInitialize(\n\t\tthis: typeof TreeNodeValid & TreeNodeSchema,\n\t): Required<MostDerivedData> {\n\t\tconst cache = this.markMostDerived();\n\t\tcache.oneTimeInitialized ??= this.oneTimeSetup();\n\t\t// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:\n\t\treturn cache as MostDerivedData & { oneTimeInitialized: TreeNodeSchemaInitializedData };\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.oneTimeInitialize();\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once TreeBeta.clone is stable.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). `TreeBeta.clone` can be used to do this.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, cache.oneTimeInitialized.context);\n\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: TreeNodeSchemaInitializedData;\n}\n\n/**\n * Cast `schema` to a {@link TreeNodeValid}, asserting it actually extends it.\n */\nexport function schemaAsTreeNodeValid(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): typeof TreeNodeValid & TreeNodeSchema {\n\tif (!inPrototypeChain(schema, TreeNodeValid)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t);\n\t}\n\n\treturn schema as typeof TreeNodeValid & TreeNodeSchema;\n}\n\n/**\n * Provides the {@link TreeNodeSchemaPrivateData} for class based implementations of {@link asTreeNodeSchemaCorePrivate}.\n * @remarks\n * Such schema must extends {@link TreeNodeValid}.\n */\nexport function createTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n\tchildAnnotatedAllowedTypes: readonly ImplicitAnnotatedAllowedTypes[],\n): TreeNodeSchemaPrivateData {\n\tconst schemaValid = schemaAsTreeNodeValid(schema);\n\t// Since this closes over the schema, ensure this schema is marked as most derived\n\t// so if some other subclass is used later, it will error instead of giving inconsistent results.\n\tschemaValid.markMostDerived();\n\n\treturn {\n\t\tidempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,\n\t\tchildAnnotatedAllowedTypes,\n\t};\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeValid.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,uEAAsE;AAEtE,+DAAqF;AAErF,+CAA0C;AAC1C,+CAAyE;AACzE,mEAAiE;AACjE,2DAM6B;AAC7B,2DAK6B;AAE7B,+CAAiD;AAGjD;;;;;;;GAOG;AACH,MAAsB,aAAsB,SAAQ,sBAAQ;IAC3D;;;;;;;OAOG;IACO,MAAM,CAAC,eAAe,CAE/B,QAA0B,EAC1B,KAAmB;QAEnB,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,YAAY,CAE5B,QAA0B,EAC1B,KAAQ;QAER,OAAO,IAAA,eAAI,EAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACO,MAAM,CAAC,YAAY;QAG5B,IAAA,eAAI,EAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAsBD;;OAEG;IACI,MAAM,CAAC,eAAe;QAC5B,IAAA,iBAAM,EAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE/E,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YAC1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,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAkB,CAAC,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,QAAQ;QACR,+HAA+H;QAC/H,qDAAqD;QACrD,qCAAqC;QACrC,2DAA2D;QAE3D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type FlexTreeNode, isFlexTreeNode } from \"../../feature-libraries/index.js\";\n\nimport { markEager } from \"./flexList.js\";\nimport { inPrototypeChain, privateToken, TreeNode } from \"./treeNode.js\";\nimport { UnhydratedFlexTreeNode } from \"./unhydratedFlexTree.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCore,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaPrivateData,\n} from \"./treeNodeSchema.js\";\nimport {\n\tgetSimpleNodeSchemaFromInnerNode,\n\tisTreeNode,\n\tTreeNodeKernel,\n\ttype InnerNode,\n} from \"./treeNodeKernel.js\";\nimport type { InternalTreeNode } from \"./types.js\";\nimport { typeSchemaSymbol } from \"./withType.js\";\nimport type { ImplicitAnnotatedAllowedTypes } from \"./allowedTypes.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t * @remarks\n\t * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).\n\t */\n\tprotected static oneTimeSetup<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t): TreeNodeSchemaInitializedData {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * See {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tpublic static oneTimeInitialize(\n\t\tthis: typeof TreeNodeValid & TreeNodeSchema,\n\t): Required<MostDerivedData> {\n\t\tconst cache = this.markMostDerived();\n\t\tcache.oneTimeInitialized ??= this.oneTimeSetup();\n\t\t// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:\n\t\treturn cache as MostDerivedData & { oneTimeInitialized: TreeNodeSchemaInitializedData };\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.oneTimeInitialize();\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once TreeBeta.clone is stable.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). `TreeBeta.clone` can be used to do this.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// For unhydrated nodes, grab the context from the `simpleContext` (which likely is from cache.oneTimeInitialized.context,\n\t\t// but might be customized for better schema evolution support like unknown optional fields like in clone)\n\t\t// For hydrated nodes, this context is unused, so using the default from cache.oneTimeInitialized.context is always fine.\n\t\tconst context =\n\t\t\tnode instanceof UnhydratedFlexTreeNode\n\t\t\t\t? node.simpleContext\n\t\t\t\t: cache.oneTimeInitialized.context;\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, context);\n\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: TreeNodeSchemaInitializedData;\n}\n\n/**\n * Cast `schema` to a {@link TreeNodeValid}, asserting it actually extends it.\n */\nexport function schemaAsTreeNodeValid(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): typeof TreeNodeValid & TreeNodeSchema {\n\tif (!inPrototypeChain(schema, TreeNodeValid)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t);\n\t}\n\n\treturn schema as typeof TreeNodeValid & TreeNodeSchema;\n}\n\n/**\n * Provides the {@link TreeNodeSchemaPrivateData} for class based implementations of {@link asTreeNodeSchemaCorePrivate}.\n * @remarks\n * Such schema must extends {@link TreeNodeValid}.\n */\nexport function createTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n\tchildAnnotatedAllowedTypes: readonly ImplicitAnnotatedAllowedTypes[],\n): TreeNodeSchemaPrivateData {\n\tconst schemaValid = schemaAsTreeNodeValid(schema);\n\t// Since this closes over the schema, ensure this schema is marked as most derived\n\t// so if some other subclass is used later, it will error instead of giving inconsistent results.\n\tschemaValid.markMostDerived();\n\n\treturn {\n\t\tidempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,\n\t\tchildAnnotatedAllowedTypes,\n\t};\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
|
|
@@ -6,14 +6,17 @@ import { type NormalizedAnnotatedAllowedTypes } from "./allowedTypes.js";
|
|
|
6
6
|
import { type TreeNodeSchema } from "./treeNodeSchema.js";
|
|
7
7
|
/**
|
|
8
8
|
* Traverses all {@link TreeNodeSchema} schema reachable from `schema`, applying the visitor pattern.
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
11
|
export declare function walkNodeSchema(schema: TreeNodeSchema, visitor: SchemaVisitor, visitedSet: Set<TreeNodeSchema>): void;
|
|
11
12
|
/**
|
|
12
13
|
* Traverses all {@link TreeNodeSchema} schema reachable from `allowedTypes`, applying the visitor pattern.
|
|
14
|
+
* @internal
|
|
13
15
|
*/
|
|
14
16
|
export declare function walkAllowedTypes(annotatedAllowedTypes: NormalizedAnnotatedAllowedTypes, visitor: SchemaVisitor, visitedSet?: Set<TreeNodeSchema>): void;
|
|
15
17
|
/**
|
|
16
18
|
* Callbacks for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.
|
|
19
|
+
* @internal
|
|
17
20
|
*/
|
|
18
21
|
export interface SchemaVisitor {
|
|
19
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walkSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/walkSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,+BAA+B,EACpC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExF
|
|
1
|
+
{"version":3,"file":"walkSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/walkSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,+BAA+B,EACpC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC7B,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,qBAAqB,EAAE,+BAA+B,EACtD,OAAO,EAAE,aAAa,EACtB,UAAU,GAAE,GAAG,CAAC,cAAc,CAAa,GACzC,IAAI,CAKN;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,+BAA+B,KAAK,IAAI,CAAC;CACvE"}
|
|
@@ -9,6 +9,7 @@ const allowedTypes_js_1 = require("./allowedTypes.js");
|
|
|
9
9
|
const treeNodeSchema_js_1 = require("./treeNodeSchema.js");
|
|
10
10
|
/**
|
|
11
11
|
* Traverses all {@link TreeNodeSchema} schema reachable from `schema`, applying the visitor pattern.
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
14
|
function walkNodeSchema(schema, visitor, visitedSet) {
|
|
14
15
|
if (visitedSet.has(schema)) {
|
|
@@ -31,6 +32,7 @@ function walkNodeSchema(schema, visitor, visitedSet) {
|
|
|
31
32
|
exports.walkNodeSchema = walkNodeSchema;
|
|
32
33
|
/**
|
|
33
34
|
* Traverses all {@link TreeNodeSchema} schema reachable from `allowedTypes`, applying the visitor pattern.
|
|
35
|
+
* @internal
|
|
34
36
|
*/
|
|
35
37
|
function walkAllowedTypes(annotatedAllowedTypes, visitor, visitedSet = new Set()) {
|
|
36
38
|
for (const { type } of annotatedAllowedTypes.types) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walkSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/walkSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAG2B;AAC3B,2DAAwF;AAExF
|
|
1
|
+
{"version":3,"file":"walkSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/walkSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAG2B;AAC3B,2DAAwF;AAExF;;;GAGG;AACH,SAAgB,cAAc,CAC7B,MAAsB,EACtB,OAAsB,EACtB,UAA+B;IAE/B,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO;IACR,CAAC;IAED,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEvB,wGAAwG;IACxG,kFAAkF;IAClF,0DAA0D;IAC1D,MAAM,qBAAqB,GAC1B,IAAA,gDAA4B,EAAC,MAAM,CAAC,CAAC,0BAA0B,CAAC;IAEjE,KAAK,MAAM,iBAAiB,IAAI,qBAAqB,EAAE,CAAC;QACvD,gBAAgB,CAAC,IAAA,gDAA8B,EAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1F,CAAC;IAED,kFAAkF;IAClF,4CAA4C;IAC5C,wGAAwG;IACxG,gIAAgI;IAChI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AA1BD,wCA0BC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAC/B,qBAAsD,EACtD,OAAsB,EACtB,aAAkC,IAAI,GAAG,EAAE;IAE3C,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACpD,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,CAAC,YAAY,EAAE,CAAC,qBAAqB,CAAC,CAAC;AAC/C,CAAC;AATD,4CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tnormalizeAnnotatedAllowedTypes,\n\ttype NormalizedAnnotatedAllowedTypes,\n} from \"./allowedTypes.js\";\nimport { getTreeNodeSchemaPrivateData, type TreeNodeSchema } from \"./treeNodeSchema.js\";\n\n/**\n * Traverses all {@link TreeNodeSchema} schema reachable from `schema`, applying the visitor pattern.\n * @internal\n */\nexport function walkNodeSchema(\n\tschema: TreeNodeSchema,\n\tvisitor: SchemaVisitor,\n\tvisitedSet: Set<TreeNodeSchema>,\n): void {\n\tif (visitedSet.has(schema)) {\n\t\treturn;\n\t}\n\n\tvisitedSet.add(schema);\n\n\t// Since walkNodeSchema is used in the implementation of TreeNodeSchemaPrivateData.idempotentInitialize,\n\t// Avoid depending on it here to avoid circular dependencies for recursive schema.\n\t// Instead normalize/evaluate the allowed types as needed.\n\tconst annotatedAllowedTypes =\n\t\tgetTreeNodeSchemaPrivateData(schema).childAnnotatedAllowedTypes;\n\n\tfor (const fieldAllowedTypes of annotatedAllowedTypes) {\n\t\twalkAllowedTypes(normalizeAnnotatedAllowedTypes(fieldAllowedTypes), visitor, visitedSet);\n\t}\n\n\t// This visit is done at the end so the traversal order is most inner types first.\n\t// This was picked since when fixing errors,\n\t// working from the inner types out to the types that use them will probably go better than the reverse.\n\t// This does not however ensure all types referenced by a type are visited before it, since in recursive cases thats impossible.\n\tvisitor.node?.(schema);\n}\n\n/**\n * Traverses all {@link TreeNodeSchema} schema reachable from `allowedTypes`, applying the visitor pattern.\n * @internal\n */\nexport function walkAllowedTypes(\n\tannotatedAllowedTypes: NormalizedAnnotatedAllowedTypes,\n\tvisitor: SchemaVisitor,\n\tvisitedSet: Set<TreeNodeSchema> = new Set(),\n): void {\n\tfor (const { type } of annotatedAllowedTypes.types) {\n\t\twalkNodeSchema(type, visitor, visitedSet);\n\t}\n\tvisitor.allowedTypes?.(annotatedAllowedTypes);\n}\n\n/**\n * Callbacks for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.\n * @internal\n */\nexport interface SchemaVisitor {\n\t/**\n\t * Called once for each node schema.\n\t */\n\tnode?: (schema: TreeNodeSchema) => void;\n\t/**\n\t * Called once for each set of allowed types.\n\t * Includes implicit allowed types (when a single type was used instead of an array).\n\t *\n\t * This includes every field, but also the allowed types array for maps and arrays and the root if starting at {@link walkAllowedTypes}.\n\t */\n\tallowedTypes?: (allowedTypes: NormalizedAnnotatedAllowedTypes) => void;\n}\n"]}
|
|
@@ -6,6 +6,8 @@ import { Context, type TreeNodeSchema, type TreeNodeSchemaInitializedData } from
|
|
|
6
6
|
import { type ImplicitFieldSchema } from "./fieldSchema.js";
|
|
7
7
|
/**
|
|
8
8
|
* Utility for creating {@link Context}s for unhydrated nodes.
|
|
9
|
+
* @remarks
|
|
10
|
+
* The resulting context will not allow any unknown optional fields.
|
|
9
11
|
*/
|
|
10
12
|
export declare function getUnhydratedContext(schema: ImplicitFieldSchema): Context;
|
|
11
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../../src/simple-tree/createContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,OAAO,EAIP,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAKlF
|
|
1
|
+
{"version":3,"file":"createContext.d.ts","sourceRoot":"","sources":["../../src/simple-tree/createContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,OAAO,EAIP,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAKlF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAUzE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,IAAI,CAAC,6BAA6B,EAAE,eAAe,GAAG,0BAA0B,CAAC,GACxF,6BAA6B,CAS/B"}
|
|
@@ -13,12 +13,14 @@ const toStoredSchema_js_1 = require("./toStoredSchema.js");
|
|
|
13
13
|
const contextCache = new WeakMap();
|
|
14
14
|
/**
|
|
15
15
|
* Utility for creating {@link Context}s for unhydrated nodes.
|
|
16
|
+
* @remarks
|
|
17
|
+
* The resulting context will not allow any unknown optional fields.
|
|
16
18
|
*/
|
|
17
19
|
function getUnhydratedContext(schema) {
|
|
18
20
|
return (0, index_js_2.getOrCreate)(contextCache, schema, (s) => {
|
|
19
21
|
const normalized = (0, fieldSchema_js_1.normalizeFieldSchema)(schema);
|
|
20
22
|
const flexContext = new index_js_3.UnhydratedContext(index_js_1.defaultSchemaPolicy, (0, toStoredSchema_js_1.toStoredSchema)(schema));
|
|
21
|
-
return new index_js_3.Context(normalized.annotatedAllowedTypesNormalized
|
|
23
|
+
return new index_js_3.Context(flexContext, index_js_3.Context.schemaMapFromRootSchema(normalized.annotatedAllowedTypesNormalized));
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
exports.getUnhydratedContext = getUnhydratedContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../src/simple-tree/createContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAAoE;AACpE,+CAA+C;AAE/C,8CAOyB;AACzB,qDAAkF;AAClF,2DAAqD;AAErD,MAAM,YAAY,GAA0C,IAAI,OAAO,EAAE,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../src/simple-tree/createContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAAoE;AACpE,+CAA+C;AAE/C,8CAOyB;AACzB,qDAAkF;AAClF,2DAAqD;AAErD,MAAM,YAAY,GAA0C,IAAI,OAAO,EAAE,CAAC;AAE1E;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,MAA2B;IAC/D,OAAO,IAAA,sBAAW,EAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;QAC9C,MAAM,UAAU,GAAG,IAAA,qCAAoB,EAAC,MAAM,CAAC,CAAC;QAEhD,MAAM,WAAW,GAAG,IAAI,4BAAiB,CAAC,8BAAmB,EAAE,IAAA,kCAAc,EAAC,MAAM,CAAC,CAAC,CAAC;QACvF,OAAO,IAAI,kBAAO,CACjB,WAAW,EACX,kBAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAC3E,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAVD,oDAUC;AAED;;GAEG;AACH,SAAgB,gCAAgC,CAC/C,MAAsB,EACtB,OAA0F;IAE1F,MAAM,IAAI,GAAG,IAAA,uCAA4B,EAAC,MAAM,CAAC,CAAC;IAClD,OAAO;QACN,GAAG,OAAO;QACV,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC;QACrC,0BAA0B,EAAE,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAC9D,yCAA8B,CAC9B;KACD,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 { defaultSchemaPolicy } from \"../feature-libraries/index.js\";\nimport { getOrCreate } from \"../util/index.js\";\n\nimport {\n\tContext,\n\tgetTreeNodeSchemaPrivateData,\n\tnormalizeAnnotatedAllowedTypes,\n\tUnhydratedContext,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaInitializedData,\n} from \"./core/index.js\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"./fieldSchema.js\";\nimport { toStoredSchema } from \"./toStoredSchema.js\";\n\nconst contextCache: WeakMap<ImplicitFieldSchema, Context> = new WeakMap();\n\n/**\n * Utility for creating {@link Context}s for unhydrated nodes.\n * @remarks\n * The resulting context will not allow any unknown optional fields.\n */\nexport function getUnhydratedContext(schema: ImplicitFieldSchema): Context {\n\treturn getOrCreate(contextCache, schema, (s) => {\n\t\tconst normalized = normalizeFieldSchema(schema);\n\n\t\tconst flexContext = new UnhydratedContext(defaultSchemaPolicy, toStoredSchema(schema));\n\t\treturn new Context(\n\t\t\tflexContext,\n\t\t\tContext.schemaMapFromRootSchema(normalized.annotatedAllowedTypesNormalized),\n\t\t);\n\t});\n}\n\n/**\n * Utility for creating {@link TreeNodeSchemaInitializedData}.\n */\nexport function getTreeNodeSchemaInitializedData(\n\tschema: TreeNodeSchema,\n\thandler: Pick<TreeNodeSchemaInitializedData, \"toFlexContent\" | \"shallowCompatibilityTest\">,\n): TreeNodeSchemaInitializedData {\n\tconst data = getTreeNodeSchemaPrivateData(schema);\n\treturn {\n\t\t...handler,\n\t\tcontext: getUnhydratedContext(schema),\n\t\tchildAnnotatedAllowedTypes: data.childAnnotatedAllowedTypes.map(\n\t\t\tnormalizeAnnotatedAllowedTypes,\n\t\t),\n\t};\n}\n"]}
|
|
@@ -313,6 +313,7 @@ export declare class FieldSchemaAlpha<Kind extends FieldKind = FieldKind, Types
|
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
315
315
|
* Normalizes a {@link ImplicitFieldSchema} or {@link ImplicitAnnotatedFieldSchema} to a {@link FieldSchema}.
|
|
316
|
+
* @internal
|
|
316
317
|
*/
|
|
317
318
|
export declare function normalizeFieldSchema(schema: ImplicitFieldSchema | ImplicitAnnotatedFieldSchema): FieldSchemaAlpha;
|
|
318
319
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/fieldSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACN,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EAIxB,KAAK,4BAA4B,EACjC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACX,cAAc,EACd,QAAQ,EACR,sBAAsB,EACtB,+BAA+B,EAC/B,oBAAoB,EACpB,6BAA6B,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,gCAAgC,EAChC,aAAa,EACb,0CAA0C,EAC1C,MAAM,iBAAiB,CAAC;AAQzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;;;;;GAMG;AACH,oBAAY,SAAS;IACpB;;;;OAIG;IACH,QAAQ,IAAA;IACR;;;;O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