@statelyai/inspect
Advanced tools
Comparing version 0.3.0 to 0.3.1
# @statelyai/inspect | ||
## 0.3.1 | ||
### Patch Changes | ||
- [#27](https://github.com/statelyai/inspect/pull/27) [`39279fe`](https://github.com/statelyai/inspect/commit/39279fe6680904f8773331fc7b42a5dbf099a7b8) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Revert serialization changes | ||
## 0.3.0 | ||
@@ -4,0 +10,0 @@ |
@@ -88,3 +88,3 @@ import { InspectionEvent, Snapshot, AnyActorRef, AnyEventObject, Observer, Subscribable } from 'xstate'; | ||
filter?: (event: StatelyInspectionEvent) => boolean; | ||
serialize?: (event: StatelyInspectionEvent, originalEvent: StatelyInspectionEvent) => StatelyInspectionEvent; | ||
serialize?: (event: StatelyInspectionEvent) => StatelyInspectionEvent; | ||
/** | ||
@@ -91,0 +91,0 @@ * Whether to automatically start the inspector. |
@@ -69,3 +69,3 @@ "use strict"; | ||
name: "@statelyai/inspect", | ||
version: "0.3.0", | ||
version: "0.3.1", | ||
description: "Inspection utilities for state, actors, workflows, and state machines.", | ||
@@ -115,3 +115,2 @@ main: "dist/index.js", | ||
var import_safe_stable_stringify = __toESM(require("safe-stable-stringify")); | ||
var import_superjson = require("superjson"); | ||
function getRoot(actorRef) { | ||
@@ -130,3 +129,3 @@ let marker = actorRef; | ||
filter: () => true, | ||
serialize: (event) => (0, import_superjson.serialize)(event).json, | ||
serialize: (event) => event, | ||
autoStart: true | ||
@@ -139,4 +138,3 @@ }; | ||
} | ||
const preSerializedEvent = defaultInspectorOptions.serialize(event, event); | ||
const serializedEvent = options?.serialize?.(preSerializedEvent, event) ?? preSerializedEvent; | ||
const serializedEvent = options?.serialize?.(event) ?? event; | ||
adapter.send(serializedEvent); | ||
@@ -383,10 +381,3 @@ } | ||
this.deferredEvents.forEach((event2) => { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
event2, | ||
event2 | ||
); | ||
const serializedEvent = this.options.serialize( | ||
preSerializedEvent, | ||
event2 | ||
); | ||
const serializedEvent = this.options.serialize(event2); | ||
this.targetWindow?.postMessage(serializedEvent, "*"); | ||
@@ -409,7 +400,3 @@ }); | ||
} else if (this.status === "connected") { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
event, | ||
event | ||
); | ||
const serializedEvent = this.options.serialize(preSerializedEvent, event); | ||
const serializedEvent = this.options.serialize(event); | ||
this.targetWindow?.postMessage(serializedEvent, "*"); | ||
@@ -423,3 +410,3 @@ } | ||
var import_partysocket = __toESM(require("partysocket")); | ||
var import_superjson2 = require("superjson"); | ||
var import_superjson = require("superjson"); | ||
var import_uuid = require("uuid"); | ||
@@ -452,3 +439,3 @@ var isDevMode = false; | ||
const skyEvent = apiKey ? { apiKey, ...event } : event; | ||
socket.send((0, import_superjson2.stringify)(skyEvent)); | ||
socket.send((0, import_superjson.stringify)(skyEvent)); | ||
} | ||
@@ -462,3 +449,3 @@ }); | ||
const skyEvent = apiKey ? { apiKey, ...event } : event; | ||
socket.send((0, import_superjson2.stringify)(skyEvent)); | ||
socket.send((0, import_superjson.stringify)(skyEvent)); | ||
} | ||
@@ -494,10 +481,4 @@ }); | ||
this.deferredEvents.forEach((inspectionEvent) => { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
inspectionEvent, | ||
inspectionEvent | ||
); | ||
const serializedEvent = this.options.serialize( | ||
preSerializedEvent, | ||
inspectionEvent | ||
); | ||
const preSerializedEvent = defaultInspectorOptions.serialize(inspectionEvent); | ||
const serializedEvent = this.options.serialize(preSerializedEvent); | ||
this.ws.send((0, import_safe_stable_stringify2.default)(serializedEvent)); | ||
@@ -504,0 +485,0 @@ }); |
@@ -14,3 +14,3 @@ { | ||
"name": "@statelyai/inspect", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Inspection utilities for state, actors, workflows, and state machines.", | ||
@@ -32,2 +32,6 @@ "main": "dist/index.js", | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"packageManager": "pnpm@8.11.0", | ||
"scripts": { | ||
@@ -37,3 +41,2 @@ "build": "tsup src/index.ts --dts", | ||
"test": "vitest", | ||
"prepublishOnly": "tsup src/index.ts --dts", | ||
"changeset": "changeset", | ||
@@ -43,7 +46,3 @@ "release": "changeset publish", | ||
"dev": "yarn build && ./scripts/dev.sh" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"packageManager": "pnpm@8.11.0" | ||
} | ||
} | ||
} |
import safeStringify from 'fast-safe-stringify'; | ||
import { AnyEventObject, Observer, Subscribable, toObserver } from 'xstate'; | ||
import { | ||
InspectorOptions, | ||
createInspector, | ||
defaultInspectorOptions, | ||
} from './createInspector'; | ||
import { InspectorOptions, createInspector } from './createInspector'; | ||
import { Adapter, Inspector, StatelyInspectionEvent } from './types'; | ||
@@ -172,10 +168,3 @@ import { UselessAdapter } from './useless'; | ||
this.deferredEvents.forEach((event) => { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
event, | ||
event | ||
); | ||
const serializedEvent = this.options.serialize( | ||
preSerializedEvent, | ||
event | ||
); | ||
const serializedEvent = this.options.serialize(event); | ||
this.targetWindow?.postMessage(serializedEvent, '*'); | ||
@@ -199,7 +188,3 @@ }); | ||
} else if (this.status === 'connected') { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
event, | ||
event | ||
); | ||
const serializedEvent = this.options.serialize(preSerializedEvent, event); | ||
const serializedEvent = this.options.serialize(event); | ||
this.targetWindow?.postMessage(serializedEvent, '*'); | ||
@@ -206,0 +191,0 @@ } |
@@ -64,3 +64,3 @@ import { expect, test } from 'vitest'; | ||
"event": { | ||
"input": null, | ||
"input": undefined, | ||
"type": "xstate.init", | ||
@@ -67,0 +67,0 @@ }, |
@@ -14,3 +14,2 @@ import { | ||
import safeStringify from 'safe-stable-stringify'; | ||
import { serialize } from 'superjson'; | ||
@@ -38,6 +37,3 @@ function getRoot(actorRef: AnyActorRef) { | ||
filter?: (event: StatelyInspectionEvent) => boolean; | ||
serialize?: ( | ||
event: StatelyInspectionEvent, | ||
originalEvent: StatelyInspectionEvent | ||
) => StatelyInspectionEvent; | ||
serialize?: (event: StatelyInspectionEvent) => StatelyInspectionEvent; | ||
/** | ||
@@ -53,4 +49,3 @@ * Whether to automatically start the inspector. | ||
filter: () => true, | ||
serialize: (event) => | ||
serialize(event).json as unknown as StatelyInspectionEvent, | ||
serialize: (event) => event, | ||
autoStart: true, | ||
@@ -68,7 +63,6 @@ }; | ||
} | ||
const preSerializedEvent = defaultInspectorOptions.serialize(event, event); | ||
const serializedEvent = | ||
options?.serialize?.(preSerializedEvent, event) ?? preSerializedEvent; | ||
const serializedEvent = options?.serialize?.(event) ?? event; | ||
// idleCallback(() => { | ||
adapter.send(serializedEvent); | ||
// }) | ||
} | ||
@@ -75,0 +69,0 @@ const inspector: Inspector<TAdapter> = { |
@@ -39,10 +39,5 @@ import { | ||
this.deferredEvents.forEach((inspectionEvent) => { | ||
const preSerializedEvent = defaultInspectorOptions.serialize( | ||
inspectionEvent, | ||
inspectionEvent | ||
); | ||
const serializedEvent = this.options.serialize( | ||
preSerializedEvent, | ||
inspectionEvent | ||
); | ||
const preSerializedEvent = | ||
defaultInspectorOptions.serialize(inspectionEvent); | ||
const serializedEvent = this.options.serialize(preSerializedEvent); | ||
this.ws.send(safeStringify(serializedEvent)); | ||
@@ -49,0 +44,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
75733
1868