Repository navigation
v0.1.0-beta.6
Pre-releaseThe 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.UnexpectedResultinitinera/journey, the abort reasonunexpected result, never retried.UnexpectedResultinitinera/event, the abort for custom code that returned what its call cannot return, naming the code and carrying amessagesaying what it returned.ByProviderForKeyandByPolicyinitinera/event, the sources of anUnexpectedResultreturned by a service provider or by a step policy's constructor.UnexpectedResultReturnedinitinera/executor, the refusal ofrunwhen 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
runthat returns what is not an outcome aborts the journey withunexpected 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 withunexpected result, instead of keeping the default or aborting it withinvalid lifecycle. JourneyAbortinitinera/eventgainsUnexpectedResult, andRefusedinitinera/executorgainsUnexpectedResultReturned, so an exhaustive match over either needs a case for it.InvalidLifecycle.stepinitinera/eventis 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
undefinedaborted the journey withinvalid 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 ofstep 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
instanceofsays, aborts the journey withunexpected 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
runwithunexpected result, instead ofrunbeing refused later withdispatcher failedorglobal metadata not set, or the journey aborting withreporter failed. instance()throws aTypeErrorwhen the ID generator returns an empty string, and the message of thatTypeErrorfor an ID that is not a string now ends "not a journey ID".