@adcp/sdk 15.9.1 → 16.0.0-beta.2

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 (321) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +25 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +25 -2
  13. package/dist/lib/core/SingleAgentClient.js +280 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +282 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/generated-compat.d.mts +34 -0
  28. package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
  29. package/dist/lib/identity-3.3/generated-compat.js +16 -0
  30. package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
  31. package/dist/lib/identity-3.3/index.d.mts +10 -0
  32. package/dist/lib/identity-3.3/index.d.ts +10 -0
  33. package/dist/lib/identity-3.3/index.js +79 -0
  34. package/dist/lib/identity-3.3/index.mjs +50 -0
  35. package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
  36. package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
  37. package/dist/lib/identity-3.3/lifecycle.js +294 -0
  38. package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
  39. package/dist/lib/identity-3.3/revocation.d.mts +86 -0
  40. package/dist/lib/identity-3.3/revocation.d.ts +86 -0
  41. package/dist/lib/identity-3.3/revocation.js +308 -0
  42. package/dist/lib/identity-3.3/revocation.mjs +286 -0
  43. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  44. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  45. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  46. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  47. package/dist/lib/identity-3.3/server.d.mts +46 -0
  48. package/dist/lib/identity-3.3/server.d.ts +46 -0
  49. package/dist/lib/identity-3.3/server.js +279 -0
  50. package/dist/lib/identity-3.3/server.mjs +260 -0
  51. package/dist/lib/identity-3.3/store.d.mts +24 -0
  52. package/dist/lib/identity-3.3/store.d.ts +24 -0
  53. package/dist/lib/identity-3.3/store.js +191 -0
  54. package/dist/lib/identity-3.3/store.mjs +169 -0
  55. package/dist/lib/identity-3.3/trust.d.mts +155 -0
  56. package/dist/lib/identity-3.3/trust.d.ts +155 -0
  57. package/dist/lib/identity-3.3/trust.js +383 -0
  58. package/dist/lib/identity-3.3/trust.mjs +342 -0
  59. package/dist/lib/identity-3.3/types.d.mts +155 -0
  60. package/dist/lib/identity-3.3/types.d.ts +155 -0
  61. package/dist/lib/identity-3.3/types.js +16 -0
  62. package/dist/lib/identity-3.3/types.mjs +0 -0
  63. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  64. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  65. package/dist/lib/identity-3.3/validation.js +125 -0
  66. package/dist/lib/identity-3.3/validation.mjs +91 -0
  67. package/dist/lib/index.d.mts +1 -1
  68. package/dist/lib/index.d.ts +1 -1
  69. package/dist/lib/index.js +2 -0
  70. package/dist/lib/index.mjs +2 -0
  71. package/dist/lib/protocols/index.d.mts +1 -1
  72. package/dist/lib/protocols/index.d.ts +1 -1
  73. package/dist/lib/protocols/index.js +2 -2
  74. package/dist/lib/protocols/index.mjs +2 -2
  75. package/dist/lib/reporting/azure/index.d.mts +5 -0
  76. package/dist/lib/reporting/azure/index.d.ts +5 -0
  77. package/dist/lib/reporting/azure/index.js +26 -7
  78. package/dist/lib/reporting/azure/index.mjs +26 -7
  79. package/dist/lib/reporting/bigquery/index.d.mts +39 -5
  80. package/dist/lib/reporting/bigquery/index.d.ts +39 -5
  81. package/dist/lib/reporting/bigquery/index.js +26 -20
  82. package/dist/lib/reporting/bigquery/index.mjs +26 -20
  83. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  84. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  85. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  86. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  87. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  88. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  89. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  90. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  91. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  92. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  93. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  94. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  95. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  96. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  97. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  98. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  99. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  100. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  101. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  102. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  103. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  104. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  105. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  106. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  107. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  108. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  109. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  110. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  111. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  112. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  113. package/dist/lib/reporting/ledger/postgres.js +43 -27
  114. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  115. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  116. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  117. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  118. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  119. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  120. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  121. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  122. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  123. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  124. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  125. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  126. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  127. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  128. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  129. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  130. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  131. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  132. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  133. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  134. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  135. package/dist/lib/reporting/ledger/schedule.js +24 -0
  136. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  137. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  138. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  139. package/dist/lib/reporting/s3/index.d.mts +5 -0
  140. package/dist/lib/reporting/s3/index.d.ts +5 -0
  141. package/dist/lib/reporting/s3/index.js +37 -14
  142. package/dist/lib/reporting/s3/index.mjs +37 -14
  143. package/dist/lib/reporting/service/index.d.mts +10 -0
  144. package/dist/lib/reporting/service/index.d.ts +10 -0
  145. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  146. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  147. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  148. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  149. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  150. package/dist/lib/server/account-sync-contract.js +225 -0
  151. package/dist/lib/server/account-sync-contract.mjs +197 -0
  152. package/dist/lib/server/adcp-server.js +5 -0
  153. package/dist/lib/server/adcp-server.mjs +10 -0
  154. package/dist/lib/server/auth-signature.d.mts +15 -0
  155. package/dist/lib/server/auth-signature.d.ts +15 -0
  156. package/dist/lib/server/auth-signature.js +72 -2
  157. package/dist/lib/server/auth-signature.mjs +81 -2
  158. package/dist/lib/server/auth.d.mts +6 -0
  159. package/dist/lib/server/auth.d.ts +6 -0
  160. package/dist/lib/server/auth.js +6 -0
  161. package/dist/lib/server/auth.mjs +6 -0
  162. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  163. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  164. package/dist/lib/server/create-adcp-server.js +259 -19
  165. package/dist/lib/server/create-adcp-server.mjs +266 -10
  166. package/dist/lib/server/decisioning/account.d.mts +24 -1
  167. package/dist/lib/server/decisioning/account.d.ts +24 -1
  168. package/dist/lib/server/decisioning/index.d.mts +1 -1
  169. package/dist/lib/server/decisioning/index.d.ts +1 -1
  170. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  171. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  172. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  173. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  174. package/dist/lib/server/index.d.mts +2 -0
  175. package/dist/lib/server/index.d.ts +2 -0
  176. package/dist/lib/server/index.js +12 -0
  177. package/dist/lib/server/index.mjs +12 -0
  178. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  179. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  180. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  181. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  182. package/dist/lib/server/principal/types.d.mts +1 -1
  183. package/dist/lib/server/principal/types.d.ts +1 -1
  184. package/dist/lib/server/serve.js +5 -0
  185. package/dist/lib/server/serve.mjs +5 -0
  186. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  187. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  188. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  189. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  190. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  191. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  192. package/dist/lib/server/webhook-emitter.js +22 -0
  193. package/dist/lib/server/webhook-emitter.mjs +22 -0
  194. package/dist/lib/signing/agent-context.d.mts +0 -5
  195. package/dist/lib/signing/agent-context.d.ts +0 -5
  196. package/dist/lib/signing/agent-context.js +9 -1
  197. package/dist/lib/signing/agent-context.mjs +9 -1
  198. package/dist/lib/signing/agent-fetch.js +27 -2
  199. package/dist/lib/signing/agent-fetch.mjs +32 -2
  200. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  201. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  202. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  203. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  204. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  205. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  206. package/dist/lib/signing/agent-resolver/index.js +5 -0
  207. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  208. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  209. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  210. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  211. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  212. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  213. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  214. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  215. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  216. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  217. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  218. package/dist/lib/signing/brand-jwks.js +4 -4
  219. package/dist/lib/signing/brand-jwks.mjs +4 -4
  220. package/dist/lib/signing/client.d.mts +1 -0
  221. package/dist/lib/signing/client.d.ts +1 -0
  222. package/dist/lib/signing/client.js +5 -0
  223. package/dist/lib/signing/client.mjs +3 -0
  224. package/dist/lib/signing/crypto.js +8 -0
  225. package/dist/lib/signing/crypto.mjs +9 -1
  226. package/dist/lib/signing/fetch-async.js +1 -1
  227. package/dist/lib/signing/fetch-async.mjs +1 -1
  228. package/dist/lib/signing/fetch.js +1 -1
  229. package/dist/lib/signing/fetch.mjs +1 -1
  230. package/dist/lib/signing/jwks-https.d.mts +1 -1
  231. package/dist/lib/signing/jwks-https.d.ts +1 -1
  232. package/dist/lib/signing/jwks-https.js +1 -1
  233. package/dist/lib/signing/jwks-https.mjs +1 -1
  234. package/dist/lib/signing/jwks.d.mts +11 -3
  235. package/dist/lib/signing/jwks.d.ts +11 -3
  236. package/dist/lib/signing/jwks.js +1 -1
  237. package/dist/lib/signing/jwks.mjs +1 -1
  238. package/dist/lib/signing/middleware.js +9 -0
  239. package/dist/lib/signing/middleware.mjs +14 -0
  240. package/dist/lib/signing/parser.d.mts +9 -6
  241. package/dist/lib/signing/parser.d.ts +9 -6
  242. package/dist/lib/signing/parser.js +82 -64
  243. package/dist/lib/signing/parser.mjs +83 -65
  244. package/dist/lib/signing/revocation.d.mts +4 -1
  245. package/dist/lib/signing/revocation.d.ts +4 -1
  246. package/dist/lib/signing/revocation.js +36 -3
  247. package/dist/lib/signing/revocation.mjs +34 -2
  248. package/dist/lib/signing/server.d.mts +1 -1
  249. package/dist/lib/signing/server.d.ts +1 -1
  250. package/dist/lib/signing/server.js +4 -0
  251. package/dist/lib/signing/server.mjs +4 -0
  252. package/dist/lib/signing/types.d.mts +3 -0
  253. package/dist/lib/signing/types.d.ts +3 -0
  254. package/dist/lib/signing/verifier.js +1 -1
  255. package/dist/lib/signing/verifier.mjs +1 -1
  256. package/dist/lib/signing/web-bot-auth.d.mts +191 -0
  257. package/dist/lib/signing/web-bot-auth.d.ts +191 -0
  258. package/dist/lib/signing/web-bot-auth.js +837 -0
  259. package/dist/lib/signing/web-bot-auth.mjs +796 -0
  260. package/dist/lib/signing/webhook-verifier.js +1 -1
  261. package/dist/lib/signing/webhook-verifier.mjs +1 -1
  262. package/dist/lib/testing/client.d.mts +1 -4
  263. package/dist/lib/testing/client.d.ts +1 -4
  264. package/dist/lib/testing/client.js +141 -20
  265. package/dist/lib/testing/client.mjs +137 -19
  266. package/dist/lib/testing/compliance/comply.js +29 -10
  267. package/dist/lib/testing/compliance/comply.mjs +37 -11
  268. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  269. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  270. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  271. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  272. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  273. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  274. package/dist/lib/testing/storyboard/runner.js +23 -8
  275. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  276. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  277. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  278. package/dist/lib/types/adcp.d.mts +4 -0
  279. package/dist/lib/types/adcp.d.ts +4 -0
  280. package/dist/lib/types/schemas.generated.d.ts +6 -6
  281. package/dist/lib/utils/capabilities.d.mts +1 -0
  282. package/dist/lib/utils/capabilities.d.ts +1 -0
  283. package/dist/lib/utils/capabilities.js +5 -0
  284. package/dist/lib/utils/capabilities.mjs +5 -0
  285. package/dist/lib/v2/projection/catalog-snapshot.js +3 -1
  286. package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
  287. package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
  288. package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
  289. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  290. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  291. package/dist/lib/v2/projection/index.d.mts +1 -1
  292. package/dist/lib/v2/projection/index.d.ts +1 -1
  293. package/dist/lib/v2/projection/index.js +2 -0
  294. package/dist/lib/v2/projection/index.mjs +2 -0
  295. package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
  296. package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
  297. package/dist/lib/v2/projection/legacy-routes.js +35 -2
  298. package/dist/lib/v2/projection/legacy-routes.mjs +32 -2
  299. package/dist/lib/validation/schema-loader.d.mts +2 -0
  300. package/dist/lib/validation/schema-loader.d.ts +2 -0
  301. package/dist/lib/validation/schema-loader.js +43 -4
  302. package/dist/lib/validation/schema-loader.mjs +39 -3
  303. package/dist/lib/version.d.mts +3 -3
  304. package/dist/lib/version.d.ts +3 -3
  305. package/dist/lib/version.js +3 -3
  306. package/dist/lib/version.mjs +3 -3
  307. package/docs/TYPE-SUMMARY.md +2 -2
  308. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  309. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  310. package/docs/guides/REPORTING-LEDGER.md +99 -29
  311. package/docs/guides/REPORTING-OPERATIONS.md +29 -13
  312. package/docs/guides/REPORTING-STABILITY.md +76 -0
  313. package/docs/guides/account-resolution.md +101 -0
  314. package/docs/llms.txt +3 -2
  315. package/docs/migration-12-to-13.md +15 -0
  316. package/docs/migration-14.x-rc-worksheet.md +4 -4
  317. package/docs/migration-agent-identity-3.3.md +494 -0
  318. package/docs/migration-agent-resolution-3.3.md +5 -0
  319. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  320. package/examples/storyboards/account-sync-contract.yaml +57 -0
  321. package/package.json +17 -1
