@fedify/fedify 2.2.19 → 2.2.21

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 (109) hide show
  1. package/dist/attachment-arrays-CalAATqD.mjs +16 -0
  2. package/dist/{builder-UmydCxtK.mjs → builder-4ImvtjG4.mjs} +3 -3
  3. package/dist/callback-0KrwzutD.d.mts +2607 -0
  4. package/dist/{client-CSddvgWN.d.ts → client-9DPcy_Yx.d.ts} +16 -1
  5. package/dist/{client-CAM_bQXx.d.cts → client-B3ruDgWg.d.cts} +16 -1
  6. package/dist/{client-9F_u23dc.mjs → client-XYMC0Mmk.mjs} +189 -65
  7. package/dist/compat/attachment-arrays.test.d.mts +2 -0
  8. package/dist/compat/attachment-arrays.test.mjs +255 -0
  9. package/dist/compat/mod.d.cts +1 -1
  10. package/dist/compat/mod.d.ts +1 -1
  11. package/dist/compat/outgoing-jsonld.test.mjs +1 -1
  12. package/dist/compat/public-audience.test.mjs +1 -1
  13. package/dist/compat/transformers.test.mjs +1 -1
  14. package/dist/{context-tJbL_Hkw.d.cts → context-CjWuov0g.d.cts} +57 -14
  15. package/dist/{context-OkwEpc3-.d.ts → context-DZqI2LJD.d.ts} +57 -14
  16. package/dist/{deno-CD-8UlUi.mjs → deno-AWk3S2Ug.mjs} +1 -1
  17. package/dist/docloader-Bogpjg4d.mjs +125 -0
  18. package/dist/federation/attachment-responses.test.d.mts +2 -0
  19. package/dist/federation/attachment-responses.test.mjs +182 -0
  20. package/dist/federation/builder.test.mjs +1 -1
  21. package/dist/federation/collection.test.mjs +1 -1
  22. package/dist/federation/delivery-attachments.test.d.mts +2 -0
  23. package/dist/federation/delivery-attachments.test.mjs +288 -0
  24. package/dist/federation/handler.test.mjs +208 -16
  25. package/dist/federation/idempotency.test.mjs +2 -2
  26. package/dist/federation/inbox.test.mjs +2 -2
  27. package/dist/federation/middleware.test.mjs +1567 -30
  28. package/dist/federation/mod.cjs +1 -1
  29. package/dist/federation/mod.d.cts +2 -2
  30. package/dist/federation/mod.d.ts +2 -2
  31. package/dist/federation/mod.js +1 -1
  32. package/dist/federation/negotiation.test.mjs +1 -1
  33. package/dist/federation/retry.test.mjs +1 -1
  34. package/dist/federation/send.test.mjs +723 -68
  35. package/dist/federation/temporal.test.mjs +25 -1
  36. package/dist/federation/webfinger.test.mjs +1 -1
  37. package/dist/{http-BBBUbwKh.mjs → http-B3wCvgu8.mjs} +199 -99
  38. package/dist/{http-DrUG4fPS.cjs → http-BNaPJVnF.cjs} +178 -107
  39. package/dist/{http-DJK2udgX.js → http-BpdLaGy8.js} +177 -106
  40. package/dist/{http-Dl00HXr4.d.ts → http-C8qLHs_Z.d.cts} +3 -4
  41. package/dist/{http-DqZhyEso.d.cts → http-D8WmcRAF.d.ts} +3 -4
  42. package/dist/{inbox-Dca_0fwc.mjs → inbox-DLy6WBXU.mjs} +1 -1
  43. package/dist/{key-DolXUaLH.mjs → key-Bhc8cQC7.mjs} +3 -2
  44. package/dist/{kv-cache-Bk3V1Tiu.cjs → kv-cache-Bj3CY9Jo.cjs} +59 -17
  45. package/dist/{kv-cache-DDm80t1K.js → kv-cache-CvjLUQTf.js} +60 -18
  46. package/dist/{ld-rTdIfZ63.mjs → ld-DTeykI0e.mjs} +153 -21
  47. package/dist/ld-signature-Dgz_b89j.mjs +23 -0
  48. package/dist/{middleware-BWOwEGpy.cjs → middleware-BSQP4d9p.cjs} +642 -149
  49. package/dist/{middleware-B4-Rzdi3.cjs → middleware-CWOzxb3o.cjs} +1 -1
  50. package/dist/{middleware-DYK_res8.mjs → middleware-DkMsC5mQ.mjs} +1 -1
  51. package/dist/{middleware-BimXKBcP.js → middleware-Dx1iwFk8.js} +641 -149
  52. package/dist/{middleware-CpXoRHs3.mjs → middleware-dlGvSrXl.mjs} +452 -122
  53. package/dist/{mod-D2JyWtW3.d.cts → mod-BmxqcEnU.d.ts} +30 -13
  54. package/dist/{mod-a6kmB8xD.d.cts → mod-DWEx2D4q.d.cts} +1 -1
  55. package/dist/{mod-DQGjRJUG.d.ts → mod-DnPmz3-S.d.ts} +1 -1
  56. package/dist/{mod-ej_rLx8h.d.ts → mod-INjDw-m0.d.cts} +30 -13
  57. package/dist/{mod-B6LmugJ4.d.ts → mod-REfljt0T.d.ts} +4 -10
  58. package/dist/{mod-V2vDnYNu.d.cts → mod-UvIGUHqW.d.cts} +4 -10
  59. package/dist/mod.cjs +5 -5
  60. package/dist/mod.d.cts +8 -8
  61. package/dist/mod.d.ts +8 -8
  62. package/dist/mod.js +5 -5
  63. package/dist/nodeinfo/client.test.mjs +764 -18
  64. package/dist/nodeinfo/handler.test.mjs +1 -1
  65. package/dist/nodeinfo/mod.cjs +1 -1
  66. package/dist/nodeinfo/mod.d.cts +1 -1
  67. package/dist/nodeinfo/mod.d.ts +1 -1
  68. package/dist/nodeinfo/mod.js +1 -1
  69. package/dist/nodeinfo/types.test.mjs +1 -1
  70. package/dist/otel/exporter.test.mjs +292 -30
  71. package/dist/otel/mod.cjs +36 -30
  72. package/dist/otel/mod.d.cts +13 -0
  73. package/dist/otel/mod.d.ts +13 -0
  74. package/dist/otel/mod.js +36 -30
  75. package/dist/{outgoing-jsonld-amccRMrV.mjs → outgoing-jsonld-DHf_DYXp.mjs} +38 -8
  76. package/dist/{owner-CVfzyM5V.mjs → owner-BsA7qMHB.mjs} +2 -2
  77. package/dist/{proof-gOGM-sJS.mjs → proof-C63Hqt9N.mjs} +40 -15
  78. package/dist/{proof-DhaTTn-P.cjs → proof-Dbz6ApNP.cjs} +1190 -1007
  79. package/dist/{proof-CaQ4KG6y.js → proof-QV_o5ZqS.js} +1174 -1003
  80. package/dist/send-CAdpwbFX.mjs +416 -0
  81. package/dist/sig/http.test.mjs +528 -2
  82. package/dist/sig/key-types.test.d.mts +218 -0
  83. package/dist/sig/key-types.test.mjs +8 -0
  84. package/dist/sig/key.test.mjs +2 -2
  85. package/dist/sig/ld.test.mjs +573 -8
  86. package/dist/sig/mod.cjs +2 -2
  87. package/dist/sig/mod.d.cts +3 -3
  88. package/dist/sig/mod.d.ts +3 -3
  89. package/dist/sig/mod.js +2 -2
  90. package/dist/sig/owner.test.mjs +1 -1
  91. package/dist/sig/proof.test.mjs +96 -4
  92. package/dist/{temporal-CA4Y9hBJ.mjs → temporal-B3JGkVgk.mjs} +3 -5
  93. package/dist/testing/mod.d.mts +1 -2396
  94. package/dist/{types-DRPjmHVV.cjs → types-BWx7zw3Y.cjs} +187 -63
  95. package/dist/{types-miAYfiGO.js → types-Dx_w2JSM.js} +188 -64
  96. package/dist/utils/docloader.test.mjs +318 -34
  97. package/dist/utils/mod.cjs +1 -1
  98. package/dist/utils/mod.d.cts +1 -1
  99. package/dist/utils/mod.d.ts +1 -1
  100. package/dist/utils/mod.js +1 -1
  101. package/package.json +6 -6
  102. package/dist/docloader-D1ghurDJ.mjs +0 -83
  103. package/dist/send-D35Va72B.mjs +0 -260
  104. /package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  105. /package/dist/{collection-D-HqUuA2.mjs → collection-CA3V5zyK.mjs} +0 -0
  106. /package/dist/{negotiation-SQvQgUqe.mjs → negotiation-VnHNB0Q5.mjs} +0 -0
  107. /package/dist/{public-audience-DpJqzPuh.mjs → public-audience-4g3_Ze4y.mjs} +0 -0
  108. /package/dist/{retry-v_sGLH1d.mjs → retry-CXg_MBI-.mjs} +0 -0
  109. /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
