@adcp/sdk 16.0.0-beta.8 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +5 -2
  3. package/bin/adcp.js +10 -13
  4. package/dist/lib/core/AgentClient.d.mts +8 -5
  5. package/dist/lib/core/AgentClient.d.ts +8 -5
  6. package/dist/lib/core/AgentClient.js +9 -4
  7. package/dist/lib/core/AgentClient.mjs +9 -4
  8. package/dist/lib/core/SingleAgentClient.d.mts +19 -112
  9. package/dist/lib/core/SingleAgentClient.d.ts +19 -112
  10. package/dist/lib/core/SingleAgentClient.js +270 -252
  11. package/dist/lib/core/SingleAgentClient.mjs +275 -253
  12. package/dist/lib/core/TaskExecutor.d.mts +1 -16
  13. package/dist/lib/core/TaskExecutor.d.ts +1 -16
  14. package/dist/lib/core/TaskExecutor.js +34 -51
  15. package/dist/lib/core/TaskExecutor.mjs +12 -29
  16. package/dist/lib/core/product-cache.d.mts +3 -1
  17. package/dist/lib/core/product-cache.d.ts +3 -1
  18. package/dist/lib/core/product-cache.js +2 -1
  19. package/dist/lib/core/product-cache.mjs +2 -1
  20. package/dist/lib/errors/index.d.mts +2 -8
  21. package/dist/lib/errors/index.d.ts +2 -8
  22. package/dist/lib/errors/index.js +4 -4
  23. package/dist/lib/errors/index.mjs +4 -4
  24. package/dist/lib/identity-3.3/revocation.js +6 -7
  25. package/dist/lib/identity-3.3/revocation.mjs +6 -7
  26. package/dist/lib/index.d.mts +4 -4
  27. package/dist/lib/index.d.ts +4 -4
  28. package/dist/lib/index.js +0 -14
  29. package/dist/lib/index.mjs +0 -14
  30. package/dist/lib/media-buy/compatibility.d.mts +1 -1
  31. package/dist/lib/media-buy/compatibility.d.ts +1 -1
  32. package/dist/lib/media-buy/compatibility.js +26 -45
  33. package/dist/lib/media-buy/compatibility.mjs +26 -45
  34. package/dist/lib/media-buy/legacy-purchase-continuation.d.mts +2 -2
  35. package/dist/lib/media-buy/legacy-purchase-continuation.d.ts +2 -2
  36. package/dist/lib/protocols/index.js +14 -22
  37. package/dist/lib/protocols/index.mjs +5 -13
  38. package/dist/lib/registry/types.d.mts +3 -2
  39. package/dist/lib/registry/types.d.ts +3 -2
  40. package/dist/lib/registry/types.generated.d.mts +51 -11
  41. package/dist/lib/registry/types.generated.d.ts +51 -11
  42. package/dist/lib/reporting/source/conformance.d.mts +8 -8
  43. package/dist/lib/reporting/source/conformance.d.ts +8 -8
  44. package/dist/lib/reporting/source/manifest.d.mts +27 -27
  45. package/dist/lib/reporting/source/manifest.d.ts +27 -27
  46. package/dist/lib/server/create-adcp-server.js +7 -1
  47. package/dist/lib/server/create-adcp-server.mjs +7 -1
  48. package/dist/lib/signing/crypto.d.mts +1 -1
  49. package/dist/lib/signing/crypto.d.ts +1 -1
  50. package/dist/lib/signing/crypto.js +2 -45
  51. package/dist/lib/signing/crypto.mjs +2 -46
  52. package/dist/lib/signing/web-bot-auth.d.mts +18 -10
  53. package/dist/lib/signing/web-bot-auth.d.ts +18 -10
  54. package/dist/lib/signing/web-bot-auth.js +29 -24
  55. package/dist/lib/signing/web-bot-auth.mjs +29 -24
  56. package/dist/lib/testing/compliance/comply.js +0 -8
  57. package/dist/lib/testing/compliance/comply.mjs +0 -8
  58. package/dist/lib/testing/compliance/storyboard-tracks.js +11 -0
  59. package/dist/lib/testing/compliance/storyboard-tracks.mjs +11 -0
  60. package/dist/lib/testing/index.d.mts +2 -0
  61. package/dist/lib/testing/index.d.ts +2 -0
  62. package/dist/lib/testing/index.js +5 -0
  63. package/dist/lib/testing/index.mjs +3 -0
  64. package/dist/lib/testing/scenarios/capabilities.d.mts +2 -2
  65. package/dist/lib/testing/scenarios/capabilities.d.ts +2 -2
  66. package/dist/lib/testing/scenarios/capabilities.js +8 -41
  67. package/dist/lib/testing/scenarios/capabilities.mjs +9 -42
  68. package/dist/lib/testing/storyboard/creative-build-probe.d.mts +34 -0
  69. package/dist/lib/testing/storyboard/creative-build-probe.d.ts +34 -0
  70. package/dist/lib/testing/storyboard/creative-build-probe.js +395 -0
  71. package/dist/lib/testing/storyboard/creative-build-probe.mjs +373 -0
  72. package/dist/lib/testing/storyboard/index.d.mts +2 -0
  73. package/dist/lib/testing/storyboard/index.d.ts +2 -0
  74. package/dist/lib/testing/storyboard/index.js +5 -0
  75. package/dist/lib/testing/storyboard/index.mjs +3 -0
  76. package/dist/lib/testing/storyboard/loader.js +12 -0
  77. package/dist/lib/testing/storyboard/loader.mjs +12 -0
  78. package/dist/lib/testing/storyboard/property-list-reference.d.mts +15 -0
  79. package/dist/lib/testing/storyboard/property-list-reference.d.ts +15 -0
  80. package/dist/lib/testing/storyboard/property-list-reference.js +514 -0
  81. package/dist/lib/testing/storyboard/property-list-reference.mjs +487 -0
  82. package/dist/lib/testing/storyboard/runner.js +318 -58
  83. package/dist/lib/testing/storyboard/runner.mjs +322 -58
  84. package/dist/lib/testing/storyboard/types.d.mts +38 -16
  85. package/dist/lib/testing/storyboard/types.d.ts +38 -16
  86. package/dist/lib/testing/storyboard/types.js +1 -0
  87. package/dist/lib/testing/storyboard/types.mjs +1 -0
  88. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  89. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  90. package/dist/lib/testing/storyboard/validations.js +64 -0
  91. package/dist/lib/testing/storyboard/validations.mjs +67 -1
  92. package/dist/lib/testing/types.d.mts +15 -1
  93. package/dist/lib/testing/types.d.ts +15 -1
  94. package/dist/lib/types/schemas.generated.d.ts +65 -65
  95. package/dist/lib/types/wellknown-schemas.generated.d.mts +21 -21
  96. package/dist/lib/types/wellknown-schemas.generated.d.ts +21 -21
  97. package/dist/lib/utils/adcp-version-config.js +6 -0
  98. package/dist/lib/utils/adcp-version-config.mjs +6 -0
  99. package/dist/lib/utils/capabilities.d.mts +7 -9
  100. package/dist/lib/utils/capabilities.d.ts +7 -9
  101. package/dist/lib/utils/capabilities.js +14 -28
  102. package/dist/lib/utils/capabilities.mjs +14 -27
  103. package/dist/lib/utils/creative-adapter.d.mts +15 -113
  104. package/dist/lib/utils/creative-adapter.d.ts +15 -113
  105. package/dist/lib/utils/creative-adapter.js +7 -106
  106. package/dist/lib/utils/creative-adapter.mjs +7 -102
  107. package/dist/lib/utils/format-renders.d.mts +20 -80
  108. package/dist/lib/utils/format-renders.d.ts +20 -80
  109. package/dist/lib/utils/format-renders.js +7 -67
  110. package/dist/lib/utils/format-renders.mjs +7 -66
  111. package/dist/lib/utils/index.d.mts +1 -2
  112. package/dist/lib/utils/index.d.ts +1 -2
  113. package/dist/lib/utils/index.js +0 -7
  114. package/dist/lib/utils/index.mjs +0 -6
  115. package/dist/lib/utils/preview-normalizer.d.mts +31 -80
  116. package/dist/lib/utils/preview-normalizer.d.ts +31 -80
  117. package/dist/lib/utils/preview-normalizer.js +5 -50
  118. package/dist/lib/utils/preview-normalizer.mjs +5 -49
  119. package/dist/lib/utils/pricing-adapter.d.mts +2 -36
  120. package/dist/lib/utils/pricing-adapter.d.ts +2 -36
  121. package/dist/lib/utils/pricing-adapter.js +0 -105
  122. package/dist/lib/utils/pricing-adapter.mjs +0 -100
  123. package/dist/lib/utils/request-normalizer.d.mts +1 -2
  124. package/dist/lib/utils/request-normalizer.d.ts +1 -2
  125. package/dist/lib/v2/projection/catalog.d.mts +4 -0
  126. package/dist/lib/v2/projection/catalog.d.ts +4 -0
  127. package/dist/lib/v2/projection/creative-delivery.d.mts +17 -9
  128. package/dist/lib/v2/projection/creative-delivery.d.ts +17 -9
  129. package/dist/lib/v2/projection/creative-delivery.js +78 -10
  130. package/dist/lib/v2/projection/creative-delivery.mjs +77 -10
  131. package/dist/lib/v2/projection/legacy-metadata.d.mts +12 -0
  132. package/dist/lib/v2/projection/legacy-metadata.d.ts +12 -0
  133. package/dist/lib/v2/projection/legacy-metadata.js +41 -1
  134. package/dist/lib/v2/projection/legacy-metadata.mjs +37 -1
  135. package/dist/lib/v2/projection/legacy-normalization.d.mts +1 -1
  136. package/dist/lib/v2/projection/legacy-normalization.d.ts +1 -1
  137. package/dist/lib/v2/projection/v1-to-v2.js +13 -0
  138. package/dist/lib/v2/projection/v1-to-v2.mjs +14 -0
  139. package/dist/lib/validation/client-hooks.d.mts +1 -4
  140. package/dist/lib/validation/client-hooks.d.ts +1 -4
  141. package/dist/lib/validation/get-products-request.d.mts +1 -1
  142. package/dist/lib/validation/get-products-request.d.ts +1 -1
  143. package/dist/lib/validation/schema-loader.js +6 -0
  144. package/dist/lib/validation/schema-loader.mjs +6 -0
  145. package/dist/lib/validation/schema-validator.js +1 -26
  146. package/dist/lib/validation/schema-validator.mjs +1 -26
  147. package/dist/lib/version.d.mts +5 -5
  148. package/dist/lib/version.d.ts +5 -5
  149. package/dist/lib/version.js +3 -5
  150. package/dist/lib/version.mjs +3 -5
  151. package/docs/TYPE-SUMMARY.md +2 -2
  152. package/docs/development/PROTOCOL_DIFFERENCES.md +1 -1
  153. package/docs/guides/CONFORMANCE.md +25 -0
  154. package/docs/guides/CREATIVE-BUILD-PROBE.md +156 -0
  155. package/docs/guides/CREATIVE-DELIVERY.md +63 -7
  156. package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +15 -18
  157. package/docs/guides/REPORTING-STABILITY.md +7 -7
  158. package/docs/guides/VALIDATE-YOUR-AGENT.md +5 -0
  159. package/docs/llms.txt +3 -3
  160. package/docs/migration-13-to-14.md +20 -16
  161. package/docs/migration-14.x-rc-worksheet.md +5 -5
  162. package/docs/migration-4.x-to-5.x.md +12 -7
  163. package/docs/migration-agent-identity-3.3.md +44 -19
  164. package/docs/migration-drop-adcp-2.md +25 -0
  165. package/docs/migration-reporting-storage-package.md +3 -3
  166. package/docs/releases/16.0.0.md +20 -0
  167. package/package.json +3 -18
  168. package/skills/call-adcp-agent/SKILL.md +23 -25
  169. package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.mts +0 -3
  170. package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts +0 -3
  171. package/dist/lib/adapters/legacy/v2-5/create_media_buy.js +0 -33
  172. package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs +0 -9
  173. package/dist/lib/adapters/legacy/v2-5/get_products.d.mts +0 -8
  174. package/dist/lib/adapters/legacy/v2-5/get_products.d.ts +0 -8
  175. package/dist/lib/adapters/legacy/v2-5/get_products.js +0 -33
  176. package/dist/lib/adapters/legacy/v2-5/get_products.mjs +0 -9
  177. package/dist/lib/adapters/legacy/v2-5/index.d.mts +0 -34
  178. package/dist/lib/adapters/legacy/v2-5/index.d.ts +0 -34
  179. package/dist/lib/adapters/legacy/v2-5/index.js +0 -50
  180. package/dist/lib/adapters/legacy/v2-5/index.mjs +0 -25
  181. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.mts +0 -8
  182. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts +0 -8
  183. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js +0 -33
  184. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs +0 -9
  185. package/dist/lib/adapters/legacy/v2-5/preview_creative.d.mts +0 -3
  186. package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts +0 -3
  187. package/dist/lib/adapters/legacy/v2-5/preview_creative.js +0 -33
  188. package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs +0 -9
  189. package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.mts +0 -11
  190. package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +0 -11
  191. package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +0 -32
  192. package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs +0 -8
  193. package/dist/lib/adapters/legacy/v2-5/types.d.mts +0 -39
  194. package/dist/lib/adapters/legacy/v2-5/types.d.ts +0 -39
  195. package/dist/lib/adapters/legacy/v2-5/types.js +0 -16
  196. package/dist/lib/adapters/legacy/v2-5/types.mjs +0 -0
  197. package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.mts +0 -3
  198. package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts +0 -3
  199. package/dist/lib/adapters/legacy/v2-5/update_media_buy.js +0 -35
  200. package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs +0 -11
  201. package/dist/lib/schemas-data/v2.5/_provenance.json +0 -8
  202. package/dist/lib/schemas-data/v2.5/adagents.json +0 -494
  203. package/dist/lib/schemas-data/v2.5/core/activation-key.json +0 -50
  204. package/dist/lib/schemas-data/v2.5/core/assets/audio-asset.json +0 -32
  205. package/dist/lib/schemas-data/v2.5/core/assets/css-asset.json +0 -21
  206. package/dist/lib/schemas-data/v2.5/core/assets/daast-asset.json +0 -87
  207. package/dist/lib/schemas-data/v2.5/core/assets/html-asset.json +0 -21
  208. package/dist/lib/schemas-data/v2.5/core/assets/image-asset.json +0 -38
  209. package/dist/lib/schemas-data/v2.5/core/assets/javascript-asset.json +0 -21
  210. package/dist/lib/schemas-data/v2.5/core/assets/markdown-asset.json +0 -31
  211. package/dist/lib/schemas-data/v2.5/core/assets/text-asset.json +0 -21
  212. package/dist/lib/schemas-data/v2.5/core/assets/url-asset.json +0 -26
  213. package/dist/lib/schemas-data/v2.5/core/assets/vast-asset.json +0 -87
  214. package/dist/lib/schemas-data/v2.5/core/assets/video-asset.json +0 -44
  215. package/dist/lib/schemas-data/v2.5/core/assets/webhook-asset.json +0 -71
  216. package/dist/lib/schemas-data/v2.5/core/async-response-data.json +0 -88
  217. package/dist/lib/schemas-data/v2.5/core/brand-manifest-ref.json +0 -33
  218. package/dist/lib/schemas-data/v2.5/core/brand-manifest.json +0 -409
  219. package/dist/lib/schemas-data/v2.5/core/context.json +0 -8
  220. package/dist/lib/schemas-data/v2.5/core/creative-asset.json +0 -125
  221. package/dist/lib/schemas-data/v2.5/core/creative-assignment.json +0 -31
  222. package/dist/lib/schemas-data/v2.5/core/creative-filters.json +0 -111
  223. package/dist/lib/schemas-data/v2.5/core/creative-manifest.json +0 -72
  224. package/dist/lib/schemas-data/v2.5/core/creative-policy.json +0 -27
  225. package/dist/lib/schemas-data/v2.5/core/delivery-metrics.json +0 -171
  226. package/dist/lib/schemas-data/v2.5/core/deployment.json +0 -93
  227. package/dist/lib/schemas-data/v2.5/core/destination.json +0 -53
  228. package/dist/lib/schemas-data/v2.5/core/error.json +0 -40
  229. package/dist/lib/schemas-data/v2.5/core/ext.json +0 -8
  230. package/dist/lib/schemas-data/v2.5/core/format-id.json +0 -47
  231. package/dist/lib/schemas-data/v2.5/core/format.json +0 -324
  232. package/dist/lib/schemas-data/v2.5/core/frequency-cap.json +0 -18
  233. package/dist/lib/schemas-data/v2.5/core/mcp-webhook-payload.json +0 -152
  234. package/dist/lib/schemas-data/v2.5/core/measurement.json +0 -48
  235. package/dist/lib/schemas-data/v2.5/core/media-buy.json +0 -62
  236. package/dist/lib/schemas-data/v2.5/core/package.json +0 -72
  237. package/dist/lib/schemas-data/v2.5/core/performance-feedback.json +0 -90
  238. package/dist/lib/schemas-data/v2.5/core/placement.json +0 -34
  239. package/dist/lib/schemas-data/v2.5/core/pricing-option.json +0 -35
  240. package/dist/lib/schemas-data/v2.5/core/product-filters.json +0 -102
  241. package/dist/lib/schemas-data/v2.5/core/product.json +0 -153
  242. package/dist/lib/schemas-data/v2.5/core/promoted-offerings.json +0 -115
  243. package/dist/lib/schemas-data/v2.5/core/promoted-products.json +0 -67
  244. package/dist/lib/schemas-data/v2.5/core/property-id.json +0 -14
  245. package/dist/lib/schemas-data/v2.5/core/property-tag.json +0 -16
  246. package/dist/lib/schemas-data/v2.5/core/property.json +0 -62
  247. package/dist/lib/schemas-data/v2.5/core/protocol-envelope.json +0 -146
  248. package/dist/lib/schemas-data/v2.5/core/publisher-property-selector.json +0 -92
  249. package/dist/lib/schemas-data/v2.5/core/push-notification-config.json +0 -48
  250. package/dist/lib/schemas-data/v2.5/core/reporting-capabilities.json +0 -71
  251. package/dist/lib/schemas-data/v2.5/core/response.json +0 -24
  252. package/dist/lib/schemas-data/v2.5/core/signal-filters.json +0 -35
  253. package/dist/lib/schemas-data/v2.5/core/start-timing.json +0 -18
  254. package/dist/lib/schemas-data/v2.5/core/sub-asset.json +0 -79
  255. package/dist/lib/schemas-data/v2.5/core/targeting.json +0 -50
  256. package/dist/lib/schemas-data/v2.5/core/tasks-get-request.json +0 -43
  257. package/dist/lib/schemas-data/v2.5/core/tasks-get-response.json +0 -166
  258. package/dist/lib/schemas-data/v2.5/core/tasks-list-request.json +0 -192
  259. package/dist/lib/schemas-data/v2.5/core/tasks-list-response.json +0 -183
  260. package/dist/lib/schemas-data/v2.5/creative/asset-types/index.json +0 -101
  261. package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-request.json +0 -73
  262. package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-response.json +0 -61
  263. package/dist/lib/schemas-data/v2.5/creative/preview-creative-request.json +0 -164
  264. package/dist/lib/schemas-data/v2.5/creative/preview-creative-response.json +0 -245
  265. package/dist/lib/schemas-data/v2.5/creative/preview-render.json +0 -225
  266. package/dist/lib/schemas-data/v2.5/enums/adcp-domain.json +0 -11
  267. package/dist/lib/schemas-data/v2.5/enums/asset-content-type.json +0 -22
  268. package/dist/lib/schemas-data/v2.5/enums/auth-scheme.json +0 -11
  269. package/dist/lib/schemas-data/v2.5/enums/available-metric.json +0 -18
  270. package/dist/lib/schemas-data/v2.5/enums/channels.json +0 -18
  271. package/dist/lib/schemas-data/v2.5/enums/co-branding-requirement.json +0 -12
  272. package/dist/lib/schemas-data/v2.5/enums/creative-action.json +0 -14
  273. package/dist/lib/schemas-data/v2.5/enums/creative-agent-capability.json +0 -13
  274. package/dist/lib/schemas-data/v2.5/enums/creative-sort-field.json +0 -15
  275. package/dist/lib/schemas-data/v2.5/enums/creative-status.json +0 -19
  276. package/dist/lib/schemas-data/v2.5/enums/daast-tracking-event.json +0 -20
  277. package/dist/lib/schemas-data/v2.5/enums/daast-version.json +0 -11
  278. package/dist/lib/schemas-data/v2.5/enums/delivery-type.json +0 -15
  279. package/dist/lib/schemas-data/v2.5/enums/dimension-unit.json +0 -13
  280. package/dist/lib/schemas-data/v2.5/enums/feed-format.json +0 -12
  281. package/dist/lib/schemas-data/v2.5/enums/feedback-source.json +0 -13
  282. package/dist/lib/schemas-data/v2.5/enums/format-category.json +0 -16
  283. package/dist/lib/schemas-data/v2.5/enums/format-id-parameter.json +0 -11
  284. package/dist/lib/schemas-data/v2.5/enums/frequency-cap-scope.json +0 -13
  285. package/dist/lib/schemas-data/v2.5/enums/history-entry-type.json +0 -11
  286. package/dist/lib/schemas-data/v2.5/enums/http-method.json +0 -11
  287. package/dist/lib/schemas-data/v2.5/enums/identifier-types.json +0 -34
  288. package/dist/lib/schemas-data/v2.5/enums/javascript-module-type.json +0 -12
  289. package/dist/lib/schemas-data/v2.5/enums/landing-page-requirement.json +0 -12
  290. package/dist/lib/schemas-data/v2.5/enums/markdown-flavor.json +0 -11
  291. package/dist/lib/schemas-data/v2.5/enums/media-buy-status.json +0 -19
  292. package/dist/lib/schemas-data/v2.5/enums/metric-type.json +0 -17
  293. package/dist/lib/schemas-data/v2.5/enums/notification-type.json +0 -13
  294. package/dist/lib/schemas-data/v2.5/enums/pacing.json +0 -17
  295. package/dist/lib/schemas-data/v2.5/enums/preview-output-format.json +0 -11
  296. package/dist/lib/schemas-data/v2.5/enums/pricing-model.json +0 -25
  297. package/dist/lib/schemas-data/v2.5/enums/property-type.json +0 -16
  298. package/dist/lib/schemas-data/v2.5/enums/publisher-identifier-types.json +0 -19
  299. package/dist/lib/schemas-data/v2.5/enums/reporting-frequency.json +0 -12
  300. package/dist/lib/schemas-data/v2.5/enums/signal-catalog-type.json +0 -12
  301. package/dist/lib/schemas-data/v2.5/enums/sort-direction.json +0 -11
  302. package/dist/lib/schemas-data/v2.5/enums/standard-format-ids.json +0 -103
  303. package/dist/lib/schemas-data/v2.5/enums/task-status.json +0 -29
  304. package/dist/lib/schemas-data/v2.5/enums/task-type.json +0 -27
  305. package/dist/lib/schemas-data/v2.5/enums/update-frequency.json +0 -13
  306. package/dist/lib/schemas-data/v2.5/enums/url-asset-type.json +0 -12
  307. package/dist/lib/schemas-data/v2.5/enums/validation-mode.json +0 -11
  308. package/dist/lib/schemas-data/v2.5/enums/vast-tracking-event.json +0 -25
  309. package/dist/lib/schemas-data/v2.5/enums/vast-version.json +0 -14
  310. package/dist/lib/schemas-data/v2.5/enums/webhook-response-type.json +0 -13
  311. package/dist/lib/schemas-data/v2.5/enums/webhook-security-method.json +0 -12
  312. package/dist/lib/schemas-data/v2.5/index.json +0 -604
  313. package/dist/lib/schemas-data/v2.5/media-buy/build-creative-request.json +0 -31
  314. package/dist/lib/schemas-data/v2.5/media-buy/build-creative-response.json +0 -65
  315. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-input-required.json +0 -31
  316. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-submitted.json +0 -16
  317. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-working.json +0 -36
  318. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-request.json +0 -126
  319. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-response.json +0 -97
  320. package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-request.json +0 -54
  321. package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-response.json +0 -285
  322. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-input-required.json +0 -38
  323. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-submitted.json +0 -21
  324. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-working.json +0 -34
  325. package/dist/lib/schemas-data/v2.5/media-buy/get-products-request.json +0 -28
  326. package/dist/lib/schemas-data/v2.5/media-buy/get-products-response.json +0 -33
  327. package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-request.json +0 -26
  328. package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-response.json +0 -70
  329. package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-request.json +0 -58
  330. package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-response.json +0 -61
  331. package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-request.json +0 -137
  332. package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-response.json +0 -437
  333. package/dist/lib/schemas-data/v2.5/media-buy/package-request.json +0 -80
  334. package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-request.json +0 -88
  335. package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-response.json +0 -66
  336. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-input-required.json +0 -25
  337. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-submitted.json +0 -16
  338. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-working.json +0 -46
  339. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-request.json +0 -178
  340. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-response.json +0 -149
  341. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-input-required.json +0 -24
  342. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-submitted.json +0 -16
  343. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-working.json +0 -36
  344. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-request.json +0 -129
  345. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-response.json +0 -99
  346. package/dist/lib/schemas-data/v2.5/pricing-options/cpc-option.json +0 -52
  347. package/dist/lib/schemas-data/v2.5/pricing-options/cpcv-option.json +0 -52
  348. package/dist/lib/schemas-data/v2.5/pricing-options/cpm-auction-option.json +0 -81
  349. package/dist/lib/schemas-data/v2.5/pricing-options/cpm-fixed-option.json +0 -52
  350. package/dist/lib/schemas-data/v2.5/pricing-options/cpp-option.json +0 -73
  351. package/dist/lib/schemas-data/v2.5/pricing-options/cpv-option.json +0 -88
  352. package/dist/lib/schemas-data/v2.5/pricing-options/flat-rate-option.json +0 -93
  353. package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-auction-option.json +0 -81
  354. package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-fixed-option.json +0 -52
  355. package/dist/lib/schemas-data/v2.5/protocols/adcp-extension.json +0 -33
  356. package/dist/lib/schemas-data/v2.5/signals/activate-signal-request.json +0 -32
  357. package/dist/lib/schemas-data/v2.5/signals/activate-signal-response.json +0 -68
  358. package/dist/lib/schemas-data/v2.5/signals/get-signals-request.json +0 -59
  359. package/dist/lib/schemas-data/v2.5/signals/get-signals-response.json +0 -100
  360. package/dist/lib/types/v2-5/index.d.mts +0 -1
  361. package/dist/lib/types/v2-5/index.d.ts +0 -1
  362. package/dist/lib/types/v2-5/index.js +0 -22
  363. package/dist/lib/types/v2-5/index.mjs +0 -1
  364. package/dist/lib/types/v2-5/tools.generated.d.mts +0 -3568
  365. package/dist/lib/types/v2-5/tools.generated.d.ts +0 -3568
  366. package/dist/lib/types/v2-5/tools.generated.js +0 -16
  367. package/dist/lib/types/v2-5/tools.generated.mjs +0 -0
  368. package/dist/lib/utils/sync-creatives-adapter.d.mts +0 -33
  369. package/dist/lib/utils/sync-creatives-adapter.d.ts +0 -33
  370. package/dist/lib/utils/sync-creatives-adapter.js +0 -83
  371. package/dist/lib/utils/sync-creatives-adapter.mjs +0 -59
