@adcp/sdk 16.0.0-beta.2 → 16.0.0-beta.4

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 (248) hide show
  1. package/README.md +54 -0
  2. package/dist/lib/auth/oauth/diagnose.js +3 -11
  3. package/dist/lib/auth/oauth/diagnose.mjs +4 -12
  4. package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
  5. package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
  6. package/dist/lib/auth/oauth/diagnostics.js +8 -10
  7. package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
  8. package/dist/lib/core/ConversationTypes.d.mts +8 -3
  9. package/dist/lib/core/ConversationTypes.d.ts +8 -3
  10. package/dist/lib/core/SingleAgentClient.d.mts +5 -3
  11. package/dist/lib/core/SingleAgentClient.d.ts +5 -3
  12. package/dist/lib/core/TaskExecutor.js +5 -1
  13. package/dist/lib/core/TaskExecutor.mjs +5 -1
  14. package/dist/lib/errors/index.d.mts +9 -4
  15. package/dist/lib/errors/index.d.ts +9 -4
  16. package/dist/lib/index.d.mts +3 -3
  17. package/dist/lib/index.d.ts +3 -3
  18. package/dist/lib/index.js +8 -0
  19. package/dist/lib/index.mjs +14 -2
  20. package/dist/lib/negotiation/types.d.mts +20 -39
  21. package/dist/lib/negotiation/types.d.ts +20 -39
  22. package/dist/lib/protocols/index.d.mts +60 -24
  23. package/dist/lib/protocols/index.d.ts +60 -24
  24. package/dist/lib/protocols/index.js +9 -4
  25. package/dist/lib/protocols/index.mjs +3 -0
  26. package/dist/lib/protocols/mcp-modern.js +1 -0
  27. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  28. package/dist/lib/protocols/mcp.js +1 -0
  29. package/dist/lib/protocols/mcp.mjs +2 -1
  30. package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
  31. package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
  32. package/dist/lib/protocols/responseSizeLimit.js +195 -31
  33. package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
  34. package/dist/lib/reporting/consumer-runtime.js +2 -1
  35. package/dist/lib/reporting/consumer-runtime.mjs +2 -1
  36. package/dist/lib/reporting/ledger/handler.js +50 -11
  37. package/dist/lib/reporting/ledger/handler.mjs +50 -12
  38. package/dist/lib/reporting/ledger/index.d.mts +17 -14
  39. package/dist/lib/reporting/ledger/index.d.ts +17 -14
  40. package/dist/lib/reporting/ledger/index.js +32 -20
  41. package/dist/lib/reporting/ledger/index.mjs +21 -10
  42. package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
  43. package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
  44. package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
  45. package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
  46. package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
  47. package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
  48. package/dist/lib/reporting/ledger/receipts.js +186 -0
  49. package/dist/lib/reporting/ledger/receipts.mjs +161 -0
  50. package/dist/lib/reporting/ledger/status-ingest.js +3 -3
  51. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
  52. package/dist/lib/reporting/ledger/types.d.mts +43 -0
  53. package/dist/lib/reporting/ledger/types.d.ts +43 -0
  54. package/dist/lib/reporting/ledger/types.js +31 -2
  55. package/dist/lib/reporting/ledger/types.mjs +26 -1
  56. package/dist/lib/reporting/pagination.d.mts +6 -0
  57. package/dist/lib/reporting/pagination.d.ts +6 -0
  58. package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
  59. package/dist/lib/reporting/pagination.mjs +12 -0
  60. package/dist/lib/reporting/reconciliation.d.mts +1 -0
  61. package/dist/lib/reporting/reconciliation.d.ts +1 -0
  62. package/dist/lib/reporting/reconciliation.js +3 -2
  63. package/dist/lib/reporting/reconciliation.mjs +3 -2
  64. package/dist/lib/reporting/service/index.d.mts +79 -153
  65. package/dist/lib/reporting/service/index.d.ts +79 -153
  66. package/dist/lib/reporting/service/index.js +34 -491
  67. package/dist/lib/reporting/service/index.mjs +36 -510
  68. package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
  69. package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
  70. package/dist/lib/reporting/service/scheduler-support.js +125 -0
  71. package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
  72. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  73. package/dist/lib/signing/canonicalize.d.mts +4 -0
  74. package/dist/lib/signing/canonicalize.d.ts +4 -0
  75. package/dist/lib/signing/canonicalize.js +14 -8
  76. package/dist/lib/signing/canonicalize.mjs +14 -8
  77. package/dist/lib/signing/content-digest.d.mts +8 -0
  78. package/dist/lib/signing/content-digest.d.ts +8 -0
  79. package/dist/lib/signing/content-digest.js +11 -5
  80. package/dist/lib/signing/content-digest.mjs +10 -5
  81. package/dist/lib/signing/crypto.d.mts +15 -0
  82. package/dist/lib/signing/crypto.d.ts +15 -0
  83. package/dist/lib/signing/crypto.js +75 -3
  84. package/dist/lib/signing/crypto.mjs +78 -3
  85. package/dist/lib/signing/server.d.mts +1 -1
  86. package/dist/lib/signing/server.d.ts +1 -1
  87. package/dist/lib/signing/server.js +2 -0
  88. package/dist/lib/signing/server.mjs +2 -1
  89. package/dist/lib/signing/signer.js +11 -14
  90. package/dist/lib/signing/signer.mjs +13 -16
  91. package/dist/lib/signing/testing.js +2 -6
  92. package/dist/lib/signing/testing.mjs +3 -7
  93. package/dist/lib/signing/verifier.js +2 -2
  94. package/dist/lib/signing/verifier.mjs +3 -3
  95. package/dist/lib/signing/web-bot-auth.js +122 -43
  96. package/dist/lib/signing/web-bot-auth.mjs +128 -44
  97. package/dist/lib/signing/webhook-verifier.js +2 -2
  98. package/dist/lib/signing/webhook-verifier.mjs +3 -3
  99. package/dist/lib/substitution/compile.js +2 -1
  100. package/dist/lib/substitution/compile.mjs +2 -1
  101. package/dist/lib/substitution/consent-macros.d.mts +4 -0
  102. package/dist/lib/substitution/consent-macros.d.ts +4 -0
  103. package/dist/lib/substitution/consent-macros.js +45 -0
  104. package/dist/lib/substitution/consent-macros.mjs +20 -0
  105. package/dist/lib/substitution/index.d.mts +1 -1
  106. package/dist/lib/substitution/index.d.ts +1 -1
  107. package/dist/lib/substitution/index.js +2 -0
  108. package/dist/lib/substitution/index.mjs +2 -1
  109. package/dist/lib/substitution/translate.d.mts +15 -2
  110. package/dist/lib/substitution/translate.d.ts +15 -2
  111. package/dist/lib/substitution/translate.js +148 -26
  112. package/dist/lib/substitution/translate.mjs +147 -26
  113. package/dist/lib/testing/client.js +2 -1
  114. package/dist/lib/testing/client.mjs +2 -1
  115. package/dist/lib/testing/scenarios/capabilities.js +1 -1
  116. package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
  117. package/dist/lib/testing/storyboard/junit.js +16 -3
  118. package/dist/lib/testing/storyboard/junit.mjs +16 -3
  119. package/dist/lib/testing/storyboard/request-signing/builder.js +12 -14
  120. package/dist/lib/testing/storyboard/request-signing/builder.mjs +13 -15
  121. package/dist/lib/testing/storyboard/runner.js +94 -25
  122. package/dist/lib/testing/storyboard/runner.mjs +94 -25
  123. package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
  124. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
  125. package/dist/lib/testing/storyboard/types.d.mts +6 -0
  126. package/dist/lib/testing/storyboard/types.d.ts +6 -0
  127. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  128. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  129. package/dist/lib/types/enums.generated.d.mts +3 -0
  130. package/dist/lib/types/enums.generated.d.ts +3 -0
  131. package/dist/lib/types/enums.generated.js +9 -0
  132. package/dist/lib/types/enums.generated.mjs +6 -0
  133. package/dist/lib/validation/schema-loader.js +25 -0
  134. package/dist/lib/validation/schema-loader.mjs +24 -0
  135. package/dist/lib/version.d.mts +3 -3
  136. package/dist/lib/version.d.ts +3 -3
  137. package/dist/lib/version.js +3 -3
  138. package/dist/lib/version.mjs +3 -3
  139. package/docs/TYPE-SUMMARY.md +28 -5
  140. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
  141. package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
  142. package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
  143. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
  144. package/docs/guides/REPORTING-LEDGER.md +107 -51
  145. package/docs/guides/REPORTING-OPERATIONS.md +66 -5
  146. package/docs/guides/REPORTING-STABILITY.md +36 -32
  147. package/docs/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
  148. package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
  149. package/docs/llms.txt +4 -3
  150. package/docs/migration-14.x-rc-worksheet.md +4 -7
  151. package/docs/migration-reporting-storage-package.md +186 -0
  152. package/examples/README.md +1 -1
  153. package/package.json +14 -78
  154. package/dist/lib/reporting/azure/index.d.mts +0 -31
  155. package/dist/lib/reporting/azure/index.d.ts +0 -31
  156. package/dist/lib/reporting/azure/index.js +0 -266
  157. package/dist/lib/reporting/azure/index.mjs +0 -249
  158. package/dist/lib/reporting/bigquery/index.d.mts +0 -246
  159. package/dist/lib/reporting/bigquery/index.d.ts +0 -246
  160. package/dist/lib/reporting/bigquery/index.js +0 -633
  161. package/dist/lib/reporting/bigquery/index.mjs +0 -594
  162. package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
  163. package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
  164. package/dist/lib/reporting/gcs/adapter.js +0 -342
  165. package/dist/lib/reporting/gcs/adapter.mjs +0 -325
  166. package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
  167. package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
  168. package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
  169. package/dist/lib/reporting/gcs/errors.d.mts +0 -11
  170. package/dist/lib/reporting/gcs/errors.d.ts +0 -11
  171. package/dist/lib/reporting/gcs/errors.mjs +0 -16
  172. package/dist/lib/reporting/gcs/fence.d.mts +0 -41
  173. package/dist/lib/reporting/gcs/fence.d.ts +0 -41
  174. package/dist/lib/reporting/gcs/fence.js +0 -250
  175. package/dist/lib/reporting/gcs/fence.mjs +0 -230
  176. package/dist/lib/reporting/gcs/index.d.mts +0 -18
  177. package/dist/lib/reporting/gcs/index.d.ts +0 -18
  178. package/dist/lib/reporting/gcs/index.js +0 -44
  179. package/dist/lib/reporting/gcs/index.mjs +0 -14
  180. package/dist/lib/reporting/gcs/io.d.mts +0 -7
  181. package/dist/lib/reporting/gcs/io.d.ts +0 -7
  182. package/dist/lib/reporting/gcs/io.js +0 -95
  183. package/dist/lib/reporting/gcs/io.mjs +0 -69
  184. package/dist/lib/reporting/gcs/reader.d.mts +0 -67
  185. package/dist/lib/reporting/gcs/reader.d.ts +0 -67
  186. package/dist/lib/reporting/gcs/reader.js +0 -193
  187. package/dist/lib/reporting/gcs/reader.mjs +0 -169
  188. package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
  189. package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
  190. package/dist/lib/reporting/gcs/row-provider.js +0 -225
  191. package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
  192. package/dist/lib/reporting/gcs/validation.d.mts +0 -5
  193. package/dist/lib/reporting/gcs/validation.d.ts +0 -5
  194. package/dist/lib/reporting/gcs/validation.js +0 -49
  195. package/dist/lib/reporting/gcs/validation.mjs +0 -25
  196. package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
  197. package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
  198. package/dist/lib/reporting/ledger/change-feed.js +0 -107
  199. package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
  200. package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
  201. package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
  202. package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
  203. package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
  204. package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
  205. package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
  206. package/dist/lib/reporting/ledger/managed-router.js +0 -280
  207. package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
  208. package/dist/lib/reporting/ledger/managed.d.mts +0 -535
  209. package/dist/lib/reporting/ledger/managed.d.ts +0 -535
  210. package/dist/lib/reporting/ledger/managed.js +0 -761
  211. package/dist/lib/reporting/ledger/managed.mjs +0 -729
  212. package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
  213. package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
  214. package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
  215. package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
  216. package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
  217. package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
  218. package/dist/lib/reporting/ledger/object-writes.js +0 -147
  219. package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
  220. package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
  221. package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
  222. package/dist/lib/reporting/ledger/postgres.js +0 -4462
  223. package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
  224. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
  225. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
  226. package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
  227. package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
  228. package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
  229. package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
  230. package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
  231. package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
  232. package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
  233. package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
  234. package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
  235. package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
  236. package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
  237. package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
  238. package/dist/lib/reporting/ledger/row-storage.js +0 -812
  239. package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
  240. package/dist/lib/reporting/s3/index.d.mts +0 -34
  241. package/dist/lib/reporting/s3/index.d.ts +0 -34
  242. package/dist/lib/reporting/s3/index.js +0 -347
  243. package/dist/lib/reporting/s3/index.mjs +0 -340
  244. package/dist/lib/reporting/service/maintenance.d.mts +0 -148
  245. package/dist/lib/reporting/service/maintenance.d.ts +0 -148
  246. package/dist/lib/reporting/service/maintenance.js +0 -185
  247. package/dist/lib/reporting/service/maintenance.mjs +0 -159
  248. package/examples/reliable-reporting-service/README.md +0 -169
