Skip to content

Commit

Permalink
Start with documentation
Browse files Browse the repository at this point in the history
Additionally, update @statelyai/inspect and make typescript checks for
pull requests.
  • Loading branch information
vladmaraev committed Aug 22, 2024
1 parent 4188413 commit 10a6e38
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check-typescript.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Typechecker

on:
pull_request:
branches: [ "main" ]
jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn exec tsc --noemit
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"vitest": "^2.0.5"
},
"dependencies": {
"@statelyai/inspect": "^0.2.5",
"@statelyai/inspect": "^0.4.0",
"speechstate": "^2.4.0"
},
"packageManager": "[email protected]+sha256.7f7d51b38db0d94adf25c512e3f3d3b47d23c97922eecc540f7440f116bdb99a"
Expand Down
11 changes: 9 additions & 2 deletions src/dme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import { setup, assign, sendTo, AnyTransitionConfig } from "xstate";
import { rules } from "./rules";
import { SaysMoveEvent, DMEEvent, DMEContext } from "./types";

/**
* Creates a transition with a guarded ISU.
*
* @param nextState Target state.
* @param ruleName Name of ISU rule.
* @param sendBackNextMove If `true`, communicate next move to the parent machine.
*/
function isuTransition(
nextState: string,
ruleName: string,
nextMove: boolean,
sendBackNextMove: boolean,
): AnyTransitionConfig {
return {
target: nextState,
guard: { type: "isu", params: { name: ruleName } },
actions: nextMove
actions: sendBackNextMove
? [
{ type: "isu", params: { name: ruleName } },
{ type: "sendBackNextMove" },
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2038,9 +2038,9 @@ __metadata:
languageName: node
linkType: hard

"@statelyai/inspect@npm:^0.2.5":
version: 0.2.5
resolution: "@statelyai/inspect@npm:0.2.5"
"@statelyai/inspect@npm:^0.4.0":
version: 0.4.0
resolution: "@statelyai/inspect@npm:0.4.0"
dependencies:
fast-safe-stringify: ^2.1.1
isomorphic-ws: ^5.0.0
Expand All @@ -2050,7 +2050,7 @@ __metadata:
uuid: ^9.0.1
peerDependencies:
xstate: ^5.5.1
checksum: a39ac4690dad15ecb6bf0dd898890d8351c075c6a6f5acee522f3119b8ffdf710ad9351e10b77f1f371c1e295a03c71520d8f8131acc9a9fc3221ae4c218b4b8
checksum: 3e0c88e19f950138d623d60729c2fa56edf82cb7ac74e16b00390ee6f4aa9304fa5103c60137993505c9f1edf5c8af92602fafd2eb4d38e04e6b626357cc8274
languageName: node
linkType: hard

Expand Down Expand Up @@ -4466,7 +4466,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "sisu@workspace:."
dependencies:
"@statelyai/inspect": ^0.2.5
"@statelyai/inspect": ^0.4.0
speechstate: ^2.4.0
typescript: ^5.2.2
vite: ^5.2.0
Expand Down

0 comments on commit 10a6e38

Please sign in to comment.