@adcp/sdk 12.1.0 → 13.0.0-rc.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 (464) hide show
  1. package/README.md +19 -3
  2. package/bin/adcp-fuzz.js +3 -1
  3. package/dist/lib/adapters/content-standards-adapter.d.mts +9 -9
  4. package/dist/lib/adapters/content-standards-adapter.d.ts +9 -9
  5. package/dist/lib/adapters/content-standards-adapter.d.ts.map +1 -1
  6. package/dist/lib/adapters/content-standards-adapter.js +22 -22
  7. package/dist/lib/adapters/content-standards-adapter.js.map +1 -1
  8. package/dist/lib/adapters/content-standards-adapter.mjs +18 -18
  9. package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
  10. package/dist/lib/adapters/index.d.mts +2 -2
  11. package/dist/lib/adapters/index.d.ts +2 -2
  12. package/dist/lib/adapters/index.d.ts.map +1 -1
  13. package/dist/lib/adapters/index.js +10 -10
  14. package/dist/lib/adapters/index.js.map +1 -1
  15. package/dist/lib/adapters/index.mjs +9 -9
  16. package/dist/lib/adapters/index.mjs.map +1 -1
  17. package/dist/lib/auth/oauth/authorization-required.d.mts +3 -0
  18. package/dist/lib/auth/oauth/authorization-required.d.ts +3 -0
  19. package/dist/lib/auth/oauth/authorization-required.d.ts.map +1 -1
  20. package/dist/lib/auth/oauth/authorization-required.js +12 -9
  21. package/dist/lib/auth/oauth/authorization-required.js.map +1 -1
  22. package/dist/lib/auth/oauth/authorization-required.mjs +12 -9
  23. package/dist/lib/auth/oauth/authorization-required.mjs.map +1 -1
  24. package/dist/lib/auth/oauth/provider-cache.d.mts +7 -0
  25. package/dist/lib/auth/oauth/provider-cache.d.ts +8 -0
  26. package/dist/lib/auth/oauth/provider-cache.d.ts.map +1 -0
  27. package/dist/lib/auth/oauth/provider-cache.js +44 -0
  28. package/dist/lib/auth/oauth/provider-cache.js.map +1 -0
  29. package/dist/lib/auth/oauth/provider-cache.mjs +19 -0
  30. package/dist/lib/auth/oauth/provider-cache.mjs.map +1 -0
  31. package/dist/lib/conformance/invariants/uniformError.js +1 -1
  32. package/dist/lib/conformance/invariants/uniformError.js.map +1 -1
  33. package/dist/lib/conformance/invariants/uniformError.mjs +1 -1
  34. package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
  35. package/dist/lib/conformance/runners.js +1 -1
  36. package/dist/lib/conformance/runners.js.map +1 -1
  37. package/dist/lib/conformance/runners.mjs +1 -1
  38. package/dist/lib/conformance/runners.mjs.map +1 -1
  39. package/dist/lib/conformance/seeder.js +5 -5
  40. package/dist/lib/conformance/seeder.js.map +1 -1
  41. package/dist/lib/conformance/seeder.mjs +5 -5
  42. package/dist/lib/conformance/seeder.mjs.map +1 -1
  43. package/dist/lib/core/ADCPMultiAgentClient.d.mts +26 -29
  44. package/dist/lib/core/ADCPMultiAgentClient.d.ts +26 -29
  45. package/dist/lib/core/ADCPMultiAgentClient.d.ts.map +1 -1
  46. package/dist/lib/core/ADCPMultiAgentClient.js +27 -19
  47. package/dist/lib/core/ADCPMultiAgentClient.js.map +1 -1
  48. package/dist/lib/core/ADCPMultiAgentClient.mjs +27 -19
  49. package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
  50. package/dist/lib/core/AgentClient.d.mts +148 -138
  51. package/dist/lib/core/AgentClient.d.ts +148 -138
  52. package/dist/lib/core/AgentClient.d.ts.map +1 -1
  53. package/dist/lib/core/AgentClient.js +174 -85
  54. package/dist/lib/core/AgentClient.js.map +1 -1
  55. package/dist/lib/core/AgentClient.mjs +174 -85
  56. package/dist/lib/core/AgentClient.mjs.map +1 -1
  57. package/dist/lib/core/AsyncHandler.d.mts +18 -16
  58. package/dist/lib/core/AsyncHandler.d.ts +18 -16
  59. package/dist/lib/core/AsyncHandler.d.ts.map +1 -1
  60. package/dist/lib/core/AsyncHandler.js +22 -1
  61. package/dist/lib/core/AsyncHandler.js.map +1 -1
  62. package/dist/lib/core/AsyncHandler.mjs +22 -1
  63. package/dist/lib/core/AsyncHandler.mjs.map +1 -1
  64. package/dist/lib/core/ConversationTypes.d.mts +6 -2
  65. package/dist/lib/core/ConversationTypes.d.ts +6 -2
  66. package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
  67. package/dist/lib/core/ConversationTypes.js.map +1 -1
  68. package/dist/lib/core/CreativeAgentClient.d.mts +41 -17
  69. package/dist/lib/core/CreativeAgentClient.d.ts +41 -17
  70. package/dist/lib/core/CreativeAgentClient.d.ts.map +1 -1
  71. package/dist/lib/core/CreativeAgentClient.js +39 -12
  72. package/dist/lib/core/CreativeAgentClient.js.map +1 -1
  73. package/dist/lib/core/CreativeAgentClient.mjs +39 -12
  74. package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
  75. package/dist/lib/core/SingleAgentClient.d.mts +129 -52
  76. package/dist/lib/core/SingleAgentClient.d.ts +129 -52
  77. package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
  78. package/dist/lib/core/SingleAgentClient.js +1748 -218
  79. package/dist/lib/core/SingleAgentClient.js.map +1 -1
  80. package/dist/lib/core/SingleAgentClient.mjs +1758 -218
  81. package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
  82. package/dist/lib/core/TaskExecutor.d.mts +9 -0
  83. package/dist/lib/core/TaskExecutor.d.ts +9 -0
  84. package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
  85. package/dist/lib/core/TaskExecutor.js +137 -44
  86. package/dist/lib/core/TaskExecutor.js.map +1 -1
  87. package/dist/lib/core/TaskExecutor.mjs +137 -44
  88. package/dist/lib/core/TaskExecutor.mjs.map +1 -1
  89. package/dist/lib/index.d.mts +111 -17
  90. package/dist/lib/index.d.ts +111 -17
  91. package/dist/lib/index.d.ts.map +1 -1
  92. package/dist/lib/index.js +94 -94
  93. package/dist/lib/index.js.map +1 -1
  94. package/dist/lib/index.mjs +93 -94
  95. package/dist/lib/index.mjs.map +1 -1
  96. package/dist/lib/net/ssrf-fetch.d.mts +13 -1
  97. package/dist/lib/net/ssrf-fetch.d.ts +13 -1
  98. package/dist/lib/net/ssrf-fetch.d.ts.map +1 -1
  99. package/dist/lib/net/ssrf-fetch.js +14 -7
  100. package/dist/lib/net/ssrf-fetch.js.map +1 -1
  101. package/dist/lib/net/ssrf-fetch.mjs +14 -7
  102. package/dist/lib/net/ssrf-fetch.mjs.map +1 -1
  103. package/dist/lib/protocols/a2a.d.mts +2 -2
  104. package/dist/lib/protocols/a2a.d.ts +2 -2
  105. package/dist/lib/protocols/a2a.d.ts.map +1 -1
  106. package/dist/lib/protocols/a2a.js +14 -9
  107. package/dist/lib/protocols/a2a.js.map +1 -1
  108. package/dist/lib/protocols/a2a.mjs +14 -9
  109. package/dist/lib/protocols/a2a.mjs.map +1 -1
  110. package/dist/lib/protocols/index.d.mts +20 -3
  111. package/dist/lib/protocols/index.d.ts +20 -3
  112. package/dist/lib/protocols/index.d.ts.map +1 -1
  113. package/dist/lib/protocols/index.js +44 -31
  114. package/dist/lib/protocols/index.js.map +1 -1
  115. package/dist/lib/protocols/index.mjs +44 -32
  116. package/dist/lib/protocols/index.mjs.map +1 -1
  117. package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
  118. package/dist/lib/protocols/mcp-modern.js +87 -12
  119. package/dist/lib/protocols/mcp-modern.js.map +1 -1
  120. package/dist/lib/protocols/mcp-modern.mjs +89 -12
  121. package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
  122. package/dist/lib/protocols/mcp-tasks.d.mts +3 -0
  123. package/dist/lib/protocols/mcp-tasks.d.ts +3 -0
  124. package/dist/lib/protocols/mcp-tasks.d.ts.map +1 -1
  125. package/dist/lib/protocols/mcp-tasks.js +21 -11
  126. package/dist/lib/protocols/mcp-tasks.js.map +1 -1
  127. package/dist/lib/protocols/mcp-tasks.mjs +21 -11
  128. package/dist/lib/protocols/mcp-tasks.mjs.map +1 -1
  129. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  130. package/dist/lib/server/create-adcp-server.d.mts +6 -0
  131. package/dist/lib/server/create-adcp-server.d.ts +6 -0
  132. package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
  133. package/dist/lib/server/create-adcp-server.js +295 -48
  134. package/dist/lib/server/create-adcp-server.js.map +1 -1
  135. package/dist/lib/server/create-adcp-server.mjs +301 -50
  136. package/dist/lib/server/create-adcp-server.mjs.map +1 -1
  137. package/dist/lib/server/decisioning/assembly-helpers.d.mts +27 -13
  138. package/dist/lib/server/decisioning/assembly-helpers.d.ts +27 -13
  139. package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -1
  140. package/dist/lib/server/decisioning/assembly-helpers.js +136 -14
  141. package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -1
  142. package/dist/lib/server/decisioning/assembly-helpers.mjs +134 -13
  143. package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
  144. package/dist/lib/server/decisioning/index.d.mts +13 -12
  145. package/dist/lib/server/decisioning/index.d.ts +13 -12
  146. package/dist/lib/server/decisioning/index.d.ts.map +1 -1
  147. package/dist/lib/server/decisioning/index.js +6 -0
  148. package/dist/lib/server/decisioning/index.js.map +1 -1
  149. package/dist/lib/server/decisioning/index.mjs +9 -3
  150. package/dist/lib/server/decisioning/index.mjs.map +1 -1
  151. package/dist/lib/server/decisioning/list-helpers.d.mts +13 -3
  152. package/dist/lib/server/decisioning/list-helpers.d.ts +13 -3
  153. package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -1
  154. package/dist/lib/server/decisioning/list-helpers.js +13 -3
  155. package/dist/lib/server/decisioning/list-helpers.js.map +1 -1
  156. package/dist/lib/server/decisioning/list-helpers.mjs +11 -2
  157. package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
  158. package/dist/lib/server/decisioning/manifest-helpers.d.mts +5 -3
  159. package/dist/lib/server/decisioning/manifest-helpers.d.ts +5 -3
  160. package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
  161. package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
  162. package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
  163. package/dist/lib/server/decisioning/proposal/dispatch.d.mts +2 -2
  164. package/dist/lib/server/decisioning/proposal/dispatch.d.ts +2 -2
  165. package/dist/lib/server/decisioning/proposal/dispatch.d.ts.map +1 -1
  166. package/dist/lib/server/decisioning/proposal/dispatch.js.map +1 -1
  167. package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
  168. package/dist/lib/server/decisioning/proposal/index.d.mts +1 -1
  169. package/dist/lib/server/decisioning/proposal/index.d.ts +1 -1
  170. package/dist/lib/server/decisioning/proposal/index.d.ts.map +1 -1
  171. package/dist/lib/server/decisioning/proposal/index.js.map +1 -1
  172. package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
  173. package/dist/lib/server/decisioning/proposal/lifecycle.d.mts +3 -2
  174. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts +3 -2
  175. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts.map +1 -1
  176. package/dist/lib/server/decisioning/proposal/lifecycle.js.map +1 -1
  177. package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
  178. package/dist/lib/server/decisioning/proposal/mock-manager.d.mts +3 -3
  179. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts +3 -3
  180. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts.map +1 -1
  181. package/dist/lib/server/decisioning/proposal/mock-manager.js.map +1 -1
  182. package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
  183. package/dist/lib/server/decisioning/proposal/types.d.mts +10 -6
  184. package/dist/lib/server/decisioning/proposal/types.d.ts +10 -6
  185. package/dist/lib/server/decisioning/proposal/types.d.ts.map +1 -1
  186. package/dist/lib/server/decisioning/proposal/types.js.map +1 -1
  187. package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
  188. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +21 -2
  189. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +21 -2
  190. package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
  191. package/dist/lib/server/decisioning/runtime/from-platform.js +754 -81
  192. package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
  193. package/dist/lib/server/decisioning/runtime/from-platform.mjs +763 -81
  194. package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
  195. package/dist/lib/server/decisioning/specialisms/brand-rights.d.mts +9 -9
  196. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +9 -9
  197. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -1
  198. package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -1
  199. package/dist/lib/server/decisioning/specialisms/content-standards.d.mts +16 -16
  200. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +16 -16
  201. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -1
  202. package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -1
  203. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.mts +15 -13
  204. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +15 -13
  205. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -1
  206. package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -1
  207. package/dist/lib/server/decisioning/specialisms/creative.d.mts +12 -11
  208. package/dist/lib/server/decisioning/specialisms/creative.d.ts +12 -11
  209. package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -1
  210. package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -1
  211. package/dist/lib/server/decisioning/specialisms/sales.d.mts +25 -15
  212. package/dist/lib/server/decisioning/specialisms/sales.d.ts +25 -15
  213. package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -1
  214. package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -1
  215. package/dist/lib/server/index.d.mts +3 -3
  216. package/dist/lib/server/index.d.ts +3 -3
  217. package/dist/lib/server/index.d.ts.map +1 -1
  218. package/dist/lib/server/index.js +72 -72
  219. package/dist/lib/server/index.js.map +1 -1
  220. package/dist/lib/server/index.mjs +36 -36
  221. package/dist/lib/server/index.mjs.map +1 -1
  222. package/dist/lib/server/legacy/v5/index.d.mts +1 -0
  223. package/dist/lib/server/legacy/v5/index.d.ts +1 -0
  224. package/dist/lib/server/legacy/v5/index.d.ts.map +1 -1
  225. package/dist/lib/server/legacy/v5/index.js +74 -1
  226. package/dist/lib/server/legacy/v5/index.js.map +1 -1
  227. package/dist/lib/server/legacy/v5/index.mjs +75 -1
  228. package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
  229. package/dist/lib/server/responses.d.mts +2 -2
  230. package/dist/lib/server/responses.d.ts +2 -2
  231. package/dist/lib/server/responses.js.map +1 -1
  232. package/dist/lib/server/responses.mjs.map +1 -1
  233. package/dist/lib/testing/client.d.ts.map +1 -1
  234. package/dist/lib/testing/client.js +13 -5
  235. package/dist/lib/testing/client.js.map +1 -1
  236. package/dist/lib/testing/client.mjs +13 -5
  237. package/dist/lib/testing/client.mjs.map +1 -1
  238. package/dist/lib/testing/compliance/comply.d.mts +1 -1
  239. package/dist/lib/testing/compliance/comply.d.ts +1 -1
  240. package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
  241. package/dist/lib/testing/compliance/comply.js +16 -6
  242. package/dist/lib/testing/compliance/comply.js.map +1 -1
  243. package/dist/lib/testing/compliance/comply.mjs +16 -6
  244. package/dist/lib/testing/compliance/comply.mjs.map +1 -1
  245. package/dist/lib/testing/scenarios/brand-rights.js +6 -6
  246. package/dist/lib/testing/scenarios/brand-rights.js.map +1 -1
  247. package/dist/lib/testing/scenarios/brand-rights.mjs +6 -6
  248. package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
  249. package/dist/lib/testing/scenarios/creative.js +7 -7
  250. package/dist/lib/testing/scenarios/creative.js.map +1 -1
  251. package/dist/lib/testing/scenarios/creative.mjs +7 -7
  252. package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
  253. package/dist/lib/testing/scenarios/discovery.js +2 -2
  254. package/dist/lib/testing/scenarios/discovery.js.map +1 -1
  255. package/dist/lib/testing/scenarios/discovery.mjs +2 -2
  256. package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
  257. package/dist/lib/testing/scenarios/edge-cases.js +11 -11
  258. package/dist/lib/testing/scenarios/edge-cases.js.map +1 -1
  259. package/dist/lib/testing/scenarios/edge-cases.mjs +11 -11
  260. package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
  261. package/dist/lib/testing/scenarios/governance.d.ts.map +1 -1
  262. package/dist/lib/testing/scenarios/governance.js +16 -22
  263. package/dist/lib/testing/scenarios/governance.js.map +1 -1
  264. package/dist/lib/testing/scenarios/governance.mjs +16 -22
  265. package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
  266. package/dist/lib/testing/scenarios/media-buy.js +5 -5
  267. package/dist/lib/testing/scenarios/media-buy.js.map +1 -1
  268. package/dist/lib/testing/scenarios/media-buy.mjs +5 -5
  269. package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
  270. package/dist/lib/testing/scenarios/schema-compliance.js +1 -1
  271. package/dist/lib/testing/scenarios/schema-compliance.js.map +1 -1
  272. package/dist/lib/testing/scenarios/schema-compliance.mjs +1 -1
  273. package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
  274. package/dist/lib/testing/scenarios/trusted-match.d.ts.map +1 -1
  275. package/dist/lib/testing/scenarios/trusted-match.js +4 -3
  276. package/dist/lib/testing/scenarios/trusted-match.js.map +1 -1
  277. package/dist/lib/testing/scenarios/trusted-match.mjs +4 -3
  278. package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
  279. package/dist/lib/testing/storyboard/probes.d.mts +6 -0
  280. package/dist/lib/testing/storyboard/probes.d.ts +6 -0
  281. package/dist/lib/testing/storyboard/probes.d.ts.map +1 -1
  282. package/dist/lib/testing/storyboard/probes.js +16 -5
  283. package/dist/lib/testing/storyboard/probes.js.map +1 -1
  284. package/dist/lib/testing/storyboard/probes.mjs +16 -5
  285. package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
  286. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  287. package/dist/lib/testing/storyboard/runner.js +6 -2
  288. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  289. package/dist/lib/testing/storyboard/runner.mjs +6 -2
  290. package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
  291. package/dist/lib/testing/storyboard/shape-drift-hints.d.mts +3 -4
  292. package/dist/lib/testing/storyboard/shape-drift-hints.d.ts +3 -4
  293. package/dist/lib/testing/storyboard/shape-drift-hints.d.ts.map +1 -1
  294. package/dist/lib/testing/storyboard/shape-drift-hints.js +27 -27
  295. package/dist/lib/testing/storyboard/shape-drift-hints.js.map +1 -1
  296. package/dist/lib/testing/storyboard/shape-drift-hints.mjs +27 -27
  297. package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
  298. package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
  299. package/dist/lib/testing/storyboard/task-map.js +43 -5
  300. package/dist/lib/testing/storyboard/task-map.js.map +1 -1
  301. package/dist/lib/testing/storyboard/task-map.mjs +43 -5
  302. package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
  303. package/dist/lib/testing/test-helpers.d.mts +2 -2
  304. package/dist/lib/testing/test-helpers.d.ts +2 -2
  305. package/dist/lib/testing/test-helpers.js.map +1 -1
  306. package/dist/lib/testing/test-helpers.mjs.map +1 -1
  307. package/dist/lib/testing/types.d.mts +7 -1
  308. package/dist/lib/testing/types.d.ts +7 -1
  309. package/dist/lib/testing/types.d.ts.map +1 -1
  310. package/dist/lib/testing/types.js.map +1 -1
  311. package/dist/lib/types/adcp.d.mts +14 -14
  312. package/dist/lib/types/adcp.d.ts +14 -14
  313. package/dist/lib/types/adcp.d.ts.map +1 -1
  314. package/dist/lib/types/adcp.js.map +1 -1
  315. package/dist/lib/types/adcp.mjs.map +1 -1
  316. package/dist/lib/types/index.d.mts +2 -2
  317. package/dist/lib/types/index.d.ts +2 -2
  318. package/dist/lib/types/index.d.ts.map +1 -1
  319. package/dist/lib/types/index.js.map +1 -1
  320. package/dist/lib/types/index.mjs.map +1 -1
  321. package/dist/lib/utils/capabilities.d.mts +6 -0
  322. package/dist/lib/utils/capabilities.d.ts +6 -0
  323. package/dist/lib/utils/capabilities.d.ts.map +1 -1
  324. package/dist/lib/utils/capabilities.js +4 -0
  325. package/dist/lib/utils/capabilities.js.map +1 -1
  326. package/dist/lib/utils/capabilities.mjs +4 -0
  327. package/dist/lib/utils/capabilities.mjs.map +1 -1
  328. package/dist/lib/utils/creative-delivery.d.mts +52 -10
  329. package/dist/lib/utils/creative-delivery.d.ts +52 -10
  330. package/dist/lib/utils/creative-delivery.d.ts.map +1 -1
  331. package/dist/lib/utils/creative-delivery.js +104 -9
  332. package/dist/lib/utils/creative-delivery.js.map +1 -1
  333. package/dist/lib/utils/creative-delivery.mjs +104 -8
  334. package/dist/lib/utils/creative-delivery.mjs.map +1 -1
  335. package/dist/lib/utils/format-assets.d.mts +41 -38
  336. package/dist/lib/utils/format-assets.d.ts +41 -38
  337. package/dist/lib/utils/format-assets.d.ts.map +1 -1
  338. package/dist/lib/utils/format-assets.js +3 -1
  339. package/dist/lib/utils/format-assets.js.map +1 -1
  340. package/dist/lib/utils/format-assets.mjs +3 -1
  341. package/dist/lib/utils/format-assets.mjs.map +1 -1
  342. package/dist/lib/utils/index.d.mts +8 -8
  343. package/dist/lib/utils/index.d.ts +8 -8
  344. package/dist/lib/utils/index.d.ts.map +1 -1
  345. package/dist/lib/utils/index.js +11 -9
  346. package/dist/lib/utils/index.js.map +1 -1
  347. package/dist/lib/utils/index.mjs +9 -8
  348. package/dist/lib/utils/index.mjs.map +1 -1
  349. package/dist/lib/utils/preview-utils.d.mts +11 -8
  350. package/dist/lib/utils/preview-utils.d.ts +11 -8
  351. package/dist/lib/utils/preview-utils.d.ts.map +1 -1
  352. package/dist/lib/utils/preview-utils.js +4 -4
  353. package/dist/lib/utils/preview-utils.js.map +1 -1
  354. package/dist/lib/utils/preview-utils.mjs +3 -3
  355. package/dist/lib/utils/preview-utils.mjs.map +1 -1
  356. package/dist/lib/utils/tool-request-schemas.d.mts +2 -2
  357. package/dist/lib/utils/tool-request-schemas.d.ts +2 -2
  358. package/dist/lib/v2/projection/aao-reference-formats.json +492 -0
  359. package/dist/lib/v2/projection/augment-response.d.mts +31 -11
  360. package/dist/lib/v2/projection/augment-response.d.ts +31 -11
  361. package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
  362. package/dist/lib/v2/projection/augment-response.js +233 -27
  363. package/dist/lib/v2/projection/augment-response.js.map +1 -1
  364. package/dist/lib/v2/projection/augment-response.mjs +232 -27
  365. package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
  366. package/dist/lib/v2/projection/builders.d.mts +7 -6
  367. package/dist/lib/v2/projection/builders.d.ts +7 -6
  368. package/dist/lib/v2/projection/builders.d.ts.map +1 -1
  369. package/dist/lib/v2/projection/builders.js +11 -8
  370. package/dist/lib/v2/projection/builders.js.map +1 -1
  371. package/dist/lib/v2/projection/builders.mjs +9 -6
  372. package/dist/lib/v2/projection/builders.mjs.map +1 -1
  373. package/dist/lib/v2/projection/catalog-snapshot.d.mts +47 -0
  374. package/dist/lib/v2/projection/catalog-snapshot.d.ts +48 -0
  375. package/dist/lib/v2/projection/catalog-snapshot.d.ts.map +1 -0
  376. package/dist/lib/v2/projection/catalog-snapshot.js +291 -0
  377. package/dist/lib/v2/projection/catalog-snapshot.js.map +1 -0
  378. package/dist/lib/v2/projection/catalog-snapshot.mjs +265 -0
  379. package/dist/lib/v2/projection/catalog-snapshot.mjs.map +1 -0
  380. package/dist/lib/v2/projection/catalog.d.mts +23 -2
  381. package/dist/lib/v2/projection/catalog.d.ts +23 -2
  382. package/dist/lib/v2/projection/catalog.d.ts.map +1 -1
  383. package/dist/lib/v2/projection/catalog.js +34 -10
  384. package/dist/lib/v2/projection/catalog.js.map +1 -1
  385. package/dist/lib/v2/projection/catalog.mjs +33 -10
  386. package/dist/lib/v2/projection/catalog.mjs.map +1 -1
  387. package/dist/lib/v2/projection/creative-delivery.d.mts +157 -0
  388. package/dist/lib/v2/projection/creative-delivery.d.ts +158 -0
  389. package/dist/lib/v2/projection/creative-delivery.d.ts.map +1 -0
  390. package/dist/lib/v2/projection/creative-delivery.js +967 -0
  391. package/dist/lib/v2/projection/creative-delivery.js.map +1 -0
  392. package/dist/lib/v2/projection/creative-delivery.mjs +941 -0
  393. package/dist/lib/v2/projection/creative-delivery.mjs.map +1 -0
  394. package/dist/lib/v2/projection/index.d.mts +8 -6
  395. package/dist/lib/v2/projection/index.d.ts +8 -6
  396. package/dist/lib/v2/projection/index.d.ts.map +1 -1
  397. package/dist/lib/v2/projection/index.js +26 -4
  398. package/dist/lib/v2/projection/index.js.map +1 -1
  399. package/dist/lib/v2/projection/index.mjs +28 -4
  400. package/dist/lib/v2/projection/index.mjs.map +1 -1
  401. package/dist/lib/v2/projection/legacy-metadata.d.mts +21 -0
  402. package/dist/lib/v2/projection/legacy-metadata.d.ts +22 -0
  403. package/dist/lib/v2/projection/legacy-metadata.d.ts.map +1 -0
  404. package/dist/lib/v2/projection/legacy-metadata.js +73 -0
  405. package/dist/lib/v2/projection/legacy-metadata.js.map +1 -0
  406. package/dist/lib/v2/projection/legacy-metadata.mjs +45 -0
  407. package/dist/lib/v2/projection/legacy-metadata.mjs.map +1 -0
  408. package/dist/lib/v2/projection/types.d.mts +29 -23
  409. package/dist/lib/v2/projection/types.d.ts +29 -23
  410. package/dist/lib/v2/projection/types.d.ts.map +1 -1
  411. package/dist/lib/v2/projection/types.js.map +1 -1
  412. package/dist/lib/v2/projection/v1-to-v2.d.mts +29 -6
  413. package/dist/lib/v2/projection/v1-to-v2.d.ts +29 -6
  414. package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
  415. package/dist/lib/v2/projection/v1-to-v2.js +218 -9
  416. package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
  417. package/dist/lib/v2/projection/v1-to-v2.mjs +219 -10
  418. package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
  419. package/dist/lib/v2/projection/v2-to-v1.d.mts +31 -2
  420. package/dist/lib/v2/projection/v2-to-v1.d.ts +31 -2
  421. package/dist/lib/v2/projection/v2-to-v1.d.ts.map +1 -1
  422. package/dist/lib/v2/projection/v2-to-v1.js +138 -7
  423. package/dist/lib/v2/projection/v2-to-v1.js.map +1 -1
  424. package/dist/lib/v2/projection/v2-to-v1.mjs +135 -6
  425. package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
  426. package/dist/lib/v2/projection/write-side.d.mts +12 -13
  427. package/dist/lib/v2/projection/write-side.d.ts +12 -13
  428. package/dist/lib/v2/projection/write-side.d.ts.map +1 -1
  429. package/dist/lib/v2/projection/write-side.js +16 -12
  430. package/dist/lib/v2/projection/write-side.js.map +1 -1
  431. package/dist/lib/v2/projection/write-side.mjs +16 -12
  432. package/dist/lib/v2/projection/write-side.mjs.map +1 -1
  433. package/dist/lib/version.d.mts +3 -3
  434. package/dist/lib/version.d.ts +3 -3
  435. package/dist/lib/version.d.ts.map +1 -1
  436. package/dist/lib/version.js +3 -3
  437. package/dist/lib/version.js.map +1 -1
  438. package/dist/lib/version.mjs +3 -3
  439. package/dist/lib/version.mjs.map +1 -1
  440. package/docs/guides/BUILD-AN-AGENT.md +7 -2
  441. package/docs/guides/PREVIEW-ASSET-DURABILITY.md +6 -2
  442. package/docs/llms.txt +1 -0
  443. package/examples/README.md +1 -1
  444. package/examples/batch-preview-test.ts +3 -3
  445. package/examples/conversation-client.ts +2 -2
  446. package/examples/debug-preview-response.ts +1 -1
  447. package/examples/decisioning-platform-broadcast-tv.ts +10 -4
  448. package/examples/decisioning-platform-mock-seller.ts +16 -9
  449. package/examples/decisioning-platform-programmatic.ts +18 -7
  450. package/examples/error-compliant-server.ts +26 -16
  451. package/examples/generative-creative-demo.ts +7 -19
  452. package/examples/hello_creative_adapter_ad_server.ts +37 -16
  453. package/examples/hello_creative_adapter_template.ts +12 -10
  454. package/examples/hello_seller_adapter_guaranteed.ts +52 -23
  455. package/examples/hello_seller_adapter_multi_tenant.ts +6 -3
  456. package/examples/hello_seller_adapter_non_guaranteed.ts +54 -26
  457. package/examples/hello_seller_adapter_proposal_mode.ts +40 -14
  458. package/examples/hello_seller_adapter_social.ts +2 -7
  459. package/examples/inspect-card-formats.ts +1 -1
  460. package/examples/simple-getting-started.ts +1 -1
  461. package/examples/test-helpers-demo.ts +1 -1
  462. package/package.json +2 -2
  463. package/skills/build-decisioning-creative-template/SKILL.md +11 -11
  464. package/skills/build-decisioning-platform/advanced/REFERENCE.md +8 -2
