@fedify/fedify 2.1.30 → 2.1.32

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 (104) hide show
  1. package/dist/attachment-arrays-DZ4JHJD8.mjs +111 -0
  2. package/dist/{builder-CTpfuuVp.mjs → builder--sc-rozj.mjs} +3 -3
  3. package/dist/callback-BARPujV7.d.mts +2388 -0
  4. package/dist/{client-CAM_bQXx.d.cts → client-9DPcy_Yx.d.ts} +16 -1
  5. package/dist/{client-CSddvgWN.d.ts → client-B3ruDgWg.d.cts} +16 -1
  6. package/dist/{client-CjDMsn4a.mjs → client-cpPaW7Ww.mjs} +189 -65
  7. package/dist/compat/attachment-arrays.test.d.mts +2 -0
  8. package/dist/compat/attachment-arrays.test.mjs +254 -0
  9. package/dist/compat/mod.d.cts +1 -1
  10. package/dist/compat/mod.d.ts +1 -1
  11. package/dist/compat/transformers.test.mjs +1 -1
  12. package/dist/{context-DLLaDau8.d.ts → context-DE2YrQwM.d.ts} +56 -13
  13. package/dist/{context-BNwv9Q1v.d.cts → context-y6ZUQCMf.d.cts} +56 -13
  14. package/dist/{deno-BATJ1hq6.mjs → deno-L23b3Hba.mjs} +1 -1
  15. package/dist/docloader-DUXr9k_O.mjs +124 -0
  16. package/dist/federation/attachment-responses.test.d.mts +2 -0
  17. package/dist/federation/attachment-responses.test.mjs +182 -0
  18. package/dist/federation/builder.test.mjs +1 -1
  19. package/dist/federation/collection.test.mjs +1 -1
  20. package/dist/federation/delivery-attachments.test.d.mts +2 -0
  21. package/dist/federation/delivery-attachments.test.mjs +280 -0
  22. package/dist/federation/handler.test.mjs +208 -16
  23. package/dist/federation/idempotency.test.mjs +2 -2
  24. package/dist/federation/inbox.test.mjs +1 -1
  25. package/dist/federation/middleware.test.mjs +1559 -26
  26. package/dist/federation/mod.cjs +1 -1
  27. package/dist/federation/mod.d.cts +2 -2
  28. package/dist/federation/mod.d.ts +2 -2
  29. package/dist/federation/mod.js +1 -1
  30. package/dist/federation/negotiation.test.mjs +1 -1
  31. package/dist/federation/retry.test.mjs +1 -1
  32. package/dist/federation/send.test.mjs +723 -68
  33. package/dist/federation/temporal.test.mjs +25 -1
  34. package/dist/federation/webfinger.test.mjs +1 -1
  35. package/dist/{http-CK3efjgM.js → http-BtbMAgTA.js} +176 -105
  36. package/dist/{http-Dl00HXr4.d.ts → http-C8qLHs_Z.d.cts} +3 -4
  37. package/dist/{http-BoR1M3W7.cjs → http-D5woFKA_.cjs} +177 -106
  38. package/dist/{http-DqZhyEso.d.cts → http-D8WmcRAF.d.ts} +3 -4
  39. package/dist/{http-Bjd6I92u.mjs → http-HX6wVyJh.mjs} +198 -98
  40. package/dist/{inbox-9MlBGgs9.mjs → inbox-CL7A0HXT.mjs} +1 -1
  41. package/dist/{key-ClQh9Qqh.mjs → key-Dai3f5yI.mjs} +3 -2
  42. package/dist/{kv-cache-BxSx_Iyp.cjs → kv-cache-B0V_e231.cjs} +59 -17
  43. package/dist/{kv-cache-ImApO425.js → kv-cache-BsDg-cT8.js} +60 -18
  44. package/dist/{ld-Crg0Xmwr.mjs → ld-DN6x1iZ8.mjs} +153 -21
  45. package/dist/ld-signature-DoZcbsZR.mjs +23 -0
  46. package/dist/{middleware-jL9p9V9G.cjs → middleware-Cl6k5Hrm.cjs} +1 -1
  47. package/dist/{middleware-CmD3lpy4.cjs → middleware-CrfRuKCf.cjs} +728 -143
  48. package/dist/{middleware-CE0b69gj.mjs → middleware-DiquMgtt.mjs} +444 -115
  49. package/dist/{middleware-C2AJFk8W.js → middleware-DunNtbo9.js} +727 -143
  50. package/dist/{middleware-Bi5D6DBT.mjs → middleware-SnQS8eIb.mjs} +1 -1
  51. package/dist/{mod-DiuFTYUt.d.cts → mod-CehHJOV4.d.cts} +30 -13
  52. package/dist/{mod-CWJNbyju.d.ts → mod-DLJpnqdw.d.ts} +1 -1
  53. package/dist/{mod-BLDHhuW0.d.ts → mod-Mh3oIuRK.d.ts} +30 -13
  54. package/dist/{mod-DNEgTI8M.d.ts → mod-REfljt0T.d.ts} +4 -9
  55. package/dist/{mod-Cn9GJ5ex.d.cts → mod-UvIGUHqW.d.cts} +4 -9
  56. package/dist/{mod-BmlfRBmU.d.cts → mod-sTa1Zzxk.d.cts} +1 -1
  57. package/dist/mod.cjs +5 -5
  58. package/dist/mod.d.cts +8 -8
  59. package/dist/mod.d.ts +8 -8
  60. package/dist/mod.js +5 -5
  61. package/dist/nodeinfo/client.test.mjs +764 -19
  62. package/dist/nodeinfo/handler.test.mjs +1 -1
  63. package/dist/nodeinfo/mod.cjs +1 -1
  64. package/dist/nodeinfo/mod.d.cts +1 -1
  65. package/dist/nodeinfo/mod.d.ts +1 -1
  66. package/dist/nodeinfo/mod.js +1 -1
  67. package/dist/nodeinfo/types.test.mjs +1 -1
  68. package/dist/otel/exporter.test.mjs +292 -30
  69. package/dist/otel/mod.cjs +36 -30
  70. package/dist/otel/mod.d.cts +13 -0
  71. package/dist/otel/mod.d.ts +13 -0
  72. package/dist/otel/mod.js +36 -30
  73. package/dist/{owner-BRoKojK1.mjs → owner-DwyDorZI.mjs} +2 -2
  74. package/dist/{proof-CHXVlsH_.cjs → proof-Be-4K4jn.cjs} +193 -46
  75. package/dist/{proof-DMIAezxz.mjs → proof-DYjmyrHh.mjs} +38 -13
  76. package/dist/{proof-7R4s10TJ.js → proof-Du4-5SHY.js} +187 -46
  77. package/dist/send-BGSfQkIK.mjs +416 -0
  78. package/dist/sig/http.test.mjs +506 -2
  79. package/dist/sig/key-types.test.d.mts +218 -0
  80. package/dist/sig/key-types.test.mjs +8 -0
  81. package/dist/sig/key.test.mjs +2 -2
  82. package/dist/sig/ld.test.mjs +573 -8
  83. package/dist/sig/mod.cjs +2 -2
  84. package/dist/sig/mod.d.cts +3 -3
  85. package/dist/sig/mod.d.ts +3 -3
  86. package/dist/sig/mod.js +2 -2
  87. package/dist/sig/owner.test.mjs +1 -1
  88. package/dist/sig/proof.test.mjs +95 -3
  89. package/dist/{temporal-DR0JahMu.mjs → temporal-CNCchWly.mjs} +3 -5
  90. package/dist/testing/mod.d.mts +1 -2177
  91. package/dist/{types-DRPjmHVV.cjs → types-B5wRhemi.cjs} +187 -63
  92. package/dist/{types-miAYfiGO.js → types-CXy2lRVU.js} +188 -64
  93. package/dist/utils/docloader.test.mjs +316 -32
  94. package/dist/utils/mod.cjs +1 -1
  95. package/dist/utils/mod.d.cts +1 -1
  96. package/dist/utils/mod.d.ts +1 -1
  97. package/dist/utils/mod.js +1 -1
  98. package/package.json +7 -7
  99. package/dist/docloader-OLWc7P2D.mjs +0 -82
  100. package/dist/send-BHIt_8ia.mjs +0 -260
  101. /package/dist/{collection-BD6-SZ6O.mjs → collection-DnoYNwBC.mjs} +0 -0
  102. /package/dist/{negotiation-BehA2uul.mjs → negotiation-xb0QR3u_.mjs} +0 -0
  103. /package/dist/{retry-B_E3V_Dx.mjs → retry-CI1flGDD.mjs} +0 -0
  104. /package/dist/{types-DCP0WLdt.mjs → types-s4mCTGkT.mjs} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { getLogger } from "@logtape/logtape";
