@fluidframework/tree 2.32.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/api-report/tree.alpha.api.md +169 -192
- package/api-report/tree.beta.api.md +135 -164
- package/api-report/tree.legacy.alpha.api.md +138 -167
- package/api-report/tree.legacy.public.api.md +135 -164
- package/api-report/tree.public.api.md +135 -164
- package/dist/alpha.d.ts +3 -11
- package/dist/beta.d.ts +2 -11
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js +1 -2
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +4 -11
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +7 -14
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +31 -24
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +1 -4
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +1 -13
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +6 -29
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +11 -50
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +12 -9
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +19 -32
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -11
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +5 -0
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +4 -0
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -22
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +29 -25
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -7
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +6 -6
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +2 -11
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -11
- package/dist/serializableDomainSchema.d.ts +5 -5
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +1 -0
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js +4 -0
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +3 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +4 -35
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +4 -54
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +28 -28
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +11 -11
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +14 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/dist/simple-tree/api/tree.d.ts +1 -14
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +237 -220
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -2
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +39 -24
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/types.d.ts +14 -4
- package/dist/simple-tree/core/types.d.ts.map +1 -1
- package/dist/simple-tree/core/types.js +14 -4
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +3 -0
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +9 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +3 -0
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +10 -5
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +5 -2
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/tableSchema.d.ts +78 -26
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +53 -24
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts +6 -12
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +56 -5
- package/dist/treeFactory.js.map +1 -1
- package/lib/alpha.d.ts +3 -11
- package/lib/beta.d.ts +2 -11
- 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/schema-stored/index.d.ts +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +1 -1
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +4 -11
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +6 -12
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +31 -24
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +1 -4
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +0 -9
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +6 -29
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +12 -51
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +12 -9
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +19 -32
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -11
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +5 -0
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +5 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +15 -22
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +28 -24
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +1 -7
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +6 -6
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +2 -11
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -11
- package/lib/serializableDomainSchema.d.ts +5 -5
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +1 -0
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js +4 -0
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +4 -35
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -51
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +28 -28
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +11 -11
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +12 -0
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/lib/simple-tree/api/tree.d.ts +1 -14
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +237 -220
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -2
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +40 -25
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/types.d.ts +14 -4
- package/lib/simple-tree/core/types.d.ts.map +1 -1
- package/lib/simple-tree/core/types.js +14 -4
- package/lib/simple-tree/core/types.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +3 -0
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +9 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +4 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +10 -5
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +5 -2
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/tableSchema.d.ts +78 -26
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +53 -24
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts +6 -12
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +55 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +22 -23
- package/src/core/index.ts +0 -2
- package/src/core/schema-stored/index.ts +0 -2
- package/src/core/schema-stored/schema.ts +10 -29
- package/src/core/tree/anchorSet.ts +32 -24
- package/src/core/tree/deltaUtil.ts +1 -13
- package/src/core/tree/visitDelta.ts +24 -81
- package/src/core/tree/visitorUtils.ts +43 -53
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +7 -22
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +45 -27
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
- package/src/feature-libraries/flex-tree/context.ts +11 -1
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -0
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +17 -28
- package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +39 -38
- package/src/feature-libraries/object-forest/objectForest.ts +1 -18
- package/src/feature-libraries/schema-index/codec.ts +1 -2
- package/src/index.ts +3 -11
- package/src/internalTypes.ts +0 -19
- package/src/jsonDomainSchema.ts +1 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +6 -0
- package/src/shared-tree/index.ts +8 -3
- package/src/shared-tree/sharedTree.ts +5 -133
- package/src/simple-tree/api/index.ts +2 -22
- package/src/simple-tree/api/schemaFactory.ts +40 -54
- package/src/simple-tree/api/schemaFactoryAlpha.ts +9 -14
- package/src/simple-tree/api/schemaFactoryRecursive.ts +25 -5
- package/src/simple-tree/api/tree.ts +1 -14
- package/src/simple-tree/api/typesUnsafe.ts +359 -341
- package/src/simple-tree/arrayNode.ts +2 -2
- package/src/simple-tree/core/treeNodeKernel.ts +46 -28
- package/src/simple-tree/core/types.ts +14 -4
- package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
- package/src/simple-tree/index.ts +2 -22
- package/src/simple-tree/objectNode.ts +13 -4
- package/src/simple-tree/schemaTypes.ts +11 -7
- package/src/tableSchema.ts +190 -63
- package/src/treeFactory.ts +151 -8
|
@@ -18,6 +18,7 @@ var _TreeNodeKernel_hydrationState, _TreeNodeKernel_unhydratedEvents;
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.createTreeNodeFromInner = exports.treeNodeFromAnchor = exports.getOrCreateInnerNode = exports.getSimpleContextFromInnerNode = exports.getSimpleNodeSchemaFromInnerNode = exports.tryDisposeTreeNode = exports.proxySlot = exports.unhydratedFlexTreeNodeToTreeNode = exports.TreeNodeKernel = exports.tryGetTreeNodeSchema = exports.isTreeNode = exports.getKernel = void 0;
|
|
20
20
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
21
|
+
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
21
22
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
22
23
|
const index_js_1 = require("../../core/index.js");
|
|
23
24
|
const index_js_2 = require("../../feature-libraries/index.js");
|
|
@@ -232,33 +233,41 @@ class TreeNodeKernel {
|
|
|
232
233
|
*
|
|
233
234
|
* For hydrated nodes it returns a FlexTreeNode backed by the forest.
|
|
234
235
|
* Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
|
|
236
|
+
*
|
|
237
|
+
* If `allowDeleted` is false, this will throw a UsageError if the node is deleted.
|
|
235
238
|
*/
|
|
236
|
-
getOrCreateInnerNode(
|
|
239
|
+
getOrCreateInnerNode(allowDeleted = false) {
|
|
237
240
|
if (!isHydrated(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f"))) {
|
|
241
|
+
(0, internal_1.debugAssert)(() => __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode?.context.isDisposed() === false ||
|
|
242
|
+
"Unhydrated node should never be disposed");
|
|
238
243
|
return __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode; // Unhydrated case
|
|
239
244
|
}
|
|
240
|
-
if (__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
if (__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode === undefined) {
|
|
246
|
+
// Marinated case -> cooked
|
|
247
|
+
const anchorNode = __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").anchorNode;
|
|
248
|
+
// The proxy is bound to an anchor node, but it may or may not have an actual flex node yet
|
|
249
|
+
const flexNode = anchorNode.slots.get(index_js_2.flexTreeSlot);
|
|
250
|
+
if (flexNode !== undefined) {
|
|
251
|
+
// If the flex node already exists, use it...
|
|
252
|
+
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode = flexNode;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
// ...otherwise, the flex node must be created
|
|
256
|
+
const context = anchorNode.anchorSet.slots.get(index_js_2.ContextSlot) ?? (0, internal_1.fail)(0xb41 /* missing context */);
|
|
257
|
+
const cursor = context.checkout.forest.allocateCursor("getFlexNode");
|
|
258
|
+
context.checkout.forest.moveCursorToPath(anchorNode, cursor);
|
|
259
|
+
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode = (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
260
|
+
cursor.free();
|
|
261
|
+
// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode
|
|
262
|
+
anchorForgetters?.get(this.node)?.();
|
|
263
|
+
if (!allowDeleted) {
|
|
264
|
+
(0, index_js_2.assertFlexTreeEntityNotFreed)(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
250
267
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const cursor = context.checkout.forest.allocateCursor("getFlexNode");
|
|
255
|
-
context.checkout.forest.moveCursorToPath(anchorNode, cursor);
|
|
256
|
-
__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode = (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
257
|
-
cursor.free();
|
|
258
|
-
// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode
|
|
259
|
-
anchorForgetters?.get(this.node)?.();
|
|
260
|
-
if (!allowFreed) {
|
|
261
|
-
(0, index_js_2.assertFlexTreeEntityNotFreed)(__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode);
|
|
268
|
+
if (!allowDeleted) {
|
|
269
|
+
if (__classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode.context.isDisposed()) {
|
|
270
|
+
throw new internal_2.UsageError("Cannot access a Deleted node.");
|
|
262
271
|
}
|
|
263
272
|
}
|
|
264
273
|
return __classPrivateFieldGet(this, _TreeNodeKernel_hydrationState, "f").innerNode;
|
|
@@ -327,11 +336,15 @@ exports.unhydratedFlexTreeNodeToTreeNode = unhydratedFlexTreeNodeToTreeNodeInter
|
|
|
327
336
|
* FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.
|
|
328
337
|
*/
|
|
329
338
|
exports.proxySlot = (0, index_js_1.anchorSlot)();
|
|
339
|
+
/**
|
|
340
|
+
* Dispose a TreeNode (if any) for an existing anchor without disposing the anchor.
|
|
341
|
+
*/
|
|
330
342
|
function tryDisposeTreeNode(anchorNode) {
|
|
331
343
|
const treeNode = anchorNode.slots.get(exports.proxySlot);
|
|
332
344
|
if (treeNode !== undefined) {
|
|
333
345
|
const kernel = getKernel(treeNode);
|
|
334
346
|
kernel.dispose();
|
|
347
|
+
anchorNode.slots.delete(exports.proxySlot);
|
|
335
348
|
}
|
|
336
349
|
}
|
|
337
350
|
exports.tryDisposeTreeNode = tryDisposeTreeNode;
|
|
@@ -362,10 +375,12 @@ exports.getSimpleContextFromInnerNode = getSimpleContextFromInnerNode;
|
|
|
362
375
|
*
|
|
363
376
|
* For hydrated nodes it returns a FlexTreeNode backed by the forest.
|
|
364
377
|
* Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
|
|
378
|
+
*
|
|
379
|
+
* If `allowDeleted` is false, this will throw a UsageError if the node is deleted.
|
|
365
380
|
*/
|
|
366
|
-
function getOrCreateInnerNode(treeNode,
|
|
381
|
+
function getOrCreateInnerNode(treeNode, allowDeleted = false) {
|
|
367
382
|
const kernel = getKernel(treeNode);
|
|
368
|
-
return kernel.getOrCreateInnerNode(
|
|
383
|
+
return kernel.getOrCreateInnerNode(allowDeleted);
|
|
369
384
|
}
|
|
370
385
|
exports.getOrCreateInnerNode = getOrCreateInnerNode;
|
|
371
386
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeKernel.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAAyE;AACzE,+DAA6D;AAG7D,kDAO6B;AAC7B,+DAQ0C;AAE1C,0E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vC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC;QAC3B,CAAC,CAAE,WAAwE,CAAC,MAAM,CAChF,QAAQ,CACR,CAAC;AACL,CAAC;AARD,0DAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable, Off } from \"@fluidframework/core-interfaces\";\nimport type { InternalTreeNode, TreeNode, Unhydrated } from \"./types.js\";\nimport {\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorNode,\n\ttype AnchorSet,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../../core/index.js\";\nimport {\n\tassertFlexTreeEntityNotFreed,\n\tContextSlot,\n\tflexTreeSlot,\n\tLazyEntity,\n\tTreeStatus,\n\ttreeStatusFromAnchorCache,\n\ttype FlexTreeNode,\n} from \"../../feature-libraries/index.js\";\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\n// TODO: decide how to deal with dependencies on flex-tree implementation.\n// eslint-disable-next-line import/no-internal-modules\nimport { makeTree } from \"../../feature-libraries/flex-tree/lazyNode.js\";\nimport { SimpleContextSlot, type Context, type HydratedContext } from \"./context.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\tinnerNode: 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\tanchorNode: AnchorNode;\n\t/** All {@link Off | event deregistration functions} that should be run when the kernel is disposed. */\n\toffAnchorNode: 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\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\tunhydratedFlexTreeNodeToTreeNodeInternal.set(innerNode, 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 = unhydratedFlexTreeNodeToTreeNodeInternal.get(unhydratedNode);\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\tconst { anchorNode } = innerNode;\n\t\t\tassert(\n\t\t\t\t!anchorNode.slots.has(proxySlot),\n\t\t\t\t0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,\n\t\t\t);\n\t\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\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 given anchor node.\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 the proxy has an anchor node.\n\t */\n\tprivate hydrate(anchorNode: AnchorNode): 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\t\tunhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);\n\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\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\tanchorNode.slots.set(proxySlot, 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\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 via {@link setInnerNode}.\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\tpublic getOrCreateInnerNode(allowFreed = false): InnerNode {\n\t\tif (!isHydrated(this.#hydrationState)) {\n\t\t\treturn this.#hydrationState.innerNode; // Unhydrated case\n\t\t}\n\n\t\tif (this.#hydrationState.innerNode !== undefined) {\n\t\t\treturn this.#hydrationState.innerNode; // Cooked case\n\t\t}\n\n\t\t// Marinated case -> cooked\n\t\tconst anchorNode = this.#hydrationState.anchorNode;\n\t\t// The proxy is bound to an anchor node, but it may or may not have an actual flex node yet\n\t\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\tif (flexNode !== undefined) {\n\t\t\t// If the flex node already exists, use it...\n\t\t\tthis.#hydrationState.innerNode = flexNode;\n\t\t} else {\n\t\t\t// ...otherwise, the flex node must be created\n\t\t\tconst context =\n\t\t\t\tanchorNode.anchorSet.slots.get(ContextSlot) ?? fail(0xb41 /* missing context */);\n\t\t\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\t\t\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\t\t\tthis.#hydrationState.innerNode = makeTree(context, cursor);\n\t\t\tcursor.free();\n\t\t\t// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode\n\t\t\tanchorForgetters?.get(this.node)?.();\n\t\t\tif (!allowFreed) {\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 * Creates an anchor node and associates it with the given proxy.\n\t * @privateRemarks\n\t * Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.\n\t * In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.\n\t *\n\t * The FlexTreeNode holds a reference to the same anchor, and has a lifetime at least as long as the simple-tree,\n\t * so this would be unnecessary except for the case of \"marinated\" nodes, which have an anchor,\n\t * but might not have a FlexTreeNode.\n\t * Handling this case is an optimization assuming that this extra anchor reference is cheaper than eagerly creating FlexTreeNodes.\n\t */\n\tpublic anchorProxy(anchors: AnchorSet, path: UpPath): AnchorNode {\n\t\tassert(!anchorForgetters.has(this.node), 0x91c /* Proxy anchor should not be set twice */);\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\t\tthis.hydrate(anchorNode);\n\t\tconst forget = (): void => {\n\t\t\tif (anchors.locate(anchor)) {\n\t\t\t\tanchors.forget(anchor);\n\t\t\t}\n\t\t\tanchorForgetters.delete(this.node);\n\t\t\toff();\n\t\t};\n\t\tanchorForgetters.set(this.node, forget);\n\t\tconst off = anchorNode.events.on(\"afterDestroy\", forget);\n\t\treturn anchorNode;\n\t}\n\n\t/**\n\t * Retrieves the InnerNode associated with the given target via {@link setInnerNode}, if any.\n\t * @remarks\n\t * If `target` is an unhydrated node, returns its UnhydratedFlexTreeNode.\n\t * If `target` is a cooked node (or marinated but a FlexTreeNode exists) returns the FlexTreeNode.\n\t * If the target is a marinated node with no FlexTreeNode for its anchor, returns undefined.\n\t */\n\tpublic tryGetInnerNode(): InnerNode | undefined {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\treturn (\n\t\t\t\tthis.#hydrationState.innerNode ??\n\t\t\t\tthis.#hydrationState.anchorNode.slots.get(flexTreeSlot)\n\t\t\t);\n\t\t}\n\n\t\treturn this.#hydrationState.innerNode;\n\t}\n}\n\n/**\n * Used by {@link anchorProxy} as an optimization to ensure that only one anchor is remembered at a time for a given anchor node\n */\nconst anchorForgetters = new WeakMap<TreeNode, () => void>();\n\nconst kernelEvents = [\"childrenChangedAfterBatch\", \"subtreeChangedAfterBatch\"] as const;\n\ntype KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;\n\n/**\n * For \"cooked\" nodes this is a FlexTreeNode thats a projection of forest content.\n * For {@link Unhydrated} nodes this is a MapTreeNode.\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 *\n * @remarks\n * Currently MapTreeNode extends FlexTreeNode, and most code which can work with either just uses FlexTreeNode.\n * TODO: Code should be migrating toward using this type to distinguish to two use-cases.\n *\n * TODO: The inconsistent handling of \"marinated\" cases should be cleaned up.\n * Maybe getOrCreateInnerNode should cook marinated nodes so they have a proper InnerNode?\n */\nexport type InnerNode = FlexTreeNode | UnhydratedFlexTreeNode;\n\n/**\n * Associates a given {@link UnhydratedFlexTreeNode} with a {@link TreeNode}.\n */\nconst unhydratedFlexTreeNodeToTreeNodeInternal = new WeakMap<\n\tUnhydratedFlexTreeNode,\n\tTreeNode\n>();\n/**\n * Retrieves the {@link TreeNode} associated with the given {@link UnhydratedFlexTreeNode} if any.\n */\nexport const unhydratedFlexTreeNodeToTreeNode =\n\tunhydratedFlexTreeNodeToTreeNodeInternal as Pick<\n\t\tWeakMap<UnhydratedFlexTreeNode, TreeNode>,\n\t\t\"get\"\n\t>;\n\n/**\n * An anchor slot which associates an anchor with its corresponding 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 proxySlot = anchorSlot<TreeNode>();\n\nexport function tryDisposeTreeNode(anchorNode: AnchorNode): void {\n\tconst treeNode = anchorNode.slots.get(proxySlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = getKernel(treeNode);\n\t\tkernel.dispose();\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.schema) ?? 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\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 via {@link setInnerNode}.\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 */\nexport function getOrCreateInnerNode(treeNode: TreeNode, allowFreed = false): InnerNode {\n\tconst kernel = getKernel(treeNode);\n\treturn kernel.getOrCreateInnerNode(allowFreed);\n}\n\n/**\n * Gets a flex node from an anchor node\n */\nfunction flexNodeFromAnchor(anchorNode: AnchorNode): FlexTreeNode {\n\t// the proxy is bound to an anchor node, but it may or may not have an actual flex node yet\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 = makeTree(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(proxySlot);\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"]}
|
|
1
|
+
{"version":3,"file":"treeNodeKernel.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG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UAAsB;IACxD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAS,CAAC,CAAC;IAC/C,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy, fail, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable, Off } from \"@fluidframework/core-interfaces\";\nimport type { InternalTreeNode, TreeNode, Unhydrated } from \"./types.js\";\nimport {\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorNode,\n\ttype AnchorSet,\n\ttype TreeValue,\n\ttype UpPath,\n} from \"../../core/index.js\";\nimport {\n\tassertFlexTreeEntityNotFreed,\n\tContextSlot,\n\tflexTreeSlot,\n\tLazyEntity,\n\tTreeStatus,\n\ttreeStatusFromAnchorCache,\n\ttype FlexTreeNode,\n} from \"../../feature-libraries/index.js\";\nimport type { TreeNodeSchema } from \"./treeNodeSchema.js\";\n// TODO: decide how to deal with dependencies on flex-tree implementation.\n// eslint-disable-next-line import/no-internal-modules\nimport { makeTree } from \"../../feature-libraries/flex-tree/lazyNode.js\";\nimport { SimpleContextSlot, type Context, type HydratedContext } from \"./context.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\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\tunhydratedFlexTreeNodeToTreeNodeInternal.set(innerNode, 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 = unhydratedFlexTreeNodeToTreeNodeInternal.get(unhydratedNode);\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\tconst { anchorNode } = innerNode;\n\t\t\tassert(\n\t\t\t\t!anchorNode.slots.has(proxySlot),\n\t\t\t\t0x7f5 /* Cannot associate an flex node with multiple simple-tree nodes */,\n\t\t\t);\n\t\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\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 given anchor node.\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 the proxy has an anchor node.\n\t */\n\tprivate hydrate(anchorNode: AnchorNode): 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\t\tunhydratedFlexTreeNodeToTreeNodeInternal.delete(this.#hydrationState.innerNode);\n\t\tthis.#hydrationState = this.createHydratedState(anchorNode);\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\tanchorNode.slots.set(proxySlot, 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\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 via {@link setInnerNode}.\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 * If `allowDeleted` is false, this will throw a UsageError if the node is deleted.\n\t */\n\tpublic getOrCreateInnerNode(allowDeleted = false): 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.#hydrationState.innerNode === undefined) {\n\t\t\t// Marinated case -> cooked\n\t\t\tconst anchorNode = this.#hydrationState.anchorNode;\n\t\t\t// The proxy 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 = makeTree(context, cursor);\n\t\t\t\tcursor.free();\n\t\t\t\t// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode\n\t\t\t\tanchorForgetters?.get(this.node)?.();\n\t\t\t\tif (!allowDeleted) {\n\t\t\t\t\tassertFlexTreeEntityNotFreed(this.#hydrationState.innerNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!allowDeleted) {\n\t\t\tif (this.#hydrationState.innerNode.context.isDisposed()) {\n\t\t\t\tthrow new UsageError(\"Cannot access a Deleted node.\");\n\t\t\t}\n\t\t}\n\n\t\treturn this.#hydrationState.innerNode;\n\t}\n\n\t/**\n\t * Creates an anchor node and associates it with the given proxy.\n\t * @privateRemarks\n\t * Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.\n\t * In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.\n\t *\n\t * The FlexTreeNode holds a reference to the same anchor, and has a lifetime at least as long as the simple-tree,\n\t * so this would be unnecessary except for the case of \"marinated\" nodes, which have an anchor,\n\t * but might not have a FlexTreeNode.\n\t * Handling this case is an optimization assuming that this extra anchor reference is cheaper than eagerly creating FlexTreeNodes.\n\t */\n\tpublic anchorProxy(anchors: AnchorSet, path: UpPath): AnchorNode {\n\t\tassert(!anchorForgetters.has(this.node), 0x91c /* Proxy anchor should not be set twice */);\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\t\tthis.hydrate(anchorNode);\n\t\tconst forget = (): void => {\n\t\t\tif (anchors.locate(anchor)) {\n\t\t\t\tanchors.forget(anchor);\n\t\t\t}\n\t\t\tanchorForgetters.delete(this.node);\n\t\t\toff();\n\t\t};\n\t\tanchorForgetters.set(this.node, forget);\n\t\tconst off = anchorNode.events.on(\"afterDestroy\", forget);\n\t\treturn anchorNode;\n\t}\n\n\t/**\n\t * Retrieves the InnerNode associated with the given target via {@link setInnerNode}, if any.\n\t * @remarks\n\t * If `target` is an unhydrated node, returns its UnhydratedFlexTreeNode.\n\t * If `target` is a cooked node (or marinated but a FlexTreeNode exists) returns the FlexTreeNode.\n\t * If the target is a marinated node with no FlexTreeNode for its anchor, returns undefined.\n\t */\n\tpublic tryGetInnerNode(): InnerNode | undefined {\n\t\tif (isHydrated(this.#hydrationState)) {\n\t\t\treturn (\n\t\t\t\tthis.#hydrationState.innerNode ??\n\t\t\t\tthis.#hydrationState.anchorNode.slots.get(flexTreeSlot)\n\t\t\t);\n\t\t}\n\n\t\treturn this.#hydrationState.innerNode;\n\t}\n}\n\n/**\n * Used by {@link anchorProxy} as an optimization to ensure that only one anchor is remembered at a time for a given anchor node\n */\nconst anchorForgetters = new WeakMap<TreeNode, () => void>();\n\nconst kernelEvents = [\"childrenChangedAfterBatch\", \"subtreeChangedAfterBatch\"] as const;\n\ntype KernelEvents = Pick<AnchorEvents, (typeof kernelEvents)[number]>;\n\n/**\n * For \"cooked\" nodes this is a FlexTreeNode thats a projection of forest content.\n * For {@link Unhydrated} nodes this is a MapTreeNode.\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 *\n * @remarks\n * Currently MapTreeNode extends FlexTreeNode, and most code which can work with either just uses FlexTreeNode.\n * TODO: Code should be migrating toward using this type to distinguish to two use-cases.\n *\n * TODO: The inconsistent handling of \"marinated\" cases should be cleaned up.\n * Maybe getOrCreateInnerNode should cook marinated nodes so they have a proper InnerNode?\n */\nexport type InnerNode = FlexTreeNode | UnhydratedFlexTreeNode;\n\n/**\n * Associates a given {@link UnhydratedFlexTreeNode} with a {@link TreeNode}.\n */\nconst unhydratedFlexTreeNodeToTreeNodeInternal = new WeakMap<\n\tUnhydratedFlexTreeNode,\n\tTreeNode\n>();\n/**\n * Retrieves the {@link TreeNode} associated with the given {@link UnhydratedFlexTreeNode} if any.\n */\nexport const unhydratedFlexTreeNodeToTreeNode =\n\tunhydratedFlexTreeNodeToTreeNodeInternal as Pick<\n\t\tWeakMap<UnhydratedFlexTreeNode, TreeNode>,\n\t\t\"get\"\n\t>;\n\n/**\n * An anchor slot which associates an anchor with its corresponding 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 proxySlot = 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(proxySlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = getKernel(treeNode);\n\t\tkernel.dispose();\n\t\tanchorNode.slots.delete(proxySlot);\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.schema) ?? 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\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 via {@link setInnerNode}.\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 * If `allowDeleted` is false, this will throw a UsageError if the node is deleted.\n */\nexport function getOrCreateInnerNode(treeNode: TreeNode, allowDeleted = false): InnerNode {\n\tconst kernel = getKernel(treeNode);\n\treturn kernel.getOrCreateInnerNode(allowDeleted);\n}\n\n/**\n * Gets a flex node from an anchor node\n */\nfunction flexNodeFromAnchor(anchorNode: AnchorNode): FlexTreeNode {\n\t// the proxy is bound to an anchor node, but it may or may not have an actual flex node yet\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 = makeTree(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(proxySlot);\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"]}
|
|
@@ -103,13 +103,23 @@ export interface TreeChangeEvents {
|
|
|
103
103
|
* A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
|
|
104
104
|
*
|
|
105
105
|
* @remarks
|
|
106
|
-
* Base type which all nodes
|
|
106
|
+
* Base type which all nodes extend.
|
|
107
107
|
*
|
|
108
|
-
* This can be used as a type to indicate/document values which should be tree nodes.
|
|
108
|
+
* This type can be used as a type to indicate/document values which should be tree nodes.
|
|
109
109
|
* Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.
|
|
110
110
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
111
|
+
* There are three ways to get instances of TreeNode:
|
|
112
|
+
*
|
|
113
|
+
* 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.
|
|
114
|
+
* This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.
|
|
115
|
+
* 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.
|
|
116
|
+
* Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.
|
|
117
|
+
* 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.
|
|
118
|
+
* These APIs internally call the constructor with the provided value, so it's really just a special case of the above option.
|
|
119
|
+
* Note that when constructing nodes, sometimes implicit construction is not allowed
|
|
120
|
+
* (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):
|
|
121
|
+
* in such cases, explicit construction must be used.
|
|
122
|
+
*
|
|
113
123
|
* @privateRemarks
|
|
114
124
|
* This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})
|
|
115
125
|
* and some runtime enforcement of schema class policy (see the the validation in the constructor).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9B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AAK,IAAI,QAAQ;IAErE;;;;;;OAMG;WACW,CAAC,MAAM,CAAC,WAAW,CAAC,CACjC,OAAO,SAAS,QAAQ,MACvB,GAAG,IAAI,EAAE,GAAG,EAAE,KACV,QAAQ,EACZ,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,OAAO,CAAC;IAahE;;;;;;;OAOG;IACH,SAAS,aAAa,KAAK,EAAE,OAAO;CAKpC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,IAAK,CAAC;AAE/B;;;;;GAKG;AAEH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAS9E;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAChB,SAAQ,UAAU,CAAC,uCAAuC,CAAC;CAAG;AAE/D,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CAGnE"}
|
|
@@ -17,13 +17,23 @@ const index_js_1 = require("../../feature-libraries/index.js");
|
|
|
17
17
|
* A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Base type which all nodes
|
|
20
|
+
* Base type which all nodes extend.
|
|
21
21
|
*
|
|
22
|
-
* This can be used as a type to indicate/document values which should be tree nodes.
|
|
22
|
+
* This type can be used as a type to indicate/document values which should be tree nodes.
|
|
23
23
|
* Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* There are three ways to get instances of TreeNode:
|
|
26
|
+
*
|
|
27
|
+
* 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.
|
|
28
|
+
* This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.
|
|
29
|
+
* 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.
|
|
30
|
+
* Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.
|
|
31
|
+
* 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.
|
|
32
|
+
* These APIs internally call the constructor with the provided value, so it's really just a special case of the above option.
|
|
33
|
+
* Note that when constructing nodes, sometimes implicit construction is not allowed
|
|
34
|
+
* (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):
|
|
35
|
+
* in such cases, explicit construction must be used.
|
|
36
|
+
*
|
|
27
37
|
* @privateRemarks
|
|
28
38
|
* This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})
|
|
29
39
|
* and some runtime enforcement of schema class policy (see the the validation in the constructor).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/simple-tree/core/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAGtE,2DAAyE;AACzE,gDAAgD;AAChD,+CAAqF;AACrF,2DAA2D;AAC3D,+DAAqF;AAkGrF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAsB,QAAQ;IAmEtB,MAAM,CAAC,mCAAC,MAAM,CAAC,WAAW,EAAC,CAA8B,KAAc;QAC7E,MAAM,MAAM,GAAG,IAAA,wCAAoB,EAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,4BAAQ,CAAC,IAAI,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAA,iBAAM,EAAC,WAAW,IAAI,MAAM,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,YAAsB,KAAc;QArFpC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACM,kCAAiB;QA4DzB,IAAI,KAAK,KAAK,oBAAY,EAAE,CAAC;YAC5B,MAAM,IAAI,qBAAU,CAAC,+DAA+D,CAAC,CAAC;QACvF,CAAC;IACF,CAAC;CACD;AA3FD,4BA2FC;AAED;;GAEG;AACU,QAAA,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,kDAAkD;AAClD,SAAgB,gBAAgB,CAAC,OAAsB,EAAE,IAAY;IACpE,IAAI,QAAQ,GAAG,OAAO,CAAC;IACvB,OAAO,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AATD,4CASC;AAaD,SAAgB,cAAc,CAAC,IAAsB;IACpD,IAAA,iBAAM,EAAC,IAAA,yBAAc,EAAC,IAAI,CAAC,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC;AACb,CAAC;AAHD,wCAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { ErasedType } from \"@fluidframework/core-interfaces\";\n\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { isFlexTreeNode, type FlexTreeNode } from \"../../feature-libraries/index.js\";\n\n/**\n * Type alias to document which values are un-hydrated.\n *\n * Un-hydrated values are nodes produced from schema's create functions that haven't been inserted into a tree yet.\n *\n * Since un-hydrated nodes become hydrated when inserted, strong typing can't be used to distinguish them.\n * This no-op wrapper is used instead.\n * @remarks\n * Nodes which are Unhydrated report {@link TreeStatus}.new from `Tree.status(node)`.\n * @privateRemarks\n * TODO: Linking tree status is failing in intellisense and linking directly to its .new item is failing in API extractor as well.\n * WOuld be nice to have a working link here.\n * @public\n */\nexport type Unhydrated<T> = T;\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the\n\t * subtree rooted at it.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes implement.\n *\n * This can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * Instances of tree nodes must be created by opening an existing document, inserting values into the document,\n * or by using the constructors and create functions of {@link TreeNodeSchema} produced by {@link SchemaFactory}.\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n * This class is however only `type` exported not value exported, preventing the class object from being used,\n * similar to how interfaces work.\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * For now the type-only export prevents use of `instanceof` on this class (but allows it in subclasses like schema classes).\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n\n/**\n * A node type internal to `@fluidframework/tree`.\n * @remarks\n * This type is used in the construction of {@link TreeNode} as an implementation detail, but leaks into the public API due to how schema are implemented.\n * @privateRemarks\n * A {@link FlexTreeNode}. Includes {@link RawTreeNode}s.\n * @sealed @public\n */\nexport interface InternalTreeNode\n\textends ErasedType<\"@fluidframework/tree.InternalTreeNode\"> {}\n\nexport function toFlexTreeNode(node: InternalTreeNode): FlexTreeNode {\n\tassert(isFlexTreeNode(node), 0x963 /* Invalid InternalTreeNode */);\n\treturn node;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/simple-tree/core/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAGtE,2DAAyE;AACzE,gDAAgD;AAChD,+CAAqF;AACrF,2DAA2D;AAC3D,+DAAqF;AAkGrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAsB,QAAQ;IAmEtB,MAAM,CAAC,mCAAC,MAAM,CAAC,WAAW,EAAC,CAA8B,KAAc;QAC7E,MAAM,MAAM,GAAG,IAAA,wCAAoB,EAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,4BAAQ,CAAC,IAAI,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAA,iBAAM,EAAC,WAAW,IAAI,MAAM,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,YAAsB,KAAc;QArFpC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACM,kCAAiB;QA4DzB,IAAI,KAAK,KAAK,oBAAY,EAAE,CAAC;YAC5B,MAAM,IAAI,qBAAU,CAAC,+DAA+D,CAAC,CAAC;QACvF,CAAC;IACF,CAAC;CACD;AA3FD,4BA2FC;AAED;;GAEG;AACU,QAAA,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,kDAAkD;AAClD,SAAgB,gBAAgB,CAAC,OAAsB,EAAE,IAAY;IACpE,IAAI,QAAQ,GAAG,OAAO,CAAC;IACvB,OAAO,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AATD,4CASC;AAaD,SAAgB,cAAc,CAAC,IAAsB;IACpD,IAAA,iBAAM,EAAC,IAAA,yBAAc,EAAC,IAAI,CAAC,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC;AACb,CAAC;AAHD,wCAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { ErasedType } from \"@fluidframework/core-interfaces\";\n\nimport { NodeKind, type TreeNodeSchemaClass } from \"./treeNodeSchema.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { type WithType, typeNameSymbol, type typeSchemaSymbol } from \"./withType.js\";\nimport { tryGetTreeNodeSchema } from \"./treeNodeKernel.js\";\nimport { isFlexTreeNode, type FlexTreeNode } from \"../../feature-libraries/index.js\";\n\n/**\n * Type alias to document which values are un-hydrated.\n *\n * Un-hydrated values are nodes produced from schema's create functions that haven't been inserted into a tree yet.\n *\n * Since un-hydrated nodes become hydrated when inserted, strong typing can't be used to distinguish them.\n * This no-op wrapper is used instead.\n * @remarks\n * Nodes which are Unhydrated report {@link TreeStatus}.new from `Tree.status(node)`.\n * @privateRemarks\n * TODO: Linking tree status is failing in intellisense and linking directly to its .new item is failing in API extractor as well.\n * WOuld be nice to have a working link here.\n * @public\n */\nexport type Unhydrated<T> = T;\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the\n\t * subtree rooted at it.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n\n/**\n * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.\n *\n * @remarks\n * Base type which all nodes extend.\n *\n * This type can be used as a type to indicate/document values which should be tree nodes.\n * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.\n *\n * There are three ways to get instances of TreeNode:\n *\n * 1. From a {@link TreeView} loading nodes from an existing document, or creating local copies of nodes inserted by a remote collaborator.\n * This case provides an {@link InternalTreeNode} to the constructor: subclasses must not modify how the constructor handles this case.\n * 2. Explicit construction of {@link Unhydrated} nodes using either {@link TreeNodeSchemaClass} as a constructor or {@link TreeNodeSchemaNonClass|TreeNodeSchemaNonClass.create}.\n * Either way the {@link TreeNodeSchema} produced must be produced using a {@link SchemaFactory}.\n * 3. Implicit construction: Several APIs which logically require an unhydrated TreeNode also allow passing in a value which could be used to explicitly construct the node instead.\n * These APIs internally call the constructor with the provided value, so it's really just a special case of the above option.\n * Note that when constructing nodes, sometimes implicit construction is not allowed\n * (either at runtime due to ambiguous types or at compile time due to TypeScript limitations):\n * in such cases, explicit construction must be used.\n *\n * @privateRemarks\n * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})\n * and some runtime enforcement of schema class policy (see the the validation in the constructor).\n * This class is however only `type` exported not value exported, preventing the class object from being used,\n * similar to how interfaces work.\n *\n * Not all node implementations include this in their prototype chain (some hide it with a proxy),\n * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.\n * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.\n * For now the type-only export prevents use of `instanceof` on this class (but allows it in subclasses like schema classes).\n * @sealed @public\n */\nexport abstract class TreeNode implements WithType {\n\t/**\n\t * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.\n\t * @remarks\n\t * This field forces TypeScript to use nominal instead of structural typing,\n\t * preventing compiler error messages and tools like \"add missing properties\"\n\t * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.\n\t * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.\n\t *\n\t * @privateRemarks\n\t * This is a JavaScript private field, so is not accessible from outside this class.\n\t * This prevents it from having name collisions with object fields.\n\t * Since this is private, the type of this field is stripped in the d.ts file.\n\t * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.\n\t * To avoid this having any runtime impact, the field is uninitialized.\n\t *\n\t * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.\n\t * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.\n\t * To avoid all this mess, this field is required, not optional.\n\t *\n\t * Another option would be to use a symbol (possibly as a private field).\n\t * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.\n\t *\n\t * The [type] symbol provides a lot of the value this private brand does, but is not all of it:\n\t * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)\n\t * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.\n\t */\n\treadonly #brand!: unknown;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t * @deprecated Use {@link typeSchemaSymbol} instead.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic abstract get [typeNameSymbol](): string;\n\n\t/**\n\t * Adds a type symbol for stronger typing.\n\t * @privateRemarks\n\t * Subclasses provide more specific strings for this to get strong typing of otherwise type compatible nodes.\n\t */\n\tpublic abstract get [typeSchemaSymbol](): TreeNodeSchemaClass;\n\n\t/**\n\t * Provides `instanceof` support for testing if a value is a `TreeNode`.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Due to type-only export, this functionality is not available outside the package.\n\t */\n\tpublic static [Symbol.hasInstance](value: unknown): value is TreeNode;\n\n\t/**\n\t * Provides `instanceof` support for all schema classes with public constructors.\n\t * @remarks\n\t * For more options, like including leaf values or narrowing to collections of schema, use `is` or `schema` from {@link TreeNodeApi}.\n\t * @privateRemarks\n\t * Despite type-only export, this functionality is available outside the package since it is inherited by subclasses.\n\t */\n\tpublic static [Symbol.hasInstance]<\n\t\tTSchema extends abstract new (\n\t\t\t...args: any[]\n\t\t) => TreeNode,\n\t>(this: TSchema, value: unknown): value is InstanceType<TSchema>;\n\n\tpublic static [Symbol.hasInstance](this: { prototype: object }, value: unknown): boolean {\n\t\tconst schema = tryGetTreeNodeSchema(value);\n\n\t\tif (schema === undefined || schema.kind === NodeKind.Leaf) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(\"prototype\" in schema, 0x98a /* expected class based schema */);\n\t\treturn inPrototypeChain(schema.prototype, this.prototype);\n\t}\n\n\t/**\n\t * TreeNodes must extend schema classes created by SchemaFactory, and therefore this constructor should not be invoked directly by code outside this package.\n\t * @privateRemarks\n\t * `token` must be the {@link privateToken} value, which is not package exported.\n\t * This is used to detect invalid subclasses.\n\t *\n\t * All valid subclass should use {@link TreeNodeValid}, but this code doesn't directly reference it to avoid cyclic dependencies.\n\t */\n\tprotected constructor(token: unknown) {\n\t\tif (token !== privateToken) {\n\t\t\tthrow new UsageError(\"TreeNodes must extend schema classes created by SchemaFactory\");\n\t\t}\n\t}\n}\n\n/**\n * `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.\n */\nexport const privateToken = {};\n\n/**\n * Check if the prototype derived's prototype chain contains `base`.\n * @param derived - prototype to check\n * @param base - prototype to search for\n * @returns true iff `base` is in the prototype chain starting at `derived`.\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport function inPrototypeChain(derived: object | null, base: object): boolean {\n\tlet checking = derived;\n\twhile (checking !== null) {\n\t\tif (base === checking) {\n\t\t\treturn true;\n\t\t}\n\t\tchecking = Reflect.getPrototypeOf(checking);\n\t}\n\treturn false;\n}\n\n/**\n * A node type internal to `@fluidframework/tree`.\n * @remarks\n * This type is used in the construction of {@link TreeNode} as an implementation detail, but leaks into the public API due to how schema are implemented.\n * @privateRemarks\n * A {@link FlexTreeNode}. Includes {@link RawTreeNode}s.\n * @sealed @public\n */\nexport interface InternalTreeNode\n\textends ErasedType<\"@fluidframework/tree.InternalTreeNode\"> {}\n\nexport function toFlexTreeNode(node: InternalTreeNode): FlexTreeNode {\n\tassert(isFlexTreeNode(node), 0x963 /* Invalid InternalTreeNode */);\n\treturn node;\n}\n"]}
|
|
@@ -29,7 +29,7 @@ interface LocationInField {
|
|
|
29
29
|
*
|
|
30
30
|
* Create a `UnhydratedFlexTreeNode` by calling {@link getOrCreate}.
|
|
31
31
|
*/
|
|
32
|
-
export declare class UnhydratedFlexTreeNode implements
|
|
32
|
+
export declare class UnhydratedFlexTreeNode implements FlexTreeNode {
|
|
33
33
|
readonly simpleContext: Context;
|
|
34
34
|
/** The underlying {@link MapTree} that this `UnhydratedFlexTreeNode` reads its data from */
|
|
35
35
|
readonly mapTree: ExclusiveMapTree;
|
|
@@ -95,6 +95,7 @@ export declare class UnhydratedContext implements FlexTreeContext {
|
|
|
95
95
|
* @param flexSchema - Schema to use when working with the tree.
|
|
96
96
|
*/
|
|
97
97
|
constructor(schemaPolicy: SchemaPolicy, schema: TreeStoredSchema);
|
|
98
|
+
isDisposed(): boolean;
|
|
98
99
|
isHydrated(): this is FlexTreeHydratedContext;
|
|
99
100
|
}
|
|
100
101
|
declare class UnhydratedFlexTreeField implements FlexTreeField {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unhydratedFlexTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/unhydratedFlexTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EAExB,KAAK,sBAAsB,EAC3B,KAAK,OAA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