@@ -1,126 +1,28 @@
1
- /**
2
- * Creative Assignment Adapter
3
- *
4
- * Handles conversion between v2 creative_ids and v3 creative_assignments.
5
- * The library exposes only v3 API (creative_assignments) to clients,
6
- * and internally adapts requests for v2 servers.
7
- */
8
- /**
9
- * v3 creative assignment with optional weight and placement targeting
10
- */
1
+ /** Helpers for reading AdCP 3 creative assignments. */
2
+ /** Creative assignment with optional weight and placement targeting. */
11
3
  export interface CreativeAssignment {
12
- /** Unique identifier for the creative */
13
4
  creative_id: string;
14
- /** Delivery weight (0-100) for rotation */
15
5
  weight?: number;
16
- /** Optional placement IDs to restrict where this creative runs */
17
6
  placement_ids?: string[];
7
+ [key: string]: unknown;
18
8
  }
19
- /**
20
- * Package request with creative assignments (v3 style)
21
- */
22
9
  export interface PackageRequestV3 {
23
10
  creative_assignments?: CreativeAssignment[];
24
- creatives?: any[];
25
- [key: string]: unknown;
26
- }
27
- /**
28
- * Package request with creative_ids (v2 style)
29
- */
30
- export interface PackageRequestV2 {
31
- creative_ids?: string[];
32
- creatives?: any[];
11
+ creatives?: unknown[];
33
12
  [key: string]: unknown;
34
13
  }
