pure-effect 0.19.0 → 0.20.1
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/CHANGELOG.md +27 -1
- package/README.md +959 -657
- package/RULES.md +43 -0
- package/examples/recording-example.js +6 -3
- package/index.d.ts +29 -20
- package/index.js +153 -58
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to
|
|
3
|
+
All notable changes to Pure Effect are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and from 1.0.0 the project follows [Semantic Versioning](https://semver.org/). Before 1.0.0 a minor version could change behaviour; each such change is marked below.
|
|
4
|
+
|
|
5
|
+
## [0.20.1] - 2026-10-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- The package ships `RULES.md`, the README's twelve rules for writing a flow with an index of where each task is covered, for coding agents and their instructions.
|
|
10
|
+
- The recording example takes a `version` and attaches it to each trace, so `timeTravel` warns when it replays a trace from another build.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- A Resolver with no answer for a step is named as the cause, and the other replay errors speak of the recorded run rather than production.
|
|
15
|
+
- A function given to an option, such as `Retry`'s `delay`, is named plainly in the error, rather than taken for a flow passed without its input.
|
|
16
|
+
- The recording example types `redact` as `recorder` declares it, so a TypeScript `redact` that names the four kinds can be passed to `recordingHooks`.
|
|
17
|
+
|
|
18
|
+
## [0.20.0] - 2026-10-13
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Breaking: `recordEffect` takes the flow already called with its input, as `runEffect` and `replayEffect` do.** Write `recordEffect(checkoutFlow(input), options)` where you wrote `recordEffect(checkoutFlow, input, options)`. The trace still holds the input of a flow `effectPipe` or `effectGen` built, so `timeTravel` builds the flow again from it, and a flow built some other way records none, as it does when recorded in production. A call written the old way is refused as a flow passed without its input. In TypeScript the trace's `initialInput` is now `unknown`, as it is in a trace read back from storage.
|
|
23
|
+
- **Breaking: `Retry`'s `attempts` option is renamed `retries`, and so is the exhaustion's field.** It always counted the tries after the first, so `retries: 2` makes at most three calls, which the old name hid. `attempts` is refused as an option `Retry` does not have, as the flow is built, and `onExhausted` receives `{ retryExhausted, lastError, retries }`.
|
|
24
|
+
- **Breaking: `timeTravel` returns `{ result, unreached }`, as `replayEffect` does for a trace,** rather than the outcome alone, so a test can check the steps it narrated as never reached.
|
|
25
|
+
- **Running a generator flow again builds it again from its input, as calling an `async` function again does.** A `Retry` around a generator flow repeated its first Command as the first attempt built it and built the rest again, so a value the body made, such as an ID or the time, was one value in the first Command and another in the next: a retried reservation and charge could go out under two different IDs. One flow value run twice, or put in two branches of a `Parallel`, mixed its runs the same way. Each `Retry` attempt, each run and each branch now builds the flow afresh, so every Command in it gets the same values, and the first takes over the body that ran as the flow was built, so a single run still runs the body once. A flow a test walked before running it is built afresh too. Getting such a value from a Command is still the way to replay it.
|
|
26
|
+
- **A long loop in a generator flow no longer holds every earlier result.** Each step kept the answers before it, so the body could be run again, and a loop over 2,000 pages of 10,000 items held about 160 MB at its last page. Now that running a flow again builds it again, a run keeps only the answer it is on, as a pipeline does; a body a test walks keeps its answers, as walking a second branch needs them. An `onBeforeCommand` hook that answers the Command it was handed, by calling its `next`, now makes the run reject with an `EffectTypeError` when the interpreter reaches that step's answer, since the run keeps no earlier answers to run the body again with.
|
|
27
|
+
- **TypeScript: a step's `type` is `'Command' | 'Parallel'`, a `Parallel`'s `options` are always present, and `timeTravel`'s options are the named `TimeTravelOptions`.** An `onStep` hook and a `Resolver` can switch on the step's type, and a hook that declares it a plain `string` still fits.
|
|
4
28
|
|
|
5
29
|
## [0.19.0] - 2026-10-11
|
|
6
30
|
|
|
@@ -269,6 +293,8 @@ All notable changes to pure-effect are recorded here. The format follows [Keep a
|
|
|
269
293
|
|
|
270
294
|
- Initial release: `Success`, `Failure`, `Command`, `effectPipe`, and `runEffect`.
|
|
271
295
|
|
|
296
|
+
[0.20.1]: https://github.com/aycangulez/pure-effect/compare/v0.20.0...v0.20.1
|
|
297
|
+
[0.20.0]: https://github.com/aycangulez/pure-effect/compare/v0.19.0...v0.20.0
|
|
272
298
|
[0.19.0]: https://github.com/aycangulez/pure-effect/compare/v0.18.0...v0.19.0
|
|
273
299
|
[0.18.0]: https://github.com/aycangulez/pure-effect/compare/v0.17.0...v0.18.0
|
|
274
300
|
[0.17.0]: https://github.com/aycangulez/pure-effect/compare/v0.16.0...v0.17.0
|