@adcp/sdk API Reference - v14.0.0-beta.6
    Preparing search index...

    Function adaptPackageRequestForV2

    • Adapt a v3-style package request for a v2 server. Converts creative_assignments to creative_ids (dropping weight and placement_ids). Strips v3-only package fields (optimization_goals, catalogs).

      When ctx is provided and the input has no buyer_ref, derives one from — in order — package.context.buyer_ref, package.idempotency_key, or ${ctx.parentBuyerRef}-${ctx.index} so v2.5 package-request validation passes. Caller-supplied top-level buyer_ref always wins. The context.buyer_ref fallback exists because v3 callers put their per-package correlation ref in context.buyer_ref (per the 3.0 package schema); this adapter is the only place that promotes it back to the top-level shape v2.5 sellers still expect.

      Parameters

      • pkg: PackageRequestV3
      • Optionalctx: PackageAdapterContext

      Returns PackageRequestV2