Repository navigation
1.5 has three parts:
withUnitOfWork. Saves from several usecases commit together, or not at all.- swift-kurrentdb 3.0. The minimum is now 3.0.0.
- Fixes for link streams and the generator. A read skips links whose event is gone, and an unknown key in
projection-model.yamlfails the build.
Upgrading from 1.4? Read the 1.4 → 1.5 migration guide. Several behaviour changes are not flagged by the compiler. The guide also has a machine-readable manifest for AI agents. MIGRATION.md has the same steps as text.
Highlights
withUnitOfWork
- Every
repository.saveinsidewithUnitOfWork { work in … }is collected and written when the block returns. A block that throws writes nothing. work.onCommitted { … }runs hooks after a successful commit; use it to publish events.- Existing usecases, repositories and generated code take part unchanged.
KurrentStorageCoordinatortakes part.InMemoryEventStoreandPersistentEventStoredo not: asaveto them inside a block is refused.- A commit of two or more streams uses KurrentDB's
AppendRecordsand needs KurrentDB 26.1 or later. - Writes commit together only through the same
KurrentDBClientinstance.
See Compose Usecases with withUnitOfWork in the README.
swift-kurrentdb 3.0
- Reads are lazy: a
findorfetchEventswhose task is cancelled midway throwsCancellationError. - swift-kurrentdb has its own
CustomMetadata. In a file that importsKurrentDB, writeEventSourcing.CustomMetadata.
Link streams
LiveEventStoreClient.readStream skips a link whose event is gone (source stream deleted, tombstoned, truncated or scavenged) and logs a warning. Before, one such link failed the whole read, so a linkTo read model stream could not be read.
Generator
An unknown key in projection-model.yaml, or a file that does not decode, fails the build. The error names the model, the key and the known keys. Before, the key was ignored and its events were missing from the generated code.
Projector
EventSourcingProjector.execute(input:) logs a warning when it returns nil because buildReadModel or apply threw.
Source-breaking
EventStoreClient.identityhas no default: custom conformances and wrappers must implement it, and forwardappendAtomically(_:).EventStoreClientErrorhas new cases:consistencyViolations,atomicAppendUnsupported.- A direct swift-kurrentdb requirement must be
3.0.0or later. - A bare
CustomMetadatanext toimport KurrentDBis ambiguous. - An unknown key in
projection-model.yamlfails the build.