@adcp/sdk 14.0.0-beta.26 → 14.0.0-beta.28

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 (66) hide show
  1. package/dist/lib/core/AgentClient.d.mts +5 -1
  2. package/dist/lib/core/AgentClient.d.ts +5 -1
  3. package/dist/lib/core/SingleAgentClient.js +2 -0
  4. package/dist/lib/core/SingleAgentClient.mjs +2 -0
  5. package/dist/lib/index.d.mts +1 -0
  6. package/dist/lib/index.d.ts +1 -0
  7. package/dist/lib/index.js +2 -0
  8. package/dist/lib/index.mjs +1 -0
  9. package/dist/lib/reporting/evidence.d.mts +4 -0
  10. package/dist/lib/reporting/evidence.d.ts +4 -0
  11. package/dist/lib/reporting/evidence.js +136 -0
  12. package/dist/lib/reporting/evidence.mjs +109 -0
  13. package/dist/lib/reporting/index.d.mts +4 -0
  14. package/dist/lib/reporting/index.d.ts +4 -0
  15. package/dist/lib/reporting/index.js +45 -0
  16. package/dist/lib/reporting/index.mjs +24 -0
  17. package/dist/lib/reporting/inspection.d.mts +88 -0
  18. package/dist/lib/reporting/inspection.d.ts +88 -0
  19. package/dist/lib/reporting/inspection.js +1125 -0
  20. package/dist/lib/reporting/inspection.mjs +1094 -0
  21. package/dist/lib/reporting/reconciliation.d.mts +199 -0
  22. package/dist/lib/reporting/reconciliation.d.ts +199 -0
  23. package/dist/lib/reporting/reconciliation.js +870 -0
  24. package/dist/lib/reporting/reconciliation.mjs +844 -0
  25. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  26. package/dist/lib/server/decisioning/runtime/protocol-for-tool.js +1 -0
  27. package/dist/lib/server/decisioning/runtime/protocol-for-tool.mjs +1 -0
  28. package/dist/lib/server/wire-spec-fields.generated.d.mts +11 -1
  29. package/dist/lib/server/wire-spec-fields.generated.d.ts +11 -1
  30. package/dist/lib/server/wire-spec-fields.generated.js +10 -0
  31. package/dist/lib/server/wire-spec-fields.generated.mjs +10 -0
  32. package/dist/lib/testing/storyboard/runner.js +13 -2
  33. package/dist/lib/testing/storyboard/runner.mjs +13 -2
  34. package/dist/lib/testing/storyboard/types.d.mts +8 -0
  35. package/dist/lib/testing/storyboard/types.d.ts +8 -0
  36. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  37. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  38. package/dist/lib/types/create-media-buy.d.ts +21 -16
  39. package/dist/lib/types/get-media-buys.d.ts +21 -16
  40. package/dist/lib/types/index.d.mts +1 -0
  41. package/dist/lib/types/index.d.ts +1 -0
  42. package/dist/lib/types/list-accounts.d.ts +21 -16
  43. package/dist/lib/types/list-creatives.d.ts +21 -16
  44. package/dist/lib/types/schemas.generated.d.ts +688 -952
  45. package/dist/lib/types/schemas.generated.js +542 -515
  46. package/dist/lib/types/schemas.generated.mjs +542 -515
  47. package/dist/lib/types/sync-accounts.d.ts +21 -16
  48. package/dist/lib/types/sync-creatives.d.ts +21 -16
  49. package/dist/lib/types/tools.generated.d.mts +2 -6
  50. package/dist/lib/types/tools.generated.d.ts +2 -6
  51. package/dist/lib/utils/reporting-status-response.d.mts +2 -0
  52. package/dist/lib/utils/reporting-status-response.d.ts +2 -0
  53. package/dist/lib/utils/reporting-status-response.js +338 -0
  54. package/dist/lib/utils/reporting-status-response.mjs +319 -0
  55. package/dist/lib/utils/response-schemas.js +6 -1
  56. package/dist/lib/utils/response-schemas.mjs +6 -1
  57. package/dist/lib/validation/sync-creatives.d.mts +42 -108
  58. package/dist/lib/validation/sync-creatives.d.ts +42 -108
  59. package/dist/lib/version.d.mts +3 -3
  60. package/dist/lib/version.d.ts +3 -3
  61. package/dist/lib/version.js +3 -3
  62. package/dist/lib/version.mjs +3 -3
  63. package/docs/TYPE-SUMMARY.md +2 -2
  64. package/docs/guides/REPORTING-RECONCILIATION.md +107 -0
  65. package/docs/llms.txt +2 -2
  66. package/package.json +1 -1
