@fedify/fedify 2.0.0-dev.1690 → 2.0.0-dev.1736
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-DuCeRiNh.js → actor-BLq4KEGR.js} +1 -1
- package/dist/{actor-Be0ThtXy.cjs → actor-C3oFUgfc.cjs} +921 -1451
- package/dist/{actor-T6RyhRgk.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-ChbPLm6n.js → actor-btAA7QSA.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-CYOcDUkj.js → builder-C4gbKvM5.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-CnOdwLLN.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-C5BsZkDr.d.cts → context-BvYz3eOb.d.cts} +130 -103
- package/dist/{context-ByZprN0S.d.ts → context-myrGWbL_.d.ts} +130 -103
- package/dist/{authdocloader-Brax1A32.js → docloader-DtYIz2Pb.js} +17 -8
- package/dist/{esm-DnIzfEj0.js → esm-CQ9nlHuI.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-BNOYnVsU.js → http-B9npZ3Md.js} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-BxbM8sEy.js → http-D7qwMpca.js} +256 -6
- package/dist/{http-D-e6AFwR.d.cts → http-M8k5mKc0.d.cts} +2 -2
- package/dist/{http-C7vbQwbz.cjs → http-ngJvMHez.cjs} +289 -9
- package/dist/{inbox-BRru9pX3.js → inbox-CY8fblhz.js} +1 -1
- package/dist/{key-1KXru8Ug.js → key-CgKiloJr.js} +3 -2
- package/dist/{keycache-CN61iGVj.js → keycache-B6O-bhMs.js} +1 -1
- package/dist/{keys-BPdFKgiy.js → keys-B3O7b5eB.js} +2 -1
- package/dist/kv-cache-BrjWZnGU.cjs +133 -0
- package/dist/kv-cache-DkW_lqUw.js +121 -0
- package/dist/kv-cache-z0lgwFi_.js +93 -0
- package/dist/{ld-Dv8DNNAT.js → ld-B7TO6JH2.js} +3 -2
- package/dist/lookup-Cc3ZAAis.cjs +273 -0
- package/dist/{type-C69ZBu7f.js → lookup-NXjB7xUj.js} +503 -5327
- package/dist/lookup-fEH6e7ZX.js +261 -0
- package/dist/{middleware-DY9B2lL8.js → middleware-BMPvaTpX.js} +44 -48
- package/dist/{middleware-BmoOlgc1.cjs → middleware-C8w5YYxK.cjs} +60 -66
- package/dist/middleware-D8ENcqxG.js +26 -0
- package/dist/{middleware-Bz_A2jeJ.js → middleware-D_VyRsDx.js} +40 -46
- package/dist/middleware-Yk-MuxWc.js +15 -0
- package/dist/middleware-glwCut0b.cjs +15 -0
- package/dist/{mod-BhUKmBJD.d.ts → mod-B2iOw50L.d.ts} +3 -3
- package/dist/mod-BYynOiJG.d.ts +109 -0
- package/dist/{mod-DlU8ISoa.d.ts → mod-BlVovdcy.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-DbFNTF7m.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-VastcQsk.d.cts +107 -0
- package/dist/{mod-D6hQoxC5.d.ts → mod-k0Dk3fGk.d.ts} +2 -2
- 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-e3FYDhsk.js → owner-CSktF-2s.js} +3 -2
- package/dist/{owner-hd9lvQcP.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-DfgvA3al.js → proof-BT65yR1Q.js} +5 -4
- package/dist/{proof-6gFMwMNJ.js → proof-Cs5Mcy_U.js} +2 -2
- package/dist/{proof-B-eqv0Ug.cjs → proof-feEDocLH.cjs} +17 -16
- package/dist/{send-Tl9NOnmO.js → send-vPZ03xUr.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 +120 -172
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-BWNCAbL-.js → testing-u2cUPQLp.js} +1 -2
- package/dist/{types-DqxyTxOf.js → types-BtUjyi5y.js} +1 -1
- package/dist/{types-zqdWZh4O.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-Dw1-yVGg.d.cts → vocab-CeDBzu-f.d.cts} +2 -21
- package/dist/{vocab-B39-pFl9.cjs → vocab-NvDV-exu.cjs} +5 -5
- package/dist/{vocab-BWoeZsME.js → vocab-wADjlIH4.js} +3 -3
- 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 +15 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-CrxhFL8e.js +0 -52
- package/dist/authdocloader-OSn_teLV.cjs +0 -58
- package/dist/docloader-CCqXeagZ.cjs +0 -4861
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/docloader-XK3y2jn5.js +0 -4795
- package/dist/key-B3uag-rz.js +0 -10
- package/dist/key-BiBmb1Yy.cjs +0 -10
- package/dist/key-DK_nfU4I.js +0 -10
- package/dist/key-Z6ceKnZC.cjs +0 -290
- package/dist/key-jyNTxCvK.js +0 -260
- package/dist/lookup-BPviO8ij.js +0 -131
- package/dist/lookup-hnMAAU5r.cjs +0 -137
- package/dist/lookup-pV0JOsuV.js +0 -331
- package/dist/middleware-CI0-zw4U.js +0 -26
- package/dist/middleware-QNK-W-jE.cjs +0 -17
- package/dist/middleware-_vjt6FWU.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.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
@@ -1,16 +1,16 @@
|
|
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-CRGm1e_F.js";
|
3
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-BsGzbnV-.js";
|
4
|
+
import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
|
5
|
+
import { Actor, Recipient } from "./actor-DqFajh9s.js";
|
6
|
+
import { HttpMessageSignaturesSpec } from "./http-BbO0ejuk.js";
|
7
|
+
import { GetKeyOwnerOptions } from "./owner-kQRGVXG1.js";
|
8
|
+
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BlVovdcy.js";
|
9
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-Ds0mpFZU.js";
|
10
|
+
import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
|
11
|
+
import { MessageQueue } from "./mq-CUKlBw08.js";
|
13
12
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
13
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
14
14
|
|
15
15
|
//#region src/compat/types.d.ts
|
16
16
|
/**
|
@@ -283,7 +283,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
283
283
|
* the entire collection without pagination.
|
284
284
|
* @since 1.8.0
|
285
285
|
*/
|
286
|
-
type CustomCollectionDispatcher<TItem,
|
286
|
+
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
287
|
/**
|
288
288
|
* A callback that counts the number of items in a custom collection.
|
289
289
|
*
|
@@ -293,7 +293,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
293
293
|
* @param values The parameters of the requested URL.
|
294
294
|
* @since 1.8.0
|
295
295
|
*/
|
296
|
-
type CustomCollectionCounter<
|
296
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
297
297
|
/**
|
298
298
|
* A callback that returns a cursor for a custom collection.
|
299
299
|
*
|
@@ -306,7 +306,7 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
306
306
|
* @param values The parameters of the requested URL.
|
307
307
|
* @since 1.8.0
|
308
308
|
*/
|
309
|
-
type CustomCollectionCursor<
|
309
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
310
310
|
//#endregion
|
311
311
|
//#region src/federation/handler.d.ts
|
312
312
|
|
@@ -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,7 @@ 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
930
|
/**
|
931
931
|
* Registers a collection of objects dispatcher.
|
932
932
|
*
|
@@ -941,7 +941,60 @@ interface Federatable<TContextData> {
|
|
941
941
|
* The path must have one or more variables.
|
942
942
|
* @param dispatcher A collection dispatcher callback to register.
|
943
943
|
*/
|
944
|
-
setCollectionDispatcher<TObject extends Object$1,
|
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>;
|
964
|
+
/**
|
965
|
+
* Registers a collection of objects dispatcher.
|
966
|
+
*
|
967
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
968
|
+
* @template TObject The type of objects to dispatch.
|
969
|
+
* @template TParam The parameter names of the requested URL.
|
970
|
+
* @param name A unique name for the collection dispatcher.
|
971
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
972
|
+
* @param path The URI path pattern for the collection dispatcher.
|
973
|
+
* The syntax is based on URI Template
|
974
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
975
|
+
* The path must have one or more variables.
|
976
|
+
* @param dispatcher A collection dispatcher callback to register.
|
977
|
+
*/
|
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>;
|
945
998
|
/**
|
946
999
|
* Registers an ordered collection of objects dispatcher.
|
947
1000
|
*
|
@@ -956,7 +1009,26 @@ interface Federatable<TContextData> {
|
|
956
1009
|
* The path must have one or more variables.
|
957
1010
|
* @param dispatcher A collection dispatcher callback to register.
|
958
1011
|
*/
|
959
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
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>;
|
1015
|
+
/**
|
1016
|
+
* Registers an ordered collection of objects dispatcher.
|
1017
|
+
*
|
1018
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
1019
|
+
* @template TObject The type of objects to dispatch.
|
1020
|
+
* @template TParam The parameter names of the requested URL.
|
1021
|
+
* @param name A unique name for the collection dispatcher.
|
1022
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
1023
|
+
* @param path The URI path pattern for the collection dispatcher.
|
1024
|
+
* The syntax is based on URI Template
|
1025
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
1026
|
+
* The path must have one or more variables.
|
1027
|
+
* @param dispatcher A collection dispatcher callback to register.
|
1028
|
+
*/
|
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
|
@@ -1092,12 +1164,6 @@ interface FederationOptions<TContextData> {
|
|
1092
1164
|
* @since 1.4.0
|
1093
1165
|
*/
|
1094
1166
|
contextLoaderFactory?: DocumentLoaderFactory;
|
1095
|
-
/**
|
1096
|
-
* A custom JSON-LD context loader. By default, this uses the same loader
|
1097
|
-
* as the document loader.
|
1098
|
-
* @deprecated Use {@link contextLoaderFactory} instead.
|
1099
|
-
*/
|
1100
|
-
contextLoader?: DocumentLoader;
|
1101
1167
|
/**
|
1102
1168
|
* A factory function that creates an authenticated document loader for a
|
1103
1169
|
* given identity. This is used for fetching documents that require
|
@@ -1434,38 +1500,38 @@ interface FederationFetchOptions<TContextData> {
|
|
1434
1500
|
/**
|
1435
1501
|
* Additional settings for a custom collection dispatcher.
|
1436
1502
|
*
|
1437
|
-
* @template
|
1503
|
+
* @template TParam The type of the parameters in the URL path.
|
1438
1504
|
* @template TContext The type of the context. {@link Context} or
|
1439
1505
|
* {@link RequestContext}.
|
1440
1506
|
* @template TContextData The context data to pass to the {@link Context}.
|
1441
1507
|
* @template TFilter The type of filter for the collection.
|
1442
1508
|
*/
|
1443
|
-
interface CustomCollectionCallbackSetters<
|
1509
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
1444
1510
|
/**
|
1445
1511
|
* Sets the counter for the custom collection.
|
1446
1512
|
* @param counter A callback that returns the number of items in the custom collection.
|
1447
1513
|
* @returns The setters object so that settings can be chained.
|
1448
1514
|
*/
|
1449
|
-
setCounter(counter: CustomCollectionCounter<
|
1515
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1450
1516
|
/**
|
1451
1517
|
* Sets the first cursor for the custom collection.
|
1452
1518
|
* @param cursor The cursor for the first item in the custom collection.
|
1453
1519
|
* @returns The setters object so that settings can be chained.
|
1454
1520
|
*/
|
1455
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
1521
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1456
1522
|
/**
|
1457
1523
|
* Sets the last cursor for the custom collection.
|
1458
1524
|
* @param cursor The cursor for the last item in the custom collection.
|
1459
1525
|
* @returns The setters object so that settings can be chained.
|
1460
1526
|
*/
|
1461
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
1527
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1462
1528
|
/**
|
1463
1529
|
* Specifies the conditions under which requests are authorized.
|
1464
1530
|
* @param predicate A callback that returns whether a request is authorized.
|
1465
1531
|
* @returns The setters object so that settings can be chained.
|
1466
1532
|
* @since 0.7.0
|
1467
1533
|
*/
|
1468
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
1534
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1469
1535
|
}
|
1470
1536
|
/**
|
1471
1537
|
* Represents an object with a type ID, which is either a constructor or an
|
@@ -1477,73 +1543,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
1477
1543
|
typeId: URL;
|
1478
1544
|
};
|
1479
1545
|
/**
|
1480
|
-
*
|
1481
|
-
*
|
1482
|
-
* values are their string representations.
|
1483
|
-
* @returns A string representing the path with all parameters.
|
1484
|
-
* @example
|
1485
|
-
* ```ts
|
1486
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
1487
|
-
* let userPostPath: UserPostPath;
|
1488
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
1489
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
1490
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
1491
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
1492
|
-
* ```
|
1493
|
-
*/
|
1494
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
1495
|
-
/**
|
1496
|
-
* Represents a path with multiple parameters.
|
1497
|
-
* All permutations of the parameters are included in the union type.
|
1498
|
-
* The path must have all parameters in the form of `{paramName}`.
|
1499
|
-
* @param Params - A union of parameter names.
|
1500
|
-
* @returns A string representing the path with all parameters.
|
1501
|
-
* @example
|
1502
|
-
* ```ts
|
1503
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
1504
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
1505
|
-
* // =
|
1506
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
1507
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
1508
|
-
* let userPostPath: UserPostPath;
|
1509
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1510
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
1511
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
1512
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1513
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1514
|
-
*/
|
1515
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
1516
|
-
/**
|
1517
|
-
* Represents a path with a single parameter.
|
1518
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
1519
|
-
* @param Param - The name of the parameter.
|
1520
|
-
* @returns A string representing the path with the parameter.
|
1521
|
-
* @example
|
1522
|
-
* ```ts
|
1523
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
1524
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
1525
|
-
* let userPostPath: UserPostPath;
|
1526
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1527
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
1528
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
1529
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1530
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1531
|
-
*/
|
1532
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
1533
|
-
/**
|
1534
|
-
* Converts union types to intersection types.
|
1546
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
1547
|
+
* parameter name.
|
1535
1548
|
*
|
1536
|
-
*
|
1537
|
-
*
|
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.
|
1538
1564
|
* @example
|
1539
1565
|
* ```ts
|
1540
|
-
* type
|
1541
|
-
*
|
1542
|
-
*
|
1543
|
-
*
|
1544
|
-
*
|
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.
|
1545
1572
|
*/
|
1546
|
-
type
|
1573
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
1547
1574
|
//#endregion
|
1548
1575
|
//#region src/federation/context.d.ts
|
1549
1576
|
/**
|
@@ -2314,4 +2341,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
2314
2341
|
multikey: Multikey;
|
2315
2342
|
}
|
2316
2343
|
//#endregion
|
2317
|
-
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,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
6
|
+
import { validateCryptoKey } from "./key-CgKiloJr.js";
|
7
|
+
import { doubleKnock } from "./http-B9npZ3Md.js";
|
8
|
+
import { curry } from "es-toolkit";
|
9
|
+
import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
9
10
|
import { getLogger } from "@logtape/logtape";
|
10
11
|
|
11
|
-
//#region src/
|
12
|
+
//#region src/utils/docloader.ts
|
12
13
|
const logger = getLogger([
|
13
14
|
"fedify",
|
14
|
-
"
|
15
|
+
"utils",
|
15
16
|
"docloader"
|
16
17
|
]);
|
17
18
|
/**
|
@@ -37,10 +38,10 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
37
38
|
});
|
38
39
|
throw error;
|
39
40
|
}
|
40
|
-
const originalRequest =
|
41
|
+
const originalRequest = createActivityPubRequest(url, { userAgent });
|
41
42
|
const response = await doubleKnock(originalRequest, identity, {
|
42
43
|
specDeterminer,
|
43
|
-
log: logRequest,
|
44
|
+
log: curry(logRequest)(logger),
|
44
45
|
tracerProvider,
|
45
46
|
signal: options?.signal
|
46
47
|
});
|
@@ -48,6 +49,14 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
48
49
|
}
|
49
50
|
return load;
|
50
51
|
}
|
52
|
+
const _fetchDocumentLoader = getDocumentLoader();
|
53
|
+
const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
|
54
|
+
function fetchDocumentLoader(url, arg = false) {
|
55
|
+
const allowPrivateAddress = typeof arg === "boolean" ? arg : false;
|
56
|
+
logger.warn("fetchDocumentLoader() function is deprecated. Use getDocumentLoader() function instead.");
|
57
|
+
const loader = allowPrivateAddress ? _fetchDocumentLoader_allowPrivateAddress : _fetchDocumentLoader;
|
58
|
+
return loader(url);
|
59
|
+
}
|
51
60
|
|
52
61
|
//#endregion
|
53
|
-
export { getAuthenticatedDocumentLoader };
|
62
|
+
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-NXjB7xUj.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-NXjB7xUj.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-CY8fblhz.js";
|
12
|
+
import { createFederationBuilder } from "../builder-C4gbKvM5.js";
|
13
|
+
import { test } from "../testing-u2cUPQLp.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-NXjB7xUj.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-u2cUPQLp.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
|