@fedify/fedify 2.3.0-dev.1021 → 2.3.0-dev.1034
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/dist/{builder-Nn2r1dKd.mjs → builder-y06Dq5bp.mjs} +3 -3
- package/dist/chunk-QSgtlS85.mjs +29 -0
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +1 -1
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +2 -2
- package/dist/{context-Dk_tacqz.mjs → context-7Azky82W.mjs} +3 -2
- package/dist/{context-Bxs4cdIZ.d.cts → context-BKLGj9QO.d.cts} +12 -1
- package/dist/{context-CVNXcFHR.d.ts → context-DrNqYkPw.d.ts} +12 -1
- package/dist/{deno-BnQyJ03o.mjs → deno-DB1H1VHx.mjs} +1 -1
- package/dist/{docloader-mEJ3hsMB.mjs → docloader-3HwiWeYL.mjs} +2 -2
- package/dist/{esm-DVILvP5e.mjs → esm-DhnRLoG9.mjs} +1 -24
- package/dist/execAsync-eck5rbtb.mjs +13 -0
- package/dist/federation/builder.test.mjs +2 -2
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +48 -11
- package/dist/federation/idempotency.test.mjs +4 -4
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +2 -2
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +103 -12
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/negotiation.test.mjs +1 -1
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/send.test.mjs +4540 -11
- package/dist/federation/webfinger.test.mjs +3 -3
- package/dist/getMachineId-bsd-DqZ4QRFp.mjs +29 -0
- package/dist/getMachineId-darwin-DMbbW3m7.mjs +26 -0
- package/dist/getMachineId-linux-lyeD2ug3.mjs +22 -0
- package/dist/getMachineId-unsupported-JuKr57jY.mjs +17 -0
- package/dist/getMachineId-win-Dxyf5pJq.mjs +28 -0
- package/dist/{http-BJ-t29n_.js → http-BUr93aO6.js} +1 -1
- package/dist/{http-CfToB_iu.mjs → http-D9zG-L9N.mjs} +3 -3
- package/dist/{http-D4xMqSqO.cjs → http-FnUTcdMf.cjs} +1 -1
- package/dist/{key-CeANlo1H.mjs → key-CV57mOYH.mjs} +1 -1
- package/dist/{kv-cache-DRwOjOkl.cjs → kv-cache-BG9O8wVV.cjs} +1 -1
- package/dist/{kv-cache-B142kDZL.js → kv-cache-C3esyJFP.js} +1 -1
- package/dist/{ld-CUlVC-TS.mjs → ld-sUf94RJ8.mjs} +2 -2
- package/dist/{middleware-I5XEZ_pZ.cjs → middleware-CKkBrsOD.cjs} +185 -27
- package/dist/{middleware-Cgy7UwfR.mjs → middleware-cMxbPxDe.mjs} +1 -1
- package/dist/{middleware-CysDkaXo.js → middleware-fAuUxD9-.js} +185 -27
- package/dist/{middleware-ASvK22Do.cjs → middleware-ohzkLsW4.cjs} +1 -1
- package/dist/{middleware-BPZEcrMG.mjs → middleware-pb2EqN_r.mjs} +67 -22
- package/dist/{mod-Bc6p4npy.d.ts → mod-B8Z8mBLk.d.ts} +1 -1
- package/dist/{mod-zA6NZHUG.d.cts → mod-DClCOv0M.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +2 -2
- package/dist/nodeinfo/handler.test.mjs +3 -3
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/otel/exporter.test.mjs +25 -22
- package/dist/otel/mod.cjs +6 -5
- package/dist/otel/mod.d.cts +3 -2
- package/dist/otel/mod.d.ts +3 -2
- package/dist/otel/mod.js +6 -5
- package/dist/{outgoing-jsonld-CNmZLixq.mjs → outgoing-jsonld-Bi7n-dEy.mjs} +1 -1
- package/dist/{owner-CuW0S2XY.mjs → owner-DsPgl527.mjs} +2 -2
- package/dist/{proof-oGiWJkX0.cjs → proof-BhJpq_J9.cjs} +1 -1
- package/dist/{proof-CFPGr1xC.mjs → proof-iVfYyJpY.mjs} +4 -4
- package/dist/{proof-CtMmqa09.js → proof-k4mEvvdS.js} +1 -1
- package/dist/send-D-vYdfC6.mjs +306 -0
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/http.test.mjs +4 -4
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +2 -2
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/testing/mod.d.mts +6 -1
- package/dist/testing/mod.mjs +1 -1
- package/dist/utils/docloader.test.mjs +4 -4
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -6
- package/dist/send-dhl-s8G0.mjs +0 -193
- /package/dist/{accept-CPkZzmGN.mjs → accept-CceiKpCy.mjs} +0 -0
- /package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
- /package/dist/{client-D_1QpnWt.mjs → client-CIiz1WX7.mjs} +0 -0
- /package/dist/{collection-D-HqUuA2.mjs → collection-CA3V5zyK.mjs} +0 -0
- /package/dist/{keycache-EGATflN-.mjs → keycache-BeU0LCII.mjs} +0 -0
- /package/dist/{keys-DGu1NFwu.mjs → keys-C3kae-6B.mjs} +0 -0
- /package/dist/{kv-cache-U__xU4qR.mjs → kv-cache-Bmv7tUzz.mjs} +0 -0
- /package/dist/{kv-rV3vodCc.mjs → kv-x2IvBUyq.mjs} +0 -0
- /package/dist/{negotiation-SQvQgUqe.mjs → negotiation-VnHNB0Q5.mjs} +0 -0
- /package/dist/{public-audience-DYFHzm_c.mjs → public-audience-PVTwU_Ex.mjs} +0 -0
- /package/dist/{retry-bMXBL97A.mjs → retry-_VvV0h9f.mjs} +0 -0
- /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
|
@@ -2,13 +2,13 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./chunk-nlSIicah.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-ve6e2xcg.js";
|
|
5
|
-
import { _ as version, a as verifyRequestDetailed, d as validateCryptoKey, f as formatAcceptSignature, g as name, i as verifyRequest, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, u as importJwk } from "./http-
|
|
6
|
-
import { c as getKeyOwner, d as detachSignature, f as hasSignatureLike, i as verifyObject, m as verifyJsonLd, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, p as signJsonLd, r as signObject, s as doesActorOwnKey } from "./proof-
|
|
5
|
+
import { _ as version, a as verifyRequestDetailed, d as validateCryptoKey, f as formatAcceptSignature, g as name, i as verifyRequest, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, u as importJwk } from "./http-BUr93aO6.js";
|
|
6
|
+
import { c as getKeyOwner, d as detachSignature, f as hasSignatureLike, i as verifyObject, m as verifyJsonLd, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, p as signJsonLd, r as signObject, s as doesActorOwnKey } from "./proof-k4mEvvdS.js";
|
|
7
7
|
import { n as getNodeInfo, t as nodeInfoToJson } from "./types-hvL8ElAs.js";
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C3esyJFP.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
11
|
-
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
11
|
+
import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
|
|
12
12
|
import { cloneDeep, uniq } from "es-toolkit";
|
|
13
13
|
import { Router } from "uri-template-router";
|
|
14
14
|
import { parseTemplate } from "url-template";
|
|
@@ -779,8 +779,90 @@ async function buildCollectionSynchronizationHeader(collectionId, actorIds) {
|
|
|
779
779
|
return `collectionId="${collectionId}", url="${url}", digest="${encodeHex(await digest(actorIds))}"`;
|
|
780
780
|
}
|
|
781
781
|
//#endregion
|
|
782
|
+
//#region src/federation/metrics.ts
|
|
783
|
+
var FederationMetrics = class {
|
|
784
|
+
deliverySent;
|
|
785
|
+
deliveryPermanentFailure;
|
|
786
|
+
signatureVerificationFailure;
|
|
787
|
+
deliveryDuration;
|
|
788
|
+
inboxProcessingDuration;
|
|
789
|
+
constructor(meterProvider) {
|
|
790
|
+
const meter = meterProvider.getMeter(name, version);
|
|
791
|
+
this.deliverySent = meter.createCounter("activitypub.delivery.sent", {
|
|
792
|
+
description: "ActivityPub delivery attempts.",
|
|
793
|
+
unit: "{attempt}"
|
|
794
|
+
});
|
|
795
|
+
this.deliveryPermanentFailure = meter.createCounter("activitypub.delivery.permanent_failure", {
|
|
796
|
+
description: "ActivityPub deliveries abandoned as permanent failures.",
|
|
797
|
+
unit: "{failure}"
|
|
798
|
+
});
|
|
799
|
+
this.signatureVerificationFailure = meter.createCounter("activitypub.signature.verification_failure", {
|
|
800
|
+
description: "ActivityPub signature verification failures.",
|
|
801
|
+
unit: "{failure}"
|
|
802
|
+
});
|
|
803
|
+
this.deliveryDuration = meter.createHistogram("activitypub.delivery.duration", {
|
|
804
|
+
description: "Duration of ActivityPub delivery attempts.",
|
|
805
|
+
unit: "ms"
|
|
806
|
+
});
|
|
807
|
+
this.inboxProcessingDuration = meter.createHistogram("activitypub.inbox.processing_duration", {
|
|
808
|
+
description: "Duration of ActivityPub inbox listener processing.",
|
|
809
|
+
unit: "ms"
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
recordDelivery(inbox, durationMs, success, activityType) {
|
|
813
|
+
const deliveryAttributes = {
|
|
814
|
+
"activitypub.remote.host": getRemoteHost(inbox),
|
|
815
|
+
"activitypub.delivery.success": success
|
|
816
|
+
};
|
|
817
|
+
if (activityType != null) deliveryAttributes["activitypub.activity.type"] = activityType;
|
|
818
|
+
this.deliverySent.add(1, deliveryAttributes);
|
|
819
|
+
this.deliveryDuration.record(durationMs, deliveryAttributes);
|
|
820
|
+
}
|
|
821
|
+
recordPermanentFailure(inbox, statusCode) {
|
|
822
|
+
this.deliveryPermanentFailure.add(1, {
|
|
823
|
+
"activitypub.remote.host": getRemoteHost(inbox),
|
|
824
|
+
"http.response.status_code": statusCode
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
recordSignatureVerificationFailure(reason, remoteHost) {
|
|
828
|
+
const attributes = { "activitypub.verification.failure_reason": reason };
|
|
829
|
+
if (remoteHost != null) attributes["activitypub.remote.host"] = remoteHost;
|
|
830
|
+
this.signatureVerificationFailure.add(1, attributes);
|
|
831
|
+
}
|
|
832
|
+
recordInboxProcessingDuration(activityType, durationMs) {
|
|
833
|
+
this.inboxProcessingDuration.record(durationMs, { "activitypub.activity.type": activityType });
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
const federationMetrics = /* @__PURE__ */ new WeakMap();
|
|
837
|
+
/**
|
|
838
|
+
* Gets the cached Fedify metric instruments for a meter provider.
|
|
839
|
+
* @since 2.3.0
|
|
840
|
+
*/
|
|
841
|
+
function getFederationMetrics(meterProvider = metrics.getMeterProvider()) {
|
|
842
|
+
let instruments = federationMetrics.get(meterProvider);
|
|
843
|
+
if (instruments == null) {
|
|
844
|
+
instruments = new FederationMetrics(meterProvider);
|
|
845
|
+
federationMetrics.set(meterProvider, instruments);
|
|
846
|
+
}
|
|
847
|
+
return instruments;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Gets the bounded remote host attribute value for a URL.
|
|
851
|
+
* @since 2.3.0
|
|
852
|
+
*/
|
|
853
|
+
function getRemoteHost(url) {
|
|
854
|
+
return url.hostname;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Gets an elapsed duration in milliseconds from a `performance.now()` value.
|
|
858
|
+
* @since 2.3.0
|
|
859
|
+
*/
|
|
860
|
+
function getDurationMs(start) {
|
|
861
|
+
return Math.max(0, performance.now() - start);
|
|
862
|
+
}
|
|
863
|
+
//#endregion
|
|
782
864
|
//#region src/federation/inbox.ts
|
|
783
|
-
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
865
|
+
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, meterProvider, tracerProvider, idempotencyStrategy }) {
|
|
784
866
|
const logger = getLogger([
|
|
785
867
|
"fedify",
|
|
786
868
|
"federation",
|
|
@@ -881,7 +963,13 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
881
963
|
const { class: cls, listener } = dispatched;
|
|
882
964
|
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
883
965
|
try {
|
|
884
|
-
|
|
966
|
+
const activityType = getTypeId(activity).href;
|
|
967
|
+
const started = performance.now();
|
|
968
|
+
try {
|
|
969
|
+
await listener(inboxContextFactory(recipient, json, activity?.id?.href, activityType), activity);
|
|
970
|
+
} finally {
|
|
971
|
+
getFederationMetrics(meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
972
|
+
}
|
|
885
973
|
} catch (error) {
|
|
886
974
|
try {
|
|
887
975
|
await inboxErrorHandler?.(ctx, error);
|
|
@@ -1691,6 +1779,8 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1691
1779
|
});
|
|
1692
1780
|
if (verification.verified === false) {
|
|
1693
1781
|
const reason = verification.reason;
|
|
1782
|
+
const remoteHost = "keyId" in reason && reason.keyId != null ? getRemoteHost(reason.keyId) : void 0;
|
|
1783
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure(reason.type, remoteHost);
|
|
1694
1784
|
logger.error("Failed to verify the request's HTTP Signatures.", {
|
|
1695
1785
|
recipient,
|
|
1696
1786
|
reason: reason.type,
|
|
@@ -1777,6 +1867,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1777
1867
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
1778
1868
|
});
|
|
1779
1869
|
if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1870
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("actorKeyMismatch", httpSigKey.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
1780
1871
|
logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1781
1872
|
activity: json,
|
|
1782
1873
|
recipient,
|
|
@@ -1794,6 +1885,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1794
1885
|
}
|
|
1795
1886
|
if (pendingNonceLabel != null) {
|
|
1796
1887
|
if (!await verifySignatureNonce(request, kv, kvPrefixes.acceptSignatureNonce, pendingNonceLabel)) {
|
|
1888
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("invalidNonce", httpSigKey?.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
1797
1889
|
logger.error("Signature nonce verification failed (missing, expired, or replayed).", { recipient });
|
|
1798
1890
|
return await getFailedSignatureResponse(inboxChallengePolicy, kv, kvPrefixes);
|
|
1799
1891
|
}
|
|
@@ -1810,6 +1902,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1810
1902
|
kvPrefixes,
|
|
1811
1903
|
queue,
|
|
1812
1904
|
span,
|
|
1905
|
+
meterProvider: parameters.meterProvider,
|
|
1813
1906
|
tracerProvider,
|
|
1814
1907
|
idempotencyStrategy: parameters.idempotencyStrategy
|
|
1815
1908
|
});
|
|
@@ -2457,6 +2550,25 @@ function sendActivity(options) {
|
|
|
2457
2550
|
});
|
|
2458
2551
|
}
|
|
2459
2552
|
const MAX_ERROR_RESPONSE_BODY_BYTES = 1024;
|
|
2553
|
+
function getActivityActorId(activity) {
|
|
2554
|
+
if (!isRecord(activity)) return void 0;
|
|
2555
|
+
return getIdValue(activity.actor);
|
|
2556
|
+
}
|
|
2557
|
+
function getIdValue(value) {
|
|
2558
|
+
if (typeof value === "string" && value !== "") return value;
|
|
2559
|
+
if (value instanceof URL) return value.href;
|
|
2560
|
+
if (Array.isArray(value)) {
|
|
2561
|
+
for (const item of value) {
|
|
2562
|
+
const id = getIdValue(item);
|
|
2563
|
+
if (id != null) return id;
|
|
2564
|
+
}
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2567
|
+
if (isRecord(value)) return getIdValue(value.id);
|
|
2568
|
+
}
|
|
2569
|
+
function isRecord(value) {
|
|
2570
|
+
return typeof value === "object" && value != null;
|
|
2571
|
+
}
|
|
2460
2572
|
async function readLimitedResponseBody(response, maxBytes) {
|
|
2461
2573
|
if (response.body == null) return "";
|
|
2462
2574
|
const reader = response.body.getReader();
|
|
@@ -2484,12 +2596,15 @@ async function readLimitedResponseBody(response, maxBytes) {
|
|
|
2484
2596
|
if (truncated) result += "… (truncated)";
|
|
2485
2597
|
return result;
|
|
2486
2598
|
}
|
|
2487
|
-
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
2599
|
+
async function sendActivityInternal({ activity, activityId, activityType, keys, inbox, headers, specDeterminer, meterProvider, tracerProvider }, span) {
|
|
2488
2600
|
const logger = getLogger([
|
|
2489
2601
|
"fedify",
|
|
2490
2602
|
"federation",
|
|
2491
2603
|
"outbox"
|
|
2492
2604
|
]);
|
|
2605
|
+
const federationMetrics = getFederationMetrics(meterProvider);
|
|
2606
|
+
const started = performance.now();
|
|
2607
|
+
let deliverySuccess = false;
|
|
2493
2608
|
headers = new Headers(headers);
|
|
2494
2609
|
headers.set("Content-Type", "application/activity+json");
|
|
2495
2610
|
const request = new Request(inbox, {
|
|
@@ -2521,29 +2636,38 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2521
2636
|
inbox: inbox.href,
|
|
2522
2637
|
error
|
|
2523
2638
|
});
|
|
2639
|
+
federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
|
|
2524
2640
|
throw error;
|
|
2525
2641
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2642
|
+
try {
|
|
2643
|
+
if (!response.ok) {
|
|
2644
|
+
let error;
|
|
2645
|
+
try {
|
|
2646
|
+
error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES);
|
|
2647
|
+
} catch (_) {
|
|
2648
|
+
error = "";
|
|
2649
|
+
}
|
|
2650
|
+
logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
|
|
2651
|
+
activityId,
|
|
2652
|
+
inbox: inbox.href,
|
|
2653
|
+
status: response.status,
|
|
2654
|
+
statusText: response.statusText,
|
|
2655
|
+
error
|
|
2656
|
+
});
|
|
2657
|
+
throw new SendActivityError(inbox, response.status, `Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`, error);
|
|
2532
2658
|
}
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
inbox: inbox.href,
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2659
|
+
deliverySuccess = true;
|
|
2660
|
+
const eventAttributes = {
|
|
2661
|
+
"activitypub.inbox.url": inbox.href,
|
|
2662
|
+
"activitypub.activity.id": activityId ?? ""
|
|
2663
|
+
};
|
|
2664
|
+
if (activityType != null) eventAttributes["activitypub.activity.type"] = activityType;
|
|
2665
|
+
const actorId = getActivityActorId(activity);
|
|
2666
|
+
if (actorId != null) eventAttributes["activitypub.actor.id"] = actorId;
|
|
2667
|
+
span.addEvent("activitypub.activity.sent", eventAttributes);
|
|
2668
|
+
} finally {
|
|
2669
|
+
federationMetrics.recordDelivery(inbox, getDurationMs(started), deliverySuccess, activityType);
|
|
2541
2670
|
}
|
|
2542
|
-
span.addEvent("activitypub.activity.sent", {
|
|
2543
|
-
"activitypub.activity.json": JSON.stringify(activity),
|
|
2544
|
-
"activitypub.inbox.url": inbox.href,
|
|
2545
|
-
"activitypub.activity.id": activityId ?? ""
|
|
2546
|
-
});
|
|
2547
2671
|
}
|
|
2548
2672
|
/**
|
|
2549
2673
|
* An error that is thrown when an activity fails to send to a remote inbox.
|
|
@@ -2761,6 +2885,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2761
2885
|
inboxRetryPolicy;
|
|
2762
2886
|
activityTransformers;
|
|
2763
2887
|
_tracerProvider;
|
|
2888
|
+
_meterProvider;
|
|
2764
2889
|
firstKnock;
|
|
2765
2890
|
inboxChallengePolicy;
|
|
2766
2891
|
constructor(options) {
|
|
@@ -2846,11 +2971,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2846
2971
|
this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
2847
2972
|
this.activityTransformers = options.activityTransformers ?? getDefaultActivityTransformers();
|
|
2848
2973
|
this._tracerProvider = options.tracerProvider;
|
|
2974
|
+
this._meterProvider = options.meterProvider;
|
|
2849
2975
|
this.firstKnock = options.firstKnock;
|
|
2850
2976
|
}
|
|
2851
2977
|
get tracerProvider() {
|
|
2852
2978
|
return this._tracerProvider ?? trace.getTracerProvider();
|
|
2853
2979
|
}
|
|
2980
|
+
get meterProvider() {
|
|
2981
|
+
return this._meterProvider ?? metrics.getMeterProvider();
|
|
2982
|
+
}
|
|
2854
2983
|
_initializeRouter() {
|
|
2855
2984
|
this.router.add("/.well-known/webfinger", "webfinger");
|
|
2856
2985
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
@@ -3029,6 +3158,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3029
3158
|
sharedInbox: message.sharedInbox,
|
|
3030
3159
|
headers: new Headers(message.headers),
|
|
3031
3160
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
3161
|
+
meterProvider: this.meterProvider,
|
|
3032
3162
|
tracerProvider: this.tracerProvider
|
|
3033
3163
|
});
|
|
3034
3164
|
} catch (error) {
|
|
@@ -3036,6 +3166,21 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3036
3166
|
code: SpanStatusCode.ERROR,
|
|
3037
3167
|
message: String(error)
|
|
3038
3168
|
});
|
|
3169
|
+
const remoteHost = (() => {
|
|
3170
|
+
if (error instanceof SendActivityError) return getRemoteHost(error.inbox);
|
|
3171
|
+
try {
|
|
3172
|
+
return getRemoteHost(new URL(message.inbox));
|
|
3173
|
+
} catch (_) {
|
|
3174
|
+
logger.warn("Invalid inbox URL in queued outbox message: {inbox}", logData);
|
|
3175
|
+
return;
|
|
3176
|
+
}
|
|
3177
|
+
})();
|
|
3178
|
+
span.addEvent("activitypub.delivery.failed", {
|
|
3179
|
+
...remoteHost == null ? {} : { "activitypub.remote.host": remoteHost },
|
|
3180
|
+
"activitypub.delivery.attempt": message.attempt,
|
|
3181
|
+
"activitypub.delivery.permanent_failure": error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode),
|
|
3182
|
+
...error instanceof SendActivityError ? { "http.response.status_code": error.statusCode } : {}
|
|
3183
|
+
});
|
|
3039
3184
|
const loaderOptions = this.#getLoaderOptions(message.baseUrl);
|
|
3040
3185
|
const activity = await Activity.fromJsonLd(message.activity, {
|
|
3041
3186
|
contextLoader: this.contextLoaderFactory(loaderOptions),
|
|
@@ -3051,6 +3196,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3051
3196
|
});
|
|
3052
3197
|
}
|
|
3053
3198
|
if (error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode)) {
|
|
3199
|
+
getFederationMetrics(this.meterProvider).recordPermanentFailure(error.inbox, error.statusCode);
|
|
3054
3200
|
logger.warn("Permanent delivery failure for activity {activityId} to {inbox} ({status}); not retrying.", {
|
|
3055
3201
|
...logData,
|
|
3056
3202
|
status: error.statusCode
|
|
@@ -3159,7 +3305,13 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3159
3305
|
const { class: cls, listener } = dispatched;
|
|
3160
3306
|
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
3161
3307
|
try {
|
|
3162
|
-
|
|
3308
|
+
const activityType = getTypeId(activity).href;
|
|
3309
|
+
const started = performance.now();
|
|
3310
|
+
try {
|
|
3311
|
+
await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, activityType), activity);
|
|
3312
|
+
} finally {
|
|
3313
|
+
getFederationMetrics(this.meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
3314
|
+
}
|
|
3163
3315
|
} catch (error) {
|
|
3164
3316
|
try {
|
|
3165
3317
|
await this.inboxErrorHandler?.(context, error);
|
|
@@ -3342,6 +3494,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3342
3494
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
3343
3495
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
3344
3496
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
3497
|
+
meterProvider: this.meterProvider,
|
|
3345
3498
|
tracerProvider: this.tracerProvider
|
|
3346
3499
|
}));
|
|
3347
3500
|
await Promise.all(promises);
|
|
@@ -3611,6 +3764,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3611
3764
|
signatureTimeWindow: this.signatureTimeWindow,
|
|
3612
3765
|
skipSignatureVerification: this.skipSignatureVerification,
|
|
3613
3766
|
inboxChallengePolicy: this.inboxChallengePolicy,
|
|
3767
|
+
meterProvider: this.meterProvider,
|
|
3614
3768
|
tracerProvider: this.tracerProvider,
|
|
3615
3769
|
idempotencyStrategy: this.idempotencyStrategy
|
|
3616
3770
|
});
|
|
@@ -3772,6 +3926,9 @@ var ContextImpl = class ContextImpl {
|
|
|
3772
3926
|
get tracerProvider() {
|
|
3773
3927
|
return this.federation.tracerProvider;
|
|
3774
3928
|
}
|
|
3929
|
+
get meterProvider() {
|
|
3930
|
+
return this.federation.meterProvider;
|
|
3931
|
+
}
|
|
3775
3932
|
getNodeInfoUri() {
|
|
3776
3933
|
const path = this.federation.router.build("nodeInfo", {});
|
|
3777
3934
|
if (path == null) throw new RouterError("No NodeInfo dispatcher registered.");
|
|
@@ -4521,6 +4678,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
4521
4678
|
activityType: ctx.activityType,
|
|
4522
4679
|
inbox: new URL(inbox),
|
|
4523
4680
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
4681
|
+
meterProvider: ctx.meterProvider,
|
|
4524
4682
|
tracerProvider: ctx.tracerProvider,
|
|
4525
4683
|
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
4526
4684
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
-
const require_middleware = require("./middleware-
|
|
3
|
+
const require_middleware = require("./middleware-CKkBrsOD.cjs");
|
|
4
4
|
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -2,27 +2,27 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError } from "./router-CrMLXoOr.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { t as formatAcceptSignature } from "./accept-
|
|
7
|
-
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-
|
|
8
|
-
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-
|
|
9
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
-
import { n as kvCache } from "./kv-cache-
|
|
11
|
-
import { a as signJsonLd, i as hasSignatureLike, o as verifyJsonLd, r as detachSignature } from "./ld-
|
|
12
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
13
|
-
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-
|
|
14
|
-
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-
|
|
15
|
-
import { t as getNodeInfo } from "./client-
|
|
16
|
-
import { t as nodeInfoToJson } from "./types-
|
|
17
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
18
|
-
import { t as buildCollectionSynchronizationHeader } from "./collection-
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
import { t as
|
|
22
|
-
import {
|
|
5
|
+
import { n as version, t as name } from "./deno-DB1H1VHx.mjs";
|
|
6
|
+
import { t as formatAcceptSignature } from "./accept-CceiKpCy.mjs";
|
|
7
|
+
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-CV57mOYH.mjs";
|
|
8
|
+
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-D9zG-L9N.mjs";
|
|
9
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-3HwiWeYL.mjs";
|
|
10
|
+
import { n as kvCache } from "./kv-cache-Bmv7tUzz.mjs";
|
|
11
|
+
import { a as signJsonLd, i as hasSignatureLike, o as verifyJsonLd, r as detachSignature } from "./ld-sUf94RJ8.mjs";
|
|
12
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DsPgl527.mjs";
|
|
13
|
+
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-Bi7n-dEy.mjs";
|
|
14
|
+
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-iVfYyJpY.mjs";
|
|
15
|
+
import { t as getNodeInfo } from "./client-CIiz1WX7.mjs";
|
|
16
|
+
import { t as nodeInfoToJson } from "./types-BFowWFTT.mjs";
|
|
17
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-y06Dq5bp.mjs";
|
|
18
|
+
import { t as buildCollectionSynchronizationHeader } from "./collection-CA3V5zyK.mjs";
|
|
19
|
+
import { a as getFederationMetrics, i as getDurationMs, n as extractInboxes, o as getRemoteHost, r as sendActivity, t as SendActivityError } from "./send-D-vYdfC6.mjs";
|
|
20
|
+
import { t as KvKeyCache } from "./keycache-BeU0LCII.mjs";
|
|
21
|
+
import { t as acceptsJsonLd } from "./negotiation-VnHNB0Q5.mjs";
|
|
22
|
+
import { t as createExponentialBackoffPolicy } from "./retry-_VvV0h9f.mjs";
|
|
23
23
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
24
24
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
25
|
-
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
25
|
+
import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
|
|
26
26
|
import { uniq } from "es-toolkit";
|
|
27
27
|
import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
28
28
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -154,7 +154,7 @@ function handleNodeInfoJrd(_request, context) {
|
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/federation/inbox.ts
|
|
157
|
-
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
157
|
+
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, meterProvider, tracerProvider, idempotencyStrategy }) {
|
|
158
158
|
const logger = getLogger([
|
|
159
159
|
"fedify",
|
|
160
160
|
"federation",
|
|
@@ -255,7 +255,13 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
255
255
|
const { class: cls, listener } = dispatched;
|
|
256
256
|
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
const activityType = getTypeId(activity).href;
|
|
259
|
+
const started = performance.now();
|
|
260
|
+
try {
|
|
261
|
+
await listener(inboxContextFactory(recipient, json, activity?.id?.href, activityType), activity);
|
|
262
|
+
} finally {
|
|
263
|
+
getFederationMetrics(meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
264
|
+
}
|
|
259
265
|
} catch (error) {
|
|
260
266
|
try {
|
|
261
267
|
await inboxErrorHandler?.(ctx, error);
|
|
@@ -910,6 +916,8 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
910
916
|
});
|
|
911
917
|
if (verification.verified === false) {
|
|
912
918
|
const reason = verification.reason;
|
|
919
|
+
const remoteHost = "keyId" in reason && reason.keyId != null ? getRemoteHost(reason.keyId) : void 0;
|
|
920
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure(reason.type, remoteHost);
|
|
913
921
|
logger.error("Failed to verify the request's HTTP Signatures.", {
|
|
914
922
|
recipient,
|
|
915
923
|
reason: reason.type,
|
|
@@ -996,6 +1004,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
996
1004
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
997
1005
|
});
|
|
998
1006
|
if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1007
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("actorKeyMismatch", httpSigKey.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
999
1008
|
logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1000
1009
|
activity: json,
|
|
1001
1010
|
recipient,
|
|
@@ -1013,6 +1022,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1013
1022
|
}
|
|
1014
1023
|
if (pendingNonceLabel != null) {
|
|
1015
1024
|
if (!await verifySignatureNonce(request, kv, kvPrefixes.acceptSignatureNonce, pendingNonceLabel)) {
|
|
1025
|
+
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("invalidNonce", httpSigKey?.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
1016
1026
|
logger.error("Signature nonce verification failed (missing, expired, or replayed).", { recipient });
|
|
1017
1027
|
return await getFailedSignatureResponse(inboxChallengePolicy, kv, kvPrefixes);
|
|
1018
1028
|
}
|
|
@@ -1029,6 +1039,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1029
1039
|
kvPrefixes,
|
|
1030
1040
|
queue,
|
|
1031
1041
|
span,
|
|
1042
|
+
meterProvider: parameters.meterProvider,
|
|
1032
1043
|
tracerProvider,
|
|
1033
1044
|
idempotencyStrategy: parameters.idempotencyStrategy
|
|
1034
1045
|
});
|
|
@@ -1722,6 +1733,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1722
1733
|
inboxRetryPolicy;
|
|
1723
1734
|
activityTransformers;
|
|
1724
1735
|
_tracerProvider;
|
|
1736
|
+
_meterProvider;
|
|
1725
1737
|
firstKnock;
|
|
1726
1738
|
inboxChallengePolicy;
|
|
1727
1739
|
constructor(options) {
|
|
@@ -1807,11 +1819,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1807
1819
|
this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
1808
1820
|
this.activityTransformers = options.activityTransformers ?? getDefaultActivityTransformers();
|
|
1809
1821
|
this._tracerProvider = options.tracerProvider;
|
|
1822
|
+
this._meterProvider = options.meterProvider;
|
|
1810
1823
|
this.firstKnock = options.firstKnock;
|
|
1811
1824
|
}
|
|
1812
1825
|
get tracerProvider() {
|
|
1813
1826
|
return this._tracerProvider ?? trace.getTracerProvider();
|
|
1814
1827
|
}
|
|
1828
|
+
get meterProvider() {
|
|
1829
|
+
return this._meterProvider ?? metrics.getMeterProvider();
|
|
1830
|
+
}
|
|
1815
1831
|
_initializeRouter() {
|
|
1816
1832
|
this.router.add("/.well-known/webfinger", "webfinger");
|
|
1817
1833
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
@@ -1990,6 +2006,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1990
2006
|
sharedInbox: message.sharedInbox,
|
|
1991
2007
|
headers: new Headers(message.headers),
|
|
1992
2008
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
2009
|
+
meterProvider: this.meterProvider,
|
|
1993
2010
|
tracerProvider: this.tracerProvider
|
|
1994
2011
|
});
|
|
1995
2012
|
} catch (error) {
|
|
@@ -1997,6 +2014,21 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1997
2014
|
code: SpanStatusCode.ERROR,
|
|
1998
2015
|
message: String(error)
|
|
1999
2016
|
});
|
|
2017
|
+
const remoteHost = (() => {
|
|
2018
|
+
if (error instanceof SendActivityError) return getRemoteHost(error.inbox);
|
|
2019
|
+
try {
|
|
2020
|
+
return getRemoteHost(new URL(message.inbox));
|
|
2021
|
+
} catch (_) {
|
|
2022
|
+
logger.warn("Invalid inbox URL in queued outbox message: {inbox}", logData);
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
})();
|
|
2026
|
+
span.addEvent("activitypub.delivery.failed", {
|
|
2027
|
+
...remoteHost == null ? {} : { "activitypub.remote.host": remoteHost },
|
|
2028
|
+
"activitypub.delivery.attempt": message.attempt,
|
|
2029
|
+
"activitypub.delivery.permanent_failure": error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode),
|
|
2030
|
+
...error instanceof SendActivityError ? { "http.response.status_code": error.statusCode } : {}
|
|
2031
|
+
});
|
|
2000
2032
|
const loaderOptions = this.#getLoaderOptions(message.baseUrl);
|
|
2001
2033
|
const activity = await Activity.fromJsonLd(message.activity, {
|
|
2002
2034
|
contextLoader: this.contextLoaderFactory(loaderOptions),
|
|
@@ -2012,6 +2044,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2012
2044
|
});
|
|
2013
2045
|
}
|
|
2014
2046
|
if (error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode)) {
|
|
2047
|
+
getFederationMetrics(this.meterProvider).recordPermanentFailure(error.inbox, error.statusCode);
|
|
2015
2048
|
logger.warn("Permanent delivery failure for activity {activityId} to {inbox} ({status}); not retrying.", {
|
|
2016
2049
|
...logData,
|
|
2017
2050
|
status: error.statusCode
|
|
@@ -2120,7 +2153,13 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2120
2153
|
const { class: cls, listener } = dispatched;
|
|
2121
2154
|
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
2122
2155
|
try {
|
|
2123
|
-
|
|
2156
|
+
const activityType = getTypeId(activity).href;
|
|
2157
|
+
const started = performance.now();
|
|
2158
|
+
try {
|
|
2159
|
+
await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, activityType), activity);
|
|
2160
|
+
} finally {
|
|
2161
|
+
getFederationMetrics(this.meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
2162
|
+
}
|
|
2124
2163
|
} catch (error) {
|
|
2125
2164
|
try {
|
|
2126
2165
|
await this.inboxErrorHandler?.(context, error);
|
|
@@ -2303,6 +2342,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2303
2342
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
2304
2343
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
2305
2344
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
2345
|
+
meterProvider: this.meterProvider,
|
|
2306
2346
|
tracerProvider: this.tracerProvider
|
|
2307
2347
|
}));
|
|
2308
2348
|
await Promise.all(promises);
|
|
@@ -2572,6 +2612,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2572
2612
|
signatureTimeWindow: this.signatureTimeWindow,
|
|
2573
2613
|
skipSignatureVerification: this.skipSignatureVerification,
|
|
2574
2614
|
inboxChallengePolicy: this.inboxChallengePolicy,
|
|
2615
|
+
meterProvider: this.meterProvider,
|
|
2575
2616
|
tracerProvider: this.tracerProvider,
|
|
2576
2617
|
idempotencyStrategy: this.idempotencyStrategy
|
|
2577
2618
|
});
|
|
@@ -2733,6 +2774,9 @@ var ContextImpl = class ContextImpl {
|
|
|
2733
2774
|
get tracerProvider() {
|
|
2734
2775
|
return this.federation.tracerProvider;
|
|
2735
2776
|
}
|
|
2777
|
+
get meterProvider() {
|
|
2778
|
+
return this.federation.meterProvider;
|
|
2779
|
+
}
|
|
2736
2780
|
getNodeInfoUri() {
|
|
2737
2781
|
const path = this.federation.router.build("nodeInfo", {});
|
|
2738
2782
|
if (path == null) throw new RouterError("No NodeInfo dispatcher registered.");
|
|
@@ -3482,6 +3526,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
3482
3526
|
activityType: ctx.activityType,
|
|
3483
3527
|
inbox: new URL(inbox),
|
|
3484
3528
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
3529
|
+
meterProvider: ctx.meterProvider,
|
|
3485
3530
|
tracerProvider: ctx.tracerProvider,
|
|
3486
3531
|
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
3487
3532
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-
|
|
3
|
+
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-DrNqYkPw.js";
|
|
4
4
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/federation/webfinger.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-
|
|
1
|
+
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-BKLGj9QO.cjs";
|
|
2
2
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
3
3
|
|
|
4
4
|
//#region src/federation/webfinger.d.ts
|
package/dist/mod.cjs
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
require("./chunk-DDcVe30Y.cjs");
|
|
5
5
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
6
6
|
require("./compat/mod.cjs");
|
|
7
|
-
const require_http = require("./http-
|
|
8
|
-
const require_middleware = require("./middleware-
|
|
9
|
-
const require_proof = require("./proof-
|
|
7
|
+
const require_http = require("./http-FnUTcdMf.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-CKkBrsOD.cjs");
|
|
9
|
+
const require_proof = require("./proof-BhJpq_J9.cjs");
|
|
10
10
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
11
|
+
const require_kv_cache = require("./kv-cache-BG9O8wVV.cjs");
|
|
12
12
|
const require_federation_mod = require("./federation/mod.cjs");
|
|
13
13
|
require("./nodeinfo/mod.cjs");
|
|
14
14
|
require("./runtime/mod.cjs");
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-z-8dc-e1.cjs";
|
|
2
2
|
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CrGuipxe.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CptqhsOy.cjs";
|
|
4
|
-
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-
|
|
4
|
+
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-BKLGj9QO.cjs";
|
|
5
5
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CbLNp3zQ.cjs";
|
|
6
6
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
7
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
7
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-DClCOv0M.cjs";
|
|
8
8
|
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-Cr3f-ACa.cjs";
|
|
9
9
|
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CMEbIaNh.cjs";
|
|
10
10
|
export * from "@fedify/vocab-runtime";
|