Import SCXML to xstate #4073
Replies: 3 comments 2 replies
-
It is possible; we do it in our tests: https://github.com/statelyai/xstate/blob/main/packages/core/src/scxml.ts In the future, we'll add a first-class API for importing from SCXML. It's tricky now because there are some subtle parts where XState deviates from SCXML, but it's still largely compatible for most machines. |
Beta Was this translation helpful? Give feedback.
-
@davidkpiano is there near term plan to make this a first class API now? Using state chart to manage state machines might be more scalable way to build complex state machines on top of xstate, but would be great to get it officially from xstate. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm developing a parametrized state machine system for each of my clients, so I would like to store in DB the state machine definition of each client and then load in xstate the corresponding definition depending on the logged user.
For this purpose I am trying to use SCXML to store the definition on DB, but I can't figure out how to create the xstate machine from this SCXML? Is it possibe?
The xstate docs talk about the compatibility with SCXML but nothing about loading from SCXML. I tried the toMachine function (as explained here: https://baptiste.devessier.fr/writing/interpret-scxml-state-machines-with-xstate/) but it is quite limited, for example the scxml tag "transition" (action of xstate machine) is not considered.
In case this was not possible, how do you recommend me to store the xstate definition in DB?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions