@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
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var gcs_exports = {};
20
- __export(gcs_exports, {
21
- ReportingGcsFenceError: () => import_errors.ReportingGcsFenceError,
22
- createGcsReportingManagedDeliveryAdapterV1: () => import_adapter.createGcsReportingManagedDeliveryAdapterV1,
23
- createGcsReportingObjectFenceV1: () => import_fence.createGcsReportingObjectFenceV1,
24
- createGcsReportingReferenceResolverV1: () => import_reader.createGcsReportingReferenceResolverV1,
25
- createGcsReportingResourceReaderV1: () => import_reader.createGcsReportingResourceReaderV1,
26
- createGcsReportingRowObjectProviderV1: () => import_row_provider.createGcsReportingRowObjectProviderV1,
27
- isReportingGcsFenceError: () => import_errors.isReportingGcsFenceError
28
- });
29
- module.exports = __toCommonJS(gcs_exports);
30
- var import_fence = require('./fence.js');
31
- var import_errors = require('./errors.js');
32
- var import_reader = require('./reader.js');
33
- var import_adapter = require('./adapter.js');
34
- var import_row_provider = require('./row-provider.js');
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- ReportingGcsFenceError,
38
- createGcsReportingManagedDeliveryAdapterV1,
39
- createGcsReportingObjectFenceV1,
40
- createGcsReportingReferenceResolverV1,
41
- createGcsReportingResourceReaderV1,
42
- createGcsReportingRowObjectProviderV1,
43
- isReportingGcsFenceError
44
- });
@@ -1,14 +0,0 @@
1
- import { createGcsReportingObjectFenceV1 } from "./fence.mjs";
2
- import { ReportingGcsFenceError, isReportingGcsFenceError } from "./errors.mjs";
3
- import { createGcsReportingResourceReaderV1, createGcsReportingReferenceResolverV1 } from "./reader.mjs";
4
- import { createGcsReportingManagedDeliveryAdapterV1 } from "./adapter.mjs";
5
- import { createGcsReportingRowObjectProviderV1 } from "./row-provider.mjs";
6
- export {
7
- ReportingGcsFenceError,
8
- createGcsReportingManagedDeliveryAdapterV1,
9
- createGcsReportingObjectFenceV1,
10
- createGcsReportingReferenceResolverV1,
11
- createGcsReportingResourceReaderV1,
12
- createGcsReportingRowObjectProviderV1,
13
- isReportingGcsFenceError
14
- };
@@ -1,7 +0,0 @@
1
- import type { File } from '@google-cloud/storage';
2
- export declare function activeGcsSignal(signal: AbortSignal): void;
3
- export declare function withGcsDeadline<T>(work: (signal: AbortSignal) => Promise<T>, context?: {
4
- signal?: AbortSignal;
5
- milliseconds?: number;
6
- }): Promise<T>;
7
- export declare function readGcsBytes(file: File, maxBytes: number, signal: AbortSignal): Promise<Buffer>;
@@ -1,7 +0,0 @@
1
- import type { File } from '@google-cloud/storage';
2
- export declare function activeGcsSignal(signal: AbortSignal): void;
3
- export declare function withGcsDeadline<T>(work: (signal: AbortSignal) => Promise<T>, context?: {
4
- signal?: AbortSignal;
5
- milliseconds?: number;
6
- }): Promise<T>;
7
- export declare function readGcsBytes(file: File, maxBytes: number, signal: AbortSignal): Promise<Buffer>;
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var io_exports = {};
20
- __export(io_exports, {
21
- activeGcsSignal: () => activeGcsSignal,
22
- readGcsBytes: () => readGcsBytes,
23
- withGcsDeadline: () => withGcsDeadline
24
- });
25
- module.exports = __toCommonJS(io_exports);
26
- var import_object_writes = require('../ledger/object-writes.js');
27
- var import_errors = require('./errors.js');
28
- function activeGcsSignal(signal) {
29
- if (signal.aborted) throw signal.reason;
30
- }
31
- const active = activeGcsSignal;
32
- async function withGcsDeadline(work, context = {}) {
33
- const signal = context.signal;
34
- const deadline = context.milliseconds ?? 6e4;
35
- if (!Number.isSafeInteger(deadline) || deadline < 1 || deadline > 6e4)
36
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
37
- if (signal !== void 0 && !(signal instanceof AbortSignal)) throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
38
- const controller = new AbortController();
39
- const onAbort = () => controller.abort(new import_errors.ReportingGcsFenceError("ABORTED"));
40
- signal?.addEventListener("abort", onAbort, { once: true });
41
- if (signal?.aborted) onAbort();
42
- const timer = setTimeout(() => controller.abort(new import_errors.ReportingGcsFenceError("DEADLINE_EXCEEDED")), deadline);
43
- let rejectAbort;
44
- try {
45
- active(controller.signal);
46
- return await Promise.race([
47
- work(controller.signal),
48
- new Promise((_, reject) => {
49
- rejectAbort = () => reject(controller.signal.reason);
50
- controller.signal.addEventListener("abort", rejectAbort, { once: true });
51
- if (controller.signal.aborted) rejectAbort();
52
- })
53
- ]);
54
- } catch (error) {
55
- if (controller.signal.aborted) throw controller.signal.reason;
56
- if ((0, import_errors.isReportingGcsFenceError)(error)) throw error;
57
- if ((0, import_object_writes.isReportingObjectWriteConflictError)(error) || error instanceof Error && (0, import_object_writes.isReportingObjectWriteConflictError)(error.cause))
58
- throw new import_errors.ReportingGcsFenceError("CONTENT_CONFLICT");
59
- if ((0, import_object_writes.isReportingObjectWriteNotRevokedError)(error) || error instanceof Error && (0, import_object_writes.isReportingObjectWriteNotRevokedError)(error.cause))
60
- throw new import_errors.ReportingGcsFenceError("NOT_REVOKED");
61
- throw new import_errors.ReportingGcsFenceError("STATE_UNAVAILABLE");
62
- } finally {
63
- clearTimeout(timer);
64
- signal?.removeEventListener("abort", onAbort);
65
- if (rejectAbort) controller.signal.removeEventListener("abort", rejectAbort);
66
- }
67
- }
68
- async function readGcsBytes(file, maxBytes, signal) {
69
- active(signal);
70
- const stream = file.createReadStream();
71
- const abort = () => stream.destroy(new import_errors.ReportingGcsFenceError("ABORTED"));
72
- signal.addEventListener("abort", abort, { once: true });
73
- if (signal.aborted) abort();
74
- const chunks = [];
75
- let count = 0;
76
- try {
77
- for await (const chunk of stream) {
78
- active(signal);
79
- count += chunk.length;
80
- if (count > maxBytes) throw new import_errors.ReportingGcsFenceError("CONTENT_CONFLICT");
81
- chunks.push(Buffer.from(chunk));
82
- }
83
- active(signal);
84
- return Buffer.concat(chunks);
85
- } finally {
86
- signal.removeEventListener("abort", abort);
87
- stream.destroy();
88
- }
89
- }
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- activeGcsSignal,
93
- readGcsBytes,
94
- withGcsDeadline
95
- });
@@ -1,69 +0,0 @@
1
- import { isReportingObjectWriteConflictError, isReportingObjectWriteNotRevokedError } from "../ledger/object-writes.mjs";
2
- import { ReportingGcsFenceError, isReportingGcsFenceError } from "./errors.mjs";
3
- function activeGcsSignal(signal) {
4
- if (signal.aborted) throw signal.reason;
5
- }
6
- const active = activeGcsSignal;
7
- async function withGcsDeadline(work, context = {}) {
8
- const signal = context.signal;
9
- const deadline = context.milliseconds ?? 6e4;
10
- if (!Number.isSafeInteger(deadline) || deadline < 1 || deadline > 6e4)
11
- throw new ReportingGcsFenceError("INVALID_INPUT");
12
- if (signal !== void 0 && !(signal instanceof AbortSignal)) throw new ReportingGcsFenceError("INVALID_INPUT");
13
- const controller = new AbortController();
14
- const onAbort = () => controller.abort(new ReportingGcsFenceError("ABORTED"));
15
- signal?.addEventListener("abort", onAbort, { once: true });
16
- if (signal?.aborted) onAbort();
17
- const timer = setTimeout(() => controller.abort(new ReportingGcsFenceError("DEADLINE_EXCEEDED")), deadline);
18
- let rejectAbort;
19
- try {
20
- active(controller.signal);
21
- return await Promise.race([
22
- work(controller.signal),
23
- new Promise((_, reject) => {
24
- rejectAbort = () => reject(controller.signal.reason);
25
- controller.signal.addEventListener("abort", rejectAbort, { once: true });
26
- if (controller.signal.aborted) rejectAbort();
27
- })
28
- ]);
29
- } catch (error) {
30
- if (controller.signal.aborted) throw controller.signal.reason;
31
- if (isReportingGcsFenceError(error)) throw error;
32
- if (isReportingObjectWriteConflictError(error) || error instanceof Error && isReportingObjectWriteConflictError(error.cause))
33
- throw new ReportingGcsFenceError("CONTENT_CONFLICT");
34
- if (isReportingObjectWriteNotRevokedError(error) || error instanceof Error && isReportingObjectWriteNotRevokedError(error.cause))
35
- throw new ReportingGcsFenceError("NOT_REVOKED");
36
- throw new ReportingGcsFenceError("STATE_UNAVAILABLE");
37
- } finally {
38
- clearTimeout(timer);
39
- signal?.removeEventListener("abort", onAbort);
40
- if (rejectAbort) controller.signal.removeEventListener("abort", rejectAbort);
41
- }
42
- }
43
- async function readGcsBytes(file, maxBytes, signal) {
44
- active(signal);
45
- const stream = file.createReadStream();
46
- const abort = () => stream.destroy(new ReportingGcsFenceError("ABORTED"));
47
- signal.addEventListener("abort", abort, { once: true });
48
- if (signal.aborted) abort();
49
- const chunks = [];
50
- let count = 0;
51
- try {
52
- for await (const chunk of stream) {
53
- active(signal);
54
- count += chunk.length;
55
- if (count > maxBytes) throw new ReportingGcsFenceError("CONTENT_CONFLICT");
56
- chunks.push(Buffer.from(chunk));
57
- }
58
- active(signal);
59
- return Buffer.concat(chunks);
60
- } finally {
61
- signal.removeEventListener("abort", abort);
62
- stream.destroy();
63
- }
64
- }
65
- export {
66
- activeGcsSignal,
67
- readGcsBytes,
68
- withGcsDeadline
69
- };
@@ -1,67 +0,0 @@
1
- import type { Storage } from '@google-cloud/storage';
2
- import { type CanonicalReferenceResolver } from '../../canonical-references/index.mjs';
3
- import type { ReportingResourceReader } from '../inspection.mjs';
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
- */
8
- export interface GcsReportingReadScopeV1 extends ReportingObjectWriteScopeV1 {
9
- /** Non-secret identity from the host's authenticated principal registry. Never a bearer. */
10
- principal_id: string;
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
- */
15
- export interface GcsReportingReadAuthorizationV1 {
16
- scope: Readonly<GcsReportingReadScopeV1>;
17
- bucket: string;
18
- objectPrefix: string;
19
- objectName: string;
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
- */
24
- export interface GcsReportingReaderOptionsV1 {
25
- scope: GcsReportingReadScopeV1;
26
- bucket: string;
27
- /** Exact saved destination prefix, including the trailing slash. */
28
- objectPrefix: string;
29
- /** Resolve an official client with keyless credentials for this operation. */
30
- getStorage(scope: Readonly<GcsReportingReadScopeV1>, context: {
31
- signal: AbortSignal;
32
- }): Promise<Storage>;
33
- /** Host verifies principal/account/destination ownership and the current grant generation. */
34
- authorize(request: Readonly<GcsReportingReadAuthorizationV1>, context: {
35
- signal: AbortSignal;
36
- }): Promise<boolean>;
37
- /** Optional operation lifetime, composed with each read deadline/caller signal. */
38
- signal?: AbortSignal;
39
- operationDeadlineMilliseconds?: number;
40
- maxBytes?: number;
41
- }
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
- */
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
- */
51
- export declare function createGcsScopedObjectReadV1(options: GcsReportingReaderOptionsV1): (uri: string, maxBytes: number, signal?: AbortSignal, nativeVersion?: string) => Promise<{
52
- body: Buffer<ArrayBufferLike>;
53
- contentType: string | undefined;
54
- generation: string;
55
- }>;
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
- */
61
- export declare function createGcsReportingResourceReaderV1(options: GcsReportingReaderOptionsV1): ReportingResourceReader;
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
- */
67
- export declare function createGcsReportingReferenceResolverV1(options: GcsReportingReaderOptionsV1): CanonicalReferenceResolver;
@@ -1,67 +0,0 @@
1
- import type { Storage } from '@google-cloud/storage';
2
- import { type CanonicalReferenceResolver } from '../../canonical-references';
3
- import type { ReportingResourceReader } from '../inspection';
4
- import { type ReportingObjectWriteScopeV1 } from '../ledger/object-writes';
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
- */
8
- export interface GcsReportingReadScopeV1 extends ReportingObjectWriteScopeV1 {
9
- /** Non-secret identity from the host's authenticated principal registry. Never a bearer. */
10
- principal_id: string;
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
- */
15
- export interface GcsReportingReadAuthorizationV1 {
16
- scope: Readonly<GcsReportingReadScopeV1>;
17
- bucket: string;
18
- objectPrefix: string;
19
- objectName: string;
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
- */
24
- export interface GcsReportingReaderOptionsV1 {
25
- scope: GcsReportingReadScopeV1;
26
- bucket: string;
27
- /** Exact saved destination prefix, including the trailing slash. */
28
- objectPrefix: string;
29
- /** Resolve an official client with keyless credentials for this operation. */
30
- getStorage(scope: Readonly<GcsReportingReadScopeV1>, context: {
31
- signal: AbortSignal;
32
- }): Promise<Storage>;
33
- /** Host verifies principal/account/destination ownership and the current grant generation. */
34
- authorize(request: Readonly<GcsReportingReadAuthorizationV1>, context: {
35
- signal: AbortSignal;
36
- }): Promise<boolean>;
37
- /** Optional operation lifetime, composed with each read deadline/caller signal. */
38
- signal?: AbortSignal;
39
- operationDeadlineMilliseconds?: number;
40
- maxBytes?: number;
41
- }
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
- */
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
- */
51
- export declare function createGcsScopedObjectReadV1(options: GcsReportingReaderOptionsV1): (uri: string, maxBytes: number, signal?: AbortSignal, nativeVersion?: string) => Promise<{
52
- body: Buffer<ArrayBufferLike>;
53
- contentType: string | undefined;
54
- generation: string;
55
- }>;
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
- */
61
- export declare function createGcsReportingResourceReaderV1(options: GcsReportingReaderOptionsV1): ReportingResourceReader;
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
- */
67
- export declare function createGcsReportingReferenceResolverV1(options: GcsReportingReaderOptionsV1): CanonicalReferenceResolver;
@@ -1,193 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var reader_exports = {};
20
- __export(reader_exports, {
21
- createGcsReportingReferenceResolverV1: () => createGcsReportingReferenceResolverV1,
22
- createGcsReportingResourceReaderV1: () => createGcsReportingResourceReaderV1,
23
- createGcsScopedObjectReadV1: () => createGcsScopedObjectReadV1,
24
- gcsReportingObjectFromUriV1: () => gcsReportingObjectFromUriV1
25
- });
26
- module.exports = __toCommonJS(reader_exports);
27
- var import_canonical_references = require('../../canonical-references/index.js');
28
- var import_object_writes = require('../ledger/object-writes.js');
29
- var import_errors = require('./errors.js');
30
- var import_io = require('./io.js');
31
- function gcsReportingObjectFromUriV1(uri, bucket, prefix) {
32
- if (typeof uri !== "string" || uri.length > 2048) throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
33
- const expectedBase = `https://storage.googleapis.com/${bucket}/`;
34
- let parsed;
35
- try {
36
- parsed = new URL(uri);
37
- } catch {
38
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
39
- }
40
- const name = uri.startsWith(expectedBase) ? uri.slice(expectedBase.length) : "";
41
- if (parsed.href !== uri || parsed.username || parsed.password || parsed.search || parsed.hash || !name.startsWith(prefix) || name.length <= prefix.length || name.length > 1024 || !/^[A-Za-z0-9/_.-]+$/.test(name) || name.split("/").some((part) => !part || part === "." || part === ".."))
42
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
43
- return name;
44
- }
45
- function createGcsScopedObjectReadV1(options) {
46
- let scope;
47
- try {
48
- scope = structuredClone(options.scope);
49
- (0, import_object_writes.assertReportingObjectWriteScope)(scope);
50
- } catch {
51
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
52
- }
53
- if (typeof scope.principal_id !== "string" || scope.principal_id.length < 1 || scope.principal_id.length > 255 || typeof options.bucket !== "string" || !/^[a-z0-9][a-z0-9.-]{1,220}[a-z0-9]$/.test(options.bucket) || typeof options.objectPrefix !== "string" || !/^[A-Za-z0-9/_.-]+\/$/.test(options.objectPrefix) || options.objectPrefix.length > 1e3 || options.objectPrefix.split("/").slice(0, -1).some((p) => !p || p === "." || p === "..") || typeof options.authorize !== "function" || typeof options.getStorage !== "function")
54
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
55
- Object.freeze(scope);
56
- const { bucket, objectPrefix, authorize, getStorage, signal: parentSignal } = options;
57
- if (parentSignal !== void 0 && !(parentSignal instanceof AbortSignal))
58
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
59
- const maximum = options.maxBytes ?? 64 * 1024 * 1024;
60
- const milliseconds = options.operationDeadlineMilliseconds ?? 6e4;
61
- if (!Number.isSafeInteger(maximum) || maximum < 1 || maximum > 64 * 1024 * 1024 || !Number.isSafeInteger(milliseconds) || milliseconds < 1 || milliseconds > 6e4)
62
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
63
- async function authorized(signal, objectName) {
64
- (0, import_io.activeGcsSignal)(signal);
65
- const allowed = await authorize({ scope, bucket, objectPrefix, objectName }, { signal });
66
- (0, import_io.activeGcsSignal)(signal);
67
- if (allowed !== true) throw new import_errors.ReportingGcsFenceError("REVOKED");
68
- }
69
- return async (uri, maxBytes, signal, nativeVersion) => (0, import_io.withGcsDeadline)(
70
- async (active) => {
71
- const name = gcsReportingObjectFromUriV1(uri, bucket, objectPrefix);
72
- if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || nativeVersion !== void 0 && !/^[1-9][0-9]{0,39}$/.test(nativeVersion))
73
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
74
- await authorized(active, name);
75
- const storage = await getStorage(scope, { signal: active });
76
- (0, import_io.activeGcsSignal)(active);
77
- try {
78
- const file = storage.bucket(bucket).file(name, nativeVersion ? { generation: nativeVersion } : void 0);
79
- const [metadata] = await file.getMetadata();
80
- (0, import_io.activeGcsSignal)(active);
81
- if (metadata.metadata?.adcp_reporting_tombstone !== void 0) throw new import_errors.ReportingGcsFenceError("REVOKED");
82
- const generation = String(metadata.generation);
83
- if (nativeVersion !== void 0 && generation !== nativeVersion)
84
- throw new import_errors.ReportingGcsFenceError("CONTENT_CONFLICT");
85
- if (!/^[1-9][0-9]{0,39}$/.test(generation) || !/^(?:0|[1-9][0-9]{0,19})$/.test(String(metadata.size)) || BigInt(String(metadata.size)) > BigInt(Math.min(maxBytes, maximum)))
86
- throw new import_errors.ReportingGcsFenceError("CONTENT_CONFLICT");
87
- const body = await (0, import_io.readGcsBytes)(
88
- storage.bucket(bucket).file(name, { generation }),
89
- Math.min(maxBytes, maximum),
90
- active
91
- );
92
- (0, import_io.activeGcsSignal)(active);
93
- await authorized(active, name);
94
- return { body, contentType: metadata.contentType, generation };
95
- } catch (error) {
96
- (0, import_io.activeGcsSignal)(active);
97
- if ((0, import_errors.isReportingGcsFenceError)(error)) throw error;
98
- await authorized(active, name);
99
- throw new import_errors.ReportingGcsFenceError("PROVIDER_UNAVAILABLE");
100
- }
101
- },
102
- {
103
- signal: parentSignal && signal ? AbortSignal.any([parentSignal, signal]) : parentSignal ?? signal,
104
- milliseconds
105
- }
106
- );
107
- }
108
- function createGcsReportingResourceReaderV1(options) {
109
- const read = createGcsScopedObjectReadV1(options);
110
- const scope = structuredClone(options.scope);
111
- const { bucket, objectPrefix } = options;
112
- return {
113
- async read(request) {
114
- if (!request?.context?.materialization?.resource || !["manifest", "object"].includes(request.role) || request.context.obligation?.account_id !== scope.account_id || request.location !== request.context.materialization.resource.location || request.context.materialization.destination_ref !== scope.destination_ref)
115
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
116
- let uri = request.location;
117
- if (request.role === "object") {
118
- if (typeof request.objectRef !== "string" || !/^[A-Za-z0-9_.-]+$/.test(request.objectRef) || request.objectRef === "." || request.objectRef === "..")
119
- throw new import_errors.ReportingGcsFenceError("INVALID_INPUT");
120
- const name = gcsReportingObjectFromUriV1(request.location, bucket, objectPrefix);
121
- uri = `https://storage.googleapis.com/${bucket}/${name.slice(0, name.lastIndexOf("/") + 1)}${request.objectRef}`;
122
- }
123
- return read(
124
- uri,
125
- request.maxBytes,
126
- request.signal,
127
- request.role === "manifest" ? request.context.materialization.resource?.native_version_ref : void 0
128
- );
129
- }
130
- };
131
- }
132
- function createGcsReportingReferenceResolverV1(options) {
133
- const read = createGcsScopedObjectReadV1(options);
134
- const documentReader = {
135
- async read(request) {
136
- try {
137
- return await read(request.uri, request.maxBytes, request.signal);
138
- } catch (error) {
139
- if ((0, import_errors.isReportingGcsFenceError)(error)) {
140
- if (error.code === "ABORTED") throw new import_canonical_references.CanonicalDocumentReadError("aborted");
141
- if (error.code === "INVALID_INPUT") throw new import_canonical_references.CanonicalDocumentReadError("unsafe_url");
142
- if (error.code === "REVOKED") throw new import_canonical_references.CanonicalDocumentReadError("access_denied");
143
- if (error.code === "CONTENT_CONFLICT") throw new import_canonical_references.CanonicalDocumentReadError("body_too_large");
144
- }
145
- throw new import_canonical_references.CanonicalDocumentReadError("network_error");
146
- }
147
- }
148
- };
149
- const parentSignal = options.signal;
150
- const resolver = (0, import_canonical_references.createCanonicalReferenceResolver)({ documentReader, signal: parentSignal });
151
- const routing = { bucket: options.bucket, objectPrefix: options.objectPrefix };
152
- const forced = (input) => ({
153
- ...input,
154
- documentReader,
155
- signal: parentSignal && input?.signal ? AbortSignal.any([parentSignal, input.signal]) : parentSignal ?? input?.signal
156
- });
157
- function blocked(ref, kind) {
158
- try {
159
- gcsReportingObjectFromUriV1(ref.uri, routing.bucket, routing.objectPrefix);
160
- return void 0;
161
- } catch {
162
- return {
163
- ok: false,
164
- status: "blocked_unsafe_url",
165
- kind,
166
- ref: {
167
- uri: "https://storage.googleapis.com/redacted-invalid-reference",
168
- digest: /^sha256:[a-f0-9]{64}$/.test(ref?.digest) ? ref.digest : "invalid"
169
- },
170
- cacheKey: "private-reference-refused",
171
- fromCache: false,
172
- error: {
173
- code: "unsafe_url",
174
- message: "Private reference is outside the saved destination scope",
175
- retryable: false
176
- }
177
- };
178
- }
179
- }
180
- return {
181
- cache: resolver.cache,
182
- resolve: async (ref, context) => blocked(ref, "generic") ?? resolver.resolve(ref, forced(context)),
183
- resolveFormatSchema: async (ref, context) => blocked(ref, "format_schema") ?? resolver.resolveFormatSchema(ref, forced(context)),
184
- resolvePlatformExtensions: async (ref, context) => blocked(ref, "platform_extensions") ?? resolver.resolvePlatformExtensions(ref, forced(context))
185
- };
186
- }
187
- // Annotate the CommonJS export names for ESM import in node:
188
- 0 && (module.exports = {
189
- createGcsReportingReferenceResolverV1,
190
- createGcsReportingResourceReaderV1,
191
- createGcsScopedObjectReadV1,
192
- gcsReportingObjectFromUriV1
193
- });