35
- /**
36
- * Package response with creative assignments (v3 style)
37
- */
38
14
  export interface PackageResponseV3 {
39
15
  creative_assignments?: CreativeAssignment[];
40
16
  [key: string]: unknown;
41
17
  }
42
- /**
43
- * Package response with creative_ids (v2 style)
44
- */
45
- export interface PackageResponseV2 {
46
- creative_ids?: string[];
47
- [key: string]: unknown;
48
- }
49
- /**
50
- * Optional context for deriving a per-package `buyer_ref` when the v3 input
51
- * doesn't carry one. v2.5 `package-request.json` requires `buyer_ref` (the
52
- * `oneOf` accepts `package_id` OR `buyer_ref`; on creation no `package_id`
53
- * exists yet, so `buyer_ref` is the actual required identifier). v3 doesn't
54
- * model packages with `buyer_ref`, but `idempotency_key` carries equivalent
55
- * client-controlled-unique-identity semantics. The `parentBuyerRef` plus
56
- * `index` compose a stable per-package reference that re-derives identically
57
- * on replay — preserving the idempotency contract sellers depend on for
58
- * deduping.
59
- */
60
- export interface PackageAdapterContext {
61
- /** Top-level `buyer_ref` derived from the parent v3 request. */
62
- parentBuyerRef?: string;
63
- /** Position of the package within the parent's `packages[]` array. */
64
- index?: number;
65
- }
66
- /**
67
- * Adapt a v3-style package request for a v2 server.
68
- * Converts creative_assignments to creative_ids (dropping weight and placement_ids).
69
- * Strips v3-only package fields (optimization_goals, catalogs).
70
- *
71
- * When `ctx` is provided and the input has no `buyer_ref`, derives one from —
72
- * in order — `package.context.buyer_ref`, `package.idempotency_key`, or
73
- * `${ctx.parentBuyerRef}-${ctx.index}` so v2.5 package-request validation
74
- * passes. Caller-supplied top-level `buyer_ref` always wins. The `context.buyer_ref`
75
- * fallback exists because v3 callers put their per-package correlation ref in
76
- * `context.buyer_ref` (per the 3.0 package schema); this adapter is the only
77
- * place that promotes it back to the top-level shape v2.5 sellers still expect.
78
- */
79
- export declare function adaptPackageRequestForV2(pkg: PackageRequestV3, ctx?: PackageAdapterContext): PackageRequestV2;
80
- /**
81
- * Adapt a create_media_buy request for a v2 server.
82
- * Strips v3-only top-level fields, converts brand → brand_manifest, derives
83
- * `buyer_ref` (top-level + per-package) from `context.buyer_ref` or
84
- * `idempotency_key`, and adapts packages.
85
- *
86
- * v2.5 requires `buyer_ref` as the buyer's reference for THIS media buy,
87
- * top-level + per-package. v3 removed the top-level field and moved buyer
88
- * correlation into `context.buyer_ref`; `idempotency_key` carries the same
89
- * client-controlled-unique-identity semantics. Preferring the caller's
90
- * `context.buyer_ref` before falling back to `idempotency_key` preserves the
91
- * buyer's stable reference on the wire when they provided one, and still
92
- * satisfies v2.5 dedupe on replay when they did not. Caller-supplied
93
- * top-level `buyer_ref` (if any) always wins.
94
- */
95
- export declare function adaptCreateMediaBuyRequestForV2(request: any): any;
96
- /**
97
- * Adapt an update_media_buy request for a v2 server.
98
- * Strips v3-only top-level fields and adapts packages.
99
- */
100
- export declare function adaptUpdateMediaBuyRequestForV2(request: any): any;
101
- /**
102
- * Normalize a v2-style package response to v3.
103
- * Converts creative_ids to creative_assignments and coerces null array fields
104
- * to undefined so downstream consumers can safely use optional chaining.
105
- */
106
- export declare function normalizePackageResponse(pkg: PackageResponseV2 | PackageResponseV3): PackageResponseV3;
107
- /**
108
- * Normalize a media buy response (converts all packages).
109
- */
110
- export declare function normalizeMediaBuyResponse(response: any): any;
111
- /**
112
- * Check if a package uses v2 creative_ids format
113
- */
114
- export declare function usesV2CreativeIds(pkg: any): boolean;
115
- /**
116
- * Check if a package uses v3 creative_assignments format
117
- */
118
- export declare function usesV3CreativeAssignments(pkg: any): boolean;
119
- /**
120
- * Get all creative IDs from a package (works with both v2 and v3 format)
121
- */
122
- export declare function getCreativeIds(pkg: PackageResponseV2 | PackageResponseV3): string[];
123
- /**
124
- * Get creative assignments from a package (normalizes v2 to v3 format)
125
- */
126
- export declare function getCreativeAssignments(pkg: PackageResponseV2 | PackageResponseV3): CreativeAssignment[];
18
+ /** Remove a null assignments array while preserving all extension fields. */
19
+ export declare function normalizePackageResponse<T extends PackageResponseV3>(pkg: T): T;
20
+ /** Normalize optional arrays in the packages of an AdCP 3 media buy response. */
21
+ export declare function normalizeMediaBuyResponse<T extends {
22
+ packages?: PackageResponseV3[];
23
+ }>(response: T): T;
24
+ export declare function usesV3CreativeAssignments(pkg: PackageResponseV3): boolean;
25
+ /** Return creative IDs in assignment order. */
26
+ export declare function getCreativeIds(pkg: PackageResponseV3): string[];
27
+ /** Return the supplied assignments, including their weights and extension fields. */
28
+ export declare function getCreativeAssignments(pkg: PackageResponseV3): CreativeAssignment[];
@@ -1,126 +1,28 @@
1
- /**
2
- * Creative Assignment Adapter
3
- *
4
- * Handles conversion between v2 creative_ids and v3 creative_assignments.
5
- * The library exposes only v3 API (creative_assignments) to clients,
6
- * and internally adapts requests for v2 servers.
7
- */
8
- /**
9
- * v3 creative assignment with optional weight and placement targeting
10
- */
1
+ /** Helpers for reading AdCP 3 creative assignments. */
2
+ /** Creative assignment with optional weight and placement targeting. */
11
3
  export interface CreativeAssignment {
12
- /** Unique identifier for the creative */
13
4
  creative_id: string;
14
- /** Delivery weight (0-100) for rotation */
15
5
  weight?: number;
16
- /** Optional placement IDs to restrict where this creative runs */
17
6
  placement_ids?: string[];
7
+ [key: string]: unknown;
18
8
  }
