How to access a shape inside a node?

For example, I want to get the shape. I can get the node by iterating the nodes in the diagram and check the name. How to get the shape after get the node?
{name: ‘node’}

It looks like the Shape is the first element in the Node Panel, so you could access it as node.elt(0).

However it is more robust to give that Shape a, as it appears that you already have done for the Node itself. (Although it is unusual to do that for a Node, since it’s common to have a reference to a Node, so you wouldn’t need to find the reference to the whole Node when you already have it.)

Say you name that Shape with { name: "SHAPE" }. Then when you have any Node you can get the particular Shape by node.findObject("SHAPE").