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.1.0 to 0.2.0

CHANGELOG.md

26

dist/index.js

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

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

@@ -77,2 +77,5 @@ main: "dist/index.js",

prepublishOnly: "tsup src/index.ts --dts"
},
publishConfig: {
access: "public"
}

@@ -337,2 +340,16 @@ };

var import_fast_safe_stringify2 = __toESM(require("fast-safe-stringify"));
// src/useless.ts
var UselessAdapter = class {
constructor() {
}
start() {
}
stop() {
}
send(_event) {
}
};
// src/browser.ts
var CONNECTION_EVENT = "@statelyai.connected";

@@ -346,2 +363,7 @@ function isEventObject(event) {

function createBrowserInspector(options) {
const resolvedWindow = options?.window ?? (typeof window === "undefined" ? void 0 : window);
if (!resolvedWindow) {
console.error("Window does not exist; inspector cannot be started.");
return new UselessAdapter();
}
const resolvedOptions = {

@@ -354,3 +376,3 @@ url: "https://stately.ai/inspect",

...options,
window: options?.window ?? window
window: resolvedWindow
};

@@ -357,0 +379,0 @@ const adapter = new BrowserAdapter(resolvedOptions);

5

package.json

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

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

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

"prepublishOnly": "tsup src/index.ts --dts"
},
"publishConfig": {
"access": "public"
}
}

@@ -68,1 +68,14 @@ import { expect, test } from 'vitest';

});
test('inspector works with window undefined', async () => {
const inspector = createBrowserInspector({
window: undefined,
});
const machine = createMachine({});
const actor = createActor(machine, { inspect: inspector.inspect });
expect(() => {
actor.start();
}).not.toThrow();
});

@@ -5,2 +5,3 @@ import { AnyEventObject, Observer, Subscribable, toObserver } from 'xstate';

import safeStringify from 'fast-safe-stringify';
import { UselessAdapter } from './useless';

@@ -43,2 +44,11 @@ interface BrowserReceiver extends Subscribable<StatelyInspectionEvent> {}

): Inspector<BrowserAdapter> {
const resolvedWindow =
options?.window ?? (typeof window === 'undefined' ? undefined : window);
if (!resolvedWindow) {
console.error('Window does not exist; inspector cannot be started.');
return new UselessAdapter() as any;
}
const resolvedOptions = {

@@ -51,3 +61,3 @@ url: 'https://stately.ai/inspect',

...options,
window: options?.window ?? window,
window: resolvedWindow,
} satisfies Required<BrowserInspectorOptions>;

@@ -54,0 +64,0 @@ const adapter = new BrowserAdapter(resolvedOptions);

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