@@ -0,0 +1,319 @@
1
+ import { z } from "zod";
2
+ import {
3
+ isReportingCanonicalDigest,
4
+ isReportingControlTotals,
5
+ isReportingReceiptEvidence,
6
+ isReportingVerificationEvidence
7
+ } from "../reporting/evidence.mjs";
8
+ import { isReportingCoverageEvidence } from "../reporting/reconciliation.mjs";
9
+ const SHA256_HEX = /^[A-Fa-f0-9]{64}$/;
10
+ function isRecord(value) {
11
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
12
+ }
13
+ function hasFields(value, fields) {
14
+ return fields.every((field) => value[field] !== void 0);
15
+ }
16
+ function isNonEmptyString(value) {
17
+ return typeof value === "string" && value.length > 0;
18
+ }
19
+ function isOffsetDateTime(value) {
20
+ return typeof value === "string" && value.includes("T") && /(?:Z|[+-]\d{2}:\d{2})$/.test(value) && Number.isFinite(Date.parse(value));
21
+ }
22
+ function nonnegativeInteger(value) {
23
+ return Number.isInteger(value) && Number(value) >= 0;
24
+ }
25
+ function stringArray(value) {
26
+ return Array.isArray(value) && value.every(isNonEmptyString);
27
+ }
28
+ function isReportingStatusIssue(value) {
29
+ if (!isRecord(value) || !hasFields(value, ["code", "severity", "responsible_party", "recommended_action"])) {
30
+ return false;
31
+ }
32
+ return [
33
+ "REPORT_OVERDUE",
34
+ "PRODUCTION_FAILED",
35
+ "DELIVERY_FAILED",
36
+ "ACCESS_REQUIRED",
37
+ "CONFIGURATION_REQUIRED",
38
+ "REPORTING_COVERAGE_INCOMPLETE",
39
+ "RESOURCE_EXPIRED",
40
+ "READER_INCOMPATIBLE",
41
+ "HISTORY_UNAVAILABLE"
42
+ ].includes(String(value.code)) && ["delayed", "action_required"].includes(String(value.severity)) && ["buyer", "seller", "provider"].includes(String(value.responsible_party)) && [
43
+ "wait_for_retry",
44
+ "contact_buyer",
45
+ "contact_seller",
46
+ "contact_provider",
47
+ "repair_access",
48
+ "update_configuration",
49
+ "change_reporting_scope",
50
+ "use_supported_reader"
51
+ ].includes(String(value.recommended_action));
52
+ }
53
+ function isReportingSchedule(value) {
54
+ if (!isRecord(value)) return false;
55
+ const required = ["period_duration", "alignment", "delivery_sla"];
56
+ const optional = ["period_anchor", "period_timezone"];
57
+ if (!hasFields(value, required) || !Object.keys(value).every((key) => [...required, ...optional].includes(key)))
58
+ return false;
59
+ const periodDuration = /^P(?=.*[1-9])(?=\d|T)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/;
60
+ const deliverySla = /^P(?=\d|T)(?=.*\d)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/;
61
+ if (typeof value.period_duration !== "string" || !periodDuration.test(value.period_duration) || !["utc", "account_timezone", "billing_cycle"].includes(String(value.alignment)) || typeof value.delivery_sla !== "string" || !deliverySla.test(value.delivery_sla))
62
+ return false;
63
+ return value.alignment === "billing_cycle" ? isOffsetDateTime(value.period_anchor) && isNonEmptyString(value.period_timezone) && value.period_timezone.length <= 255 : value.period_anchor === void 0 && value.period_timezone === void 0;
64
+ }
65
+ function isReportingResource(value) {
66
+ if (!isRecord(value)) return false;
67
+ const required = ["resource_ref", "kind", "location", "immutability", "expires_at"];
68
+ const optional = ["native_version_ref", "manifest_version", "manifest_sha256", "reader_compatibility"];
69
+ if (!hasFields(value, required) || !Object.keys(value).every((key) => [...required, ...optional].includes(key)))
70
+ return false;
71
+ if (!isNonEmptyString(value.resource_ref) || value.resource_ref.length > 255 || !["manifest", "dataset", "warehouse_relation"].includes(String(value.kind)) || !isNonEmptyString(value.location) || value.location.length > 2048 || !["immutable_location", "native_version"].includes(String(value.immutability)) || !isOffsetDateTime(value.expires_at) || value.reader_compatibility !== void 0 && (!Array.isArray(value.reader_compatibility) || !value.reader_compatibility.every(isNonEmptyString) || new Set(value.reader_compatibility).size !== value.reader_compatibility.length))
72
+ return false;
73
+ if (value.kind === "manifest" && (value.manifest_version !== "1.0" || typeof value.manifest_sha256 !== "string" || !SHA256_HEX.test(value.manifest_sha256)))
74
+ return false;
75
+ return value.immutability !== "native_version" || isNonEmptyString(value.native_version_ref);
76
+ }
77
+ function isReportingMaterialization(value) {
78
+ const allowed = /* @__PURE__ */ new Set([
79
+ "reporting_materialization_id",
80
+ "reporting_revision_id",
81
+ "reporting_obligation_id",
82
+ "delivery_config_id",
83
+ "delivery_config_version",
84
+ "destination_ref",
85
+ "feed_purpose",
86
+ "method",
87
+ "transport",
88
+ "attempt",
89
+ "status",
90
+ "ready_at",
91
+ "failed_at",
92
+ "failure_code",
93
+ "resource",
94
+ "verification",
95
+ "created_at"
96
+ ]);
97
+ if (!isRecord(value) || Object.keys(value).some((key) => !allowed.has(key)) || !hasFields(value, [
98
+ "reporting_materialization_id",
99
+ "reporting_revision_id",
100
+ "reporting_obligation_id",
101
+ "delivery_config_id",
102
+ "delivery_config_version",
103
+ "destination_ref",
104
+ "feed_purpose",
105
+ "method",
106
+ "attempt",
107
+ "status",
108
+ "created_at"
109
+ ])) {
110
+ return false;
111
+ }
112
+ if (!isNonEmptyString(value.reporting_materialization_id) || !isNonEmptyString(value.reporting_revision_id) || !isNonEmptyString(value.reporting_obligation_id) || !isNonEmptyString(value.delivery_config_id) || !Number.isSafeInteger(value.delivery_config_version) || Number(value.delivery_config_version) < 1 || !isNonEmptyString(value.destination_ref) || !["pacing", "analytics", "billing"].includes(String(value.feed_purpose)) || !["file_transfer", "dataset_share", "warehouse_materialization"].includes(String(value.method)) || value.transport !== void 0 && (typeof value.transport !== "string" || !/^[a-z][a-z0-9_.-]{0,63}$/.test(value.transport)) || !Number.isSafeInteger(value.attempt) || Number(value.attempt) < 1 || !isOffsetDateTime(value.created_at))
113
+ return false;
114
+ if (value.resource !== void 0 && !isReportingResource(value.resource) || value.verification !== void 0 && !isReportingVerificationEvidence(value.verification) || value.ready_at !== void 0 && !isOffsetDateTime(value.ready_at) || value.failed_at !== void 0 && !isOffsetDateTime(value.failed_at))
115
+ return false;
116
+ if (!["pending", "available", "delivered", "failed"].includes(String(value.status))) return false;
117
+ if (value.status === "failed") return isOffsetDateTime(value.failed_at) && isNonEmptyString(value.failure_code);
118
+ if (value.status === "pending") return true;
119
+ if (!isOffsetDateTime(value.ready_at) || !isReportingResource(value.resource) || !isRecord(value.verification) || !isReportingVerificationEvidence(value.verification))
120
+ return false;
121
+ const resource = value.resource;
122
+ const verification = value.verification;
123
+ if (resource.immutability === "native_version" && !isNonEmptyString(resource.native_version_ref)) return false;
124
+ if (value.method === "file_transfer") {
125
+ return resource.kind === "manifest" && resource.manifest_version === "1.0" && typeof resource.manifest_sha256 === "string" && SHA256_HEX.test(resource.manifest_sha256) && Array.isArray(verification.physical_checksums) && verification.physical_checksums.length > 0;
126
+ }
127
+ if (value.method === "dataset_share") {
128
+ return resource.kind === "dataset" && verification.verification_path === "representative_consumer";
129
+ }
130
+ if (value.method === "warehouse_materialization") {
131
+ return resource.kind === "warehouse_relation" && verification.verification_path === "destination";
132
+ }
133
+ return false;
134
+ }
135
+ function isReportingReceipt(value) {
136
+ return isReportingReceiptEvidence(value);
137
+ }
138
+ function isReportingPeriod(value) {
139
+ return isRecord(value) && Object.keys(value).every((key) => ["start", "end", "source_timezone"].includes(key)) && isOffsetDateTime(value.start) && isOffsetDateTime(value.end) && isNonEmptyString(value.source_timezone);
140
+ }
141
+ function isReportingObligation(value) {
142
+ const fields = [
143
+ "reporting_obligation_id",
144
+ "delivery_config_id",
145
+ "delivery_config_version",
146
+ "report_definition_id",
147
+ "feed_purpose",
148
+ "reporting_profile",
149
+ "account_id",
150
+ "scope_resolved_at",
151
+ "media_buy_ids",
152
+ "coverage",
153
+ "period",
154
+ "expected_at",
155
+ "schedule",
156
+ "destination_ref",
157
+ "required_finality",
158
+ "reconciliation_mode",
159
+ "reconciliation_status",
160
+ "health",
161
+ "production_status",
162
+ "revision_count",
163
+ "materialization_count",
164
+ "successful_materialization_count",
165
+ "receipt_count",
166
+ "accepted_receipt_count",
167
+ "issues"
168
+ ];
169
+ if (!isRecord(value) || !hasFields(value, fields)) return false;
170
+ return isNonEmptyString(value.reporting_obligation_id) && isNonEmptyString(value.delivery_config_id) && Number.isInteger(value.delivery_config_version) && Number(value.delivery_config_version) >= 1 && isNonEmptyString(value.report_definition_id) && ["pacing", "analytics", "billing"].includes(String(value.feed_purpose)) && isNonEmptyString(value.reporting_profile) && isNonEmptyString(value.account_id) && isOffsetDateTime(value.scope_resolved_at) && stringArray(value.media_buy_ids) && isReportingCoverageEvidence(value.coverage) && isReportingPeriod(value.period) && isOffsetDateTime(value.expected_at) && isReportingSchedule(value.schedule) && isNonEmptyString(value.destination_ref) && ["snapshot", "official"].includes(String(value.required_finality)) && ["delivery_only", "consumer_receipt"].includes(String(value.reconciliation_mode)) && ["not_required", "pending", "accepted", "rejected"].includes(String(value.reconciliation_status)) && ["waiting", "healthy", "delayed", "action_required", "complete"].includes(String(value.health)) && ["not_due", "pending", "published", "failed"].includes(String(value.production_status)) && [
171
+ "revision_count",
172
+ "materialization_count",
173
+ "successful_materialization_count",
174
+ "receipt_count",
175
+ "accepted_receipt_count"
176
+ ].every((field) => nonnegativeInteger(value[field])) && Array.isArray(value.issues) && value.issues.every(isReportingStatusIssue);
177
+ }
178
+ function isCanonicalDigest(value) {
179
+ return isReportingCanonicalDigest(value);
180
+ }
181
+ function isReportingRevision(value) {
182
+ const fields = [
183
+ "reporting_revision_id",
184
+ "report_definition_id",
185
+ "report_definition_uri",
186
+ "report_definition_sha256",
187
+ "reporting_profile",
188
+ "schema_version",
189
+ "schema_uri",
190
+ "schema_sha256",
191
+ "schema_dialect",
192
+ "schema_ref_policy",
193
+ "account_id",
194
+ "media_buy_ids",
195
+ "coverage",
196
+ "period",
197
+ "finality",
198
+ "observed_at",
199
+ "data_through",
200
+ "data_through_precision",
201
+ "row_count",
202
+ "control_totals",
203
+ "created_at"
204
+ ];
205
+ if (!isRecord(value) || !hasFields(value, fields)) return false;
206
+ const officialFields = ["finality_basis", "finality_policy_id", "finalized_at"];
207
+ const official = value.finality === "official";
208
+ if (official !== officialFields.every((field) => value[field] !== void 0)) return false;
209
+ if (!official && officialFields.some((field) => value[field] !== void 0)) return false;
210
+ if (official && (!["source_final", "contractual_cutoff", "stabilized"].includes(String(value.finality_basis)) || !isNonEmptyString(value.finality_policy_id) || !isOffsetDateTime(value.finalized_at))) {
211
+ return false;
212
+ }
213
+ const precision = String(value.data_through_precision);
214
+ if (!["exact", "lower_bound", "unknown"].includes(precision) || (precision === "unknown" ? value.data_through !== null : !isOffsetDateTime(value.data_through))) {
215
+ return false;
216
+ }
217
+ return isNonEmptyString(value.reporting_revision_id) && isNonEmptyString(value.report_definition_id) && isNonEmptyString(value.report_definition_uri) && typeof value.report_definition_sha256 === "string" && SHA256_HEX.test(value.report_definition_sha256) && isNonEmptyString(value.reporting_profile) && isNonEmptyString(value.schema_version) && isNonEmptyString(value.schema_uri) && typeof value.schema_sha256 === "string" && SHA256_HEX.test(value.schema_sha256) && value.schema_dialect === "https://json-schema.org/draft/2020-12/schema" && value.schema_ref_policy === "local_fragment_only" && isNonEmptyString(value.account_id) && stringArray(value.media_buy_ids) && isReportingCoverageEvidence(value.coverage) && isReportingPeriod(value.period) && ["snapshot", "official"].includes(String(value.finality)) && isOffsetDateTime(value.observed_at) && nonnegativeInteger(value.row_count) && isReportingControlTotals(value.control_totals) && isOffsetDateTime(value.created_at) && (value.canonical_content_digest === void 0 || isCanonicalDigest(value.canonical_content_digest));
218
+ }
219
+ const scopeKeys = [
220
+ "period_start",
221
+ "period_end",
222
+ "scope_closed",
223
+ "media_buy_ids",
224
+ "all_accessible_media_buys",
225
+ "delivery_config_generations",
226
+ "feed_purposes",
227
+ "finality",
228
+ "ledger_retained_from",
229
+ "coverage_complete"
230
+ ];
231
+ function isReportingScope(value) {
232
+ if (!isRecord(value) || !Object.keys(value).every((key) => scopeKeys.includes(key)) || !hasFields(
233
+ value,
234
+ scopeKeys.filter((key) => key !== "media_buy_ids")
235
+ )) {
236
+ return false;
237
+ }
238
+ const generations = value.delivery_config_generations;
239
+ return isOffsetDateTime(value.period_start) && isOffsetDateTime(value.period_end) && typeof value.scope_closed === "boolean" && typeof value.all_accessible_media_buys === "boolean" && (value.all_accessible_media_buys || stringArray(value.media_buy_ids)) && Array.isArray(generations) && generations.every(
240
+ (generation) => isRecord(generation) && Object.keys(generation).every(
241
+ (key) => ["delivery_config_id", "delivery_config_version", "feed_purpose"].includes(key)
242
+ ) && isNonEmptyString(generation.delivery_config_id) && Number.isInteger(generation.delivery_config_version) && Number(generation.delivery_config_version) >= 1 && ["pacing", "analytics", "billing"].includes(String(generation.feed_purpose))
243
+ ) && Array.isArray(value.feed_purposes) && value.feed_purposes.every((item) => ["pacing", "analytics", "billing"].includes(String(item))) && Array.isArray(value.finality) && value.finality.every((item) => ["snapshot", "official"].includes(String(item))) && isOffsetDateTime(value.ledger_retained_from) && typeof value.coverage_complete === "boolean";
244
+ }
245
+ function isPagination(value) {
246
+ return isRecord(value) && typeof value.has_more === "boolean" && nonnegativeInteger(value.total_count);
247
+ }
248
+ function lacksFields(value, fields) {
249
+ return fields.every((field) => value[field] === void 0);
250
+ }
251
+ function hasCompletedCommon(value) {
252
+ return value.status === "completed" && isNonEmptyString(value.ledger_snapshot_id) && isOffsetDateTime(value.ledger_as_of) && isNonEmptyString(value.account_id);
253
+ }
254
+ function isSummaryResponse(value) {
255
+ if (!isRecord(value.obligation_counts)) return false;
256
+ const obligationCounts = value.obligation_counts;
257
+ if (!hasCompletedCommon(value) || value.view !== "summary" || !isReportingScope(value.scope) || !isReportingCoverageEvidence(value.coverage) || !(value.data_through === null || isOffsetDateTime(value.data_through)) || !lacksFields(value, ["periods", "revisions", "pagination", "revision", "materializations", "receipts"]) || !["healthy", "waiting", "delayed", "action_required", "complete"].includes(String(value.health)) || !Array.isArray(value.issues) || !value.issues.every(isReportingStatusIssue) || !["total", "waiting", "healthy", "delayed", "action_required", "complete"].every(
258
+ (field) => nonnegativeInteger(obligationCounts[field])
259
+ )) {
260
+ return false;
261
+ }
262
+ const health = String(value.health);
263
+ if (health === "complete" && (!value.scope.scope_closed || !value.scope.coverage_complete || value.next_expected_at !== void 0)) {
264
+ return false;
265
+ }
266
+ if (["healthy", "waiting", "complete"].includes(health) && value.issues.length !== 0) return false;
267
+ if (health === "action_required" && !value.issues.some((issue) => isRecord(issue) && issue.severity === "action_required")) {
268
+ return false;
269
+ }
270
+ if (health === "delayed" && (value.issues.length === 0 || value.issues.some((issue) => !isRecord(issue) || issue.severity !== "delayed"))) {
271
+ return false;
272
+ }
273
+ if (!value.scope.coverage_complete && (health !== "action_required" || !value.issues.some(
274
+ (issue) => isRecord(issue) && issue.code === "HISTORY_UNAVAILABLE" && issue.severity === "action_required"
275
+ ))) {
276
+ return false;
277
+ }
278
+ return true;
279
+ }
280
+ function isGetReportingStatusResponse(value) {
281
+ if (!isRecord(value)) return false;
282
+ if (value.status === "failed") {
283
+ const allowed = /* @__PURE__ */ new Set([
284
+ "adcp_version",
285
+ "adcp_major_version",
286
+ "status",
287
+ "view",
288
+ "failure_kind",
289
+ "context_id",
290
+ "context",
291
+ "message",
292
+ "timestamp",
293
+ "replayed",
294
+ "adcp_error",
295
+ "errors"
296
+ ]);
297
+ if (Object.keys(value).some((key) => !allowed.has(key)) || !["summary", "periods", "revision"].includes(String(value.view)) || !["lookup_unavailable", "operational"].includes(String(value.failure_kind)) || !Array.isArray(value.errors) || value.errors.length === 0 || !value.errors.every((error) => isRecord(error) && isNonEmptyString(error.code) && isNonEmptyString(error.message)))
298
+ return false;
299
+ if (value.failure_kind === "lookup_unavailable") {
300
+ return value.errors.length === 1 && Object.keys(value.errors[0]).every((key) => ["code", "message"].includes(key)) && value.errors[0].code === "NOT_FOUND" && value.errors[0].message === "Reporting status resource is unavailable." && (value.message === void 0 || value.message === "Reporting status resource is unavailable.") && (value.adcp_error === void 0 || isRecord(value.adcp_error) && Object.keys(value.adcp_error).every((key) => ["code", "message"].includes(key)) && value.adcp_error.code === "NOT_FOUND" && value.adcp_error.message === "Reporting status resource is unavailable.");
301
+ }
302
+ return true;
303
+ }
304
+ if (value.status !== "completed") return false;
305
+ if (value.view === "summary") return isSummaryResponse(value);
306
+ if (value.view === "periods") {
307
+ return hasCompletedCommon(value) && isReportingScope(value.scope) && Array.isArray(value.periods) && value.periods.every(isReportingObligation) && Array.isArray(value.revisions) && value.revisions.every(isReportingRevision) && Array.isArray(value.materializations) && value.materializations.every(isReportingMaterialization) && Array.isArray(value.receipts) && value.receipts.every(isReportingReceipt) && isPagination(value.pagination) && lacksFields(value, ["revision"]);
308
+ }
309
+ if (value.view === "revision") {
310
+ return hasCompletedCommon(value) && isReportingRevision(value.revision) && Array.isArray(value.materializations) && value.materializations.every(isReportingMaterialization) && Array.isArray(value.receipts) && value.receipts.every(isReportingReceipt) && isPagination(value.pagination) && lacksFields(value, ["scope", "health", "periods", "revisions"]);
311
+ }
312
+ return false;
313
+ }
314
+ const GetReportingStatusResponseCurrentSchema = z.custom(isGetReportingStatusResponse, {
315
+ message: "get_reporting_status response does not satisfy the current reporting protocol"
316
+ });
317
+ export {
318
+ GetReportingStatusResponseCurrentSchema
319
+ };
@@ -36,6 +36,7 @@ var import_zod = require("zod");
36
36
  var schemas = __toESM(require('../types/schemas.generated.js'));
