@fedify/fedify 2.0.0-dev.323 → 2.0.0-dev.372
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.
- package/README.md +8 -0
- package/dist/{builder-CvKuNW7P.js → builder-BxlBAtuD.js} +8 -3
- package/dist/compat/mod.d.cts +2 -2
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/transformers.test.js +11 -11
- package/dist/{context-Zqld1re2.d.cts → context-Cf0-LmZC.d.cts} +92 -1
- package/dist/{context-CJO1oqSa.d.ts → context-liIe6DFH.d.ts} +92 -1
- package/dist/{deno-BTAi5-ur.js → deno-CDo9j5Hk.js} +1 -4
- package/dist/{docloader-D8dzb6AT.js → docloader-Cl-iMQFP.js} +2 -2
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +11 -11
- package/dist/federation/idempotency.test.js +11 -11
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +171 -11
- package/dist/federation/mod.cjs +5 -4
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +5 -5
- package/dist/federation/send.test.js +89 -6
- package/dist/federation/webfinger.test.js +11 -11
- package/dist/{http-BCfCt7nq.cjs → http-B8cUSIVv.cjs} +1 -4
- package/dist/{http-C4WANccp.js → http-BQhAaO-e.js} +2 -2
- package/dist/{http-C02fQ5SX.js → http-C_qj3I7F.js} +1 -4
- package/dist/{inbox-CdBcxHA7.js → inbox-B4kgSsVH.js} +1 -1
- package/dist/{key-BI6sqU5u.js → key-DtVs0UwP.js} +1 -1
- package/dist/{kv-cache-BLxaWwPk.js → kv-cache-CibadbOC.js} +1 -1
- package/dist/{kv-cache-Dk9UX_M2.cjs → kv-cache-CkfpyCN5.cjs} +1 -1
- package/dist/{ld-qTcTL2A4.js → ld-BLHZlaWL.js} +2 -2
- package/dist/{middleware-BhYGJwH9.js → middleware-BDQ8PDFx.js} +4 -4
- package/dist/{middleware-DG4UsFBP.js → middleware-BQigFVlt.js} +11 -11
- package/dist/{middleware-DaOdxVOc.js → middleware-C5W9b9D9.js} +154 -93
- package/dist/{middleware-LQKxYF7X.js → middleware-CEcrmJf2.js} +189 -89
- package/dist/middleware-COrE1spG.cjs +12 -0
- package/dist/{middleware-nW8ONmt3.cjs → middleware-DfAuhaf7.cjs} +194 -88
- package/dist/{mod-Bpuc-q64.d.ts → mod-B9_l3te3.d.ts} +1 -1
- package/dist/{mod-CKtAEVny.d.cts → mod-Do_sZWAA.d.cts} +1 -1
- package/dist/{mod-C92O3FpJ.d.ts → mod-Dquroqiv.d.ts} +1 -1
- package/dist/{mod-DFWeUq2q.d.cts → mod-H3ScYaOb.d.cts} +1 -1
- package/dist/mod.cjs +6 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +6 -5
- package/dist/nodeinfo/handler.test.js +11 -11
- package/dist/{owner-Cfmtlwoe.js → owner-BwS4q7BU.js} +1 -1
- package/dist/{proof-OjMPhNWs.js → proof-Cq8LNpQ3.js} +1 -1
- package/dist/{proof-BoqEqbih.cjs → proof-EVy7shg_.cjs} +1 -1
- package/dist/{proof-Bc8ULrzP.js → proof-N5F9c402.js} +2 -2
- package/dist/{send-BKW3wSXo.js → send-DpOe6hgL.js} +38 -4
- package/dist/sig/http.test.js +3 -3
- package/dist/sig/key.test.js +2 -2
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +80 -0
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.js +2 -2
- package/package.json +8 -8
- package/dist/middleware-Dsrm1uhx.cjs +0 -12
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-C3FLHUd6.js";
|
|
6
|
-
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-
|
|
7
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
6
|
+
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-C_qj3I7F.js";
|
|
7
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-Cq8LNpQ3.js";
|
|
8
8
|
import { getNodeInfo, nodeInfoToJson } from "./types-C93Ob9cU.js";
|
|
9
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-
|
|
9
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-CibadbOC.js";
|
|
10
10
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
12
12
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -322,6 +322,7 @@ var FederationBuilderImpl = class {
|
|
|
322
322
|
inboxListeners;
|
|
323
323
|
inboxErrorHandler;
|
|
324
324
|
sharedInboxKeyDispatcher;
|
|
325
|
+
outboxPermanentFailureHandler;
|
|
325
326
|
idempotencyStrategy;
|
|
326
327
|
collectionTypeIds;
|
|
327
328
|
collectionCallbacks;
|
|
@@ -337,7 +338,7 @@ var FederationBuilderImpl = class {
|
|
|
337
338
|
this.collectionTypeIds = {};
|
|
338
339
|
}
|
|
339
340
|
async build(options) {
|
|
340
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
341
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-BDQ8PDFx.js");
|
|
341
342
|
const f = new FederationImpl$1(options);
|
|
342
343
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
343
344
|
f.router = this.router.clone();
|
|
@@ -359,6 +360,7 @@ var FederationBuilderImpl = class {
|
|
|
359
360
|
f.inboxListeners = this.inboxListeners?.clone();
|
|
360
361
|
f.inboxErrorHandler = this.inboxErrorHandler;
|
|
361
362
|
f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
|
|
363
|
+
f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
|
|
362
364
|
f.idempotencyStrategy = this.idempotencyStrategy;
|
|
363
365
|
return f;
|
|
364
366
|
}
|
|
@@ -840,6 +842,9 @@ var FederationBuilderImpl = class {
|
|
|
840
842
|
const path = this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
|
|
841
843
|
return path;
|
|
842
844
|
}
|
|
845
|
+
setOutboxPermanentFailureHandler(handler) {
|
|
846
|
+
this.outboxPermanentFailureHandler = handler;
|
|
847
|
+
}
|
|
843
848
|
/**
|
|
844
849
|
* Converts a name (string or symbol) to a unique string identifier.
|
|
845
850
|
* For symbols, generates and caches a UUID if not already present.
|
|
@@ -2180,7 +2185,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2180
2185
|
statusText: response.statusText,
|
|
2181
2186
|
error
|
|
2182
2187
|
});
|
|
2183
|
-
throw new
|
|
2188
|
+
throw new SendActivityError(inbox, response.status, `Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`, error);
|
|
2184
2189
|
}
|
|
2185
2190
|
span.addEvent("activitypub.activity.sent", {
|
|
2186
2191
|
"activitypub.activity.json": JSON.stringify(activity),
|
|
@@ -2188,6 +2193,40 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2188
2193
|
"activitypub.activity.id": activityId ?? ""
|
|
2189
2194
|
});
|
|
2190
2195
|
}
|
|
2196
|
+
/**
|
|
2197
|
+
* An error that is thrown when an activity fails to send to a remote inbox.
|
|
2198
|
+
* It contains structured information about the failure, including the HTTP
|
|
2199
|
+
* status code, the inbox URL, and the response body.
|
|
2200
|
+
* @since 2.0.0
|
|
2201
|
+
*/
|
|
2202
|
+
var SendActivityError = class extends Error {
|
|
2203
|
+
/**
|
|
2204
|
+
* The inbox URL that the activity was being sent to.
|
|
2205
|
+
*/
|
|
2206
|
+
inbox;
|
|
2207
|
+
/**
|
|
2208
|
+
* The HTTP status code returned by the inbox.
|
|
2209
|
+
*/
|
|
2210
|
+
statusCode;
|
|
2211
|
+
/**
|
|
2212
|
+
* The response body from the inbox, if any.
|
|
2213
|
+
*/
|
|
2214
|
+
responseBody;
|
|
2215
|
+
/**
|
|
2216
|
+
* Creates a new {@link SendActivityError}.
|
|
2217
|
+
* @param inbox The inbox URL.
|
|
2218
|
+
* @param statusCode The HTTP status code.
|
|
2219
|
+
* @param message The error message.
|
|
2220
|
+
* @param responseBody The response body.
|
|
2221
|
+
*/
|
|
2222
|
+
constructor(inbox, statusCode, message, responseBody) {
|
|
2223
|
+
super(message);
|
|
2224
|
+
this.name = "SendActivityError";
|
|
2225
|
+
this.inbox = inbox;
|
|
2226
|
+
this.statusCode = statusCode;
|
|
2227
|
+
this.responseBody = responseBody;
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2191
2230
|
|
|
2192
2231
|
//#endregion
|
|
2193
2232
|
//#region src/federation/webfinger.ts
|
|
@@ -2349,12 +2388,13 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2349
2388
|
allowPrivateAddress;
|
|
2350
2389
|
userAgent;
|
|
2351
2390
|
onOutboxError;
|
|
2391
|
+
permanentFailureStatusCodes;
|
|
2352
2392
|
signatureTimeWindow;
|
|
2353
2393
|
skipSignatureVerification;
|
|
2354
2394
|
outboxRetryPolicy;
|
|
2355
2395
|
inboxRetryPolicy;
|
|
2356
2396
|
activityTransformers;
|
|
2357
|
-
|
|
2397
|
+
_tracerProvider;
|
|
2358
2398
|
firstKnock;
|
|
2359
2399
|
constructor(options) {
|
|
2360
2400
|
super();
|
|
@@ -2430,14 +2470,18 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2430
2470
|
}));
|
|
2431
2471
|
this.userAgent = userAgent;
|
|
2432
2472
|
this.onOutboxError = options.onOutboxError;
|
|
2473
|
+
this.permanentFailureStatusCodes = options.permanentFailureStatusCodes ?? [404, 410];
|
|
2433
2474
|
this.signatureTimeWindow = options.signatureTimeWindow ?? { hours: 1 };
|
|
2434
2475
|
this.skipSignatureVerification = options.skipSignatureVerification ?? false;
|
|
2435
2476
|
this.outboxRetryPolicy = options.outboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
2436
2477
|
this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
2437
2478
|
this.activityTransformers = options.activityTransformers ?? getDefaultActivityTransformers();
|
|
2438
|
-
this.
|
|
2479
|
+
this._tracerProvider = options.tracerProvider;
|
|
2439
2480
|
this.firstKnock = options.firstKnock;
|
|
2440
2481
|
}
|
|
2482
|
+
get tracerProvider() {
|
|
2483
|
+
return this._tracerProvider ?? trace.getTracerProvider();
|
|
2484
|
+
}
|
|
2441
2485
|
_initializeRouter() {
|
|
2442
2486
|
this.router.add("/.well-known/webfinger", "webfinger");
|
|
2443
2487
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
@@ -2478,18 +2522,24 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2478
2522
|
kind: SpanKind.CONSUMER,
|
|
2479
2523
|
attributes: { "activitypub.activity.type": message.activityType }
|
|
2480
2524
|
}, extractedContext, async (span) => {
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2525
|
+
const spanCtx = span.spanContext();
|
|
2526
|
+
return await withContext({
|
|
2527
|
+
traceId: spanCtx.traceId,
|
|
2528
|
+
spanId: spanCtx.spanId
|
|
2529
|
+
}, async () => {
|
|
2530
|
+
if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
|
|
2531
|
+
try {
|
|
2532
|
+
await this.#listenFanoutMessage(contextData, message);
|
|
2533
|
+
} catch (e) {
|
|
2534
|
+
span.setStatus({
|
|
2535
|
+
code: SpanStatusCode.ERROR,
|
|
2536
|
+
message: String(e)
|
|
2537
|
+
});
|
|
2538
|
+
throw e;
|
|
2539
|
+
} finally {
|
|
2540
|
+
span.end();
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2493
2543
|
});
|
|
2494
2544
|
else if (message.type === "outbox") await tracer.startActiveSpan("activitypub.outbox", {
|
|
2495
2545
|
kind: SpanKind.CONSUMER,
|
|
@@ -2498,34 +2548,46 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2498
2548
|
"activitypub.activity.retries": message.attempt
|
|
2499
2549
|
}
|
|
2500
2550
|
}, extractedContext, async (span) => {
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2551
|
+
const spanCtx = span.spanContext();
|
|
2552
|
+
return await withContext({
|
|
2553
|
+
traceId: spanCtx.traceId,
|
|
2554
|
+
spanId: spanCtx.spanId
|
|
2555
|
+
}, async () => {
|
|
2556
|
+
if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
|
|
2557
|
+
try {
|
|
2558
|
+
await this.#listenOutboxMessage(contextData, message, span);
|
|
2559
|
+
} catch (e) {
|
|
2560
|
+
span.setStatus({
|
|
2561
|
+
code: SpanStatusCode.ERROR,
|
|
2562
|
+
message: String(e)
|
|
2563
|
+
});
|
|
2564
|
+
throw e;
|
|
2565
|
+
} finally {
|
|
2566
|
+
span.end();
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2513
2569
|
});
|
|
2514
2570
|
else if (message.type === "inbox") await tracer.startActiveSpan("activitypub.inbox", {
|
|
2515
2571
|
kind: SpanKind.CONSUMER,
|
|
2516
2572
|
attributes: { "activitypub.shared_inbox": message.identifier == null }
|
|
2517
2573
|
}, extractedContext, async (span) => {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2574
|
+
const spanCtx = span.spanContext();
|
|
2575
|
+
return await withContext({
|
|
2576
|
+
traceId: spanCtx.traceId,
|
|
2577
|
+
spanId: spanCtx.spanId
|
|
2578
|
+
}, async () => {
|
|
2579
|
+
try {
|
|
2580
|
+
await this.#listenInboxMessage(contextData, message, span);
|
|
2581
|
+
} catch (e) {
|
|
2582
|
+
span.setStatus({
|
|
2583
|
+
code: SpanStatusCode.ERROR,
|
|
2584
|
+
message: String(e)
|
|
2585
|
+
});
|
|
2586
|
+
throw e;
|
|
2587
|
+
} finally {
|
|
2588
|
+
span.end();
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2529
2591
|
});
|
|
2530
2592
|
});
|
|
2531
2593
|
}
|
|
@@ -2612,13 +2674,44 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2612
2674
|
tracerProvider: this.tracerProvider
|
|
2613
2675
|
});
|
|
2614
2676
|
try {
|
|
2615
|
-
this.onOutboxError?.(error, activity);
|
|
2677
|
+
await this.onOutboxError?.(error, activity);
|
|
2616
2678
|
} catch (error$1) {
|
|
2617
2679
|
logger$1.error("An unexpected error occurred in onError handler:\n{error}", {
|
|
2618
2680
|
...logData,
|
|
2619
2681
|
error: error$1
|
|
2620
2682
|
});
|
|
2621
2683
|
}
|
|
2684
|
+
if (error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode)) {
|
|
2685
|
+
logger$1.warn("Permanent delivery failure for activity {activityId} to {inbox} ({status}); not retrying.", {
|
|
2686
|
+
...logData,
|
|
2687
|
+
status: error.statusCode
|
|
2688
|
+
});
|
|
2689
|
+
if (this.outboxPermanentFailureHandler != null) {
|
|
2690
|
+
const ctx = this.#createContext(new URL(message.baseUrl), _, { documentLoader: this.documentLoaderFactory(loaderOptions) });
|
|
2691
|
+
try {
|
|
2692
|
+
await this.outboxPermanentFailureHandler(ctx, {
|
|
2693
|
+
inbox: new URL(message.inbox),
|
|
2694
|
+
activity,
|
|
2695
|
+
error,
|
|
2696
|
+
statusCode: error.statusCode,
|
|
2697
|
+
actorIds: (message.actorIds ?? []).flatMap((id) => {
|
|
2698
|
+
try {
|
|
2699
|
+
return [new URL(id)];
|
|
2700
|
+
} catch {
|
|
2701
|
+
logger$1.warn("Invalid actorId URL in OutboxMessage: {id}", { id });
|
|
2702
|
+
return [];
|
|
2703
|
+
}
|
|
2704
|
+
})
|
|
2705
|
+
});
|
|
2706
|
+
} catch (handlerError) {
|
|
2707
|
+
logger$1.error("An unexpected error occurred in outboxPermanentFailureHandler:\n{error}", {
|
|
2708
|
+
...logData,
|
|
2709
|
+
error: handlerError
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2622
2715
|
if (this.outboxQueue?.nativeRetrial) {
|
|
2623
2716
|
logger$1.error("Failed to send activity {activityId} to {inbox}; backend will handle retry:\n{error}", {
|
|
2624
2717
|
...logData,
|
|
@@ -2909,6 +3002,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2909
3002
|
activityType: getTypeId(activity).href,
|
|
2910
3003
|
inbox,
|
|
2911
3004
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
3005
|
+
actorIds: [...inboxes[inbox].actorIds],
|
|
2912
3006
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2913
3007
|
attempt: 0,
|
|
2914
3008
|
headers: collectionSync == null ? {} : { "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) },
|
|
@@ -2966,54 +3060,60 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2966
3060
|
[ATTR_URL_FULL]: request.url
|
|
2967
3061
|
}
|
|
2968
3062
|
}, async (span) => {
|
|
2969
|
-
const
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
3063
|
+
const spanCtx = span.spanContext();
|
|
3064
|
+
return await withContext({
|
|
3065
|
+
traceId: spanCtx.traceId,
|
|
3066
|
+
spanId: spanCtx.spanId
|
|
3067
|
+
}, async () => {
|
|
3068
|
+
const logger$1 = getLogger([
|
|
3069
|
+
"fedify",
|
|
3070
|
+
"federation",
|
|
3071
|
+
"http"
|
|
3072
|
+
]);
|
|
3073
|
+
if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(k), [v]);
|
|
3074
|
+
let response;
|
|
3075
|
+
try {
|
|
3076
|
+
response = await this.#fetch(request, {
|
|
3077
|
+
...options,
|
|
3078
|
+
span,
|
|
3079
|
+
tracer
|
|
3080
|
+
});
|
|
3081
|
+
if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
|
|
3082
|
+
} catch (error) {
|
|
3083
|
+
span.setStatus({
|
|
3084
|
+
code: SpanStatusCode.ERROR,
|
|
3085
|
+
message: `${error}`
|
|
3086
|
+
});
|
|
3087
|
+
span.end();
|
|
3088
|
+
logger$1.error("An error occurred while serving request {method} {url}: {error}", {
|
|
3089
|
+
method: request.method,
|
|
3090
|
+
url: request.url,
|
|
3091
|
+
error
|
|
3092
|
+
});
|
|
3093
|
+
throw error;
|
|
3094
|
+
}
|
|
3095
|
+
if (span.isRecording()) {
|
|
3096
|
+
span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
|
|
3097
|
+
for (const [k, v] of response.headers) span.setAttribute(ATTR_HTTP_RESPONSE_HEADER(k), [v]);
|
|
3098
|
+
span.setStatus({
|
|
3099
|
+
code: response.status >= 500 ? SpanStatusCode.ERROR : SpanStatusCode.UNSET,
|
|
3100
|
+
message: response.statusText
|
|
3101
|
+
});
|
|
3102
|
+
}
|
|
2988
3103
|
span.end();
|
|
2989
|
-
|
|
3104
|
+
const url = new URL(request.url);
|
|
3105
|
+
const logTpl = "{method} {path}: {status}";
|
|
3106
|
+
const values = {
|
|
2990
3107
|
method: request.method,
|
|
3108
|
+
path: `${url.pathname}${url.search}`,
|
|
2991
3109
|
url: request.url,
|
|
2992
|
-
|
|
2993
|
-
}
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
span.setStatus({
|
|
3000
|
-
code: response.status >= 500 ? SpanStatusCode.ERROR : SpanStatusCode.UNSET,
|
|
3001
|
-
message: response.statusText
|
|
3002
|
-
});
|
|
3003
|
-
}
|
|
3004
|
-
span.end();
|
|
3005
|
-
const url = new URL(request.url);
|
|
3006
|
-
const logTpl = "{method} {path}: {status}";
|
|
3007
|
-
const values = {
|
|
3008
|
-
method: request.method,
|
|
3009
|
-
path: `${url.pathname}${url.search}`,
|
|
3010
|
-
url: request.url,
|
|
3011
|
-
status: response.status
|
|
3012
|
-
};
|
|
3013
|
-
if (response.status >= 500) logger$1.error(logTpl, values);
|
|
3014
|
-
else if (response.status >= 400) logger$1.warn(logTpl, values);
|
|
3015
|
-
else logger$1.info(logTpl, values);
|
|
3016
|
-
return response;
|
|
3110
|
+
status: response.status
|
|
3111
|
+
};
|
|
3112
|
+
if (response.status >= 500) logger$1.error(logTpl, values);
|
|
3113
|
+
else if (response.status >= 400) logger$1.warn(logTpl, values);
|
|
3114
|
+
else logger$1.info(logTpl, values);
|
|
3115
|
+
return response;
|
|
3116
|
+
});
|
|
3017
3117
|
});
|
|
3018
3118
|
});
|
|
3019
3119
|
}
|
|
@@ -4197,4 +4297,4 @@ function getRequestId(request) {
|
|
|
4197
4297
|
}
|
|
4198
4298
|
|
|
4199
4299
|
//#endregion
|
|
4200
|
-
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, Router$1 as Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
|
4300
|
+
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, Router$1 as Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('./transformers-3g8GZwkZ.cjs');
|
|
6
|
+
require('./http-B8cUSIVv.cjs');
|
|
7
|
+
const require_middleware = require('./middleware-DfAuhaf7.cjs');
|
|
8
|
+
require('./proof-EVy7shg_.cjs');
|
|
9
|
+
require('./types-Cd_hszr_.cjs');
|
|
10
|
+
require('./kv-cache-CkfpyCN5.cjs');
|
|
11
|
+
|
|
12
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|