json.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { StateNode, ActionObject, Guard, InvokeDefinition } from './';
  2. interface JSONFunction {
  3. $function: string;
  4. }
  5. export declare function stringifyFunction(fn: Function): JSONFunction;
  6. interface TransitionConfig {
  7. target: string[];
  8. source: string;
  9. actions: Array<ActionObject<any, any>>;
  10. cond: Guard<any, any> | undefined;
  11. eventType: string;
  12. }
  13. interface StateNodeConfig {
  14. type: StateNode['type'];
  15. id: string;
  16. key: string;
  17. initial?: string;
  18. entry: Array<ActionObject<any, any>>;
  19. exit: Array<ActionObject<any, any>>;
  20. on: {
  21. [key: string]: TransitionConfig[];
  22. };
  23. invoke: Array<InvokeDefinition<any, any>>;
  24. states: Record<string, StateNodeConfig>;
  25. }
  26. export declare function machineToJSON(stateNode: StateNode): StateNodeConfig;
  27. export declare function stringify(machine: StateNode): string;
  28. export declare function parse(machineString: string): StateNodeConfig;
  29. export declare function jsonify<T extends Record<string, any>>(value: T): T;
  30. export {};
  31. //# sourceMappingURL=json.d.ts.map