37
37
  var import_sync_creatives = require('../validation/sync-creatives.js');
38
38
  var import_adcp_version_config = require('./adcp-version-config.js');
39
+ var import_reporting_status_response = require('./reporting-status-response.js');
39
40
  var import_version = require('../version.js');
40
41
  function declaresLegacy30xPayload(response) {
41
42
  const adcpVersion = response.adcp_version;
@@ -81,7 +82,11 @@ const TOOL_RESPONSE_SCHEMAS = {
81
82
  update_media_buy: schemas.UpdateMediaBuyResponseSchema,
82
83
  get_media_buys: schemas.GetMediaBuysResponseSchema,
83
84
  get_media_buy_delivery: schemas.GetMediaBuyDeliveryResponseSchema,
84
- get_reporting_status: schemas.GetReportingStatusResponseSchema,
85
+ // The generated Zod schema does not retain every composed `allOf`
86
+ // requirement or nested `additionalProperties: false` boundary from the
87
+ // signed protocol schema. Preserve the stricter billing-evidence validator
88
+ // until code generation represents those constraints directly.
89
+ get_reporting_status: import_reporting_status_response.GetReportingStatusResponseCurrentSchema,
85
90
  sync_reporting_receipts: schemas.SyncReportingReceiptsResponseSchema,
86
91
  provide_performance_feedback: schemas.ProvidePerformanceFeedbackResponseSchema,
87
92
  // Creative
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import * as schemas from "../types/schemas.generated.mjs";
3
3
  import { SyncCreativesResponseStrictSchema } from "../validation/sync-creatives.mjs";
4
4
  import { isPre31AdcpVersion } from "./adcp-version-config.mjs";
5
+ import { GetReportingStatusResponseCurrentSchema } from "./reporting-status-response.mjs";
5
6
  import { toReleasePrecisionVersion } from "../version.mjs";
6
7
  function declaresLegacy30xPayload(response) {
7
8
  const adcpVersion = response.adcp_version;
@@ -47,7 +48,11 @@ const TOOL_RESPONSE_SCHEMAS = {
47
48
  update_media_buy: schemas.UpdateMediaBuyResponseSchema,
48
49
  get_media_buys: schemas.GetMediaBuysResponseSchema,
49
50
  get_media_buy_delivery: schemas.GetMediaBuyDeliveryResponseSchema,
50
- get_reporting_status: schemas.GetReportingStatusResponseSchema,
51
+ // The generated Zod schema does not retain every composed `allOf`
52
+ // requirement or nested `additionalProperties: false` boundary from the
53
+ // signed protocol schema. Preserve the stricter billing-evidence validator
54
+ // until code generation represents those constraints directly.
55
+ get_reporting_status: GetReportingStatusResponseCurrentSchema,
51
56
  sync_reporting_receipts: schemas.SyncReportingReceiptsResponseSchema,
52
57
  provide_performance_feedback: schemas.ProvidePerformanceFeedbackResponseSchema,
53
58
  // Creative
@@ -166,42 +166,20 @@ export declare const SyncCreativesItemSchema: z.ZodObject<{
166
166
  }, z.core.$loose>;
167
167
  method: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
168
168
  pattern: z.ZodLiteral<"file_transfer">;
169
- transport: z.ZodUnion<readonly [z.ZodLiteral<"s3">, z.ZodLiteral<"gcs">, z.ZodLiteral<"azure_blob">]>;
170
- directions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"buyer_to_seller">, z.ZodLiteral<"seller_to_buyer">]>>>;
171
- vendor: z.ZodObject<{
172
- domain: z.ZodString;
173
- brand_id: z.ZodOptional<z.ZodString>;
174
- countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
175
- industries: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
- data_subject_contestation: z.ZodOptional<z.ZodObject<{
177
- url: z.ZodOptional<z.ZodString>;
178
- email: z.ZodOptional<z.ZodEmail>;
179
- languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
- }, z.core.$loose>>;
181
- brand_kit_override: z.ZodOptional<z.ZodObject<{
182
- logo: z.ZodOptional<Omit<z.ZodObject<{
183
- asset_type: z.ZodType<"image", "image", z.core.$ZodTypeInternals<"image", "image">>;
184
- url: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
185
- width: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
186
- height: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
187
- file_size_bytes: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
188
- pixel_ratio: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
189
- state_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
190
- breakpoint_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
191
- focal_point: z.ZodOptional<z.ZodType<[number, number], [number, number], z.core.$ZodTypeInternals<[number, number], [number, number]>>>;
192
- format: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
193
- alt_text: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
194
- provenance: z.ZodOptional<z.ZodType<import("../index.mjs").Provenance, import("../index.mjs").Provenance, z.core.$ZodTypeInternals<import("../index.mjs").Provenance, import("../index.mjs").Provenance>>>;
195
- }, z.core.$loose>, keyof z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>> & z.ZodType<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset, z.core.$ZodTypeInternals<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset>>>;
196
- colors: z.ZodOptional<z.ZodObject<{
197
- primary: z.ZodOptional<z.ZodString>;
198
- secondary: z.ZodOptional<z.ZodString>;
199
- accent: z.ZodOptional<z.ZodString>;
200
- }, z.core.$loose>>;
201
- voice: z.ZodOptional<z.ZodString>;
202
- tagline: z.ZodOptional<z.ZodString>;
203
- }, z.core.$loose>>;
204
- }, z.core.$loose>;
169
+ transport: z.ZodString;
170
+ orchestration: z.ZodUnion<readonly [z.ZodLiteral<"producer_managed">, z.ZodLiteral<"consumer_managed">]>;
171
+ destination: z.ZodUnion<readonly [z.ZodObject<{
172
+ mode: z.ZodLiteral<"existing">;
173
+ destination_ref: z.ZodString;
174
+ }, z.core.$loose>, z.ZodObject<{
175
+ mode: z.ZodLiteral<"provision">;
176
+ provider: z.ZodObject<{
177
+ domain: z.ZodString;
178
+ }, z.core.$loose>;
179
+ location: z.ZodString;
180
+ access_mode: z.ZodOptional<z.ZodString>;
181
+ }, z.core.$loose>]>;
182
+ format: z.ZodUnion<readonly [z.ZodLiteral<"jsonl">, z.ZodLiteral<"csv">, z.ZodLiteral<"parquet">, z.ZodLiteral<"avro">, z.ZodLiteral<"orc">]>;
205
183
  }, z.core.$loose>, z.ZodObject<{
206
184
  pattern: z.ZodLiteral<"dataset_share">;
207
185
  transport: z.ZodString;
@@ -538,42 +516,20 @@ export declare const SyncCreativesSuccessStrictSchema: z.ZodObject<{
538
516
  }, z.core.$loose>;
539
517
  method: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
540
518
  pattern: z.ZodLiteral<"file_transfer">;
541
- transport: z.ZodUnion<readonly [z.ZodLiteral<"s3">, z.ZodLiteral<"gcs">, z.ZodLiteral<"azure_blob">]>;
542
- directions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"buyer_to_seller">, z.ZodLiteral<"seller_to_buyer">]>>>;
543
- vendor: z.ZodObject<{
544
- domain: z.ZodString;
545
- brand_id: z.ZodOptional<z.ZodString>;
546
- countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
547
- industries: z.ZodOptional<z.ZodArray<z.ZodString>>;
548
- data_subject_contestation: z.ZodOptional<z.ZodObject<{
549
- url: z.ZodOptional<z.ZodString>;
550
- email: z.ZodOptional<z.ZodEmail>;
551
- languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
552
- }, z.core.$loose>>;
553
- brand_kit_override: z.ZodOptional<z.ZodObject<{
554
- logo: z.ZodOptional<Omit<z.ZodObject<{
555
- asset_type: z.ZodType<"image", "image", z.core.$ZodTypeInternals<"image", "image">>;
556
- url: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
557
- width: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
558
- height: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
559
- file_size_bytes: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
560
- pixel_ratio: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
561
- state_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
562
- breakpoint_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
563
- focal_point: z.ZodOptional<z.ZodType<[number, number], [number, number], z.core.$ZodTypeInternals<[number, number], [number, number]>>>;
564
- format: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
565
- alt_text: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
566
- provenance: z.ZodOptional<z.ZodType<import("../index.mjs").Provenance, import("../index.mjs").Provenance, z.core.$ZodTypeInternals<import("../index.mjs").Provenance, import("../index.mjs").Provenance>>>;
567
- }, z.core.$loose>, keyof z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>> & z.ZodType<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset, z.core.$ZodTypeInternals<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset>>>;
568
- colors: z.ZodOptional<z.ZodObject<{
569
- primary: z.ZodOptional<z.ZodString>;
570
- secondary: z.ZodOptional<z.ZodString>;
571
- accent: z.ZodOptional<z.ZodString>;
572
- }, z.core.$loose>>;
573
- voice: z.ZodOptional<z.ZodString>;
574
- tagline: z.ZodOptional<z.ZodString>;
575
- }, z.core.$loose>>;
576
- }, z.core.$loose>;
519
+ transport: z.ZodString;
520
+ orchestration: z.ZodUnion<readonly [z.ZodLiteral<"producer_managed">, z.ZodLiteral<"consumer_managed">]>;
521
+ destination: z.ZodUnion<readonly [z.ZodObject<{
522
+ mode: z.ZodLiteral<"existing">;
523
+ destination_ref: z.ZodString;
524
+ }, z.core.$loose>, z.ZodObject<{
525
+ mode: z.ZodLiteral<"provision">;
526
+ provider: z.ZodObject<{
527
+ domain: z.ZodString;
528
+ }, z.core.$loose>;
529
+ location: z.ZodString;
530
+ access_mode: z.ZodOptional<z.ZodString>;
531
+ }, z.core.$loose>]>;
532
+ format: z.ZodUnion<readonly [z.ZodLiteral<"jsonl">, z.ZodLiteral<"csv">, z.ZodLiteral<"parquet">, z.ZodLiteral<"avro">, z.ZodLiteral<"orc">]>;
577
533
  }, z.core.$loose>, z.ZodObject<{
578
534
  pattern: z.ZodLiteral<"dataset_share">;
579
535
  transport: z.ZodString;
@@ -922,42 +878,20 @@ export declare const SyncCreativesResponseStrictSchema: z.ZodUnion<readonly [z.Z
922
878
  }, z.core.$loose>;
923
879
  method: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
924
880
  pattern: z.ZodLiteral<"file_transfer">;
925
- transport: z.ZodUnion<readonly [z.ZodLiteral<"s3">, z.ZodLiteral<"gcs">, z.ZodLiteral<"azure_blob">]>;
926
- directions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"buyer_to_seller">, z.ZodLiteral<"seller_to_buyer">]>>>;
927
- vendor: z.ZodObject<{
928
- domain: z.ZodString;
929
- brand_id: z.ZodOptional<z.ZodString>;
930
- countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
931
- industries: z.ZodOptional<z.ZodArray<z.ZodString>>;
932
- data_subject_contestation: z.ZodOptional<z.ZodObject<{
933
- url: z.ZodOptional<z.ZodString>;
934
- email: z.ZodOptional<z.ZodEmail>;
935
- languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
936
- }, z.core.$loose>>;
937
- brand_kit_override: z.ZodOptional<z.ZodObject<{
938
- logo: z.ZodOptional<Omit<z.ZodObject<{
939
- asset_type: z.ZodType<"image", "image", z.core.$ZodTypeInternals<"image", "image">>;
940
- url: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
941
- width: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
942
- height: z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
943
- file_size_bytes: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
944
- pixel_ratio: z.ZodOptional<z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>>;
945
- state_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
946
- breakpoint_id: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
947
- focal_point: z.ZodOptional<z.ZodType<[number, number], [number, number], z.core.$ZodTypeInternals<[number, number], [number, number]>>>;
948
- format: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
949
- alt_text: z.ZodOptional<z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
950
- provenance: z.ZodOptional<z.ZodType<import("../index.mjs").Provenance, import("../index.mjs").Provenance, z.core.$ZodTypeInternals<import("../index.mjs").Provenance, import("../index.mjs").Provenance>>>;
951
- }, z.core.$loose>, keyof z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>> & z.ZodType<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset, z.core.$ZodTypeInternals<import("../index.mjs").ImageAsset & Record<string, unknown>, import("../index.mjs").ImageAsset>>>;
952
- colors: z.ZodOptional<z.ZodObject<{
953
- primary: z.ZodOptional<z.ZodString>;
954
- secondary: z.ZodOptional<z.ZodString>;
955
- accent: z.ZodOptional<z.ZodString>;
956
- }, z.core.$loose>>;
957
- voice: z.ZodOptional<z.ZodString>;
958
- tagline: z.ZodOptional<z.ZodString>;
959
- }, z.core.$loose>>;
960
- }, z.core.$loose>;
881
+ transport: z.ZodString;
882
+ orchestration: z.ZodUnion<readonly [z.ZodLiteral<"producer_managed">, z.ZodLiteral<"consumer_managed">]>;
883
+ destination: z.ZodUnion<readonly [z.ZodObject<{
884
+ mode: z.ZodLiteral<"existing">;
885
+ destination_ref: z.ZodString;
886
+ }, z.core.$loose>, z.ZodObject<{
887
+ mode: z.ZodLiteral<"provision">;
888
+ provider: z.ZodObject<{
889
+ domain: z.ZodString;
890
+ }, z.core.$loose>;
891
+ location: z.ZodString;
892
+ access_mode: z.ZodOptional<z.ZodString>;
893
+ }, z.core.$loose>]>;
894
+ format: z.ZodUnion<readonly [z.ZodLiteral<"jsonl">, z.ZodLiteral<"csv">, z.ZodLiteral<"parquet">, z.ZodLiteral<"avro">, z.ZodLiteral<"orc">]>;
961
895
  }, z.core.$loose>, z.ZodObject<{
962
896
  pattern: z.ZodLiteral<"dataset_share">;
963
897
  transport: z.ZodString;