How do data.transform() in edit mode or what alternative exist?

I working on addon for setting origins, I want it to work from edit mode as well.

Issue is object.data.transform() do nothing in Edit mode. I already done lot of code that go out from edit mode, do set object matrix to new position/orientation, do data.transform() to compensate offset and then recover edit mode back. All work good… except of Undo in such case.

Because I switch Edit mode back and forth and this switching also counted as action for Undo everythings is f***d up, I don’t like my current result.

So yeah - how to make object.data.transform() do something in Edit mode or what alternative exist? (not only for MESH type objects so bmesh something is not the best answer)