4
- import { FetchError, UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
4
+ import { FetchError, UrlError, getUserAgent } from "@fedify/vocab-runtime";
5
+ import { detectRuntime, lookupAllAddressesBounded, openPublicFetch } from "@fedify/vocab-runtime/internal";
5
6
  //#region src/utils/body.ts
6
7
  /** Decoded JSON body limit: 16 MiB. @internal */
7
8
  const MAX_BODY_SIZE = 16 * 1024 * 1024;
@@ -23,13 +24,18 @@ function validateBodySizeLimit(maxBytes) {
23
24
  * @param message The response or request to read.
24
25
  * @param maxBytes The maximum number of decoded bytes to read.
25
26
  * @param url The URL to include in errors and logs.
27
+ * @param signal An optional signal for cancelling the body read.
26
28
  * @returns The decoded body text.
27
29
  * @throws {BodyTooLargeError} If the body exceeds the limit.
28
30
  * @internal
29
31
  */
30
- async function readBoundedText(message, maxBytes, url) {
32
+ async function readBoundedText(message, maxBytes, url, signal) {
31
33
  validateBodySizeLimit(maxBytes);
32
34
  const reader = message.body?.getReader();
35
+ const onAbort = () => {
36
+ if (reader != null) reader.cancel(signal?.reason).catch(() => {});
37
+ };
38
+ signal?.addEventListener("abort", onAbort, { once: true });
33
39
  const tooLarge = () => {
34
40
  getLogger([
35
41
  "fedify",
@@ -42,6 +48,7 @@ async function readBoundedText(message, maxBytes, url) {
42
48
  throw new BodyTooLargeError(url, maxBytes);
43
49
  };
44
50
  try {
51
+ signal?.throwIfAborted();
45
52
  const length = message.headers.get("Content-Length");
46
53
  const encoding = message.headers.get("Content-Encoding");
47
54
  if ((encoding == null || encoding.toLowerCase() === "identity") && length != null && /^\d+$/.test(length) && Number(length) > maxBytes) tooLarge();
@@ -49,6 +56,7 @@ async function readBoundedText(message, maxBytes, url) {
49
56
  let size = 0;
50
57
  const textReader = new ReadableStream({ async pull(controller) {
51
58
  const { done, value } = await reader.read();
59
+ signal?.throwIfAborted();
52
60
  if (done) {
53
61
  controller.close();
54
62
  return;
@@ -61,6 +69,7 @@ async function readBoundedText(message, maxBytes, url) {
61
69
  const chunks = [];
62
70
  while (true) {
63
71
  const { done, value } = await textReader.read();
72
+ signal?.throwIfAborted();
64
73
  if (done) break;
65
74
  chunks.push(value);
66
75
  }
@@ -72,6 +81,7 @@ async function readBoundedText(message, maxBytes, url) {
72
81
  if (reader != null) reader.cancel(error).catch(() => {});
73
82
  throw error;
74
83
  } finally {
84
+ signal?.removeEventListener("abort", onAbort);
75
85
  reader?.releaseLock();
76
86
  }
77
87
  }
@@ -83,25 +93,45 @@ const logger = getLogger([
83
93
  "client"
84
94
  ]);
85
95
  const DEFAULT_MAX_REDIRECTION = 5;
96
+ const DEFAULT_TIMEOUT = 1e4;
97
+ const MAX_TIMEOUT = 2147483647;
86
98
  /**
87
- * Fetches a URL while guarding against SSRF. Before every request—including
88
- * each redirect hop—the destination is validated with
89
- * {@link validatePublicUrl}, so that loopback, link-local, and private
90
- * addresses, as well as non-HTTP(S) schemes such as `data:`, are rejected.
91
- * Redirects are followed manually with a cap, so that a public URL cannot
92
- * bounce the request to an internal address.
99
+ * Fetches a URL while guarding against SSRF. Every request—including each
100
+ * redirect hop—is made in its own session opened with `openPublicFetch()`,
101
+ * which rejects loopback, link-local, and private addresses, as well as
102
+ * non-HTTP(S) schemes such as `data:`, and connects only to the validated
103
+ * addresses where the runtime supports it. Redirects are followed manually
104
+ * with a cap, so that a public URL cannot bounce the request to an internal
105
+ * address.
106
+ *
107
+ * The final response is passed to `consume`, which must consume or cancel its
108
+ * body; the session is closed after `consume` settles. The cancellation of
109
+ * redirect response bodies is started before their sessions are closed.
93
110
  * @param url The URL to fetch.
94
111
  * @param headers The request headers.
95
- * @returns The final response, or `null` if the URL is disallowed, its
96
- * hostname cannot be resolved, or there are too many redirects.
112
+ * @param consume The function to consume the final response with.
113
+ * @param deps The dependencies.
114
+ * @param signal The signal for the whole NodeInfo lookup.
115
+ * @returns The value returned by `consume`, or `null` if the URL is
116
+ * disallowed, its hostname cannot be resolved, or there are too many
117
+ * redirects.
118
+ * @internal
97
119
  */
98
- async function fetchPublicUrl(url, headers) {
120
+ async function fetchPublicUrl(url, headers, consume, deps = {}, signal) {
121
+ const openHop = deps.openHop ?? ((hopUrl, signal) => openPublicFetch(hopUrl, detectRuntime() === "node" ? {
122
+ signal,
123
+ lookup: (hostname) => lookupAllAddressesBounded(hostname, signal)
124
+ } : { signal }));
99
125
  let current = url instanceof URL ? url : new URL(url);
100
126
  let redirected = 0;
127
+ const visited = new Set([redirectKey(current)]);
101
128
  while (true) {
129
+ signal?.throwIfAborted();
130
+ let session;
102
131
  try {
103
- await validatePublicUrl(current.href);
132
+ session = await openHop(current.href, signal);
104
133
  } catch (e) {
134
+ signal?.throwIfAborted();
105
135
  if (e instanceof UrlError) {
106
136
  if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
107
137
  url: current.href,
@@ -115,52 +145,146 @@ async function fetchPublicUrl(url, headers) {
115
145
  }
116
146
  throw e;
117
147
  }
118
- const response = await fetch(current, {
119
- headers,
120
- redirect: "manual"
121
- });
122
- if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
123
- redirected++;
124
- if (redirected >= DEFAULT_MAX_REDIRECTION) {
125
- logger.error("Too many redirections ({redirections}) while fetching {url}.", {
126
- redirections: redirected,
127
- url: current.href
128
- });
129
- return null;
130
- }
131
- const next = new URL(response.headers.get("Location"), response.url == null || response.url === "" ? current : response.url);
132
- if (next.protocol !== current.protocol) {
133
- logger.error("Refused a redirect to a different protocol ({protocol} to {redirectedProtocol}) while fetching NodeInfo.", {
134
- protocol: current.protocol,
135
- redirectedProtocol: next.protocol
136
- });
137
- return null;
148
+ let location;
149
+ try {
150
+ signal?.throwIfAborted();
151
+ const response = await session.fetch(current, {
152
+ headers,
153
+ redirect: "manual",
154
+ signal
155
+ });
156
+ if (signal?.aborted) {
157
+ cancelBody(response, current);
158
+ signal.throwIfAborted();
138
159
  }
139
- current = next;
140
- continue;
160
+ if (response.status < 300 || response.status >= 400 || !response.headers.has("Location")) return await consume(response);
161
+ location = response.headers.get("Location");
162
+ cancelBody(response, current);
163
+ } finally {
164
+ await session.close();
165
+ }
166
+ redirected++;
167
+ if (redirected >= DEFAULT_MAX_REDIRECTION) {
168
+ logger.error("Too many redirections ({redirections}) while fetching {url}.", {
169
+ redirections: redirected,
170
+ url: current.href
171
+ });
172
+ return null;
141
173
  }
142
- return response;
174
+ const next = new URL(location, current);
175
+ if (next.protocol !== current.protocol) {
176
+ logger.error("Refused a redirect to a different protocol ({protocol} to {redirectedProtocol}) while fetching NodeInfo.", {
177
+ protocol: current.protocol,
178
+ redirectedProtocol: next.protocol
179
+ });
180
+ return null;
181
+ }
182
+ const key = redirectKey(next);
183
+ if (visited.has(key)) {
184
+ logger.error("Redirect cycle while fetching NodeInfo: {url}.", { url: next.href });
185
+ return null;
186
+ }
187
+ visited.add(key);
188
+ current = next;
143
189
  }
144
190
  }
191
+ function redirectKey(url) {
192
+ const withoutFragment = new URL(url);
193
+ withoutFragment.hash = "";
194
+ return withoutFragment.href;
195
+ }
196
+ /**
197
+ * Starts cancelling a response body that is not read, without waiting for it
198
+ * to settle. The cancellation of a branch of a tee (e.g., a body cloned by
199
+ * a fetch mock) settles only after the other branch is cancelled too, per
200
+ * the Streams standard, so awaiting it could block forever. A failure is
201
+ * only logged.
202
+ */
203
+ function cancelBody(response, url) {
204
+ response.body?.cancel().catch((error) => {
205
+ logger.debug("Failed to cancel the response body from {url}: {error}", {
206
+ url: url.toString(),
207
+ error
208
+ });
209
+ });
210
+ }
145
211
  async function getNodeInfo(url, options = {}) {
212
+ return await getNodeInfoInternal(url, options);
213
+ }
214
+ /**
215
+ * The implementation of {@link getNodeInfo}, which is not exported from any
216
+ * entry point.
217
+ * @param url The base URL of the server, or the URL of the NodeInfo document
218
+ * if `options.direct` is turned on.
219
+ * @param options Options for fetching the NodeInfo document.
220
+ * @param deps The dependencies.
221
+ * @returns The NodeInfo document if it could be fetched successfully.
222
+ * Otherwise, `undefined` is returned.
223
+ * @internal
224
+ */
225
+ async function getNodeInfoInternal(url, options = {}, deps = {}) {
226
+ const timeout = resolveTimeout(options.timeout);
227
+ if (timeout == null && options.signal == null) return await getNodeInfoWithSignal(url, options, deps);
228
+ const controller = new AbortController();
229
+ const timeoutReason = timeout == null ? void 0 : new DOMException(`The NodeInfo lookup timed out after ${timeout} ms.`, "TimeoutError");
230
+ const timer = timeout == null ? void 0 : setTimeout(() => controller.abort(timeoutReason), timeout);
231
+ const onCallerAbort = () => controller.abort(options.signal?.reason);
232
+ options.signal?.addEventListener("abort", onCallerAbort, { once: true });
233
+ if (options.signal?.aborted) onCallerAbort();
234
+ let onAbort;
235
+ const aborted = new Promise((_, reject) => {
236
+ onAbort = () => reject(controller.signal.reason);
237
+ controller.signal.addEventListener("abort", onAbort, { once: true });
238
+ });
239
+ const loading = getNodeInfoWithSignal(url, options, deps, controller.signal);
240
+ loading.catch(() => {});
146
241
  try {
242
+ return await Promise.race([loading, aborted]);
243
+ } catch (error) {
244
+ if (!controller.signal.aborted) throw error;
245
+ if (controller.signal.reason === timeoutReason) logger.error("Timed out after {timeout} ms while fetching NodeInfo: {url}", {
246
+ timeout,
247
+ url: url.toString()
248
+ });
249
+ else logger.debug("Cancelled NodeInfo lookup for {url}.", { url: url.toString() });
250
+ return;
251
+ } finally {
252
+ clearTimeout(timer);
253
+ options.signal?.removeEventListener("abort", onCallerAbort);
254
+ if (onAbort != null) controller.signal.removeEventListener("abort", onAbort);
255
+ }
256
+ }
257
+ function resolveTimeout(timeout) {
258
+ if (timeout === void 0) return DEFAULT_TIMEOUT;
259
+ if (timeout === null) return null;
260
+ if (!Number.isFinite(timeout) || timeout <= 0) throw new RangeError(`The NodeInfo timeout must be a positive finite number of milliseconds, but got ${String(timeout)}.`);
261
+ const ms = Math.ceil(timeout);
262
+ if (ms > MAX_TIMEOUT) throw new RangeError(`The NodeInfo timeout must not be greater than ${MAX_TIMEOUT} milliseconds, but got ${timeout}.`);
263
+ return ms;
264
+ }
265
+ async function getNodeInfoWithSignal(url, options, deps, signal) {
266
+ try {
267
+ const headers = {
268
+ Accept: "application/json",
269
+ "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
270
+ };
147
271
  let nodeInfoUrl = url;
148
272
  if (!options.direct) {
149
273
  const wellKnownUrl = new URL("/.well-known/nodeinfo", url);
150
- const wellKnownResponse = await fetchPublicUrl(wellKnownUrl, {
151
- Accept: "application/json",
152
- "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
153
- });
154
- if (wellKnownResponse == null) return void 0;
155
- if (!wellKnownResponse.ok) {
156
- logger.error("Failed to fetch {url}: {status} {statusText}", {
157
- url: wellKnownUrl.href,
158
- status: wellKnownResponse.status,
159
- statusText: wellKnownResponse.statusText
160
- });
161
- return;
162
- }
163
- const wellKnownRd = JSON.parse(await readBoundedText(wellKnownResponse, MAX_BODY_SIZE, wellKnownUrl));
274
+ const wellKnown = await fetchPublicUrl(wellKnownUrl, headers, async (response) => {
275
+ if (!response.ok) {
276
+ logger.error("Failed to fetch {url}: {status} {statusText}", {
277
+ url: wellKnownUrl.href,
278
+ status: response.status,
279
+ statusText: response.statusText
280
+ });
281
+ cancelBody(response, wellKnownUrl);
282
+ return;
283
+ }
284
+ return { rd: JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, wellKnownUrl, signal)) };
285
+ }, deps, signal);
286
+ if (wellKnown == null) return void 0;
287
+ const wellKnownRd = wellKnown.rd;
164
288
  const link = wellKnownRd?.links?.find((link) => link != null && "rel" in link && (link.rel === "http://nodeinfo.diaspora.software/ns/schema/2.0" || link.rel === "http://nodeinfo.diaspora.software/ns/schema/2.1") && "href" in link && link.href != null);
165
289
  if (link == null || link.href == null) {
166
290
  logger.error("Failed to find a NodeInfo document link from {url}: {resourceDescriptor}", {
@@ -171,24 +295,24 @@ async function getNodeInfo(url, options = {}) {
171
295
  }
172
296
  nodeInfoUrl = link.href;
173
297
  }
174
- const response = await fetchPublicUrl(nodeInfoUrl, {
175
- Accept: "application/json",
176
- "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
177
- });
178
- if (response == null) return void 0;
179
- if (!response.ok) {
180
- logger.error("Failed to fetch NodeInfo document from {url}: {status} {statusText}", {
181
- url: nodeInfoUrl.toString(),
182
- status: response.status,
183
- statusText: response.statusText
184
- });
185
- return;
186
- }
187
- const data = JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, nodeInfoUrl));
298
+ const document = await fetchPublicUrl(nodeInfoUrl, headers, async (response) => {
299
+ if (!response.ok) {
300
+ logger.error("Failed to fetch NodeInfo document from {url}: {status} {statusText}", {
301
+ url: nodeInfoUrl.toString(),
302
+ status: response.status,
303
+ statusText: response.statusText
304
+ });
305
+ cancelBody(response, nodeInfoUrl);
306
+ return;
307
+ }
308
+ return { data: JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, nodeInfoUrl, signal)) };
309
+ }, deps, signal);
310
+ if (document == null) return void 0;
311
+ const { data } = document;
188
312
  if (options.parse === "none") return data;
189
313
  return parseNodeInfo(data, { tryBestEffort: options.parse === "best-effort" }) ?? void 0;
190
314
  } catch (error) {
191
- logger.error("Failed to fetch NodeInfo document from {url}: {error}", {
315
+ logger[signal?.aborted ? "debug" : "error"]("Failed to fetch NodeInfo document from {url}: {error}", {
192
316
  url: url.toString(),
193
317
  error
194
318
  });