I'm trying to implement the ability to get the next set of possible events given the current state, as described here
https://stately.ai/docs/migration#statenextevents-has-been-removed
I tried adding a nextEvents handler here
like this and it seems to work.
nextEvents: async (
ctx: restate.ObjectContext<State>,
): Promise<string[]> => {
await validateStateMachineIsNotDisposed(ctx);
const systemName = ctx.key;
// no need to set the version here if we are just getting a snapshot
let version = await ctx.get("version");
if (version == null) {
version = latestLogic.id;
}
const logic = getLogic(latestLogic, versions, version);
const root = await createActor<
LatestStateMachine | PreviousStateMachine
>(ctx, api, systemName, version, logic);
const snapshot = root.getSnapshot();
return [...new Set([...snapshot._nodes.flatMap((sn) => sn.ownEvents)])];
},
I'm trying to implement the ability to get the next set of possible events given the current state, as described here
https://stately.ai/docs/migration#statenextevents-has-been-removed
I tried adding a
nextEventshandler herexstate/packages/restate-xstate/src/lib/actorObject.ts
Line 216 in b4a9b4b
like this and it seems to work.