@adcp/sdk 14.0.0-rc.37 → 14.0.0-rc.39

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 (622) hide show
  1. package/bin/adcp-storyboard-summary.js +286 -0
  2. package/bin/adcp.js +221 -10
  3. package/dist/lib/conformance/schemaLoader.d.mts +1 -1
  4. package/dist/lib/conformance/schemaLoader.d.ts +1 -1
  5. package/dist/lib/core/AgentClient.d.mts +6 -1
  6. package/dist/lib/core/AgentClient.d.ts +6 -1
  7. package/dist/lib/core/AgentClient.js +9 -0
  8. package/dist/lib/core/AgentClient.mjs +9 -0
  9. package/dist/lib/core/ConversationTypes.d.mts +29 -0
  10. package/dist/lib/core/ConversationTypes.d.ts +29 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +3 -1
  12. package/dist/lib/core/SingleAgentClient.d.ts +3 -1
  13. package/dist/lib/core/SingleAgentClient.js +9 -1
  14. package/dist/lib/core/SingleAgentClient.mjs +9 -1
  15. package/dist/lib/core/TaskExecutor.d.mts +13 -1
  16. package/dist/lib/core/TaskExecutor.d.ts +13 -1
  17. package/dist/lib/core/TaskExecutor.js +216 -18
  18. package/dist/lib/core/TaskExecutor.mjs +216 -19
  19. package/dist/lib/index.d.mts +5 -2
  20. package/dist/lib/index.d.ts +5 -2
  21. package/dist/lib/index.js +10 -1
  22. package/dist/lib/index.mjs +10 -1
  23. package/dist/lib/media-buy/action-assessment.d.mts +77 -0
  24. package/dist/lib/media-buy/action-assessment.d.ts +77 -0
  25. package/dist/lib/media-buy/action-assessment.js +300 -0
  26. package/dist/lib/media-buy/action-assessment.mjs +284 -0
  27. package/dist/lib/media-buy/action-constraints.d.mts +9 -0
  28. package/dist/lib/media-buy/action-constraints.d.ts +9 -0
  29. package/dist/lib/media-buy/action-constraints.js +170 -0
  30. package/dist/lib/media-buy/action-constraints.mjs +146 -0
  31. package/dist/lib/media-buy/action-contracts.d.mts +40 -0
  32. package/dist/lib/media-buy/action-contracts.d.ts +40 -0
  33. package/dist/lib/media-buy/action-contracts.js +304 -0
  34. package/dist/lib/media-buy/action-contracts.mjs +267 -0
  35. package/dist/lib/media-buy/action-metadata.generated.d.mts +37 -0
  36. package/dist/lib/media-buy/action-metadata.generated.d.ts +37 -0
  37. package/dist/lib/media-buy/action-metadata.generated.js +128 -0
  38. package/dist/lib/media-buy/action-metadata.generated.mjs +101 -0
  39. package/dist/lib/media-buy/action-types.d.mts +106 -0
  40. package/dist/lib/media-buy/action-types.d.ts +106 -0
  41. package/dist/lib/{types/v3-1-beta/tools.generated.js → media-buy/action-types.js} +2 -2
  42. package/dist/lib/media-buy/actions.d.mts +6 -0
  43. package/dist/lib/media-buy/actions.d.ts +6 -0
  44. package/dist/lib/media-buy/actions.js +38 -0
  45. package/dist/lib/media-buy/actions.mjs +9 -0
  46. package/dist/lib/media-buy/available-actions.d.mts +2 -1
  47. package/dist/lib/media-buy/available-actions.d.ts +2 -1
  48. package/dist/lib/media-buy/available-actions.js +4 -3
  49. package/dist/lib/media-buy/available-actions.mjs +4 -3
  50. package/dist/lib/media-buy/compatibility.js +3 -0
  51. package/dist/lib/media-buy/compatibility.mjs +3 -0
  52. package/dist/lib/media-buy/index.d.mts +4 -0
  53. package/dist/lib/media-buy/index.d.ts +4 -0
  54. package/dist/lib/media-buy/index.js +3 -1
  55. package/dist/lib/media-buy/index.mjs +1 -0
  56. package/dist/lib/media-buy/legacy-action-ids.d.mts +1 -0
  57. package/dist/lib/media-buy/legacy-action-ids.d.ts +1 -0
  58. package/dist/lib/media-buy/legacy-action-ids.js +50 -0
  59. package/dist/lib/media-buy/legacy-action-ids.mjs +26 -0
  60. package/dist/lib/media-buy/mutations.d.mts +70 -0
  61. package/dist/lib/media-buy/mutations.d.ts +70 -0
  62. package/dist/lib/media-buy/mutations.js +525 -0
  63. package/dist/lib/media-buy/mutations.mjs +498 -0
  64. package/dist/lib/media-buy/preflight.d.mts +20 -69
  65. package/dist/lib/media-buy/preflight.d.ts +20 -69
  66. package/dist/lib/media-buy/preflight.js +100 -336
  67. package/dist/lib/media-buy/preflight.mjs +111 -333
  68. package/dist/lib/media-buy/targeting-input.d.mts +7 -4
  69. package/dist/lib/media-buy/targeting-input.d.ts +7 -4
  70. package/dist/lib/media-buy/types.d.mts +55 -7
  71. package/dist/lib/media-buy/types.d.ts +55 -7
  72. package/dist/lib/protocols/rawResponseCapture.d.mts +12 -0
  73. package/dist/lib/protocols/rawResponseCapture.d.ts +12 -0
  74. package/dist/lib/protocols/rawResponseCapture.js +33 -3
  75. package/dist/lib/protocols/rawResponseCapture.mjs +32 -3
  76. package/dist/lib/registry/types.generated.d.mts +377 -9
  77. package/dist/lib/registry/types.generated.d.ts +377 -9
  78. package/dist/lib/reporting/content-mismatch.d.mts +126 -0
  79. package/dist/lib/reporting/content-mismatch.d.ts +126 -0
  80. package/dist/lib/reporting/content-mismatch.js +90 -0
  81. package/dist/lib/reporting/content-mismatch.mjs +66 -0
  82. package/dist/lib/reporting/evidence.d.mts +1 -0
  83. package/dist/lib/reporting/evidence.d.ts +1 -0
  84. package/dist/lib/reporting/evidence.js +32 -3
  85. package/dist/lib/reporting/evidence.mjs +31 -3
  86. package/dist/lib/reporting/index.d.mts +3 -1
  87. package/dist/lib/reporting/index.d.ts +3 -1
  88. package/dist/lib/reporting/index.js +3 -0
  89. package/dist/lib/reporting/index.mjs +2 -0
  90. package/dist/lib/reporting/ledger/handler.d.mts +51 -1
  91. package/dist/lib/reporting/ledger/handler.d.ts +51 -1
  92. package/dist/lib/reporting/ledger/handler.js +306 -38
  93. package/dist/lib/reporting/ledger/handler.mjs +304 -37
  94. package/dist/lib/reporting/ledger/health.d.mts +12 -0
  95. package/dist/lib/reporting/ledger/health.d.ts +12 -0
  96. package/dist/lib/reporting/ledger/health.js +15 -2
  97. package/dist/lib/reporting/ledger/health.mjs +13 -1
  98. package/dist/lib/reporting/ledger/index.d.mts +3 -0
  99. package/dist/lib/reporting/ledger/index.d.ts +3 -0
  100. package/dist/lib/reporting/ledger/index.js +7 -1
  101. package/dist/lib/reporting/ledger/index.mjs +3 -0
  102. package/dist/lib/reporting/ledger/lifecycle.d.mts +31 -4
  103. package/dist/lib/reporting/ledger/lifecycle.d.ts +31 -4
  104. package/dist/lib/reporting/ledger/lifecycle.js +244 -37
  105. package/dist/lib/reporting/ledger/lifecycle.mjs +244 -37
  106. package/dist/lib/reporting/ledger/managed-postgres.d.mts +231 -0
  107. package/dist/lib/reporting/ledger/managed-postgres.d.ts +231 -0
  108. package/dist/lib/reporting/ledger/managed-postgres.js +1797 -0
  109. package/dist/lib/reporting/ledger/managed-postgres.mjs +1776 -0
  110. package/dist/lib/reporting/ledger/managed.d.mts +355 -0
  111. package/dist/lib/reporting/ledger/managed.d.ts +355 -0
  112. package/dist/lib/reporting/ledger/managed.js +661 -0
  113. package/dist/lib/reporting/ledger/managed.mjs +633 -0
  114. package/dist/lib/reporting/ledger/notification-activity.d.mts +222 -0
  115. package/dist/lib/reporting/ledger/notification-activity.d.ts +222 -0
  116. package/dist/lib/reporting/ledger/notification-activity.js +1139 -0
  117. package/dist/lib/reporting/ledger/notification-activity.mjs +1110 -0
  118. package/dist/lib/reporting/ledger/postgres.d.mts +161 -1
  119. package/dist/lib/reporting/ledger/postgres.d.ts +161 -1
  120. package/dist/lib/reporting/ledger/postgres.js +1153 -21
  121. package/dist/lib/reporting/ledger/postgres.mjs +1152 -21
  122. package/dist/lib/reporting/ledger/producer.d.mts +8 -0
  123. package/dist/lib/reporting/ledger/producer.d.ts +8 -0
  124. package/dist/lib/reporting/ledger/producer.js +146 -52
  125. package/dist/lib/reporting/ledger/producer.mjs +146 -51
  126. package/dist/lib/reporting/ledger/types.d.mts +358 -1
  127. package/dist/lib/reporting/ledger/types.d.ts +358 -1
  128. package/dist/lib/reporting/ledger/types.js +3 -0
  129. package/dist/lib/reporting/ledger/types.mjs +2 -0
  130. package/dist/lib/reporting/reconciliation.d.mts +362 -2
  131. package/dist/lib/reporting/reconciliation.d.ts +362 -2
  132. package/dist/lib/reporting/reconciliation.js +1051 -7
  133. package/dist/lib/reporting/reconciliation.mjs +1053 -7
  134. package/dist/lib/reporting/service/conformance.d.mts +35 -0
  135. package/dist/lib/reporting/service/conformance.d.ts +35 -0
  136. package/dist/lib/reporting/service/conformance.js +89 -0
  137. package/dist/lib/reporting/service/conformance.mjs +68 -0
  138. package/dist/lib/reporting/service/index.d.mts +182 -0
  139. package/dist/lib/reporting/service/index.d.ts +182 -0
  140. package/dist/lib/reporting/service/index.js +793 -0
  141. package/dist/lib/reporting/service/index.mjs +787 -0
  142. package/dist/lib/reporting/source/index.d.mts +2 -1
  143. package/dist/lib/reporting/source/index.d.ts +2 -1
  144. package/dist/lib/reporting/source/index.js +16 -3
  145. package/dist/lib/reporting/source/index.mjs +12 -1
  146. package/dist/lib/reporting/source/inline.d.mts +88 -1
  147. package/dist/lib/reporting/source/inline.d.ts +88 -1
  148. package/dist/lib/reporting/source/inline.js +1161 -163
  149. package/dist/lib/reporting/source/inline.mjs +1166 -163
  150. package/dist/lib/reporting/source/manifest.js +12 -7
  151. package/dist/lib/reporting/source/manifest.mjs +12 -7
  152. package/dist/lib/reporting/source/source.d.mts +26 -0
  153. package/dist/lib/reporting/source/source.d.ts +26 -0
  154. package/dist/lib/reporting/source/source.js +71 -2
  155. package/dist/lib/reporting/source/source.mjs +65 -1
  156. package/dist/lib/schemas/index.d.mts +22 -1
  157. package/dist/lib/schemas/index.d.ts +22 -1
  158. package/dist/lib/schemas/index.js +7 -0
  159. package/dist/lib/schemas/index.mjs +7 -0
  160. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  161. package/dist/lib/server/create-adcp-server.d.mts +18 -0
  162. package/dist/lib/server/create-adcp-server.d.ts +18 -0
  163. package/dist/lib/server/create-adcp-server.js +52 -2
  164. package/dist/lib/server/create-adcp-server.mjs +52 -2
  165. package/dist/lib/server/decisioning/account.d.mts +1 -1
  166. package/dist/lib/server/decisioning/account.d.ts +1 -1
  167. package/dist/lib/server/decisioning/index.d.mts +1 -0
  168. package/dist/lib/server/decisioning/index.d.ts +1 -0
  169. package/dist/lib/server/decisioning/platform.d.mts +3 -0
  170. package/dist/lib/server/decisioning/platform.d.ts +3 -0
  171. package/dist/lib/server/decisioning/runtime/from-platform.js +88 -10
  172. package/dist/lib/server/decisioning/runtime/from-platform.mjs +88 -10
  173. package/dist/lib/server/decisioning/specialisms/reporting.d.mts +38 -0
  174. package/dist/lib/server/decisioning/specialisms/reporting.d.ts +38 -0
  175. package/dist/lib/{types/v3-1-beta/index.js → server/decisioning/specialisms/reporting.js} +2 -8
  176. package/dist/lib/server/decisioning/specialisms/reporting.mjs +0 -0
  177. package/dist/lib/server/index.d.mts +4 -2
  178. package/dist/lib/server/index.d.ts +4 -2
  179. package/dist/lib/server/index.js +5 -0
  180. package/dist/lib/server/index.mjs +4 -0
  181. package/dist/lib/server/media-buy-action-resolver.d.mts +63 -0
  182. package/dist/lib/server/media-buy-action-resolver.d.ts +63 -0
  183. package/dist/lib/server/media-buy-action-resolver.js +297 -0
  184. package/dist/lib/server/media-buy-action-resolver.mjs +285 -0
  185. package/dist/lib/server/media-buy-actions.d.mts +7 -8
  186. package/dist/lib/server/media-buy-actions.d.ts +7 -8
  187. package/dist/lib/server/media-buy-actions.js +57 -14
  188. package/dist/lib/server/media-buy-actions.mjs +63 -14
  189. package/dist/lib/server/notification-subscriptions/index.d.mts +2 -2
  190. package/dist/lib/server/notification-subscriptions/index.d.ts +2 -2
  191. package/dist/lib/server/notification-subscriptions/index.js +2 -0
  192. package/dist/lib/server/notification-subscriptions/index.mjs +2 -0
  193. package/dist/lib/server/notification-subscriptions/postgres-runtime.d.mts +3 -1
  194. package/dist/lib/server/notification-subscriptions/postgres-runtime.d.ts +3 -1
  195. package/dist/lib/server/notification-subscriptions/postgres-runtime.js +1 -0
  196. package/dist/lib/server/notification-subscriptions/postgres-runtime.mjs +1 -0
  197. package/dist/lib/server/notification-subscriptions/runtime.d.mts +12 -1
  198. package/dist/lib/server/notification-subscriptions/runtime.d.ts +12 -1
  199. package/dist/lib/server/notification-subscriptions/runtime.js +102 -16
  200. package/dist/lib/server/notification-subscriptions/runtime.mjs +101 -16
  201. package/dist/lib/server/notification-subscriptions/types.d.mts +104 -1
  202. package/dist/lib/server/notification-subscriptions/types.d.ts +104 -1
  203. package/dist/lib/server/webhook-emitter.d.mts +40 -5
  204. package/dist/lib/server/webhook-emitter.d.ts +40 -5
  205. package/dist/lib/server/webhook-emitter.js +23 -12
  206. package/dist/lib/server/webhook-emitter.mjs +23 -12
  207. package/dist/lib/storage/interfaces.d.mts +14 -2
  208. package/dist/lib/storage/interfaces.d.ts +14 -2
  209. package/dist/lib/testing/compliance/comply.d.mts +9 -3
  210. package/dist/lib/testing/compliance/comply.d.ts +9 -3
  211. package/dist/lib/testing/compliance/comply.js +158 -3
  212. package/dist/lib/testing/compliance/comply.mjs +159 -4
  213. package/dist/lib/testing/compliance/storyboard-tracks.js +7 -5
  214. package/dist/lib/testing/compliance/storyboard-tracks.mjs +7 -5
  215. package/dist/lib/testing/compliance/summary.js +10 -1
  216. package/dist/lib/testing/compliance/summary.mjs +10 -1
  217. package/dist/lib/testing/index.d.mts +1 -1
  218. package/dist/lib/testing/index.d.ts +1 -1
  219. package/dist/lib/testing/index.js +2 -0
  220. package/dist/lib/testing/index.mjs +3 -1
  221. package/dist/lib/testing/storyboard/agent-routing.d.mts +12 -43
  222. package/dist/lib/testing/storyboard/agent-routing.d.ts +12 -43
  223. package/dist/lib/testing/storyboard/agent-routing.js +75 -13
  224. package/dist/lib/testing/storyboard/agent-routing.mjs +70 -12
  225. package/dist/lib/testing/storyboard/index.d.mts +1 -0
  226. package/dist/lib/testing/storyboard/index.d.ts +1 -0
  227. package/dist/lib/testing/storyboard/index.js +3 -0
  228. package/dist/lib/testing/storyboard/index.mjs +2 -0
  229. package/dist/lib/testing/storyboard/junit.d.mts +1 -1
  230. package/dist/lib/testing/storyboard/junit.d.ts +1 -1
  231. package/dist/lib/testing/storyboard/junit.js +21 -2
  232. package/dist/lib/testing/storyboard/junit.mjs +21 -2
  233. package/dist/lib/testing/storyboard/probes.d.mts +130 -0
  234. package/dist/lib/testing/storyboard/probes.d.ts +130 -0
  235. package/dist/lib/testing/storyboard/probes.js +682 -10
  236. package/dist/lib/testing/storyboard/probes.mjs +683 -3
  237. package/dist/lib/testing/storyboard/request-signing/builder.d.mts +16 -5
  238. package/dist/lib/testing/storyboard/request-signing/builder.d.ts +16 -5
  239. package/dist/lib/testing/storyboard/request-signing/grader.d.mts +44 -1
  240. package/dist/lib/testing/storyboard/request-signing/grader.d.ts +44 -1
  241. package/dist/lib/testing/storyboard/request-signing/grader.js +46 -22
  242. package/dist/lib/testing/storyboard/request-signing/grader.mjs +43 -21
  243. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.mts +86 -11
  244. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.ts +86 -11
  245. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +119 -25
  246. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +117 -26
  247. package/dist/lib/testing/storyboard/request-signing/synthesize.js +22 -2
  248. package/dist/lib/testing/storyboard/request-signing/synthesize.mjs +22 -2
  249. package/dist/lib/testing/storyboard/runner.d.mts +103 -0
  250. package/dist/lib/testing/storyboard/runner.d.ts +103 -0
  251. package/dist/lib/testing/storyboard/runner.js +1090 -268
  252. package/dist/lib/testing/storyboard/runner.mjs +1096 -261
  253. package/dist/lib/testing/storyboard/seeding.d.mts +4 -1
  254. package/dist/lib/testing/storyboard/seeding.d.ts +4 -1
  255. package/dist/lib/testing/storyboard/seeding.js +55 -24
  256. package/dist/lib/testing/storyboard/seeding.mjs +55 -24
  257. package/dist/lib/testing/storyboard/test-kit.d.mts +37 -3
  258. package/dist/lib/testing/storyboard/test-kit.d.ts +37 -3
  259. package/dist/lib/testing/storyboard/test-kit.js +8 -2
  260. package/dist/lib/testing/storyboard/test-kit.mjs +7 -2
  261. package/dist/lib/testing/storyboard/types.d.mts +132 -10
  262. package/dist/lib/testing/storyboard/types.d.ts +132 -10
  263. package/dist/lib/testing/storyboard/types.js +17 -0
  264. package/dist/lib/testing/storyboard/types.mjs +16 -0
  265. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  266. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  267. package/dist/lib/testing/storyboard/validations.js +16 -0
  268. package/dist/lib/testing/storyboard/validations.mjs +16 -0
  269. package/dist/lib/testing/test-controller.d.mts +1 -1
  270. package/dist/lib/testing/test-controller.d.ts +1 -1
  271. package/dist/lib/types/buy-products.d.ts +71 -6
  272. package/dist/lib/types/control-media-buy.d.ts +25 -11
  273. package/dist/lib/types/core.generated.d.mts +69 -10
  274. package/dist/lib/types/core.generated.d.ts +69 -10
  275. package/dist/lib/types/create-media-buy.d.ts +71 -6
  276. package/dist/lib/types/forward-compat-error-codes.d.mts +7 -6
  277. package/dist/lib/types/forward-compat-error-codes.d.ts +7 -6
  278. package/dist/lib/types/index.d.mts +2 -2
  279. package/dist/lib/types/index.d.ts +2 -2
  280. package/dist/lib/types/schemas.generated.d.ts +8040 -8116
  281. package/dist/lib/types/schemas.generated.js +1074 -309
  282. package/dist/lib/types/schemas.generated.mjs +1068 -309
  283. package/dist/lib/types/tools.generated.d.mts +65 -6
  284. package/dist/lib/types/tools.generated.d.ts +65 -6
  285. package/dist/lib/types/update-media-buy.d.ts +71 -6
  286. package/dist/lib/utils/redact-secrets.d.mts +1 -1
  287. package/dist/lib/utils/redact-secrets.d.ts +1 -1
  288. package/dist/lib/utils/redact-secrets.js +1 -1
  289. package/dist/lib/utils/redact-secrets.mjs +1 -1
  290. package/dist/lib/v2/projection/cache-versions.d.mts +0 -1
  291. package/dist/lib/v2/projection/cache-versions.d.ts +0 -1
  292. package/dist/lib/v2/projection/cache-versions.js +1 -15
  293. package/dist/lib/v2/projection/cache-versions.mjs +1 -14
  294. package/dist/lib/v2/projection/canonical-properties.js +2 -2
  295. package/dist/lib/v2/projection/canonical-properties.mjs +3 -3
  296. package/dist/lib/v2/projection/registry.d.mts +1 -1
  297. package/dist/lib/v2/projection/registry.d.ts +1 -1
  298. package/dist/lib/v2/projection/registry.js +2 -2
  299. package/dist/lib/v2/projection/registry.mjs +3 -3
  300. package/dist/lib/validation/schema-loader.d.mts +9 -1
  301. package/dist/lib/validation/schema-loader.d.ts +9 -1
  302. package/dist/lib/validation/schema-loader.js +65 -8
  303. package/dist/lib/validation/schema-loader.mjs +64 -8
  304. package/dist/lib/version.d.mts +5 -5
  305. package/dist/lib/version.d.ts +5 -5
  306. package/dist/lib/version.js +3 -8
  307. package/dist/lib/version.mjs +3 -8
  308. package/dist/lib/wholesale-feed-sync/index.d.mts +1 -0
  309. package/dist/lib/wholesale-feed-sync/index.d.ts +1 -0
  310. package/dist/lib/wholesale-feed-sync/protocol-types.d.mts +42 -0
  311. package/dist/lib/wholesale-feed-sync/protocol-types.d.ts +42 -0
  312. package/dist/lib/wholesale-feed-sync/protocol-types.js +16 -0
  313. package/dist/lib/wholesale-feed-sync/protocol-types.mjs +0 -0
  314. package/dist/lib/wholesale-feed-sync/sync.d.mts +6 -6
  315. package/dist/lib/wholesale-feed-sync/sync.d.ts +6 -6
  316. package/dist/lib/wholesale-feed-sync/sync.js +3 -1
  317. package/dist/lib/wholesale-feed-sync/sync.mjs +3 -1
  318. package/dist/lib/wholesale-feed-sync/types.d.mts +15 -14
  319. package/dist/lib/wholesale-feed-sync/types.d.ts +15 -14
  320. package/dist/lib/wholesale-feed-sync/webhook-notification.d.mts +7 -5
  321. package/dist/lib/wholesale-feed-sync/webhook-notification.d.ts +7 -5
  322. package/dist/lib/wholesale-feed-sync/webhook-notification.js +45 -0
  323. package/dist/lib/wholesale-feed-sync/webhook-notification.mjs +44 -0
  324. package/docs/CLI.md +1 -1
  325. package/docs/TYPE-SUMMARY.md +118 -4
  326. package/docs/guides/ASYNC-API-REFERENCE.md +62 -1
  327. package/docs/guides/ASYNC-DEVELOPER-GUIDE.md +25 -0
  328. package/docs/guides/ASYNC-DOCUMENTATION-INDEX.md +3 -0
  329. package/docs/guides/BUYER-QUICKSTART-3.2.md +5 -0
  330. package/docs/guides/DURABLE-BUYER-WRITES.md +337 -0
  331. package/docs/guides/EXISTING-PLATFORM.md +80 -1
  332. package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +57 -0
  333. package/docs/guides/MEDIA-BUY-ACTION-ASSESSMENT.md +300 -0
  334. package/docs/guides/REPORTING-LEDGER.md +654 -3
  335. package/docs/guides/REPORTING-RECONCILIATION.md +50 -0
  336. package/docs/guides/REPORTING-SOURCE-EXECUTOR.md +63 -1
  337. package/docs/guides/SELLER-QUICKSTART-3.2.md +2 -0
  338. package/docs/guides/VALIDATE-YOUR-AGENT.md +35 -0
  339. package/docs/guides/idempotency-crash-recovery.md +4 -0
  340. package/docs/llms.txt +4 -2
  341. package/docs/migration-14.x-rc-worksheet.md +60 -5
  342. package/docs/migration-7.9-to-7.10.md +7 -5
  343. package/examples/README.md +17 -0
  344. package/examples/durable-buyer-writes/caller.ts +745 -0
  345. package/examples/durable-buyer-writes/worker.ts +240 -0
  346. package/examples/reliable-reporting-service/README.md +100 -0
  347. package/examples/seller-3.2-starter.ts +7 -8
  348. package/examples/targeting-input-existing-platform.ts +153 -0
  349. package/package.json +41 -29
  350. package/skills/build-seller-agent/SKILL.md +2 -0
  351. package/skills/build-seller-agent/specialisms/signed-requests.md +11 -1
  352. package/skills/cross-cutting.md +28 -11
  353. package/compliance/cache/3.1.0-beta.7/domains/brand/index.yaml +0 -160
  354. package/compliance/cache/3.1.0-beta.7/domains/brand/scenarios/distributed_brand_resolution.yaml +0 -415
  355. package/compliance/cache/3.1.0-beta.7/domains/brand/scenarios/single_side_trust_extension.yaml +0 -454
  356. package/compliance/cache/3.1.0-beta.7/domains/creative/index.yaml +0 -339
  357. package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/billing_out_of_band.yaml +0 -153
  358. package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -389
  359. package/compliance/cache/3.1.0-beta.7/domains/creative/scenarios/native_in_feed.yaml +0 -543
  360. package/compliance/cache/3.1.0-beta.7/domains/governance/index.yaml +0 -682
  361. package/compliance/cache/3.1.0-beta.7/domains/media-buy/index.yaml +0 -781
  362. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/audience_buy_flow.yaml +0 -380
  363. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/available_actions.yaml +0 -565
  364. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/billing_finality_delivery.yaml +0 -354
  365. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/canonical_formats.yaml +0 -711
  366. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/clicks_buy_flow.yaml +0 -264
  367. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/completed_views_buy_flow.yaml +0 -344
  368. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/create_media_buy_async.yaml +0 -234
  369. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/creative_fate_after_cancellation.yaml +0 -419
  370. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/creative_reception.yaml +0 -247
  371. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/delivery_reporting.yaml +0 -357
  372. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/dependency_impairment.yaml +0 -633
  373. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/dependency_impairment_cardinality.yaml +0 -800
  374. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/event_dedup_flow.yaml +0 -399
  375. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -309
  376. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_approved.yaml +0 -214
  377. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_conditions.yaml +0 -199
  378. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_denied.yaml +0 -204
  379. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/governance_denied_recovery.yaml +0 -252
  380. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/invalid_transitions.yaml +0 -289
  381. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  382. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/inventory_list_targeting.yaml +0 -276
  383. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/measurement_accountability.yaml +0 -244
  384. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/measurement_terms_rejected.yaml +0 -203
  385. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/pending_creatives_to_start.yaml +0 -274
  386. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -500
  387. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/performance_buy_flow.yaml +0 -428
  388. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -470
  389. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/product_signal_targeting.yaml +0 -373
  390. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_finalize.yaml +0 -399
  391. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -264
  392. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/proposal_not_found_errors.yaml +0 -257
  393. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_audit_observation.yaml +0 -333
  394. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_enforcement.yaml +0 -517
  395. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -294
  396. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/reach_buy_flow.yaml +0 -823
  397. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -360
  398. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/refine_products.yaml +0 -148
  399. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_accountability.yaml +0 -293
  400. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -307
  401. package/compliance/cache/3.1.0-beta.7/domains/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -576
  402. package/compliance/cache/3.1.0-beta.7/domains/media-buy/state-machine.yaml +0 -442
  403. package/compliance/cache/3.1.0-beta.7/domains/signals/index.yaml +0 -266
  404. package/compliance/cache/3.1.0-beta.7/domains/sponsored-intelligence/index.yaml +0 -256
  405. package/compliance/cache/3.1.0-beta.7/index.json +0 -356
  406. package/compliance/cache/3.1.0-beta.7/protocols/brand/index.yaml +0 -160
  407. package/compliance/cache/3.1.0-beta.7/protocols/brand/scenarios/distributed_brand_resolution.yaml +0 -415
  408. package/compliance/cache/3.1.0-beta.7/protocols/brand/scenarios/single_side_trust_extension.yaml +0 -454
  409. package/compliance/cache/3.1.0-beta.7/protocols/creative/index.yaml +0 -339
  410. package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/billing_out_of_band.yaml +0 -153
  411. package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -389
  412. package/compliance/cache/3.1.0-beta.7/protocols/creative/scenarios/native_in_feed.yaml +0 -543
  413. package/compliance/cache/3.1.0-beta.7/protocols/governance/index.yaml +0 -682
  414. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/index.yaml +0 -781
  415. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/audience_buy_flow.yaml +0 -380
  416. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/available_actions.yaml +0 -565
  417. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/billing_finality_delivery.yaml +0 -354
  418. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/canonical_formats.yaml +0 -711
  419. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/clicks_buy_flow.yaml +0 -264
  420. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/completed_views_buy_flow.yaml +0 -344
  421. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/create_media_buy_async.yaml +0 -234
  422. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/creative_fate_after_cancellation.yaml +0 -419
  423. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/creative_reception.yaml +0 -247
  424. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/delivery_reporting.yaml +0 -357
  425. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/dependency_impairment.yaml +0 -633
  426. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/dependency_impairment_cardinality.yaml +0 -800
  427. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/event_dedup_flow.yaml +0 -399
  428. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -309
  429. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_approved.yaml +0 -214
  430. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_conditions.yaml +0 -199
  431. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_denied.yaml +0 -204
  432. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/governance_denied_recovery.yaml +0 -252
  433. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/invalid_transitions.yaml +0 -289
  434. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  435. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/inventory_list_targeting.yaml +0 -276
  436. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/measurement_accountability.yaml +0 -244
  437. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/measurement_terms_rejected.yaml +0 -203
  438. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/pending_creatives_to_start.yaml +0 -274
  439. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -500
  440. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/performance_buy_flow.yaml +0 -428
  441. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -470
  442. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/product_signal_targeting.yaml +0 -373
  443. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_finalize.yaml +0 -399
  444. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -264
  445. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/proposal_not_found_errors.yaml +0 -257
  446. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_audit_observation.yaml +0 -333
  447. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_enforcement.yaml +0 -517
  448. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -294
  449. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/reach_buy_flow.yaml +0 -823
  450. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -360
  451. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/refine_products.yaml +0 -148
  452. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_accountability.yaml +0 -293
  453. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -307
  454. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -576
  455. package/compliance/cache/3.1.0-beta.7/protocols/media-buy/state-machine.yaml +0 -442
  456. package/compliance/cache/3.1.0-beta.7/protocols/signals/index.yaml +0 -266
  457. package/compliance/cache/3.1.0-beta.7/protocols/sponsored-intelligence/index.yaml +0 -256
  458. package/compliance/cache/3.1.0-beta.7/specialisms/audience-sync/index.yaml +0 -313
  459. package/compliance/cache/3.1.0-beta.7/specialisms/brand-rights/index.yaml +0 -350
  460. package/compliance/cache/3.1.0-beta.7/specialisms/brand-rights/scenarios/governance_denied.yaml +0 -226
  461. package/compliance/cache/3.1.0-beta.7/specialisms/collection-lists/index.yaml +0 -359
  462. package/compliance/cache/3.1.0-beta.7/specialisms/content-standards/index.yaml +0 -572
  463. package/compliance/cache/3.1.0-beta.7/specialisms/creative-ad-server/index.yaml +0 -409
  464. package/compliance/cache/3.1.0-beta.7/specialisms/creative-generative/generative-seller.yaml +0 -807
  465. package/compliance/cache/3.1.0-beta.7/specialisms/creative-generative/index.yaml +0 -758
  466. package/compliance/cache/3.1.0-beta.7/specialisms/creative-template/index.yaml +0 -510
  467. package/compliance/cache/3.1.0-beta.7/specialisms/governance-aware-seller/index.yaml +0 -143
  468. package/compliance/cache/3.1.0-beta.7/specialisms/governance-aware-seller/scenarios/governance_multi_agent_rejected.yaml +0 -117
  469. package/compliance/cache/3.1.0-beta.7/specialisms/governance-delivery-monitor/index.yaml +0 -441
  470. package/compliance/cache/3.1.0-beta.7/specialisms/governance-spend-authority/denied.yaml +0 -221
  471. package/compliance/cache/3.1.0-beta.7/specialisms/governance-spend-authority/index.yaml +0 -330
  472. package/compliance/cache/3.1.0-beta.7/specialisms/property-lists/index.yaml +0 -482
  473. package/compliance/cache/3.1.0-beta.7/specialisms/sales-broadcast-tv/index.yaml +0 -738
  474. package/compliance/cache/3.1.0-beta.7/specialisms/sales-catalog-driven/index.yaml +0 -840
  475. package/compliance/cache/3.1.0-beta.7/specialisms/sales-guaranteed/index.yaml +0 -601
  476. package/compliance/cache/3.1.0-beta.7/specialisms/sales-non-guaranteed/index.yaml +0 -546
  477. package/compliance/cache/3.1.0-beta.7/specialisms/sales-proposal-mode/index.yaml +0 -586
  478. package/compliance/cache/3.1.0-beta.7/specialisms/sales-social/index.yaml +0 -919
  479. package/compliance/cache/3.1.0-beta.7/specialisms/signal-marketplace/index.yaml +0 -424
  480. package/compliance/cache/3.1.0-beta.7/specialisms/signal-marketplace/scenarios/governance_denied.yaml +0 -211
  481. package/compliance/cache/3.1.0-beta.7/specialisms/signal-owned/index.yaml +0 -317
  482. package/compliance/cache/3.1.0-beta.7/specialisms/sponsored-intelligence/index.yaml +0 -59
  483. package/compliance/cache/3.1.0-beta.7/test-kits/acme-outdoor-live.yaml +0 -78
  484. package/compliance/cache/3.1.0-beta.7/test-kits/acme-outdoor.yaml +0 -223
  485. package/compliance/cache/3.1.0-beta.7/test-kits/billing-gate-runner.yaml +0 -115
  486. package/compliance/cache/3.1.0-beta.7/test-kits/bistro-oranje.yaml +0 -126
  487. package/compliance/cache/3.1.0-beta.7/test-kits/distributed-brand-runner.yaml +0 -281
  488. package/compliance/cache/3.1.0-beta.7/test-kits/nova-motors.yaml +0 -262
  489. package/compliance/cache/3.1.0-beta.7/test-kits/osei-natural.yaml +0 -126
  490. package/compliance/cache/3.1.0-beta.7/test-kits/parallel-dispatch-runner.yaml +0 -196
  491. package/compliance/cache/3.1.0-beta.7/test-kits/rate-limit-trip-runner.yaml +0 -172
  492. package/compliance/cache/3.1.0-beta.7/test-kits/signed-requests-runner.yaml +0 -155
  493. package/compliance/cache/3.1.0-beta.7/test-kits/single-side-trust-runner.yaml +0 -294
  494. package/compliance/cache/3.1.0-beta.7/test-kits/substitution-observer-runner.yaml +0 -688
  495. package/compliance/cache/3.1.0-beta.7/test-kits/summit-foods.yaml +0 -125
  496. package/compliance/cache/3.1.0-beta.7/test-kits/webhook-receiver-runner.yaml +0 -265
  497. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/001-minimal-plan.json +0 -43
  498. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/002-full-plan.json +0 -217
  499. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/003-bookkeeping-stripped.json +0 -60
  500. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/004a-human-review-omitted.json +0 -43
  501. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/004b-human-review-explicit-null.json +0 -49
  502. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/005a-policy-categories-order-1.json +0 -53
  503. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/005b-policy-categories-order-2.json +0 -57
  504. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/006a-ext-trace-v1.json +0 -49
  505. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/006b-ext-trace-v2.json +0 -53
  506. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/007-unicode-objectives.json +0 -43
  507. package/compliance/cache/3.1.0-beta.7/test-vectors/plan-hash/008-numeric-canonicalization.json +0 -65
  508. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/README.md +0 -220
  509. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/canonicalization.json +0 -241
  510. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/keys.json +0 -60
  511. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/001-no-signature-header.json +0 -24
  512. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/002-wrong-tag.json +0 -26
  513. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/003-expired-signature.json +0 -26
  514. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/004-window-too-long.json +0 -26
  515. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/005-alg-not-allowed.json +0 -26
  516. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/006-missing-covered-component.json +0 -26
  517. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/007-missing-content-digest.json +0 -26
  518. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/008-unknown-keyid.json +0 -26
  519. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/009-key-ops-missing-verify.json +0 -27
  520. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/010-content-digest-mismatch.json +0 -33
  521. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/011-malformed-header.json +0 -27
  522. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/012-missing-expires-param.json +0 -26
  523. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/013-expires-le-created.json +0 -27
  524. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/014-missing-nonce-param.json +0 -27
  525. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/015-signature-invalid.json +0 -28
  526. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/016-replayed-nonce.json +0 -35
  527. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/017-key-revoked.json +0 -38
  528. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/018-digest-covered-when-forbidden.json +0 -28
  529. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/019-signature-without-signature-input.json +0 -26
  530. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/020-rate-abuse.json +0 -34
  531. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/021-duplicate-signature-input-label.json +0 -31
  532. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/022-multi-valued-content-type.json +0 -31
  533. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/023-multi-valued-content-digest.json +0 -32
  534. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/024-unquoted-string-param.json +0 -31
  535. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/025-jwk-alg-crv-mismatch.json +0 -43
  536. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/026-non-ascii-host.json +0 -31
  537. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/027-webhook-registration-authentication-unsigned.json +0 -25
  538. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/negative/028-unsigned-protocol-method-required.json +0 -26
  539. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/001-basic-post.json +0 -30
  540. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/002-post-with-content-digest.json +0 -31
  541. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/003-es256-post.json +0 -30
  542. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/004-multiple-signature-labels.json +0 -26
  543. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/005-default-port-stripped.json +0 -30
  544. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/006-dot-segment-path.json +0 -30
  545. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/007-query-byte-preserved.json +0 -30
  546. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/008-percent-encoded-path.json +0 -30
  547. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/009-percent-encoded-unreserved-decoded.json +0 -30
  548. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/010-percent-encoded-slash-preserved.json +0 -30
  549. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/011-ipv6-authority.json +0 -30
  550. package/compliance/cache/3.1.0-beta.7/test-vectors/request-signing/positive/012-ipv6-authority-default-port-stripped.json +0 -30
  551. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/README.md +0 -211
  552. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/keys.json +0 -61
  553. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/001-wrong-tag.json +0 -26
  554. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/002-expired-signature.json +0 -26
  555. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/003-window-too-long.json +0 -26
  556. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/004-alg-not-allowed.json +0 -26
  557. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/005-missing-authority-component.json +0 -26
  558. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/006-missing-content-digest.json +0 -25
  559. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/007-unknown-keyid.json +0 -26
  560. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/008-wrong-adcp-use.json +0 -26
  561. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/009-content-digest-mismatch.json +0 -26
  562. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/010-malformed-signature-input.json +0 -26
  563. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/011-signature-without-input.json +0 -25
  564. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/012-missing-expires-param.json +0 -26
  565. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/013-expires-le-created.json +0 -26
  566. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/014-missing-nonce-param.json +0 -26
  567. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/015-signature-invalid.json +0 -26
  568. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/016-replayed-nonce.json +0 -37
  569. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/017-key-revoked.json +0 -32
  570. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/018-rate-abuse.json +0 -33
  571. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/019-revocation-stale.json +0 -32
  572. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/020-key-ops-missing-verify.json +0 -41
  573. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/negative/021-base64-alphabet-mixing.json +0 -26
  574. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/001-basic-post.json +0 -24
  575. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/002-es256-post.json +0 -24
  576. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/003-multiple-signature-labels.json +0 -24
  577. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/004-default-port-stripped.json +0 -24
  578. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/005-percent-encoded-path.json +0 -24
  579. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/006-query-byte-preserved.json +0 -24
  580. package/compliance/cache/3.1.0-beta.7/test-vectors/webhook-signing/positive/007-body-without-idempotency-key.json +0 -25
  581. package/compliance/cache/3.1.0-beta.7/universal/billing-gate-dispatch.yaml +0 -450
  582. package/compliance/cache/3.1.0-beta.7/universal/canonical-format-validate-input.yaml +0 -640
  583. package/compliance/cache/3.1.0-beta.7/universal/capability-discovery.yaml +0 -125
  584. package/compliance/cache/3.1.0-beta.7/universal/collection-lists-pagination-integrity.yaml +0 -306
  585. package/compliance/cache/3.1.0-beta.7/universal/comply-controller-mode-gate.yaml +0 -141
  586. package/compliance/cache/3.1.0-beta.7/universal/content-standards-pagination-integrity.yaml +0 -326
  587. package/compliance/cache/3.1.0-beta.7/universal/deterministic-testing.yaml +0 -1430
  588. package/compliance/cache/3.1.0-beta.7/universal/error-compliance-signals.yaml +0 -377
  589. package/compliance/cache/3.1.0-beta.7/universal/error-compliance.yaml +0 -528
  590. package/compliance/cache/3.1.0-beta.7/universal/fictional-entities.yaml +0 -307
  591. package/compliance/cache/3.1.0-beta.7/universal/get-media-buys-pagination-integrity.yaml +0 -160
  592. package/compliance/cache/3.1.0-beta.7/universal/get-signals-pagination-integrity.yaml +0 -211
  593. package/compliance/cache/3.1.0-beta.7/universal/idempotency.yaml +0 -861
  594. package/compliance/cache/3.1.0-beta.7/universal/notification-config-event-scope.yaml +0 -119
  595. package/compliance/cache/3.1.0-beta.7/universal/notification-config-lifecycle.yaml +0 -337
  596. package/compliance/cache/3.1.0-beta.7/universal/notification-config-rejections.yaml +0 -107
  597. package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity-creative-formats.yaml +0 -265
  598. package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity-list-accounts.yaml +0 -245
  599. package/compliance/cache/3.1.0-beta.7/universal/pagination-integrity.yaml +0 -263
  600. package/compliance/cache/3.1.0-beta.7/universal/property-lists-pagination-integrity.yaml +0 -307
  601. package/compliance/cache/3.1.0-beta.7/universal/read-tool-idempotency.yaml +0 -405
  602. package/compliance/cache/3.1.0-beta.7/universal/runner-output-contract.yaml +0 -1266
  603. package/compliance/cache/3.1.0-beta.7/universal/schema-validation-signals.yaml +0 -181
  604. package/compliance/cache/3.1.0-beta.7/universal/schema-validation.yaml +0 -548
  605. package/compliance/cache/3.1.0-beta.7/universal/security.yaml +0 -539
  606. package/compliance/cache/3.1.0-beta.7/universal/signed-requests.yaml +0 -217
  607. package/compliance/cache/3.1.0-beta.7/universal/stale-response-advisory.yaml +0 -295
  608. package/compliance/cache/3.1.0-beta.7/universal/storyboard-schema.yaml +0 -2136
  609. package/compliance/cache/3.1.0-beta.7/universal/v3-envelope-integrity.yaml +0 -117
  610. package/compliance/cache/3.1.0-beta.7/universal/version-negotiation.yaml +0 -130
  611. package/compliance/cache/3.1.0-beta.7/universal/webhook-emission.yaml +0 -411
  612. package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-bulk-webhooks.yaml +0 -82
  613. package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-product-webhooks.yaml +0 -83
  614. package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-products.yaml +0 -151
  615. package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-signal-webhooks.yaml +0 -83
  616. package/compliance/cache/3.1.0-beta.7/universal/wholesale-feed-signals.yaml +0 -149
  617. package/dist/lib/types/v3-1-beta/index.d.mts +0 -1
  618. package/dist/lib/types/v3-1-beta/index.d.ts +0 -1
  619. package/dist/lib/types/v3-1-beta/index.mjs +0 -1
  620. package/dist/lib/types/v3-1-beta/tools.generated.d.mts +0 -26788
  621. package/dist/lib/types/v3-1-beta/tools.generated.d.ts +0 -26788
  622. /package/dist/lib/{types/v3-1-beta/tools.generated.mjs → media-buy/action-types.mjs} +0 -0
