@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
@@ -1,15 +1,25 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { z } from "zod";
2
3
  import { buildReportingSourceManifestV1 } from "./builder.mjs";
3
4
  import { validateReportingSourceRequestAgainstCapabilitiesV1 } from "./conformance.mjs";
4
- import { canonicalJsonV1, REPORTING_SOURCE_CONTRACT_VERSION_V1 } from "./manifest.mjs";
5
+ import {
6
+ canonicalJsonV1,
7
+ ReportingEvidenceReasonV1Schema,
8
+ ReportingExternalIdV1Schema,
9
+ REPORTING_SOURCE_CONTRACT_VERSION_V1,
10
+ SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1,
11
+ SourceBatchContractError
12
+ } from "./manifest.mjs";
5
13
  import {
6
14
  completedReportingSourceResponseV1,
7
15
  reportingIsoDurationMillisecondsV1,
16
+ ReportingMetricOrDimensionNameV1Schema,
8
17
  reportingSourceCapabilitiesV1,
9
18
  ReportingSourceErrorV1Schema,
10
19
  ReportingSourceOfferingV1Schema,
11
20
  ReportingSourceSliceRequestV1Schema
12
21
  } from "./source.mjs";
22
+ const INLINE_REPORTING_AVAILABILITY_EVIDENCE_VERSION_V1 = "1.0";
13
23
  class ReportingSourceNotReadyError extends Error {
14
24
  constructor(message = "Reporting data is not ready") {
15
25
  super(message);
@@ -32,7 +42,87 @@ const INLINE_MAX_OBJECT_BYTES_V1 = 64 * 1024 * 1024;
32
42
  const INLINE_MAX_TOTAL_OBJECT_BYTES_V1 = 256 * 1024 * 1024;
33
43
  const INLINE_MAX_SCOPE_OBJECT_BYTES_V1 = 32 * 1024 * 1024;
34
44
  const INLINE_MAX_ROWS_V1 = 1e5;
35
- function createInlineReportingSourceExecutor(deliveryFetch, offeringInput) {
45
+ const INLINE_SHIPPED_CAPACITIES_V1 = {
46
+ object: INLINE_MAX_OBJECT_BYTES_V1,
47
+ total: INLINE_MAX_TOTAL_OBJECT_BYTES_V1,
48
+ scope: INLINE_MAX_SCOPE_OBJECT_BYTES_V1,
49
+ executions: INLINE_MAX_EXECUTIONS_V1,
50
+ scopeExecutions: INLINE_MAX_EXECUTIONS_PER_SCOPE_V1
51
+ };
52
+ function tightenInlineStagingCapacities(override) {
53
+ const tighten = (shipped, value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? Math.min(shipped, value) : shipped;
54
+ return {
55
+ object: tighten(INLINE_MAX_OBJECT_BYTES_V1, override.object),
56
+ total: tighten(INLINE_MAX_TOTAL_OBJECT_BYTES_V1, override.total),
57
+ scope: tighten(INLINE_MAX_SCOPE_OBJECT_BYTES_V1, override.scope),
58
+ executions: tighten(INLINE_MAX_EXECUTIONS_V1, override.executions),
59
+ scopeExecutions: tighten(INLINE_MAX_EXECUTIONS_PER_SCOPE_V1, override.scopeExecutions)
60
+ };
61
+ }
62
+ const INLINE_MAX_VALIDATION_WORK_UNITS_V1 = 5e6;
63
+ const INLINE_MAX_VALIDATION_SCAN_BYTES_V1 = INLINE_MAX_OBJECT_BYTES_V1;
64
+ const INLINE_MAX_VALIDATION_RETAINED_BYTES_V1 = INLINE_MAX_OBJECT_BYTES_V1;
65
+ const INLINE_RETAINED_BYTES_PER_ROW_V1 = 48;
66
+ const INLINE_RETAINED_BYTES_PER_CLAIM_V1 = 9;
67
+ const INLINE_MAX_STATUS_CHARS_V1 = 32;
68
+ const INLINE_NO_CLAIMS_OFFSET_V1 = -1;
69
+ const INLINE_MAX_EVIDENCE_OBJECT_KEYS_V1 = 16;
70
+ const INLINE_MAX_EVIDENCE_FIELD_CHARS_V1 = 1024;
71
+ const INLINE_EVIDENCE_ENVELOPE_KEYS_V1 = ["version", "cells"];
72
+ const INLINE_EVIDENCE_CELL_KEYS_V1 = ["constituent_id", "metric", "status", "reason", "data_through"];
73
+ const INLINE_UNAVAILABLE_ROW_STATUSES_V1 = [
74
+ "failed",
75
+ "reporting_delayed",
76
+ "not_ready",
77
+ "pending",
78
+ "unavailable",
79
+ "error"
80
+ ];
81
+ const INLINE_UNAVAILABLE_CELL_STATUSES_V1 = ["unsupported", "delayed", "missing"];
82
+ const INLINE_MAX_PROTOTYPE_CHAIN_DEPTH_V1 = 64;
83
+ const INLINE_MAX_DECIMAL_EXPONENT_V1 = 400;
84
+ const InlineReportingMetricEvidenceV1Schema = z.discriminatedUnion("status", [
85
+ z.strictObject({
86
+ constituent_id: ReportingExternalIdV1Schema,
87
+ metric: ReportingMetricOrDimensionNameV1Schema,
88
+ status: z.enum(["present", "explicit_zero"]),
89
+ data_through: z.string().trim().min(1).max(64),
90
+ reason: z.never().optional()
91
+ }),
92
+ z.strictObject({
93
+ constituent_id: ReportingExternalIdV1Schema,
94
+ metric: ReportingMetricOrDimensionNameV1Schema,
95
+ status: z.enum(["unsupported", "delayed", "partial", "stale", "missing"]),
96
+ reason: ReportingEvidenceReasonV1Schema,
97
+ data_through: z.string().trim().min(1).max(64).optional()
98
+ })
99
+ ]);
100
+ const InlineReportingAvailabilityEvidenceV1Schema = z.strictObject({
101
+ version: z.literal(INLINE_REPORTING_AVAILABILITY_EVIDENCE_VERSION_V1),
102
+ cells: z.array(InlineReportingMetricEvidenceV1Schema).min(1).max(SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1)
103
+ });
104
+ function createInlineReportingSourceExecutor(deliveryFetch, offeringInput, executorOptions = {}) {
105
+ return createInlineExecutorWithCapacities(
106
+ deliveryFetch,
107
+ offeringInput,
108
+ executorOptions,
109
+ INLINE_SHIPPED_CAPACITIES_V1
110
+ );
111
+ }
112
+ function createInlineReportingSourceExecutorForTestsV1(deliveryFetch, offeringInput, executorOptions, capacities, observer) {
113
+ return createInlineExecutorWithCapacities(
114
+ deliveryFetch,
115
+ offeringInput,
116
+ executorOptions,
117
+ tightenInlineStagingCapacities(capacities),
118
+ observer
119
+ );
120
+ }
121
+ function inlineStagingCapacitiesForTestsV1(capacities) {
122
+ return tightenInlineStagingCapacities(capacities);
123
+ }
124
+ function createInlineExecutorWithCapacities(deliveryFetch, offeringInput, executorOptions, capacities, observer) {
125
+ const evictSettled = executorOptions.replayRetention?.evictSettled === true;
36
126
  const parsedOffering = ReportingSourceOfferingV1Schema.parse(offeringInput);
37
127
  if (!parsedOffering.sourceExecution.manifestLevels.includes("basic")) {
38
128
  throw new TypeError("Inline reporting requires a basic manifest offering");
@@ -125,17 +215,39 @@ function createInlineReportingSourceExecutor(deliveryFetch, offeringInput) {
125
215
  if (existing.requestFingerprint !== requestFingerprint) {
126
216
  return failure("INTEGRITY_FAILED", "terminal", "sourceExecutionKey was reused with a different request");
127
217
  }
218
+ existing.reservation = void 0;
128
219
  return awaitInlineExecution(existing, context.signal, request.deadline.deadlineAt);
129
220
  }
130
- if (executions.size >= INLINE_MAX_EXECUTIONS_V1) {
131
- return failure("QUOTA_EXHAUSTED", "terminal", "Inline reporting replay capacity is exhausted");
132
- }
133
- if ([...executions.values()].filter((candidate) => candidate.scopeKey === scopeKey).length >= INLINE_MAX_EXECUTIONS_PER_SCOPE_V1) {
134
- return failure("QUOTA_EXHAUSTED", "terminal", "Inline reporting scope replay capacity is exhausted");
221
+ const scopeCount = [...executions.values()].filter((candidate) => candidate.scopeKey === scopeKey).length;
222
+ const exhaustedGlobally = executions.size >= capacities.executions;
223
+ const exhaustedForScope = scopeCount >= capacities.scopeExecutions;
224
+ if ((exhaustedGlobally || exhaustedForScope) && !evictSettled) {
225
+ return failure(
226
+ "QUOTA_EXHAUSTED",
227
+ "terminal",
228
+ `Inline reporting ${exhaustedGlobally ? "replay" : "scope replay"} capacity is exhausted; supply a durable executor or an explicit replayRetention policy for long-lived feeds`
229
+ );
135
230
  }
136
231
  if (activeExecutions >= INLINE_MAX_CONCURRENT_EXECUTIONS_V1) {
137
232
  return failure("RATE_LIMITED", "retryable", "Inline reporting concurrency capacity is exhausted");
138
233
  }
234
+ const reclaimer = evictSettled ? createAdmissionReclaimer(executions, storage) : void 0;
235
+ if (exhaustedGlobally && reclaimer?.plan(scopeKey, false) === void 0) {
236
+ reclaimer?.release();
237
+ return failure(
238
+ "QUOTA_EXHAUSTED",
239
+ "terminal",
240
+ "Inline reporting replay capacity is exhausted; supply a durable executor or an explicit replayRetention policy for long-lived feeds"
241
+ );
242
+ }
243
+ if (scopeCount - (reclaimer?.plannedInScope(scopeKey) ?? 0) >= capacities.scopeExecutions && reclaimer?.plan(scopeKey, true) === void 0) {
244
+ reclaimer?.release();
245
+ return failure(
246
+ "QUOTA_EXHAUSTED",
247
+ "terminal",
248
+ "Inline reporting scope replay capacity is exhausted; supply a durable executor or an explicit replayRetention policy for long-lived feeds"
249
+ );
250
+ }
139
251
  activeExecutions += 1;
140
252
  const controller = new AbortController();
141
253
  const pending = Promise.resolve().then(
@@ -149,7 +261,10 @@ function createInlineReportingSourceExecutor(deliveryFetch, offeringInput) {
149
261
  controller.signal,
150
262
  storage,
151
263
  key,
152
- scopeKey
264
+ scopeKey,
265
+ capacities,
266
+ reclaimer,
267
+ observer
153
268
  )
154
269
  ).then((result) => ({ requestFingerprint, result })).catch(() => ({
155
270
  requestFingerprint,
@@ -157,6 +272,7 @@ function createInlineReportingSourceExecutor(deliveryFetch, offeringInput) {
157
272
  })).finally(() => {
158
273
  activeExecutions -= 1;
159
274
  entry.pending = false;
275
+ reclaimer?.release();
160
276
  });
161
277
  const entry = {
162
278
  scopeKey,
@@ -188,13 +304,17 @@ function createInlineReportingSourceExecutor(deliveryFetch, offeringInput) {
188
304
  };
189
305
  return executor;
190
306
  }
191
- async function executeAndSeal(deliveryFetch, offering, format, request, deliveryDates, deadlineAt, signal, storage, executionNamespace, scopeKey) {
307
+ async function executeAndSeal(deliveryFetch, offering, format, request, deliveryDates, deadlineAt, signal, storage, executionNamespace, scopeKey, capacities, reclaimer, observer) {
192
308
  let fetched;
193
309
  try {
194
310
  fetched = await deliveryFetch(
195
311
  {
196
312
  account: structuredClone(request.account),
197
313
  media_buy_ids: [...request.coverage.mediaBuyIds],
314
+ constituents: request.coverage.constituents.map((constituent) => ({
315
+ constituent_id: constituent.constituentId,
316
+ media_buy_id: constituent.mediaBuyId
317
+ })),
198
318
  start_date: deliveryDates.start,
199
319
  end_date: deliveryDates.end,
200
320
  source_read_cutoff_at: request.period.sourceReadCutoffAt,
@@ -228,70 +348,209 @@ async function executeAndSeal(deliveryFetch, offering, format, request, delivery
228
348
  if (fetched === null) {
229
349
  return failure("NOT_READY", "retryable", "Reporting data is not ready");
230
350
  }
231
- const responseStatus = !isRows(fetched) ? fetched.status?.toLowerCase() : void 0;
351
+ const fetchedRecord = !isRows(fetched) ? fetched : void 0;
352
+ let rawStatus;
353
+ try {
354
+ rawStatus = fetchedRecord?.status;
355
+ } catch {
356
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an unreadable response");
357
+ }
358
+ if (rawStatus !== void 0 && typeof rawStatus !== "string") {
359
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch reported an unreadable status");
360
+ }
361
+ const responseStatus = boundedLowerCaseStatus(rawStatus);
232
362
  if (["failed", "error", "canceled", "cancelled", "rejected"].includes(responseStatus ?? "")) {
233
363
  return failure("SOURCE_TRANSIENT", "retryable", "Inline delivery fetch reported failure");
234
364
  }
235
365
  if (responseStatus === "unavailable") {
236
366
  return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch reported unavailable data");
237
367
  }
238
- if (!isRows(fetched) && (["working", "submitted", "input_required", "deferred", "reporting_delayed", "not_ready", "pending"].includes(
239
- responseStatus ?? ""
240
- ) || request.publicationClass === "AUTHORITATIVE" && fetched.is_final === false)) {
241
- return failure("NOT_READY", "retryable", "Reporting data is not ready");
242
- }
243
- if (request.publicationClass === "AUTHORITATIVE" && (isRows(fetched) || fetched.is_final !== true && !["final", "adjusted"].includes(fetched.notification_type ?? ""))) {
244
- return failure("NOT_READY", "retryable", "Authoritative inline reporting requires source finality evidence");
368
+ const readResponseField = createResponseFieldReader(fetchedRecord);
369
+ const scalarFailure = (() => {
370
+ try {
371
+ if (!isRows(fetched) && (["working", "submitted", "input_required", "deferred", "reporting_delayed", "not_ready", "pending"].includes(
372
+ responseStatus ?? ""
373
+ ) || request.publicationClass === "AUTHORITATIVE" && readResponseField("is_final") === false)) {
374
+ return failure("NOT_READY", "retryable", "Reporting data is not ready");
375
+ }
376
+ if (request.publicationClass === "AUTHORITATIVE" && (isRows(fetched) || readResponseField("is_final") !== true && !["final", "adjusted"].includes(asStringOrUndefined(readResponseField("notification_type")) ?? ""))) {
377
+ return failure("NOT_READY", "retryable", "Authoritative inline reporting requires source finality evidence");
378
+ }
379
+ if (!isRows(fetched) && (Boolean(readResponseField("partial_data")) || looseCount(readResponseField("unavailable_count")) > 0 || looseCount(lengthOfUnknown(readResponseField("errors"))) > 0)) {
380
+ return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned partial data");
381
+ }
382
+ const pagination = readResponseField("pagination");
383
+ if (!isRows(fetched) && fetchedRecord !== void 0 && pagination !== void 0) {
384
+ const paginationRecord = asRowRecord(pagination);
385
+ if (paginationRecord?.has_more !== false || Boolean(paginationRecord?.next_cursor)) {
386
+ return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned unfinished pagination");
387
+ }
388
+ }
389
+ return void 0;
390
+ } catch {
391
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an unreadable response");
392
+ }
393
+ })();
394
+ if (scalarFailure) return scalarFailure;
395
+ let reportingRowsInput;
396
+ let mediaBuyDeliveriesInput;
397
+ try {
398
+ reportingRowsInput = fetchedRecord ? fetchedRecord.reporting_rows : void 0;
399
+ mediaBuyDeliveriesInput = fetchedRecord ? fetchedRecord.media_buy_deliveries : void 0;
400
+ } catch {
401
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an invalid row collection");
245
402
  }
246
- if (!isRows(fetched) && (fetched.partial_data || (fetched.unavailable_count ?? 0) > 0 || (fetched.errors?.length ?? 0) > 0)) {
247
- return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned partial data");
403
+ const availabilityEvidenceSlot = fetchedRecord ? resolveOwnDataSlot(fetchedRecord, "availability_evidence") : { kind: "absent" };
404
+ if (reportingRowsInput !== void 0 && !Array.isArray(reportingRowsInput) || mediaBuyDeliveriesInput !== void 0 && !Array.isArray(mediaBuyDeliveriesInput)) {
405
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an invalid row collection");
248
406
  }
249
- if (!isRows(fetched) && fetched.pagination !== void 0 && (fetched.pagination.has_more !== false || Boolean(fetched.pagination.next_cursor))) {
250
- return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned unfinished pagination");
407
+ const reportingRows = reportingRowsInput;
408
+ const mediaBuyDeliveries = mediaBuyDeliveriesInput;
409
+ const reportingRowsLength = boundedCollectionLength(reportingRows);
410
+ const mediaBuyDeliveriesLength = boundedCollectionLength(mediaBuyDeliveries);
411
+ const sourceDeclaredLength = isRows(fetched) ? boundedCollectionLength(fetched) : reportingRows !== void 0 ? reportingRowsLength : mediaBuyDeliveriesLength;
412
+ if (reportingRowsLength === void 0 || mediaBuyDeliveriesLength === void 0 || sourceDeclaredLength === void 0) {
413
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an invalid row collection");
251
414
  }
252
- if (!isRows(fetched) && fetched.reporting_rows === void 0 && fetched.media_buy_deliveries === void 0) {
415
+ if (!isRows(fetched) && reportingRows === void 0 && mediaBuyDeliveries === void 0) {
253
416
  return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch omitted its row collection");
254
417
  }
255
- if (!isRows(fetched) && (!fetched.reporting_period || !deliveryPeriodBoundaryMatches(fetched.reporting_period.start, deliveryDates.start, request.period.start) || !deliveryPeriodBoundaryMatches(fetched.reporting_period.end, deliveryDates.end, request.period.end))) {
418
+ let responsePeriod;
419
+ let responseCurrency;
420
+ try {
421
+ const period = asRowRecord(readResponseField("reporting_period"));
422
+ const periodStart = period?.start;
423
+ const periodEnd = period?.end;
424
+ responsePeriod = {
425
+ present: period !== void 0 && periodStart !== void 0 && periodEnd !== void 0,
426
+ start: periodStart,
427
+ end: periodEnd
428
+ };
429
+ responseCurrency = readResponseField("currency");
430
+ } catch {
431
+ return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned an unreadable response");
432
+ }
433
+ if (!isRows(fetched) && (!responsePeriod.present || !deliveryPeriodBoundaryMatches(responsePeriod.start, deliveryDates.start, request.period.start) || !deliveryPeriodBoundaryMatches(responsePeriod.end, deliveryDates.end, request.period.end))) {
256
434
  return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch did not prove the requested half-open period");
257
435
  }
258
- if (!isRows(fetched) && fetched.currency !== void 0 && fetched.currency !== request.sourceSettings.currency) {
436
+ if (!isRows(fetched) && responseCurrency !== void 0 && responseCurrency !== request.sourceSettings.currency) {
259
437
  return failure(
260
438
  "INTEGRITY_FAILED",
261
439
  "terminal",
262
440
  "Inline delivery currency does not match the frozen source settings"
263
441
  );
264
442
  }
265
- if (!isRows(fetched) && ((fetched.reporting_rows?.length ?? 0) > INLINE_MAX_ROWS_V1 || (fetched.media_buy_deliveries?.length ?? 0) > INLINE_MAX_ROWS_V1 || (fetched.reporting_rows?.length ?? 0) + (fetched.media_buy_deliveries?.length ?? 0) > INLINE_MAX_ROWS_V1)) {
443
+ if (!isRows(fetched) && (reportingRowsLength > INLINE_MAX_ROWS_V1 || mediaBuyDeliveriesLength > INLINE_MAX_ROWS_V1 || reportingRowsLength + mediaBuyDeliveriesLength > INLINE_MAX_ROWS_V1)) {
266
444
  return failure("QUOTA_EXHAUSTED", "terminal", "Inline delivery fetch exceeded the row limit");
267
445
  }
268
- if (!isRows(fetched) && fetched.reporting_rows !== void 0 && fetched.media_buy_deliveries !== void 0 && fetched.reporting_rows.length === 0 !== (fetched.media_buy_deliveries.length === 0)) {
446
+ if (!isRows(fetched) && reportingRows !== void 0 && mediaBuyDeliveries !== void 0 && reportingRowsLength === 0 !== (mediaBuyDeliveriesLength === 0)) {
269
447
  return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row collections disagree about zero delivery");
270
448
  }
271
- const sourceRows = isRows(fetched) ? [...fetched] : fetched.reporting_rows !== void 0 ? [...fetched.reporting_rows] : [...fetched.media_buy_deliveries ?? []];
272
- if (sourceRows.length > INLINE_MAX_ROWS_V1) {
449
+ const sourceCollection = isRows(fetched) ? fetched : reportingRows ?? mediaBuyDeliveries ?? [];
450
+ const auxiliaryDeclaredLength = !isRows(fetched) && reportingRows !== void 0 ? mediaBuyDeliveriesLength : 0;
451
+ if (sourceDeclaredLength > INLINE_MAX_ROWS_V1 || auxiliaryDeclaredLength > INLINE_MAX_ROWS_V1) {
273
452
  return failure("QUOTA_EXHAUSTED", "terminal", "Inline delivery fetch exceeded the row limit");
274
453
  }
275
- const evidenceRows = isRows(fetched) ? sourceRows : [...fetched.reporting_rows ?? [], ...fetched.media_buy_deliveries ?? []];
276
- if (evidenceRows.some((row) => rowIsUnavailable(row))) {
277
- return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned an unavailable row");
454
+ const sourceRowInputs = captureRowCollection(sourceCollection, sourceDeclaredLength);
455
+ const auxiliaryRowInputs = auxiliaryDeclaredLength > 0 ? captureRowCollection(mediaBuyDeliveries ?? [], auxiliaryDeclaredLength) : [];
456
+ let availabilityEvidence;
457
+ if (!isRows(fetched) && availabilityEvidenceSlot.kind === "unreadable") {
458
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery availability evidence is invalid");
278
459
  }
279
- if (sourceRows.length > 0) {
280
- const admittedMediaBuyIds = new Set(
281
- request.coverage.constituents.flatMap((constituent) => constituent.mediaBuyId ? [constituent.mediaBuyId] : [])
282
- );
283
- if (evidenceRows.some((row) => !admittedMediaBuyIds.has(rowMediaBuyId(row) ?? ""))) {
284
- return failure("INTEGRITY_FAILED", "terminal", "Inline delivery fetch returned an out-of-scope row");
460
+ if (!isRows(fetched) && availabilityEvidenceSlot.kind === "data") {
461
+ try {
462
+ availabilityEvidence = parseInlineAvailabilityEvidence(
463
+ availabilityEvidenceSlot.value,
464
+ request
465
+ );
466
+ } catch {
467
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery availability evidence is invalid");
285
468
  }
286
- if (evidenceRows.some((row) => rowCurrency(row) !== void 0 && rowCurrency(row) !== request.sourceSettings.currency)) {
469
+ }
470
+ const captureLayout = captureLayoutFor(request);
471
+ const claimBearingRowCount = sourceRowInputs.length + (availabilityEvidenceSlot.kind === "data" ? auxiliaryRowInputs.length : 0);
472
+ if (workUnitsExceedCap(
473
+ claimBearingRowCount,
474
+ 1 + request.requestedMetrics.length + request.requestedDimensions.length,
475
+ INLINE_MAX_VALIDATION_WORK_UNITS_V1
476
+ ) || workUnitsExceedCap(
477
+ claimBearingRowCount,
478
+ INLINE_RETAINED_BYTES_PER_ROW_V1 + captureLayout.fields.length * INLINE_RETAINED_BYTES_PER_CLAIM_V1,
479
+ INLINE_MAX_VALIDATION_RETAINED_BYTES_V1
480
+ )) {
481
+ return failure("QUOTA_EXHAUSTED", "terminal", "Inline availability verification exceeded the work budget");
482
+ }
483
+ const strictClaims = availabilityEvidence !== void 0;
484
+ let scanBudget = INLINE_MAX_VALIDATION_SCAN_BYTES_V1;
485
+ const chargeScan = (units) => {
486
+ if (units > scanBudget) throw new InlineWorkBudgetExhaustedError();
487
+ scanBudget -= units;
488
+ };
489
+ const sourceReserved = [];
490
+ const auxiliaryReserved = [];
491
+ for (const [rows2, captured] of [
492
+ [sourceRowInputs, sourceReserved],
493
+ [auxiliaryRowInputs, auxiliaryReserved]
494
+ ]) {
495
+ for (const row of rows2) {
496
+ const reserved = beginRowReserved(row);
497
+ captured.push(reserved);
498
+ if (reserved !== void 0 && (rowStatusIsUnavailable(reserved) || rowDeclaresPartialData(reserved))) {
499
+ return failure("PARTIAL_RESULT", "retryable", "Inline delivery fetch returned an unavailable row");
500
+ }
501
+ }
502
+ }
503
+ for (const reserved of [...sourceReserved, ...auxiliaryReserved]) {
504
+ if (reserved === void 0) continue;
505
+ readRowCurrency(reserved);
506
+ if (typeof reserved.currency === "string" && reserved.currency !== request.sourceSettings.currency) {
287
507
  return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row currency does not match source settings");
288
508
  }
509
+ }
510
+ let sourceSnapshots;
511
+ let auxiliarySnapshots;
512
+ try {
513
+ const claimRowCount = sourceReserved.length + (strictClaims ? auxiliaryReserved.length : 0);
514
+ const store = createClaimStore(captureLayout, claimRowCount);
515
+ sourceSnapshots = sourceReserved.map(
516
+ (reserved, index) => captureRowSnapshot(reserved, store, index, strictClaims, chargeScan)
517
+ );
518
+ auxiliarySnapshots = auxiliaryReserved.map(
519
+ (reserved, index) => strictClaims ? captureRowSnapshot(reserved, store, sourceReserved.length + index, strictClaims, chargeScan) : captureRowIdentityOnly(reserved, store)
520
+ );
521
+ } catch (error) {
522
+ if (error instanceof InlineWorkBudgetExhaustedError) {
523
+ return failure("QUOTA_EXHAUSTED", "terminal", "Inline availability verification exceeded the scan budget");
524
+ }
525
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row contains invalid evidence values");
526
+ }
527
+ const allSnapshots = [...sourceSnapshots, ...auxiliarySnapshots];
528
+ if (validationWorkExceedsCap(
529
+ sourceSnapshots,
530
+ auxiliarySnapshots,
531
+ request,
532
+ availabilityEvidence !== void 0,
533
+ INLINE_MAX_VALIDATION_WORK_UNITS_V1
534
+ )) {
535
+ return failure("QUOTA_EXHAUSTED", "terminal", "Inline availability verification exceeded the work budget");
536
+ }
537
+ const admittedMediaBuyIds = new Set(
538
+ request.coverage.constituents.flatMap((constituent) => constituent.mediaBuyId ? [constituent.mediaBuyId] : [])
539
+ );
540
+ const sourceSnapshotsByMediaBuyId = groupSnapshotsByMediaBuyId(sourceSnapshots, admittedMediaBuyIds);
541
+ const auxiliarySnapshotsByMediaBuyId = groupSnapshotsByMediaBuyId(auxiliarySnapshots, admittedMediaBuyIds);
542
+ if (sourceSnapshots.length > 0) {
543
+ if (allSnapshots.some((snapshot) => !admittedMediaBuyIds.has(snapshot?.mediaBuyId ?? ""))) {
544
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery fetch returned an out-of-scope row");
545
+ }
289
546
  if (request.coverage.constituents.some((constituent) => {
290
547
  if (constituent.constituentKind !== "media_buy" || !constituent.mediaBuyId) return true;
291
- const constituentRows = sourceRows.filter((row) => rowMediaBuyId(row) === constituent.mediaBuyId);
292
- return constituentRows.length === 0 || constituentRows.some(
293
- (row) => request.requestedMetrics.some((metric) => !rowHasField(row, metric)) || request.requestedDimensions.some((dimension) => !rowHasDimension(row, dimension))
294
- );
548
+ const constituentRows = sourceSnapshotsByMediaBuyId.get(constituent.mediaBuyId) ?? NO_SNAPSHOTS;
549
+ return constituentRows.some(
550
+ (snapshot) => request.requestedDimensions.some((dimension) => !snapshotHasDimension(snapshot, dimension))
551
+ ) || availabilityEvidence === void 0 && (constituentRows.length === 0 || constituentRows.some(
552
+ (snapshot) => request.requestedMetrics.some((metric) => snapshotFieldValue(snapshot, metric) === void 0)
553
+ ));
295
554
  })) {
296
555
  return failure(
297
556
  "PARTIAL_RESULT",
@@ -300,37 +559,35 @@ async function executeAndSeal(deliveryFetch, offering, format, request, delivery
300
559
  );
301
560
  }
302
561
  }
303
- const remainingCapacity = Math.min(
304
- INLINE_MAX_OBJECT_BYTES_V1,
305
- INLINE_MAX_TOTAL_OBJECT_BYTES_V1 - storage.totalBytes,
306
- INLINE_MAX_SCOPE_OBJECT_BYTES_V1 - (storage.scopeBytes.get(scopeKey) ?? 0)
307
- );
308
- let projectionBudget = remainingCapacity;
309
- let rows;
310
- try {
311
- rows = sourceRows.map(
312
- (row) => projectEvidenceRow(row, request, (upperBound) => {
313
- if (upperBound > projectionBudget) throw new RangeError("Inline projection capacity exhausted");
314
- projectionBudget -= upperBound;
315
- })
562
+ if (availabilityEvidence !== void 0) {
563
+ const rowEvidenceFailure = validateSnapshotsAgainstAvailabilityEvidence(
564
+ sourceSnapshotsByMediaBuyId,
565
+ auxiliarySnapshotsByMediaBuyId,
566
+ request,
567
+ availabilityEvidence.cells
316
568
  );
317
- } catch (error) {
318
- if (error instanceof RangeError) {
319
- return failure("STAGING_FAILED", "terminal", "Inline delivery evidence exceeds the bounded replay capacity");
569
+ if (rowEvidenceFailure === "partial") {
570
+ return failure("PARTIAL_RESULT", "retryable", "Inline delivery rows do not prove every metric marked present");
571
+ }
572
+ if (rowEvidenceFailure === "integrity") {
573
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery rows contradict availability evidence");
320
574
  }
321
- return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row contains invalid evidence values");
322
575
  }
323
576
  const readsPartialPeriod = Date.parse(request.period.sourceReadCutoffAt) < Date.parse(request.period.end);
324
- if (readsPartialPeriod && (isRows(fetched) || fetched.data_through === void 0 || fetched.observed_at === void 0)) {
577
+ if (readsPartialPeriod && (isRows(fetched) || readResponseField("data_through") === void 0 || readResponseField("observed_at") === void 0)) {
325
578
  return failure(
326
579
  "PARTIAL_RESULT",
327
580
  "retryable",
328
581
  "Inline delivery fetch did not provide temporal evidence for the source read cutoff"
329
582
  );
330
583
  }
331
- const observedAt = isRows(fetched) ? request.period.sourceReadCutoffAt : normalizeDeliveryInstant(fetched.observed_at ?? request.period.sourceReadCutoffAt, deliveryDates, request.period);
584
+ const observedAt = isRows(fetched) ? request.period.sourceReadCutoffAt : normalizeDeliveryInstant(
585
+ readResponseField("observed_at") ?? request.period.sourceReadCutoffAt,
586
+ deliveryDates,
587
+ request.period
588
+ );
332
589
  const defaultDataThrough = request.publicationClass === "AUTHORITATIVE" ? request.period.end : Date.parse(request.period.sourceReadCutoffAt) < Date.parse(request.period.end) ? request.period.sourceReadCutoffAt : request.period.end;
333
- const dataThrough = isRows(fetched) ? defaultDataThrough : normalizeDeliveryInstant(fetched.data_through ?? defaultDataThrough, deliveryDates, request.period);
590
+ const dataThrough = isRows(fetched) ? defaultDataThrough : normalizeDeliveryInstant(readResponseField("data_through") ?? defaultDataThrough, deliveryDates, request.period);
334
591
  const acquiredAt = (/* @__PURE__ */ new Date()).toISOString();
335
592
  const startMs = Date.parse(request.period.start);
336
593
  const endMs = Date.parse(request.period.end);
@@ -341,15 +598,110 @@ async function executeAndSeal(deliveryFetch, offering, format, request, delivery
341
598
  if (request.publicationClass === "AUTHORITATIVE" && dataThroughMs < endMs) {
342
599
  return failure("NOT_READY", "retryable", "Authoritative inline reporting has not reached period end");
343
600
  }
344
- if (![dataThroughMs, observedMs].every(Number.isFinite) || dataThroughMs < startMs || dataThroughMs > endMs || dataThroughMs > cutoffMs || dataThroughMs > observedMs || observedMs > acquiredMs || rows.length > 0 && dataThroughMs <= startMs) {
601
+ if (![dataThroughMs, observedMs].every(Number.isFinite) || dataThroughMs < startMs || dataThroughMs > endMs || dataThroughMs > cutoffMs || dataThroughMs > observedMs || observedMs > acquiredMs || sourceSnapshots.length > 0 && dataThroughMs <= startMs) {
345
602
  return failure("SOURCE_PERMANENT", "terminal", "Inline delivery fetch returned invalid temporal evidence");
346
603
  }
347
- let bytes;
348
- try {
349
- bytes = encodeRows(rows, format.mediaType, remainingCapacity);
350
- } catch {
351
- return failure("STAGING_FAILED", "terminal", "Inline delivery evidence exceeds the bounded replay capacity");
604
+ const declaredMetrics = new Map(offering.metrics.map((metric) => [metric.name, metric]));
605
+ const constituentIdsWithRows = new Set(
606
+ request.coverage.constituents.filter((constituent) => constituent.mediaBuyId && sourceSnapshotsByMediaBuyId.has(constituent.mediaBuyId)).map((constituent) => constituent.constituentId)
607
+ );
608
+ let projectedAvailability;
609
+ if (availabilityEvidence) {
610
+ try {
611
+ projectedAvailability = projectInlineAvailabilityEvidence(
612
+ availabilityEvidence.cells,
613
+ request,
614
+ declaredMetrics,
615
+ deliveryDates,
616
+ dataThrough,
617
+ sourceSnapshots.length,
618
+ constituentIdsWithRows
619
+ );
620
+ } catch {
621
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery availability evidence is contradictory");
622
+ }
623
+ } else {
624
+ projectedAvailability = projectLegacyAvailability(request, declaredMetrics, dataThrough, sourceSnapshots.length);
625
+ }
626
+ if (request.coverage.expected === "full" && projectedAvailability.coverageStatus !== "full") {
627
+ return failure("PARTIAL_RESULT", "retryable", "Inline delivery evidence does not satisfy full requested coverage");
628
+ }
629
+ if (request.publicationClass === "AUTHORITATIVE" && projectedAvailability.metricAvailability.some(
630
+ (cell) => !["present", "explicit_zero"].includes(cell.status) || Date.parse(cell.dataThrough ?? "") !== endMs
631
+ )) {
632
+ return failure("PARTIAL_RESULT", "retryable", "Authoritative inline reporting has incomplete metric evidence");
633
+ }
634
+ const reservedBytes = reclaimer?.grantReservedBytes(scopeKey) ?? { global: 0, scope: 0 };
635
+ let plannedGlobalCredit = reservedBytes.global;
636
+ let plannedScopeCredit = reservedBytes.scope;
637
+ const globalRoom = () => capacities.total - storage.totalBytes + plannedGlobalCredit;
638
+ const scopeRoom = () => capacities.scope - (storage.scopeBytes.get(scopeKey) ?? 0) + plannedScopeCredit;
639
+ const capacity = () => Math.min(capacities.object, globalRoom(), scopeRoom());
640
+ const planMoreCapacity = () => {
641
+ for (; ; ) {
642
+ const freed = reclaimer?.plan(scopeKey, scopeRoom() <= globalRoom(), true);
643
+ if (freed === void 0) return false;
644
+ if (freed.bytes <= 0) continue;
645
+ plannedGlobalCredit += freed.bytes;
646
+ if (freed.sameScope) plannedScopeCredit += freed.bytes;
647
+ return true;
648
+ }
649
+ };
650
+ const growCapacity = (available) => {
651
+ observer?.onCapacityRequest?.();
652
+ if (!planMoreCapacity()) return void 0;
653
+ const grown = capacity();
654
+ return grown > available ? grown : void 0;
655
+ };
656
+ let remainingCapacity = capacity();
657
+ let projectionBudget = remainingCapacity;
658
+ let rows;
659
+ while (rows === void 0) {
660
+ projectionBudget = remainingCapacity;
661
+ try {
662
+ rows = sourceSnapshots.map(
663
+ (snapshot) => projectSnapshotRow(
664
+ snapshot,
665
+ request,
666
+ (upperBound) => {
667
+ if (upperBound > projectionBudget) throw new RangeError("Inline projection capacity exhausted");
668
+ projectionBudget -= upperBound;
669
+ },
670
+ {
671
+ allowMissingMetrics: true,
672
+ allowMissingDimensions: true,
673
+ strictMetricClaims: availabilityEvidence !== void 0,
674
+ includeDimensions: true
675
+ }
676
+ )
677
+ );
678
+ } catch (error) {
679
+ if (!(error instanceof RangeError)) {
680
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row contains invalid evidence values");
681
+ }
682
+ const grown = growCapacity(remainingCapacity);
683
+ if (grown === void 0) {
684
+ return failure("STAGING_FAILED", "terminal", "Inline delivery evidence exceeds the bounded replay capacity");
685
+ }
686
+ remainingCapacity = grown;
687
+ }
352
688
  }
689
+ let encoded;
690
+ while (encoded === void 0) {
691
+ try {
692
+ encoded = encodeRows(rows, format.mediaType, remainingCapacity);
693
+ } catch (error) {
694
+ if (!(error instanceof RangeError)) {
695
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery row contains invalid evidence values");
696
+ }
697
+ const grown = growCapacity(remainingCapacity);
698
+ if (grown === void 0) {
699
+ return failure("STAGING_FAILED", "terminal", "Inline delivery evidence exceeds the bounded replay capacity");
700
+ }
701
+ remainingCapacity = grown;
702
+ }
703
+ }
704
+ const bytes = encoded;
353
705
  const objectDigest = digest(bytes);
354
706
  const objectRef = `inline-${executionNamespace.slice(0, 32)}`;
355
707
  const generation = `sha256-${objectDigest}`;
@@ -363,25 +715,423 @@ async function executeAndSeal(deliveryFetch, offering, format, request, delivery
363
715
  byteCount: bytes.byteLength,
364
716
  rowCount: rows.length
365
717
  };
366
- const explicitZero = rows.length === 0;
718
+ let built;
719
+ try {
720
+ built = buildReportingSourceManifestV1({
721
+ level: "basic",
722
+ request,
723
+ stagedCommitRef: `inline-manifest-${executionNamespace.slice(0, 32)}`,
724
+ objects: [object],
725
+ completeness: {
726
+ terminal: true,
727
+ rowsComplete: true,
728
+ requestedGroupsComplete: true
729
+ },
730
+ controlTotals: [],
731
+ metricAvailability: projectedAvailability.metricAvailability,
732
+ coverage: {
733
+ status: projectedAvailability.coverageStatus,
734
+ constituents: projectedAvailability.coverageConstituents
735
+ },
736
+ observedAt,
737
+ dataThrough,
738
+ finalityEvidence: {
739
+ owner: "adapter",
740
+ basis: request.publicationClass === "PROVISIONAL_SNAPSHOT" ? "provisional_observation" : "source_declared",
741
+ observedAt,
742
+ ...request.publicationClass === "AUTHORITATIVE" ? { evidenceRef: "get_media_buy_delivery.is_final" } : {}
743
+ },
744
+ explicitZero: projectedAvailability.explicitZero,
745
+ acquiredAt,
746
+ ...rows.length === 0 ? {} : { eventTimeRange: { start: request.period.start, end: dataThrough } },
747
+ warnings: []
748
+ });
749
+ } catch (error) {
750
+ if (!availabilityEvidence) throw error;
751
+ if (error instanceof SourceBatchContractError && error.code === "SOURCE_MANIFEST_TOO_LARGE") {
752
+ return failure("QUOTA_EXHAUSTED", "terminal", "Inline reporting manifest exceeded the bounded size limit");
753
+ }
754
+ return failure("INTEGRITY_FAILED", "terminal", "Inline delivery availability evidence is contradictory");
755
+ }
756
+ if (Date.parse(deadlineAt) <= Date.now()) {
757
+ return failure("DEADLINE_EXCEEDED", "retryable", "Inline reporting execution deadline elapsed");
758
+ }
759
+ if (reclaimer !== void 0 && !reclaimer.commit(scopeKey)) {
760
+ return failure(
761
+ "STAGING_FAILED",
762
+ "terminal",
763
+ "Inline reporting could not reacquire the capacity a revoked reservation had promised"
764
+ );
765
+ }
766
+ storage.objects.set(objectRef, { request: structuredClone(request), generation, bytes: Uint8Array.from(bytes) });
767
+ storage.totalBytes += bytes.byteLength;
768
+ storage.scopeBytes.set(scopeKey, (storage.scopeBytes.get(scopeKey) ?? 0) + bytes.byteLength);
769
+ return {
770
+ ok: true,
771
+ response: completedReportingSourceResponseV1({ request, manifest: built.reference }),
772
+ manifestBytes: built.manifestBytes
773
+ };
774
+ }
775
+ function parseInlineAvailabilityEvidence(input, request) {
776
+ if (typeof input !== "object" || input === null) throw new TypeError("Availability evidence is not an envelope");
777
+ const envelope = snapshotOwnDataObject(input, INLINE_EVIDENCE_ENVELOPE_KEYS_V1);
778
+ const inputCells = envelope.cells;
779
+ const cellCount = Array.isArray(inputCells) ? boundedCollectionLength(inputCells) : void 0;
780
+ if (cellCount === void 0) throw new TypeError("Availability evidence cells are not a bounded array");
781
+ if (cellCount > SOURCE_BATCH_MANIFEST_MAX_METRIC_AVAILABILITY_V1) {
782
+ throw new TypeError("Availability evidence exceeds the cell limit");
783
+ }
784
+ const cellSnapshot = new Array(cellCount);
785
+ for (let index = 0; index < cellCount; index += 1) {
786
+ const cell = inputCells[index];
787
+ if (typeof cell !== "object" || cell === null || Array.isArray(cell)) {
788
+ throw new TypeError("Availability evidence cell is not an object");
789
+ }
790
+ cellSnapshot[index] = snapshotOwnDataObject(cell, INLINE_EVIDENCE_CELL_KEYS_V1);
791
+ }
792
+ const parsed = InlineReportingAvailabilityEvidenceV1Schema.parse({ ...envelope, cells: cellSnapshot });
793
+ const expected = new Set(
794
+ request.coverage.constituents.flatMap(
795
+ (constituent) => request.requestedMetrics.map((metric) => availabilityCellKey(constituent.constituentId, metric))
796
+ )
797
+ );
798
+ const seen = /* @__PURE__ */ new Set();
799
+ for (const cell of parsed.cells) {
800
+ const key = availabilityCellKey(cell.constituent_id, cell.metric);
801
+ if (!expected.has(key) || seen.has(key)) throw new TypeError("Availability cell is duplicate or out of scope");
802
+ seen.add(key);
803
+ }
804
+ if (seen.size !== expected.size) throw new TypeError("Availability evidence must cover the requested matrix");
805
+ const cellsByKey = new Map(parsed.cells.map((cell) => [availabilityCellKey(cell.constituent_id, cell.metric), cell]));
806
+ return {
807
+ ...parsed,
808
+ cells: request.coverage.constituents.flatMap(
809
+ (constituent) => request.requestedMetrics.map((metric) => {
810
+ const cell = cellsByKey.get(availabilityCellKey(constituent.constituentId, metric));
811
+ if (!cell) throw new TypeError("Availability evidence must cover the requested matrix");
812
+ return cell;
813
+ })
814
+ )
815
+ };
816
+ }
817
+ const NO_SNAPSHOTS = [];
818
+ class InlineWorkBudgetExhaustedError extends Error {
819
+ }
820
+ const UNCLAIMED_V1 = { claimed: false };
821
+ function captureLayoutFor(request) {
822
+ const fields = [];
823
+ const indexOf = /* @__PURE__ */ new Map();
824
+ const reservedFields = /* @__PURE__ */ new Set();
825
+ const requestedAsMetric = new Set(request.requestedMetrics);
826
+ for (const field of [...request.requestedMetrics, ...request.requestedDimensions]) {
827
+ if (indexOf.has(field)) continue;
828
+ if (field === "media_buy_id" && !requestedAsMetric.has(field)) continue;
829
+ indexOf.set(field, fields.length);
830
+ fields.push(field);
831
+ if (INLINE_RESERVED_ROW_FIELDS_V1.includes(field)) reservedFields.add(field);
832
+ }
833
+ return { fields, indexOf, reservedFields };
834
+ }
835
+ const CLAIM_DIRECT_CLAIMED_V1 = 1 << 0;
836
+ const CLAIM_NESTED_CLAIMED_V1 = 1 << 1;
837
+ const CLAIM_DIRECT_VALID_V1 = 1 << 2;
838
+ const CLAIM_NESTED_VALID_V1 = 1 << 3;
839
+ const CLAIM_VALUE_IS_ZERO_V1 = 1 << 4;
840
+ const CLAIM_CLAIM_IS_ZERO_V1 = 1 << 5;
841
+ const CLAIM_DISAGREE_V1 = 1 << 6;
842
+ const INLINE_RESERVED_ROW_FIELDS_V1 = ["media_buy_id", "currency", "status", "partial_data", "totals"];
843
+ function beginRowReserved(row) {
844
+ const record = asRowRecord(row);
845
+ if (!record) return void 0;
846
+ return { record, status: ownDataValue(record, "status") };
847
+ }
848
+ function rowStatusIsUnavailable(reserved) {
849
+ const status = boundedLowerCaseStatus(reserved.status);
850
+ return status !== void 0 && INLINE_UNAVAILABLE_ROW_STATUSES_V1.includes(status);
851
+ }
852
+ function rowDeclaresPartialData(reserved) {
853
+ reserved.partialData = ownDataValue(reserved.record, "partial_data");
854
+ return reserved.partialData === true;
855
+ }
856
+ function readRowCurrency(reserved) {
857
+ reserved.currency = ownDataValue(reserved.record, "currency");
858
+ }
859
+ function readRowIdentity(reserved) {
860
+ reserved.mediaBuyId = ownDataValue(reserved.record, "media_buy_id");
861
+ }
862
+ function reservedFieldValue(reserved, field) {
863
+ switch (field) {
864
+ case "media_buy_id":
865
+ return reserved.mediaBuyId;
866
+ case "currency":
867
+ return reserved.currency;
868
+ case "status":
869
+ return reserved.status;
870
+ case "partial_data":
871
+ return reserved.partialData;
872
+ default:
873
+ return reserved.totals;
874
+ }
875
+ }
876
+ function createClaimStore(layout, rowCount) {
877
+ const width = layout.fields.length;
878
+ return {
879
+ layout,
880
+ values: new Array(rowCount * width),
881
+ flags: new Uint8Array(rowCount * width)
882
+ };
883
+ }
884
+ function fieldSlotOf(snapshot, field) {
885
+ return snapshot.store.layout.indexOf.get(field) ?? -1;
886
+ }
887
+ function slotValue(snapshot, slot) {
888
+ return slot < 0 || snapshot.offset < 0 ? void 0 : snapshot.store.values[snapshot.offset + slot];
889
+ }
890
+ function slotFlags(snapshot, slot) {
891
+ return slot < 0 || snapshot.offset < 0 ? 0 : snapshot.store.flags[snapshot.offset + slot] ?? 0;
892
+ }
893
+ function snapshotFieldValue(snapshot, field) {
894
+ return slotValue(snapshot, fieldSlotOf(snapshot, field));
895
+ }
896
+ function captureRowSnapshot(reserved, store, rowIndex, strictClaims, chargeScan) {
897
+ if (!reserved) return void 0;
898
+ readRowIdentity(reserved);
899
+ const { record } = reserved;
900
+ const layout = store.layout;
901
+ const offset = rowIndex * layout.fields.length;
902
+ let totalsObserved = false;
903
+ let totalsRecord;
904
+ let totalsAliasesRow = false;
905
+ const observeTotals = () => {
906
+ if (!totalsObserved) {
907
+ totalsObserved = true;
908
+ reserved.totals = ownDataValue(record, "totals");
909
+ totalsRecord = typeof reserved.totals === "object" && reserved.totals !== null ? reserved.totals : void 0;
910
+ totalsAliasesRow = totalsRecord === record;
911
+ }
912
+ return reserved.totals;
913
+ };
914
+ for (let slot = 0; slot < layout.fields.length; slot += 1) {
915
+ const field = layout.fields[slot];
916
+ const direct = layout.reservedFields.has(field) ? claimOfValue(field === "totals" ? observeTotals() : reservedFieldValue(reserved, field)) : ownDataClaim(record, field);
917
+ const measurePasses = strictClaims ? 2 : 1;
918
+ chargeScan(measureScanWidth(direct.value) * measurePasses);
919
+ const measuredDirect = measureClaim(direct.value, strictClaims);
920
+ let nested = UNCLAIMED_V1;
921
+ let measuredNested = UNMEASURED_CLAIM_V1;
922
+ if (strictClaims || !measuredDirect.valid) {
923
+ observeTotals();
924
+ if (totalsRecord !== void 0) {
925
+ if (totalsAliasesRow) {
926
+ nested = direct;
927
+ measuredNested = measuredDirect;
928
+ } else {
929
+ nested = ownDataClaim(totalsRecord, field);
930
+ chargeScan(measureScanWidth(nested.value) * measurePasses);
931
+ measuredNested = measureClaim(nested.value, strictClaims);
932
+ }
933
+ }
934
+ }
935
+ const resolved = measuredDirect.valid ? measuredDirect : measuredNested.valid ? measuredNested : void 0;
936
+ const claimed = direct.claimed ? measuredDirect : measuredNested;
937
+ let bits = 0;
938
+ if (direct.claimed) bits |= CLAIM_DIRECT_CLAIMED_V1;
939
+ if (nested.claimed) bits |= CLAIM_NESTED_CLAIMED_V1;
940
+ if (measuredDirect.valid) bits |= CLAIM_DIRECT_VALID_V1;
941
+ if (measuredNested.valid) bits |= CLAIM_NESTED_VALID_V1;
942
+ if (resolved?.isZero === true) bits |= CLAIM_VALUE_IS_ZERO_V1;
943
+ if (claimed.valid && claimed.isZero) bits |= CLAIM_CLAIM_IS_ZERO_V1;
944
+ if (strictClaims && direct.claimed && nested.claimed && measuredDirect.valid && measuredNested.valid && !Object.is(direct.value, nested.value)) {
945
+ chargeScan(canonicalScanWidth(direct.value) + canonicalScanWidth(nested.value));
946
+ const canonicalDirect = canonicalDecimalEvidence(measuredDirect.value);
947
+ const canonicalNested = canonicalDecimalEvidence(measuredNested.value);
948
+ if (canonicalDirect === void 0 || canonicalDirect !== canonicalNested) bits |= CLAIM_DISAGREE_V1;
949
+ }
950
+ store.values[offset + slot] = resolved?.value;
951
+ store.flags[offset + slot] = bits;
952
+ }
953
+ return {
954
+ store,
955
+ offset,
956
+ mediaBuyId: typeof reserved.mediaBuyId === "string" ? reserved.mediaBuyId : void 0
957
+ };
958
+ }
959
+ function captureRowIdentityOnly(reserved, store) {
960
+ if (!reserved) return void 0;
961
+ reserved.mediaBuyId = ownDataValue(reserved.record, "media_buy_id");
962
+ return {
963
+ store,
964
+ offset: INLINE_NO_CLAIMS_OFFSET_V1,
965
+ mediaBuyId: typeof reserved.mediaBuyId === "string" ? reserved.mediaBuyId : void 0
966
+ };
967
+ }
968
+ function claimOfValue(value) {
969
+ return value === void 0 ? UNCLAIMED_V1 : { claimed: true, value };
970
+ }
971
+ function asRowRecord(row) {
972
+ return typeof row !== "object" || row === null || Array.isArray(row) ? void 0 : row;
973
+ }
974
+ function boundedLowerCaseStatus(status) {
975
+ return typeof status === "string" && status.length <= INLINE_MAX_STATUS_CHARS_V1 ? status.toLowerCase() : void 0;
976
+ }
977
+ const UNMEASURED_CLAIM_V1 = { value: void 0, valid: false, isZero: false };
978
+ function measureClaim(value, strictClaims) {
979
+ if (!isEvidenceValue(value)) return UNMEASURED_CLAIM_V1;
980
+ return { value, valid: true, isZero: strictClaims ? isZeroEvidenceValue(value) : false };
981
+ }
982
+ function measureScanWidth(value) {
983
+ return typeof value === "string" ? value.length + 1 : 1;
984
+ }
985
+ function canonicalScanWidth(value) {
986
+ if (typeof value === "string") return value.length + 1;
987
+ if (typeof value !== "number") return 1;
988
+ return numericScanUnits(value);
989
+ }
990
+ function numericScanUnits(value) {
991
+ const printed = String(value);
992
+ const exponent = /[eE]([+-]?\d+)$/.exec(printed);
993
+ return printed.length + (exponent ? Math.abs(Number(exponent[1])) : 0) + 1;
994
+ }
995
+ function workUnitsExceedCap(count, unitsEach, cap) {
996
+ return unitsEach > 0 && count > Math.floor(cap / unitsEach);
997
+ }
998
+ function validationWorkExceedsCap(sourceSnapshots, auxiliarySnapshots, request, includeAuxiliary, cap) {
999
+ const unitsPerVisit = request.requestedMetrics.length + request.requestedDimensions.length;
1000
+ if (unitsPerVisit === 0) return false;
1001
+ const perConstituentCap = Math.floor(cap / unitsPerVisit);
1002
+ const sourceCounts = countSnapshotsByMediaBuyId(sourceSnapshots);
1003
+ const auxiliaryCounts = includeAuxiliary ? countSnapshotsByMediaBuyId(auxiliarySnapshots) : void 0;
1004
+ let work = 0;
1005
+ for (const constituent of request.coverage.constituents) {
1006
+ if (!constituent.mediaBuyId) continue;
1007
+ const visits = (sourceCounts.get(constituent.mediaBuyId) ?? 0) + (auxiliaryCounts?.get(constituent.mediaBuyId) ?? 0);
1008
+ if (visits > perConstituentCap) return true;
1009
+ work += visits * unitsPerVisit;
1010
+ if (work > cap) return true;
1011
+ }
1012
+ return false;
1013
+ }
1014
+ function countSnapshotsByMediaBuyId(snapshots) {
1015
+ const counts = /* @__PURE__ */ new Map();
1016
+ for (const snapshot of snapshots) {
1017
+ if (snapshot?.mediaBuyId === void 0) continue;
1018
+ counts.set(snapshot.mediaBuyId, (counts.get(snapshot.mediaBuyId) ?? 0) + 1);
1019
+ }
1020
+ return counts;
1021
+ }
1022
+ function groupSnapshotsByMediaBuyId(snapshots, admittedMediaBuyIds) {
1023
+ const grouped = /* @__PURE__ */ new Map();
1024
+ for (const snapshot of snapshots) {
1025
+ if (!snapshot) continue;
1026
+ const mediaBuyId = snapshot.mediaBuyId;
1027
+ if (mediaBuyId === void 0 || !admittedMediaBuyIds.has(mediaBuyId)) continue;
1028
+ const existing = grouped.get(mediaBuyId);
1029
+ if (existing) existing.push(snapshot);
1030
+ else grouped.set(mediaBuyId, [snapshot]);
1031
+ }
1032
+ return grouped;
1033
+ }
1034
+ function snapshotHasDimension(snapshot, dimension) {
1035
+ return dimension === "media_buy_id" ? snapshot.mediaBuyId !== void 0 : snapshotFieldValue(snapshot, dimension) !== void 0;
1036
+ }
1037
+ function validateSnapshotsAgainstAvailabilityEvidence(sourceSnapshotsByMediaBuyId, auxiliarySnapshotsByMediaBuyId, request, cells) {
1038
+ const cellsByConstituent = /* @__PURE__ */ new Map();
1039
+ for (const constituent of request.coverage.constituents) cellsByConstituent.set(constituent.constituentId, []);
1040
+ for (const cell of cells) cellsByConstituent.get(cell.constituent_id)?.push(cell);
1041
+ let integrity = false;
1042
+ for (const constituent of request.coverage.constituents) {
1043
+ const sourceRows = constituent.mediaBuyId ? sourceSnapshotsByMediaBuyId.get(constituent.mediaBuyId) ?? NO_SNAPSHOTS : NO_SNAPSHOTS;
1044
+ const auxiliaryRows = constituent.mediaBuyId ? auxiliarySnapshotsByMediaBuyId.get(constituent.mediaBuyId) ?? NO_SNAPSHOTS : NO_SNAPSHOTS;
1045
+ for (const cell of cellsByConstituent.get(constituent.constituentId) ?? []) {
1046
+ if (cell.status === "present" && sourceRows.length === 0) return "partial";
1047
+ for (const snapshot of sourceRows) {
1048
+ const verdict = cellVerdictForSnapshot(cell, snapshot, true);
1049
+ if (verdict === "partial") return "partial";
1050
+ if (verdict === "integrity") integrity = true;
1051
+ }
1052
+ for (const snapshot of auxiliaryRows) {
1053
+ const verdict = cellVerdictForSnapshot(cell, snapshot, false);
1054
+ if (verdict === "partial") return "partial";
1055
+ if (verdict === "integrity") integrity = true;
1056
+ }
1057
+ }
1058
+ }
1059
+ return integrity ? "integrity" : void 0;
1060
+ }
1061
+ function cellVerdictForSnapshot(cell, snapshot, isSourceRow) {
1062
+ const slot = fieldSlotOf(snapshot, cell.metric);
1063
+ const flags = slotFlags(snapshot, slot);
1064
+ if (isSourceRow) {
1065
+ if (cell.status === "present" && slotValue(snapshot, slot) === void 0) return "partial";
1066
+ if (cell.status === "explicit_zero" && (flags & CLAIM_VALUE_IS_ZERO_V1) === 0) return "integrity";
1067
+ }
1068
+ const directClaimed = (flags & CLAIM_DIRECT_CLAIMED_V1) !== 0;
1069
+ const nestedClaimed = (flags & CLAIM_NESTED_CLAIMED_V1) !== 0;
1070
+ const directValid = (flags & CLAIM_DIRECT_VALID_V1) !== 0;
1071
+ const nestedValid = (flags & CLAIM_NESTED_VALID_V1) !== 0;
1072
+ if (directClaimed && !directValid || nestedClaimed && !nestedValid) return "integrity";
1073
+ const claimValid = directClaimed ? directValid : nestedValid;
1074
+ if ((flags & CLAIM_DISAGREE_V1) !== 0) return "integrity";
1075
+ if (!claimValid) return void 0;
1076
+ if (cell.status === "explicit_zero" && (flags & CLAIM_CLAIM_IS_ZERO_V1) === 0) return "integrity";
1077
+ return INLINE_UNAVAILABLE_CELL_STATUSES_V1.includes(cell.status) ? "integrity" : void 0;
1078
+ }
1079
+ function projectInlineAvailabilityEvidence(cells, request, declaredMetrics, deliveryDates, manifestDataThrough, rowCount, constituentIdsWithRows) {
1080
+ const startMs = Date.parse(request.period.start);
1081
+ const manifestDataThroughMs = Date.parse(manifestDataThrough);
1082
+ const metricAvailability = cells.map((cell) => {
1083
+ const metric = declaredMetrics.get(cell.metric);
1084
+ if (!metric) throw new TypeError(`Offering does not declare ${cell.metric}`);
1085
+ const dataThrough = cell.data_through ? normalizeDeliveryInstant(cell.data_through, deliveryDates, request.period) : void 0;
1086
+ const dataThroughMs = dataThrough === void 0 ? void 0 : Date.parse(dataThrough);
1087
+ if (dataThroughMs !== void 0 && (!Number.isFinite(dataThroughMs) || dataThroughMs < startMs || dataThroughMs > manifestDataThroughMs || ["present", "explicit_zero"].includes(cell.status) && constituentIdsWithRows.has(cell.constituent_id) && dataThroughMs === startMs)) {
1088
+ throw new TypeError("Availability dataThrough exceeds the manifest window");
1089
+ }
1090
+ return {
1091
+ constituentId: cell.constituent_id,
1092
+ metric: cell.metric,
1093
+ semanticContractId: metric.semanticContractId,
1094
+ semanticContractVersion: metric.semanticContractVersion,
1095
+ semanticContractSha256: metric.semanticContractSha256,
1096
+ status: cell.status,
1097
+ ...dataThrough ? { dataThrough } : {},
1098
+ ...cell.reason ? { reason: cell.reason } : {}
1099
+ };
1100
+ });
1101
+ const coverageConstituents = request.coverage.constituents.map((constituent) => {
1102
+ const constituentCells = metricAvailability.filter((cell) => cell.constituentId === constituent.constituentId);
1103
+ const status = rollUpInlineConstituentStatus(constituentCells.map((cell) => cell.status));
1104
+ const dataThrough = earliestDataThrough(constituentCells);
1105
+ const reason = constituentCells.find((cell) => cell.reason)?.reason;
1106
+ if (!["present", "explicit_zero"].includes(status) && !reason) {
1107
+ throw new TypeError("Unavailable constituent roll-up requires supplied evidence");
1108
+ }
1109
+ return {
1110
+ ...constituent,
1111
+ status,
1112
+ ...dataThrough ? { dataThrough } : {},
1113
+ ...reason && !["present", "explicit_zero"].includes(status) ? { reason } : {}
1114
+ };
1115
+ });
1116
+ const allCellsExplicitZero = metricAvailability.every((cell) => cell.status === "explicit_zero");
1117
+ if (rowCount === 0 && metricAvailability.some((cell) => ["present", "explicit_zero"].includes(cell.status)) && !allCellsExplicitZero) {
1118
+ throw new TypeError("Zero-row evidence has contradictory available cells");
1119
+ }
1120
+ const fullyCovered = coverageConstituents.filter(
1121
+ (constituent) => ["present", "explicit_zero"].includes(constituent.status)
1122
+ ).length;
1123
+ const someCoverage = fullyCovered > 0 || coverageConstituents.some((constituent) => constituent.status === "partial");
1124
+ return {
1125
+ metricAvailability,
1126
+ coverageConstituents,
1127
+ coverageStatus: fullyCovered === coverageConstituents.length ? "full" : someCoverage ? "partial" : "none",
1128
+ explicitZero: rowCount === 0 && allCellsExplicitZero
1129
+ };
1130
+ }
1131
+ function projectLegacyAvailability(request, declaredMetrics, dataThrough, rowCount) {
1132
+ const explicitZero = rowCount === 0;
367
1133
  const status = explicitZero ? "explicit_zero" : "present";
368
- const coverageConstituents = request.coverage.constituents.map((constituent) => ({
369
- ...constituent,
370
- status,
371
- dataThrough
372
- }));
373
- const declaredMetrics = new Map(offering.metrics.map((metric) => [metric.name, metric]));
374
- const built = buildReportingSourceManifestV1({
375
- level: "basic",
376
- request,
377
- stagedCommitRef: `inline-manifest-${executionNamespace.slice(0, 32)}`,
378
- objects: [object],
379
- completeness: {
380
- terminal: true,
381
- rowsComplete: true,
382
- requestedGroupsComplete: true
383
- },
384
- controlTotals: [],
1134
+ return {
385
1135
  metricAvailability: request.coverage.constituents.flatMap(
386
1136
  (constituent) => request.requestedMetrics.map((metricName) => {
387
1137
  const metric = declaredMetrics.get(metricName);
@@ -397,35 +1147,34 @@ async function executeAndSeal(deliveryFetch, offering, format, request, delivery
397
1147
  };
398
1148
  })
399
1149
  ),
400
- coverage: {
401
- status: "full",
402
- constituents: coverageConstituents
403
- },
404
- observedAt,
405
- dataThrough,
406
- finalityEvidence: {
407
- owner: "adapter",
408
- basis: request.publicationClass === "PROVISIONAL_SNAPSHOT" ? "provisional_observation" : "source_declared",
409
- observedAt,
410
- ...request.publicationClass === "AUTHORITATIVE" ? { evidenceRef: "get_media_buy_delivery.is_final" } : {}
411
- },
412
- explicitZero,
413
- acquiredAt,
414
- ...explicitZero ? {} : { eventTimeRange: { start: request.period.start, end: dataThrough } },
415
- warnings: []
416
- });
417
- if (Date.parse(deadlineAt) <= Date.now()) {
418
- return failure("DEADLINE_EXCEEDED", "retryable", "Inline reporting execution deadline elapsed");
419
- }
420
- storage.objects.set(objectRef, { request: structuredClone(request), generation, bytes: Uint8Array.from(bytes) });
421
- storage.totalBytes += bytes.byteLength;
422
- storage.scopeBytes.set(scopeKey, (storage.scopeBytes.get(scopeKey) ?? 0) + bytes.byteLength);
423
- return {
424
- ok: true,
425
- response: completedReportingSourceResponseV1({ request, manifest: built.reference }),
426
- manifestBytes: built.manifestBytes
1150
+ coverageConstituents: request.coverage.constituents.map((constituent) => ({
1151
+ ...constituent,
1152
+ status,
1153
+ dataThrough
1154
+ })),
1155
+ coverageStatus: "full",
1156
+ explicitZero
427
1157
  };
428
1158
  }
1159
+ function rollUpInlineConstituentStatus(statuses) {
1160
+ if (statuses.every((status) => status === "explicit_zero")) return "explicit_zero";
1161
+ if (statuses.every((status) => status === "present" || status === "explicit_zero")) return "present";
1162
+ if (statuses.every((status) => status === "unsupported")) return "unsupported";
1163
+ if (statuses.every((status) => status === "missing")) return "missing";
1164
+ if (statuses.every((status) => ["unsupported", "delayed", "missing"].includes(status))) return "delayed";
1165
+ if (statuses.every((status) => ["unsupported", "delayed", "stale", "missing"].includes(status))) return "stale";
1166
+ return "partial";
1167
+ }
1168
+ function earliestDataThrough(cells) {
1169
+ return cells.reduce((earliest, cell) => {
1170
+ if (!cell.dataThrough) return earliest;
1171
+ if (!earliest || Date.parse(cell.dataThrough) < Date.parse(earliest)) return cell.dataThrough;
1172
+ return earliest;
1173
+ }, void 0);
1174
+ }
1175
+ function availabilityCellKey(constituentId, metric) {
1176
+ return `${constituentId}\0${metric}`;
1177
+ }
429
1178
  function encodeRows(rows, mediaType, maxBytes) {
430
1179
  if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError("Inline staging capacity exhausted");
431
1180
  const chunks = [];
@@ -531,29 +1280,50 @@ async function awaitInlineExecution(entry, signal, deadlineAt) {
531
1280
  if (releaseWaiter) entry.waiters -= 1;
532
1281
  }
533
1282
  }
534
- function rowMediaBuyId(row) {
535
- if (typeof row !== "object" || row === null) return void 0;
536
- const value = ownDataValue(row, "media_buy_id");
537
- return typeof value === "string" ? value : void 0;
1283
+ function isEvidenceValue(value) {
1284
+ return typeof value === "number" && Number.isFinite(value) || typeof value === "string" && value.length > 0 && Buffer.byteLength(value, "utf8") <= INLINE_MAX_OBJECT_BYTES_V1;
538
1285
  }
539
- function rowHasField(row, field) {
540
- return rowFieldValue(row, field) !== void 0;
1286
+ function canonicalDecimalEvidence(value) {
1287
+ let raw;
1288
+ if (typeof value === "number") {
1289
+ if (!Number.isFinite(value)) return void 0;
1290
+ raw = plainDecimalNumberEvidence(value);
1291
+ } else {
1292
+ raw = value.trim();
1293
+ }
1294
+ const parts = /^(-?)(\d+)(?:\.(\d+))?$/.exec(raw);
1295
+ if (!parts) return void 0;
1296
+ const integer = trimLeadingZeroDigits(parts[2] ?? "");
1297
+ const fraction = trimTrailingZeroDigits(parts[3] ?? "");
1298
+ const magnitude = fraction ? `${integer}.${fraction}` : integer;
1299
+ return magnitude === "0" ? "0" : `${parts[1] ?? ""}${magnitude}`;
541
1300
  }
542
- function rowFieldValue(row, field) {
543
- if (typeof row !== "object" || row === null) return void 0;
544
- const record = row;
545
- const direct = ownDataValue(record, field);
546
- if (isEvidenceValue(direct)) return direct;
547
- const totals = ownDataValue(record, "totals");
548
- if (typeof totals !== "object" || totals === null) return void 0;
549
- const nested = ownDataValue(totals, field);
550
- return isEvidenceValue(nested) ? nested : void 0;
1301
+ const ZERO_CHAR_CODE = 48;
1302
+ function trimLeadingZeroDigits(digits) {
1303
+ let start = 0;
1304
+ while (start + 1 < digits.length && digits.charCodeAt(start) === ZERO_CHAR_CODE) start += 1;
1305
+ return digits.slice(start);
551
1306
  }
552
- function isEvidenceValue(value) {
553
- return typeof value === "number" && Number.isFinite(value) || typeof value === "string" && value.length > 0 && Buffer.byteLength(value, "utf8") <= INLINE_MAX_OBJECT_BYTES_V1;
1307
+ function trimTrailingZeroDigits(digits) {
1308
+ let end = digits.length;
1309
+ while (end > 0 && digits.charCodeAt(end - 1) === ZERO_CHAR_CODE) end -= 1;
1310
+ return digits.slice(0, end);
1311
+ }
1312
+ function plainDecimalNumberEvidence(value) {
1313
+ const raw = String(value);
1314
+ const parts = /^(-?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(raw);
1315
+ if (!parts) return raw;
1316
+ const exponent = Number(parts[4]);
1317
+ if (!Number.isInteger(exponent) || Math.abs(exponent) > INLINE_MAX_DECIMAL_EXPONENT_V1) return raw;
1318
+ const sign = parts[1] ?? "";
1319
+ const digits = `${parts[2] ?? ""}${parts[3] ?? ""}`;
1320
+ const pointIndex = (parts[2] ?? "").length + exponent;
1321
+ if (pointIndex <= 0) return `${sign}0.${"0".repeat(-pointIndex)}${digits}`;
1322
+ if (pointIndex >= digits.length) return `${sign}${digits}${"0".repeat(pointIndex - digits.length)}`;
1323
+ return `${sign}${digits.slice(0, pointIndex)}.${digits.slice(pointIndex)}`;
554
1324
  }
555
- function rowHasDimension(row, dimension) {
556
- return dimension === "media_buy_id" ? rowMediaBuyId(row) !== void 0 : rowHasField(row, dimension);
1325
+ function isZeroEvidenceValue(value) {
1326
+ return typeof value === "number" ? value === 0 : /^\s*-?0+(?:\.0+)?\s*$/.test(value);
557
1327
  }
558
1328
  function isRows(value) {
559
1329
  return Array.isArray(value);
@@ -562,41 +1332,122 @@ function ownDataValue(record, field) {
562
1332
  const descriptor = Object.getOwnPropertyDescriptor(record, field);
563
1333
  return descriptor && "value" in descriptor ? descriptor.value : void 0;
564
1334
  }
565
- function rowCurrency(row) {
566
- if (typeof row !== "object" || row === null) return void 0;
567
- const value = ownDataValue(row, "currency");
1335
+ function ownDataClaim(record, field) {
1336
+ const descriptor = Object.getOwnPropertyDescriptor(record, field);
1337
+ return descriptor && "value" in descriptor && descriptor.value !== void 0 ? { claimed: true, value: descriptor.value } : { claimed: false };
1338
+ }
1339
+ function snapshotOwnDataObject(record, allowedKeys) {
1340
+ const keys = Reflect.ownKeys(record);
1341
+ if (keys.length > INLINE_MAX_EVIDENCE_OBJECT_KEYS_V1) {
1342
+ throw new TypeError("Availability evidence object declares too many keys");
1343
+ }
1344
+ for (const key of keys) {
1345
+ if (typeof key !== "string" || !allowedKeys.includes(key)) {
1346
+ throw new TypeError("Availability evidence object declares an unknown key");
1347
+ }
1348
+ }
1349
+ const snapshot = {};
1350
+ for (const key of keys) {
1351
+ const descriptor = Object.getOwnPropertyDescriptor(record, key);
1352
+ if (!descriptor || !("value" in descriptor)) throw new TypeError("Availability evidence field is not readable");
1353
+ if (typeof descriptor.value === "string" && descriptor.value.length > INLINE_MAX_EVIDENCE_FIELD_CHARS_V1) {
1354
+ throw new TypeError("Availability evidence field exceeds its bounded length");
1355
+ }
1356
+ snapshot[key] = descriptor.value;
1357
+ }
1358
+ return snapshot;
1359
+ }
1360
+ function createResponseFieldReader(record) {
1361
+ const observed = /* @__PURE__ */ new Map();
1362
+ return (field) => {
1363
+ if (observed.has(field)) return observed.get(field);
1364
+ const value = record?.[field];
1365
+ observed.set(field, value);
1366
+ return value;
1367
+ };
1368
+ }
1369
+ function asStringOrUndefined(value) {
568
1370
  return typeof value === "string" ? value : void 0;
569
1371
  }
570
- function rowIsUnavailable(row) {
571
- if (typeof row !== "object" || row === null) return false;
572
- const record = row;
573
- const status = ownDataValue(record, "status");
574
- return typeof status === "string" && ["failed", "reporting_delayed", "not_ready", "pending", "unavailable", "error"].includes(status.toLowerCase()) || ownDataValue(record, "partial_data") === true;
575
- }
576
- function projectEvidenceRow(row, request, consumeBudget) {
577
- if (typeof row !== "object" || row === null || Array.isArray(row)) throw new TypeError("Invalid row");
578
- const record = row;
579
- const projected = { media_buy_id: rowMediaBuyId(row) };
580
- for (const dimension of request.requestedDimensions) {
581
- if (dimension === "media_buy_id") continue;
582
- const value = rowFieldValue(record, dimension);
583
- if (!isEvidenceValue(value)) throw new TypeError("Invalid dimension evidence");
584
- consumeBudget(jsonEvidenceUpperBound(value));
585
- projected[dimension] = value;
1372
+ function looseCount(value) {
1373
+ return value ?? 0;
1374
+ }
1375
+ function lengthOfUnknown(value) {
1376
+ return value?.length;
1377
+ }
1378
+ function boundedCollectionLength(rows) {
1379
+ if (rows === void 0) return 0;
1380
+ const declared = rows.length;
1381
+ return typeof declared === "number" && Number.isSafeInteger(declared) && declared >= 0 ? declared : void 0;
1382
+ }
1383
+ function captureRowCollection(rows, declaredLength) {
1384
+ const captured = new Array(declaredLength);
1385
+ for (let index = 0; index < declaredLength; index += 1) captured[index] = rows[index];
1386
+ return captured;
1387
+ }
1388
+ function resolveOwnDataSlot(record, field) {
1389
+ const visited = /* @__PURE__ */ new Set();
1390
+ let current = record;
1391
+ for (let depth = 0; current !== null; depth += 1) {
1392
+ if (depth >= INLINE_MAX_PROTOTYPE_CHAIN_DEPTH_V1 || visited.has(current)) return { kind: "unreadable" };
1393
+ visited.add(current);
1394
+ let descriptor;
1395
+ let prototype = null;
1396
+ try {
1397
+ descriptor = Object.getOwnPropertyDescriptor(current, field);
1398
+ if (!descriptor) prototype = Object.getPrototypeOf(current);
1399
+ } catch {
1400
+ return { kind: "unreadable" };
1401
+ }
1402
+ if (descriptor) {
1403
+ if (!("value" in descriptor)) return { kind: "unreadable" };
1404
+ if (descriptor.value === void 0) return { kind: "absent" };
1405
+ return current === record ? { kind: "data", value: descriptor.value } : { kind: "unreadable" };
1406
+ }
1407
+ current = prototype;
1408
+ }
1409
+ return { kind: "absent" };
1410
+ }
1411
+ function projectSnapshotRow(snapshot, request, consumeBudget, options) {
1412
+ if (!snapshot) throw new TypeError("Invalid row");
1413
+ const projected = { media_buy_id: snapshot.mediaBuyId };
1414
+ if (options.includeDimensions) {
1415
+ for (const dimension of request.requestedDimensions) {
1416
+ if (dimension === "media_buy_id") continue;
1417
+ const value = snapshotFieldValue(snapshot, dimension);
1418
+ if (value === void 0) {
1419
+ if (options.allowMissingDimensions) continue;
1420
+ throw new TypeError("Invalid dimension evidence");
1421
+ }
1422
+ consumeBudget(jsonEvidenceUpperBound(value));
1423
+ projected[dimension] = value;
1424
+ }
586
1425
  }
587
- const totals = ownDataValue(record, "totals");
588
1426
  const projectedTotals = {};
589
1427
  for (const metric of request.requestedMetrics) {
590
- const direct = ownDataValue(record, metric);
591
- if (isEvidenceValue(direct)) {
592
- consumeBudget(jsonEvidenceUpperBound(direct));
593
- projected[metric] = direct;
594
- continue;
1428
+ const slot = fieldSlotOf(snapshot, metric);
1429
+ const flags = slotFlags(snapshot, slot);
1430
+ const directClaimed = (flags & CLAIM_DIRECT_CLAIMED_V1) !== 0;
1431
+ const directValid = (flags & CLAIM_DIRECT_VALID_V1) !== 0;
1432
+ const value = slotValue(snapshot, slot);
1433
+ let directValue = false;
1434
+ if (options.strictMetricClaims) {
1435
+ if (directClaimed && !directValid) throw new TypeError("Invalid metric evidence");
1436
+ if ((flags & CLAIM_NESTED_CLAIMED_V1) !== 0 && (flags & CLAIM_NESTED_VALID_V1) === 0) {
1437
+ throw new TypeError("Invalid metric evidence");
1438
+ }
1439
+ if ((flags & CLAIM_DISAGREE_V1) !== 0) throw new TypeError("Contradictory metric evidence");
1440
+ directValue = directClaimed;
1441
+ } else {
1442
+ directValue = directValid;
1443
+ }
1444
+ if (value === void 0) {
1445
+ if (options.allowMissingMetrics) continue;
1446
+ throw new TypeError("Invalid metric evidence");
595
1447
  }
596
- const total = typeof totals === "object" && totals !== null ? ownDataValue(totals, metric) : void 0;
597
- if (!isEvidenceValue(total)) throw new TypeError("Invalid metric evidence");
598
- consumeBudget(jsonEvidenceUpperBound(total));
599
- projectedTotals[metric] = total;
1448
+ consumeBudget(jsonEvidenceUpperBound(value));
1449
+ if (directValue) projected[metric] = value;
1450
+ else projectedTotals[metric] = value;
600
1451
  }
601
1452
  if (Object.keys(projectedTotals).length > 0) projected.totals = projectedTotals;
602
1453
  return projected;
@@ -607,6 +1458,154 @@ function inlineDeliveryDates(request) {
607
1458
  if (start !== request.period.sourceLocalDate) throw new RangeError("sourceLocalDate does not match period start");
608
1459
  return { start, end };
609
1460
  }
1461
+ function stagedObjectRef(executionKey) {
1462
+ return `inline-${executionKey.slice(0, 32)}`;
1463
+ }
1464
+ function stagedBytesOf(storage, executionKey) {
1465
+ return storage.objects.get(stagedObjectRef(executionKey))?.bytes.byteLength ?? 0;
1466
+ }
1467
+ function planReclaim(executions, excluded, scopeKey) {
1468
+ for (const [key, entry] of executions) {
1469
+ if (entry.pending || entry.waiters > 0 || entry.reservation !== void 0) continue;
1470
+ if (scopeKey !== void 0 && entry.scopeKey !== scopeKey) continue;
1471
+ if (excluded.includes(key)) continue;
1472
+ return key;
1473
+ }
1474
+ return void 0;
1475
+ }
1476
+ function commitReclaim(executions, storage, key) {
1477
+ const entry = executions.get(key);
1478
+ if (!entry) return;
1479
+ executions.delete(key);
1480
+ const objectRef = stagedObjectRef(key);
1481
+ const stored = storage.objects.get(objectRef);
1482
+ if (!stored) return;
1483
+ storage.objects.delete(objectRef);
1484
+ storage.totalBytes -= stored.bytes.byteLength;
1485
+ const remaining = (storage.scopeBytes.get(entry.scopeKey) ?? 0) - stored.bytes.byteLength;
1486
+ if (remaining > 0) storage.scopeBytes.set(entry.scopeKey, remaining);
1487
+ else storage.scopeBytes.delete(entry.scopeKey);
1488
+ }
1489
+ function createAdmissionReclaimer(executions, storage) {
1490
+ const planned = [];
1491
+ const token = {};
1492
+ const owns = (key) => executions.get(key)?.reservation === token;
1493
+ let settled = false;
1494
+ return {
1495
+ plan(scopeKey, scopeOnly, credit = false) {
1496
+ const victim = planReclaim(
1497
+ executions,
1498
+ planned.map((entry2) => entry2.key),
1499
+ scopeOnly ? scopeKey : void 0
1500
+ );
1501
+ if (victim === void 0) return void 0;
1502
+ const entry = executions.get(victim);
1503
+ if (entry) entry.reservation = token;
1504
+ const sameScope = entry?.scopeKey === scopeKey;
1505
+ const bytes = stagedBytesOf(storage, victim);
1506
+ planned.push({
1507
+ key: victim,
1508
+ sameScope,
1509
+ grantedGlobal: credit ? bytes : 0,
1510
+ grantedScope: credit && sameScope ? bytes : 0
1511
+ });
1512
+ return { bytes, sameScope };
1513
+ },
1514
+ plannedInScope(scopeKey) {
1515
+ return planned.filter((entry) => owns(entry.key) && executions.get(entry.key)?.scopeKey === scopeKey).length;
1516
+ },
1517
+ grantReservedBytes(scopeKey) {
1518
+ let global = 0;
1519
+ let scope = 0;
1520
+ for (const victim of planned) {
1521
+ if (!owns(victim.key)) {
1522
+ victim.grantedGlobal = 0;
1523
+ victim.grantedScope = 0;
1524
+ continue;
1525
+ }
1526
+ const bytes = stagedBytesOf(storage, victim.key);
1527
+ const sameScope = executions.get(victim.key)?.scopeKey === scopeKey;
1528
+ victim.grantedGlobal = bytes;
1529
+ victim.grantedScope = sameScope ? bytes : 0;
1530
+ global += bytes;
1531
+ if (sameScope) scope += bytes;
1532
+ }
1533
+ return { global, scope };
1534
+ },
1535
+ commit(scopeKey) {
1536
+ if (settled) return true;
1537
+ const owned = [];
1538
+ const spared = [];
1539
+ for (const victim of planned) {
1540
+ const entry = executions.get(victim.key);
1541
+ if (entry === void 0) {
1542
+ spared.push(victim);
1543
+ continue;
1544
+ }
1545
+ if (entry.reservation !== token || entry.pending || entry.waiters > 0) spared.push(victim);
1546
+ else owned.push(victim.key);
1547
+ }
1548
+ let owedCount = 0;
1549
+ let owedScopeCount = 0;
1550
+ let owedGlobalBytes = 0;
1551
+ let owedScopeBytes = 0;
1552
+ for (const victim of spared) {
1553
+ owedCount += 1;
1554
+ owedGlobalBytes += victim.grantedGlobal;
1555
+ if (victim.sameScope) {
1556
+ owedScopeCount += 1;
1557
+ owedScopeBytes += victim.grantedScope;
1558
+ }
1559
+ }
1560
+ const excluded = planned.map((victim) => victim.key);
1561
+ const replacements = [];
1562
+ const bound = executions.size;
1563
+ for (let attempt = 0; attempt < bound; attempt += 1) {
1564
+ if (owedCount <= 0 && owedScopeCount <= 0 && owedGlobalBytes <= 0 && owedScopeBytes <= 0) break;
1565
+ const needScope = owedScopeCount > 0 || owedScopeBytes > 0;
1566
+ const candidate = planReclaim(executions, [...excluded, ...replacements], needScope ? scopeKey : void 0);
1567
+ if (candidate === void 0) {
1568
+ if (needScope) break;
1569
+ break;
1570
+ }
1571
+ replacements.push(candidate);
1572
+ const bytes = stagedBytesOf(storage, candidate);
1573
+ owedCount -= 1;
1574
+ owedGlobalBytes -= bytes;
1575
+ if (executions.get(candidate)?.scopeKey === scopeKey) {
1576
+ owedScopeCount -= 1;
1577
+ owedScopeBytes -= bytes;
1578
+ }
1579
+ }
1580
+ settled = true;
1581
+ if (owedCount > 0 || owedScopeCount > 0 || owedGlobalBytes > 0 || owedScopeBytes > 0) {
1582
+ for (const key of owned) {
1583
+ const entry = executions.get(key);
1584
+ if (entry?.reservation === token) entry.reservation = void 0;
1585
+ }
1586
+ planned.length = 0;
1587
+ return false;
1588
+ }
1589
+ for (const key of owned) {
1590
+ const entry = executions.get(key);
1591
+ if (entry?.reservation === token) entry.reservation = void 0;
1592
+ commitReclaim(executions, storage, key);
1593
+ }
1594
+ for (const key of replacements) commitReclaim(executions, storage, key);
1595
+ planned.length = 0;
1596
+ return true;
1597
+ },
1598
+ release() {
1599
+ if (settled) return;
1600
+ settled = true;
1601
+ for (const victim of planned) {
1602
+ const entry = executions.get(victim.key);
1603
+ if (entry?.reservation === token) entry.reservation = void 0;
1604
+ }
1605
+ planned.length = 0;
1606
+ }
1607
+ };
1608
+ }
610
1609
  function sourceLocalMidnightDate(instant, timeZone) {
611
1610
  const date = new Date(instant);
612
1611
  const parts = Object.fromEntries(
@@ -627,12 +1626,13 @@ function sourceLocalMidnightDate(instant, timeZone) {
627
1626
  return `${parts.year}-${parts.month}-${parts.day}`;
628
1627
  }
629
1628
  function deliveryPeriodBoundaryMatches(actual, wireDate, instant) {
1629
+ if (typeof actual !== "string") return false;
630
1630
  return actual === wireDate || Date.parse(actual) === Date.parse(instant);
631
1631
  }
632
1632
  function normalizeDeliveryInstant(value, deliveryDates, period) {
633
1633
  if (value === deliveryDates.start) return period.start;
634
1634
  if (value === deliveryDates.end) return period.end;
635
- return value;
1635
+ return typeof value === "string" ? value : String(value);
636
1636
  }
637
1637
  function scheduleDeadline(deadlineAt, expire) {
638
1638
  let timer;
@@ -656,7 +1656,10 @@ function jsonEvidenceUpperBound(value) {
656
1656
  return typeof value === "number" ? 32 : Math.min(Number.MAX_SAFE_INTEGER, Buffer.byteLength(value, "utf8") * 6 + 2);
657
1657
  }
658
1658
  export {
1659
+ INLINE_REPORTING_AVAILABILITY_EVIDENCE_VERSION_V1,
659
1660
  InlineReportingSourceError,
660
1661
  ReportingSourceNotReadyError,
661
- createInlineReportingSourceExecutor
1662
+ createInlineReportingSourceExecutor,
1663
+ createInlineReportingSourceExecutorForTestsV1,
1664
+ inlineStagingCapacitiesForTestsV1
662
1665
  };