@fedify/fedify 2.3.0-dev.1013 → 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-CROLcFVM.mjs → builder-y06Dq5bp.mjs} +14 -4
- 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-BDl7Y6f-.d.cts → context-BKLGj9QO.d.cts} +24 -1
- package/dist/{context-zTZAI3KP.d.ts → context-DrNqYkPw.d.ts} +24 -1
- package/dist/{deno-Ctd-K-t6.mjs → deno-DB1H1VHx.mjs} +1 -1
- package/dist/{docloader-q9QT51g3.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 +8 -3
- 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 +138 -15
- 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-1NL30qCe.js → http-BUr93aO6.js} +1 -1
- package/dist/{http-CX_zHeOD.mjs → http-D9zG-L9N.mjs} +3 -3
- package/dist/{http-Du1Jgf2P.cjs → http-FnUTcdMf.cjs} +1 -1
- package/dist/{key-C1Oto4it.mjs → key-CV57mOYH.mjs} +1 -1
- package/dist/{kv-cache-aGOwL6Vj.cjs → kv-cache-BG9O8wVV.cjs} +1 -1
- package/dist/{kv-cache-CsC3P4uu.js → kv-cache-C3esyJFP.js} +1 -1
- package/dist/{ld-Dl1HIB1a.mjs → ld-sUf94RJ8.mjs} +2 -2
- package/dist/{middleware-BiFLcrEX.cjs → middleware-CKkBrsOD.cjs} +203 -32
- package/dist/{middleware-C1cf3_6V.mjs → middleware-cMxbPxDe.mjs} +1 -1
- package/dist/{middleware-CKJC8DRf.js → middleware-fAuUxD9-.js} +203 -32
- package/dist/{middleware-BwC5U8zJ.cjs → middleware-ohzkLsW4.cjs} +1 -1
- package/dist/{middleware-CEWDB8EB.mjs → middleware-pb2EqN_r.mjs} +75 -27
- package/dist/{mod-ckCOmoCz.d.ts → mod-B8Z8mBLk.d.ts} +1 -1
- package/dist/{mod-BghZgD_U.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-CEWFJlqo.mjs → owner-DsPgl527.mjs} +2 -2
- package/dist/{proof-CDA3f-i5.cjs → proof-BhJpq_J9.cjs} +1 -1
- package/dist/{proof-BFyPVl1r.mjs → proof-iVfYyJpY.mjs} +4 -4
- package/dist/{proof-Dedf8md5.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 +18 -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-BJickEP4.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,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 {
|
|
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);
|
|
@@ -2479,15 +2519,18 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2479
2519
|
if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
2480
2520
|
switch (routeName) {
|
|
2481
2521
|
case "actor":
|
|
2482
|
-
|
|
2522
|
+
case "actorAlias": {
|
|
2523
|
+
const identifier = route.name.startsWith("actorAlias:") ? route.name.substring(ACTOR_ALIAS_PREFIX.length) : route.values.identifier;
|
|
2524
|
+
context = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier } });
|
|
2483
2525
|
return await handleActor(request, {
|
|
2484
|
-
identifier
|
|
2526
|
+
identifier,
|
|
2485
2527
|
context,
|
|
2486
2528
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
2487
2529
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
|
2488
2530
|
onUnauthorized,
|
|
2489
2531
|
onNotFound
|
|
2490
2532
|
});
|
|
2533
|
+
}
|
|
2491
2534
|
case "object": {
|
|
2492
2535
|
const typeId = route.name.replace(/^object:/, "");
|
|
2493
2536
|
const callbacks = this.objectCallbacks[typeId];
|
|
@@ -2569,6 +2612,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2569
2612
|
signatureTimeWindow: this.signatureTimeWindow,
|
|
2570
2613
|
skipSignatureVerification: this.skipSignatureVerification,
|
|
2571
2614
|
inboxChallengePolicy: this.inboxChallengePolicy,
|
|
2615
|
+
meterProvider: this.meterProvider,
|
|
2572
2616
|
tracerProvider: this.tracerProvider,
|
|
2573
2617
|
idempotencyStrategy: this.idempotencyStrategy
|
|
2574
2618
|
});
|
|
@@ -2730,13 +2774,16 @@ var ContextImpl = class ContextImpl {
|
|
|
2730
2774
|
get tracerProvider() {
|
|
2731
2775
|
return this.federation.tracerProvider;
|
|
2732
2776
|
}
|
|
2777
|
+
get meterProvider() {
|
|
2778
|
+
return this.federation.meterProvider;
|
|
2779
|
+
}
|
|
2733
2780
|
getNodeInfoUri() {
|
|
2734
2781
|
const path = this.federation.router.build("nodeInfo", {});
|
|
2735
2782
|
if (path == null) throw new RouterError("No NodeInfo dispatcher registered.");
|
|
2736
2783
|
return new URL(path, this.canonicalOrigin);
|
|
2737
2784
|
}
|
|
2738
2785
|
getActorUri(identifier) {
|
|
2739
|
-
const path = this.federation.router.build("actor", { identifier });
|
|
2786
|
+
const path = this.federation.router.build(`actorAlias:${identifier}`, {}) ?? this.federation.router.build("actor", { identifier });
|
|
2740
2787
|
if (path == null) throw new RouterError("No actor dispatcher registered.");
|
|
2741
2788
|
return new URL(path, this.canonicalOrigin);
|
|
2742
2789
|
}
|
|
@@ -2802,8 +2849,8 @@ var ContextImpl = class ContextImpl {
|
|
|
2802
2849
|
type: "inbox",
|
|
2803
2850
|
identifier: void 0
|
|
2804
2851
|
};
|
|
2805
|
-
const identifier = route.values.identifier;
|
|
2806
|
-
if (route.name === "actor") return {
|
|
2852
|
+
const identifier = route.name.startsWith("actorAlias:") ? route.name.substring(ACTOR_ALIAS_PREFIX.length) : route.values.identifier;
|
|
2853
|
+
if (route.name === "actor" || route.name.startsWith("actorAlias:")) return {
|
|
2807
2854
|
type: "actor",
|
|
2808
2855
|
identifier
|
|
2809
2856
|
};
|
|
@@ -3479,6 +3526,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
3479
3526
|
activityType: ctx.activityType,
|
|
3480
3527
|
inbox: new URL(inbox),
|
|
3481
3528
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
3529
|
+
meterProvider: ctx.meterProvider,
|
|
3482
3530
|
tracerProvider: ctx.tracerProvider,
|
|
3483
3531
|
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
3484
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";
|
package/dist/mod.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
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-AtlibPOU.js";
|
|
4
4
|
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-aQzN9Ayi.js";
|
|
5
5
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-74ARJ5TL.js";
|
|
6
|
-
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-
|
|
6
|
+
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-DrNqYkPw.js";
|
|
7
7
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-GFYnFoOl.js";
|
|
8
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
9
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-B8Z8mBLk.js";
|
|
10
10
|
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-CR8soWa9.js";
|
|
11
11
|
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CLgIXe9w.js";
|
|
12
12
|
export * from "@fedify/vocab-runtime";
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-nlSIicah.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-ve6e2xcg.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "./http-
|
|
7
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-
|
|
8
|
-
import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-
|
|
6
|
+
import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "./http-BUr93aO6.js";
|
|
7
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-fAuUxD9-.js";
|
|
8
|
+
import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-k4mEvvdS.js";
|
|
9
9
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-hvL8ElAs.js";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C3esyJFP.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
5
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
5
|
import "../std__assert-CRDpx_HF.mjs";
|
|
7
|
-
import {
|
|
6
|
+
import { t as esm_default } from "../esm-DhnRLoG9.mjs";
|
|
7
|
+
import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-CIiz1WX7.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/nodeinfo/client.test.ts
|
|
10
10
|
test("getNodeInfo()", async (t) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { r as createRequestContext } from "../context-
|
|
4
|
+
import { r as createRequestContext } from "../context-7Azky82W.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-CRDpx_HF.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
|
|
8
|
+
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-pb2EqN_r.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-CRDpx_HF.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
|
-
import { t as nodeInfoToJson } from "../types-
|
|
7
|
+
import { t as nodeInfoToJson } from "../types-BFowWFTT.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/nodeinfo/types.test.ts
|
|
10
10
|
test("nodeInfoToJson()", () => {
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-CRDpx_HF.mjs";
|
|
6
|
-
import { t as MemoryKvStore } from "../kv-
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -159,11 +159,10 @@ var FedifySpanExporter = class {
|
|
|
159
159
|
const attrs = event.attributes;
|
|
160
160
|
if (attrs == null) return null;
|
|
161
161
|
const activityJson = attrs["activitypub.activity.json"];
|
|
162
|
-
if (typeof activityJson !== "string") return null;
|
|
163
162
|
let activityType = "Unknown";
|
|
164
163
|
let activityId;
|
|
165
164
|
let actorId;
|
|
166
|
-
try {
|
|
165
|
+
if (typeof activityJson === "string") try {
|
|
167
166
|
const activity = JSON.parse(activityJson);
|
|
168
167
|
activityType = activity.type ?? "Unknown";
|
|
169
168
|
activityId = activity.id;
|
|
@@ -172,15 +171,17 @@ var FedifySpanExporter = class {
|
|
|
172
171
|
} catch {}
|
|
173
172
|
const inboxUrl = attrs["activitypub.inbox.url"];
|
|
174
173
|
const explicitActivityId = attrs["activitypub.activity.id"];
|
|
174
|
+
const explicitActivityType = attrs["activitypub.activity.type"];
|
|
175
|
+
const explicitActorId = attrs["activitypub.actor.id"];
|
|
175
176
|
return {
|
|
176
177
|
traceId,
|
|
177
178
|
spanId,
|
|
178
179
|
parentSpanId,
|
|
179
180
|
direction: "outbound",
|
|
180
|
-
activityType,
|
|
181
|
+
activityType: typeof explicitActivityType === "string" && explicitActivityType !== "" ? explicitActivityType : activityType,
|
|
181
182
|
activityId: activityId ?? (typeof explicitActivityId === "string" && explicitActivityId !== "" ? explicitActivityId : void 0),
|
|
182
|
-
actorId,
|
|
183
|
-
activityJson,
|
|
183
|
+
actorId: typeof explicitActorId === "string" && explicitActorId !== "" ? explicitActorId : actorId,
|
|
184
|
+
...typeof activityJson === "string" ? { activityJson } : {},
|
|
184
185
|
timestamp: (/* @__PURE__ */ new Date(event.time[0] * 1e3 + event.time[1] / 1e6)).toISOString(),
|
|
185
186
|
inboxUrl: typeof inboxUrl === "string" ? inboxUrl : void 0
|
|
186
187
|
};
|
|
@@ -316,14 +317,17 @@ function createActivityReceivedEvent(options) {
|
|
|
316
317
|
};
|
|
317
318
|
}
|
|
318
319
|
function createActivitySentEvent(options) {
|
|
320
|
+
const attributes = {
|
|
321
|
+
"activitypub.inbox.url": options.inboxUrl,
|
|
322
|
+
"activitypub.activity.id": options.activityId ?? ""
|
|
323
|
+
};
|
|
324
|
+
if (options.activityType != null) attributes["activitypub.activity.type"] = options.activityType;
|
|
325
|
+
if (options.actorId != null) attributes["activitypub.actor.id"] = options.actorId;
|
|
326
|
+
if (options.activityJson != null) attributes["activitypub.activity.json"] = options.activityJson;
|
|
319
327
|
return {
|
|
320
328
|
name: "activitypub.activity.sent",
|
|
321
329
|
time: [17e8, 5e8],
|
|
322
|
-
attributes
|
|
323
|
-
"activitypub.activity.json": options.activityJson,
|
|
324
|
-
"activitypub.inbox.url": options.inboxUrl,
|
|
325
|
-
"activitypub.activity.id": options.activityId ?? ""
|
|
326
|
-
}
|
|
330
|
+
attributes
|
|
327
331
|
};
|
|
328
332
|
}
|
|
329
333
|
test("FedifySpanExporter", async (t) => {
|
|
@@ -376,21 +380,18 @@ test("FedifySpanExporter", async (t) => {
|
|
|
376
380
|
const traceId = "trace789";
|
|
377
381
|
const spanId = "span012";
|
|
378
382
|
const inboxUrl = "https://example.com/users/alice/inbox";
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
id: "https://myserver.com/activities/789",
|
|
383
|
-
actor: "https://myserver.com/users/bob",
|
|
384
|
-
object: "https://example.com/users/alice"
|
|
385
|
-
};
|
|
383
|
+
const activityId = "https://myserver.com/activities/789";
|
|
384
|
+
const activityType = "https://www.w3.org/ns/activitystreams#Accept";
|
|
385
|
+
const actorId = "https://myserver.com/users/bob";
|
|
386
386
|
const span = createMockSpan({
|
|
387
387
|
traceId,
|
|
388
388
|
spanId,
|
|
389
389
|
name: "activitypub.send_activity",
|
|
390
390
|
events: [createActivitySentEvent({
|
|
391
|
-
activityJson: JSON.stringify(activity),
|
|
392
391
|
inboxUrl,
|
|
393
|
-
activityId
|
|
392
|
+
activityId,
|
|
393
|
+
activityType,
|
|
394
|
+
actorId
|
|
394
395
|
})]
|
|
395
396
|
});
|
|
396
397
|
await new Promise((resolve) => {
|
|
@@ -404,8 +405,10 @@ test("FedifySpanExporter", async (t) => {
|
|
|
404
405
|
assertEquals(activities[0].traceId, traceId);
|
|
405
406
|
assertEquals(activities[0].spanId, spanId);
|
|
406
407
|
assertEquals(activities[0].direction, "outbound");
|
|
407
|
-
assertEquals(activities[0].activityType,
|
|
408
|
-
assertEquals(activities[0].activityId,
|
|
408
|
+
assertEquals(activities[0].activityType, activityType);
|
|
409
|
+
assertEquals(activities[0].activityId, activityId);
|
|
410
|
+
assertEquals(activities[0].actorId, actorId);
|
|
411
|
+
assertEquals(activities[0].activityJson, void 0);
|
|
409
412
|
assertEquals(activities[0].inboxUrl, inboxUrl);
|
|
410
413
|
});
|
|
411
414
|
await t.step("export() ignores spans without activity events", async () => {
|
package/dist/otel/mod.cjs
CHANGED
|
@@ -155,11 +155,10 @@ var FedifySpanExporter = class {
|
|
|
155
155
|
const attrs = event.attributes;
|
|
156
156
|
if (attrs == null) return null;
|
|
157
157
|
const activityJson = attrs["activitypub.activity.json"];
|
|
158
|
-
if (typeof activityJson !== "string") return null;
|
|
159
158
|
let activityType = "Unknown";
|
|
160
159
|
let activityId;
|
|
161
160
|
let actorId;
|
|
162
|
-
try {
|
|
161
|
+
if (typeof activityJson === "string") try {
|
|
163
162
|
const activity = JSON.parse(activityJson);
|
|
164
163
|
activityType = activity.type ?? "Unknown";
|
|
165
164
|
activityId = activity.id;
|
|
@@ -168,15 +167,17 @@ var FedifySpanExporter = class {
|
|
|
168
167
|
} catch {}
|
|
169
168
|
const inboxUrl = attrs["activitypub.inbox.url"];
|
|
170
169
|
const explicitActivityId = attrs["activitypub.activity.id"];
|
|
170
|
+
const explicitActivityType = attrs["activitypub.activity.type"];
|
|
171
|
+
const explicitActorId = attrs["activitypub.actor.id"];
|
|
171
172
|
return {
|
|
172
173
|
traceId,
|
|
173
174
|
spanId,
|
|
174
175
|
parentSpanId,
|
|
175
176
|
direction: "outbound",
|
|
176
|
-
activityType,
|
|
177
|
+
activityType: typeof explicitActivityType === "string" && explicitActivityType !== "" ? explicitActivityType : activityType,
|
|
177
178
|
activityId: activityId ?? (typeof explicitActivityId === "string" && explicitActivityId !== "" ? explicitActivityId : void 0),
|
|
178
|
-
actorId,
|
|
179
|
-
activityJson,
|
|
179
|
+
actorId: typeof explicitActorId === "string" && explicitActorId !== "" ? explicitActorId : actorId,
|
|
180
|
+
...typeof activityJson === "string" ? { activityJson } : {},
|
|
180
181
|
timestamp: (/* @__PURE__ */ new Date(event.time[0] * 1e3 + event.time[1] / 1e6)).toISOString(),
|
|
181
182
|
inboxUrl: typeof inboxUrl === "string" ? inboxUrl : void 0
|
|
182
183
|
};
|
package/dist/otel/mod.d.cts
CHANGED
|
@@ -77,9 +77,10 @@ interface TraceActivityRecord {
|
|
|
77
77
|
*/
|
|
78
78
|
readonly actorId?: string;
|
|
79
79
|
/**
|
|
80
|
-
* The full JSON representation of the activity
|
|
80
|
+
* The full JSON representation of the activity, if the span event included
|
|
81
|
+
* it.
|
|
81
82
|
*/
|
|
82
|
-
readonly activityJson
|
|
83
|
+
readonly activityJson?: string;
|
|
83
84
|
/**
|
|
84
85
|
* Whether the activity was verified (for inbound activities).
|
|
85
86
|
*/
|
package/dist/otel/mod.d.ts
CHANGED
|
@@ -79,9 +79,10 @@ interface TraceActivityRecord {
|
|
|
79
79
|
*/
|
|
80
80
|
readonly actorId?: string;
|
|
81
81
|
/**
|
|
82
|
-
* The full JSON representation of the activity
|
|
82
|
+
* The full JSON representation of the activity, if the span event included
|
|
83
|
+
* it.
|
|
83
84
|
*/
|
|
84
|
-
readonly activityJson
|
|
85
|
+
readonly activityJson?: string;
|
|
85
86
|
/**
|
|
86
87
|
* Whether the activity was verified (for inbound activities).
|
|
87
88
|
*/
|
package/dist/otel/mod.js
CHANGED
|
@@ -153,11 +153,10 @@ var FedifySpanExporter = class {
|
|
|
153
153
|
const attrs = event.attributes;
|
|
154
154
|
if (attrs == null) return null;
|
|
155
155
|
const activityJson = attrs["activitypub.activity.json"];
|
|
156
|
-
if (typeof activityJson !== "string") return null;
|
|
157
156
|
let activityType = "Unknown";
|
|
158
157
|
let activityId;
|
|
159
158
|
let actorId;
|
|
160
|
-
try {
|
|
159
|
+
if (typeof activityJson === "string") try {
|
|
161
160
|
const activity = JSON.parse(activityJson);
|
|
162
161
|
activityType = activity.type ?? "Unknown";
|
|
163
162
|
activityId = activity.id;
|
|
@@ -166,15 +165,17 @@ var FedifySpanExporter = class {
|
|
|
166
165
|
} catch {}
|
|
167
166
|
const inboxUrl = attrs["activitypub.inbox.url"];
|
|
168
167
|
const explicitActivityId = attrs["activitypub.activity.id"];
|
|
168
|
+
const explicitActivityType = attrs["activitypub.activity.type"];
|
|
169
|
+
const explicitActorId = attrs["activitypub.actor.id"];
|
|
169
170
|
return {
|
|
170
171
|
traceId,
|
|
171
172
|
spanId,
|
|
172
173
|
parentSpanId,
|
|
173
174
|
direction: "outbound",
|
|
174
|
-
activityType,
|
|
175
|
+
activityType: typeof explicitActivityType === "string" && explicitActivityType !== "" ? explicitActivityType : activityType,
|
|
175
176
|
activityId: activityId ?? (typeof explicitActivityId === "string" && explicitActivityId !== "" ? explicitActivityId : void 0),
|
|
176
|
-
actorId,
|
|
177
|
-
activityJson,
|
|
177
|
+
actorId: typeof explicitActorId === "string" && explicitActorId !== "" ? explicitActorId : actorId,
|
|
178
|
+
...typeof activityJson === "string" ? { activityJson } : {},
|
|
178
179
|
timestamp: (/* @__PURE__ */ new Date(event.time[0] * 1e3 + event.time[1] / 1e6)).toISOString(),
|
|
179
180
|
inboxUrl: typeof inboxUrl === "string" ? inboxUrl : void 0
|
|
180
181
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-
|
|
4
|
+
import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-PVTwU_Ex.mjs";
|
|
5
5
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-DB1H1VHx.mjs";
|
|
5
|
+
import "./key-CV57mOYH.mjs";
|
|
6
6
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-FnUTcdMf.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab = require("@fedify/vocab");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|