openmixer — generated API reference
    Preparing search index...

    Class BlockLibrary

    In-memory store for blocks, keyed by ${level}/${name}.

    Every boundary deep-clones: save stores a private copy of the data and every read (save's return value, get, list, byTag, toJSON) returns fresh clones, so callers can never mutate the stored blocks.

    Index
    • All blocks carrying the given tag, in insertion order.

      Parameters

      • tag: string

      Returns Block<unknown>[]

      Deep clones of the matching blocks.

    • Look up a block by level and name.

      Parameters

      • level: "chain" | "strip" | "processor" | "console"
      • name: string

      Returns Block<unknown> | undefined

      A deep clone of the block, or undefined when absent.

    • All blocks (optionally filtered by level), sorted by name then level.

      Parameters

      • Optionallevel: "chain" | "strip" | "processor" | "console"

      Returns Block<unknown>[]

      Deep clones of the matching blocks.

    • Remove a block by level and name.

      Parameters

      • level: "chain" | "strip" | "processor" | "console"
      • name: string

      Returns boolean

      True when a block was removed.

    • Save a block, overwriting any existing block with the same key. data must be structured-cloneable (plain JSON-ish values).

      Type Parameters

      • T

      Parameters

      • name: string
      • level: "chain" | "strip" | "processor" | "console"
      • data: T
      • Optionaltags: readonly string[]

      Returns Block<T>

      A clone of the saved block, stamped with createdAt.

    • Serialize the library to a plain block array (used by JSON.stringify).

      Returns Block<unknown>[]

      Deep clones of all blocks, in insertion order.

    • Rehydrate a library from a serialized block array (e.g. JSON.parse output). Validates every entry — invalid input throws an Error whose message names the offending path, like blocks[2].level. Duplicate keys resolve last-wins, matching save overwrite semantics.

      Parameters

      • json: unknown

      Returns BlockLibrary