Skip to content

API reference > @kontsedal/olas-core > MutationEvent

MutationEvent type ​

One step of a mutation run. Every run emits 'start' (after onMutate, before the first mutate call) and then exactly one of 'success','error' (retries exhausted) or 'cancel' (a supersede, reset(), or the owner's disposal; reason says which).

A serial run that has to wait behind another emits 'queued' first, whenrun(...) is called, under the runId it keeps. It then emits 'start' when its turn comes. A queued run that never starts still emits exactly one outcome: 'cancel' when reset() or the owner's disposal drops it, or'error' when its onMutate throws.

Signature:

typescript
type MutationEvent = {
  readonly mutation: MutationRef;
  readonly runId: string;
  readonly variables: unknown;
  readonly phase: 'queued' | 'start' | 'success' | 'error' | 'cancel';
  readonly result?: unknown;
  readonly error?: unknown;
  readonly reason?: 'superseded' | 'reset' | 'dispose';
  readonly origin: string | undefined;
};

References: MutationRef

Released under the MIT License.