@fedify/fedify 2.3.0-dev.1110 → 2.3.0-dev.1114
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/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DQP-q39h.mjs} +27 -2
- package/dist/{builder-B-Y6fwSu.mjs → builder-YlEusQth.mjs} +3 -3
- 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-C0C_sRha.d.cts → context-Ch-ZLyTQ.d.cts} +1 -1
- package/dist/{context-Dqgt8saU.d.ts → context-cSUMk2da.d.ts} +1 -1
- package/dist/{deno-hqC7tKJn.mjs → deno-CF3jMgip.mjs} +1 -1
- package/dist/{docloader-BOEuuXkX.mjs → docloader-BENj6vQ4.mjs} +2 -2
- package/dist/federation/builder.test.mjs +3 -3
- package/dist/federation/collection.test.mjs +2 -2
- package/dist/federation/handler.test.mjs +8 -7
- package/dist/federation/idempotency.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +1 -1
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/middleware.test.mjs +10 -10
- 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/mq.test.mjs +2 -2
- package/dist/federation/negotiation.test.mjs +2 -2
- package/dist/federation/router.test.mjs +2 -2
- package/dist/federation/send.test.mjs +11 -11
- package/dist/federation/webfinger.test.mjs +3 -3
- package/dist/{getMachineId-bsd-etIyxDet.mjs → getMachineId-bsd-BY01PL1n.mjs} +1 -1
- package/dist/{getMachineId-darwin-D23zTf4g.mjs → getMachineId-darwin-Dr1gkBkp.mjs} +1 -1
- package/dist/{getMachineId-win-Dpap6v5i.mjs → getMachineId-win-QEYwcJiy.mjs} +1 -1
- package/dist/{http-BLopFpvC.mjs → http-BmOZYc-8.mjs} +86 -37
- package/dist/{http-DV0il3vk.cjs → http-CKCgOPkX.cjs} +427 -35
- package/dist/{http-O8MYWwk8.js → http-CpzZ9zsb.js} +393 -37
- package/dist/{http-BDZeS5om.d.ts → http-D6LP89UO.d.ts} +7 -1
- package/dist/{http-C87EWkO0.d.cts → http-D6aw3j2U.d.cts} +7 -1
- package/dist/{key-DW1EVmtP.mjs → key-B4I8H5Lc.mjs} +1 -1
- package/dist/{kv-cache-Dya-TWMe.cjs → kv-cache-DY-XWOqM.cjs} +1 -1
- package/dist/{kv-cache-C3NWWiTg.js → kv-cache-Wc5ezcVW.js} +1 -1
- package/dist/{ld-BNkk2Yal.mjs → ld-B5D5THhl.mjs} +60 -9
- package/dist/{send-hokVCPu6.mjs → metrics-ek3ilf6c.mjs} +53 -221
- package/dist/{middleware-CjzI3aYo.js → middleware-CuZbBw-N.js} +16 -269
- package/dist/{middleware-DA2WTBr4.mjs → middleware-DlcecZMq.mjs} +29 -23
- package/dist/{middleware-D6FbOjuK.mjs → middleware-EI7OU6BR.mjs} +1 -1
- package/dist/{middleware-DUWeXjZR.cjs → middleware-EqTYPG4F.cjs} +45 -298
- package/dist/{mod-DXY9JF28.d.cts → mod-B-Lin9Sy.d.ts} +25 -2
- package/dist/{mod-DHO9lk3D.d.ts → mod-BDhgfjP7.d.cts} +25 -2
- package/dist/{mod-B0rWmfW5.d.cts → mod-BR_BB0bh.d.cts} +1 -1
- package/dist/{mod-Dx3-hqyo.d.ts → mod-C6E8rkcz.d.ts} +1 -1
- package/dist/{mod-BhU_H1I_.d.ts → mod-DLrRb0dx.d.ts} +1 -1
- package/dist/{mod-CLPnQPsv.d.cts → mod-P9tE2WmM.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- 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 +2 -2
- package/dist/otel/exporter.test.mjs +2 -2
- package/dist/{outgoing-jsonld-BgFLCJQ_.mjs → outgoing-jsonld-BNL8AC14.mjs} +1 -1
- package/dist/{owner-jvJAtR5O.mjs → owner-DO810N24.mjs} +2 -2
- package/dist/{proof-mfmHH9j0.mjs → proof-BgfyWv7b.mjs} +25 -7
- package/dist/{proof-BD92WeqV.cjs → proof-DIoqrKnX.cjs} +78 -11
- package/dist/{proof-5kT7OUPV.js → proof-Vd8-1EWh.js} +78 -11
- package/dist/send-CAYXdUTk.mjs +225 -0
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/http.test.mjs +212 -6
- package/dist/sig/key.test.mjs +4 -4
- package/dist/sig/ld.test.mjs +138 -5
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +4 -4
- package/dist/sig/proof.test.mjs +167 -6
- package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BTEgfoJo.mjs} +2 -27
- package/dist/utils/docloader.test.mjs +5 -5
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- /package/dist/{accept-CceiKpCy.mjs → accept-CgDcxvjV.mjs} +0 -0
- /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
- /package/dist/{client-B_A6mfn3.mjs → client-Bneh_DYR.mjs} +0 -0
- /package/dist/{collection-CA3V5zyK.mjs → collection-Cc3DVAhE.mjs} +0 -0
- /package/dist/{execAsync-DCBrgFiV.mjs → execAsync-Dxb7rNf3.mjs} +0 -0
- /package/dist/{getMachineId-linux-ObI47Hql.mjs → getMachineId-linux-Bbhofx-s.mjs} +0 -0
- /package/dist/{getMachineId-unsupported-Ddu-PFeh.mjs → getMachineId-unsupported-dIOte2Ct.mjs} +0 -0
- /package/dist/{keys-C3kae-6B.mjs → keys-CSYsOMFG.mjs} +0 -0
- /package/dist/{kv-x2IvBUyq.mjs → kv-QHE0oeM3.mjs} +0 -0
- /package/dist/{kv-cache-CiiNwT6W.mjs → kv-cache-DihufyAQ.mjs} +0 -0
- /package/dist/{public-audience-N3pyOx2p.mjs → public-audience-c9zmYKgA.mjs} +0 -0
- /package/dist/{types-BFowWFTT.mjs → types-D09GN0uZ.mjs} +0 -0
|
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
5
|
-
const require_http = require("./http-
|
|
6
|
-
const require_proof = require("./proof-
|
|
5
|
+
const require_http = require("./http-CKCgOPkX.cjs");
|
|
6
|
+
const require_proof = require("./proof-DIoqrKnX.cjs");
|
|
7
7
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
8
|
-
const require_kv_cache = require("./kv-cache-
|
|
8
|
+
const require_kv_cache = require("./kv-cache-DY-XWOqM.cjs");
|
|
9
9
|
let _logtape_logtape = require("@logtape/logtape");
|
|
10
10
|
let _fedify_vocab = require("@fedify/vocab");
|
|
11
11
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -779,264 +779,6 @@ async function buildCollectionSynchronizationHeader(collectionId, actorIds) {
|
|
|
779
779
|
return `collectionId="${collectionId}", url="${url}", digest="${(0, byte_encodings_hex.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
|
-
httpServerRequestCount;
|
|
790
|
-
httpServerRequestDuration;
|
|
791
|
-
queueTaskEnqueued;
|
|
792
|
-
queueTaskStarted;
|
|
793
|
-
queueTaskCompleted;
|
|
794
|
-
queueTaskFailed;
|
|
795
|
-
queueTaskDuration;
|
|
796
|
-
queueTaskInFlight;
|
|
797
|
-
constructor(meterProvider) {
|
|
798
|
-
const meter = meterProvider.getMeter(require_http.name, require_http.version);
|
|
799
|
-
this.deliverySent = meter.createCounter("activitypub.delivery.sent", {
|
|
800
|
-
description: "ActivityPub delivery attempts.",
|
|
801
|
-
unit: "{attempt}"
|
|
802
|
-
});
|
|
803
|
-
this.deliveryPermanentFailure = meter.createCounter("activitypub.delivery.permanent_failure", {
|
|
804
|
-
description: "ActivityPub deliveries abandoned as permanent failures.",
|
|
805
|
-
unit: "{failure}"
|
|
806
|
-
});
|
|
807
|
-
this.signatureVerificationFailure = meter.createCounter("activitypub.signature.verification_failure", {
|
|
808
|
-
description: "ActivityPub signature verification failures.",
|
|
809
|
-
unit: "{failure}"
|
|
810
|
-
});
|
|
811
|
-
this.deliveryDuration = meter.createHistogram("activitypub.delivery.duration", {
|
|
812
|
-
description: "Duration of ActivityPub delivery attempts.",
|
|
813
|
-
unit: "ms"
|
|
814
|
-
});
|
|
815
|
-
this.inboxProcessingDuration = meter.createHistogram("activitypub.inbox.processing_duration", {
|
|
816
|
-
description: "Duration of ActivityPub inbox listener processing.",
|
|
817
|
-
unit: "ms"
|
|
818
|
-
});
|
|
819
|
-
this.httpServerRequestCount = meter.createCounter("fedify.http.server.request.count", {
|
|
820
|
-
description: "HTTP requests handled by Federation.fetch().",
|
|
821
|
-
unit: "{request}"
|
|
822
|
-
});
|
|
823
|
-
this.httpServerRequestDuration = meter.createHistogram("fedify.http.server.request.duration", {
|
|
824
|
-
description: "Duration of HTTP requests handled by Federation.fetch().",
|
|
825
|
-
unit: "ms",
|
|
826
|
-
advice: { explicitBucketBoundaries: [
|
|
827
|
-
5,
|
|
828
|
-
10,
|
|
829
|
-
25,
|
|
830
|
-
50,
|
|
831
|
-
75,
|
|
832
|
-
100,
|
|
833
|
-
250,
|
|
834
|
-
500,
|
|
835
|
-
750,
|
|
836
|
-
1e3,
|
|
837
|
-
2500,
|
|
838
|
-
5e3,
|
|
839
|
-
7500,
|
|
840
|
-
1e4
|
|
841
|
-
] }
|
|
842
|
-
});
|
|
843
|
-
this.queueTaskEnqueued = meter.createCounter("fedify.queue.task.enqueued", {
|
|
844
|
-
description: "Tasks Fedify enqueued for inbox, outbox, or fanout work.",
|
|
845
|
-
unit: "{task}"
|
|
846
|
-
});
|
|
847
|
-
this.queueTaskStarted = meter.createCounter("fedify.queue.task.started", {
|
|
848
|
-
description: "Tasks Fedify began processing as a queue worker.",
|
|
849
|
-
unit: "{task}"
|
|
850
|
-
});
|
|
851
|
-
this.queueTaskCompleted = meter.createCounter("fedify.queue.task.completed", {
|
|
852
|
-
description: "Queue tasks Fedify finished processing without throwing.",
|
|
853
|
-
unit: "{task}"
|
|
854
|
-
});
|
|
855
|
-
this.queueTaskFailed = meter.createCounter("fedify.queue.task.failed", {
|
|
856
|
-
description: "Queue tasks Fedify abandoned because processing threw.",
|
|
857
|
-
unit: "{task}"
|
|
858
|
-
});
|
|
859
|
-
this.queueTaskDuration = meter.createHistogram("fedify.queue.task.duration", {
|
|
860
|
-
description: "Duration of queue task processing in Fedify workers.",
|
|
861
|
-
unit: "ms",
|
|
862
|
-
advice: { explicitBucketBoundaries: [
|
|
863
|
-
5,
|
|
864
|
-
10,
|
|
865
|
-
25,
|
|
866
|
-
50,
|
|
867
|
-
75,
|
|
868
|
-
100,
|
|
869
|
-
250,
|
|
870
|
-
500,
|
|
871
|
-
750,
|
|
872
|
-
1e3,
|
|
873
|
-
2500,
|
|
874
|
-
5e3,
|
|
875
|
-
7500,
|
|
876
|
-
1e4
|
|
877
|
-
] }
|
|
878
|
-
});
|
|
879
|
-
this.queueTaskInFlight = meter.createUpDownCounter("fedify.queue.task.in_flight", {
|
|
880
|
-
description: "Queue tasks currently being processed in this Fedify process.",
|
|
881
|
-
unit: "{task}"
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
recordDelivery(inbox, durationMs, success, activityType) {
|
|
885
|
-
const deliveryAttributes = {
|
|
886
|
-
"activitypub.remote.host": getRemoteHost(inbox),
|
|
887
|
-
"activitypub.delivery.success": success
|
|
888
|
-
};
|
|
889
|
-
if (activityType != null) deliveryAttributes["activitypub.activity.type"] = activityType;
|
|
890
|
-
this.deliverySent.add(1, deliveryAttributes);
|
|
891
|
-
this.deliveryDuration.record(durationMs, deliveryAttributes);
|
|
892
|
-
}
|
|
893
|
-
recordPermanentFailure(inbox, statusCode) {
|
|
894
|
-
this.deliveryPermanentFailure.add(1, {
|
|
895
|
-
"activitypub.remote.host": getRemoteHost(inbox),
|
|
896
|
-
"http.response.status_code": statusCode
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
recordSignatureVerificationFailure(reason, remoteHost) {
|
|
900
|
-
const attributes = { "activitypub.verification.failure_reason": reason };
|
|
901
|
-
if (remoteHost != null) attributes["activitypub.remote.host"] = remoteHost;
|
|
902
|
-
this.signatureVerificationFailure.add(1, attributes);
|
|
903
|
-
}
|
|
904
|
-
recordInboxProcessingDuration(activityType, durationMs) {
|
|
905
|
-
this.inboxProcessingDuration.record(durationMs, { "activitypub.activity.type": activityType });
|
|
906
|
-
}
|
|
907
|
-
recordHttpServerRequest(method, endpoint, durationMs, options = {}) {
|
|
908
|
-
const attributes = {
|
|
909
|
-
"http.request.method": normalizeHttpMethod(method),
|
|
910
|
-
"fedify.endpoint": endpoint
|
|
911
|
-
};
|
|
912
|
-
if (options.statusCode != null) attributes["http.response.status_code"] = options.statusCode;
|
|
913
|
-
if (options.routeTemplate != null) attributes["fedify.route.template"] = options.routeTemplate;
|
|
914
|
-
this.httpServerRequestCount.add(1, attributes);
|
|
915
|
-
this.httpServerRequestDuration.record(durationMs, attributes);
|
|
916
|
-
}
|
|
917
|
-
recordQueueTaskEnqueued(common, attempt) {
|
|
918
|
-
const attributes = buildQueueTaskAttributes(common);
|
|
919
|
-
attributes["fedify.queue.task.attempt"] = attempt;
|
|
920
|
-
this.queueTaskEnqueued.add(1, attributes);
|
|
921
|
-
}
|
|
922
|
-
recordQueueTaskStarted(common) {
|
|
923
|
-
this.queueTaskStarted.add(1, buildQueueTaskAttributes(common));
|
|
924
|
-
}
|
|
925
|
-
incrementQueueTaskInFlight(common) {
|
|
926
|
-
this.queueTaskInFlight.add(1, buildQueueTaskInFlightAttributes(common));
|
|
927
|
-
}
|
|
928
|
-
decrementQueueTaskInFlight(common) {
|
|
929
|
-
this.queueTaskInFlight.add(-1, buildQueueTaskInFlightAttributes(common));
|
|
930
|
-
}
|
|
931
|
-
recordQueueTaskOutcome(common, result, durationMs) {
|
|
932
|
-
const attributes = buildQueueTaskAttributes(common);
|
|
933
|
-
attributes["fedify.queue.task.result"] = result;
|
|
934
|
-
if (result === "completed") this.queueTaskCompleted.add(1, attributes);
|
|
935
|
-
else if (result === "failed") this.queueTaskFailed.add(1, attributes);
|
|
936
|
-
this.queueTaskDuration.record(durationMs, attributes);
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
function buildQueueTaskAttributes(common) {
|
|
940
|
-
const attributes = { "fedify.queue.role": common.role };
|
|
941
|
-
const backend = getQueueBackend(common.queue);
|
|
942
|
-
if (backend != null) attributes["fedify.queue.backend"] = backend;
|
|
943
|
-
const nativeRetrial = common.queue?.nativeRetrial;
|
|
944
|
-
if (typeof nativeRetrial === "boolean") attributes["fedify.queue.native_retrial"] = nativeRetrial;
|
|
945
|
-
if (common.activityType != null) attributes["activitypub.activity.type"] = common.activityType;
|
|
946
|
-
return attributes;
|
|
947
|
-
}
|
|
948
|
-
function buildQueueTaskInFlightAttributes(common) {
|
|
949
|
-
return buildQueueTaskAttributes({
|
|
950
|
-
role: common.role,
|
|
951
|
-
queue: common.queue
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Returns the constructor name of the given message queue, when it is a
|
|
956
|
-
* meaningful identifier. Used as a best-effort `fedify.queue.backend`
|
|
957
|
-
* attribute on queue task metrics; returns `undefined` for plain object
|
|
958
|
-
* literals (whose constructor is `Object`) so the attribute does not appear
|
|
959
|
-
* with a non-informative value.
|
|
960
|
-
* @since 2.3.0
|
|
961
|
-
*/
|
|
962
|
-
function getQueueBackend(queue) {
|
|
963
|
-
const name = queue?.constructor?.name;
|
|
964
|
-
if (name == null || name === "" || name === "Object") return void 0;
|
|
965
|
-
return name;
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Records `fedify.queue.task.enqueued` for an outgoing outbox enqueue.
|
|
969
|
-
*
|
|
970
|
-
* Both `Context.sendActivity()` and `OutboxContext.forwardActivity()` enqueue
|
|
971
|
-
* outbox messages with the same metric attributes (role, queue, activity
|
|
972
|
-
* type, attempt), so they share this helper rather than each defining a local
|
|
973
|
-
* closure.
|
|
974
|
-
* @since 2.3.0
|
|
975
|
-
*/
|
|
976
|
-
function recordOutboxEnqueue(meterProvider, outboxQueue, message) {
|
|
977
|
-
getFederationMetrics(meterProvider).recordQueueTaskEnqueued({
|
|
978
|
-
role: "outbox",
|
|
979
|
-
queue: outboxQueue,
|
|
980
|
-
activityType: message.activityType
|
|
981
|
-
}, message.attempt);
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Whether the given thrown value is an `AbortError`.
|
|
985
|
-
*
|
|
986
|
-
* `processQueuedTask` distinguishes aborted tasks (recorded as
|
|
987
|
-
* `fedify.queue.task.result=aborted`) from other failures so that backend
|
|
988
|
-
* shutdown signals do not inflate the `fedify.queue.task.failed` counter.
|
|
989
|
-
* @since 2.3.0
|
|
990
|
-
*/
|
|
991
|
-
function isAbortError(error) {
|
|
992
|
-
if (error == null || typeof error !== "object") return false;
|
|
993
|
-
const name = error.name;
|
|
994
|
-
return typeof name === "string" && name === "AbortError";
|
|
995
|
-
}
|
|
996
|
-
const KNOWN_HTTP_METHODS = new Set([
|
|
997
|
-
"CONNECT",
|
|
998
|
-
"DELETE",
|
|
999
|
-
"GET",
|
|
1000
|
-
"HEAD",
|
|
1001
|
-
"OPTIONS",
|
|
1002
|
-
"PATCH",
|
|
1003
|
-
"POST",
|
|
1004
|
-
"PUT",
|
|
1005
|
-
"QUERY",
|
|
1006
|
-
"TRACE"
|
|
1007
|
-
]);
|
|
1008
|
-
function normalizeHttpMethod(method) {
|
|
1009
|
-
const upper = method.toUpperCase();
|
|
1010
|
-
return KNOWN_HTTP_METHODS.has(upper) ? upper : "_OTHER";
|
|
1011
|
-
}
|
|
1012
|
-
const federationMetrics = /* @__PURE__ */ new WeakMap();
|
|
1013
|
-
/**
|
|
1014
|
-
* Gets the cached Fedify metric instruments for a meter provider.
|
|
1015
|
-
* @since 2.3.0
|
|
1016
|
-
*/
|
|
1017
|
-
function getFederationMetrics(meterProvider = _opentelemetry_api.metrics.getMeterProvider()) {
|
|
1018
|
-
let instruments = federationMetrics.get(meterProvider);
|
|
1019
|
-
if (instruments == null) {
|
|
1020
|
-
instruments = new FederationMetrics(meterProvider);
|
|
1021
|
-
federationMetrics.set(meterProvider, instruments);
|
|
1022
|
-
}
|
|
1023
|
-
return instruments;
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Gets the bounded remote host attribute value for a URL.
|
|
1027
|
-
* @since 2.3.0
|
|
1028
|
-
*/
|
|
1029
|
-
function getRemoteHost(url) {
|
|
1030
|
-
return url.hostname;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Gets an elapsed duration in milliseconds from a `performance.now()` value.
|
|
1034
|
-
* @since 2.3.0
|
|
1035
|
-
*/
|
|
1036
|
-
function getDurationMs(start) {
|
|
1037
|
-
return Math.max(0, performance.now() - start);
|
|
1038
|
-
}
|
|
1039
|
-
//#endregion
|
|
1040
782
|
//#region src/federation/inbox.ts
|
|
1041
783
|
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, meterProvider, tracerProvider, idempotencyStrategy }) {
|
|
1042
784
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
@@ -1114,7 +856,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
1114
856
|
});
|
|
1115
857
|
throw error;
|
|
1116
858
|
}
|
|
1117
|
-
getFederationMetrics(meterProvider).recordQueueTaskEnqueued({
|
|
859
|
+
require_http.getFederationMetrics(meterProvider).recordQueueTaskEnqueued({
|
|
1118
860
|
role: "inbox",
|
|
1119
861
|
queue,
|
|
1120
862
|
activityType: (0, _fedify_vocab.getTypeId)(activity).href
|
|
@@ -1149,7 +891,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
1149
891
|
try {
|
|
1150
892
|
await listener(inboxContextFactory(recipient, json, activity?.id?.href, activityType), activity);
|
|
1151
893
|
} finally {
|
|
1152
|
-
getFederationMetrics(meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
894
|
+
require_http.getFederationMetrics(meterProvider).recordInboxProcessingDuration(activityType, require_http.getDurationMs(started));
|
|
1153
895
|
}
|
|
1154
896
|
} catch (error) {
|
|
1155
897
|
try {
|
|
@@ -1442,8 +1184,8 @@ async function handleObject(request, { values, context, objectDispatcher, author
|
|
|
1442
1184
|
* @param parameters The parameters for handling the collection.
|
|
1443
1185
|
* @returns A promise that resolves to an HTTP response.
|
|
1444
1186
|
*/
|
|
1445
|
-
async function handleCollection(request, { name: name$
|
|
1446
|
-
const spanName = name$
|
|
1187
|
+
async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
|
1188
|
+
const spanName = name$2.trim().replace(/\s+/g, "_");
|
|
1447
1189
|
tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
1448
1190
|
const tracer = tracerProvider.getTracer(require_http.name, require_http.version);
|
|
1449
1191
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
@@ -1485,7 +1227,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1485
1227
|
collection = new _fedify_vocab.OrderedCollection({
|
|
1486
1228
|
id: baseUri,
|
|
1487
1229
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
1488
|
-
items: filterCollectionItems(itemsOrResponse, name$
|
|
1230
|
+
items: filterCollectionItems(itemsOrResponse, name$2, filterPredicate)
|
|
1489
1231
|
});
|
|
1490
1232
|
} else {
|
|
1491
1233
|
const lastCursor = await collectionCallbacks.lastCursor?.(context, identifier);
|
|
@@ -1506,7 +1248,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1506
1248
|
} else {
|
|
1507
1249
|
const uri = new URL(baseUri);
|
|
1508
1250
|
uri.searchParams.set("cursor", cursor);
|
|
1509
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
1251
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
|
|
1510
1252
|
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
1511
1253
|
attributes: {
|
|
1512
1254
|
"activitypub.collection.id": uri.href,
|
|
@@ -1550,7 +1292,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1550
1292
|
id: uri,
|
|
1551
1293
|
prev,
|
|
1552
1294
|
next,
|
|
1553
|
-
items: filterCollectionItems(items, name$
|
|
1295
|
+
items: filterCollectionItems(items, name$2, filterPredicate),
|
|
1554
1296
|
partOf
|
|
1555
1297
|
});
|
|
1556
1298
|
}
|
|
@@ -1825,7 +1567,7 @@ async function handleInbox(request, options) {
|
|
|
1825
1567
|
* @returns A promise that resolves to an HTTP response.
|
|
1826
1568
|
*/
|
|
1827
1569
|
async function handleInboxInternal(request, parameters, span) {
|
|
1828
|
-
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, unverifiedActivityHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, inboxChallengePolicy, tracerProvider } = parameters;
|
|
1570
|
+
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, unverifiedActivityHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, inboxChallengePolicy, meterProvider, tracerProvider } = parameters;
|
|
1829
1571
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
1830
1572
|
"fedify",
|
|
1831
1573
|
"federation",
|
|
@@ -1903,6 +1645,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1903
1645
|
contextLoader: ctx.contextLoader,
|
|
1904
1646
|
documentLoader: ctx.documentLoader,
|
|
1905
1647
|
keyCache,
|
|
1648
|
+
meterProvider,
|
|
1906
1649
|
tracerProvider
|
|
1907
1650
|
});
|
|
1908
1651
|
} catch (error) {
|
|
@@ -1938,6 +1681,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1938
1681
|
contextLoader: ctx.contextLoader,
|
|
1939
1682
|
documentLoader: ctx.documentLoader,
|
|
1940
1683
|
keyCache,
|
|
1684
|
+
meterProvider,
|
|
1941
1685
|
tracerProvider
|
|
1942
1686
|
});
|
|
1943
1687
|
} catch (error) {
|
|
@@ -1985,12 +1729,13 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1985
1729
|
documentLoader: ctx.documentLoader,
|
|
1986
1730
|
timeWindow: signatureTimeWindow,
|
|
1987
1731
|
keyCache,
|
|
1732
|
+
meterProvider,
|
|
1988
1733
|
tracerProvider
|
|
1989
1734
|
});
|
|
1990
1735
|
if (verification.verified === false) {
|
|
1991
1736
|
const reason = verification.reason;
|
|
1992
|
-
const remoteHost = "keyId" in reason && reason.keyId != null ? getRemoteHost(reason.keyId) : void 0;
|
|
1993
|
-
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure(reason.type, remoteHost);
|
|
1737
|
+
const remoteHost = "keyId" in reason && reason.keyId != null ? require_http.getRemoteHost(reason.keyId) : void 0;
|
|
1738
|
+
require_http.getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure(reason.type, remoteHost);
|
|
1994
1739
|
logger.error("Failed to verify the request's HTTP Signatures.", {
|
|
1995
1740
|
recipient,
|
|
1996
1741
|
reason: reason.type,
|
|
@@ -2077,7 +1822,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2077
1822
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
2078
1823
|
});
|
|
2079
1824
|
if (httpSigKey != null && !await require_proof.doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
2080
|
-
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("actorKeyMismatch", httpSigKey.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
1825
|
+
require_http.getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("actorKeyMismatch", httpSigKey.id == null ? void 0 : require_http.getRemoteHost(httpSigKey.id));
|
|
2081
1826
|
logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
2082
1827
|
activity: json,
|
|
2083
1828
|
recipient,
|
|
@@ -2095,7 +1840,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2095
1840
|
}
|
|
2096
1841
|
if (pendingNonceLabel != null) {
|
|
2097
1842
|
if (!await verifySignatureNonce(request, kv, kvPrefixes.acceptSignatureNonce, pendingNonceLabel)) {
|
|
2098
|
-
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("invalidNonce", httpSigKey?.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
1843
|
+
require_http.getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("invalidNonce", httpSigKey?.id == null ? void 0 : require_http.getRemoteHost(httpSigKey.id));
|
|
2099
1844
|
logger.error("Signature nonce verification failed (missing, expired, or replayed).", { recipient });
|
|
2100
1845
|
return await getFailedSignatureResponse(inboxChallengePolicy, kv, kvPrefixes);
|
|
2101
1846
|
}
|
|
@@ -2233,8 +1978,8 @@ var CustomCollectionHandler = class {
|
|
|
2233
1978
|
* @param CollectionPage The CollectionPage constructor.
|
|
2234
1979
|
* @param filterPredicate Optional filter predicate for items.
|
|
2235
1980
|
*/
|
|
2236
|
-
constructor(name$
|
|
2237
|
-
this.name = name$
|
|
1981
|
+
constructor(name$1, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), Collection, CollectionPage, filterPredicate) {
|
|
1982
|
+
this.name = name$1;
|
|
2238
1983
|
this.values = values;
|
|
2239
1984
|
this.context = context;
|
|
2240
1985
|
this.callbacks = callbacks;
|
|
@@ -2820,7 +2565,7 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
|
|
|
2820
2565
|
"federation",
|
|
2821
2566
|
"outbox"
|
|
2822
2567
|
]);
|
|
2823
|
-
const federationMetrics = getFederationMetrics(meterProvider);
|
|
2568
|
+
const federationMetrics = require_http.getFederationMetrics(meterProvider);
|
|
2824
2569
|
const started = performance.now();
|
|
2825
2570
|
let deliverySuccess = false;
|
|
2826
2571
|
headers = new Headers(headers);
|
|
@@ -2854,7 +2599,7 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
|
|
|
2854
2599
|
inbox: inbox.href,
|
|
2855
2600
|
error
|
|
2856
2601
|
});
|
|
2857
|
-
federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
|
|
2602
|
+
federationMetrics.recordDelivery(inbox, require_http.getDurationMs(started), false, activityType);
|
|
2858
2603
|
throw error;
|
|
2859
2604
|
}
|
|
2860
2605
|
try {
|
|
@@ -2884,7 +2629,7 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
|
|
|
2884
2629
|
if (actorId != null) eventAttributes["activitypub.actor.id"] = actorId;
|
|
2885
2630
|
span.addEvent("activitypub.activity.sent", eventAttributes);
|
|
2886
2631
|
} finally {
|
|
2887
|
-
federationMetrics.recordDelivery(inbox, getDurationMs(started), deliverySuccess, activityType);
|
|
2632
|
+
federationMetrics.recordDelivery(inbox, require_http.getDurationMs(started), deliverySuccess, activityType);
|
|
2888
2633
|
}
|
|
2889
2634
|
}
|
|
2890
2635
|
/**
|
|
@@ -3233,7 +2978,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3233
2978
|
processQueuedTask(contextData, message) {
|
|
3234
2979
|
const tracer = this._getTracer();
|
|
3235
2980
|
const extractedContext = _opentelemetry_api.propagation.extract(_opentelemetry_api.context.active(), message.traceContext);
|
|
3236
|
-
const meter = getFederationMetrics(this.meterProvider);
|
|
2981
|
+
const meter = require_http.getFederationMetrics(this.meterProvider);
|
|
3237
2982
|
return (0, _logtape_logtape.withContext)({ messageId: message.id }, async () => {
|
|
3238
2983
|
if (message.type === "fanout") {
|
|
3239
2984
|
const common = {
|
|
@@ -3258,7 +3003,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3258
3003
|
try {
|
|
3259
3004
|
await this.#listenFanoutMessage(contextData, message);
|
|
3260
3005
|
} catch (e) {
|
|
3261
|
-
const aborted = isAbortError(e);
|
|
3006
|
+
const aborted = require_http.isAbortError(e);
|
|
3262
3007
|
outcome = aborted ? "aborted" : "failed";
|
|
3263
3008
|
if (!aborted) span.setStatus({
|
|
3264
3009
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
@@ -3266,7 +3011,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3266
3011
|
});
|
|
3267
3012
|
throw e;
|
|
3268
3013
|
} finally {
|
|
3269
|
-
meter.recordQueueTaskOutcome(common, outcome, getDurationMs(startedAt));
|
|
3014
|
+
meter.recordQueueTaskOutcome(common, outcome, require_http.getDurationMs(startedAt));
|
|
3270
3015
|
meter.decrementQueueTaskInFlight(common);
|
|
3271
3016
|
span.end();
|
|
3272
3017
|
}
|
|
@@ -3298,7 +3043,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3298
3043
|
try {
|
|
3299
3044
|
await this.#listenOutboxMessage(contextData, message, span);
|
|
3300
3045
|
} catch (e) {
|
|
3301
|
-
const aborted = isAbortError(e);
|
|
3046
|
+
const aborted = require_http.isAbortError(e);
|
|
3302
3047
|
outcome = aborted ? "aborted" : "failed";
|
|
3303
3048
|
if (!aborted) span.setStatus({
|
|
3304
3049
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
@@ -3306,7 +3051,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3306
3051
|
});
|
|
3307
3052
|
throw e;
|
|
3308
3053
|
} finally {
|
|
3309
|
-
meter.recordQueueTaskOutcome(common, outcome, getDurationMs(startedAt));
|
|
3054
|
+
meter.recordQueueTaskOutcome(common, outcome, require_http.getDurationMs(startedAt));
|
|
3310
3055
|
meter.decrementQueueTaskInFlight(common);
|
|
3311
3056
|
span.end();
|
|
3312
3057
|
}
|
|
@@ -3335,7 +3080,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3335
3080
|
common.activityType = activityType;
|
|
3336
3081
|
});
|
|
3337
3082
|
} catch (e) {
|
|
3338
|
-
const aborted = isAbortError(e);
|
|
3083
|
+
const aborted = require_http.isAbortError(e);
|
|
3339
3084
|
outcome = aborted ? "aborted" : "failed";
|
|
3340
3085
|
if (!aborted) span.setStatus({
|
|
3341
3086
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
@@ -3343,7 +3088,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3343
3088
|
});
|
|
3344
3089
|
throw e;
|
|
3345
3090
|
} finally {
|
|
3346
|
-
meter.recordQueueTaskOutcome(common, outcome, getDurationMs(startedAt));
|
|
3091
|
+
meter.recordQueueTaskOutcome(common, outcome, require_http.getDurationMs(startedAt));
|
|
3347
3092
|
meter.decrementQueueTaskInFlight(common);
|
|
3348
3093
|
span.end();
|
|
3349
3094
|
}
|
|
@@ -3430,9 +3175,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3430
3175
|
message: String(error)
|
|
3431
3176
|
});
|
|
3432
3177
|
const remoteHost = (() => {
|
|
3433
|
-
if (error instanceof SendActivityError) return getRemoteHost(error.inbox);
|
|
3178
|
+
if (error instanceof SendActivityError) return require_http.getRemoteHost(error.inbox);
|
|
3434
3179
|
try {
|
|
3435
|
-
return getRemoteHost(new URL(message.inbox));
|
|
3180
|
+
return require_http.getRemoteHost(new URL(message.inbox));
|
|
3436
3181
|
} catch (_) {
|
|
3437
3182
|
logger.warn("Invalid inbox URL in queued outbox message: {inbox}", logData);
|
|
3438
3183
|
return;
|
|
@@ -3459,7 +3204,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3459
3204
|
});
|
|
3460
3205
|
}
|
|
3461
3206
|
if (error instanceof SendActivityError && this.permanentFailureStatusCodes.includes(error.statusCode)) {
|
|
3462
|
-
getFederationMetrics(this.meterProvider).recordPermanentFailure(error.inbox, error.statusCode);
|
|
3207
|
+
require_http.getFederationMetrics(this.meterProvider).recordPermanentFailure(error.inbox, error.statusCode);
|
|
3463
3208
|
logger.warn("Permanent delivery failure for activity {activityId} to {inbox} ({status}); not retrying.", {
|
|
3464
3209
|
...logData,
|
|
3465
3210
|
status: error.statusCode
|
|
@@ -3513,7 +3258,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3513
3258
|
const { outboxQueue } = this;
|
|
3514
3259
|
if (outboxQueue != null) {
|
|
3515
3260
|
await outboxQueue.enqueue(retryMessage, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
|
|
3516
|
-
getFederationMetrics(this.meterProvider).recordQueueTaskEnqueued({
|
|
3261
|
+
require_http.getFederationMetrics(this.meterProvider).recordQueueTaskEnqueued({
|
|
3517
3262
|
role: "outbox",
|
|
3518
3263
|
queue: outboxQueue,
|
|
3519
3264
|
activityType: retryMessage.activityType
|
|
@@ -3583,7 +3328,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3583
3328
|
try {
|
|
3584
3329
|
await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, activityType), activity);
|
|
3585
3330
|
} finally {
|
|
3586
|
-
getFederationMetrics(this.meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
3331
|
+
require_http.getFederationMetrics(this.meterProvider).recordInboxProcessingDuration(activityType, require_http.getDurationMs(started));
|
|
3587
3332
|
}
|
|
3588
3333
|
} catch (error) {
|
|
3589
3334
|
try {
|
|
@@ -3630,7 +3375,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3630
3375
|
const { inboxQueue } = this;
|
|
3631
3376
|
if (inboxQueue != null) {
|
|
3632
3377
|
await inboxQueue.enqueue(retryMessage, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
|
|
3633
|
-
getFederationMetrics(this.meterProvider).recordQueueTaskEnqueued({
|
|
3378
|
+
require_http.getFederationMetrics(this.meterProvider).recordQueueTaskEnqueued({
|
|
3634
3379
|
role: "inbox",
|
|
3635
3380
|
queue: inboxQueue,
|
|
3636
3381
|
activityType
|
|
@@ -3827,7 +3572,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3827
3572
|
if (outboxQueue.enqueueMany == null || orderingKey != null) {
|
|
3828
3573
|
const errors = (await Promise.allSettled(messages.map(async (m) => {
|
|
3829
3574
|
await outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey });
|
|
3830
|
-
recordOutboxEnqueue(this.meterProvider, outboxQueue, m.message);
|
|
3575
|
+
require_http.recordOutboxEnqueue(this.meterProvider, outboxQueue, m.message);
|
|
3831
3576
|
}))).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3832
3577
|
if (errors.length > 0) {
|
|
3833
3578
|
logger.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
@@ -3847,7 +3592,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3847
3592
|
});
|
|
3848
3593
|
throw error;
|
|
3849
3594
|
}
|
|
3850
|
-
for (const m of messages) recordOutboxEnqueue(this.meterProvider, outboxQueue, m.message);
|
|
3595
|
+
for (const m of messages) require_http.recordOutboxEnqueue(this.meterProvider, outboxQueue, m.message);
|
|
3851
3596
|
}
|
|
3852
3597
|
}
|
|
3853
3598
|
fetch(request, options) {
|
|
@@ -3883,7 +3628,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3883
3628
|
});
|
|
3884
3629
|
if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
|
|
3885
3630
|
} catch (error) {
|
|
3886
|
-
getFederationMetrics(this.meterProvider).recordHttpServerRequest(request.method, metricState.endpoint ?? "error", getDurationMs(metricStart), { routeTemplate: metricState.routeTemplate });
|
|
3631
|
+
require_http.getFederationMetrics(this.meterProvider).recordHttpServerRequest(request.method, metricState.endpoint ?? "error", require_http.getDurationMs(metricStart), { routeTemplate: metricState.routeTemplate });
|
|
3887
3632
|
span.setStatus({
|
|
3888
3633
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3889
3634
|
message: `${error}`
|
|
@@ -3896,7 +3641,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3896
3641
|
});
|
|
3897
3642
|
throw error;
|
|
3898
3643
|
}
|
|
3899
|
-
getFederationMetrics(this.meterProvider).recordHttpServerRequest(request.method, metricState.endpoint ?? "error", getDurationMs(metricStart), {
|
|
3644
|
+
require_http.getFederationMetrics(this.meterProvider).recordHttpServerRequest(request.method, metricState.endpoint ?? "error", require_http.getDurationMs(metricStart), {
|
|
3900
3645
|
statusCode: response.status,
|
|
3901
3646
|
routeTemplate: metricState.routeTemplate
|
|
3902
3647
|
});
|
|
@@ -4663,7 +4408,7 @@ var ContextImpl = class ContextImpl {
|
|
|
4663
4408
|
};
|
|
4664
4409
|
if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
|
|
4665
4410
|
await this.federation.fanoutQueue.enqueue(message, { orderingKey: options.orderingKey });
|
|
4666
|
-
getFederationMetrics(this.federation.meterProvider).recordQueueTaskEnqueued({
|
|
4411
|
+
require_http.getFederationMetrics(this.federation.meterProvider).recordQueueTaskEnqueued({
|
|
4667
4412
|
role: "fanout",
|
|
4668
4413
|
queue: this.federation.fanoutQueue,
|
|
4669
4414
|
activityType: message.activityType
|
|
@@ -4731,6 +4476,7 @@ var ContextImpl = class ContextImpl {
|
|
|
4731
4476
|
if (await require_proof.verifyObject(_fedify_vocab.Activity, json, {
|
|
4732
4477
|
contextLoader,
|
|
4733
4478
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
4479
|
+
meterProvider: this.meterProvider,
|
|
4734
4480
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
4735
4481
|
keyCache
|
|
4736
4482
|
}) == null) {
|
|
@@ -4873,6 +4619,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
|
|
|
4873
4619
|
contextLoader: options.contextLoader ?? this.contextLoader,
|
|
4874
4620
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
4875
4621
|
timeWindow: this.federation.signatureTimeWindow,
|
|
4622
|
+
meterProvider: this.meterProvider,
|
|
4876
4623
|
tracerProvider: options.tracerProvider ?? this.tracerProvider
|
|
4877
4624
|
});
|
|
4878
4625
|
}
|
|
@@ -5050,7 +4797,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
5050
4797
|
if (outboxQueue.enqueueMany == null || orderingKey != null) {
|
|
5051
4798
|
const errors = (await Promise.allSettled(messages.map(async (m) => {
|
|
5052
4799
|
await outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey });
|
|
5053
|
-
recordOutboxEnqueue(ctx.federation.meterProvider, outboxQueue, m.message);
|
|
4800
|
+
require_http.recordOutboxEnqueue(ctx.federation.meterProvider, outboxQueue, m.message);
|
|
5054
4801
|
}))).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
5055
4802
|
if (errors.length > 0) {
|
|
5056
4803
|
logger.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
@@ -5070,7 +4817,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
5070
4817
|
});
|
|
5071
4818
|
throw error;
|
|
5072
4819
|
}
|
|
5073
|
-
for (const m of messages) recordOutboxEnqueue(ctx.federation.meterProvider, outboxQueue, m.message);
|
|
4820
|
+
for (const m of messages) require_http.recordOutboxEnqueue(ctx.federation.meterProvider, outboxQueue, m.message);
|
|
5074
4821
|
}
|
|
5075
4822
|
return true;
|
|
5076
4823
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { S as KeyCache } from "./http-
|
|
2
|
+
import { S as KeyCache } from "./http-D6LP89UO.js";
|
|
3
3
|
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
4
|
+
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
4
5
|
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
5
|
-
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region src/sig/ld.d.ts
|
|
8
8
|
/**
|
|
@@ -127,9 +127,26 @@ interface VerifySignatureOptions {
|
|
|
127
127
|
* @since 1.3.0
|
|
128
128
|
*/
|
|
129
129
|
tracerProvider?: TracerProvider;
|
|
130
|
+
/**
|
|
131
|
+
* The OpenTelemetry meter provider. If omitted, the global meter provider
|
|
132
|
+
* is used.
|
|
133
|
+
* @since 2.3.0
|
|
134
|
+
*/
|
|
135
|
+
meterProvider?: MeterProvider;
|
|
130
136
|
}
|
|
131
137
|
/**
|
|
132
138
|
* Verifies Linked Data Signatures of the given JSON-LD document.
|
|
139
|
+
*
|
|
140
|
+
* This is a low-level utility that only checks the cryptographic signature
|
|
141
|
+
* and (optionally) the cached key. It does not run the JSON-LD parsing,
|
|
142
|
+
* attribution, and owner checks that a complete inbound LD verification
|
|
143
|
+
* needs. For incoming activities, prefer {@link verifyJsonLd}, which is
|
|
144
|
+
* the public verification entry point and the one that emits the
|
|
145
|
+
* `activitypub.signature.verification.duration` metric for the LD path.
|
|
146
|
+
* `verifySignature` itself only emits
|
|
147
|
+
* `activitypub.signature.key_fetch.duration`, since the rest of the work
|
|
148
|
+
* that the verification-duration metric is meant to cover happens in
|
|
149
|
+
* `verifyJsonLd`.
|
|
133
150
|
* @param jsonLd The JSON-LD document to verify.
|
|
134
151
|
* @param options Options for verifying the signature.
|
|
135
152
|
* @returns The public key that signed the document or `null` if the signature
|
|
@@ -246,6 +263,12 @@ interface VerifyProofOptions {
|
|
|
246
263
|
* @since 1.3.0
|
|
247
264
|
*/
|
|
248
265
|
tracerProvider?: TracerProvider;
|
|
266
|
+
/**
|
|
267
|
+
* The OpenTelemetry meter provider. If omitted, the global meter provider
|
|
268
|
+
* is used.
|
|
269
|
+
* @since 2.3.0
|
|
270
|
+
*/
|
|
271
|
+
meterProvider?: MeterProvider;
|
|
249
272
|
}
|
|
250
273
|
/**
|
|
251
274
|
* Verifies the given proof for the object.
|