@@ -0,0 +1,161 @@
1
+ import { createHash } from "node:crypto";
2
+ import { canonicalize } from "../../utils/jcs.mjs";
3
+ import { isReportingAdjustmentReceiptEvidence, isReportingReceiptEvidence } from "../evidence.mjs";
4
+ import { AdcpError } from "../../server/decisioning/async-outcome.mjs";
5
+ const MAX_RECEIPTS_PER_ARRAY = 100;
6
+ const MAX_RECEIPT_RESULTS = 100;
7
+ const MAX_RECEIPT_EVIDENCE_BYTES = 64 * 1024;
8
+ function createSyncReportingReceiptsHandler(store, resolveConsumerId, now = () => /* @__PURE__ */ new Date()) {
9
+ return async (request, context) => {
10
+ const account_id = resolvedAccountId(context.account);
11
+ const consumer_id = await resolveConsumerId(context);
12
+ if (!consumer_id || consumer_id.length > 255) {
13
+ throw new TypeError("resolveConsumerId must return a durable authenticated principal of at most 255 characters");
14
+ }
15
+ if (request.receipts !== void 0 && !Array.isArray(request.receipts)) {
16
+ throw new AdcpError("VALIDATION_ERROR", { message: "sync_reporting_receipts receipts must be an array" });
17
+ }
18
+ if (request.adjustment_receipts !== void 0 && !Array.isArray(request.adjustment_receipts)) {
19
+ throw new AdcpError("VALIDATION_ERROR", {
20
+ message: "sync_reporting_receipts adjustment_receipts must be an array"
21
+ });
22
+ }
23
+ const revisionReceipts = request.receipts ?? [];
24
+ const adjustmentReceipts = request.adjustment_receipts ?? [];
25
+ if (!revisionReceipts.every(isRecord) || !adjustmentReceipts.every(isRecord)) {
26
+ throw new AdcpError("VALIDATION_ERROR", {
27
+ message: "sync_reporting_receipts entries must be objects"
28
+ });
29
+ }
30
+ if (revisionReceipts.length > MAX_RECEIPTS_PER_ARRAY || adjustmentReceipts.length > MAX_RECEIPTS_PER_ARRAY) {
31
+ throw new AdcpError("VALIDATION_ERROR", {
32
+ message: `sync_reporting_receipts accepts at most ${MAX_RECEIPTS_PER_ARRAY} receipts and ${MAX_RECEIPTS_PER_ARRAY} adjustment receipts per request`
33
+ });
34
+ }
35
+ if ([...revisionReceipts, ...adjustmentReceipts].some((receipt) => "received_at" in receipt)) {
36
+ throw new AdcpError("VALIDATION_ERROR", {
37
+ message: "sync_reporting_receipts receipts must not carry received_at; it is assigned by the server"
38
+ });
39
+ }
40
+ const entries = [
41
+ ...revisionReceipts.map((receipt) => ({ kind: "revision", receipt })),
42
+ ...adjustmentReceipts.map((receipt) => ({
43
+ kind: "adjustment",
44
+ receipt
45
+ }))
46
+ ];
47
+ if (entries.length > MAX_RECEIPT_RESULTS) {
48
+ throw new AdcpError("VALIDATION_ERROR", {
49
+ message: `sync_reporting_receipts can return at most ${MAX_RECEIPT_RESULTS} results, so a request may carry at most ${MAX_RECEIPT_RESULTS} receipts and adjustment receipts in total`
50
+ });
51
+ }
52
+ if (!entries.length) {
53
+ throw new AdcpError("VALIDATION_ERROR", {
54
+ message: "sync_reporting_receipts requires at least one receipt or adjustment receipt"
55
+ });
56
+ }
57
+ if (request.account && "account_id" in request.account && request.account.account_id !== account_id) {
58
+ return receiptBatchFailure(entries, "PERMISSION_DENIED", "Reporting receipt account is unavailable");
59
+ }
60
+ if (!/^[A-Za-z0-9_.:-]{16,255}$/.test(request.idempotency_key)) {
61
+ return receiptBatchFailure(entries, "VALIDATION_ERROR", "sync_reporting_receipts idempotency_key is invalid");
62
+ }
63
+ const submittedIds = entries.map(
64
+ (entry) => isRecord(entry.receipt) && typeof entry.receipt.reporting_receipt_id === "string" ? entry.receipt.reporting_receipt_id : ""
65
+ );
66
+ const duplicateSubmittedIds = new Set(
67
+ submittedIds.filter((value, index) => value !== "" && submittedIds.indexOf(value) !== index)
68
+ );
69
+ if (duplicateSubmittedIds.size) {
70
+ return receiptBatchFailure(
71
+ entries,
72
+ "VALIDATION_ERROR",
73
+ "sync_reporting_receipts receipt IDs must be unique across the batch"
74
+ );
75
+ }
76
+ const evidenceValid = entries.map(
77
+ (entry) => entry.kind === "revision" ? isReportingReceiptEvidence(entry.receipt) : isReportingAdjustmentReceiptEvidence(entry.receipt)
78
+ );
79
+ const oversized = entries.map(
80
+ (entry) => Buffer.byteLength(JSON.stringify(entry.receipt), "utf8") > MAX_RECEIPT_EVIDENCE_BYTES
81
+ );
82
+ const valid = entries.map((_, index) => evidenceValid[index] && !oversized[index]);
83
+ const validEntries = entries.filter((_, index) => valid[index]);
84
+ const request_fingerprint = sha256({ entries });
85
+ const stored = validEntries.length ? await store.syncReceiptBatch({
86
+ account_id,
87
+ consumer_id,
88
+ idempotency_key: request.idempotency_key,
89
+ request_fingerprint,
90
+ entries: validEntries,
91
+ received_at: now().toISOString()
92
+ }) : [];
93
+ let storedIndex = 0;
94
+ return {
95
+ status: "completed",
96
+ results: entries.map((entry, index) => {
97
+ if (valid[index]) return stored[storedIndex++];
98
+ const field = entry.kind === "revision" ? `receipts[${index}]` : `adjustment_receipts[${index - revisionReceipts.length}]`;
99
+ return oversized[index] ? receiptFailure(
100
+ reflectableReceiptId(entry.receipt.reporting_receipt_id, index),
101
+ "VALIDATION_ERROR",
102
+ "Reporting receipt evidence exceeds the 64 KiB limit",
103
+ {
104
+ field,
105
+ suggestion: `Reduce ${field} to 64 KiB or less and retry.`
106
+ }
107
+ ) : receiptFailure(
108
+ reflectableReceiptId(entry.receipt.reporting_receipt_id, index),
109
+ "VALIDATION_ERROR",
110
+ "Reporting receipt evidence is malformed",
111
+ {
112
+ field,
113
+ suggestion: `Correct ${field} to satisfy the reporting receipt evidence schema and retry.`
114
+ }
115
+ );
116
+ })
117
+ };
118
+ };
119
+ }
120
+ function receiptBatchFailure(entries, code, message) {
121
+ return {
122
+ status: "completed",
123
+ results: entries.map(
124
+ (entry, index) => receiptFailure(reflectableReceiptId(entry.receipt.reporting_receipt_id, index), code, message)
125
+ )
126
+ };
127
+ }
128
+ const RECEIPT_ID_PATTERN = /^[A-Za-z0-9_.:-]{16,255}$/;
129
+ function reflectableReceiptId(value, index) {
130
+ return typeof value === "string" && RECEIPT_ID_PATTERN.test(value) ? value : `unidentified-reporting-receipt-${String(index).padStart(3, "0")}`;
131
+ }
132
+ function receiptFailure(reporting_receipt_id, code, message, metadata = {}) {
133
+ return {
134
+ result: "failed",
135
+ reporting_receipt_id,
136
+ errors: [{ code, message, recovery: "correctable", ...metadata }]
137
+ };
138
+ }
139
+ function resolvedAccountId(account) {
140
+ if (!account || typeof account !== "object") throw new Error("Reporting receipts require a resolved account");
141
+ const value = account;
142
+ const id = typeof value.id === "string" ? value.id : typeof value.account_id === "string" ? value.account_id : "";
143
+ if (!id) throw new Error("Reporting receipts require a resolved account");
144
+ return id;
145
+ }
146
+ function isRecord(value) {
147
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
148
+ }
149
+ function sha256(value) {
150
+ return createHash("sha256").update(canonicalize(value === void 0 ? null : value)).digest("hex");
151
+ }
152
+ function reportingManagedDeliveryBindingV1(input) {
153
+ const created_at = input.created_at ?? (/* @__PURE__ */ new Date()).toISOString();
154
+ const { semantic_fingerprint: _predecessor, ...semantic } = input;
155
+ const semantic_fingerprint = sha256({ ...semantic, created_at: void 0 });
156
+ return { ...semantic, created_at, semantic_fingerprint };
157
+ }
158
+ export {
159
+ createSyncReportingReceiptsHandler,
160
+ reportingManagedDeliveryBindingV1
161
+ };
@@ -156,7 +156,7 @@ function createSyncReportingStatusHandler(store, options) {
156
156
  });
