Skip to content

Recipes

Each recipe is one complete workflow or hooks file and its test. Copy both into your project, run the test, then adapt the file to your system. The host deploys the default export of each workflow file, one Workflow Definition per file.

Set up your project once as described in Test workflows: the @identity-flow/* packages, workflow-test.setup.ts, and a vitest.config.ts whose include covers both **/*.case.ts and **/*.test.ts. You also need the Workflow Test distribution of your release, and Docker must be running.

Save each recipe’s two files next to each other in that project, under the names the recipe gives. Each test imports its file by that name. Then run the tests from your project directory:

Terminal window
# Run from your project directory. Use the folder where you unpacked the
# Workflow Test distribution of your release and platform.
/opt/identity-flow/identity-flow-test-v0.3.0-linux-x64/identity-flow-test --run

This runs every test file the configuration includes. Two kinds of test appear on these pages:

  • Workflow Tests, in files ending in .case.ts, start a real instance against PostgreSQL. They run only with the Workflow Test distribution.
  • Hook tests, in files ending in .test.ts, load a hooks file into an in-memory host with no engine and no database. Only Map a login to principals has one.

Type-check with npx tsc --noEmit as well. Vitest does not check types, so a @ts-expect-error line or a changed interface fails only in the type check.

Several recipes depend on replay: when an instance continues, IdentityFlow runs the workflow function again from the top and returns each finished step’s recorded result instead of running the step again.

The company in the examples is invented. acme is the provider ID, employee IDs look like e-2041, and principal subjects look like role:vacation-approver. Replace them with your own.

Every code block on these pages is a file in the IdentityFlow repository. IdentityFlow’s continuous integration compiles each file, runs the Workflow Tests against PostgreSQL 17 and 18 and the hook test under plain Vitest, so the retry counts, canceled steps and refused answers shown here are what IdentityFlow does.