Skip to content

Commit

Permalink
Merge pull request #18 from statelyai/mellson/sta-5836-update-sky-sdk…
Browse files Browse the repository at this point in the history
…-to-xstate-5-release

Update Sky SDK to XState 5 release
  • Loading branch information
mellson authored Dec 12, 2023
2 parents ac7ec53 + bb76f0f commit 03152df
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .changeset/gorgeous-doors-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@statelyai/sky-react': patch
'@statelyai/sky': patch
---

Update to the XState 5 release version.
4 changes: 2 additions & 2 deletions packages/sky-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
"homepage": "https://github.com/statelyai/sky/tree/main/packages/sky-core#readme",
"dependencies": {
"partysocket": "0.0.12",
"partysocket": "0.0.17",
"superjson": "1.13.1",
"xstate": "5.0.0-beta.37"
"xstate": "5.2.1"
}
}
4 changes: 2 additions & 2 deletions packages/sky-core/src/actorFromStately.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export async function actorFromStately<T extends AnyStateMachine>(
}
case 'actor.start': {
// Start the actor with the initial value from Sky
actor = createActor(machine, {
state: skyEvent.persistedState,
actor = createActor(machine as any, {
snapshot: skyEvent.snapshot,
});

// Send all events from the actor to Sky except for events that originate from Sky
Expand Down
20 changes: 10 additions & 10 deletions packages/sky-core/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { AnyStateMachine } from 'xstate';
import {
AnyActorLogic,
AnyEventObject,
AnyStateMachine,
SnapshotFrom,
StateValue,
} from 'xstate';

export type SkyConfig =
| {
config: any;
actorId: string;
prettyConfigString: string;
configString: string;
implementationString: string;
}
| { error: string };

Expand All @@ -13,13 +20,6 @@ export interface SkyConfigFile<T extends AnyStateMachine> {
actorId: string;
}

import {
AnyActorLogic,
AnyEventObject,
PersistedStateFrom,
StateValue,
} from 'xstate';

interface SafeSkyEvent {
apiKey: string;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ export type SkyServerSimulateEvent = SafeSkyEvent &
InternalSkyServerSimulateEvent;

type InternalSkyServerActorEvent =
| { type: 'actor.start'; persistedState: PersistedStateFrom<AnyActorLogic> }
| { type: 'actor.start'; snapshot: SnapshotFrom<AnyActorLogic> }
| { type: 'actor.send'; event: AnyEventObject }
| { type: 'actor.stop'; event: AnyEventObject }
| { type: 'actor.error'; error: string };
Expand Down
6 changes: 3 additions & 3 deletions packages/sky-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
},
"homepage": "https://github.com/statelyai/sky/tree/main/packages/sky-react#readme",
"dependencies": {
"@statelyai/sky": "0.0.9",
"@xstate/react": "4.0.0-beta.10",
"xstate": "5.0.0-beta.37"
"@statelyai/sky": "*",
"@xstate/react": "4.0.1",
"xstate": "5.2.1"
},
"devDependencies": {
"@types/react": "^18.2.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/sky-react/src/useStatelyActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function useStatelyActor<T extends AnyStateMachine>(

const [maybeActor, setMaybeActor] = useState<Actor<T>>();
const state = useSelector(
maybeActor ?? createActor(skyConfig.machine),
maybeActor ?? createActor(skyConfig.machine as any),
(snapshot) => snapshot,
);

Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,10 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04"
integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==

"@xstate/[email protected].0-beta.10":
version "4.0.0-beta.10"
resolved "https://registry.yarnpkg.com/@xstate/react/-/react-4.0.0-beta.10.tgz#35b67128560b2fab685e3d3113c3392b1c93492e"
integrity sha512-S77ALlcoMYMiG9cVlf9qpcy0V6hZ6Va9K/jU4xidX21JsI6YI9i8HMtmMAiRbeV+chkwThe0otEEWFFUWXNHgg==
"@xstate/[email protected].1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@xstate/react/-/react-4.0.1.tgz#a5cec511e23e44ac5dd64852a1497efb6434c3f0"
integrity sha512-UB9qUC11wcaYd05wGea0mvEA3uTHikNaB4InMZfxD7MVFxzBFU+3JFkemjiN8bDdPJfDrObyP9ZPDVojq2LytA==
dependencies:
use-isomorphic-layout-effect "^1.1.2"
use-sync-external-store "^1.0.0"
Expand Down Expand Up @@ -2445,10 +2445,10 @@ parse-json@^5.0.0, parse-json@^5.1.0:
json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"

[email protected].12:
version "0.0.12"
resolved "https://registry.yarnpkg.com/partysocket/-/partysocket-0.0.12.tgz#97285d8047121fe82d8294f46dea037f579c5b22"
integrity sha512-20fikH08aHl7oJvRD7QLftzHvCEqxHf6y/ZiO0wltkl2cbNbtZQuDno9CLrqIQG2t22UWFHjiSqj/rT1In36Eg==
[email protected].17:
version "0.0.17"
resolved "https://registry.yarnpkg.com/partysocket/-/partysocket-0.0.17.tgz#cb36858e5c2749cbf3ef9208f7df22c028162105"
integrity sha512-8Re9nmgP2LzQhq+FBs9+BZNTjmMwoF4geEKlpH0lxW1JKp3FmplN74306afGH9EsOjdfcXqKY2VCZtc3iAHIow==

path-exists@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -3214,10 +3214,10 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==

xstate@5.0.0-beta.37:
version "5.0.0-beta.37"
resolved "https://registry.yarnpkg.com/xstate/-/xstate-5.0.0-beta.37.tgz#617dc79ec2dc6b30b2567da93c0559bf2d595b34"
integrity sha512-pbdl6piQ7H+KGd8TKxo5htomMkP85HXLVfTuUy6J0JMPvI8srum3YD+QINx3Ea4QAib8tqk28u70BNq2opnoIw==
xstate@5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/xstate/-/xstate-5.2.1.tgz#55f1736cccdff58938277d1e1e2a91a01d37f008"
integrity sha512-qPYPnoYIvNSwSv4uIwV+V/uFeGk6houLGmZy0io1XsfImBrp1AKbw9ADNJytCksCDP/YOAg1EtiWjXFzsT1rdw==

y18n@^4.0.0:
version "4.0.3"
Expand Down

0 comments on commit 03152df

Please sign in to comment.