What this version supports
What the itinera this book covers implements, how you can check it, and what comes next. The specification defines what each version of Itinera means; the conformance report of itinera says which parts of it the package passes.
The specification
This book follows specification 0.1, the first version of the Itinera specification. It defines tier 1, a single workflow:
- steps, their inputs, their outcomes and their abnormal terminations;
- services, and the service providers that supply them to steps;
- the data bag, contributions and values;
- retry budgets, and whether an abnormal termination may be retried;
- rescue steps;
- step policies and workflow policies, their hooks and the lifecycles they return;
- workflow roles and input adapters;
- workflow instances, journey IDs and the result;
- events, reporters, dispatchers and dispatcher factories, and global metadata;
- admission, violations and refusals;
- the local executor, and the execution modes.
Each part of the specification is written from accepted proposals, listed at the top of each of its chapters, and is checked by the conformance cases, a set of scenarios every implementation runs. The cases of tier 1 were released as candidates until an implementation first passed every one of them, and are now tagged v0.1.0, like the specification.
The itinera this book covers
This book covers itinera 0.1.0, the fourth release and the first that is not a pre-release, published on npm under the tag latest and built from its repository at the tag v0.1.0, and every example you read here compiles and runs against it. It passes every proposal of tier 1, with the capabilities test support and value conversions.
Capabilities
A tier says what Itinera means; capabilities say what an executor accepts, and what else a language offers. itinera claims three:
async: its one executor,LocalExecutor, runs journeys asynchronously, sorunalways returns a promise. It accepts steps and hooks of either execution mode, and waits for whichever it gets, as chapter 26 shows, and reporters too, as chapter 31 does. It doesn't claimsync, an executor that runs a journey without a promise, since JavaScript can't wait for a promise synchronously.testing: test support, fromitinera/testing, as chapters 27 to 30 show.value-conversions: an object of one of your own classes can be given wherever a value is, such as a contribution to the data bag.itineracalls the object'stoValue()to turn it into a value, and the class's staticfromValueto turn the value back into an object when it is read. A conversion that fails while a value is read makes it of the wrong type, and one that fails while a value is captured makes it not a value, as the specification says.
The conformance report
The report of itinera is conformance.json, in its repository. It says which version of the conformance cases the package runs, the proposals whose cases all pass, the capabilities it claims, and the rules it makes impossible to write. In 0.1.0, it runs the conformance cases v0.1.0, and lists all 40 proposals of tier 1 of specification 0.1 as passing, including those of test support and value conversions.
A rule the specification lets a language make impossible, such as a policy attached to a workflow that doesn't provide its role, isn't run as a case in TypeScript. Instead, a type test of the package proves that the mistake doesn't compile, as chapter 37 shows. The report lists these rules as impossible to write in TypeScript, each with the type tests that prove it:
- a lifecycle a hook may not return (
invalid-lifecycle); - a policy needing a role the workflow doesn't provide (
role-not-provided); - a write through an input adapter's access to the data bag (
bag-write); - a rescue step that skips (
rescue-skip); - a service provider that returns no service (
no-instance); - your code returning what its call can't return, such as a step's
runthat returns no outcome or a step hook that returnsundefined(unexpected-result); - an ID generator that returns something that isn't a string (
non-string-journey-id).
The specification lets a language make a few more rules impossible, which TypeScript's types can't rule out in every case: something stored that is not a value, for one, since a type can't refuse every value that isn't one. itinera checks those while the program runs, and their cases run like any other, except for an executor that refuses an execution mode, which doesn't arise, since LocalExecutor accepts both.
What later tiers add
Each tier includes everything before it. Later tiers will add, once their proposals are accepted:
- Tier 2: moving a journey to another workflow, with or without its data.
- Tier 3: running a workflow from inside another.
- Durable runs: journeys that survive a crash and resume, with their state kept in a store.
Each will add a part to this book, in the same style, once itinera implements it.