Repository navigation
v0.1.0-beta.5
Pre-release
Pre-release
·
27 commits
to main
since this release
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.