@effectstream/runtime 0.100.15 → 0.100.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +30 -19
  2. package/package.json +14 -14
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # @effectstream/runtime
2
2
 
3
- The state-machine runtime — the loop that ties sync, state machine,
3
+ The state-machine runtime - the loop that ties sync, state machine,
4
4
  database, events, and HTTP API together inside an EffectStream node.
5
5
  Boot it with `init()` then drive it with `start(config)` and your node
6
6
  is up.
7
7
 
8
+ - The state-machine runtime that owns an Effectstream node's process model.
9
+ - `init()` once, `start(config)` to run; ties sync, state machine, DB, events, and HTTP API together.
10
+ - Used by every template.
11
+ - Also reachable through `@effectstream/node-sdk/runtime`.
12
+
8
13
  ## Install
9
14
 
10
15
  ```bash
@@ -23,21 +28,27 @@ This package **owns the node's process model**. You don't pick parts of
23
28
  it; you call `init()` once at boot and then `start(config)`. The config
24
29
  brings together everything else:
25
30
 
31
+ `init()` and `start()` are Effection operations, so they must be
32
+ yielded inside an Effection `main()`:
33
+
26
34
  ```typescript
35
+ import { main } from "effection";
27
36
  import { init, start } from "@effectstream/runtime";
28
37
  import { Stm } from "@effectstream/sm";
29
38
  import { config } from "./config.dev.ts";
30
39
 
31
- await init();
40
+ await main(function* () {
41
+ yield* init();
32
42
 
33
- const gameStm = new Stm(grammar);
34
- gameStm.addStateTransition("join", function* () { /* ... */ });
43
+ const gameStm = new Stm(grammar);
44
+ gameStm.addStateTransition("join", function* () { /* ... */ });
35
45
 
36
- await start({
37
- config,
38
- gameStateTransitions: [gameStm],
39
- apiRouter: undefined, // optional Fastify route plugin
40
- dbMigrations: [], // SQL migrations
46
+ yield* start({
47
+ config,
48
+ gameStateTransitions: [gameStm],
49
+ apiRouter: undefined, // optional Fastify route plugin
50
+ migrations: [], // SQL migrations
51
+ });
41
52
  });
42
53
  ```
43
54
 
@@ -60,30 +71,30 @@ runtime exposes a Fastify router.
60
71
 
61
72
  ## Key exports
62
73
 
63
- - `init()` — `Operation<void>`. One-shot setup: OpenTelemetry, config validation, version pinning. Call before `start`.
64
- - `start(config: StartConfig)` — `Operation<void>`. Run the node loop until cancelled.
74
+ - `init()` - `Operation<void>`. One-shot setup: OpenTelemetry, config validation, version pinning. Call before `start`.
75
+ - `start(config: StartConfig)` - `Operation<void>`. Run the node loop until cancelled.
65
76
 
66
77
  Types and helpers re-exported alongside `init` / `start`:
67
78
 
68
- - `DBMigrations` — versioned SQL migrations passed into `start`.
69
- - `StartConfig`, `StartConfigGameStateTransitions`, `StartConfigApiRouter` — `start`'s config types. Templates type-check against these implicitly but don't usually import them by name.
70
- - `PrimitiveConstructor<T>` — extension point for new primitives.
71
- - `VERSION` — `${number}.${number}.${number}` literal type for version pinning.
79
+ - `DBMigrations` - versioned SQL migrations passed into `start`.
80
+ - `StartConfig`, `StartConfigGameStateTransitions`, `StartConfigApiRouter` - `start`'s config types. Templates type-check against these implicitly but don't usually import them by name.
81
+ - `PrimitiveConstructor<T>` - extension point for new primitives.
82
+ - `VERSION` - `${number}.${number}.${number}` literal type for version pinning.
72
83
  - Pagination helpers re-exported from `./api/pagination.ts`.
73
84
 
74
85
  ## Examples
75
86
 
76
87
  The templates under
77
- [`templates/`](https://github.com/PaimaStudios/paima-engine/tree/main/templates)
88
+ [`templates/`](https://github.com/effectstream/effectstream/tree/main/templates)
78
89
  are full working `init()` + `start()` examples. The simplest is
79
- [`templates/minimal/`](https://github.com/PaimaStudios/paima-engine/tree/main/templates/minimal).
90
+ [`templates/minimal/`](https://github.com/effectstream/effectstream/tree/main/templates/minimal).
80
91
 
81
92
  End-to-end EVM sync test:
82
- [`e2e/evm/sync/`](https://github.com/PaimaStudios/paima-engine/tree/main/e2e/evm/sync).
93
+ [`e2e/evm/sync/`](https://github.com/effectstream/effectstream/tree/main/e2e/evm/sync).
83
94
 
84
95
  Runnable: [`test/examples.test.ts`](./test/examples.test.ts).
85
96
 
86
97
  ## Links
87
98
 
88
99
  - Docs: https://effectstream.github.io/docs/packages/node/runtime
89
- - Source: https://github.com/PaimaStudios/paima-engine/tree/main/packages/node-sdk/runtime
100
+ - Source: https://github.com/effectstream/effectstream/tree/main/packages/node-sdk/runtime
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@effectstream/runtime",
3
- "version": "0.100.15",
3
+ "version": "0.100.17",
4
4
  "license": "MIT",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/PaimaStudios/paima-engine",
8
+ "url": "https://github.com/effectstream/effectstream",
9
9
  "directory": "packages/node-sdk/runtime"
10
10
  },
11
11
  "bugs": {
12
- "url": "https://github.com/PaimaStudios/paima-engine/issues"
12
+ "url": "https://github.com/effectstream/effectstream/issues"
13
13
  },
14
14
  "exports": "./src/mod.ts",
15
15
  "dependencies": {
16
- "@effectstream/concise": "0.100.15",
17
- "@effectstream/config": "0.100.15",
18
- "@effectstream/coroutine": "0.100.15",
19
- "@effectstream/crypto": "0.100.15",
20
- "@effectstream/db": "0.100.15",
21
- "@effectstream/event-client": "0.100.15",
22
- "@effectstream/event-server": "0.100.15",
23
- "@effectstream/log": "0.100.15",
24
- "@effectstream/sm": "0.100.15",
25
- "@effectstream/sync": "0.100.15",
26
- "@effectstream/utils": "0.100.15",
16
+ "@effectstream/concise": "0.100.17",
17
+ "@effectstream/config": "0.100.17",
18
+ "@effectstream/coroutine": "0.100.17",
19
+ "@effectstream/crypto": "0.100.17",
20
+ "@effectstream/db": "0.100.17",
21
+ "@effectstream/event-client": "0.100.17",
22
+ "@effectstream/event-server": "0.100.17",
23
+ "@effectstream/log": "0.100.17",
24
+ "@effectstream/sm": "0.100.17",
25
+ "@effectstream/sync": "0.100.17",
26
+ "@effectstream/utils": "0.100.17",
27
27
  "@fastify/cors": "^11.0.1",
28
28
  "@metamask/json-rpc-engine": "^10.0.3",
29
29
  "pg": "8.17.2",