157
157
  if (replay) return completed(replay);
158
158
  } catch (error) {
159
- if (!(error instanceof import_types.ReportingConsumerStatusConflictError)) throw error;
159
+ if (!(0, import_types.isReportingLedgerErrorNamed)(error, "ReportingConsumerStatusConflictError")) throw error;
160
160
  return failed(statusIds, "IDEMPOTENCY_CONFLICT", "Reporting status idempotency conflict");
161
161
  }
162
162
  const now = (options.now ?? (() => /* @__PURE__ */ new Date()))();
@@ -216,7 +216,7 @@ function createSyncReportingStatusHandler(store, options) {
216
216
  });
217
217
  return completed(results);
218
218
  } catch (error) {
219
- const conflict = error instanceof import_types.ReportingConsumerStatusConflictError;
219
+ const conflict = (0, import_types.isReportingLedgerErrorNamed)(error, "ReportingConsumerStatusConflictError");
220
220
  if (!conflict && !(error instanceof ReportingStatusValidationError)) throw error;
221
221
  return failed(
222
222
  statusIds,
@@ -277,7 +277,7 @@ async function validateStatus(store, configurations, accountId, consumerId, stat
277
277
  try {
278
278
  page = await store.readSnapshotPage(status.seller_ledger_snapshot_id, accountId, void 0, 1);
279
279
  } catch (error) {
280
- if (!(error instanceof import_types.ReportingLedgerSnapshotUnavailableError)) throw error;
280
+ if (!(0, import_types.isReportingLedgerErrorNamed)(error, "ReportingLedgerSnapshotUnavailableError")) throw error;
281
281
  throw new ReportingStatusValidationError("snapshot provenance unavailable");
282
282
  }
283
283
  const scope = (0, import_coverage.reportingLedgerEffectivePeriod)(page.snapshot.query, page.snapshot.ledgerAsOf);
@@ -24,8 +24,7 @@ import {
24
24
  import {
25
25
  REPORTING_CONSUMER_STATUS_ERROR_FIELD_MAX_BYTES,
26
26
  REPORTING_CONSUMER_STATUS_ERROR_MESSAGE_MAX_BYTES,
27
- ReportingConsumerStatusConflictError,
28
- ReportingLedgerSnapshotUnavailableError
27
+ isReportingLedgerErrorNamed
29
28
  } from "./types.mjs";
30
29
  const statusId = z.string().min(16).max(255).regex(/^[A-Za-z0-9_.:-]+$/);
31
30
  const INVALID_REPORTING_STATUS_ID = "invalid-reporting-status-id";
@@ -147,7 +146,7 @@ function createSyncReportingStatusHandler(store, options) {
147
146
  });
148
147
  if (replay) return completed(replay);
149
148
  } catch (error) {
150
- if (!(error instanceof ReportingConsumerStatusConflictError)) throw error;
149
+ if (!isReportingLedgerErrorNamed(error, "ReportingConsumerStatusConflictError")) throw error;
151
150
  return failed(statusIds, "IDEMPOTENCY_CONFLICT", "Reporting status idempotency conflict");
152
151
  }
153
152
  const now = (options.now ?? (() => /* @__PURE__ */ new Date()))();
@@ -207,7 +206,7 @@ function createSyncReportingStatusHandler(store, options) {
207
206
  });
208
207
  return completed(results);
209
208
  } catch (error) {
210
- const conflict = error instanceof ReportingConsumerStatusConflictError;
209
+ const conflict = isReportingLedgerErrorNamed(error, "ReportingConsumerStatusConflictError");
211
210
  if (!conflict && !(error instanceof ReportingStatusValidationError)) throw error;
212
211
  return failed(
213
212
  statusIds,
@@ -268,7 +267,7 @@ async function validateStatus(store, configurations, accountId, consumerId, stat
268
267
  try {
269
268
  page = await store.readSnapshotPage(status.seller_ledger_snapshot_id, accountId, void 0, 1);
270
269
  } catch (error) {
271
- if (!(error instanceof ReportingLedgerSnapshotUnavailableError)) throw error;
270
+ if (!isReportingLedgerErrorNamed(error, "ReportingLedgerSnapshotUnavailableError")) throw error;
272
271
  throw new ReportingStatusValidationError("snapshot provenance unavailable");
273
272
  }
274
273
  const scope = reportingLedgerEffectivePeriod(page.snapshot.query, page.snapshot.ledgerAsOf);
@@ -722,6 +722,35 @@ export interface ReportingLedgerLeaseV1 {
722
722
  generation: number;
723
723
  expiresAt: string;
724
724
  }
725
+ /**
726
+ * The writer's lease was lost before the commit completed.
727
+ *
728
+ * `ReportingLedgerLeaseLostError`, `ReportingLedgerPeriodRetiredError` and
729
+ * `ReportingLedgerContinuityError` are the errors every `ReportingLedgerStore` throws. The protocol
730
+ * layer recognizes them by `name`, so a store from another package (or another copy of the SDK) is
731
+ * understood as well as one built here. Store implementations should throw these classes.
732
+ *
733
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
734
+ */
735
+ export declare class ReportingLedgerLeaseLostError extends Error {
736
+ constructor(message?: string);
737
+ }
738
+ /**
739
+ * A planner or writer named a period whose ledger records were retired by retention.
740
+ *
741
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
742
+ */
743
+ export declare class ReportingLedgerPeriodRetiredError extends Error {
744
+ constructor(message?: string);
745
+ }
746
+ /**
747
+ * A revision continuity invariant failed (a gap or a fork in the revision chain).
748
+ *
749
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
750
+ */
751
+ export declare class ReportingLedgerContinuityError extends Error {
752
+ constructor(message?: string);
753
+ }
725
754
  export declare class ReportingLedgerSnapshotUnavailableError extends Error {
726
755
  constructor();
727
756
  }
@@ -732,10 +761,24 @@ export declare class ReportingConsumerStatusConflictError extends Error {
732
761
  */
733
762
  constructor(message?: string);
734
763
  }
764
+ /**
765
+ * Recognizes a store-contract error by its `name`, not its class. A host that loads the SDK once through
766
+ * `require` and once through `import` holds two copies of every class, and a store from another package can
767
+ * be built against either, so `instanceof` would miss an error the store legitimately threw.
768
+ *
769
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
770
+ */
771
+ export declare function isReportingLedgerErrorNamed(error: unknown, name: 'ReportingLedgerSnapshotUnavailableError' | 'ReportingConsumerStatusConflictError' | 'ReportingLedgerIssueIntegrityError' | 'ReportingLedgerLeaseLostError' | 'ReportingLedgerPeriodRetiredError' | 'ReportingLedgerContinuityError'): boolean;
735
772
  /**
736
773
  * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
737
774
  */
738
775
  export interface ReportingLedgerStore {
776
+ /**
777
+ * Setup scripts the host applies before first use (SQL for a SQL store), in order and idempotent.
778
+ * `createReliableReportingService` surfaces them as `service.setup.migrations`. A store with nothing
779
+ * to install omits it.
780
+ */
781
+ readonly migrations?: readonly string[];
739
782
  /** Optional substrate identity for an add-on store that must prove shared authority. */
740
783
  readonly [REPORTING_LEDGER_AUTHORITY]?: ReportingLedgerAuthorityV1;
741
784
  /**
@@ -722,6 +722,35 @@ export interface ReportingLedgerLeaseV1 {
722
722
  generation: number;
723
723
  expiresAt: string;
724
724
  }
725
+ /**
726
+ * The writer's lease was lost before the commit completed.
727
+ *
728
+ * `ReportingLedgerLeaseLostError`, `ReportingLedgerPeriodRetiredError` and
729
+ * `ReportingLedgerContinuityError` are the errors every `ReportingLedgerStore` throws. The protocol
730
+ * layer recognizes them by `name`, so a store from another package (or another copy of the SDK) is
731
+ * understood as well as one built here. Store implementations should throw these classes.
732
+ *
733
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
734
+ */
735
+ export declare class ReportingLedgerLeaseLostError extends Error {
736
+ constructor(message?: string);
737
+ }
738
+ /**
739
+ * A planner or writer named a period whose ledger records were retired by retention.
740
+ *
741
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
742
+ */
743
+ export declare class ReportingLedgerPeriodRetiredError extends Error {
744
+ constructor(message?: string);
745
+ }
746
+ /**
747
+ * A revision continuity invariant failed (a gap or a fork in the revision chain).
748
+ *
749
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
750
+ */
751
+ export declare class ReportingLedgerContinuityError extends Error {
752
+ constructor(message?: string);
753
+ }
725
754
  export declare class ReportingLedgerSnapshotUnavailableError extends Error {
726
755
  constructor();
727
756
  }
@@ -732,10 +761,24 @@ export declare class ReportingConsumerStatusConflictError extends Error {
732
761
  */
733
762
  constructor(message?: string);
734
763
  }
764
+ /**
765
+ * Recognizes a store-contract error by its `name`, not its class. A host that loads the SDK once through
766
+ * `require` and once through `import` holds two copies of every class, and a store from another package can
767
+ * be built against either, so `instanceof` would miss an error the store legitimately threw.
768
+ *
769
+ * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
770
+ */
771
+ export declare function isReportingLedgerErrorNamed(error: unknown, name: 'ReportingLedgerSnapshotUnavailableError' | 'ReportingConsumerStatusConflictError' | 'ReportingLedgerIssueIntegrityError' | 'ReportingLedgerLeaseLostError' | 'ReportingLedgerPeriodRetiredError' | 'ReportingLedgerContinuityError'): boolean;
735
772
  /**
736
773
  * @experimental Reliable Reporting storage surface: breaking changes may ship in minor releases. See https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
737
774
  */
738
775
  export interface ReportingLedgerStore {
776
+ /**
777
+ * Setup scripts the host applies before first use (SQL for a SQL store), in order and idempotent.
778
+ * `createReliableReportingService` surfaces them as `service.setup.migrations`. A store with nothing
779
+ * to install omits it.
780
+ */
781
+ readonly migrations?: readonly string[];
739
782
  /** Optional substrate identity for an add-on store that must prove shared authority. */
740
783
  readonly [REPORTING_LEDGER_AUTHORITY]?: ReportingLedgerAuthorityV1;
741
784
  /**
@@ -25,7 +25,11 @@ __export(types_exports, {
25
25
  REPORTING_CONSUMER_STATUS_MAX_BYTES: () => REPORTING_CONSUMER_STATUS_MAX_BYTES,
26
26
  REPORTING_LEDGER_AUTHORITY: () => REPORTING_LEDGER_AUTHORITY,
27
27
  ReportingConsumerStatusConflictError: () => ReportingConsumerStatusConflictError,
28
- ReportingLedgerSnapshotUnavailableError: () => ReportingLedgerSnapshotUnavailableError
28
+ ReportingLedgerContinuityError: () => ReportingLedgerContinuityError,
29
+ ReportingLedgerLeaseLostError: () => ReportingLedgerLeaseLostError,
30
+ ReportingLedgerPeriodRetiredError: () => ReportingLedgerPeriodRetiredError,
31
+ ReportingLedgerSnapshotUnavailableError: () => ReportingLedgerSnapshotUnavailableError,
32
+ isReportingLedgerErrorNamed: () => isReportingLedgerErrorNamed
29
33
  });
30
34
  module.exports = __toCommonJS(types_exports);
31
35
  const REPORTING_LEDGER_AUTHORITY = /* @__PURE__ */ Symbol.for("@adcp/sdk/reporting-ledger-authority");
@@ -34,6 +38,24 @@ const REPORTING_CONSUMER_STATUS_ERROR_MESSAGE_MAX_BYTES = 1024;
34
38
  const REPORTING_CONSUMER_STATUS_MAX_BYTES = 64 * 1024;
35
39
  const REPORTING_CONSUMER_STATUS_BATCH_MAX_BYTES = 8 * 1024 * 1024;
36
40
  const REPORTING_CONSUMER_STATUS_BATCH_RESULT_MAX_BYTES = 64 * 1024;
41
+ class ReportingLedgerLeaseLostError extends Error {
42
+ constructor(message = "Reporting ledger lease was lost before commit") {
43
+ super(message);
44
+ this.name = "ReportingLedgerLeaseLostError";
45
+ }
46
+ }
47
+ class ReportingLedgerPeriodRetiredError extends Error {
48
+ constructor(message = "Reporting obligation period was retired by retention") {
49
+ super(message);
50
+ this.name = "ReportingLedgerPeriodRetiredError";
51
+ }
52
+ }
53
+ class ReportingLedgerContinuityError extends Error {
54
+ constructor(message = "Reporting ledger revision continuity invariant failed") {
55
+ super(message);
56
+ this.name = "ReportingLedgerContinuityError";
57
+ }
58
+ }
37
59
  class ReportingLedgerSnapshotUnavailableError extends Error {
38
60
  constructor() {
39
61
  super("Reporting ledger snapshot is unavailable");
@@ -50,6 +72,9 @@ class ReportingConsumerStatusConflictError extends Error {
50
72
  this.name = "ReportingConsumerStatusConflictError";
51
73
  }
52
74
  }
75
+ function isReportingLedgerErrorNamed(error, name) {
76
+ return error instanceof Error && error.name === name;
77
+ }
53
78
  // Annotate the CommonJS export names for ESM import in node:
54
79
  0 && (module.exports = {
55
80
  REPORTING_CONSUMER_STATUS_BATCH_MAX_BYTES,
@@ -59,5 +84,9 @@ class ReportingConsumerStatusConflictError extends Error {
59
84
  REPORTING_CONSUMER_STATUS_MAX_BYTES,
60
85
  REPORTING_LEDGER_AUTHORITY,
61
86
  ReportingConsumerStatusConflictError,
62
- ReportingLedgerSnapshotUnavailableError
87
+ ReportingLedgerContinuityError,
88
+ ReportingLedgerLeaseLostError,
89
+ ReportingLedgerPeriodRetiredError,
90
+ ReportingLedgerSnapshotUnavailableError,
91
+ isReportingLedgerErrorNamed
63
92
  });
@@ -4,6 +4,24 @@ const REPORTING_CONSUMER_STATUS_ERROR_MESSAGE_MAX_BYTES = 1024;
4
4
  const REPORTING_CONSUMER_STATUS_MAX_BYTES = 64 * 1024;
5
5
  const REPORTING_CONSUMER_STATUS_BATCH_MAX_BYTES = 8 * 1024 * 1024;
6
6
  const REPORTING_CONSUMER_STATUS_BATCH_RESULT_MAX_BYTES = 64 * 1024;
7
+ class ReportingLedgerLeaseLostError extends Error {
8
+ constructor(message = "Reporting ledger lease was lost before commit") {
9
+ super(message);
10
+ this.name = "ReportingLedgerLeaseLostError";
11
+ }
12
+ }
13
+ class ReportingLedgerPeriodRetiredError extends Error {
14
+ constructor(message = "Reporting obligation period was retired by retention") {
15
+ super(message);
16
+ this.name = "ReportingLedgerPeriodRetiredError";
17
+ }
18
+ }
19
+ class ReportingLedgerContinuityError extends Error {
20
+ constructor(message = "Reporting ledger revision continuity invariant failed") {
21
+ super(message);
22
+ this.name = "ReportingLedgerContinuityError";
23
+ }
24
+ }
7
25
  class ReportingLedgerSnapshotUnavailableError extends Error {
8
26
  constructor() {
9
27
  super("Reporting ledger snapshot is unavailable");
@@ -20,6 +38,9 @@ class ReportingConsumerStatusConflictError extends Error {
20
38
  this.name = "ReportingConsumerStatusConflictError";
21
39
  }
22
40
  }
41
+ function isReportingLedgerErrorNamed(error, name) {
42
+ return error instanceof Error && error.name === name;
43
+ }
23
44
  export {
24
45
  REPORTING_CONSUMER_STATUS_BATCH_MAX_BYTES,
25
46
  REPORTING_CONSUMER_STATUS_BATCH_RESULT_MAX_BYTES,
@@ -28,5 +49,9 @@ export {
28
49
  REPORTING_CONSUMER_STATUS_MAX_BYTES,
29
50
  REPORTING_LEDGER_AUTHORITY,
30
51
  ReportingConsumerStatusConflictError,
31
- ReportingLedgerSnapshotUnavailableError
52
+ ReportingLedgerContinuityError,
53
+ ReportingLedgerLeaseLostError,
54
+ ReportingLedgerPeriodRetiredError,
55
+ ReportingLedgerSnapshotUnavailableError,
56
+ isReportingLedgerErrorNamed
32
57
  };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The largest `pagination.max_results` AdCP allows (`core/pagination-request.json`), read from the generated
3
+ * schema so a protocol change carries through. The reporting walkers ask for pages this large: a seller that
4
+ * validates the schema answers 50 rows when `max_results` is omitted.
5
+ */
6
+ export declare function reportingMaxPageSize(): number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The largest `pagination.max_results` AdCP allows (`core/pagination-request.json`), read from the generated
3
+ * schema so a protocol change carries through. The reporting walkers ask for pages this large: a seller that
4
+ * validates the schema answers 50 rows when `max_results` is omitted.
5
+ */
6
+ export declare function reportingMaxPageSize(): number;
@@ -16,26 +16,21 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var errors_exports = {};
20
- __export(errors_exports, {
21
- ReportingGcsFenceError: () => ReportingGcsFenceError,
22
- isReportingGcsFenceError: () => isReportingGcsFenceError
19
+ var pagination_exports = {};
20
+ __export(pagination_exports, {
21
+ reportingMaxPageSize: () => reportingMaxPageSize
23
22
  });
24
- module.exports = __toCommonJS(errors_exports);
25
- class ReportingGcsFenceError extends Error {
26
- constructor(code) {
27
- super(`Reporting GCS fence: ${code}`);
28
- this.code = code;
29
- this.name = "ReportingGcsFenceError";
30
- Object.defineProperty(this, /* @__PURE__ */ Symbol.for("adcp.reportingGcsFenceError"), { value: true });
23
+ module.exports = __toCommonJS(pagination_exports);
24
+ var import_schemas = require('../types/schemas.generated.js');
25
+ function reportingMaxPageSize() {
26
+ const field = import_schemas.PaginationRequestSchema.shape.max_results;
27
+ const maximum = field.unwrap().maxValue;
28
+ if (maximum === null || !Number.isSafeInteger(maximum) || maximum < 1) {
29
+ throw new Error("The AdCP pagination-request schema does not define a maximum for max_results");
31
30
  }
32
- code;
33
- }
34
- function isReportingGcsFenceError(error) {
35
- return !!error && typeof error === "object" && error[/* @__PURE__ */ Symbol.for("adcp.reportingGcsFenceError")] === true;
31
+ return maximum;
36
32
  }
37
33
  // Annotate the CommonJS export names for ESM import in node:
38
34
  0 && (module.exports = {
39
- ReportingGcsFenceError,
40
- isReportingGcsFenceError
35
+ reportingMaxPageSize
41
36
  });
@@ -0,0 +1,12 @@
1
+ import { PaginationRequestSchema } from "../types/schemas.generated.mjs";
2
+ function reportingMaxPageSize() {
3
+ const field = PaginationRequestSchema.shape.max_results;
4
+ const maximum = field.unwrap().maxValue;
5
+ if (maximum === null || !Number.isSafeInteger(maximum) || maximum < 1) {
6
+ throw new Error("The AdCP pagination-request schema does not define a maximum for max_results");
7
+ }
8
+ return maximum;
9
+ }
10
+ export {
11
+ reportingMaxPageSize
12
+ };
@@ -82,6 +82,7 @@ export interface ReportingReconciliationClient {
82
82
  account?: GetReportingStatusRequest['account'];
83
83
  reporting_revision_id: string;
84
84
  pagination?: {
85
+ max_results?: number;
85
86
  cursor?: string;
86
87
  };
87
88
  }, options?: {
@@ -82,6 +82,7 @@ export interface ReportingReconciliationClient {
82
82
  account?: GetReportingStatusRequest['account'];
83
83
  reporting_revision_id: string;
84
84
  pagination?: {
85
+ max_results?: number;
85
86
  cursor?: string;
86
87
  };
87
88
  }, options?: {
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(reconciliation_exports);
30
30
  var import_crypto = require("crypto");
31
31
  var import_idempotency = require('../utils/idempotency.js');
32
32
  var import_jcs = require('../utils/jcs.js');
33
+ var import_pagination = require('./pagination.js');
33
34
  var import_content_mismatch = require('./content-mismatch.js');
34
35
  var import_evidence = require('./evidence.js');
35
36
  var import_inspection = require('./inspection.js');
@@ -319,7 +320,7 @@ async function loadReportingLedger(client, request, maxSnapshotRestarts = 2, lim
319
320
  {
320
321
  ...request,
321
322
  view: "periods",
322
- ...cursor ? { pagination: { cursor } } : {}
323
+ pagination: { max_results: (0, import_pagination.reportingMaxPageSize)(), ...cursor ? { cursor } : {} }
323
324
  },
324
325
  { signal }
325
326
  ),
@@ -2040,7 +2041,7 @@ async function consumeReportingRevision(options, reportingRevisionId, deadline,
2040
2041
  {
2041
2042
  ...options.request.account ? { account: options.request.account } : {},
2042
2043
  reporting_revision_id: reportingRevisionId,
2043
- ...cursor ? { pagination: { cursor } } : {}
2044
+ pagination: { max_results: (0, import_pagination.reportingMaxPageSize)(), ...cursor ? { cursor } : {} }
2044
2045
  },
2045
2046
  { signal }
2046
2047
  ),
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "crypto";
2
2
  import { generateIdempotencyKey } from "../utils/idempotency.mjs";
3
3
  import { canonicalize } from "../utils/jcs.mjs";
4
+ import { reportingMaxPageSize } from "./pagination.mjs";
4
5
  import {
5
6
  detectReportingContentMismatch
6
7
  } from "./content-mismatch.mjs";
@@ -295,7 +296,7 @@ async function loadReportingLedger(client, request, maxSnapshotRestarts = 2, lim
295
296
  {
296
297
  ...request,
297
298
  view: "periods",
298
- ...cursor ? { pagination: { cursor } } : {}
299
+ pagination: { max_results: reportingMaxPageSize(), ...cursor ? { cursor } : {} }
299
300
  },
300
301
  { signal }
301
302
  ),
@@ -2016,7 +2017,7 @@ async function consumeReportingRevision(options, reportingRevisionId, deadline,
2016
2017
  {
2017
2018
  ...options.request.account ? { account: options.request.account } : {},
2018
2019
  reporting_revision_id: reportingRevisionId,
2019
- ...cursor ? { pagination: { cursor } } : {}
2020
+ pagination: { max_results: reportingMaxPageSize(), ...cursor ? { cursor } : {} }
2020
2021
  },
2021
2022
  { signal }
2022
2023
  ),