@fedify/fedify 2.0.0-pr.412.1692 → 2.0.0-pr.412.1794
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/{actor-D5S46edz.js → actor-BXHc5r-q.js} +1 -1
- package/dist/{actor-CrTGiTZd.cjs → actor-Ba9Z1eNJ.cjs} +921 -1451
- package/dist/{actor-T6RyhRgk.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-G2S5sPEA.js → actor-DzhunPC_.js} +189 -677
- package/dist/{actor-D6K058Tb.d.cts → actor-f2NtjyCg.d.cts} +2 -2
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-OA47XRft.js → builder-u7usRsT3.js} +7 -8
- package/dist/{client-CegPX0Rn.d.cts → client-94iWEfQa.d.cts} +1 -1
- package/dist/{client-bgSdkFa2.d.ts → client-BsGzbnV-.d.ts} +1 -1
- package/dist/{client-Bmd-i8x8.js → client-pY7-3icS.js} +1 -1
- package/dist/compat/mod.d.cts +11 -12
- package/dist/compat/mod.d.ts +11 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-ByZprN0S.d.ts → context-DG0huGW-.d.ts} +124 -127
- package/dist/{context-C5BsZkDr.d.cts → context-DJ8aSy2Q.d.cts} +124 -127
- package/dist/{authdocloader-SjwloJUA.js → docloader-CrbAy9Oc.js} +17 -8
- package/dist/{esm-CwHz8Y8t.js → esm-C-Qa1zEM.js} +11 -11
- package/dist/federation/builder.test.js +8 -10
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +25 -26
- package/dist/federation/idempotency.test.js +25 -26
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +32 -33
- package/dist/federation/mod.cjs +9 -11
- package/dist/federation/mod.d.cts +12 -13
- package/dist/federation/mod.d.ts +12 -13
- package/dist/federation/mod.js +9 -11
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +7 -9
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/{http-D6Uj2x2y.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-C5tC93Hn.js → http-CUVx-vzb.js} +256 -6
- package/dist/{http-DGjdMiLc.js → http-D2kIm9la.js} +2 -2
- package/dist/{http-BiBofurJ.cjs → http-Dofes42e.cjs} +289 -9
- package/dist/{http-D-e6AFwR.d.cts → http-M8k5mKc0.d.cts} +2 -2
- package/dist/{inbox-BoDY3z8G.js → inbox-HjG5peXY.js} +1 -1
- package/dist/{key-IxRhZpOF.js → key-CxdLUFS6.js} +3 -2
- package/dist/{keycache-TEniXNel.js → keycache-bU7COwsh.js} +1 -1
- package/dist/{keys-bZxcrZ9Z.js → keys-DMHs8XNn.js} +2 -1
- package/dist/kv-cache-CGXcDejL.js +122 -0
- package/dist/kv-cache-DN9pfMBe.js +94 -0
- package/dist/kv-cache-Dkvbn6rg.cjs +134 -0
- package/dist/{ld-DW7A0uIc.js → ld-CIhvSCCr.js} +3 -2
- package/dist/{lookup-cVRa2QM-.js → lookup-CHkCVZTU.js} +131 -2
- package/dist/lookup-CfFkONZD.cjs +272 -0
- package/dist/{type-NEA09tSC.js → lookup-DQRtjvb1.js} +503 -5328
- package/dist/middleware-Bot7EEwV.js +26 -0
- package/dist/middleware-CFJgmUMW.cjs +15 -0
- package/dist/{middleware-Cgr3PtaJ.js → middleware-CJlj5Olw.js} +44 -48
- package/dist/middleware-CjHl2NHA.js +15 -0
- package/dist/{middleware-TfuVoceY.cjs → middleware-D74TgW2E.cjs} +60 -66
- package/dist/{middleware-DvvYAIsd.js → middleware-DMk2Mdn9.js} +40 -46
- package/dist/mod-0noXw66R.d.cts +107 -0
- package/dist/{mod-BhUKmBJD.d.ts → mod-B2iOw50L.d.ts} +3 -3
- package/dist/mod-B9M-8jm2.d.ts +109 -0
- package/dist/{mod-DlU8ISoa.d.ts → mod-BlVovdcy.d.ts} +2 -2
- package/dist/{mod-D6hQoxC5.d.ts → mod-BoHnwOCs.d.ts} +2 -2
- package/dist/{mod-CxkWO3Mg.d.cts → mod-BxRCHTz-.d.cts} +2 -2
- package/dist/{mod-jQ4OODsl.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
- package/dist/{mod-8DMWKtQE.d.cts → mod-DJcZDvjA.d.cts} +2 -2
- package/dist/{mod-Djzcw2ry.d.cts → mod-DgdBYYa0.d.cts} +3 -3
- package/dist/{mod-DBzN0aCM.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/mod.cjs +19 -32
- package/dist/mod.d.cts +15 -16
- package/dist/mod.d.ts +16 -17
- package/dist/mod.js +14 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +2 -3
- package/dist/nodeinfo/mod.d.cts +2 -4
- package/dist/nodeinfo/mod.d.ts +2 -4
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-BN_tO3cY.d.cts → owner-B4HbyP8s.d.cts} +3 -3
- package/dist/{owner-6Vc3UXXE.js → owner-Dvh7mBvr.js} +3 -2
- package/dist/{owner-hd9lvQcP.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-CRJWXFfT.cjs → proof-D0uThUvD.cjs} +17 -16
- package/dist/{proof-C1jhbeNv.js → proof-Dgy35fzc.js} +2 -2
- package/dist/{proof-Chi90OXv.js → proof-fqzaMJ4g.js} +5 -4
- package/dist/{send-DjATl6i3.js → send-Drp20VO9.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +9 -11
- package/dist/sig/mod.d.cts +5 -7
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +5 -7
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +114 -196
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-BnfPB5T-.js → testing-g4UC4liW.js} +1 -2
- package/dist/{types-dLXLjVLf.js → types-BtUjyi5y.js} +1 -1
- package/dist/{types-CmmUQisS.cjs → types-CWgzGaqk.cjs} +3 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
- package/dist/utils/kv-cache.test.js +209 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +3 -4
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +3 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-BCWe1Ih5.d.ts} +2 -21
- package/dist/{vocab-rWbHpc2J.js → vocab-BnR3nIU9.js} +3 -3
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-CeDBzu-f.d.cts} +2 -21
- package/dist/{vocab-C5Y-0fGj.cjs → vocab-DFaWWYDn.cjs} +5 -5
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +2 -3
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/cfworkers.d.cts +2 -2
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -11
- package/dist/x/hono.d.ts +10 -11
- package/dist/x/sveltekit.d.cts +10 -11
- package/dist/x/sveltekit.d.ts +10 -11
- package/package.json +18 -17
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-C5AvdCCi.js +0 -52
- package/dist/authdocloader-CQMPmpaO.cjs +0 -58
- package/dist/docloader-7Ey7wNHx.cjs +0 -4861
- package/dist/docloader-CkweNhUH.js +0 -4795
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-CZR7QraT.cjs +0 -290
- package/dist/key-Cf8MffVe.cjs +0 -10
- package/dist/key-CkxrAIyp.js +0 -260
- package/dist/key-Dk0j88Jo.js +0 -10
- package/dist/key-Epcl5jpz.js +0 -10
- package/dist/lookup-DhQCVVja.js +0 -331
- package/dist/lookup-DiV4LFBg.cjs +0 -137
- package/dist/middleware-Be1JStOx.js +0 -17
- package/dist/middleware-CDOK7WOb.js +0 -26
- package/dist/middleware-EjIW2mZB.cjs +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.d.ts +0 -3
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CcnIw1qY.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{federation-H2_En3j5.cjs → federation-CRpdnOMS.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-jcR8-ZxP.js} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-Bxr0Q87_.d.cts} +0 -0
- /package/dist/{mod-FZd39qVq.d.cts → mod-B-hUPT2N.d.cts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-xIj-IT58.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CUKlBw08.d.ts} +0 -0
- /package/dist/{mq-B7R1Q-M5.d.cts → mq-DcJPkXD5.d.cts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BnthBobC.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-C34-oHBl.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-YYj5tCnr.cjs} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{types-BSuWJsOm.js → types-C2XVl6gj.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-D-Va7aXC.js} +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-DyRU1gdZ.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-C72Y8lrh.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-vAtLmxOF.cjs} +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import "./lookup-DQRtjvb1.js";
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CJlj5Olw.js";
|
8
|
+
import "./client-pY7-3icS.js";
|
9
|
+
import "./types-C2XVl6gj.js";
|
10
|
+
import "./actor-BXHc5r-q.js";
|
11
|
+
import "./key-CxdLUFS6.js";
|
12
|
+
import "./http-D2kIm9la.js";
|
13
|
+
import "./ld-CIhvSCCr.js";
|
14
|
+
import "./owner-Dvh7mBvr.js";
|
15
|
+
import "./proof-Dgy35fzc.js";
|
16
|
+
import "./docloader-CrbAy9Oc.js";
|
17
|
+
import "./kv-cache-DN9pfMBe.js";
|
18
|
+
import "./inbox-HjG5peXY.js";
|
19
|
+
import "./builder-u7usRsT3.js";
|
20
|
+
import "./collection-BzWsN9pB.js";
|
21
|
+
import "./keycache-bU7COwsh.js";
|
22
|
+
import "./negotiation-C4nFufNk.js";
|
23
|
+
import "./retry-CfF8Gn4d.js";
|
24
|
+
import "./send-Drp20VO9.js";
|
25
|
+
|
26
|
+
export { FederationImpl };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('./transformers-CoBS-oFG.cjs');
|
6
|
+
require('./lookup-CfFkONZD.cjs');
|
7
|
+
require('./actor-Ba9Z1eNJ.cjs');
|
8
|
+
const require_middleware = require('./middleware-D74TgW2E.cjs');
|
9
|
+
require('./http-Dofes42e.cjs');
|
10
|
+
require('./proof-D0uThUvD.cjs');
|
11
|
+
require('./types-CWgzGaqk.cjs');
|
12
|
+
require('./kv-cache-Dkvbn6rg.cjs');
|
13
|
+
require('./vocab-DFaWWYDn.cjs');
|
14
|
+
|
15
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
@@ -3,23 +3,24 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage,
|
7
|
-
import { getNodeInfo } from "./client-
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import { routeActivity } from "./inbox-
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
18
|
-
import { buildCollectionSynchronizationHeader } from "./collection-
|
19
|
-
import { KvKeyCache } from "./keycache-
|
20
|
-
import { acceptsJsonLd } from "./negotiation-
|
21
|
-
import { createExponentialBackoffPolicy } from "./retry-
|
22
|
-
import { extractInboxes, sendActivity } from "./send-
|
6
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, RouterError, deno_default, getTypeId, lookupObject, lookupWebFinger, traverseCollection } from "./lookup-DQRtjvb1.js";
|
7
|
+
import { getNodeInfo } from "./client-pY7-3icS.js";
|
8
|
+
import { nodeInfoToJson } from "./types-C2XVl6gj.js";
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-CxdLUFS6.js";
|
10
|
+
import { verifyRequest } from "./http-D2kIm9la.js";
|
11
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CIhvSCCr.js";
|
12
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-Dvh7mBvr.js";
|
13
|
+
import { signObject, verifyObject } from "./proof-Dgy35fzc.js";
|
14
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-CrbAy9Oc.js";
|
15
|
+
import { kvCache } from "./kv-cache-DN9pfMBe.js";
|
16
|
+
import { routeActivity } from "./inbox-HjG5peXY.js";
|
17
|
+
import { FederationBuilderImpl } from "./builder-u7usRsT3.js";
|
18
|
+
import { buildCollectionSynchronizationHeader } from "./collection-BzWsN9pB.js";
|
19
|
+
import { KvKeyCache } from "./keycache-bU7COwsh.js";
|
20
|
+
import { acceptsJsonLd } from "./negotiation-C4nFufNk.js";
|
21
|
+
import { createExponentialBackoffPolicy } from "./retry-CfF8Gn4d.js";
|
22
|
+
import { extractInboxes, sendActivity } from "./send-Drp20VO9.js";
|
23
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
23
24
|
import { getLogger, withContext } from "@logtape/logtape";
|
24
25
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
25
26
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -838,7 +839,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
838
839
|
/**
|
839
840
|
* Handles a custom collection request.
|
840
841
|
* @template TItem The type of items in the collection.
|
841
|
-
* @template
|
842
|
+
* @template TParam The parameter names of the requested URL.
|
842
843
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
843
844
|
* @template TContextData The context data to pass to the `TContext`.
|
844
845
|
* @param request The HTTP request.
|
@@ -856,7 +857,7 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
856
857
|
/**
|
857
858
|
* Handles an ordered collection request.
|
858
859
|
* @template TItem The type of items in the collection.
|
859
|
-
* @template
|
860
|
+
* @template TParam The parameter names of the requested URL.
|
860
861
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
861
862
|
* @template TContextData The context data to pass to the `TContext`.
|
862
863
|
* @param request The HTTP request.
|
@@ -876,7 +877,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
876
877
|
* The main flow is on `getCollection`, `dispatch`.
|
877
878
|
*
|
878
879
|
* @template TItem The type of items in the collection.
|
879
|
-
* @template
|
880
|
+
* @template TParam The parameter names of the requested URL.
|
880
881
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
881
882
|
* @template TContextData The context data to pass to the `TContext`.
|
882
883
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
@@ -910,14 +911,14 @@ var CustomCollectionHandler = class {
|
|
910
911
|
#collection = null;
|
911
912
|
/**
|
912
913
|
* Creates a new CustomCollection instance.
|
913
|
-
* @param
|
914
|
-
* @param
|
915
|
-
* @param
|
916
|
-
* @param
|
917
|
-
* @param
|
918
|
-
* @param
|
919
|
-
* @param
|
920
|
-
* @param
|
914
|
+
* @param name The name of the collection.
|
915
|
+
* @param values The parameter values for the collection.
|
916
|
+
* @param context The request context.
|
917
|
+
* @param callbacks The collection callbacks.
|
918
|
+
* @param tracerProvider The tracer provider for telemetry.
|
919
|
+
* @param Collection The Collection constructor.
|
920
|
+
* @param CollectionPage The CollectionPage constructor.
|
921
|
+
* @param filterPredicate Optional filter predicate for items.
|
921
922
|
*/
|
922
923
|
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
923
924
|
this.name = name;
|
@@ -1042,7 +1043,7 @@ var CustomCollectionHandler = class {
|
|
1042
1043
|
/**
|
1043
1044
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
1044
1045
|
* @param params Parameters including cursor and total items.
|
1045
|
-
* @returns
|
1046
|
+
* @returns A function that handles the span operation.
|
1046
1047
|
*/
|
1047
1048
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
1048
1049
|
try {
|
@@ -1063,23 +1064,23 @@ var CustomCollectionHandler = class {
|
|
1063
1064
|
};
|
1064
1065
|
/**
|
1065
1066
|
* Dispatches the collection request to get items.
|
1066
|
-
* @param
|
1067
|
-
* @returns
|
1067
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
1068
|
+
* @returns A promise that resolves to the page items.
|
1068
1069
|
*/
|
1069
1070
|
async dispatch(cursor = null) {
|
1070
1071
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
1071
1072
|
}
|
1072
1073
|
/**
|
1073
1074
|
* Filters the items in the collection.
|
1074
|
-
* @param
|
1075
|
-
* @returns
|
1075
|
+
* @param items The items to filter.
|
1076
|
+
* @returns The filtered items.
|
1076
1077
|
*/
|
1077
1078
|
filterItems(items) {
|
1078
1079
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
1079
1080
|
}
|
1080
1081
|
/**
|
1081
1082
|
* Appends a cursor to the URL if it exists.
|
1082
|
-
* @param
|
1083
|
+
* @param cursor The cursor to append, or null/undefined.
|
1083
1084
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
1084
1085
|
*/
|
1085
1086
|
appendToUrl(cursor) {
|
@@ -1087,8 +1088,7 @@ var CustomCollectionHandler = class {
|
|
1087
1088
|
}
|
1088
1089
|
/**
|
1089
1090
|
* Gets the stored collection or collection page.
|
1090
|
-
* @returns
|
1091
|
-
the collection or collection page.
|
1091
|
+
* @returns A promise that resolves to the collection or collection page.
|
1092
1092
|
*/
|
1093
1093
|
get collection() {
|
1094
1094
|
if (this.#collection === null) this.#collection = this.getCollection();
|
@@ -1096,8 +1096,8 @@ var CustomCollectionHandler = class {
|
|
1096
1096
|
}
|
1097
1097
|
/**
|
1098
1098
|
* Gets the total number of items in the collection.
|
1099
|
-
* @returns
|
1100
|
-
|
1099
|
+
* @returns A promise that resolves to the total items count,
|
1100
|
+
* or null if not available.
|
1101
1101
|
*/
|
1102
1102
|
get totalItems() {
|
1103
1103
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
@@ -1113,8 +1113,8 @@ var CustomCollectionHandler = class {
|
|
1113
1113
|
}
|
1114
1114
|
/**
|
1115
1115
|
* Gets the first cursor for pagination.
|
1116
|
-
* @returns
|
1117
|
-
or null if not available.
|
1116
|
+
* @returns A promise that resolves to the first cursor,
|
1117
|
+
* or null if not available.
|
1118
1118
|
*/
|
1119
1119
|
get firstCursor() {
|
1120
1120
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
@@ -1319,7 +1319,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
1319
1319
|
firstKnock;
|
1320
1320
|
constructor(options) {
|
1321
1321
|
super();
|
1322
|
-
const logger$2 = getLogger(["fedify", "federation"]);
|
1323
1322
|
this.kv = options.kv;
|
1324
1323
|
this.kvPrefixes = {
|
1325
1324
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
@@ -1367,8 +1366,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
1367
1366
|
this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
|
1368
1367
|
this._initializeRouter();
|
1369
1368
|
if (options.allowPrivateAddress || options.userAgent != null) {
|
1370
|
-
if (options.
|
1371
|
-
|
1369
|
+
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set documentLoaderFactory with allowPrivateAddress or userAgent options.");
|
1370
|
+
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set contextLoaderFactory with allowPrivateAddress or userAgent options.");
|
1371
|
+
if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
|
1372
1372
|
}
|
1373
1373
|
const { allowPrivateAddress, userAgent } = options;
|
1374
1374
|
this.allowPrivateAddress = allowPrivateAddress ?? false;
|
@@ -1382,11 +1382,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
1382
1382
|
prefix: this.kvPrefixes.remoteDocument
|
1383
1383
|
});
|
1384
1384
|
});
|
1385
|
-
|
1386
|
-
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set both contextLoader and contextLoaderFactory options at a time; use contextLoaderFactory only.");
|
1387
|
-
this.contextLoaderFactory = () => options.contextLoader;
|
1388
|
-
logger$2.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
|
1389
|
-
} else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
1385
|
+
this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
1390
1386
|
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => getAuthenticatedDocumentLoader(identity, {
|
1391
1387
|
allowPrivateAddress,
|
1392
1388
|
userAgent,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "./transformers-BFT6d7J5.js";
|
6
|
+
import "./lookup-CHkCVZTU.js";
|
7
|
+
import "./actor-DzhunPC_.js";
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-DMk2Mdn9.js";
|
9
|
+
import "./http-CUVx-vzb.js";
|
10
|
+
import "./proof-fqzaMJ4g.js";
|
11
|
+
import "./types-BtUjyi5y.js";
|
12
|
+
import "./kv-cache-CGXcDejL.js";
|
13
|
+
import "./vocab-BnR3nIU9.js";
|
14
|
+
|
15
|
+
export { FederationImpl };
|
@@ -4,21 +4,20 @@
|
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
6
|
const require_transformers = require('./transformers-CoBS-oFG.cjs');
|
7
|
-
const
|
8
|
-
const require_actor = require('./actor-
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const require_authdocloader = require('./authdocloader-CQMPmpaO.cjs');
|
15
|
-
const require_vocab = require('./vocab-C5Y-0fGj.cjs');
|
7
|
+
const require_lookup = require('./lookup-CfFkONZD.cjs');
|
8
|
+
const require_actor = require('./actor-Ba9Z1eNJ.cjs');
|
9
|
+
const require_http = require('./http-Dofes42e.cjs');
|
10
|
+
const require_proof = require('./proof-D0uThUvD.cjs');
|
11
|
+
const require_types = require('./types-CWgzGaqk.cjs');
|
12
|
+
const require_kv_cache = require('./kv-cache-Dkvbn6rg.cjs');
|
13
|
+
const require_vocab = require('./vocab-DFaWWYDn.cjs');
|
16
14
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
17
15
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
18
|
-
const
|
16
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
19
17
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
20
18
|
const uri_template_router = require_chunk.__toESM(require("uri-template-router"));
|
21
19
|
const url_template = require_chunk.__toESM(require("url-template"));
|
20
|
+
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
22
21
|
const __opentelemetry_semantic_conventions = require_chunk.__toESM(require("@opentelemetry/semantic-conventions"));
|
23
22
|
const node_url = require_chunk.__toESM(require("node:url"));
|
24
23
|
|
@@ -143,7 +142,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
143
142
|
return "enqueued";
|
144
143
|
}
|
145
144
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
146
|
-
const tracer = tracerProvider.getTracer(
|
145
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
147
146
|
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: __opentelemetry_api.SpanKind.INTERNAL }, async (span$1) => {
|
148
147
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
149
148
|
if (dispatched == null) {
|
@@ -340,7 +339,7 @@ var FederationBuilderImpl = class {
|
|
340
339
|
this.collectionTypeIds = {};
|
341
340
|
}
|
342
341
|
async build(options) {
|
343
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
342
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-CFJgmUMW.cjs"));
|
344
343
|
const f = new FederationImpl$1(options);
|
345
344
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
346
345
|
f.router = this.router.clone();
|
@@ -366,7 +365,7 @@ var FederationBuilderImpl = class {
|
|
366
365
|
return f;
|
367
366
|
}
|
368
367
|
_getTracer() {
|
369
|
-
return __opentelemetry_api.trace.getTracer(
|
368
|
+
return __opentelemetry_api.trace.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
370
369
|
}
|
371
370
|
setActorDispatcher(path, dispatcher) {
|
372
371
|
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
@@ -793,11 +792,11 @@ var FederationBuilderImpl = class {
|
|
793
792
|
};
|
794
793
|
return setters;
|
795
794
|
}
|
796
|
-
setCollectionDispatcher(name,
|
797
|
-
return this.#setCustomCollectionDispatcher(name, "collection",
|
795
|
+
setCollectionDispatcher(name, itemType, path, dispatcher) {
|
796
|
+
return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
|
798
797
|
}
|
799
|
-
setOrderedCollectionDispatcher(name,
|
800
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection",
|
798
|
+
setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
|
799
|
+
return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
|
801
800
|
}
|
802
801
|
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
803
802
|
const strName = String(name);
|
@@ -1113,7 +1112,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
1113
1112
|
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
1114
1113
|
const spanName = name.trim().replace(/\s+/g, "_");
|
1115
1114
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
1116
|
-
const tracer = tracerProvider.getTracer(
|
1115
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
1117
1116
|
const url = new URL(request.url);
|
1118
1117
|
const cursor = url.searchParams.get("cursor");
|
1119
1118
|
if (collectionCallbacks == null) return await onNotFound(request);
|
@@ -1290,7 +1289,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
1290
1289
|
*/
|
1291
1290
|
async function handleInbox(request, options) {
|
1292
1291
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
1293
|
-
const tracer = tracerProvider.getTracer(
|
1292
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
1294
1293
|
return await tracer.startActiveSpan("activitypub.inbox", {
|
1295
1294
|
kind: options.queue == null ? __opentelemetry_api.SpanKind.SERVER : __opentelemetry_api.SpanKind.PRODUCER,
|
1296
1295
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
@@ -1551,7 +1550,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
1551
1550
|
/**
|
1552
1551
|
* Handles a custom collection request.
|
1553
1552
|
* @template TItem The type of items in the collection.
|
1554
|
-
* @template
|
1553
|
+
* @template TParam The parameter names of the requested URL.
|
1555
1554
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
1556
1555
|
* @template TContextData The context data to pass to the `TContext`.
|
1557
1556
|
* @param request The HTTP request.
|
@@ -1569,7 +1568,7 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
1569
1568
|
/**
|
1570
1569
|
* Handles an ordered collection request.
|
1571
1570
|
* @template TItem The type of items in the collection.
|
1572
|
-
* @template
|
1571
|
+
* @template TParam The parameter names of the requested URL.
|
1573
1572
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
1574
1573
|
* @template TContextData The context data to pass to the `TContext`.
|
1575
1574
|
* @param request The HTTP request.
|
@@ -1589,7 +1588,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
1589
1588
|
* The main flow is on `getCollection`, `dispatch`.
|
1590
1589
|
*
|
1591
1590
|
* @template TItem The type of items in the collection.
|
1592
|
-
* @template
|
1591
|
+
* @template TParam The parameter names of the requested URL.
|
1593
1592
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
1594
1593
|
* @template TContextData The context data to pass to the `TContext`.
|
1595
1594
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
@@ -1623,14 +1622,14 @@ var CustomCollectionHandler = class {
|
|
1623
1622
|
#collection = null;
|
1624
1623
|
/**
|
1625
1624
|
* Creates a new CustomCollection instance.
|
1626
|
-
* @param
|
1627
|
-
* @param
|
1628
|
-
* @param
|
1629
|
-
* @param
|
1630
|
-
* @param
|
1631
|
-
* @param
|
1632
|
-
* @param
|
1633
|
-
* @param
|
1625
|
+
* @param name The name of the collection.
|
1626
|
+
* @param values The parameter values for the collection.
|
1627
|
+
* @param context The request context.
|
1628
|
+
* @param callbacks The collection callbacks.
|
1629
|
+
* @param tracerProvider The tracer provider for telemetry.
|
1630
|
+
* @param Collection The Collection constructor.
|
1631
|
+
* @param CollectionPage The CollectionPage constructor.
|
1632
|
+
* @param filterPredicate Optional filter predicate for items.
|
1634
1633
|
*/
|
1635
1634
|
constructor(name, values, context$2, callbacks, tracerProvider = __opentelemetry_api.trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
1636
1635
|
this.name = name;
|
@@ -1642,7 +1641,7 @@ var CustomCollectionHandler = class {
|
|
1642
1641
|
this.CollectionPage = CollectionPage$1;
|
1643
1642
|
this.filterPredicate = filterPredicate;
|
1644
1643
|
this.name = this.name.trim().replace(/\s+/g, "_");
|
1645
|
-
this.#tracer = this.tracerProvider.getTracer(
|
1644
|
+
this.#tracer = this.tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
1646
1645
|
this.#id = new URL(this.context.url);
|
1647
1646
|
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
1648
1647
|
}
|
@@ -1755,7 +1754,7 @@ var CustomCollectionHandler = class {
|
|
1755
1754
|
/**
|
1756
1755
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
1757
1756
|
* @param params Parameters including cursor and total items.
|
1758
|
-
* @returns
|
1757
|
+
* @returns A function that handles the span operation.
|
1759
1758
|
*/
|
1760
1759
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
1761
1760
|
try {
|
@@ -1776,23 +1775,23 @@ var CustomCollectionHandler = class {
|
|
1776
1775
|
};
|
1777
1776
|
/**
|
1778
1777
|
* Dispatches the collection request to get items.
|
1779
|
-
* @param
|
1780
|
-
* @returns
|
1778
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
1779
|
+
* @returns A promise that resolves to the page items.
|
1781
1780
|
*/
|
1782
1781
|
async dispatch(cursor = null) {
|
1783
1782
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
1784
1783
|
}
|
1785
1784
|
/**
|
1786
1785
|
* Filters the items in the collection.
|
1787
|
-
* @param
|
1788
|
-
* @returns
|
1786
|
+
* @param items The items to filter.
|
1787
|
+
* @returns The filtered items.
|
1789
1788
|
*/
|
1790
1789
|
filterItems(items) {
|
1791
1790
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
1792
1791
|
}
|
1793
1792
|
/**
|
1794
1793
|
* Appends a cursor to the URL if it exists.
|
1795
|
-
* @param
|
1794
|
+
* @param cursor The cursor to append, or null/undefined.
|
1796
1795
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
1797
1796
|
*/
|
1798
1797
|
appendToUrl(cursor) {
|
@@ -1800,8 +1799,7 @@ var CustomCollectionHandler = class {
|
|
1800
1799
|
}
|
1801
1800
|
/**
|
1802
1801
|
* Gets the stored collection or collection page.
|
1803
|
-
* @returns
|
1804
|
-
the collection or collection page.
|
1802
|
+
* @returns A promise that resolves to the collection or collection page.
|
1805
1803
|
*/
|
1806
1804
|
get collection() {
|
1807
1805
|
if (this.#collection === null) this.#collection = this.getCollection();
|
@@ -1809,8 +1807,8 @@ var CustomCollectionHandler = class {
|
|
1809
1807
|
}
|
1810
1808
|
/**
|
1811
1809
|
* Gets the total number of items in the collection.
|
1812
|
-
* @returns
|
1813
|
-
|
1810
|
+
* @returns A promise that resolves to the total items count,
|
1811
|
+
* or null if not available.
|
1814
1812
|
*/
|
1815
1813
|
get totalItems() {
|
1816
1814
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
@@ -1826,8 +1824,8 @@ var CustomCollectionHandler = class {
|
|
1826
1824
|
}
|
1827
1825
|
/**
|
1828
1826
|
* Gets the first cursor for pagination.
|
1829
|
-
* @returns
|
1830
|
-
or null if not available.
|
1827
|
+
* @returns A promise that resolves to the first cursor,
|
1828
|
+
* or null if not available.
|
1831
1829
|
*/
|
1832
1830
|
get firstCursor() {
|
1833
1831
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
@@ -2234,7 +2232,7 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
2234
2232
|
*/
|
2235
2233
|
function sendActivity(options) {
|
2236
2234
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
2237
|
-
const tracer = tracerProvider.getTracer(
|
2235
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
2238
2236
|
return tracer.startActiveSpan("activitypub.send_activity", {
|
2239
2237
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
2240
2238
|
attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
|
@@ -2351,7 +2349,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2351
2349
|
firstKnock;
|
2352
2350
|
constructor(options) {
|
2353
2351
|
super();
|
2354
|
-
const logger$1 = (0, __logtape_logtape.getLogger)(["fedify", "federation"]);
|
2355
2352
|
this.kv = options.kv;
|
2356
2353
|
this.kvPrefixes = {
|
2357
2354
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
@@ -2399,14 +2396,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2399
2396
|
this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
|
2400
2397
|
this._initializeRouter();
|
2401
2398
|
if (options.allowPrivateAddress || options.userAgent != null) {
|
2402
|
-
if (options.
|
2403
|
-
|
2399
|
+
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set documentLoaderFactory with allowPrivateAddress or userAgent options.");
|
2400
|
+
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set contextLoaderFactory with allowPrivateAddress or userAgent options.");
|
2401
|
+
if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
|
2404
2402
|
}
|
2405
2403
|
const { allowPrivateAddress, userAgent } = options;
|
2406
2404
|
this.allowPrivateAddress = allowPrivateAddress ?? false;
|
2407
2405
|
this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
2408
|
-
return
|
2409
|
-
loader:
|
2406
|
+
return require_kv_cache.kvCache({
|
2407
|
+
loader: (0, __fedify_vocab_runtime.getDocumentLoader)({
|
2410
2408
|
allowPrivateAddress: opts?.allowPrivateAddress ?? allowPrivateAddress,
|
2411
2409
|
userAgent: opts?.userAgent ?? userAgent
|
2412
2410
|
}),
|
@@ -2414,12 +2412,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2414
2412
|
prefix: this.kvPrefixes.remoteDocument
|
2415
2413
|
});
|
2416
2414
|
});
|
2417
|
-
|
2418
|
-
|
2419
|
-
this.contextLoaderFactory = () => options.contextLoader;
|
2420
|
-
logger$1.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
|
2421
|
-
} else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
2422
|
-
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_authdocloader.getAuthenticatedDocumentLoader(identity, {
|
2415
|
+
this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
2416
|
+
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_kv_cache.getAuthenticatedDocumentLoader(identity, {
|
2423
2417
|
allowPrivateAddress,
|
2424
2418
|
userAgent,
|
2425
2419
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
@@ -2440,7 +2434,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2440
2434
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
2441
2435
|
}
|
2442
2436
|
_getTracer() {
|
2443
|
-
return this.tracerProvider.getTracer(
|
2437
|
+
return this.tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
2444
2438
|
}
|
2445
2439
|
async _startQueueInternal(ctxData, signal, queue) {
|
2446
2440
|
if (this.inboxQueue == null && this.outboxQueue == null) return;
|
@@ -2538,7 +2532,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2538
2532
|
});
|
2539
2533
|
const keys = await Promise.all(message.keys.map(async ({ keyId, privateKey }) => ({
|
2540
2534
|
keyId: new URL(keyId),
|
2541
|
-
privateKey: await
|
2535
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
2542
2536
|
})));
|
2543
2537
|
const activity = await require_actor.Activity.fromJsonLd(message.activity, {
|
2544
2538
|
contextLoader: this.contextLoaderFactory({
|
@@ -2579,7 +2573,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2579
2573
|
for (const { keyId, privateKey } of message.keys) {
|
2580
2574
|
const pair = {
|
2581
2575
|
keyId: new URL(keyId),
|
2582
|
-
privateKey: await
|
2576
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
2583
2577
|
};
|
2584
2578
|
if (rsaKeyPair == null && pair.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKeyPair = pair;
|
2585
2579
|
keys.push(pair);
|
@@ -2814,7 +2808,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2814
2808
|
let proofCreated = false;
|
2815
2809
|
let rsaKey = null;
|
2816
2810
|
for (const { keyId, privateKey } of keys) {
|
2817
|
-
|
2811
|
+
require_http.validateCryptoKey(privateKey, "private");
|
2818
2812
|
if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
2819
2813
|
rsaKey = {
|
2820
2814
|
keyId,
|
@@ -2882,7 +2876,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2882
2876
|
});
|
2883
2877
|
const keyJwkPairs = [];
|
2884
2878
|
for (const { keyId, privateKey } of keys) {
|
2885
|
-
const privateKeyJwk = await
|
2879
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
2886
2880
|
keyJwkPairs.push({
|
2887
2881
|
keyId: keyId.href,
|
2888
2882
|
privateKey: privateKeyJwk
|
@@ -3582,7 +3576,7 @@ var ContextImpl = class ContextImpl {
|
|
3582
3576
|
});
|
3583
3577
|
}
|
3584
3578
|
sendActivity(sender, recipients, activity, options = {}) {
|
3585
|
-
const tracer = this.tracerProvider.getTracer(
|
3579
|
+
const tracer = this.tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
3586
3580
|
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
3587
3581
|
kind: this.federation.outboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
3588
3582
|
attributes: {
|
@@ -3639,7 +3633,7 @@ var ContextImpl = class ContextImpl {
|
|
3639
3633
|
keys = sender;
|
3640
3634
|
} else keys = [sender];
|
3641
3635
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
3642
|
-
for (const { privateKey } of keys)
|
3636
|
+
for (const { privateKey } of keys) require_http.validateCryptoKey(privateKey, "private");
|
3643
3637
|
const opts = { context: this };
|
3644
3638
|
let expandedRecipients;
|
3645
3639
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
@@ -3680,7 +3674,7 @@ var ContextImpl = class ContextImpl {
|
|
3680
3674
|
}
|
3681
3675
|
const keyJwkPairs = await Promise.all(keys.map(async ({ keyId, privateKey }) => ({
|
3682
3676
|
keyId: keyId.href,
|
3683
|
-
privateKey: await
|
3677
|
+
privateKey: await require_http.exportJwk(privateKey)
|
3684
3678
|
})));
|
3685
3679
|
const carrier = {};
|
3686
3680
|
__opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
|
@@ -3728,7 +3722,7 @@ var ContextImpl = class ContextImpl {
|
|
3728
3722
|
}
|
3729
3723
|
routeActivity(recipient, activity, options = {}) {
|
3730
3724
|
const tracerProvider = this.tracerProvider ?? this.tracerProvider;
|
3731
|
-
const tracer = tracerProvider.getTracer(
|
3725
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
3732
3726
|
return tracer.startActiveSpan("activitypub.inbox", {
|
3733
3727
|
kind: this.federation.inboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.INTERNAL : __opentelemetry_api.SpanKind.PRODUCER,
|
3734
3728
|
attributes: { "activitypub.activity.type": require_actor.getTypeId(activity).href }
|
@@ -3946,7 +3940,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
3946
3940
|
});
|
3947
3941
|
}
|
3948
3942
|
forwardActivity(forwarder, recipients, options) {
|
3949
|
-
const tracer = this.tracerProvider.getTracer(
|
3943
|
+
const tracer = this.tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
3950
3944
|
return tracer.startActiveSpan("activitypub.outbox", {
|
3951
3945
|
kind: this.federation.outboxQueue == null || options?.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
3952
3946
|
attributes: { "activitypub.activity.type": this.activityType }
|
@@ -4047,7 +4041,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
4047
4041
|
});
|
4048
4042
|
const keyJwkPairs = [];
|
4049
4043
|
for (const { keyId, privateKey } of keys) {
|
4050
|
-
const privateKeyJwk = await
|
4044
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
4051
4045
|
keyJwkPairs.push({
|
4052
4046
|
keyId: keyId.href,
|
4053
4047
|
privateKey: privateKeyJwk
|