@adcp/sdk 15.9.0 → 16.0.0-beta.1

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 (295) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +16 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +16 -2
  13. package/dist/lib/core/SingleAgentClient.js +259 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +261 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/index.d.mts +10 -0
  28. package/dist/lib/identity-3.3/index.d.ts +10 -0
  29. package/dist/lib/identity-3.3/index.js +75 -0
  30. package/dist/lib/identity-3.3/index.mjs +46 -0
  31. package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
  32. package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
  33. package/dist/lib/identity-3.3/lifecycle.js +267 -0
  34. package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
  35. package/dist/lib/identity-3.3/revocation.d.mts +50 -0
  36. package/dist/lib/identity-3.3/revocation.d.ts +50 -0
  37. package/dist/lib/identity-3.3/revocation.js +238 -0
  38. package/dist/lib/identity-3.3/revocation.mjs +216 -0
  39. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  40. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  41. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  42. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  43. package/dist/lib/identity-3.3/server.d.mts +34 -0
  44. package/dist/lib/identity-3.3/server.d.ts +34 -0
  45. package/dist/lib/identity-3.3/server.js +219 -0
  46. package/dist/lib/identity-3.3/server.mjs +194 -0
  47. package/dist/lib/identity-3.3/store.d.mts +24 -0
  48. package/dist/lib/identity-3.3/store.d.ts +24 -0
  49. package/dist/lib/identity-3.3/store.js +191 -0
  50. package/dist/lib/identity-3.3/store.mjs +169 -0
  51. package/dist/lib/identity-3.3/trust.d.mts +94 -0
  52. package/dist/lib/identity-3.3/trust.d.ts +94 -0
  53. package/dist/lib/identity-3.3/trust.js +278 -0
  54. package/dist/lib/identity-3.3/trust.mjs +239 -0
  55. package/dist/lib/identity-3.3/types.d.mts +127 -0
  56. package/dist/lib/identity-3.3/types.d.ts +127 -0
  57. package/dist/lib/identity-3.3/types.js +16 -0
  58. package/dist/lib/identity-3.3/types.mjs +0 -0
  59. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  60. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  61. package/dist/lib/identity-3.3/validation.js +125 -0
  62. package/dist/lib/identity-3.3/validation.mjs +91 -0
  63. package/dist/lib/index.d.mts +1 -1
  64. package/dist/lib/index.d.ts +1 -1
  65. package/dist/lib/reporting/azure/index.d.mts +5 -0
  66. package/dist/lib/reporting/azure/index.d.ts +5 -0
  67. package/dist/lib/reporting/azure/index.js +26 -7
  68. package/dist/lib/reporting/azure/index.mjs +26 -7
  69. package/dist/lib/reporting/bigquery/index.d.mts +80 -25
  70. package/dist/lib/reporting/bigquery/index.d.ts +80 -25
  71. package/dist/lib/reporting/bigquery/index.js +184 -81
  72. package/dist/lib/reporting/bigquery/index.mjs +182 -80
  73. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  74. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  75. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  76. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  77. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  78. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  79. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  80. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  81. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  82. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  83. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  84. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  85. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  86. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  87. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  88. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  89. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  90. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  91. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  92. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  93. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  94. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  95. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  96. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  97. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  98. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  99. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  100. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  101. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  102. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  103. package/dist/lib/reporting/ledger/postgres.js +43 -27
  104. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  105. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  106. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  107. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  108. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  109. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  110. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  111. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  112. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  113. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  114. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  115. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  116. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  117. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  118. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  119. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  120. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  121. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  122. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  123. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  124. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  125. package/dist/lib/reporting/ledger/schedule.js +24 -0
  126. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  127. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  128. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  129. package/dist/lib/reporting/s3/index.d.mts +5 -0
  130. package/dist/lib/reporting/s3/index.d.ts +5 -0
  131. package/dist/lib/reporting/s3/index.js +37 -14
  132. package/dist/lib/reporting/s3/index.mjs +37 -14
  133. package/dist/lib/reporting/service/index.d.mts +10 -0
  134. package/dist/lib/reporting/service/index.d.ts +10 -0
  135. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  136. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  137. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  138. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  139. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  140. package/dist/lib/server/account-sync-contract.js +225 -0
  141. package/dist/lib/server/account-sync-contract.mjs +197 -0
  142. package/dist/lib/server/adcp-server.js +5 -0
  143. package/dist/lib/server/adcp-server.mjs +10 -0
  144. package/dist/lib/server/auth-signature.d.mts +10 -0
  145. package/dist/lib/server/auth-signature.d.ts +10 -0
  146. package/dist/lib/server/auth-signature.js +61 -2
  147. package/dist/lib/server/auth-signature.mjs +65 -2
  148. package/dist/lib/server/auth.d.mts +6 -0
  149. package/dist/lib/server/auth.d.ts +6 -0
  150. package/dist/lib/server/auth.js +6 -0
  151. package/dist/lib/server/auth.mjs +6 -0
  152. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  153. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  154. package/dist/lib/server/create-adcp-server.js +238 -19
  155. package/dist/lib/server/create-adcp-server.mjs +240 -10
  156. package/dist/lib/server/decisioning/account.d.mts +24 -1
  157. package/dist/lib/server/decisioning/account.d.ts +24 -1
  158. package/dist/lib/server/decisioning/index.d.mts +1 -1
  159. package/dist/lib/server/decisioning/index.d.ts +1 -1
  160. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  161. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  162. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  163. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  164. package/dist/lib/server/index.d.mts +2 -0
  165. package/dist/lib/server/index.d.ts +2 -0
  166. package/dist/lib/server/index.js +12 -0
  167. package/dist/lib/server/index.mjs +12 -0
  168. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  169. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  170. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  171. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  172. package/dist/lib/server/principal/types.d.mts +1 -1
  173. package/dist/lib/server/principal/types.d.ts +1 -1
  174. package/dist/lib/server/serve.js +5 -0
  175. package/dist/lib/server/serve.mjs +5 -0
  176. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  177. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  178. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  179. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  180. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  181. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  182. package/dist/lib/server/webhook-emitter.js +22 -0
  183. package/dist/lib/server/webhook-emitter.mjs +22 -0
  184. package/dist/lib/signing/agent-context.d.mts +0 -5
  185. package/dist/lib/signing/agent-context.d.ts +0 -5
  186. package/dist/lib/signing/agent-context.js +9 -1
  187. package/dist/lib/signing/agent-context.mjs +9 -1
  188. package/dist/lib/signing/agent-fetch.js +27 -2
  189. package/dist/lib/signing/agent-fetch.mjs +32 -2
  190. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  191. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  192. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  193. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  194. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  195. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  196. package/dist/lib/signing/agent-resolver/index.js +5 -0
  197. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  198. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  199. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  200. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  201. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  202. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  203. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  204. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  205. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  206. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  207. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  208. package/dist/lib/signing/brand-jwks.js +4 -4
  209. package/dist/lib/signing/brand-jwks.mjs +4 -4
  210. package/dist/lib/signing/client.d.mts +1 -0
  211. package/dist/lib/signing/client.d.ts +1 -0
  212. package/dist/lib/signing/client.js +5 -0
  213. package/dist/lib/signing/client.mjs +3 -0
  214. package/dist/lib/signing/jwks-https.d.mts +1 -1
  215. package/dist/lib/signing/jwks-https.d.ts +1 -1
  216. package/dist/lib/signing/jwks-https.js +1 -1
  217. package/dist/lib/signing/jwks-https.mjs +1 -1
  218. package/dist/lib/signing/jwks.d.mts +11 -3
  219. package/dist/lib/signing/jwks.d.ts +11 -3
  220. package/dist/lib/signing/jwks.js +1 -1
  221. package/dist/lib/signing/jwks.mjs +1 -1
  222. package/dist/lib/signing/parser.d.mts +1 -1
  223. package/dist/lib/signing/parser.d.ts +1 -1
  224. package/dist/lib/signing/parser.js +5 -3
  225. package/dist/lib/signing/parser.mjs +6 -4
  226. package/dist/lib/signing/revocation.d.mts +4 -1
  227. package/dist/lib/signing/revocation.d.ts +4 -1
  228. package/dist/lib/signing/revocation.js +33 -3
  229. package/dist/lib/signing/revocation.mjs +31 -2
  230. package/dist/lib/signing/server.d.mts +1 -1
  231. package/dist/lib/signing/server.d.ts +1 -1
  232. package/dist/lib/signing/server.js +4 -0
  233. package/dist/lib/signing/server.mjs +4 -0
  234. package/dist/lib/signing/types.d.mts +3 -0
  235. package/dist/lib/signing/types.d.ts +3 -0
  236. package/dist/lib/signing/web-bot-auth.d.mts +117 -0
  237. package/dist/lib/signing/web-bot-auth.d.ts +117 -0
  238. package/dist/lib/signing/web-bot-auth.js +660 -0
  239. package/dist/lib/signing/web-bot-auth.mjs +624 -0
  240. package/dist/lib/testing/client.d.mts +1 -4
  241. package/dist/lib/testing/client.d.ts +1 -4
  242. package/dist/lib/testing/client.js +141 -20
  243. package/dist/lib/testing/client.mjs +137 -19
  244. package/dist/lib/testing/compliance/comply.js +29 -10
  245. package/dist/lib/testing/compliance/comply.mjs +37 -11
  246. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  247. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  248. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  249. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  250. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  251. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  252. package/dist/lib/testing/storyboard/runner.js +23 -8
  253. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  254. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  255. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  256. package/dist/lib/types/adcp.d.mts +4 -0
  257. package/dist/lib/types/adcp.d.ts +4 -0
  258. package/dist/lib/types/schemas.generated.d.ts +6 -6
  259. package/dist/lib/utils/capabilities.d.mts +1 -0
  260. package/dist/lib/utils/capabilities.d.ts +1 -0
  261. package/dist/lib/utils/capabilities.js +5 -0
  262. package/dist/lib/utils/capabilities.mjs +5 -0
  263. package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
  264. package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
  265. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  266. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  267. package/dist/lib/v2/projection/index.d.mts +1 -1
  268. package/dist/lib/v2/projection/index.d.ts +1 -1
  269. package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
  270. package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
  271. package/dist/lib/v2/projection/legacy-routes.js +28 -2
  272. package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
  273. package/dist/lib/validation/schema-loader.d.mts +2 -0
  274. package/dist/lib/validation/schema-loader.d.ts +2 -0
  275. package/dist/lib/validation/schema-loader.js +43 -4
  276. package/dist/lib/validation/schema-loader.mjs +39 -3
  277. package/dist/lib/version.d.mts +3 -3
  278. package/dist/lib/version.d.ts +3 -3
  279. package/dist/lib/version.js +3 -3
  280. package/dist/lib/version.mjs +3 -3
  281. package/docs/TYPE-SUMMARY.md +2 -2
  282. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  283. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  284. package/docs/guides/REPORTING-LEDGER.md +132 -46
  285. package/docs/guides/REPORTING-OPERATIONS.md +25 -4
  286. package/docs/guides/REPORTING-STABILITY.md +76 -0
  287. package/docs/guides/account-resolution.md +101 -0
  288. package/docs/llms.txt +3 -2
  289. package/docs/migration-12-to-13.md +7 -0
  290. package/docs/migration-14.x-rc-worksheet.md +4 -4
  291. package/docs/migration-agent-identity-3.3.md +355 -0
  292. package/docs/migration-agent-resolution-3.3.md +5 -0
  293. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  294. package/examples/storyboards/account-sync-contract.yaml +57 -0
  295. package/package.json +15 -1
