@fedify/fedify 2.0.0-dev.1690 → 2.0.0-dev.170
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 +70 -34
- 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-_MVsWtsS.js} +9 -8
- package/dist/{client-bgSdkFa2.d.ts → client-CUTUGgvJ.d.ts} +19 -19
- package/dist/{client-CnOdwLLN.js → client-Dg7OfUDA.js} +28 -23
- package/dist/{client-CegPX0Rn.d.cts → client-by-PEGAJ.d.cts} +19 -19
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +6 -12
- package/dist/compat/mod.d.ts +6 -12
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.js +19 -18
- package/dist/context-Bns6uTJq.js +109 -0
- package/dist/{context-ByZprN0S.d.ts → context-C7vzWilY.d.ts} +314 -182
- package/dist/{context-C5BsZkDr.d.cts → context-CrB9RFy5.d.cts} +314 -182
- package/dist/deno-DhWON59o.js +117 -0
- package/dist/{testing-BWNCAbL-.js → dist-B5f6a8Tt.js} +90 -111
- package/dist/{authdocloader-Brax1A32.js → docloader-Cni79dmb.js} +17 -8
- package/dist/{esm-DnIzfEj0.js → esm-DGl7uK1r.js} +32 -17
- package/dist/federation/builder.test.js +11 -11
- package/dist/federation/collection.test.js +5 -8
- package/dist/federation/handler.test.js +111 -24
- package/dist/federation/idempotency.test.js +24 -24
- package/dist/federation/inbox.test.js +5 -6
- package/dist/federation/keycache.test.js +4 -5
- package/dist/federation/kv.test.js +60 -9
- package/dist/federation/middleware.test.js +102 -101
- package/dist/federation/mod.cjs +8 -12
- package/dist/federation/mod.d.cts +7 -13
- package/dist/federation/mod.d.ts +7 -13
- package/dist/federation/mod.js +8 -13
- package/dist/federation/mq.test.js +9 -10
- package/dist/federation/negotiation.test.js +5 -8
- package/dist/federation/retry.test.js +2 -4
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +55 -15
- package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +25 -24
- package/dist/{federation-H2_En3j5.cjs → federation-B431K2gm.cjs} +22 -0
- package/dist/{federation-D1U8YY9t.js → federation-BbZwNNWj.js} +28 -6
- package/dist/{http-C7vbQwbz.cjs → http-7RQPvAkX.cjs} +410 -14
- package/dist/{http-BxbM8sEy.js → http-CZXlv4xU.js} +371 -11
- package/dist/{http-D-e6AFwR.d.cts → http-ClB3pLcL.d.cts} +2 -2
- package/dist/{http-BNOYnVsU.js → http-CwsBL5_A.js} +3 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-DLBDPal9.d.ts} +2 -2
- package/dist/{inbox-BRru9pX3.js → inbox-CukSCwad.js} +2 -1
- package/dist/{key-1KXru8Ug.js → key-DKkHKzvg.js} +3 -2
- package/dist/{keycache-CN61iGVj.js → keycache-DRxpZ5r9.js} +1 -1
- package/dist/{keys-BPdFKgiy.js → keys-ZbcByPg9.js} +2 -1
- package/dist/{kv-63Cil1MD.d.cts → kv-B4vFhIYL.d.cts} +30 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-CYySNrsn.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
- package/dist/kv-cache-BEeqyGER.js +107 -0
- package/dist/kv-cache-BVA7CrnS.cjs +134 -0
- package/dist/kv-cache-HDuc4ZaJ.js +122 -0
- package/dist/{ld-Dv8DNNAT.js → ld-CM6OO5ar.js} +4 -2
- package/dist/middleware--i9t8nKh.js +26 -0
- package/dist/middleware-C567nJlD.cjs +12 -0
- package/dist/middleware-D9oWuacw.js +12 -0
- package/dist/{middleware-DY9B2lL8.js → middleware-DXRcwk_y.js} +185 -192
- package/dist/{middleware-BmoOlgc1.cjs → middleware-TufpQUzj.cjs} +251 -241
- package/dist/{middleware-Bz_A2jeJ.js → middleware-eDeNdyRA.js} +195 -191
- package/dist/mod-0p9zUdzg.d.cts +107 -0
- package/dist/mod-0qnPv4EC.d.cts +62 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-BrS8tiad.d.cts} +3 -3
- package/dist/mod-C3SOvTD1.d.ts +64 -0
- package/dist/{mod-8DMWKtQE.d.cts → mod-D6pS5_xJ.d.cts} +4 -4
- package/dist/{mod-BhUKmBJD.d.ts → mod-jOa7W503.d.ts} +3 -3
- package/dist/{mod-D6hQoxC5.d.ts → mod-waqu-BL_.d.ts} +4 -4
- package/dist/mod-xc20HhMD.d.ts +109 -0
- package/dist/mod.cjs +17 -112
- package/dist/mod.d.cts +11 -17
- package/dist/mod.d.ts +11 -17
- package/dist/mod.js +11 -17
- package/dist/nodeinfo/client.test.js +7 -10
- package/dist/nodeinfo/handler.test.js +23 -23
- 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 +6 -9
- package/dist/otel/exporter.test.js +893 -0
- package/dist/otel/mod.cjs +256 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +255 -0
- package/dist/{owner-e3FYDhsk.js → owner-BOEfZQv2.js} +45 -8
- package/dist/{owner-hd9lvQcP.d.ts → owner-BgI8C-VY.d.ts} +2 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-C-zfmVAD.d.cts} +2 -3
- package/dist/{proof-B-eqv0Ug.cjs → proof-CaDQpGJD.cjs} +69 -33
- package/dist/{proof-DfgvA3al.js → proof-iYIDiv8I.js} +47 -11
- package/dist/{proof-6gFMwMNJ.js → proof-iw6KtIyj.js} +3 -2
- package/dist/router-D9eI0s4b.js +118 -0
- package/dist/{send-Tl9NOnmO.js → send-Bn8o0mjW.js} +9 -4
- package/dist/sig/http.test.js +11 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +7 -11
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +3 -7
- package/dist/sig/owner.test.js +33 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/mod.d.ts +183 -7194
- package/dist/testing/mod.js +4 -4
- package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
- package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
- package/dist/{types-DqxyTxOf.js → types-8l28uC8o.js} +31 -26
- package/dist/{types-zqdWZh4O.cjs → types-B6z6CqIz.cjs} +33 -28
- package/dist/{types-BSuWJsOm.js → types-CPz01LGH.js} +3 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +211 -0
- package/dist/utils/mod.cjs +10 -0
- package/dist/utils/mod.d.cts +4 -0
- package/dist/utils/mod.d.ts +6 -0
- package/dist/utils/mod.js +9 -0
- package/package.json +34 -75
- package/dist/actor-Be0ThtXy.cjs +0 -42609
- package/dist/actor-ChbPLm6n.js +0 -42135
- package/dist/actor-D6K058Tb.d.cts +0 -128
- package/dist/actor-DuCeRiNh.js +0 -146
- package/dist/actor-T6RyhRgk.d.ts +0 -130
- 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/denokv-Bv33Xxea.js +0 -57
- 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/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/media.example.com/avatars/test-avatar.jpg.json +0 -6
- 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-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/mod-CxkWO3Mg.d.cts +0 -307
- package/dist/mod-DBzN0aCM.d.ts +0 -115
- package/dist/mod-DlU8ISoa.d.ts +0 -309
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod-jQ4OODsl.d.cts +0 -113
- package/dist/mq-B7R1Q-M5.d.cts +0 -140
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- 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/type-C69ZBu7f.js +0 -47010
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/actor.test.js +0 -5965
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/lookup.test.js +0 -456
- package/dist/vocab/mod.cjs +0 -87
- package/dist/vocab/mod.d.cts +0 -6
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/vocab/mod.js +0 -10
- package/dist/vocab/schema.yaml +0 -247
- package/dist/vocab/type.test.d.ts +0 -3
- package/dist/vocab/type.test.js +0 -25
- package/dist/vocab/vocab.test.d.ts +0 -3
- package/dist/vocab/vocab.test.js +0 -3787
- package/dist/vocab-B39-pFl9.cjs +0 -291
- package/dist/vocab-BI0Ak5lL.d.ts +0 -14924
- package/dist/vocab-BWoeZsME.js +0 -255
- package/dist/vocab-Dw1-yVGg.d.cts +0 -14922
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.js +0 -195
- package/dist/webfinger/mod.cjs +0 -9
- package/dist/webfinger/mod.d.cts +0 -4
- package/dist/webfinger/mod.d.ts +0 -6
- package/dist/webfinger/mod.js +0 -9
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- package/dist/x/cfworkers.cjs +0 -100
- package/dist/x/cfworkers.d.cts +0 -59
- 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.cjs +0 -61
- package/dist/x/hono.d.cts +0 -54
- package/dist/x/hono.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.cjs +0 -69
- package/dist/x/sveltekit.d.cts +0 -46
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/webfinger.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-1E3W847c.d.ts} +0 -0
- /package/dist/{mod-C2tOeRkN.d.cts → mod-C81L6_lQ.d.cts} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BlLsRSiT.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-CwuONEzF.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DeXX2xnj.cjs} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.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
- /package/dist/{sig-ByHXzqUi.cjs → utils-Db0ZmjcD.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-Wranxuoe.js} +0 -0
|
@@ -1,16 +1,13 @@
|
|
|
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 { Actor, Recipient } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-DBzN0aCM.js";
|
|
12
|
-
import { MessageQueue } from "./mq-CRGm1e_F.js";
|
|
13
|
-
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
3
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-CUTUGgvJ.js";
|
|
4
|
+
import { HttpMessageSignaturesSpec } from "./http-DLBDPal9.js";
|
|
5
|
+
import { GetKeyOwnerOptions } from "./owner-BgI8C-VY.js";
|
|
6
|
+
import { KvKey, KvStore } from "./kv-CYySNrsn.js";
|
|
7
|
+
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
|
|
8
|
+
import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
9
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
10
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
14
11
|
|
|
15
12
|
//#region src/compat/types.d.ts
|
|
16
13
|
/**
|
|
@@ -24,9 +21,9 @@ type ActivityTransformer<TContextData> = (activity: Activity, context: Context<T
|
|
|
24
21
|
* A page of items.
|
|
25
22
|
*/
|
|
26
23
|
interface PageItems<TItem> {
|
|
27
|
-
prevCursor?: string | null;
|
|
28
|
-
nextCursor?: string | null;
|
|
29
|
-
items: TItem[];
|
|
24
|
+
readonly prevCursor?: string | null;
|
|
25
|
+
readonly nextCursor?: string | null;
|
|
26
|
+
readonly items: readonly TItem[];
|
|
30
27
|
}
|
|
31
28
|
/**
|
|
32
29
|
* Calculates the [partial follower collection digest][1].
|
|
@@ -56,11 +53,11 @@ interface SenderKeyPair {
|
|
|
56
53
|
/**
|
|
57
54
|
* The actor's private key to sign the request.
|
|
58
55
|
*/
|
|
59
|
-
privateKey: CryptoKey;
|
|
56
|
+
readonly privateKey: CryptoKey;
|
|
60
57
|
/**
|
|
61
58
|
* The public key ID that corresponds to the private key.
|
|
62
59
|
*/
|
|
63
|
-
keyId: URL;
|
|
60
|
+
readonly keyId: URL;
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
66
63
|
* Parameters for {@link sendActivity}.
|
|
@@ -283,7 +280,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
|
283
280
|
* the entire collection without pagination.
|
|
284
281
|
* @since 1.8.0
|
|
285
282
|
*/
|
|
286
|
-
type CustomCollectionDispatcher<TItem,
|
|
283
|
+
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
284
|
/**
|
|
288
285
|
* A callback that counts the number of items in a custom collection.
|
|
289
286
|
*
|
|
@@ -293,7 +290,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
|
293
290
|
* @param values The parameters of the requested URL.
|
|
294
291
|
* @since 1.8.0
|
|
295
292
|
*/
|
|
296
|
-
type CustomCollectionCounter<
|
|
293
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
|
297
294
|
/**
|
|
298
295
|
* A callback that returns a cursor for a custom collection.
|
|
299
296
|
*
|
|
@@ -306,10 +303,148 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
|
306
303
|
* @param values The parameters of the requested URL.
|
|
307
304
|
* @since 1.8.0
|
|
308
305
|
*/
|
|
309
|
-
type CustomCollectionCursor<
|
|
306
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/federation/mq.d.ts
|
|
309
|
+
/**
|
|
310
|
+
* Additional options for enqueuing a message in a queue.
|
|
311
|
+
*
|
|
312
|
+
* @since 0.5.0
|
|
313
|
+
*/
|
|
314
|
+
interface MessageQueueEnqueueOptions {
|
|
315
|
+
/**
|
|
316
|
+
* The delay before the message is enqueued. No delay by default.
|
|
317
|
+
*
|
|
318
|
+
* It must not be negative.
|
|
319
|
+
*/
|
|
320
|
+
delay?: Temporal.Duration;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Additional options for listening to a message queue.
|
|
324
|
+
*
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
*/
|
|
327
|
+
interface MessageQueueListenOptions {
|
|
328
|
+
/**
|
|
329
|
+
* The signal to abort listening to the message queue.
|
|
330
|
+
*/
|
|
331
|
+
signal?: AbortSignal;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* An abstract interface for a message queue.
|
|
335
|
+
*
|
|
336
|
+
* @since 0.5.0
|
|
337
|
+
*/
|
|
338
|
+
interface MessageQueue {
|
|
339
|
+
/**
|
|
340
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
341
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
342
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
343
|
+
* using its own retry policies.
|
|
344
|
+
*
|
|
345
|
+
* @default `false`
|
|
346
|
+
* @since 1.7.0
|
|
347
|
+
*/
|
|
348
|
+
readonly nativeRetrial?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Enqueues a message in the queue.
|
|
351
|
+
* @param message The message to enqueue.
|
|
352
|
+
* @param options Additional options for enqueuing the message.
|
|
353
|
+
*/
|
|
354
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
357
|
+
* and may not be supported by all implementations. If not supported,
|
|
358
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
359
|
+
*
|
|
360
|
+
* @param messages The messages to enqueue.
|
|
361
|
+
* @param options Additional options for enqueuing the messages.
|
|
362
|
+
*/
|
|
363
|
+
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* Listens for messages in the queue.
|
|
366
|
+
* @param handler The handler for messages in the queue.
|
|
367
|
+
* @param options Additional options for listening to the message queue.
|
|
368
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
369
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
370
|
+
* signal is provided, it never resolves.
|
|
371
|
+
*/
|
|
372
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
376
|
+
* @since 1.0.0
|
|
377
|
+
*/
|
|
378
|
+
interface InProcessMessageQueueOptions {
|
|
379
|
+
/**
|
|
380
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
381
|
+
* @default `{ seconds: 5 }`
|
|
382
|
+
*/
|
|
383
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* A message queue that processes messages in the same process.
|
|
387
|
+
* Do not use this in production as it does neither persist messages nor
|
|
388
|
+
* distribute them across multiple processes.
|
|
389
|
+
*
|
|
390
|
+
* @since 0.5.0
|
|
391
|
+
*/
|
|
392
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
393
|
+
#private;
|
|
394
|
+
/**
|
|
395
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
396
|
+
* @since 1.7.0
|
|
397
|
+
*/
|
|
398
|
+
readonly nativeRetrial = false;
|
|
399
|
+
/**
|
|
400
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
401
|
+
* @param options Additional options for the in-process message queue.
|
|
402
|
+
*/
|
|
403
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
404
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
405
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
406
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* A message queue that processes messages in parallel. It takes another
|
|
410
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
411
|
+
* number of workers.
|
|
412
|
+
*
|
|
413
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
414
|
+
*
|
|
415
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
416
|
+
* are not running in separate threads or processes. They are running in the
|
|
417
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
418
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
419
|
+
* workloads.
|
|
420
|
+
*
|
|
421
|
+
* @since 1.0.0
|
|
422
|
+
*/
|
|
423
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
424
|
+
#private;
|
|
425
|
+
readonly queue: MessageQueue;
|
|
426
|
+
readonly workers: number;
|
|
427
|
+
/**
|
|
428
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
429
|
+
* @since 1.7.0
|
|
430
|
+
*/
|
|
431
|
+
readonly nativeRetrial?: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
434
|
+
* number of workers.
|
|
435
|
+
* @param queue The message queue to use under the hood. Note that
|
|
436
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
437
|
+
* @param workers The number of workers to process messages in parallel.
|
|
438
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
439
|
+
* {@link ParallelMessageQueue}.
|
|
440
|
+
*/
|
|
441
|
+
constructor(queue: MessageQueue, workers: number);
|
|
442
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
443
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
444
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
445
|
+
}
|
|
310
446
|
//#endregion
|
|
311
447
|
//#region src/federation/handler.d.ts
|
|
312
|
-
|
|
313
448
|
/**
|
|
314
449
|
* Options for the {@link respondWithObject} and
|
|
315
450
|
* {@link respondWithObjectIfAcceptable} functions.
|
|
@@ -436,8 +571,8 @@ declare function createFederationBuilder<TContextData>(): FederationBuilder<TCon
|
|
|
436
571
|
//#endregion
|
|
437
572
|
//#region src/federation/queue.d.ts
|
|
438
573
|
interface SenderKeyJwkPair {
|
|
439
|
-
keyId: string;
|
|
440
|
-
privateKey: JsonWebKey;
|
|
574
|
+
readonly keyId: string;
|
|
575
|
+
readonly privateKey: JsonWebKey;
|
|
441
576
|
}
|
|
442
577
|
/**
|
|
443
578
|
* A message that represents a task to be processed by the background worker.
|
|
@@ -450,44 +585,44 @@ interface SenderKeyJwkPair {
|
|
|
450
585
|
*/
|
|
451
586
|
type Message = FanoutMessage | OutboxMessage | InboxMessage;
|
|
452
587
|
interface FanoutMessage {
|
|
453
|
-
type: "fanout";
|
|
454
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
455
|
-
baseUrl: string;
|
|
456
|
-
keys: SenderKeyJwkPair[];
|
|
457
|
-
inboxes: Record<string, {
|
|
458
|
-
actorIds: string[];
|
|
459
|
-
sharedInbox: boolean;
|
|
460
|
-
}
|
|
461
|
-
activity: unknown;
|
|
462
|
-
activityId?: string;
|
|
463
|
-
activityType: string;
|
|
464
|
-
collectionSync?: string;
|
|
465
|
-
traceContext: Record<string, string
|
|
588
|
+
readonly type: "fanout";
|
|
589
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
590
|
+
readonly baseUrl: string;
|
|
591
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
592
|
+
readonly inboxes: Readonly<Record<string, {
|
|
593
|
+
readonly actorIds: readonly string[];
|
|
594
|
+
readonly sharedInbox: boolean;
|
|
595
|
+
}>>;
|
|
596
|
+
readonly activity: unknown;
|
|
597
|
+
readonly activityId?: string;
|
|
598
|
+
readonly activityType: string;
|
|
599
|
+
readonly collectionSync?: string;
|
|
600
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
466
601
|
}
|
|
467
602
|
interface OutboxMessage {
|
|
468
|
-
type: "outbox";
|
|
469
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
470
|
-
baseUrl: string;
|
|
471
|
-
keys: SenderKeyJwkPair[];
|
|
472
|
-
activity: unknown;
|
|
473
|
-
activityId?: string;
|
|
474
|
-
activityType: string;
|
|
475
|
-
inbox: string;
|
|
476
|
-
sharedInbox: boolean;
|
|
477
|
-
started: string;
|
|
478
|
-
attempt: number;
|
|
479
|
-
headers: Record<string, string
|
|
480
|
-
traceContext: Record<string, string
|
|
603
|
+
readonly type: "outbox";
|
|
604
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
605
|
+
readonly baseUrl: string;
|
|
606
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
607
|
+
readonly activity: unknown;
|
|
608
|
+
readonly activityId?: string;
|
|
609
|
+
readonly activityType: string;
|
|
610
|
+
readonly inbox: string;
|
|
611
|
+
readonly sharedInbox: boolean;
|
|
612
|
+
readonly started: string;
|
|
613
|
+
readonly attempt: number;
|
|
614
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
615
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
481
616
|
}
|
|
482
617
|
interface InboxMessage {
|
|
483
|
-
type: "inbox";
|
|
484
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
485
|
-
baseUrl: string;
|
|
486
|
-
activity: unknown;
|
|
487
|
-
started: string;
|
|
488
|
-
attempt: number;
|
|
489
|
-
identifier: string | null;
|
|
490
|
-
traceContext: Record<string, string
|
|
618
|
+
readonly type: "inbox";
|
|
619
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
620
|
+
readonly baseUrl: string;
|
|
621
|
+
readonly activity: unknown;
|
|
622
|
+
readonly started: string;
|
|
623
|
+
readonly attempt: number;
|
|
624
|
+
readonly identifier: string | null;
|
|
625
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
491
626
|
}
|
|
492
627
|
//#endregion
|
|
493
628
|
//#region src/federation/retry.d.ts
|
|
@@ -571,19 +706,19 @@ interface FederationQueueOptions {
|
|
|
571
706
|
* The message queue for incoming activities. If not provided, incoming
|
|
572
707
|
* activities will not be queued and will be processed immediately.
|
|
573
708
|
*/
|
|
574
|
-
inbox?: MessageQueue;
|
|
709
|
+
readonly inbox?: MessageQueue;
|
|
575
710
|
/**
|
|
576
711
|
* The message queue for outgoing activities. If not provided, outgoing
|
|
577
712
|
* activities will not be queued and will be sent immediately.
|
|
578
713
|
*/
|
|
579
|
-
outbox?: MessageQueue;
|
|
714
|
+
readonly outbox?: MessageQueue;
|
|
580
715
|
/**
|
|
581
716
|
* The message queue for fanning out outgoing activities. If not provided,
|
|
582
717
|
* outgoing activities will not be fanned out in the background, but will be
|
|
583
718
|
* fanned out immediately, which causes slow response times on
|
|
584
719
|
* {@link Context.sendActivity} calls.
|
|
585
720
|
*/
|
|
586
|
-
fanout?: MessageQueue;
|
|
721
|
+
readonly fanout?: MessageQueue;
|
|
587
722
|
}
|
|
588
723
|
/**
|
|
589
724
|
* Prefixes for namespacing keys in the Deno KV store.
|
|
@@ -594,18 +729,18 @@ interface FederationKvPrefixes {
|
|
|
594
729
|
* processed or not.
|
|
595
730
|
* @default `["_fedify", "activityIdempotence"]`
|
|
596
731
|
*/
|
|
597
|
-
activityIdempotence: KvKey;
|
|
732
|
+
readonly activityIdempotence: KvKey;
|
|
598
733
|
/**
|
|
599
734
|
* The key prefix used for storing remote JSON-LD documents.
|
|
600
735
|
* @default `["_fedify", "remoteDocument"]`
|
|
601
736
|
*/
|
|
602
|
-
remoteDocument: KvKey;
|
|
737
|
+
readonly remoteDocument: KvKey;
|
|
603
738
|
/**
|
|
604
739
|
* The key prefix used for caching public keys.
|
|
605
740
|
* @default `["_fedify", "publicKey"]`
|
|
606
741
|
* @since 0.12.0
|
|
607
742
|
*/
|
|
608
|
-
publicKey: KvKey;
|
|
743
|
+
readonly publicKey: KvKey;
|
|
609
744
|
/**
|
|
610
745
|
* The key prefix used for caching HTTP Message Signatures specs.
|
|
611
746
|
* The cached spec is used to reduce the number of requests to make signed
|
|
@@ -613,7 +748,7 @@ interface FederationKvPrefixes {
|
|
|
613
748
|
* @default `["_fedify", "httpMessageSignaturesSpec"]`
|
|
614
749
|
* @since 1.6.0
|
|
615
750
|
*/
|
|
616
|
-
httpMessageSignaturesSpec: KvKey;
|
|
751
|
+
readonly httpMessageSignaturesSpec: KvKey;
|
|
617
752
|
}
|
|
618
753
|
/**
|
|
619
754
|
* Options for {@link CreateFederationOptions.origin} when it is not a string.
|
|
@@ -704,7 +839,7 @@ interface Federatable<TContextData> {
|
|
|
704
839
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
|
705
840
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
706
841
|
*/
|
|
707
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
842
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
708
843
|
/**
|
|
709
844
|
* Registers an object dispatcher.
|
|
710
845
|
*
|
|
@@ -718,9 +853,7 @@ interface Federatable<TContextData> {
|
|
|
718
853
|
* must have one or more variables.
|
|
719
854
|
* @param dispatcher An object dispatcher callback to register.
|
|
720
855
|
*/
|
|
721
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
722
|
-
typeId: URL;
|
|
723
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
856
|
+
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>;
|
|
724
857
|
/**
|
|
725
858
|
* Registers an object dispatcher.
|
|
726
859
|
*
|
|
@@ -734,9 +867,7 @@ interface Federatable<TContextData> {
|
|
|
734
867
|
* must have one or more variables.
|
|
735
868
|
* @param dispatcher An object dispatcher callback to register.
|
|
736
869
|
*/
|
|
737
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
738
|
-
typeId: URL;
|
|
739
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
870
|
+
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>;
|
|
740
871
|
/**
|
|
741
872
|
* Registers an object dispatcher.
|
|
742
873
|
*
|
|
@@ -750,9 +881,7 @@ interface Federatable<TContextData> {
|
|
|
750
881
|
* must have one or more variables.
|
|
751
882
|
* @param dispatcher An object dispatcher callback to register.
|
|
752
883
|
*/
|
|
753
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
754
|
-
typeId: URL;
|
|
755
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
884
|
+
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>;
|
|
756
885
|
/**
|
|
757
886
|
* Registers an object dispatcher.
|
|
758
887
|
*
|
|
@@ -766,9 +895,7 @@ interface Federatable<TContextData> {
|
|
|
766
895
|
* must have one or more variables.
|
|
767
896
|
* @param dispatcher An object dispatcher callback to register.
|
|
768
897
|
*/
|
|
769
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
770
|
-
typeId: URL;
|
|
771
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
898
|
+
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>;
|
|
772
899
|
/**
|
|
773
900
|
* Registers an object dispatcher.
|
|
774
901
|
*
|
|
@@ -782,9 +909,7 @@ interface Federatable<TContextData> {
|
|
|
782
909
|
* must have one or more variables.
|
|
783
910
|
* @param dispatcher An object dispatcher callback to register.
|
|
784
911
|
*/
|
|
785
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
786
|
-
typeId: URL;
|
|
787
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
912
|
+
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>;
|
|
788
913
|
/**
|
|
789
914
|
* Registers an object dispatcher.
|
|
790
915
|
*
|
|
@@ -798,9 +923,7 @@ interface Federatable<TContextData> {
|
|
|
798
923
|
* must have one or more variables.
|
|
799
924
|
* @param dispatcher An object dispatcher callback to register.
|
|
800
925
|
*/
|
|
801
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
802
|
-
typeId: URL;
|
|
803
|
-
}, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
926
|
+
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>;
|
|
804
927
|
/**
|
|
805
928
|
* Registers an inbox dispatcher.
|
|
806
929
|
*
|
|
@@ -812,7 +935,7 @@ interface Federatable<TContextData> {
|
|
|
812
935
|
* @param dispatcher An inbox dispatcher callback to register.
|
|
813
936
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
814
937
|
*/
|
|
815
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
938
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
816
939
|
/**
|
|
817
940
|
* Registers an outbox dispatcher.
|
|
818
941
|
*
|
|
@@ -836,7 +959,7 @@ interface Federatable<TContextData> {
|
|
|
836
959
|
* @param dispatcher An outbox dispatcher callback to register.
|
|
837
960
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
838
961
|
*/
|
|
839
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
962
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
840
963
|
/**
|
|
841
964
|
* Registers a following collection dispatcher.
|
|
842
965
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -848,7 +971,7 @@ interface Federatable<TContextData> {
|
|
|
848
971
|
* callbacks.
|
|
849
972
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
850
973
|
*/
|
|
851
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
974
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
852
975
|
/**
|
|
853
976
|
* Registers a followers collection dispatcher.
|
|
854
977
|
* @param path The URI path pattern for the followers collection. The syntax
|
|
@@ -860,7 +983,7 @@ interface Federatable<TContextData> {
|
|
|
860
983
|
* callbacks.
|
|
861
984
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
862
985
|
*/
|
|
863
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
986
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
864
987
|
/**
|
|
865
988
|
* Registers a liked collection dispatcher.
|
|
866
989
|
* @param path The URI path pattern for the liked collection. The syntax
|
|
@@ -872,7 +995,7 @@ interface Federatable<TContextData> {
|
|
|
872
995
|
* callbacks.
|
|
873
996
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
874
997
|
*/
|
|
875
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
998
|
+
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
999
|
/**
|
|
877
1000
|
* Registers a featured collection dispatcher.
|
|
878
1001
|
* @param path The URI path pattern for the featured collection. The syntax
|
|
@@ -884,7 +1007,7 @@ interface Federatable<TContextData> {
|
|
|
884
1007
|
* callbacks.
|
|
885
1008
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
886
1009
|
*/
|
|
887
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1010
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
888
1011
|
/**
|
|
889
1012
|
* Registers a featured tags collection dispatcher.
|
|
890
1013
|
* @param path The URI path pattern for the featured tags collection.
|
|
@@ -896,7 +1019,7 @@ interface Federatable<TContextData> {
|
|
|
896
1019
|
* callbacks.
|
|
897
1020
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
898
1021
|
*/
|
|
899
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1022
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
900
1023
|
/**
|
|
901
1024
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
|
902
1025
|
*
|
|
@@ -926,7 +1049,37 @@ interface Federatable<TContextData> {
|
|
|
926
1049
|
* @returns An object to register inbox listeners.
|
|
927
1050
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
|
928
1051
|
*/
|
|
929
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1052
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Registers a collection of objects dispatcher.
|
|
1055
|
+
*
|
|
1056
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1057
|
+
* @template TObject The type of objects to dispatch.
|
|
1058
|
+
* @template TParam The parameter names of the requested URL.
|
|
1059
|
+
* @param name A unique name for the collection dispatcher.
|
|
1060
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1061
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1062
|
+
* The syntax is based on URI Template
|
|
1063
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1064
|
+
* The path must have one or more variables.
|
|
1065
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1066
|
+
*/
|
|
1067
|
+
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>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Registers a collection of objects dispatcher.
|
|
1070
|
+
*
|
|
1071
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1072
|
+
* @template TObject The type of objects to dispatch.
|
|
1073
|
+
* @template TParam The parameter names of the requested URL.
|
|
1074
|
+
* @param name A unique name for the collection dispatcher.
|
|
1075
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1076
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1077
|
+
* The syntax is based on URI Template
|
|
1078
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1079
|
+
* The path must have one or more variables.
|
|
1080
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1081
|
+
*/
|
|
1082
|
+
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>;
|
|
930
1083
|
/**
|
|
931
1084
|
* Registers a collection of objects dispatcher.
|
|
932
1085
|
*
|
|
@@ -941,7 +1094,37 @@ interface Federatable<TContextData> {
|
|
|
941
1094
|
* The path must have one or more variables.
|
|
942
1095
|
* @param dispatcher A collection dispatcher callback to register.
|
|
943
1096
|
*/
|
|
944
|
-
setCollectionDispatcher<TObject extends Object$1,
|
|
1097
|
+
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>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1100
|
+
*
|
|
1101
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1102
|
+
* @template TObject The type of objects to dispatch.
|
|
1103
|
+
* @template TParam The parameter names of the requested URL.
|
|
1104
|
+
* @param name A unique name for the collection dispatcher.
|
|
1105
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1106
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1107
|
+
* The syntax is based on URI Template
|
|
1108
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1109
|
+
* The path must have one or more variables.
|
|
1110
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1111
|
+
*/
|
|
1112
|
+
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>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1115
|
+
*
|
|
1116
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1117
|
+
* @template TObject The type of objects to dispatch.
|
|
1118
|
+
* @template TParam The parameter names of the requested URL.
|
|
1119
|
+
* @param name A unique name for the collection dispatcher.
|
|
1120
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1121
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1122
|
+
* The syntax is based on URI Template
|
|
1123
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1124
|
+
* The path must have one or more variables.
|
|
1125
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1126
|
+
*/
|
|
1127
|
+
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>;
|
|
945
1128
|
/**
|
|
946
1129
|
* Registers an ordered collection of objects dispatcher.
|
|
947
1130
|
*
|
|
@@ -956,7 +1139,7 @@ interface Federatable<TContextData> {
|
|
|
956
1139
|
* The path must have one or more variables.
|
|
957
1140
|
* @param dispatcher A collection dispatcher callback to register.
|
|
958
1141
|
*/
|
|
959
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
|
1142
|
+
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>;
|
|
960
1143
|
}
|
|
961
1144
|
/**
|
|
962
1145
|
* An object that registers federation-related business logic and dispatches
|
|
@@ -1092,12 +1275,6 @@ interface FederationOptions<TContextData> {
|
|
|
1092
1275
|
* @since 1.4.0
|
|
1093
1276
|
*/
|
|
1094
1277
|
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
1278
|
/**
|
|
1102
1279
|
* A factory function that creates an authenticated document loader for a
|
|
1103
1280
|
* given identity. This is used for fetching documents that require
|
|
@@ -1434,38 +1611,38 @@ interface FederationFetchOptions<TContextData> {
|
|
|
1434
1611
|
/**
|
|
1435
1612
|
* Additional settings for a custom collection dispatcher.
|
|
1436
1613
|
*
|
|
1437
|
-
* @template
|
|
1614
|
+
* @template TParam The type of the parameters in the URL path.
|
|
1438
1615
|
* @template TContext The type of the context. {@link Context} or
|
|
1439
1616
|
* {@link RequestContext}.
|
|
1440
1617
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
1441
1618
|
* @template TFilter The type of filter for the collection.
|
|
1442
1619
|
*/
|
|
1443
|
-
interface CustomCollectionCallbackSetters<
|
|
1620
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
|
1444
1621
|
/**
|
|
1445
1622
|
* Sets the counter for the custom collection.
|
|
1446
1623
|
* @param counter A callback that returns the number of items in the custom collection.
|
|
1447
1624
|
* @returns The setters object so that settings can be chained.
|
|
1448
1625
|
*/
|
|
1449
|
-
setCounter(counter: CustomCollectionCounter<
|
|
1626
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1450
1627
|
/**
|
|
1451
1628
|
* Sets the first cursor for the custom collection.
|
|
1452
1629
|
* @param cursor The cursor for the first item in the custom collection.
|
|
1453
1630
|
* @returns The setters object so that settings can be chained.
|
|
1454
1631
|
*/
|
|
1455
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
|
1632
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1456
1633
|
/**
|
|
1457
1634
|
* Sets the last cursor for the custom collection.
|
|
1458
1635
|
* @param cursor The cursor for the last item in the custom collection.
|
|
1459
1636
|
* @returns The setters object so that settings can be chained.
|
|
1460
1637
|
*/
|
|
1461
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
|
1638
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1462
1639
|
/**
|
|
1463
1640
|
* Specifies the conditions under which requests are authorized.
|
|
1464
1641
|
* @param predicate A callback that returns whether a request is authorized.
|
|
1465
1642
|
* @returns The setters object so that settings can be chained.
|
|
1466
1643
|
* @since 0.7.0
|
|
1467
1644
|
*/
|
|
1468
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
|
1645
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1469
1646
|
}
|
|
1470
1647
|
/**
|
|
1471
1648
|
* Represents an object with a type ID, which is either a constructor or an
|
|
@@ -1477,73 +1654,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
|
1477
1654
|
typeId: URL;
|
|
1478
1655
|
};
|
|
1479
1656
|
/**
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
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.
|
|
1657
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
|
1658
|
+
* parameter name.
|
|
1659
|
+
*
|
|
1660
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
|
1661
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
|
1662
|
+
* single, named variable.
|
|
1535
1663
|
*
|
|
1536
|
-
*
|
|
1537
|
-
*
|
|
1664
|
+
* The supported expression types are:
|
|
1665
|
+
* - `{Param}`: Simple string expansion
|
|
1666
|
+
* - `+{Param}`: Reserved string expansion
|
|
1667
|
+
* - `#{Param}`: Fragment expansion
|
|
1668
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
|
1669
|
+
* - `{/Param}`: Path segment expansion
|
|
1670
|
+
* - `{;Param}`: Path-style parameter expansion
|
|
1671
|
+
* - `{?Param}`: Query component expansion
|
|
1672
|
+
* - `{&Param}`: Query continuation expansion
|
|
1673
|
+
*
|
|
1674
|
+
* @template Param The name of the parameter to be used in the expressions.
|
|
1538
1675
|
* @example
|
|
1539
1676
|
* ```ts
|
|
1540
|
-
* type
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1677
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
|
1678
|
+
*
|
|
1679
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
|
1680
|
+
* const userPath: UserIdExpression = "{/userId}";
|
|
1681
|
+
* ```
|
|
1682
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
|
1545
1683
|
*/
|
|
1546
|
-
type
|
|
1684
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
|
1547
1685
|
//#endregion
|
|
1548
1686
|
//#region src/federation/context.d.ts
|
|
1549
1687
|
/**
|
|
@@ -1632,9 +1770,7 @@ interface Context<TContextData> {
|
|
|
1632
1770
|
* @throws {TypeError} If values are invalid.
|
|
1633
1771
|
* @since 0.7.0
|
|
1634
1772
|
*/
|
|
1635
|
-
getObjectUri<TObject extends Object$1>(cls:
|
|
1636
|
-
typeId: URL;
|
|
1637
|
-
}, values: Record<string, string>): URL;
|
|
1773
|
+
getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
|
|
1638
1774
|
/**
|
|
1639
1775
|
* Builds the URI of an actor's outbox with the given identifier.
|
|
1640
1776
|
* @param identifier The actor's identifier.
|
|
@@ -1948,9 +2084,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
1948
2084
|
* @throws {TypeError} If values are invalid.
|
|
1949
2085
|
* @since 0.7.0
|
|
1950
2086
|
*/
|
|
1951
|
-
getObject<TObject extends Object$1>(cls:
|
|
1952
|
-
typeId: URL;
|
|
1953
|
-
}, values: Record<string, string>): Promise<TObject | null>;
|
|
2087
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
|
|
1954
2088
|
/**
|
|
1955
2089
|
* Gets the public key of the sender, if any exists and it is verified.
|
|
1956
2090
|
* Otherwise, `null` is returned.
|
|
@@ -2028,7 +2162,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2028
2162
|
* inbox, it is `null`.
|
|
2029
2163
|
* @since 1.2.0
|
|
2030
2164
|
*/
|
|
2031
|
-
recipient: string | null;
|
|
2165
|
+
readonly recipient: string | null;
|
|
2032
2166
|
/**
|
|
2033
2167
|
* Creates a new context with the same properties as this one,
|
|
2034
2168
|
* but with the given data.
|
|
@@ -2094,9 +2228,7 @@ type ParseUriResult =
|
|
|
2094
2228
|
* The case of an object URI.
|
|
2095
2229
|
*/ | {
|
|
2096
2230
|
readonly type: "object";
|
|
2097
|
-
readonly class:
|
|
2098
|
-
typeId: URL;
|
|
2099
|
-
};
|
|
2231
|
+
readonly class: ConstructorWithTypeId<Object$1>;
|
|
2100
2232
|
readonly typeId: URL;
|
|
2101
2233
|
readonly values: Record<string, string>;
|
|
2102
2234
|
}
|
|
@@ -2220,7 +2352,7 @@ interface SendActivityOptions {
|
|
|
2220
2352
|
*
|
|
2221
2353
|
* @since 0.9.0
|
|
2222
2354
|
*/
|
|
2223
|
-
excludeBaseUris?: URL[];
|
|
2355
|
+
readonly excludeBaseUris?: readonly URL[];
|
|
2224
2356
|
}
|
|
2225
2357
|
/**
|
|
2226
2358
|
* Options for {@link Context.sendActivity} method when sending to a collection.
|
|
@@ -2303,15 +2435,15 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2303
2435
|
/**
|
|
2304
2436
|
* The URI of the public key, which is used for verifying HTTP Signatures.
|
|
2305
2437
|
*/
|
|
2306
|
-
keyId: URL;
|
|
2438
|
+
readonly keyId: URL;
|
|
2307
2439
|
/**
|
|
2308
2440
|
* A {@link CryptographicKey} instance of the public key.
|
|
2309
2441
|
*/
|
|
2310
|
-
cryptographicKey: CryptographicKey;
|
|
2442
|
+
readonly cryptographicKey: CryptographicKey;
|
|
2311
2443
|
/**
|
|
2312
2444
|
* A {@link Multikey} instance of the public key.
|
|
2313
2445
|
*/
|
|
2314
|
-
multikey: Multikey;
|
|
2446
|
+
readonly multikey: Multikey;
|
|
2315
2447
|
}
|
|
2316
2448
|
//#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,
|
|
2449
|
+
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 };
|