Skip to content

v0.1.0-beta.6

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 27 Oct 16:53
· 19 commits to main since this release
b7eb2fd

The second release, a beta, published under the dist-tag next: specification 0.1.0, tier 1, capabilities async, testing and value-conversions, cases v0.1.0-rc.18. It breaks code written for 0.1.0-beta.5. It implements proposal 0121, which says that a copy made to keep received data read-only is not a value conversion, and which changes nothing itinera does, and proposal 0122, on custom code that returns what its call cannot return, which now aborts the journey with unexpected result, or refuses run. TypeScript's types already refuse every such result where no cast hides it, so the scenarios tagged unexpected-result and non-string-journey-id are claimed impossible to express, each with a proof. It runs on Node 22.12 and later, and applications compile it with TypeScript 5.5 or later.

Added

  • AbortReason.UnexpectedResult in itinera/journey, the abort reason unexpected result, never retried.
  • UnexpectedResult in itinera/event, the abort for custom code that returned what its call cannot return, naming the code and carrying a message saying what it returned.
  • ByProviderForKey and ByPolicy in itinera/event, the sources of an UnexpectedResult returned by a service provider or by a step policy's constructor.
  • UnexpectedResultReturned in itinera/executor, the refusal of run when the dispatcher factory returns what is not a dispatcher, or a workflow policy's constructor another object.

Changed

  • A step's or rescue step's run that returns what is not an outcome aborts the journey with unexpected result, never retried, instead of ending in an abnormal termination.
  • A step hook that returns undefined, or anything else that is not a lifecycle, aborts the journey with unexpected result, instead of keeping the default or aborting it with invalid lifecycle.
  • JourneyAbort in itinera/event gains UnexpectedResult, and Refused in itinera/executor gains UnexpectedResultReturned, so an exhaustive match over either needs a case for it.
  • InvalidLifecycle.step in itinera/event is always there, since only a step hook's lifecycle is read.
  • What a workflow hook returns, or what its promise resolves to, is never read, where anything but undefined aborted the journey with invalid lifecycle.
  • An input adapter or a service provider that returns what its helpers did not make aborts the journey with unexpected result, with no adapter or provider event, instead of step could not be built.
  • The constructor of a step, a rescue step or a step policy that returns an object that is not a step, a rescue step or a step policy, as instanceof says, aborts the journey with unexpected result, where a step's or rescue step's ended its attempt in an abnormal termination.
  • A dispatcher factory that returns what is not a dispatcher refuses run with unexpected result, instead of run being refused later with dispatcher failed or global metadata not set, or the journey aborting with reporter failed.
  • instance() throws a TypeError when the ID generator returns an empty string, and the message of that TypeError for an ID that is not a string now ends "not a journey ID".