Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xstate/graph

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xstate/graph - npm Package Compare versions

Comparing version 1.0.0-rc1.1 to 1.0.0

20

lib/graph.d.ts

@@ -1,3 +0,3 @@

import { StateNode, State, DefaultContext, Event, EventObject, StateMachine } from 'xstate';
import { StatePathsMap, StatePaths, AdjacencyMap } from './types';
import { StateNode, State, DefaultContext, Event, EventObject, StateMachine, AnyEventObject } from 'xstate';
import { StatePathsMap, StatePaths, AdjacencyMap, ValueAdjMapOptions } from './types';
export declare function toEventObject<TEvent extends EventObject>(event: Event<TEvent>): TEvent;

@@ -8,17 +8,7 @@ /**

*/
export declare function getStateNodes(stateNode: StateNode): StateNode[];
export declare function serializeState<TContext>(state: State<TContext>): string;
export declare function getStateNodes(stateNode: StateNode | StateMachine<any, any, any>): StateNode[];
export declare function serializeState<TContext>(state: State<TContext, any>): string;
export declare function serializeEvent<TEvent extends EventObject>(event: TEvent): string;
export declare function deserializeEventString<TEvent extends EventObject>(eventString: string): TEvent;
export interface ValueAdjMapOptions<TContext, TEvent extends EventObject> {
events: {
[K in TEvent['type']]: Array<TEvent & {
type: K;
}>;
};
filter: (state: State<TContext>) => boolean;
stateSerializer: (state: State<TContext>) => string;
eventSerializer: (event: TEvent) => string;
}
export declare function getAdjacencyMap<TContext = DefaultContext, TEvent extends EventObject = EventObject>(node: StateNode<TContext, any, TEvent>, options?: Partial<ValueAdjMapOptions<TContext, TEvent>>): AdjacencyMap<TContext, TEvent>;
export declare function getAdjacencyMap<TContext = DefaultContext, TEvent extends EventObject = AnyEventObject>(node: StateNode<TContext, any, TEvent> | StateMachine<TContext, any, TEvent>, options?: Partial<ValueAdjMapOptions<TContext, TEvent>>): AdjacencyMap<TContext, TEvent>;
export declare function getShortestPaths<TContext = DefaultContext, TEvent extends EventObject = EventObject>(machine: StateMachine<TContext, any, TEvent>, options?: Partial<ValueAdjMapOptions<TContext, TEvent>>): StatePathsMap<TContext, TEvent>;

@@ -25,0 +15,0 @@ export declare function getSimplePaths<TContext = DefaultContext, TEvent extends EventObject = EventObject>(machine: StateMachine<TContext, any, TEvent>, options?: Partial<ValueAdjMapOptions<TContext, TEvent>>): StatePathsMap<TContext, TEvent>;

@@ -33,6 +33,6 @@ "use strict";

};
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
return {
if (o && typeof o.length === "number") return {
next: function () {

@@ -43,2 +43,3 @@ if (o && i >= o.length) o = void 0;

};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};

@@ -93,3 +94,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var e_1, _a;
var optionsWithDefaults = __assign({}, defaultValueAdjMapOptions, options);
var optionsWithDefaults = __assign(__assign({}, defaultValueAdjMapOptions), options);
var filter = optionsWithDefaults.filter, stateSerializer = optionsWithDefaults.stateSerializer, eventSerializer = optionsWithDefaults.eventSerializer;

@@ -245,3 +246,3 @@ var events = {};

var e_5, _a;
var optionsWithDefaults = __assign({}, defaultValueAdjMapOptions, options);
var optionsWithDefaults = __assign(__assign({}, defaultValueAdjMapOptions), options);
var stateSerializer = optionsWithDefaults.stateSerializer;

@@ -251,2 +252,3 @@ if (!machine.states) {

}
// @ts-ignore - excessively deep
var adjacency = getAdjacencyMap(machine, optionsWithDefaults);

@@ -327,2 +329,1 @@ var stateMap = new Map();

exports.getSimplePathsAsArray = getSimplePathsAsArray;
//# sourceMappingURL=graph.js.map
import { getStateNodes, getSimplePaths, getShortestPaths, serializeEvent, serializeState } from './graph';
export { getStateNodes, getSimplePaths, getShortestPaths, serializeEvent, serializeState };
export * from './types';
//# sourceMappingURL=index.d.ts.map

@@ -9,2 +9,1 @@ "use strict";

exports.serializeState = graph_1.serializeState;
//# sourceMappingURL=index.js.map

@@ -49,2 +49,12 @@ import { State, EventObject, StateValue } from 'xstate';

export declare type Segments<TContext, TEvent extends EventObject> = Array<Segment<TContext, TEvent>>;
export interface ValueAdjMapOptions<TContext, TEvent extends EventObject> {
events: {
[K in TEvent['type']]?: Array<TEvent & {
type: K;
}>;
};
filter: (state: State<TContext, any>) => boolean;
stateSerializer: (state: State<TContext, any>) => string;
eventSerializer: (event: TEvent) => string;
}
//# sourceMappingURL=types.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map
{
"name": "@xstate/graph",
"version": "1.0.0-rc1.1",
"version": "1.0.0",
"description": "XState graph utilities",

@@ -19,3 +19,4 @@ "keywords": [

"files": [
"lib"
"lib/**/*.js",
"lib/**/*.d.ts"
],

@@ -44,5 +45,6 @@ "repository": {

"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
"typescript": "^3.7.2",
"xstate": "^4.7.0"
},
"dependencies": {}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc