@rotorsoft/act 1.37.7 → 2.0.0
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.
- package/README.md +16 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +5 -4
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +2 -2
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/merge.d.ts.map +1 -1
- package/dist/@types/builders/state-builder.d.ts +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts +8 -0
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/classify.d.ts.map +1 -1
- package/dist/@types/internal/close-cycle.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +11 -0
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/date-reviver.d.ts +6 -3
- package/dist/@types/internal/date-reviver.d.ts.map +1 -1
- package/dist/@types/internal/drain-ops.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts +6 -2
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/internal/reaction-dispatch.d.ts +6 -0
- package/dist/@types/internal/reaction-dispatch.d.ts.map +1 -1
- package/dist/@types/internal/tracing.d.ts.map +1 -1
- package/dist/@types/ports.d.ts.map +1 -1
- package/dist/@types/types/act.d.ts +0 -9
- package/dist/@types/types/act.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +36 -32
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/builders.d.ts +126 -47
- package/dist/@types/types/builders.d.ts.map +1 -1
- package/dist/@types/types/errors.d.ts +11 -43
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +51 -34
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +3 -3
- package/dist/@types/utils.d.ts +37 -12
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/{chunk-PRDX3HP6.cjs → chunk-LUHPSF3C.cjs} +73 -50
- package/dist/chunk-LUHPSF3C.cjs.map +1 -0
- package/dist/{chunk-HXW3TPP6.js → chunk-MWHTNPUY.js} +62 -39
- package/dist/chunk-MWHTNPUY.js.map +1 -0
- package/dist/{chunk-V5ZB54DC.js → chunk-SNPEQW6Z.js} +7 -21
- package/dist/chunk-SNPEQW6Z.js.map +1 -0
- package/dist/{chunk-H6KVPVP4.cjs → chunk-YFFWCVXW.cjs} +8 -22
- package/dist/chunk-YFFWCVXW.cjs.map +1 -0
- package/dist/index.cjs +1828 -1621
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1511 -1304
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +4 -4
- package/dist/test/index.js +2 -2
- package/dist/types/index.cjs +2 -4
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +1 -3
- package/package.json +2 -2
- package/dist/chunk-H6KVPVP4.cjs.map +0 -1
- package/dist/chunk-HXW3TPP6.js.map +0 -1
- package/dist/chunk-PRDX3HP6.cjs.map +0 -1
- package/dist/chunk-V5ZB54DC.js.map +0 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ For the project-level overview, see the [root README](../../README.md).
|
|
|
20
20
|
pnpm add @rotorsoft/act zod
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The examples use top-level `await`, which needs ESM (`"type": "module"`).
|
|
24
24
|
|
|
25
25
|
For production, also install one of the durable stores: [`@rotorsoft/act-pg`](https://www.npmjs.com/package/@rotorsoft/act-pg) (Postgres) or [`@rotorsoft/act-sqlite`](https://www.npmjs.com/package/@rotorsoft/act-sqlite) (SQLite). The bundled `InMemoryStore` is used by default and is intended for development and tests.
|
|
26
26
|
|
|
@@ -47,6 +47,19 @@ console.log(snap.state); // { count: 5 }
|
|
|
47
47
|
|
|
48
48
|
Define state, declare actions, dispatch, load. Everything else — projections, reactions, slices, cross-process drain, time-travel — is more of the same builder calls.
|
|
49
49
|
|
|
50
|
+
## Rules across streams
|
|
51
|
+
|
|
52
|
+
**New in 2.0.** A rule that spans streams, such as a unique email or a limited number of seats, needs no saga. An action loads the other stream with `.loads`, decides, and commits to every stream at once: all of it lands or none of it does.
|
|
53
|
+
|
|
54
|
+
```ts no-check
|
|
55
|
+
.on({ Enroll })
|
|
56
|
+
.loads(Seats, (data) => `course-${data.course}`, ["SeatTaken"])
|
|
57
|
+
.requires([{ description: "a free seat", holds: (_, __, ___, { Seats }) => Seats.taken < Seats.capacity }])
|
|
58
|
+
.emit((data) => [["Enrolled", data], ["SeatTaken", {}]])
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Every pattern, what a race does and what it costs: [Rules across streams](https://rotorsoft.github.io/act-root/docs/guides/rules-across-streams). [Watch it play](https://rotorsoft.github.io/act-root/flows/rules-across-streams.html).
|
|
62
|
+
|
|
50
63
|
## API
|
|
51
64
|
|
|
52
65
|
Top-level exports:
|
|
@@ -129,8 +142,8 @@ await app.unblock({ stream: "^webhooks-out-" }); // bulk
|
|
|
129
142
|
|
|
130
143
|
## Compatibility
|
|
131
144
|
|
|
132
|
-
- **Node**: >=22.23.
|
|
133
|
-
- **Peer**: `zod` ^4.
|
|
145
|
+
- **Node**: >=22.23.4
|
|
146
|
+
- **Peer**: `zod` ^4.6.7
|
|
134
147
|
- **Bundled deps**: `@rotorsoft/act-patch` (state reducer)
|
|
135
148
|
- **Module formats**: ESM + CJS
|
|
136
149
|
- **TypeScript**: strict mode recommended for full inference
|