@fedify/fedify 1.3.0-dev.568 → 1.3.0-dev.569
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/esm/deno.js +1 -1
- package/esm/federation/middleware.js +40 -3
- package/esm/vocab/vocab.js +173 -173
- package/package.json +1 -1
- package/types/federation/middleware.d.ts.map +1 -1
package/esm/deno.js
CHANGED
@@ -11,6 +11,7 @@ import { hasSignature, signJsonLd } from "../sig/ld.js";
|
|
11
11
|
import { getKeyOwner } from "../sig/owner.js";
|
12
12
|
import { signObject } from "../sig/proof.js";
|
13
13
|
import { lookupObject, traverseCollection, } from "../vocab/lookup.js";
|
14
|
+
import { getTypeId } from "../vocab/type.js";
|
14
15
|
import { Activity, CryptographicKey, Multikey, } from "../vocab/vocab.js";
|
15
16
|
import { handleWebFinger } from "../webfinger/handler.js";
|
16
17
|
import { buildCollectionSynchronizationHeader } from "./collection.js";
|
@@ -402,7 +403,29 @@ export class FederationImpl {
|
|
402
403
|
}
|
403
404
|
const callbacks = {
|
404
405
|
dispatcher: async (context, identifier) => {
|
405
|
-
const actor = await
|
406
|
+
const actor = await this.#getTracer().startActiveSpan("activitypub.dispatch_actor", { kind: SpanKind.SERVER }, async (span) => {
|
407
|
+
try {
|
408
|
+
const actor = await dispatcher(context, identifier);
|
409
|
+
span.setAttribute("activitypub.actor.id", (actor?.id ?? context.getActorUri(identifier)).href);
|
410
|
+
if (actor == null) {
|
411
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
412
|
+
}
|
413
|
+
else {
|
414
|
+
span.setAttribute("activitypub.actor.type", getTypeId(actor).href);
|
415
|
+
}
|
416
|
+
return actor;
|
417
|
+
}
|
418
|
+
catch (error) {
|
419
|
+
span.setStatus({
|
420
|
+
code: SpanStatusCode.ERROR,
|
421
|
+
message: String(error),
|
422
|
+
});
|
423
|
+
throw error;
|
424
|
+
}
|
425
|
+
finally {
|
426
|
+
span.end();
|
427
|
+
}
|
428
|
+
});
|
406
429
|
if (actor == null)
|
407
430
|
return null;
|
408
431
|
const logger = getLogger(["fedify", "federation", "actor"]);
|
@@ -536,8 +559,22 @@ export class FederationImpl {
|
|
536
559
|
};
|
537
560
|
this.actorCallbacks = callbacks;
|
538
561
|
const setters = {
|
539
|
-
setKeyPairsDispatcher(dispatcher) {
|
540
|
-
callbacks.keyPairsDispatcher =
|
562
|
+
setKeyPairsDispatcher: (dispatcher) => {
|
563
|
+
callbacks.keyPairsDispatcher = (ctx, identifier) => this.#getTracer().startActiveSpan("activitypub.dispatch_actor_key_pairs", { kind: SpanKind.SERVER }, async (span) => {
|
564
|
+
try {
|
565
|
+
return await dispatcher(ctx, identifier);
|
566
|
+
}
|
567
|
+
catch (e) {
|
568
|
+
span.setStatus({
|
569
|
+
code: SpanStatusCode.ERROR,
|
570
|
+
message: String(e),
|
571
|
+
});
|
572
|
+
throw e;
|
573
|
+
}
|
574
|
+
finally {
|
575
|
+
span.end();
|
576
|
+
}
|
577
|
+
});
|
541
578
|
return setters;
|
542
579
|
},
|
543
580
|
mapHandle(mapper) {
|