@@ -3,6 +3,7 @@ import { promises as fs } from "fs";
3
3
  import { tmpdir } from "os";
4
4
  import * as path from "path";
5
5
  import { decodeReportingChangeCursorV1 } from "../ledger/change-feed.mjs";
6
+ import { reportingPeriodDate } from "../ledger/schedule.mjs";
6
7
  const REPORTING_WAREHOUSE_SINK_MIGRATION = `
7
8
  CREATE TABLE IF NOT EXISTS adcp_reporting_warehouse_sinks (
8
9
  sink_name TEXT PRIMARY KEY CHECK (sink_name ~ '^[A-Za-z0-9_.:-]{1,128}$'),
@@ -12,14 +13,21 @@ CREATE TABLE IF NOT EXISTS adcp_reporting_warehouse_sinks (
12
13
  planned_revisions JSONB,
13
14
  planned_rows_attempt INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_attempt >= 0),
14
15
  planned_revisions_attempt INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_attempt >= 0),
16
+ planned_rows_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_timeouts >= 0),
17
+ planned_revisions_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_timeouts >= 0),
15
18
  reset_generation INTEGER NOT NULL DEFAULT 0 CHECK (reset_generation >= 0),
16
19
  updated_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
17
20
  CHECK ((planned_to_cursor IS NULL) = (planned_revisions IS NULL))
18
21
  );
19
22
  ALTER TABLE adcp_reporting_warehouse_sinks
20
23
  ADD COLUMN IF NOT EXISTS reset_generation INTEGER NOT NULL DEFAULT 0 CHECK (reset_generation >= 0);
24
+ ALTER TABLE adcp_reporting_warehouse_sinks
25
+ ADD COLUMN IF NOT EXISTS planned_rows_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_rows_timeouts >= 0);
26
+ ALTER TABLE adcp_reporting_warehouse_sinks
27
+ ADD COLUMN IF NOT EXISTS planned_revisions_timeouts INTEGER NOT NULL DEFAULT 0 CHECK (planned_revisions_timeouts >= 0);
21
28
  `.trim();
