@fedify/fedify 2.0.0-pr.445.1694 → 2.0.0-pr.451.1730
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/{actor-T6RyhRgk.d.ts → actor-Cd2CREO0.d.ts} +2 -2
- package/dist/{actor-D8gCwLzv.js → actor-Cg8ZhoVF.js} +1 -1
- package/dist/{actor-CwZ2m5rG.cjs → actor-D020hlx3.cjs} +922 -1451
- package/dist/{actor-D6K058Tb.d.cts → actor-DDhZuMGl.d.cts} +2 -2
- package/dist/{actor-DoMcqXsW.js → actor-DPD6Gbdn.js} +190 -677
- 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-1_skw-d2.js → builder-Dn87hy75.js} +7 -8
- package/dist/{client-bgSdkFa2.d.ts → client-Bkaw0_PR.d.ts} +1 -1
- package/dist/{client-CegPX0Rn.d.cts → client-Cle5j1T1.d.cts} +1 -1
- package/dist/{client-D5CBsPrc.js → client-D6-5okV1.js} +1 -1
- package/dist/compat/mod.d.cts +11 -11
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-DiqjMRef.d.cts → context-BOYzcFSe.d.cts} +130 -97
- package/dist/{context-DBKpNBnc.d.ts → context-DqFifMwj.d.ts} +131 -98
- package/dist/{authdocloader-DYTNpaMA.js → docloader-B2BFBGqv.js} +18 -8
- package/dist/{esm-Dl5T1RNE.js → esm-CU0Dnk7T.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 +26 -27
- package/dist/federation/mod.cjs +10 -11
- package/dist/federation/mod.d.cts +11 -11
- package/dist/federation/mod.d.ts +13 -13
- package/dist/federation/mod.js +10 -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-D-e6AFwR.d.cts → http-B6SKO6NJ.d.cts} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BE7aFuqn.d.ts} +2 -2
- package/dist/{http-CAusBl_3.cjs → http-DMsjudj8.cjs} +289 -9
- package/dist/{http-CuS-d4U0.js → http-DN0v2zoF.js} +2 -2
- package/dist/{http-C_Qc2neP.js → http-DcDb8r1W.js} +256 -6
- package/dist/{inbox-IETv_Qez.js → inbox-CgGy7Hzc.js} +1 -1
- package/dist/{key-DnqhSgAv.js → key-jSvnymAk.js} +3 -2
- package/dist/{keycache-CSBkusP8.js → keycache-IVLjlAK9.js} +1 -1
- package/dist/{keys-D3_MDK7n.js → keys-BKM2Mqu2.js} +2 -1
- package/dist/{docloader-CYnQRIXv.cjs → kv-cache-BHIupktM.cjs} +69 -651
- package/dist/kv-cache-DNvS-egZ.js +4236 -0
- package/dist/{docloader-Czl3xV10.js → kv-cache-ydIs4Ul6.js} +68 -596
- package/dist/{ld-Isot0tiW.js → ld-CcsryBo0.js} +3 -2
- package/dist/{lookup-Dhm78GlK.js → lookup-BV3A9Zbc.js} +63 -2
- package/dist/{type-DaUr3Il7.js → lookup-BbEekiru.js} +588 -5303
- package/dist/{lookup-D6dro5Au.cjs → lookup-CMAGfQ1Q.cjs} +78 -5
- package/dist/{middleware-BuHr2fzh.js → middleware-D-vPitR-.js} +37 -38
- package/dist/{middleware-DQYscW90.js → middleware-Dm8sXYUr.js} +40 -40
- package/dist/middleware-DzA970CF.js +16 -0
- package/dist/middleware-VpoC5jyA.js +26 -0
- package/dist/middleware-W_-inBoE.cjs +16 -0
- package/dist/{middleware-Dgmdgrvb.cjs → middleware-ekn2KaOw.cjs} +57 -58
- package/dist/{mod-CxkWO3Mg.d.cts → mod--K7l84wp.d.cts} +3 -2
- package/dist/{mod-DBzN0aCM.d.ts → mod-CB80AlIA.d.ts} +1 -1
- package/dist/mod-CLKu6Uo_.d.cts +107 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-COlOrmr9.d.cts} +3 -3
- package/dist/{mod-DlU8ISoa.d.ts → mod-CRENK2dd.d.ts} +3 -2
- package/dist/{mod-D_y2y32N.d.ts → mod-CaWbCg0N.d.ts} +2 -2
- package/dist/mod-Cm97bAiT.d.ts +109 -0
- package/dist/{mod-Bpb5QLaZ.d.cts → mod-D9XZsft2.d.cts} +2 -2
- package/dist/{mod-BhUKmBJD.d.ts → mod-DLIidI_j.d.ts} +3 -3
- package/dist/{mod-jQ4OODsl.d.cts → mod-DuclhZjh.d.cts} +1 -1
- package/dist/mod.cjs +21 -32
- package/dist/mod.d.cts +14 -14
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +15 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +3 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +3 -4
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-hd9lvQcP.d.ts → owner-CktUdA0h.d.ts} +3 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-dkg5OpSC.d.cts} +3 -3
- package/dist/{owner-ChSL4aJ7.js → owner-n5c_oZ_M.js} +3 -2
- package/dist/{proof-BiSCuwyA.js → proof-CLwByIT1.js} +5 -4
- package/dist/{proof-ONNmhInb.cjs → proof-CZfrp13P.cjs} +17 -16
- package/dist/{proof-x3IBewan.js → proof-CsFR7fiS.js} +2 -2
- package/dist/request-BbHkedIU.d.cts +35 -0
- package/dist/request-DKGQaofB.js +184 -0
- package/dist/request-U1t6zZtk.d.ts +39 -0
- package/dist/request-XHWUW2bi.cjs +208 -0
- package/dist/{send-D5fjmUEj.js → send-eW9JIzQV.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 +10 -11
- package/dist/sig/mod.d.cts +6 -7
- package/dist/sig/mod.d.ts +6 -7
- package/dist/sig/mod.js +6 -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 +122 -148
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-tWr1VQxx.js → testing-ClYSmXdi.js} +1 -2
- package/dist/{types-D2Nyz0tR.cjs → types-BT0xc4-R.cjs} +3 -3
- package/dist/{types-DQuSDtDg.js → types-DaPoJTSc.js} +1 -1
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +208 -0
- package/dist/utils/mod.cjs +14 -0
- package/dist/utils/mod.d.cts +6 -0
- package/dist/utils/mod.d.ts +8 -0
- package/dist/utils/mod.js +12 -0
- package/dist/utils/request.test.js +48 -0
- package/dist/utils/url.test.js +41 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.d.cts +4 -5
- package/dist/vocab/mod.d.ts +4 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-Dd4VMrr0.cjs → vocab-CxTuoEVd.cjs} +6 -5
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-DCBw44JZ.d.cts} +2 -21
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-ivDKb439.d.ts} +2 -21
- package/dist/{vocab-w--qk7HF.js → vocab-yFT-fQBj.js} +4 -3
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +3 -3
- package/dist/webfinger/mod.d.cts +2 -3
- package/dist/webfinger/mod.d.ts +2 -3
- package/dist/webfinger/mod.js +3 -3
- package/dist/x/cfworkers.d.cts +1 -1
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -10
- package/dist/x/hono.d.ts +11 -11
- package/dist/x/sveltekit.d.cts +10 -10
- package/dist/x/sveltekit.d.ts +11 -11
- package/package.json +16 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Cv_qEn1G.js +0 -52
- package/dist/authdocloader-bsmVF6eO.cjs +0 -58
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-BNJQQm3h.js +0 -260
- package/dist/key-C_ruQbbl.js +0 -10
- package/dist/key-DIMJMxf4.cjs +0 -10
- package/dist/key-DpFjiItf.js +0 -10
- package/dist/key-DuXv64tg.cjs +0 -290
- package/dist/lookup-CbtuFbtg.js +0 -331
- package/dist/middleware-BpR6186a.js +0 -26
- package/dist/middleware-DDMxdtWM.cjs +0 -17
- package/dist/middleware-T-knSMwl.js +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.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.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-DOuZpcAw.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-pZJsapBn.js} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-BMKIFXNW.d.cts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-Dt06smFt.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-B-ZQqbGe.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-CjsiSl7_.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CPRJk4mZ.d.ts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-B0UefMXO.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-ByTd7HpT.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DE_NC_VQ.cjs} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-Dx59zAgn.js} +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/{runtime/key.test.d.ts → utils/request.test.d.ts} +0 -0
- /package/dist/{runtime → utils}/url.test.d.ts +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-B6yXfxAQ.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-BXMGcmqK.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-C949bxcD.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-qG8R5jc3.js} +0 -0
@@ -1,16 +1,17 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import { MessageQueue } from "./mq-
|
3
|
+
import { GetUserAgentOptions } from "./request-U1t6zZtk.js";
|
4
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-Bkaw0_PR.js";
|
5
|
+
import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-ivDKb439.js";
|
6
|
+
import { Actor, Recipient } from "./actor-Cd2CREO0.js";
|
7
|
+
import { HttpMessageSignaturesSpec } from "./http-BE7aFuqn.js";
|
8
|
+
import { GetKeyOwnerOptions } from "./owner-CktUdA0h.js";
|
9
|
+
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-CRENK2dd.js";
|
10
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-CB80AlIA.js";
|
11
|
+
import { KvKey, KvStore } from "./kv-Dt06smFt.js";
|
12
|
+
import { MessageQueue } from "./mq-CPRJk4mZ.js";
|
13
13
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
14
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory } from "@fedify/vocab-runtime";
|
14
15
|
|
15
16
|
//#region src/compat/types.d.ts
|
16
17
|
/**
|
@@ -283,7 +284,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
283
284
|
* the entire collection without pagination.
|
284
285
|
* @since 1.8.0
|
285
286
|
*/
|
286
|
-
type CustomCollectionDispatcher<TItem,
|
287
|
+
type CustomCollectionDispatcher<TItem, TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>, cursor: string | null) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>;
|
287
288
|
/**
|
288
289
|
* A callback that counts the number of items in a custom collection.
|
289
290
|
*
|
@@ -293,7 +294,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
293
294
|
* @param values The parameters of the requested URL.
|
294
295
|
* @since 1.8.0
|
295
296
|
*/
|
296
|
-
type CustomCollectionCounter<
|
297
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
297
298
|
/**
|
298
299
|
* A callback that returns a cursor for a custom collection.
|
299
300
|
*
|
@@ -306,10 +307,9 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
306
307
|
* @param values The parameters of the requested URL.
|
307
308
|
* @since 1.8.0
|
308
309
|
*/
|
309
|
-
type CustomCollectionCursor<
|
310
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
310
311
|
//#endregion
|
311
312
|
//#region src/federation/handler.d.ts
|
312
|
-
|
313
313
|
/**
|
314
314
|
* Options for the {@link respondWithObject} and
|
315
315
|
* {@link respondWithObjectIfAcceptable} functions.
|
@@ -704,7 +704,7 @@ interface Federatable<TContextData> {
|
|
704
704
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
705
705
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
706
706
|
*/
|
707
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
707
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
708
708
|
/**
|
709
709
|
* Registers an object dispatcher.
|
710
710
|
*
|
@@ -768,7 +768,7 @@ interface Federatable<TContextData> {
|
|
768
768
|
*/
|
769
769
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
770
770
|
typeId: URL;
|
771
|
-
}, path: `${string}
|
771
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
772
772
|
/**
|
773
773
|
* Registers an object dispatcher.
|
774
774
|
*
|
@@ -784,7 +784,7 @@ interface Federatable<TContextData> {
|
|
784
784
|
*/
|
785
785
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
786
786
|
typeId: URL;
|
787
|
-
}, path: `${string}
|
787
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
788
788
|
/**
|
789
789
|
* Registers an object dispatcher.
|
790
790
|
*
|
@@ -800,7 +800,7 @@ interface Federatable<TContextData> {
|
|
800
800
|
*/
|
801
801
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
802
802
|
typeId: URL;
|
803
|
-
}, path: `${string}
|
803
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
804
804
|
/**
|
805
805
|
* Registers an inbox dispatcher.
|
806
806
|
*
|
@@ -812,7 +812,7 @@ interface Federatable<TContextData> {
|
|
812
812
|
* @param dispatcher An inbox dispatcher callback to register.
|
813
813
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
814
814
|
*/
|
815
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
815
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
816
816
|
/**
|
817
817
|
* Registers an outbox dispatcher.
|
818
818
|
*
|
@@ -836,7 +836,7 @@ interface Federatable<TContextData> {
|
|
836
836
|
* @param dispatcher An outbox dispatcher callback to register.
|
837
837
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
838
838
|
*/
|
839
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
839
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
840
840
|
/**
|
841
841
|
* Registers a following collection dispatcher.
|
842
842
|
* @param path The URI path pattern for the following collection. The syntax
|
@@ -848,7 +848,7 @@ interface Federatable<TContextData> {
|
|
848
848
|
* callbacks.
|
849
849
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
850
850
|
*/
|
851
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
851
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
852
852
|
/**
|
853
853
|
* Registers a followers collection dispatcher.
|
854
854
|
* @param path The URI path pattern for the followers collection. The syntax
|
@@ -860,7 +860,7 @@ interface Federatable<TContextData> {
|
|
860
860
|
* callbacks.
|
861
861
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
862
862
|
*/
|
863
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
863
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
864
864
|
/**
|
865
865
|
* Registers a liked collection dispatcher.
|
866
866
|
* @param path The URI path pattern for the liked collection. The syntax
|
@@ -872,7 +872,7 @@ interface Federatable<TContextData> {
|
|
872
872
|
* callbacks.
|
873
873
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
874
874
|
*/
|
875
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
875
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
876
876
|
/**
|
877
877
|
* Registers a featured collection dispatcher.
|
878
878
|
* @param path The URI path pattern for the featured collection. The syntax
|
@@ -884,7 +884,7 @@ interface Federatable<TContextData> {
|
|
884
884
|
* callbacks.
|
885
885
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
886
886
|
*/
|
887
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
887
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
888
888
|
/**
|
889
889
|
* Registers a featured tags collection dispatcher.
|
890
890
|
* @param path The URI path pattern for the featured tags collection.
|
@@ -896,7 +896,7 @@ interface Federatable<TContextData> {
|
|
896
896
|
* callbacks.
|
897
897
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
898
898
|
*/
|
899
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
899
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
900
900
|
/**
|
901
901
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
902
902
|
*
|
@@ -926,7 +926,41 @@ interface Federatable<TContextData> {
|
|
926
926
|
* @returns An object to register inbox listeners.
|
927
927
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
928
928
|
*/
|
929
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
929
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
930
|
+
/**
|
931
|
+
* Registers a collection of objects dispatcher.
|
932
|
+
*
|
933
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
934
|
+
* @template TObject The type of objects to dispatch.
|
935
|
+
* @template TParam The parameter names of the requested URL.
|
936
|
+
* @param name A unique name for the collection dispatcher.
|
937
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
938
|
+
* @param path The URI path pattern for the collection dispatcher.
|
939
|
+
* The syntax is based on URI Template
|
940
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
941
|
+
* The path must have one or more variables.
|
942
|
+
* @param dispatcher A collection dispatcher callback to register.
|
943
|
+
*/
|
944
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
945
|
+
typeId: URL;
|
946
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
947
|
+
/**
|
948
|
+
* Registers a collection of objects dispatcher.
|
949
|
+
*
|
950
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
951
|
+
* @template TObject The type of objects to dispatch.
|
952
|
+
* @template TParam The parameter names of the requested URL.
|
953
|
+
* @param name A unique name for the collection dispatcher.
|
954
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
955
|
+
* @param path The URI path pattern for the collection dispatcher.
|
956
|
+
* The syntax is based on URI Template
|
957
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
958
|
+
* The path must have one or more variables.
|
959
|
+
* @param dispatcher A collection dispatcher callback to register.
|
960
|
+
*/
|
961
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
962
|
+
typeId: URL;
|
963
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
930
964
|
/**
|
931
965
|
* Registers a collection of objects dispatcher.
|
932
966
|
*
|
@@ -941,7 +975,43 @@ interface Federatable<TContextData> {
|
|
941
975
|
* The path must have one or more variables.
|
942
976
|
* @param dispatcher A collection dispatcher callback to register.
|
943
977
|
*/
|
944
|
-
setCollectionDispatcher<TObject extends Object$1,
|
978
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
979
|
+
typeId: URL;
|
980
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
981
|
+
/**
|
982
|
+
* Registers an ordered collection of objects dispatcher.
|
983
|
+
*
|
984
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
985
|
+
* @template TObject The type of objects to dispatch.
|
986
|
+
* @template TParam The parameter names of the requested URL.
|
987
|
+
* @param name A unique name for the collection dispatcher.
|
988
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
989
|
+
* @param path The URI path pattern for the collection dispatcher.
|
990
|
+
* The syntax is based on URI Template
|
991
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
992
|
+
* The path must have one or more variables.
|
993
|
+
* @param dispatcher A collection dispatcher callback to register.
|
994
|
+
*/
|
995
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
996
|
+
typeId: URL;
|
997
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
998
|
+
/**
|
999
|
+
* Registers an ordered collection of objects dispatcher.
|
1000
|
+
*
|
1001
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
1002
|
+
* @template TObject The type of objects to dispatch.
|
1003
|
+
* @template TParam The parameter names of the requested URL.
|
1004
|
+
* @param name A unique name for the collection dispatcher.
|
1005
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
1006
|
+
* @param path The URI path pattern for the collection dispatcher.
|
1007
|
+
* The syntax is based on URI Template
|
1008
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
1009
|
+
* The path must have one or more variables.
|
1010
|
+
* @param dispatcher A collection dispatcher callback to register.
|
1011
|
+
*/
|
1012
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
1013
|
+
typeId: URL;
|
1014
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
945
1015
|
/**
|
946
1016
|
* Registers an ordered collection of objects dispatcher.
|
947
1017
|
*
|
@@ -956,7 +1026,9 @@ interface Federatable<TContextData> {
|
|
956
1026
|
* The path must have one or more variables.
|
957
1027
|
* @param dispatcher A collection dispatcher callback to register.
|
958
1028
|
*/
|
959
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
1029
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
1030
|
+
typeId: URL;
|
1031
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
960
1032
|
}
|
961
1033
|
/**
|
962
1034
|
* An object that registers federation-related business logic and dispatches
|
@@ -1428,38 +1500,38 @@ interface FederationFetchOptions<TContextData> {
|
|
1428
1500
|
/**
|
1429
1501
|
* Additional settings for a custom collection dispatcher.
|
1430
1502
|
*
|
1431
|
-
* @template
|
1503
|
+
* @template TParam The type of the parameters in the URL path.
|
1432
1504
|
* @template TContext The type of the context. {@link Context} or
|
1433
1505
|
* {@link RequestContext}.
|
1434
1506
|
* @template TContextData The context data to pass to the {@link Context}.
|
1435
1507
|
* @template TFilter The type of filter for the collection.
|
1436
1508
|
*/
|
1437
|
-
interface CustomCollectionCallbackSetters<
|
1509
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
1438
1510
|
/**
|
1439
1511
|
* Sets the counter for the custom collection.
|
1440
1512
|
* @param counter A callback that returns the number of items in the custom collection.
|
1441
1513
|
* @returns The setters object so that settings can be chained.
|
1442
1514
|
*/
|
1443
|
-
setCounter(counter: CustomCollectionCounter<
|
1515
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1444
1516
|
/**
|
1445
1517
|
* Sets the first cursor for the custom collection.
|
1446
1518
|
* @param cursor The cursor for the first item in the custom collection.
|
1447
1519
|
* @returns The setters object so that settings can be chained.
|
1448
1520
|
*/
|
1449
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
1521
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1450
1522
|
/**
|
1451
1523
|
* Sets the last cursor for the custom collection.
|
1452
1524
|
* @param cursor The cursor for the last item in the custom collection.
|
1453
1525
|
* @returns The setters object so that settings can be chained.
|
1454
1526
|
*/
|
1455
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
1527
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1456
1528
|
/**
|
1457
1529
|
* Specifies the conditions under which requests are authorized.
|
1458
1530
|
* @param predicate A callback that returns whether a request is authorized.
|
1459
1531
|
* @returns The setters object so that settings can be chained.
|
1460
1532
|
* @since 0.7.0
|
1461
1533
|
*/
|
1462
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
1534
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1463
1535
|
}
|
1464
1536
|
/**
|
1465
1537
|
* Represents an object with a type ID, which is either a constructor or an
|
@@ -1471,73 +1543,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
1471
1543
|
typeId: URL;
|
1472
1544
|
};
|
1473
1545
|
/**
|
1474
|
-
*
|
1475
|
-
*
|
1476
|
-
* values are their string representations.
|
1477
|
-
* @returns A string representing the path with all parameters.
|
1478
|
-
* @example
|
1479
|
-
* ```ts
|
1480
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
1481
|
-
* let userPostPath: UserPostPath;
|
1482
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
1483
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
1484
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
1485
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
1486
|
-
* ```
|
1487
|
-
*/
|
1488
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
1489
|
-
/**
|
1490
|
-
* Represents a path with multiple parameters.
|
1491
|
-
* All permutations of the parameters are included in the union type.
|
1492
|
-
* The path must have all parameters in the form of `{paramName}`.
|
1493
|
-
* @param Params - A union of parameter names.
|
1494
|
-
* @returns A string representing the path with all parameters.
|
1495
|
-
* @example
|
1496
|
-
* ```ts
|
1497
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
1498
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
1499
|
-
* // =
|
1500
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
1501
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
1502
|
-
* let userPostPath: UserPostPath;
|
1503
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1504
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
1505
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
1506
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1507
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1508
|
-
*/
|
1509
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
1510
|
-
/**
|
1511
|
-
* Represents a path with a single parameter.
|
1512
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
1513
|
-
* @param Param - The name of the parameter.
|
1514
|
-
* @returns A string representing the path with the parameter.
|
1515
|
-
* @example
|
1516
|
-
* ```ts
|
1517
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
1518
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
1519
|
-
* let userPostPath: UserPostPath;
|
1520
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1521
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
1522
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
1523
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1524
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1525
|
-
*/
|
1526
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
1527
|
-
/**
|
1528
|
-
* Converts union types to intersection types.
|
1546
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
1547
|
+
* parameter name.
|
1529
1548
|
*
|
1530
|
-
*
|
1531
|
-
*
|
1549
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
1550
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
1551
|
+
* single, named variable.
|
1552
|
+
*
|
1553
|
+
* The supported expression types are:
|
1554
|
+
* - `{Param}`: Simple string expansion
|
1555
|
+
* - `+{Param}`: Reserved string expansion
|
1556
|
+
* - `#{Param}`: Fragment expansion
|
1557
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
1558
|
+
* - `{/Param}`: Path segment expansion
|
1559
|
+
* - `{;Param}`: Path-style parameter expansion
|
1560
|
+
* - `{?Param}`: Query component expansion
|
1561
|
+
* - `{&Param}`: Query continuation expansion
|
1562
|
+
*
|
1563
|
+
* @template Param The name of the parameter to be used in the expressions.
|
1532
1564
|
* @example
|
1533
1565
|
* ```ts
|
1534
|
-
* type
|
1535
|
-
*
|
1536
|
-
*
|
1537
|
-
*
|
1538
|
-
*
|
1566
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
1567
|
+
*
|
1568
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
1569
|
+
* const userPath: UserIdExpression = "{/userId}";
|
1570
|
+
* ```
|
1571
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
1539
1572
|
*/
|
1540
|
-
type
|
1573
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
1541
1574
|
//#endregion
|
1542
1575
|
//#region src/federation/context.d.ts
|
1543
1576
|
/**
|
@@ -2308,4 +2341,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
2308
2341
|
multikey: Multikey;
|
2309
2342
|
}
|
2310
2343
|
//#endregion
|
2311
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems,
|
2344
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,15 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { UrlError,
|
7
|
-
import { validateCryptoKey } from "./key-
|
8
|
-
import { doubleKnock } from "./http-
|
6
|
+
import { UrlError, createActivityPubRequest, logRequest, validatePublicUrl } from "./lookup-BbEekiru.js";
|
7
|
+
import { validateCryptoKey } from "./key-jSvnymAk.js";
|
8
|
+
import { doubleKnock } from "./http-DN0v2zoF.js";
|
9
|
+
import { getDocumentLoader, getRemoteDocument } from "@fedify/vocab-runtime";
|
9
10
|
import { getLogger } from "@logtape/logtape";
|
11
|
+
import { curry } from "@fxts/core";
|
10
12
|
|
11
|
-
//#region src/
|
13
|
+
//#region src/utils/docloader.ts
|
12
14
|
const logger = getLogger([
|
13
15
|
"fedify",
|
14
|
-
"
|
16
|
+
"utils",
|
15
17
|
"docloader"
|
16
18
|
]);
|
17
19
|
/**
|
@@ -37,10 +39,10 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
37
39
|
});
|
38
40
|
throw error;
|
39
41
|
}
|
40
|
-
const originalRequest =
|
42
|
+
const originalRequest = createActivityPubRequest(url, { userAgent });
|
41
43
|
const response = await doubleKnock(originalRequest, identity, {
|
42
44
|
specDeterminer,
|
43
|
-
log: logRequest,
|
45
|
+
log: curry(logRequest)(logger),
|
44
46
|
tracerProvider,
|
45
47
|
signal: options?.signal
|
46
48
|
});
|
@@ -48,6 +50,14 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
48
50
|
}
|
49
51
|
return load;
|
50
52
|
}
|
53
|
+
const _fetchDocumentLoader = getDocumentLoader();
|
54
|
+
const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
|
55
|
+
function fetchDocumentLoader(url, arg = false) {
|
56
|
+
const allowPrivateAddress = typeof arg === "boolean" ? arg : false;
|
57
|
+
logger.warn("fetchDocumentLoader() function is deprecated. Use getDocumentLoader() function instead.");
|
58
|
+
const loader = allowPrivateAddress ? _fetchDocumentLoader_allowPrivateAddress : _fetchDocumentLoader;
|
59
|
+
return loader(url);
|
60
|
+
}
|
51
61
|
|
52
62
|
//#endregion
|
53
|
-
export { getAuthenticatedDocumentLoader };
|
63
|
+
export { fetchDocumentLoader, getAuthenticatedDocumentLoader };
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { __commonJS, __toESM } from "./
|
6
|
+
import { __commonJS, __toESM } from "./lookup-BbEekiru.js";
|
7
7
|
|
8
8
|
//#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
|
9
9
|
var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
|
@@ -115,7 +115,7 @@ function parse(input, loose) {
|
|
115
115
|
}
|
116
116
|
|
117
117
|
//#endregion
|
118
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
118
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
|
119
119
|
const valueTypes = new Set([
|
120
120
|
"boolean",
|
121
121
|
"number",
|
@@ -207,7 +207,7 @@ var TypeDescriptor = class TypeDescriptor {
|
|
207
207
|
};
|
208
208
|
|
209
209
|
//#endregion
|
210
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
210
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
|
211
211
|
const allowedTypes = new Set([
|
212
212
|
"array",
|
213
213
|
"object",
|
@@ -366,7 +366,7 @@ function dequal(foo, bar) {
|
|
366
366
|
}
|
367
367
|
|
368
368
|
//#endregion
|
369
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
369
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/RequestUtils.js
|
370
370
|
const absoluteUrlRX = new RegExp("^[a-z]+://|^data:", "i");
|
371
371
|
const protocolRelativeUrlRX = new RegExp("^//", "i");
|
372
372
|
function hasCredentialsInUrl(url) {
|
@@ -444,7 +444,7 @@ function normalizeHeaders(headers) {
|
|
444
444
|
}
|
445
445
|
|
446
446
|
//#endregion
|
447
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
447
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/Matchers.js
|
448
448
|
var import_glob_to_regexp = __toESM(require_glob_to_regexp(), 1);
|
449
449
|
const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
|
450
450
|
const isFunctionMatcher = (matcher) => typeof matcher === "function";
|
@@ -627,7 +627,7 @@ const builtInMatchers = [
|
|
627
627
|
];
|
628
628
|
|
629
629
|
//#endregion
|
630
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
630
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/StatusTextMap.js
|
631
631
|
const statusTextMap = {
|
632
632
|
100: "Continue",
|
633
633
|
101: "Switching Protocols",
|
@@ -695,7 +695,7 @@ const statusTextMap = {
|
|
695
695
|
var StatusTextMap_default = statusTextMap;
|
696
696
|
|
697
697
|
//#endregion
|
698
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
698
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/Route.js
|
699
699
|
var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
700
700
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
701
701
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
@@ -829,7 +829,7 @@ builtInMatchers.forEach(Route.defineMatcher);
|
|
829
829
|
var Route_default = Route;
|
830
830
|
|
831
831
|
//#endregion
|
832
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
832
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/Router.js
|
833
833
|
const responseConfigProps = [
|
834
834
|
"body",
|
835
835
|
"headers",
|
@@ -1002,7 +1002,7 @@ var Router = class {
|
|
1002
1002
|
};
|
1003
1003
|
|
1004
1004
|
//#endregion
|
1005
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
1005
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/CallHistory.js
|
1006
1006
|
const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
|
1007
1007
|
const isMatchedOrUnmatched = (filter) => typeof filter === "boolean" || ["matched", "unmatched"].includes(filter);
|
1008
1008
|
var CallHistory = class {
|
@@ -1087,7 +1087,7 @@ var CallHistory = class {
|
|
1087
1087
|
var CallHistory_default = CallHistory;
|
1088
1088
|
|
1089
1089
|
//#endregion
|
1090
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
1090
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/FetchMock.js
|
1091
1091
|
const defaultFetchMockConfig = {
|
1092
1092
|
includeContentLength: true,
|
1093
1093
|
matchPartialBody: false,
|
@@ -1220,7 +1220,7 @@ const fetchMock = new FetchMock({ ...defaultFetchMockConfig });
|
|
1220
1220
|
var FetchMock_default = fetchMock;
|
1221
1221
|
|
1222
1222
|
//#endregion
|
1223
|
-
//#region ../../node_modules/.pnpm/fetch-mock@12.5.
|
1223
|
+
//#region ../../node_modules/.pnpm/fetch-mock@12.5.4/node_modules/fetch-mock/dist/esm/index.js
|
1224
1224
|
var esm_default = FetchMock_default;
|
1225
1225
|
|
1226
1226
|
//#endregion
|
@@ -3,20 +3,18 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Note, Person } from "../
|
6
|
+
import { Activity, Note, Person } from "../lookup-BbEekiru.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import "../
|
12
|
-
import "../
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
import "../
|
17
|
-
import "../
|
18
|
-
import "../assert_not_equals-f3m3epl3.js";
|
19
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
11
|
+
import "../inbox-CgGy7Hzc.js";
|
12
|
+
import { createFederationBuilder } from "../builder-Dn87hy75.js";
|
13
|
+
import { test } from "../testing-ClYSmXdi.js";
|
14
|
+
import { assertExists } from "../std__assert-DWivtrGR.js";
|
15
|
+
import "../assert_rejects-Ce45JcFg.js";
|
16
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
17
|
+
import "../assert_not_equals-C80BG-_5.js";
|
20
18
|
|
21
19
|
//#region src/federation/builder.test.ts
|
22
20
|
test("FederationBuilder", async (t) => {
|
@@ -3,18 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../
|
6
|
+
import "../lookup-BbEekiru.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../
|
11
|
-
import {
|
12
|
-
import
|
13
|
-
import "../
|
14
|
-
import "../
|
15
|
-
import "../
|
16
|
-
import "../assert_not_equals-f3m3epl3.js";
|
17
|
-
import "../assert_throws-BOO88avQ.js";
|
10
|
+
import { buildCollectionSynchronizationHeader, digest } from "../collection-BzWsN9pB.js";
|
11
|
+
import { test } from "../testing-ClYSmXdi.js";
|
12
|
+
import "../std__assert-DWivtrGR.js";
|
13
|
+
import "../assert_rejects-Ce45JcFg.js";
|
14
|
+
import "../assert_throws-BNXdRGWP.js";
|
15
|
+
import "../assert_not_equals-C80BG-_5.js";
|
18
16
|
import { decodeHex } from "byte-encodings/hex";
|
19
17
|
|
20
18
|
//#region src/federation/collection.test.ts
|