Repository navigation
Releases
v0.1.0
The fourth release, the first that is not a pre-release, published under the dist-tag latest: specification 0.1.0, tier 1, capabilities async, testing and value-conversions, cases v0.1.0. It does not break code written for 0.1.0-beta.7, and holds the same code: the cases v0.1.0 are those of v0.1.0-rc.20, which 0.1.0-beta.7 passes. What a journey does is unchanged. It runs on Node 22.12 and later, and applications compile it with TypeScript 5.5 or later.
v0.1.0-beta.7
The third 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.20. It does not break code written for 0.1.0-beta.6. It follows two corrections of the specification that the cases v0.1.0-rc.19 and v0.1.0-rc.20 carry: an input adapter that runs in an execution mode the executor does not accept is mode not accepted, which changes nothing here, since the one executor accepts synchronous and asynchronous input adapters alike, and a scripted run needs no attempt after a rescue step scripted to fail or to end in an abnormal termination. What a journey does is unchanged. It runs on Node 22.12 and later, and applications compile it with TypeScript 5.5 or later.
Fixed
runof a script fromscriptedinitinera/testingno longer stops the test for the attempt after a rescued step's attempt 1 when its rescue step is scripted to fail or end in an abnormal termination, an attempt that never runs.
v0.1.0-beta.6
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.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".
v0.1.0-beta.5
The first 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.16. Its version matches that of itinera-rs, whose 0.1.0-beta.5 passes the same cases. It runs on Node 22.12 and later, and applications compile it with TypeScript 5.5 or later.
Added
- Each concept imported from a subpath of its own, such as
itinera/steporitinera/workflow, withimportandrequirealike; the package root exports nothing of its own, anditinera/unstable, for API that may still change, is empty. - Steps, classes extending
Stepand marked with@step, that request what they need, such as inputs from the data bag with@input, a contributor or a service, and end with an outcome:this.succeed(),this.fail(...)orthis.skip(). Only an attempt that succeeds commits its contributions to the data bag of values. A retry budget alone decides whether a failed or abnormally terminated attempt is tried again; a step declared withnoRetryOnAbnormalTerminationis not retried after an abnormal termination. - Workflows, classes extending
Workflow, marked with@workflowand listing their steps with@withStep, and made withOrders.build(...); or put together without decorators withOrders.builder(), for compilers that record no decorator metadata. A workflow that breaks a rule of the specification throwsViolations, andlisting()lists its steps, each with its policies, input adapter, services and rescue step. Workflow descriptors, step descriptors and instances are sealed: only itinera makes them, so one written by hand does not compile, andrunrejects with aTypeErroran instance that a cast lets through. - Step and workflow policies, with every hook kind, its requests and the lifecycles it returns, and roles the workflow implements; input adapters, methods of the workflow marked with
@inputAdapter, which supply a step's input from the data bag. - Rescue steps: a step may have a rescue step, which runs when the step fails or terminates abnormally and, once it succeeds, lets the step run again. Input adapters and service providers are attached to it by the name
<step name>_rescue. - Services that steps request by key and by a service type made with
serviceType, made by service providers, methods of the workflow marked with@provider, for the journey or for each attempt, and attached to chosen steps, or to none, serving every step that requests their key and has no provider of its own; a provider returns its service made withthis.provide(...), which names the implementation on theservice_providedevent. - Workflow instances with their initial data, journey IDs, made by a method marked with
@idGeneratoror as a random UUID, and global metadata, andLocalExecutor, whoserunresolves to the journey's result, withoutput(...)reading its data bag, or rejects with aRefusalbefore any journey. - Values, the only data a journey holds, checked by type tokens built on Zod, such as
string,integer,listOf(...)andclassOf(...); an application's own Zod schemas, throughzfromitinera/schema, and other Standard Schema validators also serve as tokens, andoptional(...)requests a value that may be absent, as anOption,SomeorNonefromitinera/option. A class becomes a value throughtoValue()and comes back throughfromValue, and a conversion that fails meanswrong typeornot a value, as the specification says. - Events, reporters, dispatchers and their factories, with
DefaultDispatcher, andDebugReporter, which prints every event. Global metadata: entries of a key and a value, apart from the data bag, that every reporter receives as soon as each one is set, starting with the journey ID; steps, hooks and service providers set entries withsetGlobalMetadata. - Test support, from
itinera/testing:RecordingReporter, which keeps every event and the latest value of each entry of global metadata, and whosepathlists the flow a journey took;fakeProvider, which puts a fake in place of a service provider for one instance; scripted runs, which play what named steps' attempts do without their business rules; recorders that lend a step, a hook or an input adapter its handles outside any journey; and mocks of steps, rescue steps and policies. - Compile errors, instead of checks while a journey runs, for the rules the specification lets an implementation make impossible to express: a lifecycle a hook may not return, a policy whose role the workflow does not implement, a rescue step that skips, a service provider returning what
this.provide(...)does not make, and an input adapter writing to the data bag. Steps, rescue steps and policies keep no static data, refused at compile time where TypeScript can and when they are declared otherwise.