Skip to content

API reference > @kontsedal/olas-core > DebugEventBody

DebugEventBody type ​

The set of event bodies emitted by a root. DebugEvent layersDebugEventMeta onto each (see below). Spec §14. Adding new variants is non-breaking — consumers switch on type and ignore unknowns.

Signature:

typescript
type DebugEventBody = {
  type: 'controller:constructed';
  path: readonly string[];
  props: unknown;
  debug?: Record<string, unknown>;
} | {
  type: 'controller:suspended';
  path: readonly string[];
} | {
  type: 'controller:resumed';
  path: readonly string[];
} | {
  type: 'controller:disposed';
  path: readonly string[];
} |
/**
 * A `ctx.debug({...})` call AFTER construction (e.g. from an effect) —
 * carries the controller's full merged debug record (live references).
 */
{
  type: 'controller:debug';
  path: readonly string[];
  values: Record<string, unknown>;
} |
/**
 * A `createQuery` subscription bound an entry: on subscribe, on a key change
 * and on resume. `subscriberPath` is the subscribing controller's path. One
 * event per subscription, so the entry's subscriber count is the number of
 * these minus the matching `cache:unsubscribed` events.
 */
{
  type: 'cache:subscribed';
  queryId?: string;
  queryKey: readonly unknown[];
  subscriberPath: readonly string[];
} |
/**
 * A subscription let go of an entry: on dispose, a key change, a disable and
 * suspend. The counterpart of `cache:subscribed`, with the same path.
 */
{
  type: 'cache:unsubscribed';
  queryId?: string;
  queryKey: readonly unknown[];
  subscriberPath: readonly string[];
} | {
  type: 'cache:fetch-start';
  queryId?: string;
  queryKey: readonly unknown[];
} | {
  type: 'cache:fetch-success';
  queryId?: string;
  queryKey: readonly unknown[];
  durationMs: number;
} | {
  type: 'cache:fetch-error';
  queryId?: string;
  queryKey: readonly unknown[];
  error: unknown;
  durationMs: number;
} |
/**
 * A value was written to a cache entry. `data` is the post-write value —
 * carried so the devtools cache inspector and timeline diff show *current*
 * data without polling. `source` is the plugins' `WriteSource` vocabulary:
 * `'fetch'`, `'hydrate'`, `'optimistic'`, `'rollback'`, `'commit'`,
 * `'write'`, `'replace'`.
 */
{
  type: 'cache:set-data';
  queryId?: string;
  queryKey: readonly unknown[];
  source: WriteSource;
  data: unknown;
} | {
  type: 'cache:invalidated';
  queryId?: string;
  queryKey: readonly unknown[];
} | {
  type: 'cache:gc';
  queryId?: string;
  queryKey: readonly unknown[];
} |
/** An optimistic snapshot layer was pushed onto an entry (`setData` with tracking). */
{
  type: 'snapshot:push';
  queryKey: readonly unknown[];
} |
/** An optimistic snapshot layer was rolled back (mutation error / supersede). */
{
  type: 'snapshot:rollback';
  queryKey: readonly unknown[];
} |
/** An optimistic snapshot layer was committed (mutation success). */
{
  type: 'snapshot:finalize';
  queryKey: readonly unknown[];
} |
/**
 * The mutation lifecycle. `id` is the mutation's `id`, absent for an inline
 * `createMutation` spec that has none. Each event carries the run id as its
 * `causeId`.
 */
{
  type: 'mutation:run';
  path: readonly string[];
  id?: string;
  vars: unknown;
} | {
  type: 'mutation:success';
  path: readonly string[];
  id?: string;
  result: unknown;
} | {
  type: 'mutation:error';
  path: readonly string[];
  id?: string;
  error: unknown;
} | {
  type: 'mutation:rollback';
  path: readonly string[];
  id?: string;
} |
/**
 * A run was cancelled, and it will send no `mutation:success` or
 * `mutation:error`. Sent for every run whose plugin event is `'cancel'`,
 * with the same `reason`: `'superseded'` (a newer `latest-wins` run),
 * `'reset'` (`mutation.reset()`) or `'dispose'` (the owning controller was
 * disposed). A queued `serial` run that never started sends one too, with
 * no `mutation:run` before it.
 */
{
  type: 'mutation:cancel';
  path: readonly string[];
  id?: string;
  reason: 'superseded' | 'reset' | 'dispose';
} | {
  type: 'field:validated';
  path: readonly string[];
  field: string;
  valid: boolean;
  errors: string[];
} |
/** A plugin published `payload` on its lane through `host.debug(...)`. */
{
  type: 'plugin:event';
  plugin: string;
  payload: unknown;
};

References: WriteSource

Released under the MIT License.