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

@statelyai/inspect

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statelyai/inspect - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

src/idleCallback.ts

40

dist/index.js

@@ -59,3 +59,3 @@ "use strict";

name: "@statelyai/inspect",
version: "0.0.6",
version: "0.0.7",
description: "Inspection utilities for state, actors, workflows, and state machines.",

@@ -69,3 +69,3 @@ main: "dist/index.js",

"isomorphic-ws": "^5.0.0",
xstate: "5.0.0"
xstate: "5.1.0"
},

@@ -79,2 +79,12 @@ scripts: {

// src/idleCallback.ts
function idleCallback(cb) {
if (typeof window !== "undefined") {
const raf = window.requestIdleCallback || window.requestAnimationFrame;
raf(cb);
} else {
setTimeout(cb, 0);
}
}
// src/createInspector.ts

@@ -143,4 +153,6 @@ function getRoot(actorRef) {

next: (event) => {
const convertedEvent = convertXStateEvent(event);
adapter.send(convertedEvent);
idleCallback(function inspectNext() {
const convertedEvent = convertXStateEvent(event);
adapter.send(convertedEvent);
});
}

@@ -161,4 +173,9 @@ },

const actorRef = inspectionEvent.actorRef;
const definitionObject = actorRef?.logic?.config;
const definitionString = definitionObject ? JSON.stringify(definitionObject, (key, value) => {
const logic = actorRef?.logic;
const definitionObject = logic?.config;
let name = actorRef.id;
if (name === actorRef.sessionId && definitionObject) {
name = definitionObject.id;
}
const definitionString = typeof definitionObject === "object" ? JSON.stringify(definitionObject, (key, value) => {
if (typeof value === "function") {

@@ -168,4 +185,5 @@ return { type: value.name };

return value;
}) : void 0;
const name = definitionObject ? definitionObject.id : actorRef.sessionId;
}) : JSON.stringify({
id: name
});
return {

@@ -175,3 +193,3 @@ name,

definition: definitionString,
_version: "0.0.1",
_version: package_default.version,
createdAt: Date.now().toString(),

@@ -192,3 +210,3 @@ id: null,

sessionId: inspectionEvent.actorRef.sessionId,
_version: "0.0.1",
_version: package_default.version,
createdAt: Date.now().toString(),

@@ -205,3 +223,3 @@ id: null,

sessionId: inspectionEvent.actorRef.sessionId,
_version: "0.0.1",
_version: package_default.version,
createdAt: Date.now().toString(),

@@ -208,0 +226,0 @@ id: null,

@@ -11,3 +11,3 @@ {

"name": "@statelyai/inspect",
"version": "0.0.6",
"version": "0.0.7",
"description": "Inspection utilities for state, actors, workflows, and state machines.",

@@ -21,3 +21,3 @@ "main": "dist/index.js",

"isomorphic-ws": "^5.0.0",
"xstate": "5.0.0"
"xstate": "5.1.0"
},

@@ -29,2 +29,2 @@ "scripts": {

}
}
}

@@ -12,2 +12,3 @@ import {

import pkg from '../package.json';
import { idleCallback } from './idleCallback';

@@ -106,4 +107,6 @@ function getRoot(actorRef: AnyActorRef) {

next: (event) => {
const convertedEvent = convertXStateEvent(event);
adapter.send(convertedEvent);
idleCallback(function inspectNext() {
const convertedEvent = convertXStateEvent(event);
adapter.send(convertedEvent);
});
},

@@ -128,14 +131,23 @@ },

const actorRef = inspectionEvent.actorRef;
const definitionObject = (actorRef as any)?.logic?.config;
const definitionString = definitionObject
? JSON.stringify(definitionObject, (key, value) => {
if (typeof value === 'function') {
return { type: value.name };
}
const logic = (actorRef as any)?.logic;
const definitionObject = logic?.config;
let name = actorRef.id;
return value;
})
: undefined;
const name = definitionObject ? definitionObject.id : actorRef.sessionId;
// TODO: fix this in XState
if (name === actorRef.sessionId && definitionObject) {
name = definitionObject.id;
}
const definitionString =
typeof definitionObject === 'object'
? JSON.stringify(definitionObject, (key, value) => {
if (typeof value === 'function') {
return { type: value.name };
}
return value;
})
: JSON.stringify({
id: name,
});
return {

@@ -145,3 +157,3 @@ name,

definition: definitionString,
_version: '0.0.1',
_version: pkg.version,
createdAt: Date.now().toString(),

@@ -162,3 +174,3 @@ id: null as any,

sessionId: inspectionEvent.actorRef.sessionId,
_version: '0.0.1',
_version: pkg.version,
createdAt: Date.now().toString(),

@@ -175,3 +187,3 @@ id: null as any,

sessionId: inspectionEvent.actorRef.sessionId,
_version: '0.0.1',
_version: pkg.version,
createdAt: Date.now().toString(),

@@ -178,0 +190,0 @@ id: null as any,

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