19
- /**
20
- * Package request with creative assignments (v3 style)
21
- */
22
9
  export interface PackageRequestV3 {
23
10
  creative_assignments?: CreativeAssignment[];
24
- creatives?: any[];
25
- [key: string]: unknown;
26
- }
27
- /**
28
- * Package request with creative_ids (v2 style)
29
- */
30
- export interface PackageRequestV2 {
31
- creative_ids?: string[];
32
- creatives?: any[];
11
+ creatives?: unknown[];
33
12
  [key: string]: unknown;
34
13
  }
35
- /**
36
- * Package response with creative assignments (v3 style)
37
- */
38
14
  export interface PackageResponseV3 {
39
15
  creative_assignments?: CreativeAssignment[];
40
16
  [key: string]: unknown;
41
17
  }
42
- /**
43
- * Package response with creative_ids (v2 style)
44
- */
45
- export interface PackageResponseV2 {
46
- creative_ids?: string[];
47
- [key: string]: unknown;
48
- }
49
- /**
50
- * Optional context for deriving a per-package `buyer_ref` when the v3 input
51
- * doesn't carry one. v2.5 `package-request.json` requires `buyer_ref` (the
52
- * `oneOf` accepts `package_id` OR `buyer_ref`; on creation no `package_id`
53
- * exists yet, so `buyer_ref` is the actual required identifier). v3 doesn't
54
- * model packages with `buyer_ref`, but `idempotency_key` carries equivalent
55
- * client-controlled-unique-identity semantics. The `parentBuyerRef` plus
56
- * `index` compose a stable per-package reference that re-derives identically
57
- * on replay — preserving the idempotency contract sellers depend on for
58
- * deduping.
59
- */
60
- export interface PackageAdapterContext {
61
- /** Top-level `buyer_ref` derived from the parent v3 request. */
62
- parentBuyerRef?: string;
63
- /** Position of the package within the parent's `packages[]` array. */
64
- index?: number;
65
- }
66
- /**
67
- * Adapt a v3-style package request for a v2 server.
68
- * Converts creative_assignments to creative_ids (dropping weight and placement_ids).
69
- * Strips v3-only package fields (optimization_goals, catalogs).
70
- *
71
- * When `ctx` is provided and the input has no `buyer_ref`, derives one from —
72
- * in order — `package.context.buyer_ref`, `package.idempotency_key`, or
73
- * `${ctx.parentBuyerRef}-${ctx.index}` so v2.5 package-request validation
74
- * passes. Caller-supplied top-level `buyer_ref` always wins. The `context.buyer_ref`
75
- * fallback exists because v3 callers put their per-package correlation ref in
76
- * `context.buyer_ref` (per the 3.0 package schema); this adapter is the only
77
- * place that promotes it back to the top-level shape v2.5 sellers still expect.
78
- */
79
- export declare function adaptPackageRequestForV2(pkg: PackageRequestV3, ctx?: PackageAdapterContext): PackageRequestV2;
80
- /**
81
- * Adapt a create_media_buy request for a v2 server.
82
- * Strips v3-only top-level fields, converts brand → brand_manifest, derives
83
- * `buyer_ref` (top-level + per-package) from `context.buyer_ref` or
84
- * `idempotency_key`, and adapts packages.
85
- *
86
- * v2.5 requires `buyer_ref` as the buyer's reference for THIS media buy,
87
- * top-level + per-package. v3 removed the top-level field and moved buyer
88
- * correlation into `context.buyer_ref`; `idempotency_key` carries the same
89
- * client-controlled-unique-identity semantics. Preferring the caller's
90
- * `context.buyer_ref` before falling back to `idempotency_key` preserves the
91
- * buyer's stable reference on the wire when they provided one, and still
92
- * satisfies v2.5 dedupe on replay when they did not. Caller-supplied
93
- * top-level `buyer_ref` (if any) always wins.
94
- */
95
- export declare function adaptCreateMediaBuyRequestForV2(request: any): any;
96
- /**
97
- * Adapt an update_media_buy request for a v2 server.
98
- * Strips v3-only top-level fields and adapts packages.
99
- */
100
- export declare function adaptUpdateMediaBuyRequestForV2(request: any): any;
101
- /**
102
- * Normalize a v2-style package response to v3.
103
- * Converts creative_ids to creative_assignments and coerces null array fields
104
- * to undefined so downstream consumers can safely use optional chaining.
105
- */
106
- export declare function normalizePackageResponse(pkg: PackageResponseV2 | PackageResponseV3): PackageResponseV3;
107
- /**
108
- * Normalize a media buy response (converts all packages).
109
- */
110
- export declare function normalizeMediaBuyResponse(response: any): any;
111
- /**
112
- * Check if a package uses v2 creative_ids format
113
- */
114
- export declare function usesV2CreativeIds(pkg: any): boolean;
115
- /**
116
- * Check if a package uses v3 creative_assignments format
117
- */
118
- export declare function usesV3CreativeAssignments(pkg: any): boolean;
119
- /**
120
- * Get all creative IDs from a package (works with both v2 and v3 format)
121
- */
122
- export declare function getCreativeIds(pkg: PackageResponseV2 | PackageResponseV3): string[];
123
- /**
124
- * Get creative assignments from a package (normalizes v2 to v3 format)
125
- */
126
- export declare function getCreativeAssignments(pkg: PackageResponseV2 | PackageResponseV3): CreativeAssignment[];
18
+ /** Remove a null assignments array while preserving all extension fields. */
19
+ export declare function normalizePackageResponse<T extends PackageResponseV3>(pkg: T): T;
20
+ /** Normalize optional arrays in the packages of an AdCP 3 media buy response. */
21
+ export declare function normalizeMediaBuyResponse<T extends {
22
+ packages?: PackageResponseV3[];
23
+ }>(response: T): T;
24
+ export declare function usesV3CreativeAssignments(pkg: PackageResponseV3): boolean;
25
+ /** Return creative IDs in assignment order. */
26
+ export declare function getCreativeIds(pkg: PackageResponseV3): string[];
27
+ /** Return the supplied assignments, including their weights and extension fields. */
28
+ export declare function getCreativeAssignments(pkg: PackageResponseV3): CreativeAssignment[];
@@ -18,102 +18,22 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var creative_adapter_exports = {};
20
20
  __export(creative_adapter_exports, {
21
- adaptCreateMediaBuyRequestForV2: () => adaptCreateMediaBuyRequestForV2,
22
- adaptPackageRequestForV2: () => adaptPackageRequestForV2,
23
- adaptUpdateMediaBuyRequestForV2: () => adaptUpdateMediaBuyRequestForV2,
24
21
  getCreativeAssignments: () => getCreativeAssignments,
25
22
  getCreativeIds: () => getCreativeIds,
26
23
  normalizeMediaBuyResponse: () => normalizeMediaBuyResponse,
27
24
  normalizePackageResponse: () => normalizePackageResponse,
28
- usesV2CreativeIds: () => usesV2CreativeIds,
29
25
  usesV3CreativeAssignments: () => usesV3CreativeAssignments
30
26
  });
