graphLinksModel.linkFromPortIdProperty connecting to complex object

my data model is designed that way
class sequenceFlow {
sourceRef :string
targetRef:string
edge:BPMNEdge
}
class BpmnEdge{
fromPort:string
toPort:string
… and many other UI properties
}

this design is from BPMN 2.0

(I need to keep the reference to the ports and also to the node.)

now I want to specify the linkFromPortIdProperty which is basically something like this
graphLinksModel.linkFromPortIdProperty = “sequenceFlow.fromPort:string”

this is referencing a complex object

can it be done?
or should I create a different model for the graph and a different model for save?

The GraphLinksModel.linkFromPortIdProperty, if it’s a string, must name the property. It is not a property path. It cannot have a TypeScript type declaration in it. Presumably the property name is not something with a period and a colon in it – although that would be possible, it’s unusual and hard to type.

So it means that I have to have 2 models, one for the diagram view and one for database store?

Is GraphLinksModel.linkFromKeyProperty set to “sourceRef”?

Are you trying to separate out the UI properties from the essential ones that your database needs? Why doesn’t the database care about which ports links connect with?

Why can’t you just set GraphLinksModel.linkFromPortIdProperty to a function that returns the “fromPort” property of the “edge” property value? Or sets it if the second argument is not undefined?

graphLinkModel has linkDataArray of type sequenceFlow
the separation of the data is a BMPN 2.0 standard (not mine)
I did not know that i can set GraphLinksModel.linkFromPortIdProperty to a function,
I will start working on that , that should be ok,
is there a sample for this?

I could do this
graphLinksModel.linkFromPortIdProperty = (data: any, newval: any) =>{return data.edge.fromPort}

this is one way binding, how can I make it the other way.

(data: any, newval: any) => {
  if (any === undefined) return data.edge.fromPort;
  data.edge.fromPort = newval;
}

WORKS!!, thanks