@@ -1,7 +1,134 @@
1
1
  import { projectV1ProductToV2 } from "./v1-to-v2.mjs";
2
2
  import { LIBRARY_VERSION } from "../../version.mjs";
3
+ import { canonicalize as canonicalizeJson } from "../../utils/jcs.mjs";
4
+ import { concealLegacyFormatRefs } from "./legacy-metadata.mjs";
3
5
  const SDK_ID = `@adcp/sdk@${LIBRARY_VERSION}`;
4
- function augmentProductWithFormatOptions(product) {
6
+ function canonicalDiagnostic(diagnostic) {
7
+ return {
8
+ ...diagnostic,
9
+ // A source `format_ids[i]` index is not an index into the projected
10
+ // `format_options[]`: earlier source refs may have failed while later refs
11
+ // projected successfully. Point at the canonical collection instead of
12
+ // claiming that a successful projected option is the failing value.
13
+ field: diagnostic.field.replace(/\.format_ids\[\d+\]/g, ".format_options")
14
+ };
15
+ }
16
+ function projectionErrorMessage(code) {
17
+ switch (code) {
18
+ case "CANONICAL_PRODUCT_FORMATS_UNAVAILABLE":
19
+ return "Product has no format declaration representable on the canonical-only surface";
20
+ case "FORMAT_PROJECTION_FAILED":
21
+ return "Legacy creative format could not be projected to a canonical declaration";
22
+ case "FORMAT_DECLARATION_V1_AMBIGUOUS":
23
+ return "Canonical creative format has no unambiguous legacy declaration";
24
+ case "FORMAT_DECLARATION_V1_NOT_APPLICABLE":
25
+ return "Canonical-only creative format cannot be represented on a legacy format path";
26
+ case "CANONICAL_NOT_V1_TRANSLATABLE":
27
+ return "Canonical creative format has no legacy representation";
28
+ case "FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE":
29
+ return "Canonical multi-size format has incomplete legacy coverage";
30
+ case "LEGACY_FORMAT_ID_DROPPED_UNMAPPED":
31
+ return "Redundant legacy creative identity has no canonical counterpart";
32
+ }
33
+ }
34
+ function projectionDiagnosticToError(diagnostic) {
35
+ return {
36
+ code: diagnostic.code,
37
+ message: projectionErrorMessage(diagnostic.code),
38
+ field: diagnostic.field,
39
+ recovery: "correctable",
40
+ source: diagnostic.source,
41
+ sdk_id: diagnostic.sdk_id,
42
+ details: diagnostic.error.details
43
+ };
44
+ }
45
+ function canonicalFormatsUnavailableForProduct(product, reason) {
46
+ return {
47
+ source: "sdk",
48
+ sdk_id: SDK_ID,
49
+ field: `products[${product.product_id}].format_options`,
50
+ code: "CANONICAL_PRODUCT_FORMATS_UNAVAILABLE",
51
+ error: {
52
+ details: {
53
+ product_id: product.product_id,
54
+ reason
55
+ }
56
+ }
57
+ };
58
+ }
59
+ function errorIdentity(value) {
60
+ if (typeof value.code !== "string" || typeof value.field !== "string") return void 0;
61
+ try {
62
+ return `${value.code}\0${value.field}\0${canonicalizeJson(value.details ?? null)}`;
63
+ } catch {
64
+ return void 0;
65
+ }
66
+ }
67
+ function mergeProjectionErrors(existing, diagnostics) {
68
+ const merged = Array.isArray(existing) ? [...existing] : [];
69
+ const seen = /* @__PURE__ */ new Set();
70
+ for (const value of merged) {
71
+ if (!value || typeof value !== "object" || Array.isArray(value)) continue;
72
+ const record = value;
73
+ const key = errorIdentity(record);
74
+ if (key) seen.add(key);
75
+ }
76
+ for (const diagnostic of diagnostics) {
77
+ const error = projectionDiagnosticToError(diagnostic);
78
+ const key = errorIdentity(error);
79
+ if (seen.has(key)) continue;
80
+ seen.add(key);
81
+ merged.push(error);
82
+ }
83
+ return merged;
84
+ }
85
+ function remapExistingProductErrors(existing, originalToOutputIndex, products) {
86
+ if (!Array.isArray(existing)) return existing;
87
+ return existing.map((value) => {
88
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
89
+ const record = value;
90
+ let issuesChanged = false;
91
+ const issues = Array.isArray(record.issues) ? record.issues.map((issue) => {
92
+ if (!issue || typeof issue !== "object" || Array.isArray(issue)) return issue;
93
+ const issueRecord = issue;
94
+ if (typeof issueRecord.pointer !== "string") return issue;
95
+ const pointerMatch = /^\/products\/(\d+)(\/.*)?$/.exec(issueRecord.pointer);
96
+ if (!pointerMatch) return issue;
97
+ const originalIssueIndex = Number(pointerMatch[1]);
98
+ if (!originalToOutputIndex.has(originalIssueIndex)) return issue;
99
+ const outputIssueIndex = originalToOutputIndex.get(originalIssueIndex);
100
+ issuesChanged = true;
101
+ return {
102
+ ...issueRecord,
103
+ pointer: outputIssueIndex === void 0 ? "/products" : `/products/${outputIssueIndex}${pointerMatch[2] ?? ""}`
104
+ };
105
+ }) : record.issues;
106
+ const withIssues = issuesChanged ? { ...record, issues } : record;
107
+ if (typeof record.field !== "string") return issuesChanged ? withIssues : value;
108
+ const match = /^products\[(\d+)\](.*)$/.exec(record.field);
109
+ if (!match) return issuesChanged ? withIssues : value;
110
+ const originalIndex = Number(match[1]);
111
+ if (!originalToOutputIndex.has(originalIndex)) return issuesChanged ? withIssues : value;
112
+ const outputIndex = originalToOutputIndex.get(originalIndex);
113
+ if (outputIndex !== void 0) {
114
+ return { ...withIssues, field: `products[${outputIndex}]${match[2] ?? ""}` };
115
+ }
116
+ const productId = products[originalIndex]?.product_id;
117
+ const details = record.details && typeof record.details === "object" && !Array.isArray(record.details) ? { ...record.details } : {};
118
+ if (typeof productId === "string" && details.product_id === void 0) details.product_id = productId;
119
+ return { ...withIssues, field: "products", ...Object.keys(details).length > 0 ? { details } : {} };
120
+ });
121
+ }
122
+ function hasEmptyPlacementFormatOptions(product) {
123
+ const placements = product.placements;
124
+ if (!Array.isArray(placements)) return false;
125
+ return placements.some((value) => {
126
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
127
+ const options = value.format_options;
128
+ return Array.isArray(options) && options.length === 0;
129
+ });
130
+ }
131
+ function augmentProductWithFormatOptions(product, options) {
5
132
  const existing = product.format_options;
6
133
  if (Array.isArray(existing)) {
7
134
  return {
@@ -15,7 +142,7 @@ function augmentProductWithFormatOptions(product) {
15
142
  diagnostics: []
16
143
  };
17
144
  }
18
- const { v2, diagnostics } = projectV1ProductToV2(product);
145
+ const { v2, diagnostics } = projectV1ProductToV2(product, options);
19
146
  return {
20
147
  product: {
21
148
  ...product,
@@ -24,7 +151,7 @@ function augmentProductWithFormatOptions(product) {
24
151
  diagnostics
25
152
  };
26
153
  }
27
- function withFormatOptions(response) {
154
+ function withFormatOptions(response, options) {
28
155
  if (!Array.isArray(response?.products)) {
29
156
  return {
30
157
  response: { ...response, products: [] },
@@ -34,7 +161,7 @@ function withFormatOptions(response) {
34
161
  const out = [];
35
162
  const diagnostics = [];
36
163
  for (const p of response.products) {
37
- const { product, diagnostics: d } = augmentProductWithFormatOptions(p);
164
+ const { product, diagnostics: d } = augmentProductWithFormatOptions(p, options);
38
165
  out.push(product);
39
166
  diagnostics.push(...d);
40
167
  }
@@ -43,15 +170,50 @@ function withFormatOptions(response) {
43
170
  diagnostics
44
171
  };
45
172
  }
173
+ function canonicalDeclarations(values) {
174
+ return values.map((value) => concealLegacyFormatRefs(value));
175
+ }
176
+ function canonicalPlacements(product, options, diagnostics) {
177
+ if (!Array.isArray(product.placements)) return product.placements;
178
+ return product.placements.map((value, placementIndex) => {
179
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
180
+ const placement = value;
181
+ const { format_ids: _drop, ...rest } = placement;
182
+ void _drop;
183
+ const hasLegacyFormats = Array.isArray(placement.format_ids);
184
+ const hasCanonicalFormats = Array.isArray(placement.format_options);
185
+ if (!hasLegacyFormats && !hasCanonicalFormats) return rest;
186
+ const productId = typeof product.product_id === "string" ? product.product_id : "(unknown)";
187
+ const placementId = typeof placement.placement_id === "string" ? placement.placement_id : String(placementIndex);
188
+ const pseudoProduct = {
189
+ product_id: `${productId}:placement:${placementId}`,
190
+ name: typeof placement.name === "string" ? placement.name : placementId,
191
+ description: `Nested placement ${placementId}`,
192
+ ...hasLegacyFormats ? { format_ids: placement.format_ids } : {},
193
+ ...hasCanonicalFormats ? { format_options: placement.format_options } : {}
194
+ };
195
+ const projected = toCanonicalOnlyProduct(pseudoProduct, options);
196
+ for (const diagnostic of projected.diagnostics) {
197
+ diagnostics.push({
198
+ ...diagnostic,
199
+ field: diagnostic.field.replace(/^products\[[^\]]+\]/, `products[${productId}].placements[${placementIndex}]`)
200
+ });
201
+ }
202
+ return {
203
+ ...rest,
204
+ format_options: projected.product.format_options
205
+ };
206
+ });
207
+ }
46
208
  function formatRefCoverageKey(ref) {
47
209
  const url = ref.agent_url && !ref.agent_url.endsWith("/") ? ref.agent_url + "/" : ref.agent_url;
48
210
  return `${url}::${ref.id}::${ref.width ?? ""}x${ref.height ?? ""}::${ref.duration_ms ?? ""}`;
49
211
  }
50
- function toCanonicalOnlyProduct(product) {
212
+ function toCanonicalOnlyProduct(product, options) {
51
213
  const existing = product.format_options;
52
214
  if (Array.isArray(existing)) {
53
215
  const formatOptions = existing;
54
- const diagnostics = [];
216
+ const diagnostics2 = [];
55
217
  const inputIds = Array.isArray(product.format_ids) ? product.format_ids : [];
56
218
  if (inputIds.length > 0) {
57
219
  const covered = /* @__PURE__ */ new Set();
@@ -62,22 +224,15 @@ function toCanonicalOnlyProduct(product) {
62
224
  for (let k = 0; k < inputIds.length; k++) {
63
225
  const fid = inputIds[k];
64
226
  if (!covered.has(formatRefCoverageKey(fid))) {
65
- const dropped_format_id = { agent_url: fid.agent_url, id: fid.id };
66
- if (typeof fid.width === "number") dropped_format_id.width = fid.width;
67
- if (typeof fid.height === "number") dropped_format_id.height = fid.height;
68
- if (typeof fid.duration_ms === "number") dropped_format_id.duration_ms = fid.duration_ms;
69
- diagnostics.push({
227
+ diagnostics2.push({
70
228
  source: "sdk",
71
229
  sdk_id: SDK_ID,
72
- // Indexed to match the v1→v2 projection path's
73
- // `products[id].format_ids[K]` so consumers correlate diagnostics
74
- // by `field` shape across both paths.
75
- field: `products[${product.product_id}].format_ids[${k}]`,
230
+ field: `products[${product.product_id}].format_options`,
76
231
  code: "LEGACY_FORMAT_ID_DROPPED_UNMAPPED",
77
232
  error: {
78
233
  details: {
79
234
  product_id: product.product_id,
80
- dropped_format_id
235
+ resolution_failure: "unmapped_legacy_format"
81
236
  }
82
237
  }
83
238
  });
@@ -86,25 +241,41 @@ function toCanonicalOnlyProduct(product) {
86
241
  }
87
242
  const { format_ids: _dropV2, ...rest2 } = product;
88
243
  void _dropV2;
89
- return { product: rest2, diagnostics };
244
+ return {
245
+ product: {
246
+ ...rest2,
247
+ format_options: canonicalDeclarations(formatOptions),
248
+ ...Array.isArray(product.placements) ? { placements: canonicalPlacements(product, options, diagnostics2) } : {}
249
+ },
250
+ diagnostics: diagnostics2.map(canonicalDiagnostic)
251
+ };
90
252
  }
91
253
  if (Array.isArray(product.format_ids)) {
92
- const { v2, diagnostics } = projectV1ProductToV2(product);
254
+ const { v2, diagnostics: diagnostics2 } = projectV1ProductToV2(product, options);
93
255
  const { format_ids: _dropV1, ...rest2 } = product;
94
256
  void _dropV1;
95
257
  return {
96
- product: { ...rest2, format_options: v2.format_options },
97
- diagnostics
258
+ product: {
259
+ ...rest2,
260
+ format_options: canonicalDeclarations(v2.format_options),
261
+ ...Array.isArray(product.placements) ? { placements: canonicalPlacements(product, options, diagnostics2) } : {}
262
+ },
263
+ diagnostics: diagnostics2.map(canonicalDiagnostic)
98
264
  };
99
265
  }
100
266
  const { format_ids: _dropNone, ...rest } = product;
101
267
  void _dropNone;
268
+ const diagnostics = [];
102
269
  return {
103
- product: { ...rest, format_options: [] },
104
- diagnostics: []
270
+ product: {
271
+ ...rest,
272
+ format_options: [],
273
+ ...Array.isArray(product.placements) ? { placements: canonicalPlacements(product, options, diagnostics) } : {}
274
+ },
275
+ diagnostics: diagnostics.map(canonicalDiagnostic)
105
276
  };
106
277
  }
107
- function toCanonicalOnlyResponse(response) {
278
+ function toCanonicalOnlyResponse(response, options) {
108
279
  if (!Array.isArray(response?.products)) {
109
280
  return {
110
281
  response: { ...response, products: [] },
@@ -113,18 +284,52 @@ function toCanonicalOnlyResponse(response) {
113
284
  }
114
285
  const out = [];
115
286
  const diagnostics = [];
116
- for (const p of response.products) {
117
- const { product, diagnostics: d } = toCanonicalOnlyProduct(p);
118
- out.push(product);
287
+ const originalToOutputIndex = /* @__PURE__ */ new Map();
288
+ for (let productIndex = 0; productIndex < response.products.length; productIndex++) {
289
+ const p = response.products[productIndex];
290
+ const { product, diagnostics: rawDiagnostics } = toCanonicalOnlyProduct(p, options);
291
+ const hasEmptyPlacement = hasEmptyPlacementFormatOptions(product);
292
+ const keep = product.format_options.length > 0 && !hasEmptyPlacement;
293
+ const outputIndex = keep ? out.length : void 0;
294
+ originalToOutputIndex.set(productIndex, outputIndex);
295
+ const d = rawDiagnostics.map((diagnostic) => ({
296
+ ...diagnostic,
297
+ field: keep ? diagnostic.field.replace(/^products\[[^\]]+\]/, `products[${outputIndex}]`) : "products",
298
+ error: keep ? diagnostic.error : {
299
+ details: {
300
+ ...diagnostic.error.details,
301
+ product_id: p.product_id
302
+ }
303
+ }
304
+ }));
305
+ if (!keep && d.length === 0) {
306
+ const reason = hasEmptyPlacement ? "nested_placement_format_list_empty" : Array.isArray(p.format_options) ? "canonical_format_list_empty" : Array.isArray(p.format_ids) ? "legacy_format_list_empty" : "missing_format_declaration";
307
+ d.push({
308
+ ...canonicalFormatsUnavailableForProduct(p, reason),
309
+ field: "products"
310
+ });
311
+ }
119
312
  diagnostics.push(...d);
313
+ if (keep) out.push(product);
120
314
  }
315
+ const remappedExistingErrors = remapExistingProductErrors(
316
+ response.errors,
317
+ originalToOutputIndex,
318
+ response.products
319
+ );
320
+ const errors = mergeProjectionErrors(remappedExistingErrors, diagnostics);
121
321
  return {
122
- response: { ...response, products: out },
322
+ response: {
323
+ ...response,
324
+ products: out,
325
+ ...errors.length > 0 ? { errors } : {}
326
+ },
123
327
  diagnostics
124
328
  };
125
329
  }
126
330
  export {
127
331
  augmentProductWithFormatOptions,
332
+ projectionDiagnosticToError,
128
333
  toCanonicalOnlyProduct,
129
334
  toCanonicalOnlyResponse,
130
335
  withFormatOptions
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/v2/projection/augment-response.ts"],"sourcesContent":["/**\n * Buyer-side helpers that augment a v1-shaped agent response with v2\n * `format_options[]` derived from the existing `format_ids[]` on each\n * Product.\n *\n * Buyers who want the canonical creative-format model call\n * `withFormatOptions(response)` and read `format_options` instead of\n * relying only on legacy `format_ids`.\n *\n * The SDK also auto-projects compatible `AgentClient.getProducts()`\n * responses; this helper remains useful for cached responses, fixtures,\n * upstream seller/storefront composition, and explicit migration code.\n *\n * Pure functions — no IO, no caching. Each Product is projected\n * independently; diagnostics aggregate so a multi-product response\n * surfaces every projection issue at once. The helpers preserve the\n * input shape verbatim and add `format_options[]` (additive). They do\n * NOT drop `format_ids[]` — that's the 8.0 narrowing. To DROP\n * `format_ids[]` once a consumer has fully migrated, use\n * `toCanonicalOnlyProduct` / `toCanonicalOnlyResponse`.\n */\n\nimport type { V1Product, V1FormatId, V2ProductFormatDeclaration, ProjectionDiagnostic } from './types';\nimport { projectV1ProductToV2 } from './v1-to-v2';\nimport { LIBRARY_VERSION } from '../../version';\n\nconst SDK_ID = `@adcp/sdk@${LIBRARY_VERSION}`;\n\n/**\n * A Product that has been augmented with `format_options[]` while\n * preserving the original `format_ids[]`. Carries the projection\n * diagnostics that were generated mapping each `format_id` so the\n * buyer can see what (if anything) didn't project cleanly.\n *\n * **Write-side bridge.** After picking a `format_options[i]` entry,\n * use {@link formatIdsFromOptions} (from `@adcp/sdk/v2/projection`)\n * to extract the `format_ids[]` value for a `create_media_buy`\n * package. Inlining `decl.v1_format_ref` works but bypasses the\n * fail-closed semantics (canonical_formats_only / inherently-v2\n * canonical → throw). The spec gap that forces this bridge is tracked\n * at adcontextprotocol/adcp#4842.\n *\n * @see formatIdsFromOptions\n * @see formatIdsForCapability\n */\nexport type V2AugmentedProduct<P> = P & {\n format_options: V2ProductFormatDeclaration[];\n};\n\n/**\n * Augment a single Product. Idempotent — when `format_options[]` is\n * already present (the seller is v2-native), passes the Product\n * through unchanged. Otherwise projects from `format_ids[]`.\n *\n * Returns `{ product, diagnostics }`. `diagnostics` is empty for a\n * clean projection; populated when individual format_ids don't have\n * a v2 mapping (catalog gap, structural unreachability, etc.).\n *\n * @see toCanonicalOnlyProduct — the canonical-only counterpart that DROPS\n * `format_ids[]` for a fully-migrated consumer.\n */\nexport function augmentProductWithFormatOptions<P extends V1Product>(\n product: P\n): { product: V2AugmentedProduct<P>; diagnostics: ProjectionDiagnostic[] } {\n // Already v2-shaped (seller sent format_options directly) — pass through.\n const existing = (product as unknown as { format_options?: unknown }).format_options;\n if (Array.isArray(existing)) {\n return {\n product: product as V2AugmentedProduct<P>,\n diagnostics: [],\n };\n }\n // v1 shape — project to add format_options[].\n if (!Array.isArray(product.format_ids)) {\n // Neither shape — nothing to project. Return as-is with an empty\n // format_options so the buyer doesn't have to special-case.\n return {\n product: { ...product, format_options: [] },\n diagnostics: [],\n };\n }\n const { v2, diagnostics } = projectV1ProductToV2(product);\n // Preserve the original product shape (especially format_ids); just\n // add format_options.\n return {\n product: {\n ...product,\n format_options: v2.format_options,\n },\n diagnostics,\n };\n}\n\n/**\n * Augment every Product in a `get_products` response with\n * `format_options[]`. Returns `{ response, diagnostics }` so callers\n * can surface projection diagnostics alongside the response's existing\n * `errors[]` array (or filter by `source: 'sdk'` to distinguish SDK\n * diagnostics from seller-emitted errors).\n *\n * Idempotent: if the seller is v2-native and every Product already\n * carries `format_options[]`, returns the response verbatim with no\n * diagnostics.\n *\n * @see toCanonicalOnlyResponse — the canonical-only counterpart that DROPS\n * `format_ids[]` for a fully-migrated consumer.\n */\nexport function withFormatOptions<R extends { products?: V1Product[] }>(\n response: R\n): { response: R & { products: V2AugmentedProduct<V1Product>[] }; diagnostics: ProjectionDiagnostic[] } {\n if (!Array.isArray(response?.products)) {\n return {\n response: { ...response, products: [] } as R & { products: V2AugmentedProduct<V1Product>[] },\n diagnostics: [],\n };\n }\n const out: V2AugmentedProduct<V1Product>[] = [];\n const diagnostics: ProjectionDiagnostic[] = [];\n for (const p of response.products) {\n const { product, diagnostics: d } = augmentProductWithFormatOptions(p);\n out.push(product);\n diagnostics.push(...d);\n }\n return {\n response: { ...response, products: out } as R & { products: V2AugmentedProduct<V1Product>[] },\n diagnostics,\n };\n}\n\n/**\n * A Product reduced to the canonical creative-format surface:\n * `format_options[]` only, with the legacy `format_ids[]` removed. The\n * read-side counterpart to a fully-migrated consumer — naive downstream\n * code can no longer fall back to the stale `{ agent_url, id }` shape and\n * silently bypass the canonical model.\n */\nexport type CanonicalOnlyProduct<P> = Omit<P, 'format_ids'> & {\n format_options: V2ProductFormatDeclaration[];\n};\n\n/**\n * Identity key for a `format_id` ref used by the coverage check.\n * Trailing-slash-insensitive on `agent_url` (folds the AAO host's slash /\n * no-slash forms, per `catalog.ts`'s `normalizeAgentUrl`), and includes the\n * dimensional discriminators so multi-size declarations sharing one\n * `{ agent_url, id }` but differing by size/duration are NOT collapsed —\n * the same key shape `write-side.ts` uses for v1 ref de-dup. Without the\n * size half, a `format_ids[]` entry for a size no `v1_format_ref` covers\n * would read as covered and be dropped silently.\n */\nfunction formatRefCoverageKey(ref: V1FormatId): string {\n const url = ref.agent_url && !ref.agent_url.endsWith('/') ? ref.agent_url + '/' : ref.agent_url;\n return `${url}::${ref.id}::${ref.width ?? ''}x${ref.height ?? ''}::${ref.duration_ms ?? ''}`;\n}\n\n/**\n * Project a single Product to the canonical-only shape: `format_options[]`\n * present, `format_ids[]` dropped.\n *\n * **Dropping legacy never silently loses a format.** Every input\n * `format_id` is either represented in the returned `format_options[]` or\n * surfaced in `diagnostics` — never discarded without a trace:\n *\n * - **v1-shaped input** (`format_ids[]`, no `format_options[]`): runs the\n * v1 → v2 projection. Mapped refs become `format_options[]`; any ref\n * the projection can't map is surfaced as `FORMAT_PROJECTION_FAILED`.\n * - **v2-native input** (`format_options[]` already present): keeps the\n * seller's canonical surface and drops the redundant v1 fallback. If a\n * `format_ids[]` entry exists that no `format_options[].v1_format_ref`\n * covers, it surfaces as `LEGACY_FORMAT_ID_DROPPED_UNMAPPED` — the gap\n * the projection path can't see.\n * - **neither shape**: returns `format_options: []`; there is nothing to\n * project and nothing to lose.\n *\n * Pure and subtractive: unlike {@link augmentProductWithFormatOptions}\n * (which preserves `format_ids[]`), this drops it — the opt-in narrowing for\n * a consumer that has fully migrated. Complements the write-side\n * non-invertibility tracked at adcontextprotocol/adcp#4842 — this is the\n * read-side transparency half.\n */\nexport function toCanonicalOnlyProduct<P extends V1Product>(\n product: P\n): { product: CanonicalOnlyProduct<P>; diagnostics: ProjectionDiagnostic[] } {\n const existing = (product as unknown as { format_options?: unknown }).format_options;\n\n // v2-native: the seller already sent format_options[]. Drop the\n // redundant v1 fallback, but flag any legacy ref no v1_format_ref covers.\n if (Array.isArray(existing)) {\n const formatOptions = existing as V2ProductFormatDeclaration[];\n const diagnostics: ProjectionDiagnostic[] = [];\n const inputIds = Array.isArray(product.format_ids) ? product.format_ids : [];\n if (inputIds.length > 0) {\n const covered = new Set<string>();\n for (const opt of formatOptions) {\n const refs = Array.isArray(opt?.v1_format_ref) ? opt.v1_format_ref : [];\n for (const ref of refs) covered.add(formatRefCoverageKey(ref));\n }\n for (let k = 0; k < inputIds.length; k++) {\n const fid = inputIds[k]!;\n if (!covered.has(formatRefCoverageKey(fid))) {\n // Echo the full ref the SDK saw — including dimensions — so a\n // buyer can tell WHICH variant was dropped (matches the\n // FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE size-in-details contract).\n const dropped_format_id: {\n agent_url: string;\n id: string;\n width?: number;\n height?: number;\n duration_ms?: number;\n } = { agent_url: fid.agent_url, id: fid.id };\n if (typeof fid.width === 'number') dropped_format_id.width = fid.width;\n if (typeof fid.height === 'number') dropped_format_id.height = fid.height;\n if (typeof fid.duration_ms === 'number') dropped_format_id.duration_ms = fid.duration_ms;\n diagnostics.push({\n source: 'sdk',\n sdk_id: SDK_ID,\n // Indexed to match the v1→v2 projection path's\n // `products[id].format_ids[K]` so consumers correlate diagnostics\n // by `field` shape across both paths.\n field: `products[${product.product_id}].format_ids[${k}]`,\n code: 'LEGACY_FORMAT_ID_DROPPED_UNMAPPED',\n error: {\n details: {\n product_id: product.product_id,\n dropped_format_id,\n },\n },\n });\n }\n }\n }\n const { format_ids: _dropV2, ...rest } = product as P & { format_ids?: unknown };\n void _dropV2;\n return { product: rest as CanonicalOnlyProduct<P>, diagnostics };\n }\n\n // v1 shape: project. projectV1ProductToV2 already omits format_ids and\n // emits a diagnostic for every ref it couldn't map.\n if (Array.isArray(product.format_ids)) {\n const { v2, diagnostics } = projectV1ProductToV2(product);\n const { format_ids: _dropV1, ...rest } = product as P & { format_ids?: unknown };\n void _dropV1;\n return {\n product: { ...(rest as Omit<P, 'format_ids'>), format_options: v2.format_options } as CanonicalOnlyProduct<P>,\n diagnostics,\n };\n }\n\n // Neither shape — nothing to project, nothing to lose.\n const { format_ids: _dropNone, ...rest } = product as P & { format_ids?: unknown };\n void _dropNone;\n return {\n product: { ...(rest as Omit<P, 'format_ids'>), format_options: [] } as CanonicalOnlyProduct<P>,\n diagnostics: [],\n };\n}\n\n/**\n * Reduce every Product in a `get_products` response to the canonical-only\n * shape — `format_options[]` present, `format_ids[]` dropped. Returns\n * `{ response, diagnostics }` so callers surface projection diagnostics\n * alongside the response's existing `errors[]`.\n *\n * Response-level counterpart to {@link toCanonicalOnlyProduct}; same\n * never-silently-lose-a-format guarantee, aggregated across products. The\n * canonical-only sibling of {@link withFormatOptions} (which is additive\n * and preserves `format_ids[]`).\n */\nexport function toCanonicalOnlyResponse<R extends { products?: V1Product[] }>(\n response: R\n): {\n response: Omit<R, 'products'> & { products: CanonicalOnlyProduct<V1Product>[] };\n diagnostics: ProjectionDiagnostic[];\n} {\n if (!Array.isArray(response?.products)) {\n return {\n response: { ...response, products: [] } as Omit<R, 'products'> & { products: CanonicalOnlyProduct<V1Product>[] },\n diagnostics: [],\n };\n }\n const out: CanonicalOnlyProduct<V1Product>[] = [];\n const diagnostics: ProjectionDiagnostic[] = [];\n for (const p of response.products) {\n const { product, diagnostics: d } = toCanonicalOnlyProduct(p);\n out.push(product);\n diagnostics.push(...d);\n }\n return {\n response: { ...response, products: out } as Omit<R, 'products'> & { products: CanonicalOnlyProduct<V1Product>[] },\n diagnostics,\n };\n}\n"],"mappings":"AAuBA,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAEhC,MAAM,SAAS,aAAa,eAAe;AAmCpC,SAAS,gCACd,SACyE;AAEzE,QAAM,WAAY,QAAoD;AACtE,MAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,WAAO;AAAA,MACL;AAAA,MACA,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AAEA,MAAI,CAAC,MAAM,QAAQ,QAAQ,UAAU,GAAG;AAGtC,WAAO;AAAA,MACL,SAAS,EAAE,GAAG,SAAS,gBAAgB,CAAC,EAAE;AAAA,MAC1C,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACA,QAAM,EAAE,IAAI,YAAY,IAAI,qBAAqB,OAAO;AAGxD,SAAO;AAAA,IACL,SAAS;AAAA,MACP,GAAG;AAAA,MACH,gBAAgB,GAAG;AAAA,IACrB;AAAA,IACA;AAAA,EACF;AACF;AAgBO,SAAS,kBACd,UACsG;AACtG,MAAI,CAAC,MAAM,QAAQ,UAAU,QAAQ,GAAG;AACtC,WAAO;AAAA,MACL,UAAU,EAAE,GAAG,UAAU,UAAU,CAAC,EAAE;AAAA,MACtC,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACA,QAAM,MAAuC,CAAC;AAC9C,QAAM,cAAsC,CAAC;AAC7C,aAAW,KAAK,SAAS,UAAU;AACjC,UAAM,EAA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AACA,SAAO;AAAA,IACL,UAAU,EAAE,GAAG,UAAU,UAAU,IAAI;AAAA,IACvC;AAAA,EACF;AACF;","names":["rest"]}
1
+ {"version":3,"sources":["../../../../src/lib/v2/projection/augment-response.ts"],"sourcesContent":["/**\n * Buyer-side helpers that augment a v1-shaped agent response with v2\n * `format_options[]` derived from the existing `format_ids[]` on each\n * Product.\n *\n * Buyers who want the canonical creative-format model call\n * `withFormatOptions(response)` and read `format_options` instead of\n * relying only on legacy `format_ids`.\n *\n * The SDK also auto-projects compatible `AgentClient.getProducts()`\n * responses; this helper remains useful for cached responses, fixtures,\n * upstream seller/storefront composition, and explicit migration code.\n *\n * Pure functions — no IO, no caching. Each Product is projected\n * independently; diagnostics aggregate so a multi-product response\n * surfaces every projection issue at once. The helpers preserve the\n * input shape verbatim and add `format_options[]` (additive). They do\n * NOT drop `format_ids[]` — that's the 8.0 narrowing. To DROP\n * `format_ids[]` once a consumer has fully migrated, use\n * `toCanonicalOnlyProduct` / `toCanonicalOnlyResponse`.\n */\n\nimport type { V1Product, V1FormatId, V2ProductFormatDeclaration, ProjectionDiagnostic } from './types';\nimport { projectV1ProductToV2 } from './v1-to-v2';\nimport type { V1ToV2ProjectionOptions } from './v1-to-v2';\nimport { LIBRARY_VERSION } from '../../version';\nimport { canonicalize as canonicalizeJson } from '../../utils/jcs';\nimport { concealLegacyFormatRefs } from './legacy-metadata';\nimport type { CanonicalFormatDeclaration } from './legacy-metadata';\n\nconst SDK_ID = `@adcp/sdk@${LIBRARY_VERSION}`;\n\nfunction canonicalDiagnostic(diagnostic: ProjectionDiagnostic): ProjectionDiagnostic {\n return {\n ...diagnostic,\n // A source `format_ids[i]` index is not an index into the projected\n // `format_options[]`: earlier source refs may have failed while later refs\n // projected successfully. Point at the canonical collection instead of\n // claiming that a successful projected option is the failing value.\n field: diagnostic.field.replace(/\\.format_ids\\[\\d+\\]/g, '.format_options'),\n };\n}\n\n/** Protocol Error shape used for portable response-level projection advisories. */\nexport interface CanonicalProjectionError {\n code: ProjectionDiagnostic['code'];\n message: string;\n field: string;\n recovery: 'correctable';\n source: 'sdk';\n sdk_id: string;\n details: ProjectionDiagnostic['error']['details'];\n}\n\nfunction projectionErrorMessage(code: ProjectionDiagnostic['code']): string {\n switch (code) {\n case 'CANONICAL_PRODUCT_FORMATS_UNAVAILABLE':\n return 'Product has no format declaration representable on the canonical-only surface';\n case 'FORMAT_PROJECTION_FAILED':\n return 'Legacy creative format could not be projected to a canonical declaration';\n case 'FORMAT_DECLARATION_V1_AMBIGUOUS':\n return 'Canonical creative format has no unambiguous legacy declaration';\n case 'FORMAT_DECLARATION_V1_NOT_APPLICABLE':\n return 'Canonical-only creative format cannot be represented on a legacy format path';\n case 'CANONICAL_NOT_V1_TRANSLATABLE':\n return 'Canonical creative format has no legacy representation';\n case 'FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE':\n return 'Canonical multi-size format has incomplete legacy coverage';\n case 'LEGACY_FORMAT_ID_DROPPED_UNMAPPED':\n return 'Redundant legacy creative identity has no canonical counterpart';\n }\n}\n\n/** Flatten the projector's internal diagnostic into the protocol `Error` shape. */\nexport function projectionDiagnosticToError(diagnostic: ProjectionDiagnostic): CanonicalProjectionError {\n return {\n code: diagnostic.code,\n message: projectionErrorMessage(diagnostic.code),\n field: diagnostic.field,\n recovery: 'correctable',\n source: diagnostic.source,\n sdk_id: diagnostic.sdk_id,\n details: diagnostic.error.details,\n } as CanonicalProjectionError;\n}\n\nfunction canonicalFormatsUnavailableForProduct(\n product: V1Product,\n reason: Extract<ProjectionDiagnostic, { code: 'CANONICAL_PRODUCT_FORMATS_UNAVAILABLE' }>['error']['details']['reason']\n): ProjectionDiagnostic {\n return {\n source: 'sdk',\n sdk_id: SDK_ID,\n field: `products[${product.product_id}].format_options`,\n code: 'CANONICAL_PRODUCT_FORMATS_UNAVAILABLE',\n error: {\n details: {\n product_id: product.product_id,\n reason,\n },\n },\n };\n}\n\nfunction errorIdentity(value: Record<string, unknown>): string | undefined {\n if (typeof value.code !== 'string' || typeof value.field !== 'string') return undefined;\n try {\n return `${value.code}\\u0000${value.field}\\u0000${canonicalizeJson(value.details ?? null)}`;\n } catch {\n // Preserve unreadable third-party errors instead of falsely deduplicating.\n return undefined;\n }\n}\n\nfunction mergeProjectionErrors(existing: unknown, diagnostics: readonly ProjectionDiagnostic[]): unknown[] {\n const merged = Array.isArray(existing) ? [...existing] : [];\n const seen = new Set<string>();\n for (const value of merged) {\n if (!value || typeof value !== 'object' || Array.isArray(value)) continue;\n const record = value as Record<string, unknown>;\n const key = errorIdentity(record);\n if (key) seen.add(key);\n }\n for (const diagnostic of diagnostics) {\n const error = projectionDiagnosticToError(diagnostic) as unknown as Record<string, unknown>;\n const key = errorIdentity(error)!;\n if (seen.has(key)) continue;\n seen.add(key);\n merged.push(error);\n }\n return merged;\n}\n\nfunction remapExistingProductErrors(\n existing: unknown,\n originalToOutputIndex: ReadonlyMap<number, number | undefined>,\n products: readonly V1Product[]\n): unknown {\n if (!Array.isArray(existing)) return existing;\n return existing.map(value => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return value;\n const record = value as Record<string, unknown>;\n let issuesChanged = false;\n const issues = Array.isArray(record.issues)\n ? record.issues.map(issue => {\n if (!issue || typeof issue !== 'object' || Array.isArray(issue)) return issue;\n const issueRecord = issue as Record<string, unknown>;\n if (typeof issueRecord.pointer !== 'string') return issue;\n const pointerMatch = /^\\/products\\/(\\d+)(\\/.*)?$/.exec(issueRecord.pointer);\n if (!pointerMatch) return issue;\n const originalIssueIndex = Number(pointerMatch[1]);\n if (!originalToOutputIndex.has(originalIssueIndex)) return issue;\n const outputIssueIndex = originalToOutputIndex.get(originalIssueIndex);\n issuesChanged = true;\n return {\n ...issueRecord,\n pointer:\n outputIssueIndex === undefined ? '/products' : `/products/${outputIssueIndex}${pointerMatch[2] ?? ''}`,\n };\n })\n : record.issues;\n const withIssues = issuesChanged ? { ...record, issues } : record;\n if (typeof record.field !== 'string') return issuesChanged ? withIssues : value;\n const match = /^products\\[(\\d+)\\](.*)$/.exec(record.field);\n if (!match) return issuesChanged ? withIssues : value;\n const originalIndex = Number(match[1]);\n if (!originalToOutputIndex.has(originalIndex)) return issuesChanged ? withIssues : value;\n const outputIndex = originalToOutputIndex.get(originalIndex);\n if (outputIndex !== undefined) {\n return { ...withIssues, field: `products[${outputIndex}]${match[2] ?? ''}` };\n }\n const productId = products[originalIndex]?.product_id;\n const details =\n record.details && typeof record.details === 'object' && !Array.isArray(record.details)\n ? { ...(record.details as Record<string, unknown>) }\n : {};\n if (typeof productId === 'string' && details.product_id === undefined) details.product_id = productId;\n return { ...withIssues, field: 'products', ...(Object.keys(details).length > 0 ? { details } : {}) };\n });\n}\n\nfunction hasEmptyPlacementFormatOptions(product: CanonicalOnlyProduct<V1Product>): boolean {\n const placements = (product as Record<string, unknown>).placements;\n if (!Array.isArray(placements)) return false;\n return placements.some(value => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false;\n const options = (value as Record<string, unknown>).format_options;\n return Array.isArray(options) && options.length === 0;\n });\n}\n\n/**\n * A Product that has been augmented with `format_options[]` while\n * preserving the original `format_ids[]`. Carries the projection\n * diagnostics that were generated mapping each `format_id` so the\n * buyer can see what (if anything) didn't project cleanly.\n *\n * **Write-side bridge.** After picking a `format_options[i]` entry,\n * use {@link formatIdsFromOptions} (from `@adcp/sdk/v2/projection`)\n * to extract the `format_ids[]` value for a `create_media_buy`\n * package. Inlining `decl.v1_format_ref` works but bypasses the\n * fail-closed semantics (canonical_formats_only / inherently-v2\n * canonical → throw). The spec gap that forces this bridge is tracked\n * at adcontextprotocol/adcp#4842.\n *\n * @see formatIdsFromOptions\n * @see formatIdsForCapability\n */\nexport type V2AugmentedProduct<P> = P & {\n format_options: V2ProductFormatDeclaration[];\n};\n\n/**\n * Augment a single Product. Idempotent — when `format_options[]` is\n * already present (the seller is v2-native), passes the Product\n * through unchanged. Otherwise projects from `format_ids[]`.\n *\n * Returns `{ product, diagnostics }`. `diagnostics` is empty for a\n * clean projection; populated when individual format_ids don't have\n * a v2 mapping (catalog gap, structural unreachability, etc.).\n *\n * @see toCanonicalOnlyProduct — the canonical-only counterpart that DROPS\n * `format_ids[]` for a fully-migrated consumer.\n */\nexport function augmentProductWithFormatOptions<P extends V1Product>(\n product: P,\n options?: V1ToV2ProjectionOptions\n): { product: V2AugmentedProduct<P>; diagnostics: ProjectionDiagnostic[] } {\n // Already v2-shaped (seller sent format_options directly) — pass through.\n const existing = (product as unknown as { format_options?: unknown }).format_options;\n if (Array.isArray(existing)) {\n return {\n product: product as V2AugmentedProduct<P>,\n diagnostics: [],\n };\n }\n // v1 shape — project to add format_options[].\n if (!Array.isArray(product.format_ids)) {\n // Neither shape — nothing to project. Return as-is with an empty\n // format_options so the buyer doesn't have to special-case.\n return {\n product: { ...product, format_options: [] },\n diagnostics: [],\n };\n }\n const { v2, diagnostics } = projectV1ProductToV2(product, options);\n // Preserve the original product shape (especially format_ids); just\n // add format_options.\n return {\n product: {\n ...product,\n format_options: v2.format_options,\n },\n diagnostics,\n };\n}\n\n/**\n * Augment every Product in a `get_products` response with\n * `format_options[]`. Returns `{ response, diagnostics }` so callers\n * can surface projection diagnostics alongside the response's existing\n * `errors[]` array (or filter by `source: 'sdk'` to distinguish SDK\n * diagnostics from seller-emitted errors).\n *\n * Idempotent: if the seller is v2-native and every Product already\n * carries `format_options[]`, returns the response verbatim with no\n * diagnostics.\n *\n * @see toCanonicalOnlyResponse — the canonical-only counterpart that DROPS\n * `format_ids[]` for a fully-migrated consumer.\n */\nexport function withFormatOptions<R extends { products?: V1Product[] }>(\n response: R,\n options?: V1ToV2ProjectionOptions\n): { response: R & { products: V2AugmentedProduct<V1Product>[] }; diagnostics: ProjectionDiagnostic[] } {\n if (!Array.isArray(response?.products)) {\n return {\n response: { ...response, products: [] } as R & { products: V2AugmentedProduct<V1Product>[] },\n diagnostics: [],\n };\n }\n const out: V2AugmentedProduct<V1Product>[] = [];\n const diagnostics: ProjectionDiagnostic[] = [];\n for (const p of response.products) {\n const { product, diagnostics: d } = augmentProductWithFormatOptions(p, options);\n out.push(product);\n diagnostics.push(...d);\n }\n return {\n response: { ...response, products: out } as R & { products: V2AugmentedProduct<V1Product>[] },\n diagnostics,\n };\n}\n\n/**\n * A Product reduced to the canonical creative-format surface:\n * `format_options[]` only, with the legacy `format_ids[]` removed. The\n * read-side counterpart to a fully-migrated consumer — naive downstream\n * code can no longer fall back to the stale `{ agent_url, id }` shape and\n * silently bypass the canonical model.\n */\nexport type CanonicalOnlyProduct<P> = Omit<P, 'format_ids'> & {\n format_ids?: never;\n format_options: CanonicalFormatDeclaration[];\n};\n\nfunction canonicalDeclarations(values: readonly V2ProductFormatDeclaration[]): CanonicalFormatDeclaration[] {\n return values.map(value => concealLegacyFormatRefs(value));\n}\n\nfunction canonicalPlacements(\n product: Record<string, unknown>,\n options: V1ToV2ProjectionOptions | undefined,\n diagnostics: ProjectionDiagnostic[]\n): unknown {\n if (!Array.isArray(product.placements)) return product.placements;\n return product.placements.map((value, placementIndex) => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return value;\n const placement = value as Record<string, unknown>;\n const { format_ids: _drop, ...rest } = placement;\n void _drop;\n const hasLegacyFormats = Array.isArray(placement.format_ids);\n const hasCanonicalFormats = Array.isArray(placement.format_options);\n if (!hasLegacyFormats && !hasCanonicalFormats) return rest;\n\n const productId = typeof product.product_id === 'string' ? product.product_id : '(unknown)';\n const placementId = typeof placement.placement_id === 'string' ? placement.placement_id : String(placementIndex);\n const pseudoProduct = {\n product_id: `${productId}:placement:${placementId}`,\n name: typeof placement.name === 'string' ? placement.name : placementId,\n description: `Nested placement ${placementId}`,\n ...(hasLegacyFormats ? { format_ids: placement.format_ids } : {}),\n ...(hasCanonicalFormats ? { format_options: placement.format_options } : {}),\n } as unknown as V1Product;\n const projected = toCanonicalOnlyProduct(pseudoProduct, options);\n for (const diagnostic of projected.diagnostics) {\n diagnostics.push({\n ...diagnostic,\n field: diagnostic.field.replace(/^products\\[[^\\]]+\\]/, `products[${productId}].placements[${placementIndex}]`),\n });\n }\n return {\n ...rest,\n format_options: projected.product.format_options,\n };\n });\n}\n\n/**\n * Identity key for a `format_id` ref used by the coverage check.\n * Trailing-slash-insensitive on `agent_url` (folds the AAO host's slash /\n * no-slash forms, per `catalog.ts`'s `normalizeAgentUrl`), and includes the\n * dimensional discriminators so multi-size declarations sharing one\n * `{ agent_url, id }` but differing by size/duration are NOT collapsed —\n * the same key shape `write-side.ts` uses for v1 ref de-dup. Without the\n * size half, a `format_ids[]` entry for a size no `v1_format_ref` covers\n * would read as covered and be dropped silently.\n */\nfunction formatRefCoverageKey(ref: V1FormatId): string {\n const url = ref.agent_url && !ref.agent_url.endsWith('/') ? ref.agent_url + '/' : ref.agent_url;\n return `${url}::${ref.id}::${ref.width ?? ''}x${ref.height ?? ''}::${ref.duration_ms ?? ''}`;\n}\n\n/**\n * Project a single Product to the canonical-only shape: `format_options[]`\n * present, `format_ids[]` dropped.\n *\n * **Dropping legacy never silently loses a format.** Every input\n * `format_id` is either represented in the returned `format_options[]` or\n * surfaced in `diagnostics` — never discarded without a trace:\n *\n * - **v1-shaped input** (`format_ids[]`, no `format_options[]`): runs the\n * v1 → v2 projection. Mapped refs become `format_options[]`; any ref\n * the projection can't map is surfaced as `FORMAT_PROJECTION_FAILED`.\n * - **v2-native input** (`format_options[]` already present): keeps the\n * seller's canonical surface and drops the redundant v1 fallback. If a\n * legacy routing entry exists that no canonical option covers, it\n * surfaces a canonical-safe `LEGACY_FORMAT_ID_DROPPED_UNMAPPED`\n * diagnostic without echoing the routing identifier.\n * - **neither shape**: returns `format_options: []`; there is nothing to\n * project and nothing to lose.\n *\n * Pure and subtractive: unlike {@link augmentProductWithFormatOptions}\n * (which preserves `format_ids[]`), this drops it — the opt-in narrowing for\n * a consumer that has fully migrated. Complements the write-side\n * non-invertibility tracked at adcontextprotocol/adcp#4842 — this is the\n * read-side transparency half.\n */\nexport function toCanonicalOnlyProduct<P extends V1Product>(\n product: P,\n options?: V1ToV2ProjectionOptions\n): { product: CanonicalOnlyProduct<P>; diagnostics: ProjectionDiagnostic[] } {\n const existing = (product as unknown as { format_options?: unknown }).format_options;\n\n // v2-native: the seller already sent format_options[]. Drop the\n // redundant v1 fallback, but flag any legacy ref no v1_format_ref covers.\n if (Array.isArray(existing)) {\n const formatOptions = existing as V2ProductFormatDeclaration[];\n const diagnostics: ProjectionDiagnostic[] = [];\n const inputIds = Array.isArray(product.format_ids) ? product.format_ids : [];\n if (inputIds.length > 0) {\n const covered = new Set<string>();\n for (const opt of formatOptions) {\n const refs = Array.isArray(opt?.v1_format_ref) ? opt.v1_format_ref : [];\n for (const ref of refs) covered.add(formatRefCoverageKey(ref));\n }\n for (let k = 0; k < inputIds.length; k++) {\n const fid = inputIds[k]!;\n if (!covered.has(formatRefCoverageKey(fid))) {\n diagnostics.push({\n source: 'sdk',\n sdk_id: SDK_ID,\n field: `products[${product.product_id}].format_options`,\n code: 'LEGACY_FORMAT_ID_DROPPED_UNMAPPED',\n error: {\n details: {\n product_id: product.product_id,\n resolution_failure: 'unmapped_legacy_format',\n },\n },\n });\n }\n }\n }\n const { format_ids: _dropV2, ...rest } = product as P & { format_ids?: unknown };\n void _dropV2;\n return {\n product: {\n ...rest,\n format_options: canonicalDeclarations(formatOptions),\n ...(Array.isArray((product as Record<string, unknown>).placements)\n ? { placements: canonicalPlacements(product as Record<string, unknown>, options, diagnostics) }\n : {}),\n } as CanonicalOnlyProduct<P>,\n diagnostics: diagnostics.map(canonicalDiagnostic),\n };\n }\n\n // v1 shape: project. projectV1ProductToV2 already omits format_ids and\n // emits a diagnostic for every ref it couldn't map.\n if (Array.isArray(product.format_ids)) {\n const { v2, diagnostics } = projectV1ProductToV2(product, options);\n const { format_ids: _dropV1, ...rest } = product as P & { format_ids?: unknown };\n void _dropV1;\n return {\n product: {\n ...(rest as Omit<P, 'format_ids'>),\n format_options: canonicalDeclarations(v2.format_options),\n ...(Array.isArray((product as Record<string, unknown>).placements)\n ? { placements: canonicalPlacements(product as Record<string, unknown>, options, diagnostics) }\n : {}),\n } as CanonicalOnlyProduct<P>,\n diagnostics: diagnostics.map(canonicalDiagnostic),\n };\n }\n\n // Neither shape — nothing to project, nothing to lose.\n const { format_ids: _dropNone, ...rest } = product as P & { format_ids?: unknown };\n void _dropNone;\n const diagnostics: ProjectionDiagnostic[] = [];\n return {\n product: {\n ...(rest as Omit<P, 'format_ids'>),\n format_options: [],\n ...(Array.isArray((product as Record<string, unknown>).placements)\n ? { placements: canonicalPlacements(product as Record<string, unknown>, options, diagnostics) }\n : {}),\n } as CanonicalOnlyProduct<P>,\n diagnostics: diagnostics.map(canonicalDiagnostic),\n };\n}\n\n/**\n * Reduce every Product in a `get_products` response to the canonical-only\n * shape — `format_options[]` present, `format_ids[]` dropped. Returns\n * `{ response, diagnostics }` so callers surface projection diagnostics\n * alongside the response's existing `errors[]`.\n *\n * Response-level counterpart to {@link toCanonicalOnlyProduct}; same\n * fail-closed guarantee, aggregated across products. A wholly unmappable\n * legacy product cannot be represented as a canonical Product because the\n * protocol requires `format_options` to contain at least one declaration. It\n * is therefore omitted from the canonical list and surfaced through the\n * response's portable `errors[]` plus the SDK convenience diagnostics. A\n * partially mappable product remains with its mapped options and advisories\n * for the refs that could not be projected.\n */\nexport function toCanonicalOnlyResponse<R extends { products?: V1Product[] }>(\n response: R,\n options?: V1ToV2ProjectionOptions\n): {\n response: Omit<R, 'products'> & { products: CanonicalOnlyProduct<V1Product>[]; errors?: unknown[] };\n diagnostics: ProjectionDiagnostic[];\n} {\n if (!Array.isArray(response?.products)) {\n return {\n response: { ...response, products: [] } as Omit<R, 'products'> & {\n products: CanonicalOnlyProduct<V1Product>[];\n errors?: unknown[];\n },\n diagnostics: [],\n };\n }\n const out: CanonicalOnlyProduct<V1Product>[] = [];\n const diagnostics: ProjectionDiagnostic[] = [];\n const originalToOutputIndex = new Map<number, number | undefined>();\n for (let productIndex = 0; productIndex < response.products.length; productIndex++) {\n const p = response.products[productIndex]!;\n const { product, diagnostics: rawDiagnostics } = toCanonicalOnlyProduct(p, options);\n const hasEmptyPlacement = hasEmptyPlacementFormatOptions(product);\n const keep = product.format_options.length > 0 && !hasEmptyPlacement;\n const outputIndex = keep ? out.length : undefined;\n originalToOutputIndex.set(productIndex, outputIndex);\n const d = rawDiagnostics.map(diagnostic => ({\n ...diagnostic,\n field: keep ? diagnostic.field.replace(/^products\\[[^\\]]+\\]/, `products[${outputIndex}]`) : 'products',\n error: keep\n ? diagnostic.error\n : {\n details: {\n ...diagnostic.error.details,\n product_id: p.product_id,\n },\n },\n })) as ProjectionDiagnostic[];\n if (!keep && d.length === 0) {\n const reason = hasEmptyPlacement\n ? 'nested_placement_format_list_empty'\n : Array.isArray((p as Record<string, unknown>).format_options)\n ? 'canonical_format_list_empty'\n : Array.isArray(p.format_ids)\n ? 'legacy_format_list_empty'\n : 'missing_format_declaration';\n d.push({\n ...canonicalFormatsUnavailableForProduct(p, reason),\n field: 'products',\n });\n }\n diagnostics.push(...d);\n if (keep) out.push(product);\n }\n const remappedExistingErrors = remapExistingProductErrors(\n (response as { errors?: unknown }).errors,\n originalToOutputIndex,\n response.products\n );\n const errors = mergeProjectionErrors(remappedExistingErrors, diagnostics);\n return {\n response: {\n ...response,\n products: out,\n ...(errors.length > 0 ? { errors } : {}),\n } as Omit<R, 'products'> & { products: CanonicalOnlyProduct<V1Product>[]; errors?: unknown[] },\n diagnostics,\n };\n}\n"],"mappings":"AAuBA,SAAS,4BAA4B;AAErC,SAAS,uBAAuB;AAChC,SAAS,gBAAgB,wBAAwB;AACjD,SAAS,+BAA+B;AAGxC,MAAM,SAAS,aAAa,eAAe;AAE3C,SAAS,oBAAoB,YAAwD;AACnF,SAAO;AAAA,IACL,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,IAKH,OAAO,WAAW,MAAM,QAAQ,wBAAwB,iBAAiB;AAAA,EAC3E;AACF;AAaA,SAAS,uBAAuB,MAA4C;AAC1E,UAAQ,MAAM;AAAA,IACZ,KAAK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W,MAAM;AAAA,UACpB,YAAY,EAAE;AAAA,QAChB;AAAA,MACF;AAAA,IACN,EAAE;AACF,QAAI,CAAC,QAAQ,EAAE,WAAW,GAAG;AAC3B,YAAM,SAAS,oBACX,uCACA,MAAM,QAAS,EAA8B,cAAc,IACzD,gCACA,MAAM,QAAQ,EAAE,UAAU,IACxB,6BACA;AACR,QAAE,KAAK;AAAA,QACL,GAAG,sCAAsC,GAAG,MAAM;AAAA,QAClD,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AACA,gBAAY,KAAK,GAAG,CAAC;AACrB,QAAI,KAAM,KAAI,KAAK,OAAO;AAAA,EAC5B;AACA,QAAM,yBAAyB;AAAA,IAC5B,SAAkC;AAAA,IACnC;AAAA,IACA,SAAS;AAAA,EACX;AACA,QAAM,SAAS,sBAAsB,wBAAwB,WAAW;AACxE,SAAO;AAAA,IACL,UAAU;AAAA,MACR,GAAG;AAAA,MACH,UAAU;AAAA,MACV,GAAI,OAAO,SAAS,IAAI,EAAE,OAAO,IAAI,CAAC;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AACF;","names":["diagnostics","rest"]}
@@ -1,6 +1,9 @@
1
1
  import type { FormatReferenceStructuredObject } from '../../types/core.generated.mjs';
2
- import type { AgentPlacementFormatDeclaration, CustomFormatDeclaration, DAASTAudioFormatDeclaration, DisplayTagFormatDeclaration, HTML5FormatDeclaration, HostedAudioFormatDeclaration, HostedVideoFormatDeclaration, ImageAsset, ImageCarouselFormatDeclaration, ImageFormatDeclaration, NativeInFeedFormatDeclaration, ProductFormatDeclaration, ResponsiveCreativeFormatDeclaration, SponsoredPlacementFormatDeclaration, VASTVideoFormatDeclaration } from '../../types/tools.generated.mjs';
3
- type WithCommonDeclaration<T> = ProductFormatDeclaration & T;
2
+ import type { AgentPlacementFormatDeclaration, CustomFormatDeclaration, DAASTAudioFormatDeclaration, DisplayTagFormatDeclaration, HTML5FormatDeclaration, HostedAudioFormatDeclaration, HostedVideoFormatDeclaration, ImageAsset, ImageCarouselFormatDeclaration, ImageFormatDeclaration, NativeInFeedFormatDeclaration, ResponsiveCreativeFormatDeclaration, SponsoredPlacementFormatDeclaration, VASTVideoFormatDeclaration } from '../../types/tools.generated.mjs';
3
+ import type { CanonicalFormatDeclaration as CanonicalBaseFormatDeclaration } from './legacy-metadata.mjs';
4
+ type WithCommonDeclaration<T> = CanonicalBaseFormatDeclaration & Omit<T, 'v1_format_ref'> & {
5
+ v1_format_ref?: never;
6
+ };
4
7
  interface CanonicalFormatDeclarationMap {
5
8
  image: WithCommonDeclaration<ImageFormatDeclaration>;
6
9
  html5: WithCommonDeclaration<HTML5FormatDeclaration>;
@@ -45,8 +48,8 @@ export interface ProductCardDetailedFields {
45
48
  * bare string when populating Product.format_ids, ProductFormatDeclaration
46
49
  * v1_format_ref, or list_creative_formats filters.
47
50
  */
48
- export declare function formatRef(agent_url: string, id: string, fields?: Omit<Partial<FormatReferenceStructuredObject>, 'agent_url' | 'id'> & Record<string, unknown>): FormatReferenceStructuredObject;
49
- export declare function formatRefs(...refs: FormatReferenceInput[]): FormatReferenceStructuredObject[];
51
+ export declare function legacyFormatRef(agent_url: string, id: string, fields?: Omit<Partial<FormatReferenceStructuredObject>, 'agent_url' | 'id'> & Record<string, unknown>): FormatReferenceStructuredObject;
52
+ export declare function legacyFormatRefs(...refs: FormatReferenceInput[]): FormatReferenceStructuredObject[];
50
53
  /**
51
54
  * Generic canonical-format declaration builder. It sets the format_kind
52
55
  * discriminator and keeps common declaration metadata in the third argument.
@@ -72,8 +75,6 @@ export declare function customFormatDeclaration(format_shape: string, format_sch
72
75
  export declare function productCard(fields: ProductCardFields): ProductCardFields;
73
76
  export declare function productCardDetailed(fields: ProductCardDetailedFields): ProductCardDetailedFields;
74
77
  export declare const CanonicalFormat: {
75
- readonly ref: typeof formatRef;
76
- readonly refs: typeof formatRefs;
77
78
  readonly declaration: typeof canonicalFormatDeclaration;
78
79
  readonly image: typeof imageFormatDeclaration;
79
80
  readonly html5: typeof html5FormatDeclaration;
@@ -1,6 +1,9 @@
1
1
  import type { FormatReferenceStructuredObject } from '../../types/core.generated';
2
- import type { AgentPlacementFormatDeclaration, CustomFormatDeclaration, DAASTAudioFormatDeclaration, DisplayTagFormatDeclaration, HTML5FormatDeclaration, HostedAudioFormatDeclaration, HostedVideoFormatDeclaration, ImageAsset, ImageCarouselFormatDeclaration, ImageFormatDeclaration, NativeInFeedFormatDeclaration, ProductFormatDeclaration, ResponsiveCreativeFormatDeclaration, SponsoredPlacementFormatDeclaration, VASTVideoFormatDeclaration } from '../../types/tools.generated';
3
- type WithCommonDeclaration<T> = ProductFormatDeclaration & T;
2
+ import type { AgentPlacementFormatDeclaration, CustomFormatDeclaration, DAASTAudioFormatDeclaration, DisplayTagFormatDeclaration, HTML5FormatDeclaration, HostedAudioFormatDeclaration, HostedVideoFormatDeclaration, ImageAsset, ImageCarouselFormatDeclaration, ImageFormatDeclaration, NativeInFeedFormatDeclaration, ResponsiveCreativeFormatDeclaration, SponsoredPlacementFormatDeclaration, VASTVideoFormatDeclaration } from '../../types/tools.generated';
3
+ import type { CanonicalFormatDeclaration as CanonicalBaseFormatDeclaration } from './legacy-metadata';
4
+ type WithCommonDeclaration<T> = CanonicalBaseFormatDeclaration & Omit<T, 'v1_format_ref'> & {
5
+ v1_format_ref?: never;
6
+ };
4
7
  interface CanonicalFormatDeclarationMap {
5
8
  image: WithCommonDeclaration<ImageFormatDeclaration>;
6
9
  html5: WithCommonDeclaration<HTML5FormatDeclaration>;
@@ -45,8 +48,8 @@ export interface ProductCardDetailedFields {
45
48
  * bare string when populating Product.format_ids, ProductFormatDeclaration
46
49
  * v1_format_ref, or list_creative_formats filters.
47
50
  */
48
- export declare function formatRef(agent_url: string, id: string, fields?: Omit<Partial<FormatReferenceStructuredObject>, 'agent_url' | 'id'> & Record<string, unknown>): FormatReferenceStructuredObject;
49
- export declare function formatRefs(...refs: FormatReferenceInput[]): FormatReferenceStructuredObject[];
51
+ export declare function legacyFormatRef(agent_url: string, id: string, fields?: Omit<Partial<FormatReferenceStructuredObject>, 'agent_url' | 'id'> & Record<string, unknown>): FormatReferenceStructuredObject;
52
+ export declare function legacyFormatRefs(...refs: FormatReferenceInput[]): FormatReferenceStructuredObject[];
50
53
  /**
51
54
  * Generic canonical-format declaration builder. It sets the format_kind
52
55
  * discriminator and keeps common declaration metadata in the third argument.
@@ -72,8 +75,6 @@ export declare function customFormatDeclaration(format_shape: string, format_sch
72
75
  export declare function productCard(fields: ProductCardFields): ProductCardFields;
73
76
  export declare function productCardDetailed(fields: ProductCardDetailedFields): ProductCardDetailedFields;
74
77
  export declare const CanonicalFormat: {
75
- readonly ref: typeof formatRef;
76
- readonly refs: typeof formatRefs;
77
78
  readonly declaration: typeof canonicalFormatDeclaration;
78
79
  readonly image: typeof imageFormatDeclaration;
79
80
  readonly html5: typeof html5FormatDeclaration;
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/projection/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EACV,+BAA+B,EAC/B,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,UAAU,EACV,8BAA8B,EAC9B,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,mCAAmC,EACnC,mCAAmC,EACnC,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AAErC,KAAK,qBAAqB,CAAC,CAAC,IAAI,wBAAwB,GAAG,CAAC,CAAC;AAE7D,UAAU,6BAA6B;IACrC,KAAK,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;IACrD,KAAK,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;IACrD,WAAW,EAAE,qBAAqB,CAAC,2BAA2B,CAAC,CAAC;IAChE,cAAc,EAAE,qBAAqB,CAAC,8BAA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ders_exports, {
25
25
  canonicalFormatDeclaration: () => canonicalFormatDeclaration,
26
26
  customFormatDeclaration: () => customFormatDeclaration,
27
27
  displayTagFormatDeclaration: () => displayTagFormatDeclaration,
28
- formatRef: () => formatRef,
29
- formatRefs: () => formatRefs,
30
28
  html5FormatDeclaration: () => html5FormatDeclaration,
31
29
  imageCarouselFormatDeclaration: () => imageCarouselFormatDeclaration,
32
30
  imageFormatDeclaration: () => imageFormatDeclaration,
31
+ legacyFormatRef: () => legacyFormatRef,
32
+ legacyFormatRefs: () => legacyFormatRefs,
33
33
  nativeInFeedFormatDeclaration: () => nativeInFeedFormatDeclaration,
34
34
  productCard: () => productCard,
35
35
  productCardDetailed: () => productCardDetailed,
@@ -39,13 +39,18 @@ __export(builders_exports, {
39
39
  videoVastFormatDeclaration: () => videoVastFormatDeclaration
40
40
  });
41
41
  module.exports = __toCommonJS(builders_exports);
42
- function formatRef(agent_url, id, fields = {}) {
42
+ function legacyFormatRef(agent_url, id, fields = {}) {
43
43
  return { ...fields, agent_url, id };
44
44
  }
45
- function formatRefs(...refs) {
45
+ function legacyFormatRefs(...refs) {
46
46
  return refs.map((ref) => ({ ...ref }));
47
47
  }
48
48
  function canonicalFormatDeclaration(format_kind, params, fields = {}) {
49
+ if (Reflect.has(fields, "v1_format_ref")) {
50
+ throw new Error(
51
+ "canonicalFormatDeclaration does not accept legacy routing references; use explicitly named legacy migration helpers outside the canonical surface"
52
+ );
53
+ }
49
54
  return { ...fields, format_kind, params };
50
55
  }
51
56
  function imageFormatDeclaration(params, fields = {}) {
@@ -98,8 +103,6 @@ function productCardDetailed(fields) {
98
103
  };
99
104
  }
100
105
  const CanonicalFormat = {
101
- ref: formatRef,
102
- refs: formatRefs,
103
106
  declaration: canonicalFormatDeclaration,
104
107
  image: imageFormatDeclaration,
105
108
  html5: html5FormatDeclaration,
@@ -126,11 +129,11 @@ const CanonicalFormat = {
126
129
  canonicalFormatDeclaration,
127
130
  customFormatDeclaration,
128
131
  displayTagFormatDeclaration,
129
- formatRef,
130
- formatRefs,
131
132
  html5FormatDeclaration,
132
133
  imageCarouselFormatDeclaration,
133
134
  imageFormatDeclaration,
135
+ legacyFormatRef,
136
+ legacyFormatRefs,
134
137
  nativeInFeedFormatDeclaration,
135
138
  productCard,
136
139
  productCardDetailed,