@@ -53,6 +53,7 @@ export interface MediaBuyFeatures {
53
53
  * Account management capabilities declared by the seller
54
54
  */
55
55
  export interface AccountCapabilities {
56
+ agentOnboarding?: import('../identity-3.3/types').AgentOnboarding;
56
57
  /** Seller-issued IDs are stable and accepted wherever an account reference is used. */
57
58
  stableAccountId?: boolean;
58
59
  /** Optional account change feed; absence does not imply support. */
@@ -316,6 +316,11 @@ function parseCapabilitiesResponse(response) {
316
316
  authorizationEndpoint: response.account.authorization_endpoint,
317
317
  supportedBilling: response.account.supported_billing ?? [],
318
318
  defaultBilling: response.account.default_billing,
319
+ ...response.account.agent_onboarding && {
320
+ agentOnboarding: structuredClone(
321
+ response.account.agent_onboarding
322
+ )
323
+ },
319
324
  supportedAccountCurrencyModes: response.account.supported_account_currency_modes,
320
325
  ...response.account.timezone && {
321
326
  timezone: {
@@ -260,6 +260,11 @@ function parseCapabilitiesResponse(response) {
260
260
  authorizationEndpoint: response.account.authorization_endpoint,
261
261
  supportedBilling: response.account.supported_billing ?? [],
262
262
  defaultBilling: response.account.default_billing,
263
+ ...response.account.agent_onboarding && {
264
+ agentOnboarding: structuredClone(
265
+ response.account.agent_onboarding
266
+ )
267
+ },
263
268
  supportedAccountCurrencyModes: response.account.supported_account_currency_modes,
264
269
  ...response.account.timezone && {
265
270
  timezone: {
@@ -25,6 +25,7 @@ __export(catalog_snapshot_exports, {
25
25
  module.exports = __toCommonJS(catalog_snapshot_exports);
26
26
  var import_resolve_agent_properties = require('../../discovery/resolve-agent-properties.js');
27
27
  var import_canonical_properties = require('./canonical-properties.js');
28
+ var import_legacy_routes = require('./legacy-routes.js');
28
29
  const compiledSnapshotCache = /* @__PURE__ */ new WeakMap();
29
30
  function normalizedAgentUrl(value) {
30
31
  return (0, import_resolve_agent_properties.canonicalizeAgentUrl)(value) ?? value;
@@ -202,7 +203,7 @@ function legacyFormatConverterFromCatalogSnapshots(snapshots, fallback) {
202
203
  function canonicalFormatLegacyResolverFromCatalogSnapshots(snapshots, fallback) {
203
204
  if (!snapshots || snapshots.length === 0) return fallback;
204
205
  const compiled = compileProjectionCatalogSnapshots(snapshots);
205
- return (context) => {
206
+ const resolver = (context) => {
206
207
  const refs = resolutionContextFormatOptionRefs(context);
207
208
  if (refs.length === 0) return fallback?.(context);
208
209
  const resolved = [];
@@ -225,6 +226,7 @@ function canonicalFormatLegacyResolverFromCatalogSnapshots(snapshots, fallback)
225
226
  }
226
227
  return [...new Map(resolved.map((ref) => [legacyRefKey(ref), ref])).values()];
227
228
  };
229
+ return (0, import_legacy_routes.carryFormatOptionOrigins)(resolver, fallback);
228
230
  }
229
231
  function assertBidirectionalProjectionCatalogs(snapshots) {
230
232
  const routeByCanonicalOption = /* @__PURE__ */ new Map();
@@ -1,5 +1,6 @@
1
1
  import { canonicalizeAgentUrl } from "../../discovery/resolve-agent-properties.mjs";
2
2
  import { isCanonicalV1Translatable } from "./canonical-properties.mjs";
3
+ import { carryFormatOptionOrigins } from "./legacy-routes.mjs";
3
4
  const compiledSnapshotCache = /* @__PURE__ */ new WeakMap();
4
5
  function normalizedAgentUrl(value) {
5
6
  return canonicalizeAgentUrl(value) ?? value;
@@ -177,7 +178,7 @@ function legacyFormatConverterFromCatalogSnapshots(snapshots, fallback) {
177
178
  function canonicalFormatLegacyResolverFromCatalogSnapshots(snapshots, fallback) {
178
179
  if (!snapshots || snapshots.length === 0) return fallback;
179
180
  const compiled = compileProjectionCatalogSnapshots(snapshots);
180
- return (context) => {
181
+ const resolver = (context) => {
181
182
  const refs = resolutionContextFormatOptionRefs(context);
182
183
  if (refs.length === 0) return fallback?.(context);
183
184
  const resolved = [];
@@ -200,6 +201,7 @@ function canonicalFormatLegacyResolverFromCatalogSnapshots(snapshots, fallback)
200
201
  }
201
202
  return [...new Map(resolved.map((ref) => [legacyRefKey(ref), ref])).values()];
202
203
  };
204
+ return carryFormatOptionOrigins(resolver, fallback);
203
205
  }
204
206
  function assertBidirectionalProjectionCatalogs(snapshots) {
205
207
  const routeByCanonicalOption = /* @__PURE__ */ new Map();
@@ -78,23 +78,47 @@ export type CanonicalCreateMediaBuyRequest = Omit<CanonicalCreativeResponse<Crea
78
78
  packages?: CanonicalPackageRequest[];
79
79
  };
80
80
  type CanonicalReportingWebhook = NonNullable<CanonicalCreateMediaBuyRequest['reporting_webhook']>;
81
- type ReportingWebhookPreferences = Omit<CanonicalReportingWebhook, 'url' | 'authentication' | 'reporting_frequency'> & {
82
- reporting_frequency?: CanonicalReportingWebhook['reporting_frequency'];
81
+ /**
82
+ * Client-facing form of a wire reporting webhook `W`. Every field is optional:
83
+ * the SDK can supply the callback `url`, `reporting_frequency` and the
84
+ * `authentication` block from client configuration.
85
+ *
86
+ * `authentication` is optional even with a caller-supplied `url`. AdCP 3.3
87
+ * makes it optional on the wire when the seller signs webhooks under its
88
+ * profile (`webhook_signing.supported`), and the experimental 3.3 client sends
89
+ * the registration without it once it has negotiated that. Below 3.3 the wire
90
+ * still requires it: with `webhookUrlTemplate` configured the client throws
91
+ * rather than send a caller URL without credentials (it never pairs its own
92
+ * `webhookSecret` with a caller-controlled host), and request validation
93
+ * reports the missing field otherwise.
94
+ *
95
+ * Derived from `W` rather than restating its fields, so it accepts every
96
+ * reporting webhook the pinned schemas generate, whether they declare
97
+ * `authentication` required (3.2) or optional (3.3).
98
+ *
99
+ * Exported for the type tests only; not re-exported from the package root.
100
+ */
101
+ export type ClientReportingWebhookInputFor<W extends {
102
+ url: string;
103
+ reporting_frequency: unknown;
104
+ }> = Omit<W, 'url' | 'authentication' | 'reporting_frequency'> & {
105
+ url?: W['url'];
106
+ reporting_frequency?: W['reporting_frequency'];
107
+ /** Atomic: `schemes` and `credentials` always come from the same source. */
108
+ authentication?: W extends {
109
+ authentication?: infer A;
110
+ } ? (unknown extends A ? never : A) : never;
83
111
  };
84
- type ClientReportingWebhookInput = (ReportingWebhookPreferences & {
85
- url?: never;
86
- authentication?: CanonicalReportingWebhook['authentication'];
87
- }) | (ReportingWebhookPreferences & {
88
- url: CanonicalReportingWebhook['url'];
89
- authentication: CanonicalReportingWebhook['authentication'];
90
- });
112
+ type ClientReportingWebhookInput = ClientReportingWebhookInputFor<CanonicalReportingWebhook>;
91
113
  /**
92
114
  * Client-facing create request. The SDK may supply the reporting callback URL
93
115
  * and its complete authentication block from client configuration; the wire
94
116
  * request remains a strict {@link CanonicalCreateMediaBuyRequest}.
95
117
  */
96
118
  export type CanonicalCreateMediaBuyInput = Omit<CanonicalCreateMediaBuyRequest, 'reporting_webhook'> & {
97
- reporting_webhook?: ClientReportingWebhookInput;
119
+ reporting_webhook?: ClientReportingWebhookInput & {
120
+ signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
121
+ };
98
122
  };
99
123
  export type CanonicalUpdateMediaBuyRequest = Omit<CanonicalCreativeResponse<UpdateMediaBuyRequest>, 'packages' | 'new_packages'> & {
100
124
  packages?: CanonicalPackageUpdate[];
@@ -78,23 +78,47 @@ export type CanonicalCreateMediaBuyRequest = Omit<CanonicalCreativeResponse<Crea
78
78
  packages?: CanonicalPackageRequest[];
79
79
  };
80
80
  type CanonicalReportingWebhook = NonNullable<CanonicalCreateMediaBuyRequest['reporting_webhook']>;
81
- type ReportingWebhookPreferences = Omit<CanonicalReportingWebhook, 'url' | 'authentication' | 'reporting_frequency'> & {
82
- reporting_frequency?: CanonicalReportingWebhook['reporting_frequency'];
81
+ /**
82
+ * Client-facing form of a wire reporting webhook `W`. Every field is optional:
83
+ * the SDK can supply the callback `url`, `reporting_frequency` and the
84
+ * `authentication` block from client configuration.
85
+ *
86
+ * `authentication` is optional even with a caller-supplied `url`. AdCP 3.3
87
+ * makes it optional on the wire when the seller signs webhooks under its
88
+ * profile (`webhook_signing.supported`), and the experimental 3.3 client sends
89
+ * the registration without it once it has negotiated that. Below 3.3 the wire
90
+ * still requires it: with `webhookUrlTemplate` configured the client throws
91
+ * rather than send a caller URL without credentials (it never pairs its own
92
+ * `webhookSecret` with a caller-controlled host), and request validation
93
+ * reports the missing field otherwise.
94
+ *
95
+ * Derived from `W` rather than restating its fields, so it accepts every
96
+ * reporting webhook the pinned schemas generate, whether they declare
97
+ * `authentication` required (3.2) or optional (3.3).
98
+ *
99
+ * Exported for the type tests only; not re-exported from the package root.
100
+ */
101
+ export type ClientReportingWebhookInputFor<W extends {
102
+ url: string;
103
+ reporting_frequency: unknown;
104
+ }> = Omit<W, 'url' | 'authentication' | 'reporting_frequency'> & {
105
+ url?: W['url'];
106
+ reporting_frequency?: W['reporting_frequency'];
107
+ /** Atomic: `schemes` and `credentials` always come from the same source. */
108
+ authentication?: W extends {
109
+ authentication?: infer A;
110
+ } ? (unknown extends A ? never : A) : never;
83
111
  };
84
- type ClientReportingWebhookInput = (ReportingWebhookPreferences & {
85
- url?: never;
86
- authentication?: CanonicalReportingWebhook['authentication'];
87
- }) | (ReportingWebhookPreferences & {
88
- url: CanonicalReportingWebhook['url'];
89
- authentication: CanonicalReportingWebhook['authentication'];
90
- });
112
+ type ClientReportingWebhookInput = ClientReportingWebhookInputFor<CanonicalReportingWebhook>;
91
113
  /**
92
114
  * Client-facing create request. The SDK may supply the reporting callback URL
93
115
  * and its complete authentication block from client configuration; the wire
94
116
  * request remains a strict {@link CanonicalCreateMediaBuyRequest}.
95
117
  */
96
118
  export type CanonicalCreateMediaBuyInput = Omit<CanonicalCreateMediaBuyRequest, 'reporting_webhook'> & {
97
- reporting_webhook?: ClientReportingWebhookInput;
119
+ reporting_webhook?: ClientReportingWebhookInput & {
120
+ signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
121
+ };
98
122
  };
99
123
  export type CanonicalUpdateMediaBuyRequest = Omit<CanonicalCreativeResponse<UpdateMediaBuyRequest>, 'packages' | 'new_packages'> & {
100
124
  packages?: CanonicalPackageUpdate[];
@@ -487,20 +487,32 @@ function creativeFormatParameterConstraints(creative) {
487
487
  if (width === void 0 && height === void 0 && durationMs === void 0) return void 0;
488
488
  return { width, height, durationMs };
489
489
  }
490
+ function legacyRefParameterConstraints(ref) {
491
+ const params = typeof ref.width !== "number" || typeof ref.height !== "number" ? record((0, import_v1_to_v2.canonicalDeclarationFromBareId)(ref.id, { agentUrl: ref.agent_url })?.params) : void 0;
492
+ return {
493
+ width: typeof ref.width === "number" ? ref.width : typeof params?.width === "number" ? params.width : void 0,
494
+ height: typeof ref.height === "number" ? ref.height : typeof params?.height === "number" ? params.height : void 0,
495
+ durationMs: ref.duration_ms
496
+ };
497
+ }
490
498
  function refContradictsConstraints(ref, constraints) {
491
- if (constraints.width !== void 0 && typeof ref.width === "number" && ref.width !== constraints.width) return true;
492
- if (constraints.height !== void 0 && typeof ref.height === "number" && ref.height !== constraints.height) {
499
+ const refConstraints = legacyRefParameterConstraints(ref);
500
+ if (constraints.width !== void 0 && refConstraints.width !== void 0 && refConstraints.width !== constraints.width) {
501
+ return true;
502
+ }
503
+ if (constraints.height !== void 0 && refConstraints.height !== void 0 && refConstraints.height !== constraints.height) {
493
504
  return true;
494
505
  }
495
- if (constraints.durationMs !== void 0 && typeof ref.duration_ms === "number" && ref.duration_ms !== constraints.durationMs) {
506
+ if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs === "number" && refConstraints.durationMs !== constraints.durationMs) {
496
507
  return true;
497
508
  }
498
509
  return false;
499
510
  }
500
511
  function refPinsConstraints(ref, constraints) {
501
- if (constraints.width !== void 0 && typeof ref.width !== "number") return false;
502
- if (constraints.height !== void 0 && typeof ref.height !== "number") return false;
503
- if (constraints.durationMs !== void 0 && typeof ref.duration_ms !== "number") return false;
512
+ const refConstraints = legacyRefParameterConstraints(ref);
513
+ if (constraints.width !== void 0 && refConstraints.width === void 0) return false;
514
+ if (constraints.height !== void 0 && refConstraints.height === void 0) return false;
515
+ if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs !== "number") return false;
504
516
  return true;
505
517
  }
506
518
  function legacyIdPinsDimensions(ref) {
@@ -510,15 +522,19 @@ function legacyIdPinsDimensions(ref) {
510
522
  return typeof params.width === "number" || typeof params.height === "number" || typeof params.duration_ms_exact === "number" || Array.isArray(params.sizes);
511
523
  }
512
524
  function refConstraintKey(ref) {
513
- return [agentIdentity(ref.agent_url), ref.width ?? "", ref.height ?? "", ref.duration_ms ?? ""].join("|");
525
+ const constraints = legacyRefParameterConstraints(ref);
526
+ return [
527
+ agentIdentity(ref.agent_url),
528
+ constraints.width ?? "",
529
+ constraints.height ?? "",
530
+ constraints.durationMs ?? ""
531
+ ].join("|");
514
532
  }
515
533
  function preferMostConstrainedLegacyCandidates(candidates, creative) {
516
- if (candidates.length <= 1) return candidates;
517
534
  let remaining = candidates;
518
535
  const constraints = creativeFormatParameterConstraints(creative);
519
536
  if (constraints) {
520
- const compatible = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
521
- if (compatible.length > 0) remaining = compatible;
537
+ remaining = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
522
538
  const pinned = remaining.filter((candidate) => refPinsConstraints(candidate.ref, constraints));
523
539
  if (pinned.length > 0) remaining = pinned;
524
540
  }
@@ -466,20 +466,32 @@ function creativeFormatParameterConstraints(creative) {
466
466
  if (width === void 0 && height === void 0 && durationMs === void 0) return void 0;
467
467
  return { width, height, durationMs };
468
468
  }
469
+ function legacyRefParameterConstraints(ref) {
470
+ const params = typeof ref.width !== "number" || typeof ref.height !== "number" ? record(canonicalDeclarationFromBareId(ref.id, { agentUrl: ref.agent_url })?.params) : void 0;
471
+ return {
472
+ width: typeof ref.width === "number" ? ref.width : typeof params?.width === "number" ? params.width : void 0,
473
+ height: typeof ref.height === "number" ? ref.height : typeof params?.height === "number" ? params.height : void 0,
474
+ durationMs: ref.duration_ms
475
+ };
476
+ }
469
477
  function refContradictsConstraints(ref, constraints) {
470
- if (constraints.width !== void 0 && typeof ref.width === "number" && ref.width !== constraints.width) return true;
471
- if (constraints.height !== void 0 && typeof ref.height === "number" && ref.height !== constraints.height) {
478
+ const refConstraints = legacyRefParameterConstraints(ref);
479
+ if (constraints.width !== void 0 && refConstraints.width !== void 0 && refConstraints.width !== constraints.width) {
480
+ return true;
481
+ }
482
+ if (constraints.height !== void 0 && refConstraints.height !== void 0 && refConstraints.height !== constraints.height) {
472
483
  return true;
473
484
  }
474
- if (constraints.durationMs !== void 0 && typeof ref.duration_ms === "number" && ref.duration_ms !== constraints.durationMs) {
485
+ if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs === "number" && refConstraints.durationMs !== constraints.durationMs) {
475
486
  return true;
476
487
  }
477
488
  return false;
478
489
  }
479
490
  function refPinsConstraints(ref, constraints) {
480
- if (constraints.width !== void 0 && typeof ref.width !== "number") return false;
481
- if (constraints.height !== void 0 && typeof ref.height !== "number") return false;
482
- if (constraints.durationMs !== void 0 && typeof ref.duration_ms !== "number") return false;
491
+ const refConstraints = legacyRefParameterConstraints(ref);
492
+ if (constraints.width !== void 0 && refConstraints.width === void 0) return false;
493
+ if (constraints.height !== void 0 && refConstraints.height === void 0) return false;
494
+ if (constraints.durationMs !== void 0 && typeof refConstraints.durationMs !== "number") return false;
483
495
  return true;
484
496
  }
485
497
  function legacyIdPinsDimensions(ref) {
@@ -489,15 +501,19 @@ function legacyIdPinsDimensions(ref) {
489
501
  return typeof params.width === "number" || typeof params.height === "number" || typeof params.duration_ms_exact === "number" || Array.isArray(params.sizes);
490
502
  }
491
503
  function refConstraintKey(ref) {
492
- return [agentIdentity(ref.agent_url), ref.width ?? "", ref.height ?? "", ref.duration_ms ?? ""].join("|");
504
+ const constraints = legacyRefParameterConstraints(ref);
505
+ return [
506
+ agentIdentity(ref.agent_url),
507
+ constraints.width ?? "",
508
+ constraints.height ?? "",
509
+ constraints.durationMs ?? ""
510
+ ].join("|");
493
511
  }
494
512
  function preferMostConstrainedLegacyCandidates(candidates, creative) {
495
- if (candidates.length <= 1) return candidates;
496
513
  let remaining = candidates;
497
514
  const constraints = creativeFormatParameterConstraints(creative);
498
515
  if (constraints) {
499
- const compatible = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
500
- if (compatible.length > 0) remaining = compatible;
516
+ remaining = remaining.filter((candidate) => !refContradictsConstraints(candidate.ref, constraints));
501
517
  const pinned = remaining.filter((candidate) => refPinsConstraints(candidate.ref, constraints));
502
518
  if (pinned.length > 0) remaining = pinned;
503
519
  }
@@ -43,7 +43,7 @@ export { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalF
43
43
  export type { V1ToV2Result, V1ToV2ProjectionOptions, BareFormatIdResolveOptions, LegacyFormatConversionContext, LegacyFormatConverter, LegacyFormatResolutionContext, LegacyFormatResolver, } from './v1-to-v2.mjs';
44
44
  export { projectV2ProductToV1 } from './v2-to-v1.mjs';
45
45
  export type { V2ToV1Result, V2ToV1ProjectionOptions, CanonicalFormatLegacyResolver, CanonicalFormatLegacyResolutionContext, CanonicalProductFormatLegacyResolutionContext, CanonicalCreativeFormatLegacyResolutionContext, CanonicalSelectorFormatLegacyResolutionContext, } from './v2-to-v1.mjs';
46
- export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, } from './legacy-routes.mjs';
46
+ export { canonicalFormatLegacyResolverFromRoutes, carryFormatOptionOrigins, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, type LegacyRoutesForProductOptions, } from './legacy-routes.mjs';
47
47
  export { augmentProductWithFormatOptions, withFormatOptions, toCanonicalFormatOptionsWithRoutes, toAdditiveCanonicalProduct, withAdditiveCanonicalFormatOptions, toCanonicalOnlyProduct, toCanonicalOnlyResponse, type V2AugmentedProduct, type AdditiveCanonicalProduct, type CanonicalOnlyProduct, } from './augment-response.mjs';
48
48
  export { CanonicalFormat, audioDaastFormatDeclaration, audioHostedFormatDeclaration, audioVastFormatDeclaration, agentPlacementFormatDeclaration, canonicalFormatDeclaration, customFormatDeclaration, displayTagFormatDeclaration, legacyFormatRef, legacyFormatRefs, html5FormatDeclaration, imageCarouselFormatDeclaration, imageFormatDeclaration, nativeInFeedFormatDeclaration, productCard, productCardDetailed, responsiveCreativeFormatDeclaration, sellerRenderedStatefulDisplayFormatDeclaration, sponsoredPlacementFormatDeclaration, coordinatedPlacementsFormatDeclaration, videoHostedFormatDeclaration, videoVastFormatDeclaration, type CanonicalFormatDeclaration, type CanonicalFormatDeclarationFields, type CanonicalFormatKind, type CanonicalFormatParams, type FormatReferenceInput, type ProductCardDetailedFields, type ProductCardFields, } from './builders.mjs';
49
49
  export { packageRefsForFormatOptions, packageRefsForCapabilities, legacyFormatIdsFromOptions, tryLegacyFormatIdsFromOptions, legacyFormatIdsForFormatOption, legacyFormatIdsForCapability, lintPackageFormatSelectorDimensions, FormatOptionRefsLookupError, CapabilityIdsLookupError, type PackageFormatRefs, type PackageCapabilityRefs, type FormatOptionRef, type FormatOptionSelector, type FormatOptionRefsLookupErrorCode, type CapabilityIdsLookupErrorCode, type PackageFormatSelectorInput, type PackageFormatSelectorDimensionOptions, type FixedSizeDimensions, type PackageFormatSelectorDimensionDiagnosticCode, type PackageFormatSelectorDimensionDiagnostic, } from './write-side.mjs';
@@ -43,7 +43,7 @@ export { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalF
43
43
  export type { V1ToV2Result, V1ToV2ProjectionOptions, BareFormatIdResolveOptions, LegacyFormatConversionContext, LegacyFormatConverter, LegacyFormatResolutionContext, LegacyFormatResolver, } from './v1-to-v2';
44
44
  export { projectV2ProductToV1 } from './v2-to-v1';
45
45
  export type { V2ToV1Result, V2ToV1ProjectionOptions, CanonicalFormatLegacyResolver, CanonicalFormatLegacyResolutionContext, CanonicalProductFormatLegacyResolutionContext, CanonicalCreativeFormatLegacyResolutionContext, CanonicalSelectorFormatLegacyResolutionContext, } from './v2-to-v1';
46
- export { canonicalFormatLegacyResolverFromRoutes, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, } from './legacy-routes';
46
+ export { canonicalFormatLegacyResolverFromRoutes, carryFormatOptionOrigins, legacyRoutesForProduct, type CanonicalFormatLegacyRoute, type LegacyRoutesForProductOptions, } from './legacy-routes';
47
47
  export { augmentProductWithFormatOptions, withFormatOptions, toCanonicalFormatOptionsWithRoutes, toAdditiveCanonicalProduct, withAdditiveCanonicalFormatOptions, toCanonicalOnlyProduct, toCanonicalOnlyResponse, type V2AugmentedProduct, type AdditiveCanonicalProduct, type CanonicalOnlyProduct, } from './augment-response';
48
48
  export { CanonicalFormat, audioDaastFormatDeclaration, audioHostedFormatDeclaration, audioVastFormatDeclaration, agentPlacementFormatDeclaration, canonicalFormatDeclaration, customFormatDeclaration, displayTagFormatDeclaration, legacyFormatRef, legacyFormatRefs, html5FormatDeclaration, imageCarouselFormatDeclaration, imageFormatDeclaration, nativeInFeedFormatDeclaration, productCard, productCardDetailed, responsiveCreativeFormatDeclaration, sellerRenderedStatefulDisplayFormatDeclaration, sponsoredPlacementFormatDeclaration, coordinatedPlacementsFormatDeclaration, videoHostedFormatDeclaration, videoVastFormatDeclaration, type CanonicalFormatDeclaration, type CanonicalFormatDeclarationFields, type CanonicalFormatKind, type CanonicalFormatParams, type FormatReferenceInput, type ProductCardDetailedFields, type ProductCardFields, } from './builders';
49
49
  export { packageRefsForFormatOptions, packageRefsForCapabilities, legacyFormatIdsFromOptions, tryLegacyFormatIdsFromOptions, legacyFormatIdsForFormatOption, legacyFormatIdsForCapability, lintPackageFormatSelectorDimensions, FormatOptionRefsLookupError, CapabilityIdsLookupError, type PackageFormatRefs, type PackageCapabilityRefs, type FormatOptionRef, type FormatOptionSelector, type FormatOptionRefsLookupErrorCode, type CapabilityIdsLookupErrorCode, type PackageFormatSelectorInput, type PackageFormatSelectorDimensionOptions, type FixedSizeDimensions, type PackageFormatSelectorDimensionDiagnosticCode, type PackageFormatSelectorDimensionDiagnostic, } from './write-side';
@@ -33,6 +33,7 @@ __export(projection_exports, {
33
33
  canonicalFormatDeclaration: () => import_builders.canonicalFormatDeclaration,
34
34
  canonicalFormatLegacyResolverFromCatalogSnapshots: () => import_catalog_snapshot.canonicalFormatLegacyResolverFromCatalogSnapshots,
35
35
  canonicalFormatLegacyResolverFromRoutes: () => import_legacy_routes.canonicalFormatLegacyResolverFromRoutes,
36
+ carryFormatOptionOrigins: () => import_legacy_routes.carryFormatOptionOrigins,
36
37
  coordinatedPlacementsFormatDeclaration: () => import_builders.coordinatedPlacementsFormatDeclaration,
37
38
  customFormatDeclaration: () => import_builders.customFormatDeclaration,
38
39
  displayTagFormatDeclaration: () => import_builders.displayTagFormatDeclaration,
@@ -111,6 +112,7 @@ var import_creative_delivery = require('./creative-delivery.js');
111
112
  canonicalFormatDeclaration,
112
113
  canonicalFormatLegacyResolverFromCatalogSnapshots,
113
114
  canonicalFormatLegacyResolverFromRoutes,
115
+ carryFormatOptionOrigins,
114
116
  coordinatedPlacementsFormatDeclaration,
115
117
  customFormatDeclaration,
116
118
  displayTagFormatDeclaration,
@@ -2,6 +2,7 @@ import { projectV1ProductToV2, canonicalDeclarationFromBareId, resolveCanonicalF
2
2
  import { projectV2ProductToV1 } from "./v2-to-v1.mjs";
3
3
  import {
4
4
  canonicalFormatLegacyResolverFromRoutes,
5
+ carryFormatOptionOrigins,
5
6
  legacyRoutesForProduct
6
7
  } from "./legacy-routes.mjs";
7
8
  import {
@@ -88,6 +89,7 @@ export {
88
89
  canonicalFormatDeclaration,
89
90
  canonicalFormatLegacyResolverFromCatalogSnapshots,
90
91
  canonicalFormatLegacyResolverFromRoutes,
92
+ carryFormatOptionOrigins,
91
93
  coordinatedPlacementsFormatDeclaration,
92
94
  customFormatDeclaration,
93
95
  displayTagFormatDeclaration,
@@ -51,12 +51,44 @@ export type FormatOptionOrigin = {
51
51
  seller_declared: false;
52
52
  selector: UndeclaredFormatOptionSelector;
53
53
  };
54
- /** Extract persistable routes from canonical declarations, including concealed migration metadata. */
55
- export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[]): CanonicalFormatLegacyRoute[];
54
+ /** Whether two option refs name the same format option. Publisher domains compare case-insensitively. */
55
+ export declare function sameFormatOptionRef(left: FormatOptionReference, right: FormatOptionReference): boolean;
56
+ /**
57
+ * Option refs a product declares in its own `format_options[]`, read from the
58
+ * product exactly as the seller returned it. Options the SDK derives from the
59
+ * seller's legacy `format_ids` never appear here.
60
+ */
61
+ export declare function sellerDeclaredFormatOptionRefs(sellerProduct: unknown): FormatOptionReference[];
62
+ export interface LegacyRoutesForProductOptions {
63
+ /**
64
+ * The product exactly as the seller returned it from `get_products`. When
65
+ * given, an option is seller-declared exactly when this product's own
66
+ * `format_options[]` names it. Use it when the declarations were projected
67
+ * from a stored seller response in a process that never ran discovery, so
68
+ * the SDK holds no origin metadata for them.
69
+ */
70
+ sellerProduct?: unknown;
71
+ }
72
+ /**
73
+ * Extract persistable routes from canonical declarations, including concealed
74
+ * migration metadata. Pass `sellerProduct` to record each option's origin from
75
+ * the seller's own response instead of that metadata.
76
+ */
77
+ export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[], options?: LegacyRoutesForProductOptions): CanonicalFormatLegacyRoute[];
56
78
  /**
57
79
  * The origin a resolver built by {@link canonicalFormatLegacyResolverFromRoutes}
58
80
  * recorded for one option. Without a product id, every route for the option
59
81
  * must agree that the seller did not declare it.
60
82
  */
61
83
  export declare function formatOptionOriginFromRoutes(resolver: CanonicalFormatLegacyResolver | undefined, ref: FormatOptionReference, productId: string | undefined): FormatOptionOrigin | undefined;
84
+ /**
85
+ * Make `resolver` report the format-option origins recorded by `sources`.
86
+ *
87
+ * A resolver built by {@link canonicalFormatLegacyResolverFromRoutes} carries
88
+ * each route's `seller_declared` origin, which `AgentClient` reads to rewrite
89
+ * options the seller never declared on the canonical wire. A resolver that
90
+ * wraps or composes it is a new function and would otherwise carry none.
91
+ * Returns `resolver` itself, so the call can wrap a composition inline.
92
+ */
93
+ export declare function carryFormatOptionOrigins(resolver: CanonicalFormatLegacyResolver, ...sources: ReadonlyArray<CanonicalFormatLegacyResolver | undefined>): CanonicalFormatLegacyResolver;
62
94
  export declare function canonicalFormatLegacyResolverFromRoutes(routes: readonly CanonicalFormatLegacyRoute[]): CanonicalFormatLegacyResolver;
@@ -51,12 +51,44 @@ export type FormatOptionOrigin = {
51
51
  seller_declared: false;
52
52
  selector: UndeclaredFormatOptionSelector;
53
53
  };
54
- /** Extract persistable routes from canonical declarations, including concealed migration metadata. */
55
- export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[]): CanonicalFormatLegacyRoute[];
54
+ /** Whether two option refs name the same format option. Publisher domains compare case-insensitively. */
55
+ export declare function sameFormatOptionRef(left: FormatOptionReference, right: FormatOptionReference): boolean;
56
+ /**
57
+ * Option refs a product declares in its own `format_options[]`, read from the
58
+ * product exactly as the seller returned it. Options the SDK derives from the
59
+ * seller's legacy `format_ids` never appear here.
60
+ */
61
+ export declare function sellerDeclaredFormatOptionRefs(sellerProduct: unknown): FormatOptionReference[];
62
+ export interface LegacyRoutesForProductOptions {
63
+ /**
64
+ * The product exactly as the seller returned it from `get_products`. When
65
+ * given, an option is seller-declared exactly when this product's own
66
+ * `format_options[]` names it. Use it when the declarations were projected
67
+ * from a stored seller response in a process that never ran discovery, so
68
+ * the SDK holds no origin metadata for them.
69
+ */
70
+ sellerProduct?: unknown;
71
+ }
72
+ /**
73
+ * Extract persistable routes from canonical declarations, including concealed
74
+ * migration metadata. Pass `sellerProduct` to record each option's origin from
75
+ * the seller's own response instead of that metadata.
76
+ */
77
+ export declare function legacyRoutesForProduct(productId: string, declarations: readonly V2ProductFormatDeclaration[], options?: LegacyRoutesForProductOptions): CanonicalFormatLegacyRoute[];
56
78
  /**
57
79
  * The origin a resolver built by {@link canonicalFormatLegacyResolverFromRoutes}
58
80
  * recorded for one option. Without a product id, every route for the option
59
81
  * must agree that the seller did not declare it.
60
82
  */
61
83
  export declare function formatOptionOriginFromRoutes(resolver: CanonicalFormatLegacyResolver | undefined, ref: FormatOptionReference, productId: string | undefined): FormatOptionOrigin | undefined;
84
+ /**
85
+ * Make `resolver` report the format-option origins recorded by `sources`.
86
+ *
87
+ * A resolver built by {@link canonicalFormatLegacyResolverFromRoutes} carries
88
+ * each route's `seller_declared` origin, which `AgentClient` reads to rewrite
89
+ * options the seller never declared on the canonical wire. A resolver that
90
+ * wraps or composes it is a new function and would otherwise carry none.
91
+ * Returns `resolver` itself, so the call can wrap a composition inline.
92
+ */
93
+ export declare function carryFormatOptionOrigins(resolver: CanonicalFormatLegacyResolver, ...sources: ReadonlyArray<CanonicalFormatLegacyResolver | undefined>): CanonicalFormatLegacyResolver;
62
94
  export declare function canonicalFormatLegacyResolverFromRoutes(routes: readonly CanonicalFormatLegacyRoute[]): CanonicalFormatLegacyResolver;
@@ -19,8 +19,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var legacy_routes_exports = {};
20
20
  __export(legacy_routes_exports, {
21
21
  canonicalFormatLegacyResolverFromRoutes: () => canonicalFormatLegacyResolverFromRoutes,
22
+ carryFormatOptionOrigins: () => carryFormatOptionOrigins,
22
23
  formatOptionOriginFromRoutes: () => formatOptionOriginFromRoutes,
23
24
  legacyRoutesForProduct: () => legacyRoutesForProduct,
25
+ sameFormatOptionRef: () => sameFormatOptionRef,
26
+ sellerDeclaredFormatOptionRefs: () => sellerDeclaredFormatOptionRefs,
24
27
  undeclaredFormatOptionSelector: () => undeclaredFormatOptionSelector
25
28
  });
26
29
  module.exports = __toCommonJS(legacy_routes_exports);
@@ -62,6 +65,27 @@ function routeRef(value) {
62
65
  if (record.scope !== void 0 && record.scope !== "product") return void 0;
63
66
  return { scope: "product", format_option_id: record.format_option_id };
64
67
  }
68
+ function sameFormatOptionRef(left, right) {
69
+ return left.scope === right.scope && left.format_option_id === right.format_option_id && (left.scope !== "publisher" || right.scope === "publisher" && left.publisher_domain.toLowerCase() === right.publisher_domain.toLowerCase());
70
+ }
71
+ function sellerDeclaredFormatOptionRefs(sellerProduct) {
72
+ if (!sellerProduct || typeof sellerProduct !== "object" || Array.isArray(sellerProduct)) return [];
73
+ const options = sellerProduct.format_options;
74
+ const refs = [];
75
+ for (const optionValue of Array.isArray(options) ? options : []) {
76
+ if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
77
+ const option = optionValue;
78
+ if (typeof option.format_option_id !== "string") continue;
79
+ refs.push(
80
+ typeof option.publisher_domain === "string" ? {
81
+ scope: "publisher",
82
+ publisher_domain: option.publisher_domain,
83
+ format_option_id: option.format_option_id
84
+ } : { scope: "product", format_option_id: option.format_option_id }
85
+ );
86
+ }
87
+ return refs;
88
+ }
65
89
  function routeKey(productId, ref) {
66
90
  return JSON.stringify([
67
91
  productId,
@@ -89,12 +113,13 @@ function uniqueFormatIds(refs) {
89
113
  ).values()
90
114
  ];
91
115
  }
92
- function legacyRoutesForProduct(productId, declarations) {
116
+ function legacyRoutesForProduct(productId, declarations, options = {}) {
117
+ const declaredRefs = options.sellerProduct === void 0 ? void 0 : sellerDeclaredFormatOptionRefs(options.sellerProduct);
93
118
  return declarations.flatMap((declaration) => {
94
119
  const formatOptionRef = routeRef(declaration);
95
120
  const formatIds = uniqueFormatIds((0, import_legacy_metadata.legacyFormatRefsForDeclaration)(declaration));
96
121
  if (!formatOptionRef || formatIds.length === 0) return [];
97
- const declared = (0, import_legacy_metadata.sellerDeclaredFormatOption)(declaration);
122
+ const declared = declaredRefs ? declaredRefs.some((ref) => sameFormatOptionRef(ref, formatOptionRef)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(declaration);
98
123
  const selector = declared === false ? undeclaredFormatOptionSelector(declaration) : void 0;
99
124
  return [
100
125
  {
@@ -180,6 +205,11 @@ function formatOptionOriginFromRoutes(resolver, ref, productId) {
180
205
  if (matching.some((entry) => entry.origin === void 0)) return void 0;
181
206
  return matching[0].origin;
182
207
  }
208
+ function carryFormatOptionOrigins(resolver, ...sources) {
209
+ const carried = [resolver, ...sources].flatMap((source) => source ? originsByResolver.get(source) ?? [] : []);
210
+ if (carried.length > 0) originsByResolver.set(resolver, Object.freeze(carried));
211
+ return resolver;
212
+ }
183
213
  function canonicalFormatLegacyResolverFromRoutes(routes) {
184
214
  const index = /* @__PURE__ */ new Map();
185
215
  const origins = [];
@@ -213,7 +243,10 @@ function canonicalFormatLegacyResolverFromRoutes(routes) {
213
243
  // Annotate the CommonJS export names for ESM import in node:
214
244
  0 && (module.exports = {
215
245
  canonicalFormatLegacyResolverFromRoutes,
246
+ carryFormatOptionOrigins,
216
247
  formatOptionOriginFromRoutes,
217
248
  legacyRoutesForProduct,
249
+ sameFormatOptionRef,
250
+ sellerDeclaredFormatOptionRefs,
218
251
  undeclaredFormatOptionSelector
219
252
  });
@@ -36,6 +36,27 @@ function routeRef(value) {
36
36
  if (record.scope !== void 0 && record.scope !== "product") return void 0;
37
37
  return { scope: "product", format_option_id: record.format_option_id };
38
38
  }
39
+ function sameFormatOptionRef(left, right) {
40
+ return left.scope === right.scope && left.format_option_id === right.format_option_id && (left.scope !== "publisher" || right.scope === "publisher" && left.publisher_domain.toLowerCase() === right.publisher_domain.toLowerCase());
41
+ }
42
+ function sellerDeclaredFormatOptionRefs(sellerProduct) {
43
+ if (!sellerProduct || typeof sellerProduct !== "object" || Array.isArray(sellerProduct)) return [];
44
+ const options = sellerProduct.format_options;
45
+ const refs = [];
46
+ for (const optionValue of Array.isArray(options) ? options : []) {
47
+ if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
48
+ const option = optionValue;
49
+ if (typeof option.format_option_id !== "string") continue;
50
+ refs.push(
51
+ typeof option.publisher_domain === "string" ? {
52
+ scope: "publisher",
53
+ publisher_domain: option.publisher_domain,
54
+ format_option_id: option.format_option_id
55
+ } : { scope: "product", format_option_id: option.format_option_id }
56
+ );
57
+ }
58
+ return refs;
59
+ }
39
60
  function routeKey(productId, ref) {
40
61
  return JSON.stringify([
41
62
  productId,
@@ -63,12 +84,13 @@ function uniqueFormatIds(refs) {
63
84
  ).values()
64
85
  ];
65
86
  }
66
- function legacyRoutesForProduct(productId, declarations) {
87
+ function legacyRoutesForProduct(productId, declarations, options = {}) {
88
+ const declaredRefs = options.sellerProduct === void 0 ? void 0 : sellerDeclaredFormatOptionRefs(options.sellerProduct);
67
89
  return declarations.flatMap((declaration) => {
68
90
  const formatOptionRef = routeRef(declaration);
69
91
  const formatIds = uniqueFormatIds(legacyFormatRefsForDeclaration(declaration));
70
92
  if (!formatOptionRef || formatIds.length === 0) return [];
71
- const declared = sellerDeclaredFormatOption(declaration);
93
+ const declared = declaredRefs ? declaredRefs.some((ref) => sameFormatOptionRef(ref, formatOptionRef)) : sellerDeclaredFormatOption(declaration);
72
94
  const selector = declared === false ? undeclaredFormatOptionSelector(declaration) : void 0;
73
95
  return [
74
96
  {
@@ -154,6 +176,11 @@ function formatOptionOriginFromRoutes(resolver, ref, productId) {
154
176
  if (matching.some((entry) => entry.origin === void 0)) return void 0;
155
177
  return matching[0].origin;
156
178
  }
179
+ function carryFormatOptionOrigins(resolver, ...sources) {
180
+ const carried = [resolver, ...sources].flatMap((source) => source ? originsByResolver.get(source) ?? [] : []);
181
+ if (carried.length > 0) originsByResolver.set(resolver, Object.freeze(carried));
182
+ return resolver;
183
+ }
157
184
  function canonicalFormatLegacyResolverFromRoutes(routes) {
158
185
  const index = /* @__PURE__ */ new Map();
159
186
  const origins = [];
@@ -186,7 +213,10 @@ function canonicalFormatLegacyResolverFromRoutes(routes) {
186
213
  }
187
214
  export {
188
215
  canonicalFormatLegacyResolverFromRoutes,
216
+ carryFormatOptionOrigins,
189
217
  formatOptionOriginFromRoutes,
190
218
  legacyRoutesForProduct,
219
+ sameFormatOptionRef,
220
+ sellerDeclaredFormatOptionRefs,
191
221
  undeclaredFormatOptionSelector
192
222
  };