31
27
  module.exports = __toCommonJS(creative_adapter_exports);
32
- function adaptPackageRequestForV2(pkg, ctx) {
33
- const {
34
- optimization_goals,
35
- catalogs,
36
- idempotency_key: pkgIdempotencyKey,
37
- buyer_ref: callerBuyerRef,
38
- ...rest
39
- } = pkg;
40
- const contextBuyerRef = rest.context && typeof rest.context === "object" && !Array.isArray(rest.context) ? rest.context.buyer_ref : void 0;
41
- const derivedBuyerRef = typeof callerBuyerRef === "string" && callerBuyerRef.length > 0 ? callerBuyerRef : typeof contextBuyerRef === "string" && contextBuyerRef.length > 0 ? contextBuyerRef : typeof pkgIdempotencyKey === "string" && pkgIdempotencyKey.length > 0 ? pkgIdempotencyKey : ctx?.parentBuyerRef !== void 0 && ctx?.index !== void 0 ? `${ctx.parentBuyerRef}-${ctx.index}` : void 0;
42
- const baseOut = rest;
43
- if (!rest.creative_assignments) {
44
- return derivedBuyerRef === void 0 ? baseOut : { ...baseOut, buyer_ref: derivedBuyerRef };
45
- }
46
- const { creative_assignments, ...withoutAssignments } = rest;
47
- return {
48
- ...withoutAssignments,
49
- ...derivedBuyerRef !== void 0 && { buyer_ref: derivedBuyerRef },
50
- creative_ids: creative_assignments.map((a) => a.creative_id)
51
- };
52
- }
53
- function adaptCreateMediaBuyRequestForV2(request) {
54
- const {
55
- account,
56
- proposal_id,
57
- total_budget,
58
- artifact_webhook,
59
- brand,
60
- brand_manifest: inputManifest,
61
- adcp_major_version,
62
- idempotency_key,
63
- buyer_ref: callerBuyerRef,
64
- ...rest
65
- } = request;
66
- const contextBuyerRef = rest.context && typeof rest.context === "object" && !Array.isArray(rest.context) ? rest.context.buyer_ref : void 0;
67
- if (proposal_id && !rest.packages?.length) {
68
- throw new Error(
69
- "Proposal mode (proposal_id + total_budget) requires a v3 server. The connected server only supports AdCP v2. Provide an explicit packages array instead."
70
- );
71
- }
72
- const callerUrl = typeof inputManifest === "string" ? inputManifest : typeof inputManifest === "object" && inputManifest?.url ? inputManifest.url : void 0;
73
- const brand_manifest = callerUrl || (brand?.domain ? `https://${brand.domain}` : void 0);
74
- const buyer_ref = typeof callerBuyerRef === "string" && callerBuyerRef.length > 0 ? callerBuyerRef : typeof contextBuyerRef === "string" && contextBuyerRef.length > 0 ? contextBuyerRef : typeof idempotency_key === "string" && idempotency_key.length > 0 ? idempotency_key : void 0;
75
- return {
76
- ...rest,
77
- ...buyer_ref !== void 0 && { buyer_ref },
78
- ...brand && !brand_manifest && { brand },
79
- ...brand_manifest !== void 0 && { brand_manifest },
80
- ...rest.packages && {
81
- packages: rest.packages.map(
82
- (pkg, index) => adaptPackageRequestForV2(pkg, { parentBuyerRef: buyer_ref, index })
83
- )
84
- }
85
- };
86
- }
87
- function adaptUpdateMediaBuyRequestForV2(request) {
88
- const { reporting_webhook, adcp_major_version, idempotency_key, ...rest } = request;
89
- return {
90
- ...rest,
91
- ...rest.packages && { packages: rest.packages.map(adaptPackageRequestForV2) }
92
- };
93
- }
94
28
  function normalizePackageResponse(pkg) {
95
- const nullArrayFields = ["creative_assignments", "creative_ids", "products"];
96
- let cleaned = pkg;
97
- for (const field of nullArrayFields) {
98
- if (field in cleaned && cleaned[field] === null) {
99
- const { [field]: _removed, ...rest } = cleaned;
100
- cleaned = rest;
101
- }
102
- }
103
- if (cleaned.creative_assignments) {
104
- return cleaned;
29
+ if (pkg.creative_assignments === null) {
30
+ const { creative_assignments: _removed, ...rest } = pkg;
31
+ return rest;
105
32
  }
106
- if (cleaned.creative_ids) {
107
- const { creative_ids, ...rest } = cleaned;
108
- return {
109
- ...rest,
110
- creative_assignments: creative_ids.map((id) => ({ creative_id: id }))
111
- };
112
- }
113
- return cleaned;
33
+ return pkg;
114
34
  }
115
35
  function normalizeMediaBuyResponse(response) {
116
- if (!response.packages) {
36
+ if (!Array.isArray(response.packages)) {
117
37
  return response;
118
38
  }
119
39
  return {
@@ -121,39 +41,20 @@ function normalizeMediaBuyResponse(response) {
121
41
  packages: response.packages.map(normalizePackageResponse)
122
42
  };
123
43
  }
124
- function usesV2CreativeIds(pkg) {
125
- return Array.isArray(pkg.creative_ids) && !pkg.creative_assignments;
126
- }
127
44
  function usesV3CreativeAssignments(pkg) {
128
45
  return Array.isArray(pkg.creative_assignments);
129
46
  }
130
47
  function getCreativeIds(pkg) {
131
- if (pkg.creative_assignments) {
132
- return pkg.creative_assignments.map((a) => a.creative_id);
133
- }
134
- if (pkg.creative_ids) {
135
- return pkg.creative_ids;
136
- }
137
- return [];
48
+ return getCreativeAssignments(pkg).map((assignment) => assignment.creative_id);
138
49
  }
139
50
  function getCreativeAssignments(pkg) {
140
- if (pkg.creative_assignments) {
141
- return pkg.creative_assignments;
142
- }
143
- if (pkg.creative_ids) {
144
- return pkg.creative_ids.map((id) => ({ creative_id: id }));
145
- }
146
- return [];
51
+ return pkg.creative_assignments ?? [];
147
52
  }
148
53
  // Annotate the CommonJS export names for ESM import in node:
149
54
  0 && (module.exports = {
150
- adaptCreateMediaBuyRequestForV2,
151
- adaptPackageRequestForV2,
152
- adaptUpdateMediaBuyRequestForV2,
153
55
  getCreativeAssignments,
154
56
  getCreativeIds,
155
57
  normalizeMediaBuyResponse,
156
58
  normalizePackageResponse,
157
- usesV2CreativeIds,
158
59
  usesV3CreativeAssignments
159
60
  });
@@ -1,88 +1,12 @@
1
- function adaptPackageRequestForV2(pkg, ctx) {
2
- const {
3
- optimization_goals,
4
- catalogs,
5
- idempotency_key: pkgIdempotencyKey,
6
- buyer_ref: callerBuyerRef,
7
- ...rest
8
- } = pkg;
9
- const contextBuyerRef = rest.context && typeof rest.context === "object" && !Array.isArray(rest.context) ? rest.context.buyer_ref : void 0;
10
- const derivedBuyerRef = typeof callerBuyerRef === "string" && callerBuyerRef.length > 0 ? callerBuyerRef : typeof contextBuyerRef === "string" && contextBuyerRef.length > 0 ? contextBuyerRef : typeof pkgIdempotencyKey === "string" && pkgIdempotencyKey.length > 0 ? pkgIdempotencyKey : ctx?.parentBuyerRef !== void 0 && ctx?.index !== void 0 ? `${ctx.parentBuyerRef}-${ctx.index}` : void 0;
11
- const baseOut = rest;
12
- if (!rest.creative_assignments) {
13
- return derivedBuyerRef === void 0 ? baseOut : { ...baseOut, buyer_ref: derivedBuyerRef };
14
- }
15
- const { creative_assignments, ...withoutAssignments } = rest;
16
- return {
17
- ...withoutAssignments,
18
- ...derivedBuyerRef !== void 0 && { buyer_ref: derivedBuyerRef },
19
- creative_ids: creative_assignments.map((a) => a.creative_id)
20
- };
21
- }
22
- function adaptCreateMediaBuyRequestForV2(request) {
23
- const {
24
- account,
25
- proposal_id,
26
- total_budget,
27
- artifact_webhook,
28
- brand,
29
- brand_manifest: inputManifest,
30
- adcp_major_version,
31
- idempotency_key,
32
- buyer_ref: callerBuyerRef,
33
- ...rest
34
- } = request;
35
- const contextBuyerRef = rest.context && typeof rest.context === "object" && !Array.isArray(rest.context) ? rest.context.buyer_ref : void 0;
36
- if (proposal_id && !rest.packages?.length) {
37
- throw new Error(
38
- "Proposal mode (proposal_id + total_budget) requires a v3 server. The connected server only supports AdCP v2. Provide an explicit packages array instead."
39
- );
40
- }
41
- const callerUrl = typeof inputManifest === "string" ? inputManifest : typeof inputManifest === "object" && inputManifest?.url ? inputManifest.url : void 0;
42
- const brand_manifest = callerUrl || (brand?.domain ? `https://${brand.domain}` : void 0);
43
- const buyer_ref = typeof callerBuyerRef === "string" && callerBuyerRef.length > 0 ? callerBuyerRef : typeof contextBuyerRef === "string" && contextBuyerRef.length > 0 ? contextBuyerRef : typeof idempotency_key === "string" && idempotency_key.length > 0 ? idempotency_key : void 0;
44
- return {
45
- ...rest,
46
- ...buyer_ref !== void 0 && { buyer_ref },
47
- ...brand && !brand_manifest && { brand },
48
- ...brand_manifest !== void 0 && { brand_manifest },
49
- ...rest.packages && {
50
- packages: rest.packages.map(
51
- (pkg, index) => adaptPackageRequestForV2(pkg, { parentBuyerRef: buyer_ref, index })
52
- )
53
- }
54
- };
55
- }
56
- function adaptUpdateMediaBuyRequestForV2(request) {
57
- const { reporting_webhook, adcp_major_version, idempotency_key, ...rest } = request;
58
- return {
59
- ...rest,
60
- ...rest.packages && { packages: rest.packages.map(adaptPackageRequestForV2) }
61
- };
62
- }
63
1
  function normalizePackageResponse(pkg) {
64
- const nullArrayFields = ["creative_assignments", "creative_ids", "products"];
65
- let cleaned = pkg;
66
- for (const field of nullArrayFields) {
67
- if (field in cleaned && cleaned[field] === null) {
68
- const { [field]: _removed, ...rest } = cleaned;
69
- cleaned = rest;
70
- }
71
- }
72
- if (cleaned.creative_assignments) {
73
- return cleaned;
2
+ if (pkg.creative_assignments === null) {
3
+ const { creative_assignments: _removed, ...rest } = pkg;
4
+ return rest;
74
5
  }
75
- if (cleaned.creative_ids) {
76
- const { creative_ids, ...rest } = cleaned;
77
- return {
78
- ...rest,
79
- creative_assignments: creative_ids.map((id) => ({ creative_id: id }))
80
- };
81
- }
82
- return cleaned;
6
+ return pkg;
83
7
  }
84
8
  function normalizeMediaBuyResponse(response) {
85
- if (!response.packages) {
9
+ if (!Array.isArray(response.packages)) {
86
10
  return response;
87
11
  }
88
12
  return {
@@ -90,38 +14,19 @@ function normalizeMediaBuyResponse(response) {
90
14
  packages: response.packages.map(normalizePackageResponse)
91
15
  };
92
16
  }
93
- function usesV2CreativeIds(pkg) {
94
- return Array.isArray(pkg.creative_ids) && !pkg.creative_assignments;
95
- }
96
17
  function usesV3CreativeAssignments(pkg) {
97
18
  return Array.isArray(pkg.creative_assignments);
98
19
  }
99
20
  function getCreativeIds(pkg) {
100
- if (pkg.creative_assignments) {
101
- return pkg.creative_assignments.map((a) => a.creative_id);
102
- }
103
- if (pkg.creative_ids) {
104
- return pkg.creative_ids;
105
- }
106
- return [];
21
+ return getCreativeAssignments(pkg).map((assignment) => assignment.creative_id);
107
22
  }
108
23
  function getCreativeAssignments(pkg) {
109
- if (pkg.creative_assignments) {
110
- return pkg.creative_assignments;
111
- }
112
- if (pkg.creative_ids) {
113
- return pkg.creative_ids.map((id) => ({ creative_id: id }));
114
- }
115
- return [];
24
+ return pkg.creative_assignments ?? [];
116
25
  }
117
26
  export {
118
- adaptCreateMediaBuyRequestForV2,
119
- adaptPackageRequestForV2,
120
- adaptUpdateMediaBuyRequestForV2,
121
27
  getCreativeAssignments,
122
28
  getCreativeIds,
123
29
  normalizeMediaBuyResponse,
124
30
  normalizePackageResponse,
125
- usesV2CreativeIds,
126
31
  usesV3CreativeAssignments
127
32
  };