@@ -0,0 +1,787 @@
1
+ import { scanArgsForCredentials } from "../../server/credential-policy.mjs";
2
+ import { canonicalize } from "../../utils/jcs.mjs";
3
+ import { redactCredentialPatterns } from "../../utils/redact-credential-patterns.mjs";
4
+ import { ReportingDeliveryOfferingSchema } from "../../types/schemas.generated.mjs";
5
+ import {
6
+ REPORTING_LEDGER_MIGRATION,
7
+ assertReportingConsumerMismatchEscalation,
8
+ reportingConsumerStatusCapabilityV1,
9
+ reportingEffectiveConsumerMismatchEscalationV1,
10
+ createReportingDeliveryHandler,
11
+ createReportingProducer,
12
+ createReportingStatusHandler,
13
+ createSyncReportingStatusHandler
14
+ } from "../ledger/index.mjs";
15
+ import {
16
+ ReportingCoverageConstituentIdentityV1Schema,
17
+ SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1,
18
+ ReportingSourceOfferingV1Schema,
19
+ ReportingSourceScopeV1Schema,
20
+ reportingIsSourceLocalMidnightV1,
21
+ reportingScheduleOriginV1,
22
+ reportingUtcOffsetMinutesV1,
23
+ createInlineReportingSourceExecutor,
24
+ reportingIsoDurationMillisecondsV1,
25
+ reportingSourceCapabilitiesV1
26
+ } from "../source/index.mjs";
27
+ const ADAPTER_SCOPE_KEY = "_adcp_reporting_adapter";
28
+ function createReliableReportingService(options) {
29
+ const adapterEntries = Object.entries(options.adapters);
30
+ if (adapterEntries.length === 0) throw new TypeError("Reliable reporting requires at least one adapter");
31
+ positiveInteger(options.automatedRecoveryWindowSeconds, "automatedRecoveryWindowSeconds");
32
+ const sources = /* @__PURE__ */ new Map();
33
+ const adapterOfferings = /* @__PURE__ */ new Map();
34
+ const offerings = /* @__PURE__ */ new Map();
35
+ const deliveryOfferings = [];
36
+ for (const [adapterId, adapter] of adapterEntries) {
37
+ if (!/^[A-Za-z0-9_.:-]{1,128}$/.test(adapterId)) throw new TypeError("Reporting adapter IDs must be bounded IDs");
38
+ const sourceOffering = ReportingSourceOfferingV1Schema.parse(structuredClone(adapter.sourceOffering));
39
+ const deliveryOffering = ReportingDeliveryOfferingSchema.parse(
40
+ structuredClone(adapter.deliveryOffering)
41
+ );
42
+ if (offerings.has(sourceOffering.offeringId)) throw new TypeError("Reporting offering IDs must be unique");
43
+ if (adapter.fetchSlice === void 0 === (adapter.executor === void 0)) {
44
+ throw new TypeError("Each reporting adapter requires exactly one of fetchSlice or executor");
45
+ }
46
+ const source = adapter.executor ?? createInlineReportingSourceExecutor(adapter.fetchSlice, sourceOffering, {
47
+ ...adapter.inlineReplayRetention ? { replayRetention: adapter.inlineReplayRetention } : {}
48
+ });
49
+ const routed = source.capabilities.offerings.filter(
50
+ (candidate) => candidate.offeringId === sourceOffering.offeringId
51
+ );
52
+ if (routed.length !== 1) {
53
+ throw new TypeError("Reporting adapter executor must expose exactly one offering with its declared ID");
54
+ }
55
+ const routedOffering = routed[0];
56
+ if (canonicalize(routedOffering.contract) !== canonicalize(sourceOffering.contract)) {
57
+ throw new TypeError("Reporting adapter executor offering contract differs from its declared source offering");
58
+ }
59
+ validateDeliveryOffering(routedOffering, deliveryOffering);
60
+ sources.set(adapterId, source);
61
+ adapterOfferings.set(adapterId, routedOffering);
62
+ offerings.set(routedOffering.offeringId, routedOffering);
63
+ deliveryOfferings.push(deliveryOffering);
64
+ }
65
+ const routedSource = createRoutedSource(sources, offerings);
66
+ const producer = createReportingProducer({
67
+ store: options.store,
68
+ source: routedSource,
69
+ offerings: [...offerings.values()],
70
+ contact: options.contact,
71
+ ...options.subscribers ? { subscribers: options.subscribers } : {}
72
+ });
73
+ const hasConsumerStatus = options.resolveConsumerId !== void 0;
74
+ if (options.consumerMismatchEscalation && !hasConsumerStatus) {
75
+ throw new TypeError("consumerMismatchEscalation requires resolveConsumerId");
76
+ }
77
+ const effectiveConsumerMismatchEscalation = assertReportingConsumerMismatchEscalation(
78
+ reportingEffectiveConsumerMismatchEscalationV1(
79
+ options.consumerMismatchEscalation,
80
+ options.store,
81
+ "createReliableReportingService"
82
+ )
83
+ );
84
+ const advertisedConsumerMismatchEscalation = hasConsumerStatus ? effectiveConsumerMismatchEscalation : void 0;
85
+ if (hasConsumerStatus) assertConsumerStatusStore(options.store);
86
+ const retentionDays = options.statusRetentionDays;
87
+ positiveInteger(retentionDays, "statusRetentionDays");
88
+ const capabilities = deepFreeze({
89
+ supported: true,
90
+ reliable_reporting_version: "1.0",
91
+ configuration_task: "sync_accounts",
92
+ status_task: "get_reporting_status",
93
+ ...hasConsumerStatus ? { consumer_status_task: "sync_reporting_status" } : {},
94
+ revision_content_task: "get_media_buy_delivery",
95
+ offerings: deliveryOfferings,
96
+ automated_recovery_window_seconds: options.automatedRecoveryWindowSeconds,
97
+ status_retention_days: retentionDays,
98
+ ...advertisedConsumerMismatchEscalation ? reportingConsumerStatusCapabilityV1(advertisedConsumerMismatchEscalation) : {}
99
+ });
100
+ const getReportingStatus = options.resolveConsumerId ? createReportingStatusHandler(options.store, {
101
+ resolveConsumerId: options.resolveConsumerId,
102
+ ...effectiveConsumerMismatchEscalation ? { consumerMismatchEscalation: effectiveConsumerMismatchEscalation } : {}
103
+ }) : createReportingStatusHandler(options.store);
104
+ const getMediaBuyDelivery = createReportingDeliveryHandler(options.store);
105
+ const syncReportingStatus = options.resolveConsumerId ? createSyncReportingStatusHandler(options.store, {
106
+ resolveConsumerId: options.resolveConsumerId
107
+ }) : void 0;
108
+ const reportingPlatform = {
109
+ capabilities,
110
+ getReportingStatus: (request, context) => getReportingStatus(request, context),
111
+ getMediaBuyDelivery: (request, context) => getMediaBuyDelivery(request, context),
112
+ ...syncReportingStatus && {
113
+ syncReportingStatus: (request, context) => syncReportingStatus(request, context),
114
+ // Published so `createAdcpServerFromPlatform` can scope replay by the
115
+ // identity the receipt is actually recorded under, rather than by the
116
+ // caller's credential.
117
+ resolveConsumerId: options.resolveConsumerId
118
+ }
119
+ };
120
+ let schedulerAbort;
121
+ let schedulerPromise;
122
+ const service = {
123
+ setup: Object.freeze({
124
+ component: "reliable-reporting-core",
125
+ migrations: Object.freeze([REPORTING_LEDGER_MIGRATION]),
126
+ requiresIsolatedLedgerDatabaseAcknowledgement: true
127
+ }),
128
+ capabilities,
129
+ producer,
130
+ platform: reportingPlatform,
131
+ get running() {
132
+ return schedulerPromise !== void 0;
133
+ },
134
+ async installConfiguration(configuration, context) {
135
+ if (!context?.account?.id) throw new TypeError("Reporting configuration requires a framework-resolved account");
136
+ assertNoUntrustedLineageFields(configuration);
137
+ if (Object.prototype.hasOwnProperty.call(configuration.sourceSettings, "currency")) {
138
+ throw new TypeError("Reporting configuration must not supply trusted lineage field sourceSettings.currency");
139
+ }
140
+ const frozenInput = structuredClone(configuration);
141
+ const offering = offerings.get(configuration.offeringId);
142
+ if (!offering) throw new TypeError("Reporting configuration selected an unknown offering");
143
+ const deliveryOffering = deliveryOfferings.find((value) => value.offering_id === offering.offeringId);
144
+ validateConfigurationAgainstDeliveryOffering(
145
+ frozenInput,
146
+ deliveryOffering,
147
+ options.automatedRecoveryWindowSeconds
148
+ );
149
+ const [route, currency, coverage] = await Promise.all([
150
+ options.resolveSource(context.account, frozenInput),
151
+ options.resolveCurrency(context.account, frozenInput),
152
+ options.resolveCoverage(context.account, frozenInput)
153
+ ]);
154
+ if (!route || typeof route !== "object" || !route.sourceScope || typeof route.sourceScope !== "object") {
155
+ throw new TypeError("resolveSource must return an adapter, sourceScope, and sourceTimezone");
156
+ }
157
+ const source = sources.get(route.adapterId);
158
+ const adapterOffering = adapterOfferings.get(route.adapterId);
159
+ if (!source || !adapterOffering) throw new TypeError("resolveSource selected an unknown reporting adapter");
160
+ if (adapterOffering.offeringId !== offering.offeringId) {
161
+ throw new TypeError("Resolved reporting adapter does not provide the selected offering");
162
+ }
163
+ if (canonicalize(adapterOffering.contract) !== canonicalize(offering.contract)) {
164
+ throw new TypeError("Resolved reporting adapter contract differs from the selected offering");
165
+ }
166
+ const normalizedCurrency = trustedCurrency(currency);
167
+ const normalizedTimezone = trustedTimezone(route.sourceTimezone);
168
+ if (configuration.expectedCurrency !== void 0 && configuration.expectedCurrency !== normalizedCurrency) {
169
+ throw new TypeError("Trusted reporting currency conflicts with the configuration currency assertion");
170
+ }
171
+ if (configuration.expectedSourceTimezone !== void 0 && configuration.expectedSourceTimezone !== normalizedTimezone) {
172
+ throw new TypeError("Trusted reporting timezone conflicts with the configuration timezone assertion");
173
+ }
174
+ assertSupportedScheduleSemantics(frozenInput.schedule, deliveryOffering, normalizedTimezone);
175
+ const { constituents, mediaBuyIds } = trustedCoverage(coverage, frozenInput.requestedMetrics);
176
+ if (configuration.expectedMediaBuyIds !== void 0 && !sameIdMembers(configuration.expectedMediaBuyIds, mediaBuyIds)) {
177
+ throw new TypeError("Trusted reporting coverage conflicts with the configuration media-buy assertion");
178
+ }
179
+ if (Object.prototype.hasOwnProperty.call(route.sourceScope, ADAPTER_SCOPE_KEY)) {
180
+ throw new TypeError("Reporting sourceScope contains an SDK-reserved key");
181
+ }
182
+ const credentialPaths = scanArgsForCredentials(route.sourceScope);
183
+ if (credentialPaths.length > 0 || containsContextMetadata(route.sourceScope)) {
184
+ throw new TypeError("Reporting sourceScope must contain non-secret routing identifiers only");
185
+ }
186
+ const routedScope = ReportingSourceScopeV1Schema.parse({
187
+ ...structuredClone(route.sourceScope),
188
+ [ADAPTER_SCOPE_KEY]: route.adapterId
189
+ });
190
+ const predecessor = await predecessorGeneration(options.store, context.account.id, frozenInput);
191
+ const sourceScope = keylessPredecessorScope(predecessor, route.sourceScope, sources.size) ?? routedScope;
192
+ const scheduleIdentity = predecessor && predecessor.schedule.alignment === void 0 ? {} : {
193
+ periodDuration: deliveryOffering.schedule.period_duration,
194
+ deliverySlaDuration: deliveryOffering.schedule.delivery_sla,
195
+ alignment: deliveryOffering.schedule.alignment,
196
+ ...deliveryOffering.schedule.alignment === "utc" ? {} : { periodTimezone: normalizedTimezone }
197
+ };
198
+ const {
199
+ expectedCurrency: _currency,
200
+ expectedSourceTimezone: _timezone,
201
+ expectedMediaBuyIds: _mediaBuyIds,
202
+ sourceSettings,
203
+ ...ledgerInput
204
+ } = frozenInput;
205
+ void _currency;
206
+ void _timezone;
207
+ void _mediaBuyIds;
208
+ return producer.installConfiguration({
209
+ ...ledgerInput,
210
+ schedule: { ...ledgerInput.schedule, ...scheduleIdentity },
211
+ account: { account_id: context.account.id },
212
+ sourceScope,
213
+ sourceTimezone: normalizedTimezone,
214
+ sourceSettings: { ...sourceSettings, currency: normalizedCurrency },
215
+ contract: structuredClone(offering.contract),
216
+ constituents,
217
+ mediaBuyIds
218
+ });
219
+ },
220
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
221
+ install(platform) {
222
+ if (typeof platform.accounts.upsert !== "function") {
223
+ throw new TypeError(
224
+ "Reliable reporting requires accounts.upsert so the advertised sync_accounts configuration task is installed"
225
+ );
226
+ }
227
+ if (platform.reporting && platform.reporting !== reportingPlatform) {
228
+ throw new TypeError("DecisioningPlatform already has a reporting lifecycle installed");
229
+ }
230
+ if (!platform.reporting) {
231
+ Object.defineProperty(platform, "reporting", {
232
+ value: reportingPlatform,
233
+ enumerable: true,
234
+ configurable: false,
235
+ writable: false
236
+ });
237
+ }
238
+ return platform;
239
+ },
240
+ async runCycle(cycle) {
241
+ const accountId = cycleAccountId(cycle);
242
+ const planningNow = cycle.now ?? /* @__PURE__ */ new Date();
243
+ cycle.signal?.throwIfAborted();
244
+ const planned = await producer.planObligations(planningNow.toISOString(), {
245
+ ...accountId !== void 0 ? { account_id: accountId } : {},
246
+ ...cycle.maxObligations !== void 0 ? { maxObligations: cycle.maxObligations } : {}
247
+ });
248
+ cycle.signal?.throwIfAborted();
249
+ const result = await producer.runWorker({
250
+ ...cycle.signal ? { signal: cycle.signal } : {},
251
+ ...cycle.now ? { now: () => cycle.now } : {},
252
+ ...accountId !== void 0 ? { account_id: accountId } : {},
253
+ ...cycle.maxWorkerIterations !== void 0 ? { maxIterations: cycle.maxWorkerIterations } : {},
254
+ ...cycle.retryDelayMilliseconds !== void 0 ? { retryDelayMilliseconds: cycle.retryDelayMilliseconds } : {},
255
+ ...cycle.executionDeadlineMilliseconds !== void 0 ? { executionDeadlineMilliseconds: cycle.executionDeadlineMilliseconds } : {},
256
+ ...cycle.settlementGraceMilliseconds !== void 0 ? { settlementGraceMilliseconds: cycle.settlementGraceMilliseconds } : {}
257
+ });
258
+ return { planned: planned.length, ...result };
259
+ },
260
+ start(scheduler) {
261
+ if (schedulerPromise) throw new Error("Reliable reporting scheduler is already running");
262
+ positiveInteger(scheduler.intervalMilliseconds, "intervalMilliseconds");
263
+ schedulerAbort = new AbortController();
264
+ const signal = schedulerAbort.signal;
265
+ schedulerPromise = schedulerLoop(service, scheduler, signal, options.store).finally(() => {
266
+ schedulerPromise = void 0;
267
+ schedulerAbort = void 0;
268
+ });
269
+ },
270
+ async stop() {
271
+ const running = schedulerPromise;
272
+ schedulerAbort?.abort();
273
+ if (running) await running;
274
+ }
275
+ };
276
+ return service;
277
+ }
278
+ function createRoutedSource(sources, offerings) {
279
+ const capabilities = reportingSourceCapabilitiesV1([...offerings.values()], "reliable-reporting-service-v1");
280
+ return {
281
+ capabilities,
282
+ execute(request, context) {
283
+ return routeSource(sources, request.sourceScope).execute(request, context);
284
+ },
285
+ read(input) {
286
+ return routeSource(sources, input.sourceScope).read(input);
287
+ }
288
+ };
289
+ }
290
+ function routeSource(sources, sourceScope) {
291
+ const adapterId = sourceScope[ADAPTER_SCOPE_KEY];
292
+ const source = typeof adapterId === "string" ? sources.get(adapterId) : sources.size === 1 ? sources.values().next().value : void 0;
293
+ if (!source) throw new TypeError("Reporting sourceScope has no installed adapter route");
294
+ return source;
295
+ }
296
+ async function schedulerLoop(service, options, signal, store) {
297
+ let rotation = 0;
298
+ while (!signal.aborted) {
299
+ let accountIds = [];
300
+ try {
301
+ accountIds = options.deploymentWide ? (
302
+ // A single deployment-wide sweep shares one budget across every
303
+ // tenant, so whichever account the ledger returns first can consume
304
+ // it — the producer's own default cap starves the rest just as an
305
+ // explicit per-account cap would. Enumerate the roster so each tenant
306
+ // gets its own bounded cycle, and rotate the starting point each pass.
307
+ rotate(await deploymentWideAccountIds(store), rotation)
308
+ ) : rotate(
309
+ validateAccountIds(
310
+ typeof options.accountIds === "function" ? await options.accountIds() : options.accountIds
311
+ ),
312
+ rotation
313
+ );
314
+ } catch (error) {
315
+ await reportSchedulerError(options, signal, error, { phase: "roster" });
316
+ }
317
+ rotation += 1;
318
+ for (const accountId of accountIds) {
319
+ if (signal.aborted) break;
320
+ try {
321
+ await service.runCycle({
322
+ ...accountId === void 0 ? { deploymentWide: true } : { accountId },
323
+ signal,
324
+ ...options.maxObligationsPerAccount !== void 0 ? { maxObligations: options.maxObligationsPerAccount } : {},
325
+ ...options.maxWorkerIterationsPerAccount !== void 0 ? { maxWorkerIterations: options.maxWorkerIterationsPerAccount } : {},
326
+ ...options.retryDelayMilliseconds !== void 0 ? { retryDelayMilliseconds: options.retryDelayMilliseconds } : {},
327
+ ...options.executionDeadlineMilliseconds !== void 0 ? { executionDeadlineMilliseconds: options.executionDeadlineMilliseconds } : {},
328
+ ...options.settlementGraceMilliseconds !== void 0 ? { settlementGraceMilliseconds: options.settlementGraceMilliseconds } : {}
329
+ });
330
+ } catch (error) {
331
+ await reportSchedulerError(options, signal, error, { phase: "cycle", accountId });
332
+ }
333
+ }
334
+ if (!signal.aborted) await abortableDelay(options.intervalMilliseconds, signal);
335
+ }
336
+ }
337
+ async function reportSchedulerError(options, signal, error, site) {
338
+ if (signal.aborted) return;
339
+ if (options.onError) {
340
+ try {
341
+ await options.onError(error);
342
+ } catch (observerError) {
343
+ warnSchedulerFailure(options, site, error, observerError);
344
+ }
345
+ return;
346
+ }
347
+ warnSchedulerFailure(options, site, error);
348
+ }
349
+ function warnSchedulerFailure(options, site, error, observerError) {
350
+ const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
351
+ const observed = observerError === void 0 ? "" : ` (the configured onError also threw: ${safeMessage(observerError)})`;
352
+ const message = `[adcp/reporting] scheduler ${where}: ${safeMessage(error)}${observed}`;
353
+ const logger = options.logger;
354
+ try {
355
+ if (logger !== void 0) logger.warn(message);
356
+ else defaultSchedulerWarn(message);
357
+ } catch {
358
+ }
359
+ }
360
+ function defaultSchedulerWarn(message) {
361
+ console.warn(message);
362
+ }
363
+ const MAX_SCHEDULER_MESSAGE_CHARS = 512;
364
+ const MAX_SCHEDULER_SCAN_CHARS = 8192;
365
+ const UNREPORTABLE_SCHEDULER_ERROR = "<unreportable error>";
366
+ function safeMessage(error) {
367
+ try {
368
+ const raw = rawMessage(error);
369
+ const redacted = redactCredentialPatterns(raw.slice(0, MAX_SCHEDULER_SCAN_CHARS));
370
+ const text = typeof redacted === "string" && redacted.length > 0 ? redacted : UNREPORTABLE_SCHEDULER_ERROR;
371
+ return text.length > MAX_SCHEDULER_MESSAGE_CHARS ? `${text.slice(0, MAX_SCHEDULER_MESSAGE_CHARS)}\u2026` : text;
372
+ } catch {
373
+ return UNREPORTABLE_SCHEDULER_ERROR;
374
+ }
375
+ }
376
+ function rawMessage(error) {
377
+ switch (typeof error) {
378
+ case "string":
379
+ return error;
380
+ case "number":
381
+ case "boolean":
382
+ case "bigint":
383
+ return String(error);
384
+ case "undefined":
385
+ return "undefined";
386
+ case "symbol":
387
+ return error.description ?? "symbol";
388
+ default:
389
+ break;
390
+ }
391
+ if (error === null) return "null";
392
+ const message = error.message;
393
+ return typeof message === "string" ? message : "non-Error scheduler failure";
394
+ }
395
+ const MAX_TIMER_DELAY_MILLISECONDS = 2147483647;
396
+ async function abortableDelay(milliseconds, signal) {
397
+ let remaining = milliseconds;
398
+ while (remaining > 0 && !signal.aborted) {
399
+ const chunk = Math.min(remaining, MAX_TIMER_DELAY_MILLISECONDS);
400
+ await abortableTimeout(chunk, signal);
401
+ remaining -= chunk;
402
+ }
403
+ }
404
+ function abortableTimeout(milliseconds, signal) {
405
+ return new Promise((resolve) => {
406
+ const timer = setTimeout(done, milliseconds);
407
+ function done() {
408
+ clearTimeout(timer);
409
+ signal.removeEventListener("abort", done);
410
+ resolve();
411
+ }
412
+ signal.addEventListener("abort", done, { once: true });
413
+ });
414
+ }
415
+ function rotate(values, by) {
416
+ if (values.length < 2) return [...values];
417
+ const offset = (by % values.length + values.length) % values.length;
418
+ return [...values.slice(offset), ...values.slice(0, offset)];
419
+ }
420
+ async function deploymentWideAccountIds(store) {
421
+ const configurations = await store.listConfigurations();
422
+ return [...new Set(configurations.map((value) => value.account.account_id))].sort();
423
+ }
424
+ function validateAccountIds(values) {
425
+ if (!Array.isArray(values)) {
426
+ throw new TypeError("Reporting scheduler accountIds resolver must return an array");
427
+ }
428
+ const unique = /* @__PURE__ */ new Set();
429
+ for (const value of values) {
430
+ if (typeof value !== "string" || value.length === 0 || value.length > 255) {
431
+ throw new TypeError("Reporting scheduler accountIds must contain bounded non-empty strings");
432
+ }
433
+ unique.add(value);
434
+ }
435
+ return [...unique];
436
+ }
437
+ function cycleAccountId(cycle) {
438
+ const requested = cycle.accountId;
439
+ if (cycle.deploymentWide === true) {
440
+ if (requested !== void 0) {
441
+ throw new TypeError("Reliable reporting cycles cannot combine deploymentWide with an accountId");
442
+ }
443
+ return void 0;
444
+ }
445
+ if (typeof requested !== "string" || requested.length === 0 || requested.length > 255) {
446
+ throw new TypeError("Reliable reporting cycles require deploymentWide: true or a bounded non-empty accountId");
447
+ }
448
+ return requested;
449
+ }
450
+ async function predecessorGeneration(store, accountId, configuration) {
451
+ return (await store.listConfigurations(accountId)).find(
452
+ (value) => value.delivery_config_id === configuration.delivery_config_id && value.delivery_config_version === configuration.delivery_config_version
453
+ );
454
+ }
455
+ function keylessPredecessorScope(predecessor, resolvedScope, adapterCount) {
456
+ if (!predecessor || Object.prototype.hasOwnProperty.call(predecessor.sourceScope, ADAPTER_SCOPE_KEY)) {
457
+ return void 0;
458
+ }
459
+ if (adapterCount > 1) {
460
+ throw new TypeError(
461
+ "Reporting configuration generation predates the adapter route key and cannot be routed with multiple adapters installed; install a new generation with an explicit adapter route"
462
+ );
463
+ }
464
+ if (canonicalize(predecessor.sourceScope) !== canonicalize(resolvedScope)) return void 0;
465
+ return structuredClone(predecessor.sourceScope);
466
+ }
467
+ function validateDeliveryOffering(source, delivery) {
468
+ if (delivery.offering_id !== source.offeringId) throw new TypeError("Source and delivery offering IDs differ");
469
+ if (delivery.report_definition_id !== source.contract.report_definition_id) {
470
+ throw new TypeError("Source and delivery report definitions differ");
471
+ }
472
+ if (delivery.report_definition_uri !== source.contract.reportDefinitionUri || delivery.report_definition_sha256 !== source.contract.reportDefinitionSha256 || delivery.reporting_profile.id !== source.contract.reportingProfile || delivery.reporting_profile.version !== source.contract.schemaVersion || delivery.reporting_profile.schema_uri !== source.contract.schemaUri || delivery.reporting_profile.schema_sha256 !== source.contract.schemaSha256 || delivery.reporting_profile.schema_dialect !== source.contract.schemaDialect || delivery.reporting_profile.schema_ref_policy !== source.contract.schemaRefPolicy) {
473
+ throw new TypeError("Delivery offering does not describe the source contract");
474
+ }
475
+ if (delivery.method !== void 0 || delivery.reconciliation_mode !== "delivery_only" || delivery.feed_purpose === "billing") {
476
+ throw new TypeError("ReliableReportingService currently installs Core API delivery only");
477
+ }
478
+ if (delivery.schedule.alignment !== "utc" && delivery.schedule.alignment !== "source_timezone") {
479
+ throw new TypeError(
480
+ `ReliableReportingService cannot honor '${delivery.schedule.alignment}' period alignment; it generates fixed-length periods from the utc and source_timezone origins`
481
+ );
482
+ }
483
+ assertOfferingScheduleShape(delivery);
484
+ const advertisedSla = parseAdvertisedDuration(delivery.schedule.delivery_sla, "delivery_sla");
485
+ parseAdvertisedDuration(delivery.schedule.period_duration, "period_duration");
486
+ if (delivery.supported_finality.includes("official") && source.publicationClass !== "AUTHORITATIVE") {
487
+ throw new TypeError("Official delivery finality requires an authoritative source offering");
488
+ }
489
+ if (source.publicationClass === "AUTHORITATIVE" && delivery.supported_finality.includes("snapshot")) {
490
+ throw new TypeError(
491
+ "Authoritative source offerings cannot advertise snapshot delivery finality; the ledger installs them as official only"
492
+ );
493
+ }
494
+ if (delivery.supported_finality.includes("official") && source.publicationClass === "AUTHORITATIVE") {
495
+ const { finalization } = source;
496
+ const readyOffset = finalization.schedule.daysAfterPeriodEnd * 864e5 + localTimeOfDayMilliseconds(finalization.schedule.sourceLocalReadyTime);
497
+ const earliest = readyOffset + reportingIsoDurationMillisecondsV1(finalization.worstCaseAvailabilityLag);
498
+ if (advertisedSla < earliest) {
499
+ throw new TypeError(
500
+ "Official reporting delivery SLA is shorter than the source can finalize and publish; the advertised deadline is unreachable for every period"
501
+ );
502
+ }
503
+ }
504
+ if (source.publicationClass === "PROVISIONAL_SNAPSHOT") {
505
+ const worstCase = reportingIsoDurationMillisecondsV1(source.cadence.worstCaseAvailabilityLag);
506
+ if (advertisedSla < worstCase) {
507
+ throw new TypeError(
508
+ "Snapshot reporting delivery SLA is shorter than the source worst-case availability lag; the advertised deadline is unreachable for every period"
509
+ );
510
+ }
511
+ }
512
+ const pinnedTimezone = delivery.schedule.period_timezone_policy === "fixed" ? delivery.schedule.period_timezone : source.sourceTimezone.ianaTimezone;
513
+ if (pinnedTimezone) {
514
+ const now = Date.now();
515
+ if (delivery.schedule.alignment === "utc" && reportingUtcOffsetMinutesV1(pinnedTimezone, now) !== 0) {
516
+ throw new TypeError("UTC-aligned reporting requires a source timezone whose UTC offset is zero");
517
+ }
518
+ const originMs = reportingScheduleOriginV1(
519
+ delivery.schedule.alignment === "utc" ? "utc" : "source_timezone",
520
+ pinnedTimezone
521
+ );
522
+ if (reportingUtcOffsetMinutesV1(pinnedTimezone, originMs) !== reportingUtcOffsetMinutesV1(pinnedTimezone, now)) {
523
+ throw new TypeError(
524
+ "Reporting source timezone no longer observes its schedule-origin offset; no anchor derived from the protocol origin can land on source-local midnight"
525
+ );
526
+ }
527
+ assertConstantUtcOffset(
528
+ pinnedTimezone,
529
+ now - OFFSET_BACKWARD_HORIZON_DAYS * DAY_MILLISECONDS,
530
+ now + OFFSET_FORWARD_HORIZON_DAYS * DAY_MILLISECONDS
531
+ );
532
+ }
533
+ const period = reportingIsoDurationMillisecondsV1(delivery.schedule.period_duration);
534
+ const min = reportingIsoDurationMillisecondsV1(source.windowing.minimumWindow);
535
+ const max = reportingIsoDurationMillisecondsV1(source.windowing.maximumWindow);
536
+ if (period < min || period > max) throw new TypeError("Delivery schedule is outside source window bounds");
537
+ if (period % 864e5 !== 0) {
538
+ throw new TypeError(
539
+ `Delivery schedule period '${delivery.schedule.period_duration}' is not a whole number of source-local days; the service generates period boundaries only on source-local midnight`
540
+ );
541
+ }
542
+ const executorCeiling = source.sourceExecution.maximumWindowDaysPerRequest * 864e5;
543
+ if (period > executorCeiling) {
544
+ throw new TypeError(
545
+ "Delivery schedule period exceeds the source executor maximumWindowDaysPerRequest; no single request could cover one period"
546
+ );
547
+ }
548
+ if (delivery.reporting_profile.primary_keys.length === 0) {
549
+ throw new TypeError("Delivery offering requires at least one reporting primary key");
550
+ }
551
+ if (delivery.reporting_profile.grain !== source.grain) {
552
+ throw new TypeError("Delivery offering grain does not match its source offering grain");
553
+ }
554
+ if (delivery.schedule.period_timezone_policy === "fixed" && source.sourceTimezone.ianaTimezone !== void 0 && delivery.schedule.period_timezone !== source.sourceTimezone.ianaTimezone) {
555
+ throw new TypeError("Delivery offering pins a period timezone its source offering does not declare");
556
+ }
557
+ if (delivery.supported_finality.length === 0) {
558
+ throw new TypeError("Delivery offering must advertise at least one supported finality");
559
+ }
560
+ if (new Set(delivery.supported_finality).size !== delivery.supported_finality.length) {
561
+ throw new TypeError("Delivery offering supported finality values must be unique");
562
+ }
563
+ }
564
+ function validateConfigurationAgainstDeliveryOffering(configuration, offering, automatedRecoveryWindowSeconds) {
565
+ if (configuration.feedPurpose !== offering.feed_purpose || configuration.report_definition_id !== offering.report_definition_id) {
566
+ throw new TypeError("Reporting configuration does not match its delivery offering");
567
+ }
568
+ if (!offering.supported_finality.includes(configuration.requiredFinality)) {
569
+ throw new TypeError("Reporting configuration finality is not supported by its delivery offering");
570
+ }
571
+ if (configuration.schedule.periodMilliseconds !== reportingIsoDurationMillisecondsV1(offering.schedule.period_duration) || configuration.schedule.deliverySlaMilliseconds !== reportingIsoDurationMillisecondsV1(offering.schedule.delivery_sla)) {
572
+ throw new TypeError("Reporting configuration schedule does not match its delivery offering");
573
+ }
574
+ if (configuration.schedule.officialAfterMilliseconds !== void 0 && configuration.schedule.officialAfterMilliseconds !== configuration.schedule.deliverySlaMilliseconds) {
575
+ throw new TypeError("Reporting official deadline must equal the advertised delivery SLA of its offering");
576
+ }
577
+ if (configuration.schedule.recoveryWindowMilliseconds !== automatedRecoveryWindowSeconds * 1e3) {
578
+ throw new TypeError(
579
+ "Reporting configuration recovery window must equal the advertised automated recovery window; the advertised value is what buyer-facing deadlines are measured against"
580
+ );
581
+ }
582
+ }
583
+ function trustedCoverage(coverage, requestedMetrics) {
584
+ if (!coverage || typeof coverage !== "object" || !Array.isArray(coverage.constituents)) {
585
+ throw new TypeError("resolveCoverage must return an authorized constituent denominator");
586
+ }
587
+ const constituents = ReportingCoverageConstituentIdentityV1Schema.array().min(1).max(SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1).parse(structuredClone(coverage.constituents));
588
+ if (constituents.length * requestedMetrics.length > SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1) {
589
+ throw new TypeError(
590
+ "Reporting coverage exceeds the per-slice metric availability bound; reduce constituents or metrics"
591
+ );
592
+ }
593
+ const constituentIds = new Set(constituents.map((value) => value.constituentId));
594
+ if (constituentIds.size !== constituents.length) {
595
+ throw new TypeError("resolveCoverage must return unique constituent identities");
596
+ }
597
+ for (const constituent of constituents) {
598
+ const binding = constituent.productBinding;
599
+ if (!binding) continue;
600
+ if (binding.productId !== constituent.productId) {
601
+ throw new TypeError("resolveCoverage constituent productId contradicts its product binding");
602
+ }
603
+ if (constituent.constituentKind === "media_buy" && binding.mediaBuyId !== constituent.mediaBuyId) {
604
+ throw new TypeError("resolveCoverage constituent mediaBuyId contradicts its product binding");
605
+ }
606
+ if (constituent.constituentKind === "package_item" && binding.packageId !== constituent.packageId) {
607
+ throw new TypeError("resolveCoverage constituent packageId contradicts its product binding");
608
+ }
609
+ }
610
+ const mediaBuyIds = [
611
+ ...new Set(constituents.map((value) => value.mediaBuyId).filter((value) => Boolean(value)))
612
+ ].sort();
613
+ return { constituents, mediaBuyIds };
614
+ }
615
+ function sameIdMembers(left, right) {
616
+ if (!Array.isArray(left)) throw new TypeError("expectedMediaBuyIds must be an array of media buy IDs");
617
+ const expected = new Set(left);
618
+ return expected.size === right.length && right.every((value) => expected.has(value));
619
+ }
620
+ const DAY_MILLISECONDS = 864e5;
621
+ const OFFSET_PROBE_STEP_DAYS = 10;
622
+ const OFFSET_BACKWARD_HORIZON_DAYS = 400;
623
+ const OFFSET_FORWARD_HORIZON_DAYS = 400;
624
+ function assertSupportedScheduleSemantics(schedule, offering, sourceTimezone) {
625
+ const { alignment } = offering.schedule;
626
+ if (alignment !== "utc" && alignment !== "source_timezone") {
627
+ throw new TypeError(
628
+ `ReliableReportingService cannot honor '${alignment}' period alignment; it generates fixed-length periods from the utc and source_timezone origins`
629
+ );
630
+ }
631
+ if (offering.schedule.period_timezone_policy === "fixed" && offering.schedule.period_timezone !== sourceTimezone) {
632
+ throw new TypeError("Reporting offering pins a period timezone that is not the resolved source timezone");
633
+ }
634
+ if (schedule.periodMilliseconds % DAY_MILLISECONDS !== 0) {
635
+ throw new TypeError(
636
+ "Reporting periods must be whole source-local days; a sub-day window has no source-local midnight boundary"
637
+ );
638
+ }
639
+ const anchorMs = Date.parse(schedule.anchor);
640
+ if (!Number.isFinite(anchorMs)) throw new TypeError("Reporting configuration anchor must be a valid instant");
641
+ if (alignment === "utc" && reportingUtcOffsetMinutesV1(sourceTimezone, anchorMs) !== 0) {
642
+ throw new TypeError("UTC-aligned reporting requires a source timezone whose UTC offset is zero");
643
+ }
644
+ const originMs = reportingScheduleOriginV1(alignment, sourceTimezone);
645
+ const phase = ((anchorMs - originMs) % schedule.periodMilliseconds + schedule.periodMilliseconds) % schedule.periodMilliseconds;
646
+ if (phase !== 0) {
647
+ throw new TypeError(
648
+ `Reporting configuration anchor is not on a '${alignment}' period boundary; boundaries are derived from the protocol origin (1970-01-01 local midnight) plus whole periods`
649
+ );
650
+ }
651
+ const now = Date.now();
652
+ const spanStartMs = Math.max(anchorMs, now - OFFSET_BACKWARD_HORIZON_DAYS * DAY_MILLISECONDS);
653
+ const spanEndMs = Math.max(now, anchorMs) + OFFSET_FORWARD_HORIZON_DAYS * DAY_MILLISECONDS;
654
+ if (reportingUtcOffsetMinutesV1(sourceTimezone, originMs) !== reportingUtcOffsetMinutesV1(sourceTimezone, now)) {
655
+ throw new TypeError(
656
+ "Reporting source timezone no longer observes its schedule-origin offset; no anchor derived from the protocol origin can land on source-local midnight"
657
+ );
658
+ }
659
+ assertConstantUtcOffset(sourceTimezone, spanStartMs, spanEndMs);
660
+ if (!reportingIsSourceLocalMidnightV1(spanStartMs === anchorMs ? anchorMs : now, sourceTimezone)) {
661
+ const ordinal = Math.ceil((spanStartMs - originMs) / schedule.periodMilliseconds);
662
+ if (!reportingIsSourceLocalMidnightV1(originMs + ordinal * schedule.periodMilliseconds, sourceTimezone)) {
663
+ throw new TypeError("Reporting configuration boundaries do not land on source-local midnight");
664
+ }
665
+ }
666
+ }
667
+ function assertConstantUtcOffset(timeZone, startMs, endMs) {
668
+ const baseline = reportingUtcOffsetMinutesV1(timeZone, startMs);
669
+ for (let instant = startMs; instant < endMs; instant += OFFSET_PROBE_STEP_DAYS * DAY_MILLISECONDS) {
670
+ if (reportingUtcOffsetMinutesV1(timeZone, instant) !== baseline) {
671
+ throw new TypeError(
672
+ "Reporting source timezone changes its UTC offset; fixed-length periods cannot express its local days"
673
+ );
674
+ }
675
+ }
676
+ if (reportingUtcOffsetMinutesV1(timeZone, endMs) !== baseline) {
677
+ throw new TypeError(
678
+ "Reporting source timezone changes its UTC offset; fixed-length periods cannot express its local days"
679
+ );
680
+ }
681
+ }
682
+ function assertOfferingScheduleShape(offering) {
683
+ const advertised = offering.schedule;
684
+ const forbid = (fields) => {
685
+ for (const field of fields) {
686
+ if (advertised[field] !== void 0) {
687
+ throw new TypeError(
688
+ `Reporting offering advertises ${field}, which '${offering.schedule.alignment}' alignment forbids`
689
+ );
690
+ }
691
+ }
692
+ };
693
+ if (offering.schedule.alignment === "utc") {
694
+ forbid(["period_anchor", "period_anchor_policy", "period_timezone", "period_timezone_policy"]);
695
+ return;
696
+ }
697
+ forbid(["period_anchor", "period_anchor_policy"]);
698
+ const policy = offering.schedule.period_timezone_policy;
699
+ if (policy === void 0) {
700
+ throw new TypeError("source_timezone reporting offerings must advertise a period_timezone_policy");
701
+ }
702
+ if (policy === "fixed") {
703
+ if (offering.schedule.period_timezone === void 0) {
704
+ throw new TypeError("A fixed source_timezone reporting offering must advertise its period_timezone");
705
+ }
706
+ return;
707
+ }
708
+ if (offering.schedule.period_timezone !== void 0) {
709
+ forbid(["period_timezone"]);
710
+ }
711
+ }
712
+ function parseAdvertisedDuration(value, field) {
713
+ try {
714
+ return reportingIsoDurationMillisecondsV1(value);
715
+ } catch {
716
+ throw new TypeError(
717
+ `Reporting offering advertises a ${field} of '${value}' that this service cannot express as a fixed duration; every installation would reject it`
718
+ );
719
+ }
720
+ }
721
+ function localTimeOfDayMilliseconds(value) {
722
+ const [hours = 0, minutes = 0] = value.split(":").map(Number);
723
+ return hours * 36e5 + minutes * 6e4;
724
+ }
725
+ function trustedCurrency(value) {
726
+ if (typeof value !== "string" || !/^[A-Z]{3}$/.test(value)) {
727
+ throw new TypeError("resolveCurrency must return an ISO 4217-style three-letter uppercase currency");
728
+ }
729
+ return value;
730
+ }
731
+ function trustedTimezone(value) {
732
+ if (typeof value !== "string" || value.length === 0 || value.length > 255) {
733
+ throw new TypeError("resolveSource must return a bounded IANA sourceTimezone");
734
+ }
735
+ try {
736
+ new Intl.DateTimeFormat("en-US", { timeZone: value }).format(0);
737
+ } catch {
738
+ throw new TypeError("resolveSource must return a valid IANA sourceTimezone");
739
+ }
740
+ return value;
741
+ }
742
+ function assertNoUntrustedLineageFields(configuration) {
743
+ for (const field of [
744
+ "account",
745
+ "sourceScope",
746
+ "sourceTimezone",
747
+ "contract",
748
+ "currency",
749
+ "ctx_metadata",
750
+ "constituents",
751
+ "mediaBuyIds"
752
+ ]) {
753
+ if (Object.prototype.hasOwnProperty.call(configuration, field)) {
754
+ throw new TypeError(`Reporting configuration must not supply trusted lineage field ${field}`);
755
+ }
756
+ }
757
+ }
758
+ function containsContextMetadata(value) {
759
+ if (!value || typeof value !== "object") return false;
760
+ if (Array.isArray(value)) return value.some(containsContextMetadata);
761
+ for (const [key, child] of Object.entries(value)) {
762
+ if (/^(?:ctx_metadata|authInfo|auth_info)$/i.test(key) || containsContextMetadata(child)) return true;
763
+ }
764
+ return false;
765
+ }
766
+ function assertConsumerStatusStore(store) {
767
+ const candidate = store;
768
+ for (const method of ["getRevisionMetadata", "getConsumerStatusBatchReplay", "syncConsumerStatusBatch"]) {
769
+ if (typeof candidate[method] !== "function") {
770
+ throw new TypeError(`Consumer status requires a reporting ledger store with ${method}()`);
771
+ }
772
+ }
773
+ }
774
+ function positiveInteger(value, field) {
775
+ if (!Number.isSafeInteger(value) || value <= 0) throw new TypeError(`${field} must be a positive safe integer`);
776
+ }
777
+ function deepFreeze(value) {
778
+ if (value && typeof value === "object" && !Object.isFrozen(value)) {
779
+ Object.freeze(value);
780
+ for (const child of Object.values(value)) deepFreeze(child);
781
+ }
782
+ return value;
783
+ }
784
+ export * from "./conformance.mjs";
785
+ export {
786
+ createReliableReportingService
787
+ };