@fedify/fedify 2.0.0-dev.1485 → 2.0.0-dev.149
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/LICENSE +1 -1
- package/README.md +38 -18
- package/dist/actor-CCAL5-E_.cjs +42079 -0
- package/dist/{actor-7ivEf1H3.js → actor-DYdPViDz.js} +4 -1
- package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-DXTdNCfp.js → actor-U_BZZ2ps.js} +7058 -2722
- package/dist/actor-f2NtjyCg.d.cts +128 -0
- package/dist/{assert-MZs1qjMx.js → assert-Dp5_aoAs.js} +1 -1
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-D1m8F7x0.js} +1 -1
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-B2R_8p36.js} +1 -1
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-BoKYY0g1.js} +2 -2
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-DjkXin1a.js} +32 -2
- package/dist/{builder-BPGqEvtB.js → builder-CYR2yKqn.js} +20 -8
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/chunk-HsBuZ-b2.js +41 -0
- package/dist/client-94iWEfQa.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-g2FDBoeY.js → client-CD87uCL_.js} +4 -23
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +11 -0
- package/dist/compat/mod.d.ts +10 -12
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +29 -24
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/context-DBQ7nMCw.d.cts +2449 -0
- package/dist/context-DH7LHJdw.js +109 -0
- package/dist/{context-DmlbRh9p.d.ts → context-mM0Nu5yo.d.ts} +335 -134
- package/dist/deno-BTeveqhY.js +131 -0
- package/dist/{testing-BG_8Fyas.js → dist-lStjlyET.js} +73 -114
- package/dist/{authdocloader-D_IvQE4z.js → docloader-BSGGKhrl.js} +17 -8
- package/dist/{esm-CPZhxxGc.js → esm-B52TuumP.js} +32 -17
- package/dist/federation/builder.test.js +16 -16
- package/dist/federation/collection.test.js +9 -12
- package/dist/federation/handler.test.js +123 -152
- package/dist/federation/idempotency.test.js +206 -0
- package/dist/federation/inbox.test.js +7 -7
- package/dist/federation/keycache.test.js +7 -8
- package/dist/federation/kv.test.js +64 -12
- package/dist/federation/middleware.test.js +281 -99
- package/dist/federation/mod.cjs +27 -0
- package/dist/federation/mod.d.cts +11 -0
- package/dist/federation/mod.d.ts +11 -13
- package/dist/federation/mod.js +13 -15
- package/dist/federation/mq.test.js +12 -13
- package/dist/federation/negotiation.test.js +25 -0
- package/dist/federation/retry.test.js +4 -6
- package/dist/federation/router.test.js +9 -11
- package/dist/federation/send.test.js +61 -18
- package/dist/federation-CoW-KDKv.cjs +266 -0
- package/dist/{federation-CMX7WzeL.js → federation-D0hkM4T7.js} +25 -3
- package/dist/{http-C7rxW7Kh.js → http-BIDOYI9f.js} +4 -3
- package/dist/{http-zsOxPKCt.js → http-BQRnmfXP.js} +260 -10
- package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/http-DtYHWbwa.cjs +1106 -0
- package/dist/http-M8k5mKc0.d.cts +253 -0
- package/dist/{inbox-eK2W2MF3.js → inbox-DNjplQSR.js} +26 -7
- package/dist/{key-CYOcZ9G5.js → key-dws2_YsP.js} +4 -2
- package/dist/{keycache-BLq6GT4_.js → keycache-BbbXRjc-.js} +1 -1
- package/dist/{keys-BIwlbtMN.js → keys-C6QyjjIN.js} +2 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-BpJND1Hr.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-DaWUKuhD.js} +22 -0
- package/dist/kv-cD_d4hg-.d.cts +110 -0
- package/dist/kv-cache-1_lcnUMp.cjs +134 -0
- package/dist/kv-cache-BEP4OyiZ.js +122 -0
- package/dist/kv-cache-C6NrTtII.js +107 -0
- package/dist/{ld-DWwLYT4e.js → ld-C6UrncJk.js} +7 -4
- package/dist/lookup-BORWbouU.cjs +268 -0
- package/dist/lookup-BV72lfsA.js +256 -0
- package/dist/{lookup-DNQyH8UQ.js → lookup-BoiLMtAx.js} +33 -125
- package/dist/{lookup-BHYMosdS.js → lookup-yv_aH7K7.js} +3 -1
- package/dist/{middleware-BcVqlHyD.js → middleware--1K3DAB8.js} +143 -136
- package/dist/middleware-7Yg2p_nl.js +31 -0
- package/dist/{middleware-DakCaqXu.js → middleware-8Oymc6Na.js} +105 -188
- package/dist/middleware-C6YBw2qx.cjs +15 -0
- package/dist/middleware-D6XNERu3.js +15 -0
- package/dist/middleware-DBHDivdC.cjs +4237 -0
- package/dist/mod-B-hUPT2N.d.cts +1 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
- package/dist/mod-BxRCHTz-.d.cts +307 -0
- package/dist/mod-C58MZ7Wx.d.cts +113 -0
- package/dist/mod-CAdoBu0x.d.ts +109 -0
- package/dist/mod-CcDPcLJW.d.cts +1 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-D5Z2tISD.d.ts} +3 -3
- package/dist/mod-DgxG-byT.d.cts +266 -0
- package/dist/{lookup-3czM5mmU.d.ts → mod-Ds0mpFZU.d.ts} +9 -2
- package/dist/mod-Dy2fJtmN.d.cts +80 -0
- package/dist/{mod-0EysZ-dJ.d.ts → mod-GetHzY6F.d.ts} +2 -2
- package/dist/mod-fxr25Gv7.d.cts +107 -0
- package/dist/mod.cjs +137 -0
- package/dist/mod.d.cts +15 -0
- package/dist/mod.d.ts +15 -18
- package/dist/mod.js +19 -21
- package/dist/negotiation-B4NJHk1f.js +71 -0
- package/dist/nodeinfo/client.test.js +32 -114
- package/dist/nodeinfo/handler.test.js +35 -30
- package/dist/nodeinfo/mod.cjs +10 -0
- package/dist/nodeinfo/mod.d.cts +3 -0
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +6 -7
- package/dist/nodeinfo/types.test.js +10 -18
- package/dist/nodeinfo-BnthBobC.js +4 -0
- package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
- package/dist/otel/exporter.test.js +899 -0
- package/dist/otel/mod.cjs +262 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +261 -0
- package/dist/owner-B4HbyP8s.d.cts +67 -0
- package/dist/{owner-smArESGi.js → owner-DQuVKHuY.js} +46 -8
- package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-CT1SITRP.js → proof-BG2G4cDG.js} +53 -16
- package/dist/proof-C3K5Z8RT.cjs +710 -0
- package/dist/{proof-C6z-uqeO.js → proof-GrivUN5L.js} +5 -3
- package/dist/router-CVRQXlZi.js +118 -0
- package/dist/{send-1zdmNlUo.js → send-B_dTZyUD.js} +9 -4
- package/dist/sig/http.test.js +19 -17
- package/dist/sig/key.test.js +15 -14
- package/dist/sig/ld.test.js +13 -12
- package/dist/sig/mod.cjs +28 -0
- package/dist/sig/mod.d.cts +6 -0
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +8 -10
- package/dist/sig/owner.test.js +40 -15
- package/dist/sig/proof.test.js +19 -17
- package/dist/sig-C34-oHBl.js +4 -0
- package/dist/sig-YYj5tCnr.cjs +4 -0
- package/dist/{std__assert-X-_kMxKM.js → std__assert-Cm-MfI66.js} +1 -1
- package/dist/testing/mod.d.ts +410 -232
- package/dist/testing/mod.js +9 -4
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/type-BSNcIxTd.js +14 -0
- package/dist/{types-BzyGRkRt.js → types-BtUjyi5y.js} +9 -170
- package/dist/types-CWgzGaqk.cjs +315 -0
- package/dist/{types-BIgY6c-l.js → types-D2jhK2VG.js} +1 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +20 -18
- package/dist/utils/kv-cache.test.js +211 -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/utils-D-Va7aXC.js +4 -0
- package/dist/utils-DyRU1gdZ.cjs +4 -0
- package/dist/vocab/actor.test.js +15 -13
- package/dist/vocab/lookup.test.js +285 -12
- package/dist/vocab/mod.cjs +86 -0
- package/dist/vocab/mod.d.cts +4 -0
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +6 -7
- package/dist/vocab/type.test.js +4 -4
- package/dist/vocab/vocab.test.js +8058 -1987
- package/dist/{vocab-Bg1J3mu4.js → vocab-Aig1Fmi8.js} +32 -18
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
- package/dist/{type-I68qwqmo.js → vocab-C3nSleOZ.js} +6947 -7381
- package/dist/vocab-CeDBzu-f.d.cts +14903 -0
- package/dist/vocab-DFMYh9aV.cjs +296 -0
- package/dist/webfinger/handler.test.js +62 -29
- package/dist/webfinger/lookup.test.js +11 -12
- package/dist/webfinger/mod.cjs +8 -0
- package/dist/webfinger/mod.d.cts +2 -0
- package/dist/webfinger/mod.d.ts +1 -4
- package/dist/webfinger/mod.js +5 -6
- package/dist/webfinger-C72Y8lrh.js +4 -0
- package/dist/webfinger-vAtLmxOF.cjs +4 -0
- package/package.json +81 -45
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Bq0gEHRj.js +0 -52
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/denokv-Bv33Xxea.js +0 -57
- package/dist/docloader-BlVueewg.js +0 -4615
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
- package/dist/fixtures/example.com/announce.json +0 -6
- package/dist/fixtures/example.com/collection.json +0 -19
- package/dist/fixtures/example.com/create.json +0 -6
- package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
- package/dist/fixtures/example.com/hong-gildong.json +0 -11
- package/dist/fixtures/example.com/invite.json +0 -7
- package/dist/fixtures/example.com/key.json +0 -7
- package/dist/fixtures/example.com/key2.json +0 -6
- package/dist/fixtures/example.com/object.json +0 -6
- package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
- package/dist/fixtures/example.com/paged/a.json +0 -13
- package/dist/fixtures/example.com/paged/b.json +0 -16
- package/dist/fixtures/example.com/paged-collection.json +0 -6
- package/dist/fixtures/example.com/person.json +0 -22
- package/dist/fixtures/example.com/person2.json +0 -40
- package/dist/fixtures/example.com/test.json +0 -5
- package/dist/fixtures/example.com/users/handle.json +0 -16
- package/dist/fixtures/example.com/wrong-type.json +0 -3
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
- package/dist/fixtures/remote.domain/users/bob.json +0 -20
- package/dist/fixtures/server.example/users/alice.json +0 -20
- package/dist/fixtures/w3id.org/identity/v1.json +0 -152
- package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
- package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
- package/dist/fixtures/w3id.org/security/v1.json +0 -50
- package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
- package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
- package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
- package/dist/key-Dn7Lram-.js +0 -260
- package/dist/key-S7WllAWz.js +0 -10
- package/dist/key-rRCUafNm.js +0 -10
- package/dist/middleware-CWbGhXnl.js +0 -26
- package/dist/middleware-D-OlNiyj.js +0 -17
- package/dist/mod-TFoH2Ql8.d.ts +0 -104
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- 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/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/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/src/vocab/accept.yaml +0 -15
- package/dist/src/vocab/activity.yaml +0 -98
- package/dist/src/vocab/add.yaml +0 -16
- package/dist/src/vocab/announce.yaml +0 -30
- package/dist/src/vocab/application.yaml +0 -324
- package/dist/src/vocab/arrive.yaml +0 -15
- package/dist/src/vocab/article.yaml +0 -46
- package/dist/src/vocab/audio.yaml +0 -11
- package/dist/src/vocab/block.yaml +0 -16
- package/dist/src/vocab/chatmessage.yaml +0 -50
- package/dist/src/vocab/collection.yaml +0 -154
- package/dist/src/vocab/collectionpage.yaml +0 -55
- package/dist/src/vocab/create.yaml +0 -28
- package/dist/src/vocab/dataintegrityproof.yaml +0 -56
- package/dist/src/vocab/delete.yaml +0 -27
- package/dist/src/vocab/didservice.yaml +0 -22
- package/dist/src/vocab/dislike.yaml +0 -14
- package/dist/src/vocab/document.yaml +0 -31
- package/dist/src/vocab/emoji.yaml +0 -12
- package/dist/src/vocab/emojireact.yaml +0 -17
- package/dist/src/vocab/endpoints.yaml +0 -85
- package/dist/src/vocab/event.yaml +0 -11
- package/dist/src/vocab/export.yaml +0 -9
- package/dist/src/vocab/flag.yaml +0 -15
- package/dist/src/vocab/follow.yaml +0 -19
- package/dist/src/vocab/group.yaml +0 -324
- package/dist/src/vocab/hashtag.yaml +0 -14
- package/dist/src/vocab/ignore.yaml +0 -14
- package/dist/src/vocab/image.yaml +0 -9
- package/dist/src/vocab/intransitiveactivity.yaml +0 -15
- package/dist/src/vocab/invite.yaml +0 -14
- package/dist/src/vocab/join.yaml +0 -14
- package/dist/src/vocab/key.yaml +0 -28
- package/dist/src/vocab/leave.yaml +0 -14
- package/dist/src/vocab/like.yaml +0 -16
- package/dist/src/vocab/link.yaml +0 -101
- package/dist/src/vocab/listen.yaml +0 -12
- package/dist/src/vocab/mention.yaml +0 -9
- package/dist/src/vocab/move.yaml +0 -15
- package/dist/src/vocab/multikey.yaml +0 -36
- package/dist/src/vocab/note.yaml +0 -48
- package/dist/src/vocab/object.yaml +0 -404
- package/dist/src/vocab/offer.yaml +0 -15
- package/dist/src/vocab/orderedcollection.yaml +0 -39
- package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
- package/dist/src/vocab/organization.yaml +0 -324
- package/dist/src/vocab/page.yaml +0 -11
- package/dist/src/vocab/person.yaml +0 -324
- package/dist/src/vocab/place.yaml +0 -75
- package/dist/src/vocab/profile.yaml +0 -26
- package/dist/src/vocab/propertyvalue.yaml +0 -32
- package/dist/src/vocab/question.yaml +0 -103
- package/dist/src/vocab/read.yaml +0 -13
- package/dist/src/vocab/reject.yaml +0 -14
- package/dist/src/vocab/relationship.yaml +0 -52
- package/dist/src/vocab/remove.yaml +0 -14
- package/dist/src/vocab/service.yaml +0 -324
- package/dist/src/vocab/source.yaml +0 -26
- package/dist/src/vocab/tentativeaccept.yaml +0 -14
- package/dist/src/vocab/tentativereject.yaml +0 -14
- package/dist/src/vocab/tombstone.yaml +0 -24
- package/dist/src/vocab/travel.yaml +0 -16
- package/dist/src/vocab/undo.yaml +0 -26
- package/dist/src/vocab/update.yaml +0 -58
- package/dist/src/vocab/video.yaml +0 -11
- package/dist/src/vocab/view.yaml +0 -13
- package/dist/testing/docloader.test.js +0 -24
- package/dist/vocab/schema.yaml +0 -247
- package/dist/webfinger-C3GIyXIg.js +0 -4
- package/dist/x/cfworkers.d.ts +0 -61
- package/dist/x/cfworkers.js +0 -98
- package/dist/x/cfworkers.test.d.ts +0 -3
- package/dist/x/cfworkers.test.js +0 -179
- package/dist/x/hono.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Gbplq4lg.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-CrkRM5Ep.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-GIh5OYxW.d.ts → mod-bjzj5QIb.d.ts} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-Bz5pP75o.js} +0 -0
- /package/dist/{testing → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
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 { LookupWebFingerOptions, ResourceDescriptor } from "./lookup-3czM5mmU.js";
|
|
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-BpJND1Hr.js";
|
|
13
11
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
12
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
14
13
|
|
|
15
14
|
//#region src/compat/types.d.ts
|
|
16
15
|
/**
|
|
@@ -73,6 +72,14 @@ interface SenderKeyPair {
|
|
|
73
72
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
74
73
|
*/
|
|
75
74
|
type NodeInfoDispatcher<TContextData> = (context: RequestContext<TContextData>) => NodeInfo | Promise<NodeInfo>;
|
|
75
|
+
/**
|
|
76
|
+
* A callback that dispatches a array of {@link Link}.
|
|
77
|
+
*
|
|
78
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
79
|
+
* @param resource The URL queried via WebFinger.
|
|
80
|
+
* @returns Links related to the queried resource.
|
|
81
|
+
*/
|
|
82
|
+
type WebFingerLinksDispatcher<TContextData> = (context: RequestContext<TContextData>, resource: URL) => readonly Link$1[] | Promise<readonly Link$1[]>;
|
|
76
83
|
/**
|
|
77
84
|
* A callback that dispatches an {@link Actor} object.
|
|
78
85
|
*
|
|
@@ -275,7 +282,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
|
275
282
|
* the entire collection without pagination.
|
|
276
283
|
* @since 1.8.0
|
|
277
284
|
*/
|
|
278
|
-
type CustomCollectionDispatcher<TItem,
|
|
285
|
+
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>;
|
|
279
286
|
/**
|
|
280
287
|
* A callback that counts the number of items in a custom collection.
|
|
281
288
|
*
|
|
@@ -285,7 +292,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
|
285
292
|
* @param values The parameters of the requested URL.
|
|
286
293
|
* @since 1.8.0
|
|
287
294
|
*/
|
|
288
|
-
type CustomCollectionCounter<
|
|
295
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
|
289
296
|
/**
|
|
290
297
|
* A callback that returns a cursor for a custom collection.
|
|
291
298
|
*
|
|
@@ -298,10 +305,148 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
|
298
305
|
* @param values The parameters of the requested URL.
|
|
299
306
|
* @since 1.8.0
|
|
300
307
|
*/
|
|
301
|
-
type CustomCollectionCursor<
|
|
308
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/federation/mq.d.ts
|
|
311
|
+
/**
|
|
312
|
+
* Additional options for enqueuing a message in a queue.
|
|
313
|
+
*
|
|
314
|
+
* @since 0.5.0
|
|
315
|
+
*/
|
|
316
|
+
interface MessageQueueEnqueueOptions {
|
|
317
|
+
/**
|
|
318
|
+
* The delay before the message is enqueued. No delay by default.
|
|
319
|
+
*
|
|
320
|
+
* It must not be negative.
|
|
321
|
+
*/
|
|
322
|
+
delay?: Temporal.Duration;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Additional options for listening to a message queue.
|
|
326
|
+
*
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
*/
|
|
329
|
+
interface MessageQueueListenOptions {
|
|
330
|
+
/**
|
|
331
|
+
* The signal to abort listening to the message queue.
|
|
332
|
+
*/
|
|
333
|
+
signal?: AbortSignal;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* An abstract interface for a message queue.
|
|
337
|
+
*
|
|
338
|
+
* @since 0.5.0
|
|
339
|
+
*/
|
|
340
|
+
interface MessageQueue {
|
|
341
|
+
/**
|
|
342
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
343
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
344
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
345
|
+
* using its own retry policies.
|
|
346
|
+
*
|
|
347
|
+
* @default `false`
|
|
348
|
+
* @since 1.7.0
|
|
349
|
+
*/
|
|
350
|
+
readonly nativeRetrial?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Enqueues a message in the queue.
|
|
353
|
+
* @param message The message to enqueue.
|
|
354
|
+
* @param options Additional options for enqueuing the message.
|
|
355
|
+
*/
|
|
356
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
357
|
+
/**
|
|
358
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
359
|
+
* and may not be supported by all implementations. If not supported,
|
|
360
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
361
|
+
*
|
|
362
|
+
* @param messages The messages to enqueue.
|
|
363
|
+
* @param options Additional options for enqueuing the messages.
|
|
364
|
+
*/
|
|
365
|
+
enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Listens for messages in the queue.
|
|
368
|
+
* @param handler The handler for messages in the queue.
|
|
369
|
+
* @param options Additional options for listening to the message queue.
|
|
370
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
371
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
372
|
+
* signal is provided, it never resolves.
|
|
373
|
+
*/
|
|
374
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
378
|
+
* @since 1.0.0
|
|
379
|
+
*/
|
|
380
|
+
interface InProcessMessageQueueOptions {
|
|
381
|
+
/**
|
|
382
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
383
|
+
* @default `{ seconds: 5 }`
|
|
384
|
+
*/
|
|
385
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* A message queue that processes messages in the same process.
|
|
389
|
+
* Do not use this in production as it does neither persist messages nor
|
|
390
|
+
* distribute them across multiple processes.
|
|
391
|
+
*
|
|
392
|
+
* @since 0.5.0
|
|
393
|
+
*/
|
|
394
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
395
|
+
#private;
|
|
396
|
+
/**
|
|
397
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
398
|
+
* @since 1.7.0
|
|
399
|
+
*/
|
|
400
|
+
readonly nativeRetrial = false;
|
|
401
|
+
/**
|
|
402
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
403
|
+
* @param options Additional options for the in-process message queue.
|
|
404
|
+
*/
|
|
405
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
406
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
407
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
408
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* A message queue that processes messages in parallel. It takes another
|
|
412
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
413
|
+
* number of workers.
|
|
414
|
+
*
|
|
415
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
416
|
+
*
|
|
417
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
418
|
+
* are not running in separate threads or processes. They are running in the
|
|
419
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
420
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
421
|
+
* workloads.
|
|
422
|
+
*
|
|
423
|
+
* @since 1.0.0
|
|
424
|
+
*/
|
|
425
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
426
|
+
#private;
|
|
427
|
+
readonly queue: MessageQueue;
|
|
428
|
+
readonly workers: number;
|
|
429
|
+
/**
|
|
430
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
431
|
+
* @since 1.7.0
|
|
432
|
+
*/
|
|
433
|
+
readonly nativeRetrial?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
436
|
+
* number of workers.
|
|
437
|
+
* @param queue The message queue to use under the hood. Note that
|
|
438
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
439
|
+
* @param workers The number of workers to process messages in parallel.
|
|
440
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
441
|
+
* {@link ParallelMessageQueue}.
|
|
442
|
+
*/
|
|
443
|
+
constructor(queue: MessageQueue, workers: number);
|
|
444
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
445
|
+
enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
446
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
447
|
+
}
|
|
302
448
|
//#endregion
|
|
303
449
|
//#region src/federation/handler.d.ts
|
|
304
|
-
|
|
305
450
|
/**
|
|
306
451
|
* Options for the {@link respondWithObject} and
|
|
307
452
|
* {@link respondWithObjectIfAcceptable} functions.
|
|
@@ -667,6 +812,11 @@ interface Federatable<TContextData> {
|
|
|
667
812
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
668
813
|
*/
|
|
669
814
|
setNodeInfoDispatcher(path: string, dispatcher: NodeInfoDispatcher<TContextData>): void;
|
|
815
|
+
/**
|
|
816
|
+
* Registers a links dispatcher to WebFinger
|
|
817
|
+
* @param dispatcher A links dispatcher callback to register.
|
|
818
|
+
*/
|
|
819
|
+
setWebFingerLinksDispatcher(dispatcher: WebFingerLinksDispatcher<TContextData>): void;
|
|
670
820
|
/**
|
|
671
821
|
* Registers an actor dispatcher.
|
|
672
822
|
*
|
|
@@ -691,7 +841,7 @@ interface Federatable<TContextData> {
|
|
|
691
841
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
|
692
842
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
693
843
|
*/
|
|
694
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
844
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
695
845
|
/**
|
|
696
846
|
* Registers an object dispatcher.
|
|
697
847
|
*
|
|
@@ -705,9 +855,7 @@ interface Federatable<TContextData> {
|
|
|
705
855
|
* must have one or more variables.
|
|
706
856
|
* @param dispatcher An object dispatcher callback to register.
|
|
707
857
|
*/
|
|
708
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
709
|
-
typeId: URL;
|
|
710
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
858
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
711
859
|
/**
|
|
712
860
|
* Registers an object dispatcher.
|
|
713
861
|
*
|
|
@@ -721,9 +869,7 @@ interface Federatable<TContextData> {
|
|
|
721
869
|
* must have one or more variables.
|
|
722
870
|
* @param dispatcher An object dispatcher callback to register.
|
|
723
871
|
*/
|
|
724
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
725
|
-
typeId: URL;
|
|
726
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
872
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
727
873
|
/**
|
|
728
874
|
* Registers an object dispatcher.
|
|
729
875
|
*
|
|
@@ -737,9 +883,7 @@ interface Federatable<TContextData> {
|
|
|
737
883
|
* must have one or more variables.
|
|
738
884
|
* @param dispatcher An object dispatcher callback to register.
|
|
739
885
|
*/
|
|
740
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
741
|
-
typeId: URL;
|
|
742
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
886
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
743
887
|
/**
|
|
744
888
|
* Registers an object dispatcher.
|
|
745
889
|
*
|
|
@@ -753,9 +897,7 @@ interface Federatable<TContextData> {
|
|
|
753
897
|
* must have one or more variables.
|
|
754
898
|
* @param dispatcher An object dispatcher callback to register.
|
|
755
899
|
*/
|
|
756
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
757
|
-
typeId: URL;
|
|
758
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
900
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
759
901
|
/**
|
|
760
902
|
* Registers an object dispatcher.
|
|
761
903
|
*
|
|
@@ -769,9 +911,7 @@ interface Federatable<TContextData> {
|
|
|
769
911
|
* must have one or more variables.
|
|
770
912
|
* @param dispatcher An object dispatcher callback to register.
|
|
771
913
|
*/
|
|
772
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
773
|
-
typeId: URL;
|
|
774
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
914
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
775
915
|
/**
|
|
776
916
|
* Registers an object dispatcher.
|
|
777
917
|
*
|
|
@@ -785,9 +925,7 @@ interface Federatable<TContextData> {
|
|
|
785
925
|
* must have one or more variables.
|
|
786
926
|
* @param dispatcher An object dispatcher callback to register.
|
|
787
927
|
*/
|
|
788
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
789
|
-
typeId: URL;
|
|
790
|
-
}, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
928
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
791
929
|
/**
|
|
792
930
|
* Registers an inbox dispatcher.
|
|
793
931
|
*
|
|
@@ -799,7 +937,7 @@ interface Federatable<TContextData> {
|
|
|
799
937
|
* @param dispatcher An inbox dispatcher callback to register.
|
|
800
938
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
801
939
|
*/
|
|
802
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
940
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
803
941
|
/**
|
|
804
942
|
* Registers an outbox dispatcher.
|
|
805
943
|
*
|
|
@@ -823,7 +961,7 @@ interface Federatable<TContextData> {
|
|
|
823
961
|
* @param dispatcher An outbox dispatcher callback to register.
|
|
824
962
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
825
963
|
*/
|
|
826
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
964
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
827
965
|
/**
|
|
828
966
|
* Registers a following collection dispatcher.
|
|
829
967
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -835,7 +973,7 @@ interface Federatable<TContextData> {
|
|
|
835
973
|
* callbacks.
|
|
836
974
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
837
975
|
*/
|
|
838
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
976
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
839
977
|
/**
|
|
840
978
|
* Registers a followers collection dispatcher.
|
|
841
979
|
* @param path The URI path pattern for the followers collection. The syntax
|
|
@@ -847,7 +985,7 @@ interface Federatable<TContextData> {
|
|
|
847
985
|
* callbacks.
|
|
848
986
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
849
987
|
*/
|
|
850
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
988
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
851
989
|
/**
|
|
852
990
|
* Registers a liked collection dispatcher.
|
|
853
991
|
* @param path The URI path pattern for the liked collection. The syntax
|
|
@@ -859,7 +997,7 @@ interface Federatable<TContextData> {
|
|
|
859
997
|
* callbacks.
|
|
860
998
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
861
999
|
*/
|
|
862
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1000
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
863
1001
|
/**
|
|
864
1002
|
* Registers a featured collection dispatcher.
|
|
865
1003
|
* @param path The URI path pattern for the featured collection. The syntax
|
|
@@ -871,7 +1009,7 @@ interface Federatable<TContextData> {
|
|
|
871
1009
|
* callbacks.
|
|
872
1010
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
873
1011
|
*/
|
|
874
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1012
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
875
1013
|
/**
|
|
876
1014
|
* Registers a featured tags collection dispatcher.
|
|
877
1015
|
* @param path The URI path pattern for the featured tags collection.
|
|
@@ -883,7 +1021,7 @@ interface Federatable<TContextData> {
|
|
|
883
1021
|
* callbacks.
|
|
884
1022
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
885
1023
|
*/
|
|
886
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1024
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
887
1025
|
/**
|
|
888
1026
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
|
889
1027
|
*
|
|
@@ -913,7 +1051,7 @@ interface Federatable<TContextData> {
|
|
|
913
1051
|
* @returns An object to register inbox listeners.
|
|
914
1052
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
|
915
1053
|
*/
|
|
916
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1054
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
917
1055
|
/**
|
|
918
1056
|
* Registers a collection of objects dispatcher.
|
|
919
1057
|
*
|
|
@@ -928,7 +1066,52 @@ interface Federatable<TContextData> {
|
|
|
928
1066
|
* The path must have one or more variables.
|
|
929
1067
|
* @param dispatcher A collection dispatcher callback to register.
|
|
930
1068
|
*/
|
|
931
|
-
setCollectionDispatcher<TObject extends Object$1,
|
|
1069
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Registers a collection of objects dispatcher.
|
|
1072
|
+
*
|
|
1073
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1074
|
+
* @template TObject The type of objects to dispatch.
|
|
1075
|
+
* @template TParam The parameter names of the requested URL.
|
|
1076
|
+
* @param name A unique name for the collection dispatcher.
|
|
1077
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1078
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1079
|
+
* The syntax is based on URI Template
|
|
1080
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1081
|
+
* The path must have one or more variables.
|
|
1082
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1083
|
+
*/
|
|
1084
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Registers a collection of objects dispatcher.
|
|
1087
|
+
*
|
|
1088
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1089
|
+
* @template TObject The type of objects to dispatch.
|
|
1090
|
+
* @template TParam The parameter names of the requested URL.
|
|
1091
|
+
* @param name A unique name for the collection dispatcher.
|
|
1092
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1093
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1094
|
+
* The syntax is based on URI Template
|
|
1095
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1096
|
+
* The path must have one or more variables.
|
|
1097
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1098
|
+
*/
|
|
1099
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1102
|
+
*
|
|
1103
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1104
|
+
* @template TObject The type of objects to dispatch.
|
|
1105
|
+
* @template TParam The parameter names of the requested URL.
|
|
1106
|
+
* @param name A unique name for the collection dispatcher.
|
|
1107
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1108
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1109
|
+
* The syntax is based on URI Template
|
|
1110
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1111
|
+
* The path must have one or more variables.
|
|
1112
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1113
|
+
*/
|
|
1114
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
932
1115
|
/**
|
|
933
1116
|
* Registers an ordered collection of objects dispatcher.
|
|
934
1117
|
*
|
|
@@ -943,7 +1126,22 @@ interface Federatable<TContextData> {
|
|
|
943
1126
|
* The path must have one or more variables.
|
|
944
1127
|
* @param dispatcher A collection dispatcher callback to register.
|
|
945
1128
|
*/
|
|
946
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
|
1129
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1132
|
+
*
|
|
1133
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1134
|
+
* @template TObject The type of objects to dispatch.
|
|
1135
|
+
* @template TParam The parameter names of the requested URL.
|
|
1136
|
+
* @param name A unique name for the collection dispatcher.
|
|
1137
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1138
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1139
|
+
* The syntax is based on URI Template
|
|
1140
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1141
|
+
* The path must have one or more variables.
|
|
1142
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1143
|
+
*/
|
|
1144
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
|
947
1145
|
}
|
|
948
1146
|
/**
|
|
949
1147
|
* An object that registers federation-related business logic and dispatches
|
|
@@ -1079,18 +1277,6 @@ interface FederationOptions<TContextData> {
|
|
|
1079
1277
|
* @since 1.4.0
|
|
1080
1278
|
*/
|
|
1081
1279
|
contextLoaderFactory?: DocumentLoaderFactory;
|
|
1082
|
-
/**
|
|
1083
|
-
* A custom JSON-LD document loader. By default, this uses the built-in
|
|
1084
|
-
* cache-backed loader that fetches remote documents over HTTP(S).
|
|
1085
|
-
* @deprecated Use {@link documentLoaderFactory} instead.
|
|
1086
|
-
*/
|
|
1087
|
-
documentLoader?: DocumentLoader;
|
|
1088
|
-
/**
|
|
1089
|
-
* A custom JSON-LD context loader. By default, this uses the same loader
|
|
1090
|
-
* as the document loader.
|
|
1091
|
-
* @deprecated Use {@link contextLoaderFactory} instead.
|
|
1092
|
-
*/
|
|
1093
|
-
contextLoader?: DocumentLoader;
|
|
1094
1280
|
/**
|
|
1095
1281
|
* A factory function that creates an authenticated document loader for a
|
|
1096
1282
|
* given identity. This is used for fetching documents that require
|
|
@@ -1299,6 +1485,36 @@ interface CollectionCallbackSetters<TContext extends Context<TContextData>, TCon
|
|
|
1299
1485
|
*/
|
|
1300
1486
|
authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
|
1301
1487
|
}
|
|
1488
|
+
/**
|
|
1489
|
+
* The strategy for handling activity idempotency in inbox processing.
|
|
1490
|
+
*
|
|
1491
|
+
* - `"global"`: Activities are deduplicated globally across all inboxes and
|
|
1492
|
+
* origins. The same activity ID will be processed only once, regardless
|
|
1493
|
+
* of which inbox receives it or which server sent it.
|
|
1494
|
+
*
|
|
1495
|
+
* - `"per-origin"`: Activities are deduplicated per receiving server's origin.
|
|
1496
|
+
* The same activity ID will be processed only once on each receiving server,
|
|
1497
|
+
* but can be processed separately on different receiving servers. This had
|
|
1498
|
+
* been the default behavior in Fedify 1.x versions.
|
|
1499
|
+
*
|
|
1500
|
+
* - `"per-inbox"`: Activities are deduplicated per inbox. The same activity
|
|
1501
|
+
* ID can be processed once per inbox, allowing the same activity to be
|
|
1502
|
+
* delivered to multiple inboxes independently. This follows standard
|
|
1503
|
+
* ActivityPub behavior and is the default strategy since Fedify 2.0.0.
|
|
1504
|
+
*
|
|
1505
|
+
* @since 1.9.0
|
|
1506
|
+
*/
|
|
1507
|
+
type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
|
|
1508
|
+
/**
|
|
1509
|
+
* A callback to generate a custom idempotency key for an activity.
|
|
1510
|
+
* Returns the cache key to use, or null to skip idempotency checking.
|
|
1511
|
+
* @template TContextData The context data to pass to the {@link InboxContext}.
|
|
1512
|
+
* @param ctx The inbox context.
|
|
1513
|
+
* @param activity The activity being processed.
|
|
1514
|
+
* @returns The idempotency key to use for caching, or null to skip caching.
|
|
1515
|
+
* @since 1.9.0
|
|
1516
|
+
*/
|
|
1517
|
+
type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
|
|
1302
1518
|
/**
|
|
1303
1519
|
* Registry for inbox listeners for different activity types.
|
|
1304
1520
|
*/
|
|
@@ -1329,6 +1545,36 @@ interface InboxListenerSetters<TContextData> {
|
|
|
1329
1545
|
* @since 0.11.0
|
|
1330
1546
|
*/
|
|
1331
1547
|
setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
|
|
1548
|
+
/**
|
|
1549
|
+
* Configures the strategy for handling activity idempotency in inbox processing.
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* Use per-inbox strategy (standard ActivityPub behavior):
|
|
1553
|
+
* ```
|
|
1554
|
+
* federation
|
|
1555
|
+
* .setInboxListeners("/users/{identifier}/inbox", "/inbox")
|
|
1556
|
+
* .withIdempotency("per-inbox");
|
|
1557
|
+
* ```
|
|
1558
|
+
*
|
|
1559
|
+
* Use custom strategy:
|
|
1560
|
+
* ```
|
|
1561
|
+
* federation
|
|
1562
|
+
* .setInboxListeners("/users/{identifier}/inbox", "/inbox")
|
|
1563
|
+
* .withIdempotency((ctx, activity) => {
|
|
1564
|
+
* // Return null to skip idempotency
|
|
1565
|
+
* return `${ctx.origin}:${activity.id?.href}:${ctx.recipient}`;
|
|
1566
|
+
* });
|
|
1567
|
+
* ```
|
|
1568
|
+
*
|
|
1569
|
+
* @param strategy The idempotency strategy to use. Can be:
|
|
1570
|
+
* - `"global"`: Activities are deduplicated across all inboxes and origins
|
|
1571
|
+
* - `"per-origin"`: Activities are deduplicated per inbox origin
|
|
1572
|
+
* - `"per-inbox"`: Activities are deduplicated per inbox
|
|
1573
|
+
* - A custom callback function that returns the cache key to use
|
|
1574
|
+
* @returns The setters object so that settings can be chained.
|
|
1575
|
+
* @since 1.9.0
|
|
1576
|
+
*/
|
|
1577
|
+
withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>;
|
|
1332
1578
|
}
|
|
1333
1579
|
/**
|
|
1334
1580
|
* Parameters of {@link Federation.fetch} method.
|
|
@@ -1367,38 +1613,38 @@ interface FederationFetchOptions<TContextData> {
|
|
|
1367
1613
|
/**
|
|
1368
1614
|
* Additional settings for a custom collection dispatcher.
|
|
1369
1615
|
*
|
|
1370
|
-
* @template
|
|
1616
|
+
* @template TParam The type of the parameters in the URL path.
|
|
1371
1617
|
* @template TContext The type of the context. {@link Context} or
|
|
1372
1618
|
* {@link RequestContext}.
|
|
1373
1619
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
1374
1620
|
* @template TFilter The type of filter for the collection.
|
|
1375
1621
|
*/
|
|
1376
|
-
interface CustomCollectionCallbackSetters<
|
|
1622
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
|
1377
1623
|
/**
|
|
1378
1624
|
* Sets the counter for the custom collection.
|
|
1379
1625
|
* @param counter A callback that returns the number of items in the custom collection.
|
|
1380
1626
|
* @returns The setters object so that settings can be chained.
|
|
1381
1627
|
*/
|
|
1382
|
-
setCounter(counter: CustomCollectionCounter<
|
|
1628
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1383
1629
|
/**
|
|
1384
1630
|
* Sets the first cursor for the custom collection.
|
|
1385
1631
|
* @param cursor The cursor for the first item in the custom collection.
|
|
1386
1632
|
* @returns The setters object so that settings can be chained.
|
|
1387
1633
|
*/
|
|
1388
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
|
1634
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1389
1635
|
/**
|
|
1390
1636
|
* Sets the last cursor for the custom collection.
|
|
1391
1637
|
* @param cursor The cursor for the last item in the custom collection.
|
|
1392
1638
|
* @returns The setters object so that settings can be chained.
|
|
1393
1639
|
*/
|
|
1394
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
|
1640
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1395
1641
|
/**
|
|
1396
1642
|
* Specifies the conditions under which requests are authorized.
|
|
1397
1643
|
* @param predicate A callback that returns whether a request is authorized.
|
|
1398
1644
|
* @returns The setters object so that settings can be chained.
|
|
1399
1645
|
* @since 0.7.0
|
|
1400
1646
|
*/
|
|
1401
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
|
1647
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1402
1648
|
}
|
|
1403
1649
|
/**
|
|
1404
1650
|
* Represents an object with a type ID, which is either a constructor or an
|
|
@@ -1410,73 +1656,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
|
1410
1656
|
typeId: URL;
|
|
1411
1657
|
};
|
|
1412
1658
|
/**
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
* values are their string representations.
|
|
1416
|
-
* @returns A string representing the path with all parameters.
|
|
1417
|
-
* @example
|
|
1418
|
-
* ```ts
|
|
1419
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
|
1420
|
-
* let userPostPath: UserPostPath;
|
|
1421
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
|
1422
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
|
1423
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
|
1424
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
|
1425
|
-
* ```
|
|
1426
|
-
*/
|
|
1427
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
|
1428
|
-
/**
|
|
1429
|
-
* Represents a path with multiple parameters.
|
|
1430
|
-
* All permutations of the parameters are included in the union type.
|
|
1431
|
-
* The path must have all parameters in the form of `{paramName}`.
|
|
1432
|
-
* @param Params - A union of parameter names.
|
|
1433
|
-
* @returns A string representing the path with all parameters.
|
|
1434
|
-
* @example
|
|
1435
|
-
* ```ts
|
|
1436
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
|
1437
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
|
1438
|
-
* // =
|
|
1439
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
|
1440
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
|
1441
|
-
* let userPostPath: UserPostPath;
|
|
1442
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
|
1443
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
|
1444
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
|
1445
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
|
1446
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
|
1447
|
-
*/
|
|
1448
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
|
1449
|
-
/**
|
|
1450
|
-
* Represents a path with a single parameter.
|
|
1451
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
|
1452
|
-
* @param Param - The name of the parameter.
|
|
1453
|
-
* @returns A string representing the path with the parameter.
|
|
1454
|
-
* @example
|
|
1455
|
-
* ```ts
|
|
1456
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
|
1457
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
|
1458
|
-
* let userPostPath: UserPostPath;
|
|
1459
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
|
1460
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
|
1461
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
|
1462
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
|
1463
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
|
1464
|
-
*/
|
|
1465
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
|
1466
|
-
/**
|
|
1467
|
-
* Converts union types to intersection types.
|
|
1659
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
|
1660
|
+
* parameter name.
|
|
1468
1661
|
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1662
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
|
1663
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
|
1664
|
+
* single, named variable.
|
|
1665
|
+
*
|
|
1666
|
+
* The supported expression types are:
|
|
1667
|
+
* - `{Param}`: Simple string expansion
|
|
1668
|
+
* - `+{Param}`: Reserved string expansion
|
|
1669
|
+
* - `#{Param}`: Fragment expansion
|
|
1670
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
|
1671
|
+
* - `{/Param}`: Path segment expansion
|
|
1672
|
+
* - `{;Param}`: Path-style parameter expansion
|
|
1673
|
+
* - `{?Param}`: Query component expansion
|
|
1674
|
+
* - `{&Param}`: Query continuation expansion
|
|
1675
|
+
*
|
|
1676
|
+
* @template Param The name of the parameter to be used in the expressions.
|
|
1471
1677
|
* @example
|
|
1472
1678
|
* ```ts
|
|
1473
|
-
* type
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1679
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
|
1680
|
+
*
|
|
1681
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
|
1682
|
+
* const userPath: UserIdExpression = "{/userId}";
|
|
1683
|
+
* ```
|
|
1684
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
|
1478
1685
|
*/
|
|
1479
|
-
type
|
|
1686
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
|
1480
1687
|
//#endregion
|
|
1481
1688
|
//#region src/federation/context.d.ts
|
|
1482
1689
|
/**
|
|
@@ -1565,9 +1772,7 @@ interface Context<TContextData> {
|
|
|
1565
1772
|
* @throws {TypeError} If values are invalid.
|
|
1566
1773
|
* @since 0.7.0
|
|
1567
1774
|
*/
|
|
1568
|
-
getObjectUri<TObject extends Object$1>(cls:
|
|
1569
|
-
typeId: URL;
|
|
1570
|
-
}, values: Record<string, string>): URL;
|
|
1775
|
+
getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
|
|
1571
1776
|
/**
|
|
1572
1777
|
* Builds the URI of an actor's outbox with the given identifier.
|
|
1573
1778
|
* @param identifier The actor's identifier.
|
|
@@ -1881,9 +2086,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
1881
2086
|
* @throws {TypeError} If values are invalid.
|
|
1882
2087
|
* @since 0.7.0
|
|
1883
2088
|
*/
|
|
1884
|
-
getObject<TObject extends Object$1>(cls:
|
|
1885
|
-
typeId: URL;
|
|
1886
|
-
}, values: Record<string, string>): Promise<TObject | null>;
|
|
2089
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
|
|
1887
2090
|
/**
|
|
1888
2091
|
* Gets the public key of the sender, if any exists and it is verified.
|
|
1889
2092
|
* Otherwise, `null` is returned.
|
|
@@ -2027,9 +2230,7 @@ type ParseUriResult =
|
|
|
2027
2230
|
* The case of an object URI.
|
|
2028
2231
|
*/ | {
|
|
2029
2232
|
readonly type: "object";
|
|
2030
|
-
readonly class:
|
|
2031
|
-
typeId: URL;
|
|
2032
|
-
};
|
|
2233
|
+
readonly class: ConstructorWithTypeId<Object$1>;
|
|
2033
2234
|
readonly typeId: URL;
|
|
2034
2235
|
readonly values: Record<string, string>;
|
|
2035
2236
|
}
|
|
@@ -2247,4 +2448,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2247
2448
|
multikey: Multikey;
|
|
2248
2449
|
}
|
|
2249
2450
|
//#endregion
|
|
2250
|
-
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, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems,
|
|
2451
|
+
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, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|