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

@xstate/inspect

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xstate/inspect - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

6

CHANGELOG.md
# @xstate/inspect
## 0.6.3
### Patch Changes
- [#3089](https://github.com/statelyai/xstate/pull/3089) [`862697e29`](https://github.com/statelyai/xstate/commit/862697e2990934d46050580d7e09c749d09d8426) Thanks [@Andarist](https://github.com/Andarist)! - Fixed compatibility with Skypack by exporting some shared utilities from root entry of XState and consuming them directly in other packages (this avoids accessing those things using deep imports and thus it avoids creating those compatibility problems).
## 0.6.2

@@ -4,0 +10,0 @@

3

es/browser.d.ts

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

import { Interpreter, EventObject } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import { EventObject, Interpreter, XStateDevInterface } from 'xstate';
import type { Inspector, InspectorOptions, InspectReceiver, WebSocketReceiverOptions, WindowReceiverOptions } from './types';

@@ -4,0 +3,0 @@ export declare const serviceMap: Map<string, Interpreter<any, any, EventObject, {

import { __assign } from './_virtual/_tslib.js';
import { interpret } from 'xstate';
import { toSCXMLEvent, toEventObject, toObserver, interopSymbols } from 'xstate/lib/utils';
import { interpret, toSCXMLEvent, toEventObject, toObserver, toActorRef } from 'xstate';
import { getLazy, stringify, isReceiverEvent, parseReceiverEvent } from './utils.js';

@@ -183,3 +182,5 @@ import { stringifyMachine, stringifyState } from './serialize.js';

ownWindow.addEventListener('message', handler);
var actorRef = __assign({ id: 'xstate.windowReceiver', send: function (event) {
var actorRef = toActorRef({
id: 'xstate.windowReceiver',
send: function (event) {
if (!targetWindow) {

@@ -189,3 +190,4 @@ return;

targetWindow.postMessage(event, '*');
}, subscribe: function (next, onError, onComplete) {
},
subscribe: function (next, onError, onComplete) {
var observer = toObserver(next, onError, onComplete);

@@ -198,8 +200,11 @@ observers.add(observer);

};
}, stop: function () {
},
stop: function () {
observers.clear();
ownWindow.removeEventListener('message', handler);
}, getSnapshot: function () {
},
getSnapshot: function () {
return latestEvent;
} }, interopSymbols);
}
});
actorRef.send({

@@ -215,5 +220,8 @@ type: 'xstate.inspecting'

var latestEvent;
var actorRef = __assign({ id: 'xstate.webSocketReceiver', send: function (event) {
var actorRef = toActorRef({
id: 'xstate.webSocketReceiver',
send: function (event) {
ws.send(stringify(event, options.serialize));
}, subscribe: function (next, onError, onComplete) {
},
subscribe: function (next, onError, onComplete) {
var observer = toObserver(next, onError, onComplete);

@@ -226,5 +234,7 @@ observers.add(observer);

};
}, getSnapshot: function () {
},
getSnapshot: function () {
return latestEvent;
} }, interopSymbols);
}
});
ws.onopen = function () {

@@ -231,0 +241,0 @@ actorRef.send({

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

import { ActorRef } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import { ActorRef, XStateDevInterface } from 'xstate';
import { ReceiverEvent, Replacer } from './types';

@@ -20,3 +19,8 @@ export declare type InspectMachineEvent = ReceiverEvent | {

client?: Pick<ActorRef<any, any>, "send"> | undefined;
}, any, InspectMachineEvent, any, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").TypegenDisabled & {
}, any, InspectMachineEvent, {
value: any;
context: {
client?: Pick<ActorRef<any, any>, "send"> | undefined;
};
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").TypegenDisabled & {
missingImplementations: {

@@ -23,0 +27,0 @@ actions: never;

@@ -1,6 +0,6 @@

import { State, StateMachine } from 'xstate';
import { AnyState, AnyStateMachine } from 'xstate';
import { Replacer } from './types';
export declare function selectivelyStringify<T extends object>(value: T, keys: Array<keyof T>, replacer?: Replacer): string;
export declare function stringifyState(state: State<any, any>, replacer?: Replacer): string;
export declare function stringifyMachine(machine: StateMachine<any, any, any>, replacer?: Replacer): string;
export declare function stringifyState(state: AnyState, replacer?: Replacer): string;
export declare function stringifyMachine(machine: AnyStateMachine, replacer?: Replacer): string;
//# sourceMappingURL=serialize.d.ts.map

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

import type { ActorRef, SCXML, State, StateMachine, AnyInterpreter } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import type { ActorRef, AnyInterpreter, AnyState, AnyStateMachine, SCXML } from 'xstate';
import { XStateDevInterface } from 'xstate';
import { InspectMachineEvent } from './inspectMachine';

@@ -13,3 +13,3 @@ export declare type MaybeLazy<T> = T | (() => T);

}
export interface Inspector extends ActorRef<InspectMachineEvent, State<any, any, any, any, any>> {
export interface Inspector extends ActorRef<InspectMachineEvent, AnyState> {
/**

@@ -55,4 +55,4 @@ * Disconnects the inspector.

type: 'service.register';
machine: StateMachine<any, any, any, any, any, any, any>;
state: State<any, any>;
machine: AnyStateMachine;
state: AnyState;
id: string;

@@ -67,3 +67,3 @@ sessionId: string;

type: 'service.state';
state: State<any, any, any, any, any>;
state: AnyState;
sessionId: string;

@@ -70,0 +70,0 @@ } | {

@@ -1,2 +0,2 @@

import { State } from 'xstate';
import { AnyState } from 'xstate';
import { ParsedReceiverEvent, ReceiverEvent } from './types';

@@ -6,4 +6,4 @@ export declare function getLazy<T>(value: T): T extends () => infer R ? R : T;

export declare function isReceiverEvent(event: any): event is ReceiverEvent;
export declare function parseState(stateJSON: string): State<any, any>;
export declare function parseState(stateJSON: string): AnyState;
export declare function parseReceiverEvent(event: ReceiverEvent): ParsedReceiverEvent;
//# sourceMappingURL=utils.d.ts.map

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

import { Interpreter, EventObject } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import { EventObject, Interpreter, XStateDevInterface } from 'xstate';
import type { Inspector, InspectorOptions, InspectReceiver, WebSocketReceiverOptions, WindowReceiverOptions } from './types';

@@ -4,0 +3,0 @@ export declare const serviceMap: Map<string, Interpreter<any, any, EventObject, {

@@ -7,3 +7,2 @@ 'use strict';

var xstate = require('xstate');
var utils$1 = require('xstate/lib/utils');
var utils = require('./utils.js');

@@ -121,3 +120,3 @@ var serialize = require('./serialize.js');

type: 'service.event',
event: stringifyWithSerializer(utils$1.toSCXMLEvent(utils$1.toEventObject(event, payload))),
event: stringifyWithSerializer(xstate.toSCXMLEvent(xstate.toEventObject(event, payload))),
sessionId: service.sessionId

@@ -161,3 +160,3 @@ });

subscribe: function (next, onError, onComplete) {
var observer = utils$1.toObserver(next, onError, onComplete);
var observer = xstate.toObserver(next, onError, onComplete);
listeners.add(observer);

@@ -190,3 +189,5 @@ observer.next(inspectService.state);

ownWindow.addEventListener('message', handler);
var actorRef = _tslib.__assign({ id: 'xstate.windowReceiver', send: function (event) {
var actorRef = xstate.toActorRef({
id: 'xstate.windowReceiver',
send: function (event) {
if (!targetWindow) {

@@ -196,4 +197,5 @@ return;

targetWindow.postMessage(event, '*');
}, subscribe: function (next, onError, onComplete) {
var observer = utils$1.toObserver(next, onError, onComplete);
},
subscribe: function (next, onError, onComplete) {
var observer = xstate.toObserver(next, onError, onComplete);
observers.add(observer);

@@ -205,8 +207,11 @@ return {

};
}, stop: function () {
},
stop: function () {
observers.clear();
ownWindow.removeEventListener('message', handler);
}, getSnapshot: function () {
},
getSnapshot: function () {
return latestEvent;
} }, utils$1.interopSymbols);
}
});
actorRef.send({

@@ -222,6 +227,9 @@ type: 'xstate.inspecting'

var latestEvent;
var actorRef = _tslib.__assign({ id: 'xstate.webSocketReceiver', send: function (event) {
var actorRef = xstate.toActorRef({
id: 'xstate.webSocketReceiver',
send: function (event) {
ws.send(utils.stringify(event, options.serialize));
}, subscribe: function (next, onError, onComplete) {
var observer = utils$1.toObserver(next, onError, onComplete);
},
subscribe: function (next, onError, onComplete) {
var observer = xstate.toObserver(next, onError, onComplete);
observers.add(observer);

@@ -233,5 +241,7 @@ return {

};
}, getSnapshot: function () {
},
getSnapshot: function () {
return latestEvent;
} }, utils$1.interopSymbols);
}
});
ws.onopen = function () {

@@ -238,0 +248,0 @@ actorRef.send({

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

import { ActorRef } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import { ActorRef, XStateDevInterface } from 'xstate';
import { ReceiverEvent, Replacer } from './types';

@@ -20,3 +19,8 @@ export declare type InspectMachineEvent = ReceiverEvent | {

client?: Pick<ActorRef<any, any>, "send"> | undefined;
}, any, InspectMachineEvent, any, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").TypegenDisabled & {
}, any, InspectMachineEvent, {
value: any;
context: {
client?: Pick<ActorRef<any, any>, "send"> | undefined;
};
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").TypegenDisabled & {
missingImplementations: {

@@ -23,0 +27,0 @@ actions: never;

@@ -1,6 +0,6 @@

import { State, StateMachine } from 'xstate';
import { AnyState, AnyStateMachine } from 'xstate';
import { Replacer } from './types';
export declare function selectivelyStringify<T extends object>(value: T, keys: Array<keyof T>, replacer?: Replacer): string;
export declare function stringifyState(state: State<any, any>, replacer?: Replacer): string;
export declare function stringifyMachine(machine: StateMachine<any, any, any>, replacer?: Replacer): string;
export declare function stringifyState(state: AnyState, replacer?: Replacer): string;
export declare function stringifyMachine(machine: AnyStateMachine, replacer?: Replacer): string;
//# sourceMappingURL=serialize.d.ts.map

@@ -7,4 +7,3 @@ 'use strict';

var xstate = require('xstate');
var utils = require('xstate/lib/utils');
var utils$1 = require('./utils.js');
var utils = require('./utils.js');
var inspectMachine = require('./inspectMachine.js');

@@ -42,3 +41,5 @@

var inspectService = xstate.interpret(inspectMachine.createInspectMachine(globalThis.__xstate__, options)).start();
var client = _tslib.__assign(_tslib.__assign({}, utils.interopSymbols), { id: '@@xstate/ws-client', send: function (event) {
var client = xstate.toActorRef({
id: '@@xstate/ws-client',
send: function (event) {
server.clients.forEach(function (wsClient) {

@@ -49,5 +50,8 @@ if (wsClient.readyState === wsClient.OPEN) {

});
}, subscribe: function () {
},
subscribe: function () {
return { unsubscribe: function () { return void 0; } };
}, getSnapshot: function () { return undefined; } });
},
getSnapshot: function () { return undefined; }
});
server.on('connection', function connection(wsClient) {

@@ -72,3 +76,3 @@ wsClient.on('message', function incoming(data, isBinary) {

type: 'service.event',
event: utils$1.stringify((service.state || service.initialState)._event),
event: utils.stringify((service.state || service.initialState)._event),
sessionId: service.sessionId

@@ -83,3 +87,3 @@ });

type: 'service.event',
event: utils$1.stringify(utils.toSCXMLEvent(utils.toEventObject(event, payload))),
event: utils.stringify(xstate.toSCXMLEvent(xstate.toEventObject(event, payload))),
sessionId: service.sessionId

@@ -92,3 +96,3 @@ });

type: 'service.state',
state: utils$1.stringify(state),
state: utils.stringify(state),
sessionId: service.sessionId

@@ -104,12 +108,18 @@ });

});
var inspector = _tslib.__assign(_tslib.__assign({}, utils.interopSymbols), { id: '@@xstate/inspector', send: function (event) {
var inspector = xstate.toActorRef({
id: '@@xstate/inspector',
send: function (event) {
inspectService.send(event);
}, subscribe: function () {
},
subscribe: function () {
return {
unsubscribe: function () { return void 0; }
};
}, disconnect: function () {
},
disconnect: function () {
server.close();
inspectService.stop();
}, getSnapshot: function () { return undefined; } });
},
getSnapshot: function () { return undefined; }
});
server.on('close', function () {

@@ -116,0 +126,0 @@ inspectService.stop();

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

import type { ActorRef, SCXML, State, StateMachine, AnyInterpreter } from 'xstate';
import { XStateDevInterface } from 'xstate/lib/devTools';
import type { ActorRef, AnyInterpreter, AnyState, AnyStateMachine, SCXML } from 'xstate';
import { XStateDevInterface } from 'xstate';
import { InspectMachineEvent } from './inspectMachine';

@@ -13,3 +13,3 @@ export declare type MaybeLazy<T> = T | (() => T);

}
export interface Inspector extends ActorRef<InspectMachineEvent, State<any, any, any, any, any>> {
export interface Inspector extends ActorRef<InspectMachineEvent, AnyState> {
/**

@@ -55,4 +55,4 @@ * Disconnects the inspector.

type: 'service.register';
machine: StateMachine<any, any, any, any, any, any, any>;
state: State<any, any>;
machine: AnyStateMachine;
state: AnyState;
id: string;

@@ -67,3 +67,3 @@ sessionId: string;

type: 'service.state';
state: State<any, any, any, any, any>;
state: AnyState;
sessionId: string;

@@ -70,0 +70,0 @@ } | {

@@ -1,2 +0,2 @@

import { State } from 'xstate';
import { AnyState } from 'xstate';
import { ParsedReceiverEvent, ReceiverEvent } from './types';

@@ -6,4 +6,4 @@ export declare function getLazy<T>(value: T): T extends () => infer R ? R : T;

export declare function isReceiverEvent(event: any): event is ReceiverEvent;
export declare function parseState(stateJSON: string): State<any, any>;
export declare function parseState(stateJSON: string): AnyState;
export declare function parseReceiverEvent(event: ReceiverEvent): ParsedReceiverEvent;
//# sourceMappingURL=utils.d.ts.map
{
"name": "@xstate/inspect",
"version": "0.6.2",
"version": "0.6.3",
"description": "XState inspection utilities",

@@ -5,0 +5,0 @@ "keywords": [

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