22
29
  const MAX_LOAD_TIMEOUT = 6 * 36e5;
30
+ const MAX_TIMEOUT_DOUBLINGS = 16;
23
31
  let warnedLabelsIgnored = false;
24
32
  const PROJECT = /^[a-z][a-z0-9-]{4,61}[a-z0-9]$/;
25
33
  const DATASET_OR_TABLE = /^[A-Za-z_][A-Za-z0-9_]{0,1023}$/;
@@ -72,51 +80,104 @@ function createBigQueryReportingWarehouseSinkV1(options) {
72
80
  ...options.projectId ? { projectId: options.projectId } : {},
73
81
  ...options.location ? { location: options.location } : {}
74
82
  } : void 0;
75
- async function cancelLoad(jobId, signal) {
83
+ const uploads = /* @__PURE__ */ new Map();
84
+ function startUpload(tableId, jobId, lines) {
85
+ const entry = {
86
+ startedAt: Date.now(),
87
+ done: Promise.resolve()
88
+ };
89
+ const cleanup = async () => {
90
+ if (uploads.get(jobId) === entry) uploads.delete(jobId);
91
+ if (entry.directory) await fs.rm(entry.directory, { recursive: true, force: true }).catch(() => {
92
+ });
93
+ };
94
+ entry.done = (async () => {
95
+ const directory = await fs.mkdtemp(path.join(tmpdir(), "adcp-warehouse-"));
96
+ entry.directory = directory;
97
+ const file = path.join(directory, `${jobId}.ndjson`);
98
+ await fs.writeFile(file, lines.length ? lines.join("\n") + "\n" : "", { mode: 384 });
99
+ return dataset.table(tableId).load(file, {
100
+ jobId,
101
+ sourceFormat: "NEWLINE_DELIMITED_JSON",
102
+ writeDisposition: "WRITE_APPEND",
103
+ ...options.location ? { location: options.location } : {}
104
+ });
105
+ })();
106
+ const replaced = uploads.get(jobId);
107
+ uploads.set(jobId, entry);
108
+ void entry.done.then(cleanup, cleanup);
109
+ if (replaced?.directory) void fs.rm(replaced.directory, { recursive: true, force: true }).catch(() => {
110
+ });
111
+ return entry.done;
112
+ }
113
+ async function jobStatus(jobId, signal, boundMilliseconds = loadTimeout, context) {
114
+ let metadata;
76
115
  try {
77
- const job = options.bigquery.job(jobId, jobOptions);
78
- if (typeof job.cancel !== "function") return;
79
- const cancel = job.cancel.bind(job);
80
- await withinDeadline(cancel, Math.min(loadTimeout, 3e4), signal);
81
- } catch (error) {
82
- const code = error?.code;
83
- if (code === 404 || signal?.aborted) return;
84
- process.emitWarning(
85
- `Cancelling BigQuery load job ${jobId} failed (${typeof code === "number" || typeof code === "string" ? code : "no status code"}); the job may still be running`,
86
- { code: "ADCP_BIGQUERY_SINK_CANCEL_FAILED" }
116
+ metadata = await withinDeadline(
117
+ () => options.bigquery.job(jobId, jobOptions).getMetadata(),
118
+ boundMilliseconds,
119
+ signal,
120
+ context
87
121
  );
122
+ } catch (error) {
123
+ if (error?.code === 404) return "missing";
124
+ throw error;
125
+ }
126
+ const record = Array.isArray(metadata) ? metadata[0] : metadata;
127
+ if (record?.status?.state !== "DONE") return "running";
128
+ if (record.status.errorResult) {
129
+ const failure = new Error("A BigQuery load job for this batch failed; it will be retried as a new attempt");
130
+ Object.defineProperty(failure, "adcpJobFailed", { value: true });
131
+ throw failure;
88
132
  }
133
+ return "done";
89
134
  }
90
- async function loadOnce(tableId, jobId, lines, attempt, signal) {
91
- const loadDeadline = Math.min(loadTimeout * 2 ** Math.min(attempt, 16), MAX_LOAD_TIMEOUT);
135
+ async function loadOnce(role, tableId, jobId, lines, timeouts, signal) {
92
136
  signal?.throwIfAborted();
93
- const directory = await fs.mkdtemp(path.join(tmpdir(), "adcp-warehouse-"));
94
- const file = path.join(directory, `${jobId}.ndjson`);
95
- try {
96
- await fs.writeFile(file, lines.length ? lines.join("\n") + "\n" : "", { mode: 384 });
137
+ const table = `the ${role} table "${tableId}" (timeout count ${timeouts})`;
138
+ let status = await jobStatus(jobId, signal, loadTimeout, table);
139
+ if (status === "done") return;
140
+ const loadDeadline = reportingWarehouseLoadDeadlineV1(loadTimeout, timeouts);
141
+ const deadlineAt = Date.now() + loadDeadline;
142
+ const timedOut = (what) => {
143
+ const error = new Error(
144
+ `${what} exceeded this run's ${loadDeadline} ms deadline for ${table}; the next run checks the job again`
145
+ );
146
+ Object.defineProperty(error, "adcpDeadlineExceeded", { value: true });
147
+ Object.defineProperty(error, "adcpLoadTimedOut", { value: true });
148
+ return error;
149
+ };
150
+ if (status === "missing") {
97
151
  try {
98
- await withinDeadline(
99
- () => dataset.table(tableId).load(file, {
100
- jobId,
101
- sourceFormat: "NEWLINE_DELIMITED_JSON",
102
- writeDisposition: "WRITE_APPEND",
103
- ...options.location ? { location: options.location } : {}
104
- }),
105
- loadDeadline,
106
- signal
107
- );
152
+ const running = uploads.get(jobId);
153
+ const upload = running && Date.now() - running.startedAt < MAX_LOAD_TIMEOUT ? running.done : startUpload(tableId, jobId, lines);
154
+ await withinDeadline(() => upload, Math.max(deadlineAt - Date.now(), 1), signal);
155
+ return;
108
156
  } catch (error) {
109
- if (isDeadlineExceeded(error)) await cancelLoad(jobId, signal);
157
+ if (isDeadlineExceeded(error)) throw timedOut("Uploading the load");
110
158
  if (!isAlreadyExists(error)) throw error;
111
- const metadata = await withinDeadline(
112
- () => options.bigquery.job(jobId, jobOptions).getMetadata(),
113
- loadTimeout,
114
- signal
115
- );
116
- assertJobSucceeded(metadata);
159
+ status = await jobStatus(jobId, signal, loadTimeout, table);
160
+ if (status === "missing") {
161
+ throw new Error(
162
+ "BigQuery refused the load job ID as already existing, but the job cannot be found. Check that projectId and location match the dataset (location is required for datasets outside the US and EU multi-regions)",
163
+ { cause: error }
164
+ );
165
+ }
166
+ }
167
+ }
168
+ const pollMilliseconds = Math.min(5e3, Math.max(250, Math.floor(loadDeadline / 10)));
169
+ while (status !== "done") {
170
+ const remaining = deadlineAt - Date.now();
171
+ if (remaining <= 0) throw timedOut("Waiting for the running load job");
172
+ await sleep(Math.min(pollMilliseconds, remaining), signal);
173
+ const bound = Math.max(Math.min(loadTimeout, deadlineAt - Date.now()), 1);
174
+ try {
175
+ status = await jobStatus(jobId, signal, bound, table);
176
+ } catch (error) {
177
+ if (isDeadlineExceeded(error) && bound < loadTimeout) throw timedOut("Waiting for the running load job");
178
+ throw error;
117
179
  }
118
- } finally {
119
- await fs.rm(directory, { recursive: true, force: true });
180
+ if (status === "missing") throw new Error("A BigQuery load job for this batch disappeared while it was awaited");
120
181
  }
121
182
  }
122
183
  return {
@@ -131,6 +192,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
131
192
  `UPDATE adcp_reporting_warehouse_sinks
132
193
  SET committed_cursor = NULL, planned_from_cursor = NULL, planned_to_cursor = NULL,
133
194
  planned_revisions = NULL, planned_rows_attempt = 0, planned_revisions_attempt = 0,
195
+ planned_rows_timeouts = 0, planned_revisions_timeouts = 0,
134
196
  reset_generation = reset_generation + 1, updated_at = clock_timestamp()
135
197
  WHERE sink_name = $1 AND ($2::boolean OR planned_to_cursor IS NULL)
136
198
  RETURNING sink_name`,
@@ -164,7 +226,8 @@ function createBigQueryReportingWarehouseSinkV1(options) {
164
226
  );
165
227
  const state = (await options.db.query(
166
228
  `SELECT committed_cursor, planned_from_cursor, planned_to_cursor, planned_revisions,
167
- planned_rows_attempt, planned_revisions_attempt, reset_generation
229
+ planned_rows_attempt, planned_revisions_attempt,
230
+ planned_rows_timeouts, planned_revisions_timeouts, reset_generation
168
231
  FROM adcp_reporting_warehouse_sinks WHERE sink_name = $1`,
169
232
  [options.name]
170
233
  ).catch(missingMigration)).rows[0];
@@ -183,7 +246,9 @@ function createBigQueryReportingWarehouseSinkV1(options) {
183
246
  to: state.planned_to_cursor,
184
247
  revisions: state.planned_revisions,
185
248
  rowsAttempt: state.planned_rows_attempt,
186
- revisionsAttempt: state.planned_revisions_attempt
249
+ revisionsAttempt: state.planned_revisions_attempt,
250
+ rowsTimeouts: state.planned_rows_timeouts,
251
+ revisionsTimeouts: state.planned_revisions_timeouts
187
252
  } : void 0;
188
253
  if (!plan) {
189
254
  const position = {
@@ -232,12 +297,15 @@ function createBigQueryReportingWarehouseSinkV1(options) {
232
297
  to: page.cursor,
233
298
  revisions: page.records.filter((record) => record.kind === "revision").map((record) => ({ id: record.record_id, account_id: record.account_id })),
234
299
  rowsAttempt: 0,
235
- revisionsAttempt: 0
300
+ revisionsAttempt: 0,
301
+ rowsTimeouts: 0,
302
+ revisionsTimeouts: 0
236
303
  };
237
304
  const claimed = await options.db.query(
238
305
  `UPDATE adcp_reporting_warehouse_sinks
239
306
  SET planned_from_cursor = $2, planned_to_cursor = $3, planned_revisions = $4::jsonb,
240
- planned_rows_attempt = 0, planned_revisions_attempt = 0, updated_at = clock_timestamp()
307
+ planned_rows_attempt = 0, planned_revisions_attempt = 0,
308
+ planned_rows_timeouts = 0, planned_revisions_timeouts = 0, updated_at = clock_timestamp()
241
309
  WHERE sink_name = $1 AND committed_cursor IS NOT DISTINCT FROM $2
242
310
  AND planned_to_cursor IS NULL AND planned_revisions IS NULL AND reset_generation = $5
243
311
  RETURNING sink_name`,
@@ -257,6 +325,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
257
325
  const rowLines = [];
258
326
  const revisionLines = [];
259
327
  const missing = [];
328
+ const resolved = [];
260
329
  for (const planned of plan.revisions) {
261
330
  signal?.throwIfAborted();
262
331
  const revision = await options.store.getRevisionMetadata(planned.id, planned.account_id);
@@ -264,10 +333,10 @@ function createBigQueryReportingWarehouseSinkV1(options) {
264
333
  missing.push(planned.id);
265
334
  continue;
266
335
  }
267
- const periodDate = sourceLocalDate(
268
- revision.wireRevision.period?.start,
269
- revision.wireRevision.period?.source_timezone
270
- );
336
+ resolved.push({ planned, revision, periodDate: periodDateOf(revision) });
337
+ }
338
+ for (const { planned, revision, periodDate } of resolved) {
339
+ signal?.throwIfAborted();
271
340
  const base = {
272
341
  reporting_revision_id: revision.reporting_revision_id,
273
342
  reporting_obligation_id: revision.reporting_obligation_id,
@@ -296,9 +365,9 @@ function createBigQueryReportingWarehouseSinkV1(options) {
296
365
  JSON.stringify({
297
366
  ...base,
298
367
  supersedes_reporting_revision_id: revision.supersedes_reporting_revision_id ?? null,
299
- period_start: revision.wireRevision.period?.start ?? null,
300
- period_end: revision.wireRevision.period?.end ?? null,
301
- source_timezone: revision.wireRevision.period?.source_timezone ?? null,
368
+ period_start: revision.wireRevision.period.start,
369
+ period_end: revision.wireRevision.period.end,
370
+ source_timezone: revision.wireRevision.period.source_timezone,
302
371
  observed_at: revision.observedAt,
303
372
  data_through: revision.dataThrough,
304
373
  revision_content_sha256: revision.binding.sha256,
@@ -310,27 +379,52 @@ function createBigQueryReportingWarehouseSinkV1(options) {
310
379
  const baseJobId = reportingWarehouseJobIdV1(options.name, plan.from, plan.to, state.reset_generation);
311
380
  const suffix = (attempt) => attempt ? `_a${attempt}` : "";
312
381
  const steps = [
313
- { table: options.rowsTableId, kind: "rows", lines: rowLines, attempt: plan.rowsAttempt },
314
- { table: options.revisionsTableId, kind: "revs", lines: revisionLines, attempt: plan.revisionsAttempt }
382
+ {
383
+ table: options.rowsTableId,
384
+ role: "rows",
385
+ kind: "rows",
386
+ lines: rowLines,
387
+ attempt: plan.rowsAttempt,
388
+ timeouts: plan.rowsTimeouts,
389
+ timeoutColumn: "planned_rows_timeouts",
390
+ attemptColumn: "planned_rows_attempt"
391
+ },
392
+ {
393
+ table: options.revisionsTableId,
394
+ role: "revisions",
395
+ kind: "revs",
396
+ lines: revisionLines,
397
+ attempt: plan.revisionsAttempt,
398
+ timeouts: plan.revisionsTimeouts,
399
+ timeoutColumn: "planned_revisions_timeouts",
400
+ attemptColumn: "planned_revisions_attempt"
401
+ }
315
402
  ];
316
403
  for (const step of steps) {
317
404
  if (!step.lines.length) continue;
318
405
  try {
319
406
  await loadOnce(
407
+ step.role,
320
408
  step.table,
321
409
  `${baseJobId}_${step.kind}${suffix(step.attempt)}`,
322
410
  [...step.lines],
323
- step.attempt,
411
+ step.timeouts,
324
412
  signal
325
413
  );
326
414
  } catch (error) {
327
415
  if (isFinishedWithError(error)) {
328
- const column = step.kind === "rows" ? "planned_rows_attempt" : "planned_revisions_attempt";
329
416
  await options.db.query(
330
- `UPDATE adcp_reporting_warehouse_sinks SET ${column} = ${column} + 1,
417
+ `UPDATE adcp_reporting_warehouse_sinks SET ${step.attemptColumn} = ${step.attemptColumn} + 1,
331
418
  updated_at = clock_timestamp() ${matchesPlan}`,
332
419
  planValues
333
420
  );
421
+ } else if (isLoadTimedOut(error)) {
422
+ await options.db.query(
423
+ `UPDATE adcp_reporting_warehouse_sinks
424
+ SET ${step.timeoutColumn} = $8::integer + 1, updated_at = clock_timestamp()
425
+ ${matchesPlan} AND ${step.timeoutColumn} = $8::integer`,
426
+ [...planValues, step.timeouts]
427
+ );
334
428
  }
335
429
  throw error;
336
430
  }
@@ -339,7 +433,7 @@ function createBigQueryReportingWarehouseSinkV1(options) {
339
433
  `UPDATE adcp_reporting_warehouse_sinks
340
434
  SET committed_cursor = $3, planned_from_cursor = NULL, planned_to_cursor = NULL,
341
435
  planned_revisions = NULL, planned_rows_attempt = 0, planned_revisions_attempt = 0,
342
- updated_at = clock_timestamp()
436
+ planned_rows_timeouts = 0, planned_revisions_timeouts = 0, updated_at = clock_timestamp()
343
437
  ${matchesPlan} RETURNING sink_name`,
344
438
  planValues
345
439
  );
@@ -358,6 +452,9 @@ function missingMigration(error) {
358
452
  }
359
453
  throw error;
360
454
  }
455
+ function reportingWarehouseLoadDeadlineV1(baseMilliseconds, timeouts) {
456
+ return Math.min(baseMilliseconds * 2 ** Math.min(Math.max(timeouts, 0), MAX_TIMEOUT_DOUBLINGS), MAX_LOAD_TIMEOUT);
457
+ }
361
458
  function reportingWarehouseJobIdV1(name, from, to, generation = 0) {
362
459
  return `adcp_rr_${createHash("sha256").update(JSON.stringify(generation > 0 ? [name, from, to, generation] : [name, from, to])).digest("hex").slice(0, 40)}`;
363
460
  }
@@ -414,23 +511,19 @@ SELECT row_data.*
414
511
  ) AS current_revision
415
512
  USING (reporting_obligation_id, reporting_revision_id);`.trim();
416
513
  }
417
- function sourceLocalDate(start, timeZone) {
418
- if (!start) return null;
419
- const instant = new Date(start);
420
- if (Number.isNaN(instant.getTime())) return null;
514
+ function periodDateOf(revision) {
515
+ const period = revision.wireRevision.period;
421
516
  try {
422
- const parts = new Intl.DateTimeFormat("en-CA", {
423
- timeZone: timeZone ?? "UTC",
424
- year: "numeric",
425
- month: "2-digit",
426
- day: "2-digit"
427
- }).format(instant);
428
- return parts;
429
- } catch {
430
- return instant.toISOString().slice(0, 10);
517
+ if (!period) throw new TypeError("the revision carries no period");
518
+ return reportingPeriodDate(period.start, period.source_timezone);
519
+ } catch (error) {
520
+ throw new Error(
521
+ `Cannot compute period_date for revision ${revision.reporting_revision_id}: ${error instanceof Error ? error.message : String(error)}. The batch stays retained and every run fails until the revision's period is repaired (or, if this runtime's timezone data is older than the writer's, until it is upgraded); reset({ discardRetainedPlan: true }) restarts from the beginning, so empty the destination tables first.`,
522
+ { cause: error }
523
+ );
431
524
  }
432
525
  }
433
- async function withinDeadline(operation, milliseconds, signal) {
526
+ async function withinDeadline(operation, milliseconds, signal, context) {
434
527
  signal?.throwIfAborted();
435
528
  let timer;
436
529
  let onAbort;
@@ -439,7 +532,9 @@ async function withinDeadline(operation, milliseconds, signal) {
439
532
  operation(),
440
533
  new Promise((_, reject) => {
441
534
  timer = setTimeout(() => {
442
- const error = new Error("BigQuery call exceeded its deadline; the batch will be retried");
535
+ const error = new Error(
536
+ `BigQuery call exceeded its deadline${context ? ` of ${milliseconds} ms for ${context}` : ""}; the batch will be retried`
537
+ );
443
538
  Object.defineProperty(error, "adcpDeadlineExceeded", { value: true });
444
539
  reject(error);
445
540
  }, milliseconds);
@@ -461,24 +556,31 @@ function isAlreadyExists(error) {
461
556
  const record = error;
462
557
  return record?.code === 409 || !!record?.errors?.some((entry) => entry.reason === "duplicate");
463
558
  }
559
+ function isLoadTimedOut(error) {
560
+ return error?.adcpLoadTimedOut === true;
561
+ }
562
+ function sleep(milliseconds, signal) {
563
+ signal?.throwIfAborted();
564
+ return new Promise((resolve, reject) => {
565
+ const onAbort = () => {
566
+ clearTimeout(timer);
567
+ reject(signal?.reason ?? new Error("aborted"));
568
+ };
569
+ const timer = setTimeout(() => {
570
+ signal?.removeEventListener("abort", onAbort);
571
+ resolve();
572
+ }, milliseconds);
573
+ signal?.addEventListener("abort", onAbort, { once: true });
574
+ });
575
+ }
464
576
  function isFinishedWithError(error) {
465
577
  return error?.adcpJobFailed === true;
466
578
  }
467
- function assertJobSucceeded(metadata) {
468
- const record = Array.isArray(metadata) ? metadata[0] : metadata;
469
- if (record?.status?.state !== "DONE") {
470
- throw new Error("A BigQuery load job for this batch is still running; retry later");
471
- }
472
- if (record.status.errorResult) {
473
- const failure = new Error("A BigQuery load job for this batch failed; it will be retried as a new attempt");
474
- Object.defineProperty(failure, "adcpJobFailed", { value: true });
475
- throw failure;
476
- }
477
- }
478
579
  export {
479
580
  REPORTING_WAREHOUSE_SINK_MIGRATION,
480
581
  createBigQueryReportingWarehouseSinkV1,
481
582
  reportingWarehouseCurrentRowsViewSqlV1,
482
583
  reportingWarehouseDefaultTablesSqlV1,
483
- reportingWarehouseJobIdV1
584
+ reportingWarehouseJobIdV1,
585
+ reportingWarehouseLoadDeadlineV1
484
586
  };
@@ -5,6 +5,9 @@ import type { ReportingLedgerStore } from '../ledger/types.mjs';
5
5
  import { type ReportingObjectWriteAuthorityStoreV1 } from '../ledger/object-writes.mjs';
6
6
  import { type GcsReportingReaderOptionsV1 } from './reader.mjs';
7
7
  type DeliveryInput = Parameters<ReportingManagedDeliveryAdapterV1['deliver']>[0];
8
+ /**
9
+ * @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
10
+ */
8
11
  export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
9
12
  storage: Storage;
10
13
  coreStore: ReportingLedgerStore;
@@ -24,7 +27,11 @@ export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
24
27
  operationDeadlineMilliseconds?: number;
25
28
  minimumResourceRetentionDays?: number;
26
29
  }
27
- /** Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime. */
30
+ /**
31
+ * Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime.
32
+ *
33
+ * @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
34
+ */
28
35
  export declare function createGcsReportingManagedDeliveryAdapterV1(options: CreateGcsReportingManagedDeliveryAdapterOptionsV1, context?: {
29
36
  signal?: AbortSignal;
30
37
  }): Promise<ReportingManagedDeliveryAdapterV1>;
@@ -5,6 +5,9 @@ import type { ReportingLedgerStore } from '../ledger/types';
5
5
  import { type ReportingObjectWriteAuthorityStoreV1 } from '../ledger/object-writes';
6
6
  import { type GcsReportingReaderOptionsV1 } from './reader';
7
7
  type DeliveryInput = Parameters<ReportingManagedDeliveryAdapterV1['deliver']>[0];
8
+ /**
9
+ * @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
10
+ */
8
11
  export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
9
12
  storage: Storage;
10
13
  coreStore: ReportingLedgerStore;
@@ -24,7 +27,11 @@ export interface CreateGcsReportingManagedDeliveryAdapterOptionsV1 {
24
27
  operationDeadlineMilliseconds?: number;
25
28
  minimumResourceRetentionDays?: number;
26
29
  }
27
- /** Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime. */
30
+ /**
31
+ * Complete file-transfer adapter. Availability and cleanup lease commits remain with the managed runtime.
32
+ *
33
+ * @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
34
+ */
28
35
  export declare function createGcsReportingManagedDeliveryAdapterV1(options: CreateGcsReportingManagedDeliveryAdapterOptionsV1, context?: {
29
36
  signal?: AbortSignal;
30
37
  }): Promise<ReportingManagedDeliveryAdapterV1>;
@@ -1,5 +1,11 @@
1
+ /**
2
+ * @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
3
+ */
1
4
  export declare class ReportingGcsFenceError extends Error {
2
5
  readonly code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE';
3
6
  constructor(code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE');
4
7
  }
8
+ /**
9
+ * @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
10
+ */
5
11
  export declare function isReportingGcsFenceError(error: unknown): error is ReportingGcsFenceError;
@@ -1,5 +1,11 @@
1
+ /**
2
+ * @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
3
+ */
1
4
  export declare class ReportingGcsFenceError extends Error {
2
5
  readonly code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE';
3
6
  constructor(code: 'INVALID_INPUT' | 'UNSAFE_BUCKET' | 'REVOKED' | 'NOT_REVOKED' | 'CONTENT_CONFLICT' | 'ABORTED' | 'PROVIDER_UNAVAILABLE' | 'DEADLINE_EXCEEDED' | 'HOST_CALLBACK_FAILED' | 'STATE_UNAVAILABLE');
4
7
  }
8
+ /**
9
+ * @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
10
+ */
5
11
  export declare function isReportingGcsFenceError(error: unknown): error is ReportingGcsFenceError;
@@ -1,6 +1,9 @@
1
1
  import type { Storage } from '@google-cloud/storage';
2
2
  import { type ReportingObjectWriteScopeV1, type ReportingObjectWritePlanV1, type ReportingObjectWriteStoreV1 } from '../ledger/object-writes.mjs';
3
3
  export { ReportingGcsFenceError } from './errors.mjs';
4
+ /**
5
+ * @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
6
+ */
4
7
  export interface GcsReportingObjectFenceV1 {
5
8
  probe(context?: {
6
9
  signal?: AbortSignal;
@@ -25,6 +28,8 @@ export interface GcsReportingObjectFenceV1 {
25
28
  * Bucket configuration must remain managed exclusively by the trusted host.
26
29
  * Tombstones and inventory MUST NOT be deleted while stale requests can execute.
27
30
  * Inject the official Storage client with host-owned, keyless credentials.
31
+ *
32
+ * @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
28
33
  */
29
34
  export declare function createGcsReportingObjectFenceV1(options: {
30
35
  storage: Storage;
@@ -1,6 +1,9 @@
1
1
  import type { Storage } from '@google-cloud/storage';
2
2
  import { type ReportingObjectWriteScopeV1, type ReportingObjectWritePlanV1, type ReportingObjectWriteStoreV1 } from '../ledger/object-writes';
3
3
  export { ReportingGcsFenceError } from './errors';
4
+ /**
5
+ * @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
6
+ */
4
7
  export interface GcsReportingObjectFenceV1 {
5
8
  probe(context?: {
6
9
  signal?: AbortSignal;
@@ -25,6 +28,8 @@ export interface GcsReportingObjectFenceV1 {
25
28
  * Bucket configuration must remain managed exclusively by the trusted host.
26
29
  * Tombstones and inventory MUST NOT be deleted while stale requests can execute.
27
30
  * Inject the official Storage client with host-owned, keyless credentials.
31
+ *
32
+ * @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
28
33
  */
29
34
  export declare function createGcsReportingObjectFenceV1(options: {
30
35
  storage: Storage;
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Google Cloud Storage fence, reader, managed-delivery adapter and row-object provider for Reliable Reporting.
3
+ *
4
+ * Every export of this subpath is `@experimental` and may change in minor releases.
5
+ *
6
+ * Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
7
+ *
8
+ * @packageDocumentation
9
+ */
1
10
  export { createGcsReportingObjectFenceV1 } from './fence.mjs';
2
11
  export type { GcsReportingObjectFenceV1 } from './fence.mjs';
3
12
  export { ReportingGcsFenceError, isReportingGcsFenceError } from './errors.mjs';
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Google Cloud Storage fence, reader, managed-delivery adapter and row-object provider for Reliable Reporting.
3
+ *
4
+ * Every export of this subpath is `@experimental` and may change in minor releases.
5
+ *
6
+ * Stability policy: https://github.com/adcontextprotocol/adcp-client/blob/main/docs/guides/REPORTING-STABILITY.md
7
+ *
8
+ * @packageDocumentation
9
+ */
1
10
  export { createGcsReportingObjectFenceV1 } from './fence';
2
11
  export type { GcsReportingObjectFenceV1 } from './fence';
3
12
  export { ReportingGcsFenceError, isReportingGcsFenceError } from './errors';
@@ -2,16 +2,25 @@ import type { Storage } from '@google-cloud/storage';
2
2
  import { type CanonicalReferenceResolver } from '../../canonical-references/index.mjs';
3
3
  import type { ReportingResourceReader } from '../inspection.mjs';
4
4
  import { type ReportingObjectWriteScopeV1 } from '../ledger/object-writes.mjs';
5
+ /**
6
+ * @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
7
+ */
5
8
  export interface GcsReportingReadScopeV1 extends ReportingObjectWriteScopeV1 {
6
9
  /** Non-secret identity from the host's authenticated principal registry. Never a bearer. */
7
10
  principal_id: string;
8
11
  }
12
+ /**
13
+ * @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
14
+ */
9
15
  export interface GcsReportingReadAuthorizationV1 {
10
16
  scope: Readonly<GcsReportingReadScopeV1>;
11
17
  bucket: string;
12
18
  objectPrefix: string;
13
19
  objectName: string;
14
20
  }
21
+ /**
22
+ * @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
23
+ */
15
24
  export interface GcsReportingReaderOptionsV1 {
16
25
  scope: GcsReportingReadScopeV1;
17
26
  bucket: string;
@@ -30,14 +39,29 @@ export interface GcsReportingReaderOptionsV1 {
30
39
  operationDeadlineMilliseconds?: number;
31
40
  maxBytes?: number;
32
41
  }
33
- /** Restrictive provider-native URL grammar: no credentials, queries, encoding or traversal. */
42
+ /**
43
+ * Restrictive provider-native URL grammar: no credentials, queries, encoding or traversal.
44
+ *
45
+ * @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
46
+ */
34
47
  export declare function gcsReportingObjectFromUriV1(uri: string, bucket: string, prefix: string): string;
48
+ /**
49
+ * @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
50
+ */
35
51
  export declare function createGcsScopedObjectReadV1(options: GcsReportingReaderOptionsV1): (uri: string, maxBytes: number, signal?: AbortSignal, nativeVersion?: string) => Promise<{
36
52
  body: Buffer<ArrayBufferLike>;
37
53
  contentType: string | undefined;
38
54
  generation: string;
39
55
  }>;
40
- /** Destination-bound manifest/object reader. The caller never supplies bucket or credential scope. */
56
+ /**
57
+ * Destination-bound manifest/object reader. The caller never supplies bucket or credential scope.
58
+ *
59
+ * @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
60
+ */
41
61
  export declare function createGcsReportingResourceReaderV1(options: GcsReportingReaderOptionsV1): ReportingResourceReader;
42
- /** Digest-pinned private contract resolver; all resolutions re-authorize and bypass caches. */
62
+ /**
63
+ * Digest-pinned private contract resolver; all resolutions re-authorize and bypass caches.
64
+ *
65
+ * @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
66
+ */
43
67
  export declare function createGcsReportingReferenceResolverV1(options: GcsReportingReaderOptionsV1): CanonicalReferenceResolver;