@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Function assertMediaBuyTransition

    • Throws an AdcpError with the spec-correct error code for an illegal MediaBuyStatus transition.

      Code selection per compliance/cache/<version>/protocols/media-buy/state-machine.yaml: "The cancellation-specific code takes precedence over the generic INVALID_STATE when the attempted action is cancel; non-cancel actions targeting or out of terminal states still return INVALID_STATE."

      • Any illegal transition where to === 'canceled' (i.e. the buyer was attempting a cancel that the current state forbids — completed → canceled, rejected → canceled, the double-cancel idempotency canceled → canceled): NOT_CANCELLABLE.
      • Any other illegal edge (terminal-state escapes like canceled → paused, completed → active, lifecycle skips): INVALID_STATE.

      Both codes carry recovery: 'correctable' per the manifest in STANDARD_ERROR_CODES — the buyer can adjust their request (re-fetch current state, choose a different action) rather than escalating.

      Parameters

      Returns void