@statelyai/inspect
Advanced tools
Comparing version 0.2.1 to 0.2.2
# @statelyai/inspect | ||
## 0.2.2 | ||
### Patch Changes | ||
- [#15](https://github.com/statelyai/inspect/pull/15) [`b20b7b7`](https://github.com/statelyai/inspect/commit/b20b7b71722f4f3a68ee17cfad471d89bc1f0e2e) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Use `safe-stable-stringify` everywhere applicable | ||
- [#13](https://github.com/statelyai/inspect/pull/13) [`9d9229d`](https://github.com/statelyai/inspect/commit/9d9229dcd6a83a8d32d65c4f9eca084e7f5b66b0) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Replace fast-safe-stringify with stable-safe-stringify | ||
## 0.2.1 | ||
@@ -4,0 +12,0 @@ |
@@ -109,3 +109,3 @@ import { InspectionEvent, Snapshot, AnyActorRef, AnyEventObject, Observer, Subscribable } from 'xstate'; | ||
stop(): void; | ||
send(event: StatelyInspectionEvent): void; | ||
send(inspectionEvent: StatelyInspectionEvent): void; | ||
} | ||
@@ -112,0 +112,0 @@ declare function createWebSocketInspector(options?: WebSocketInspectorOptions): Inspector<WebSocketAdapter>; |
@@ -62,3 +62,3 @@ "use strict"; | ||
name: "@statelyai/inspect", | ||
version: "0.2.1", | ||
version: "0.2.2", | ||
description: "Inspection utilities for state, actors, workflows, and state machines.", | ||
@@ -70,4 +70,4 @@ main: "dist/index.js", | ||
dependencies: { | ||
"fast-safe-stringify": "^2.1.1", | ||
"isomorphic-ws": "^5.0.0" | ||
"isomorphic-ws": "^5.0.0", | ||
"safe-stable-stringify": "^2.4.3" | ||
}, | ||
@@ -103,3 +103,3 @@ peerDependencies: { | ||
// src/createInspector.ts | ||
var import_fast_safe_stringify = __toESM(require("fast-safe-stringify")); | ||
var import_safe_stable_stringify = __toESM(require("safe-stable-stringify")); | ||
function getRoot(actorRef) { | ||
@@ -129,3 +129,3 @@ let marker = actorRef; | ||
const definitionObject = actorRef?.logic?.config; | ||
const definition = definitionObject ? JSON.stringify(definitionObject) : void 0; | ||
const definition = definitionObject ? (0, import_safe_stable_stringify.default)(definitionObject) : void 0; | ||
const rootId = info?.rootId ?? typeof actorRef === "string" ? void 0 : getRootId(actorRef); | ||
@@ -204,3 +204,3 @@ const parentId = info?.parentId ?? typeof actorRef === "string" ? void 0 : actorRef._parent?.sessionId; | ||
} | ||
const definitionString = typeof definitionObject === "object" ? JSON.stringify(definitionObject, (key, value) => { | ||
const definitionString = typeof definitionObject === "object" ? (0, import_safe_stable_stringify.default)(definitionObject, (_key, value) => { | ||
if (typeof value === "function") { | ||
@@ -210,3 +210,3 @@ return { type: value.name }; | ||
return value; | ||
}) : JSON.stringify({ | ||
}) : (0, import_safe_stable_stringify.default)({ | ||
id: name | ||
@@ -244,3 +244,3 @@ }); | ||
event: inspectionEvent.event, | ||
snapshot: JSON.parse((0, import_fast_safe_stringify.default)(inspectionEvent.snapshot)), | ||
snapshot: JSON.parse((0, import_safe_stable_stringify.default)(inspectionEvent.snapshot)), | ||
sessionId: inspectionEvent.actorRef.sessionId, | ||
@@ -263,3 +263,3 @@ _version: package_default.version, | ||
var import_isomorphic_ws = __toESM(require("isomorphic-ws")); | ||
var import_fast_safe_stringify2 = __toESM(require("fast-safe-stringify")); | ||
var import_safe_stable_stringify2 = __toESM(require("safe-stable-stringify")); | ||
var import_xstate = require("xstate"); | ||
@@ -274,3 +274,3 @@ var WebSocketAdapter = class { | ||
filter: () => true, | ||
serialize: (event) => JSON.parse((0, import_fast_safe_stringify2.default)(event)), | ||
serialize: (inspectionEvent) => JSON.parse((0, import_safe_stable_stringify2.default)(inspectionEvent)), | ||
autoStart: true, | ||
@@ -287,4 +287,5 @@ url: "ws://localhost:8080", | ||
this.status = "open"; | ||
this.deferredEvents.forEach((event) => { | ||
this.ws.send(JSON.stringify(event)); | ||
this.deferredEvents.forEach((inspectionEvent) => { | ||
const serializedEvent = this.options.serialize(inspectionEvent); | ||
this.ws.send((0, import_safe_stable_stringify2.default)(serializedEvent)); | ||
}); | ||
@@ -314,7 +315,7 @@ }; | ||
} | ||
send(event) { | ||
send(inspectionEvent) { | ||
if (this.status === "open") { | ||
this.ws.send(JSON.stringify(event)); | ||
this.ws.send((0, import_safe_stable_stringify2.default)(inspectionEvent)); | ||
} else { | ||
this.deferredEvents.push(event); | ||
this.deferredEvents.push(inspectionEvent); | ||
} | ||
@@ -364,3 +365,3 @@ } | ||
var import_xstate2 = require("xstate"); | ||
var import_fast_safe_stringify3 = __toESM(require("fast-safe-stringify")); | ||
var import_safe_stable_stringify3 = __toESM(require("safe-stable-stringify")); | ||
@@ -396,3 +397,3 @@ // src/useless.ts | ||
filter: () => true, | ||
serialize: (event) => JSON.parse((0, import_fast_safe_stringify3.default)(event)), | ||
serialize: (inspectionEvent) => JSON.parse((0, import_safe_stable_stringify3.default)(inspectionEvent)), | ||
autoStart: true, | ||
@@ -399,0 +400,0 @@ iframe: null, |
@@ -13,3 +13,3 @@ { | ||
"name": "@statelyai/inspect", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Inspection utilities for state, actors, workflows, and state machines.", | ||
@@ -21,4 +21,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"fast-safe-stringify": "^2.1.1", | ||
"isomorphic-ws": "^5.0.0" | ||
"isomorphic-ws": "^5.0.0", | ||
"safe-stable-stringify": "^2.4.3" | ||
}, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
import { AnyEventObject, Observer, Subscribable, toObserver } from 'xstate'; | ||
import { Adapter, Inspector, StatelyInspectionEvent } from './types'; | ||
import { InspectorOptions, createInspector } from './createInspector'; | ||
import safeStringify from 'fast-safe-stringify'; | ||
import safeStringify from 'safe-stable-stringify'; | ||
import { UselessAdapter } from './useless'; | ||
@@ -55,3 +55,3 @@ | ||
filter: () => true, | ||
serialize: (event) => JSON.parse(safeStringify(event)), | ||
serialize: (inspectionEvent) => JSON.parse(safeStringify(inspectionEvent)), | ||
autoStart: true, | ||
@@ -58,0 +58,0 @@ iframe: null, |
@@ -13,3 +13,3 @@ import { | ||
import { idleCallback } from './idleCallback'; | ||
import safeStringify from 'fast-safe-stringify'; | ||
import safeStringify from 'safe-stable-stringify'; | ||
@@ -73,3 +73,3 @@ function getRoot(actorRef: AnyActorRef) { | ||
const definition = definitionObject | ||
? JSON.stringify(definitionObject) | ||
? safeStringify(definitionObject) | ||
: undefined; | ||
@@ -168,3 +168,3 @@ const rootId = | ||
typeof definitionObject === 'object' | ||
? JSON.stringify(definitionObject, (key, value) => { | ||
? safeStringify(definitionObject, (_key, value) => { | ||
if (typeof value === 'function') { | ||
@@ -176,3 +176,3 @@ return { type: value.name }; | ||
}) | ||
: JSON.stringify({ | ||
: safeStringify({ | ||
id: name, | ||
@@ -179,0 +179,0 @@ }); |
import { InspectorOptions, createInspector } from './createInspector'; | ||
import { Adapter, StatelyInspectionEvent } from './types'; | ||
import WebSocket from 'isomorphic-ws'; | ||
import safeStringify from 'fast-safe-stringify'; | ||
import safeStringify from 'safe-stable-stringify'; | ||
import { Observer, Subscribable, toObserver } from 'xstate'; | ||
@@ -20,3 +20,4 @@ | ||
filter: () => true, | ||
serialize: (event) => JSON.parse(safeStringify(event)), | ||
serialize: (inspectionEvent) => | ||
JSON.parse(safeStringify(inspectionEvent)), | ||
autoStart: true, | ||
@@ -34,4 +35,5 @@ url: 'ws://localhost:8080', | ||
this.status = 'open'; | ||
this.deferredEvents.forEach((event) => { | ||
this.ws.send(JSON.stringify(event)); | ||
this.deferredEvents.forEach((inspectionEvent) => { | ||
const serializedEvent = this.options.serialize(inspectionEvent); | ||
this.ws.send(safeStringify(serializedEvent)); | ||
}); | ||
@@ -66,7 +68,7 @@ }; | ||
} | ||
public send(event: StatelyInspectionEvent) { | ||
public send(inspectionEvent: StatelyInspectionEvent) { | ||
if (this.status === 'open') { | ||
this.ws.send(JSON.stringify(event)); | ||
this.ws.send(safeStringify(inspectionEvent)); | ||
} else { | ||
this.deferredEvents.push(event); | ||
this.deferredEvents.push(inspectionEvent); | ||
} | ||
@@ -73,0 +75,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67700
1708
+ Addedsafe-stable-stringify@^2.4.3
+ Addedsafe-stable-stringify@2.5.0(transitive)
- Removedfast-safe-stringify@^2.1.1
- Removedfast-safe-stringify@2.1.1(transitive)