@@ -0,0 +1,416 @@
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { n as version, t as name } from "./deno-AWk3S2Ug.mjs";
5
+ import { r as doubleKnockScoped } from "./http-B3wCvgu8.mjs";
6
+ import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
+ import { FetchError, UrlError } from "@fedify/vocab-runtime";
8
+ import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
9
+ import { getLogger } from "@logtape/logtape";
10
+ //#region src/federation/send.ts
11
+ /**
12
+ * Extracts the inbox URLs from recipients.
13
+ * @param parameters The parameters to extract the inboxes.
14
+ * See also {@link ExtractInboxesParameters}.
15
+ * @returns The inboxes as a map of inbox URL to actor URIs.
16
+ */
17
+ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
18
+ const inboxes = {};
19
+ for (const recipient of recipients) {
20
+ let inbox;
21
+ let sharedInbox = false;
22
+ if (preferSharedInbox && recipient.endpoints?.sharedInbox != null) {
23
+ inbox = recipient.endpoints.sharedInbox;
24
+ sharedInbox = true;
25
+ } else inbox = recipient.inboxId;
26
+ if (inbox != null && recipient.id != null) {
27
+ if (excludeBaseUris != null && excludeBaseUris.some((u) => u.origin === inbox?.origin)) continue;
28
+ inboxes[inbox.href] ??= {
29
+ actorIds: /* @__PURE__ */ new Set(),
30
+ sharedInbox
31
+ };
32
+ inboxes[inbox.href].actorIds.add(recipient.id.href);
33
+ }
34
+ }
35
+ return inboxes;
36
+ }
37
+ /**
38
+ * Sends an {@link Activity} to an inbox.
39
+ *
40
+ * @param parameters The parameters for sending the activity.
41
+ * See also {@link SendActivityParameters}.
42
+ * @param deps The dependencies, for tests.
43
+ * @throws {FetchError} If the delivery times out before receiving a response.
44
+ * @throws {SendActivityError} If the inbox returns an unsuccessful response.
45
+ */
46
+ function sendActivity(options, deps = {}) {
47
+ const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
48
+ return tracerProvider.getTracer(name, version).startActiveSpan("activitypub.send_activity", {
49
+ kind: SpanKind.CLIENT,
50
+ attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
51
+ }, async (span) => {
52
+ if (options.activityId != null) span.setAttribute("activitypub.activity.id", options.activityId);
53
+ if (options.activityType != null) span.setAttribute("activitypub.activity.type", options.activityType);
54
+ try {
55
+ await sendActivityInternal({
56
+ ...options,
57
+ tracerProvider
58
+ }, span, deps);
59
+ } catch (e) {
60
+ span.setStatus({
61
+ code: SpanStatusCode.ERROR,
62
+ message: String(e)
63
+ });
64
+ throw e;
65
+ } finally {
66
+ span.end();
67
+ }
68
+ });
69
+ }
70
+ const MAX_ERROR_RESPONSE_BODY_BYTES = 1024;
71
+ const SEND_ACTIVITY_TIMEOUT_MS = 3e4;
72
+ function raceWithAbort(promise, signal) {
73
+ if (signal.aborted) return Promise.reject(signal.reason);
74
+ return new Promise((resolve, reject) => {
75
+ const onAbort = () => {
76
+ signal.removeEventListener("abort", onAbort);
77
+ reject(signal.reason);
78
+ };
79
+ signal.addEventListener("abort", onAbort, { once: true });
80
+ promise.then((value) => {
81
+ signal.removeEventListener("abort", onAbort);
82
+ resolve(value);
83
+ }, (error) => {
84
+ signal.removeEventListener("abort", onAbort);
85
+ reject(error);
86
+ });
87
+ });
88
+ }
89
+ async function readLimitedResponseBody(response, maxBytes, signal) {
90
+ if (response.body == null) return "";
91
+ const reader = response.body.getReader();
92
+ const decoder = new TextDecoder();
93
+ const chunks = [];
94
+ let totalBytes = 0;
95
+ let truncated = false;
96
+ try {
97
+ while (true) {
98
+ signal.throwIfAborted();
99
+ const { done, value } = await raceWithAbort(reader.read(), signal);
100
+ if (done) break;
101
+ if (totalBytes + value.length > maxBytes) {
102
+ const remaining = maxBytes - totalBytes;
103
+ if (remaining > 0) chunks.push(decoder.decode(value.slice(0, remaining), { stream: true }));
104
+ truncated = true;
105
+ break;
106
+ }
107
+ chunks.push(decoder.decode(value, { stream: true }));
108
+ totalBytes += value.length;
109
+ }
110
+ } finally {
111
+ if (truncated || signal.aborted) reader.cancel().catch(() => {});
112
+ try {
113
+ reader.releaseLock();
114
+ } catch (_) {}
115
+ }
116
+ let result = chunks.join("");
117
+ if (truncated) result += "… (truncated)";
118
+ return result;
119
+ }
120
+ async function sendActivityInternal({ activity, activityId, keys, inbox, allowPrivateAddress, headers, specDeterminer, tracerProvider }, span, deps) {
121
+ const logger = getLogger([
122
+ "fedify",
123
+ "federation",
124
+ "outbox"
125
+ ]);
126
+ const timeoutMs = deps.timeoutMs ?? SEND_ACTIVITY_TIMEOUT_MS;
127
+ const controller = new AbortController();
128
+ const { signal } = controller;
129
+ const openUnvalidatedHop = deps.openHop ?? (allowPrivateAddress ? openDirectFetch : (url) => openPublicFetch(url, { signal }));
130
+ let opened = false;
131
+ async function openHop(url) {
132
+ let session;
133
+ try {
134
+ signal.throwIfAborted();
135
+ const opening = openUnvalidatedHop(url);
136
+ opening.then((lateSession) => {
137
+ if (signal.aborted) closeAfterError(lateSession, logger);
138
+ }, () => {});
139
+ session = await raceWithAbort(opening, signal);
140
+ if (signal.aborted) {
141
+ closeAfterError(session, logger);
142
+ signal.throwIfAborted();
143
+ }
144
+ } catch (error) {
145
+ if (error instanceof UrlError && error.reason === "dns") {
146
+ logger.error("DNS resolution failed for URL: {url}", {
147
+ url,
148
+ error
149
+ });
150
+ const failure = new FetchError(url, error.message);
151
+ failure.cause = error;
152
+ throw failure;
153
+ }
154
+ if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
155
+ url,
156
+ error
157
+ });
158
+ throw error;
159
+ }
160
+ opened = true;
161
+ return session;
162
+ }
163
+ headers = new Headers(headers);
164
+ headers.set("Content-Type", "application/activity+json");
165
+ const request = new Request(inbox, {
166
+ method: "POST",
167
+ headers,
168
+ body: JSON.stringify(activity),
169
+ redirect: "manual",
170
+ signal
171
+ });
172
+ let rsaKey = null;
173
+ for (const key of keys) if (key.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
174
+ rsaKey = key;
175
+ break;
176
+ }
177
+ if (rsaKey == null) logger.warn("No supported key found to sign the request to {inbox}. The request will be sent without a signature. In order to sign the request, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
178
+ inbox: inbox.href,
179
+ keys: keys.map((pair) => ({
180
+ keyId: pair.keyId.href,
181
+ privateKey: pair.privateKey
182
+ }))
183
+ });
184
+ let outcome;
185
+ const boundedSpecDeterminer = specDeterminer == null ? void 0 : {
186
+ determineSpec(origin) {
187
+ signal.throwIfAborted();
188
+ return raceWithAbort(Promise.resolve(specDeterminer.determineSpec(origin)), signal);
189
+ },
190
+ rememberSpec(origin, spec) {
191
+ if (signal.aborted) return;
192
+ try {
193
+ Promise.resolve(specDeterminer.rememberSpec(origin, spec)).catch((error) => logger.debug("Failed to remember the signature spec for {origin}: {error}", {
194
+ origin,
195
+ error
196
+ }));
197
+ } catch (error) {
198
+ logger.debug("Failed to remember the signature spec for {origin}: {error}", {
199
+ origin,
200
+ error
201
+ });
202
+ }
203
+ }
204
+ };
205
+ const timer = setTimeout(() => controller.abort(new DOMException("The delivery timed out.", "TimeoutError")), timeoutMs);
206
+ try {
207
+ outcome = rsaKey == null ? await fetchWithValidatedRedirects(request, openHop, (response) => consumeSendActivityResponse(response, inbox, signal), signal) : await doubleKnockScoped(request, rsaKey, {
208
+ tracerProvider,
209
+ specDeterminer: boundedSpecDeterminer,
210
+ signal
211
+ }, openHop, (response) => consumeSendActivityResponse(response, inbox, signal));
212
+ } catch (error) {
213
+ let failureError = error;
214
+ if (signal.aborted && !(error instanceof SendActivityError)) {
215
+ const failure = new FetchError(inbox.href, `Timed out after ${timeoutMs} ms`);
216
+ failure.cause = signal.reason;
217
+ failureError = failure;
218
+ }
219
+ if (opened || signal.aborted) logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
220
+ activityId,
221
+ inbox: inbox.href,
222
+ error: failureError
223
+ });
224
+ throw failureError;
225
+ } finally {
226
+ clearTimeout(timer);
227
+ }
228
+ if (!outcome.ok) {
229
+ const { status, statusText, error } = outcome;
230
+ logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
231
+ activityId,
232
+ inbox: inbox.href,
233
+ status,
234
+ statusText,
235
+ error
236
+ });
237
+ throw new SendActivityError(inbox, status, `Failed to send activity ${activityId} to ${inbox.href} (${status} ${statusText}):\n${error}`, error);
238
+ }
239
+ span.addEvent("activitypub.activity.sent", {
240
+ "activitypub.activity.json": JSON.stringify(activity),
241
+ "activitypub.inbox.url": inbox.href,
242
+ "activitypub.activity.id": activityId ?? ""
243
+ });
244
+ }
245
+ /**
246
+ * Starts cancelling the body of a response without waiting for it to settle.
247
+ * The cancellation of a branch of a tee (e.g., a body cloned by a fetch mock)
248
+ * settles only after the other branch is cancelled too, per the Streams
249
+ * standard, so awaiting it could block forever. Failures are only logged.
250
+ */
251
+ function cancelResponseBody(response, url) {
252
+ response.body?.cancel().catch((error) => {
253
+ getLogger([
254
+ "fedify",
255
+ "federation",
256
+ "outbox"
257
+ ]).debug("Failed to cancel the response body from {url}: {error}", {
258
+ url,
259
+ error
260
+ });
261
+ });
262
+ }
263
+ /**
264
+ * Reads what is needed from the final response of a delivery while its
265
+ * session is open: the body of a successful response is cancelled, and at
266
+ * most 1 KiB of an error response body is read.
267
+ */
268
+ async function consumeSendActivityResponse(response, inbox, signal) {
269
+ if (response.ok) {
270
+ cancelResponseBody(response, response.url || inbox.href);
271
+ return { ok: true };
272
+ }
273
+ let error;
274
+ try {
275
+ error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES, signal);
276
+ } catch (_) {
277
+ error = "";
278
+ }
279
+ if (signal.aborted) error = "(timed out reading response body)";
280
+ return {
281
+ ok: false,
282
+ status: response.status,
283
+ statusText: response.statusText,
284
+ error
285
+ };
286
+ }
287
+ /**
288
+ * Sends a request without signing it, following redirects manually like the
289
+ * Fetch standard does. Every hop is opened with `openHop()`, which validates
290
+ * the destination, after the previous hop is closed. The final response is
291
+ * passed to `consume()`, and its session is closed after that.
292
+ * This is exported only for tests; it is not exported from any entry point.
293
+ * @param request The request to send.
294
+ * @param openHop The function to open a session for each hop.
295
+ * @param consume The function to consume the final response.
296
+ * @returns The value returned by `consume`.
297
+ */
298
+ async function fetchWithValidatedRedirects(request, openHop, consume, signal) {
299
+ const logger = getLogger([
300
+ "fedify",
301
+ "federation",
302
+ "outbox"
303
+ ]);
304
+ let body = await request.clone().text();
305
+ for (let redirects = 0;; redirects++) {
306
+ signal?.throwIfAborted();
307
+ const session = await openHop(request.url);
308
+ let response;
309
+ try {
310
+ response = await session.fetch(request, {
311
+ redirect: "manual",
312
+ signal
313
+ });
314
+ } catch (error) {
315
+ await closeAfterError(session, logger);
316
+ throw error;
317
+ }
318
+ const location = response.headers.get("Location");
319
+ if (![
320
+ 301,
321
+ 302,
322
+ 303,
323
+ 307,
324
+ 308
325
+ ].includes(response.status) || location == null) try {
326
+ return await consume(response);
327
+ } catch (error) {
328
+ logger.debug("Failed to consume the response from {url}; closing the session: {error}", {
329
+ url: request.url,
330
+ error
331
+ });
332
+ throw error;
333
+ } finally {
334
+ await session.close();
335
+ }
336
+ cancelResponseBody(response, request.url);
337
+ await session.close();
338
+ if (redirects >= 20) throw new TypeError("Too many redirects");
339
+ const url = new URL(location, request.url);
340
+ const headers = new Headers(request.headers);
341
+ if (url.origin !== new URL(request.url).origin) {
342
+ headers.delete("Authorization");
343
+ headers.delete("Proxy-Authorization");
344
+ headers.delete("Cookie");
345
+ headers.delete("Host");
346
+ }
347
+ let method = request.method;
348
+ if ((response.status === 301 || response.status === 302) && method === "POST" || response.status === 303 && method !== "GET" && method !== "HEAD") {
349
+ method = "GET";
350
+ body = void 0;
351
+ for (const name of [
352
+ "Content-Encoding",
353
+ "Content-Language",
354
+ "Content-Length",
355
+ "Content-Location",
356
+ "Content-Type"
357
+ ]) headers.delete(name);
358
+ }
359
+ request = new Request(url, {
360
+ method,
361
+ headers,
362
+ body,
363
+ redirect: "manual",
364
+ signal: signal ?? request.signal
365
+ });
366
+ }
367
+ }
368
+ async function closeAfterError(session, logger) {
369
+ try {
370
+ await session.close();
371
+ } catch (error) {
372
+ logger.debug("Failed to close the session for {url}: {error}", {
373
+ url: session.url.href,
374
+ error
375
+ });
376
+ }
377
+ }
378
+ /**
379
+ * An error that is thrown when an activity fails to send to a remote inbox.
380
+ * It contains structured information about the failure, including the HTTP
381
+ * status code, the inbox URL, and the response body.
382
+ * @since 2.0.0
383
+ */
384
+ var SendActivityError = class extends Error {
385
+ /**
386
+ * The inbox URL that the activity was being sent to.
387
+ */
388
+ inbox;
389
+ /**
390
+ * The HTTP status code returned by the inbox.
391
+ */
392
+ statusCode;
393
+ /**
394
+ * The response body from the inbox, if any. Note that this may be
395
+ * truncated to a maximum of 1 KiB to prevent excessive memory consumption
396
+ * when remote servers return large error pages (e.g., Cloudflare error pages).
397
+ * If truncated, the string will end with `"… (truncated)"`.
398
+ */
399
+ responseBody;
400
+ /**
401
+ * Creates a new {@link SendActivityError}.
402
+ * @param inbox The inbox URL.
403
+ * @param statusCode The HTTP status code.
404
+ * @param message The error message.
405
+ * @param responseBody The response body.
406
+ */
407
+ constructor(inbox, statusCode, message, responseBody) {
408
+ super(message);
409
+ this.name = "SendActivityError";
410
+ this.inbox = inbox;
411
+ this.statusCode = statusCode;
412
+ this.responseBody = responseBody;
413
+ }
414
+ };
415
+ //#endregion
416
+ export { sendActivity as i, extractInboxes as n, fetchWithValidatedRedirects as r, SendActivityError as t };