@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,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Actor, Recipient } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-jQ4OODsl.cjs";
|
|
10
|
-
import { MessageQueue } from "./mq-B7R1Q-M5.cjs";
|
|
11
|
-
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
1
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-by-PEGAJ.cjs";
|
|
2
|
+
import { HttpMessageSignaturesSpec } from "./http-ClB3pLcL.cjs";
|
|
3
|
+
import { GetKeyOwnerOptions } from "./owner-C-zfmVAD.cjs";
|
|
4
|
+
import { KvKey, KvStore } from "./kv-B4vFhIYL.cjs";
|
|
5
|
+
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
|
|
6
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
7
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
8
|
+
import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
12
9
|
|
|
13
10
|
//#region src/compat/types.d.ts
|
|
14
11
|
/**
|
|
@@ -22,9 +19,9 @@ type ActivityTransformer<TContextData> = (activity: Activity, context: Context<T
|
|
|
22
19
|
* A page of items.
|
|
23
20
|
*/
|
|
24
21
|
interface PageItems<TItem> {
|
|
25
|
-
prevCursor?: string | null;
|
|
26
|
-
nextCursor?: string | null;
|
|
27
|
-
items: TItem[];
|
|
22
|
+
readonly prevCursor?: string | null;
|
|
23
|
+
readonly nextCursor?: string | null;
|
|
24
|
+
readonly items: readonly TItem[];
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Calculates the [partial follower collection digest][1].
|
|
@@ -54,11 +51,11 @@ interface SenderKeyPair {
|
|
|
54
51
|
/**
|
|
55
52
|
* The actor's private key to sign the request.
|
|
56
53
|
*/
|
|
57
|
-
privateKey: CryptoKey;
|
|
54
|
+
readonly privateKey: CryptoKey;
|
|
58
55
|
/**
|
|
59
56
|
* The public key ID that corresponds to the private key.
|
|
60
57
|
*/
|
|
61
|
-
keyId: URL;
|
|
58
|
+
readonly keyId: URL;
|
|
62
59
|
}
|
|
63
60
|
/**
|
|
64
61
|
* Parameters for {@link sendActivity}.
|
|
@@ -281,7 +278,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
|
281
278
|
* the entire collection without pagination.
|
|
282
279
|
* @since 1.8.0
|
|
283
280
|
*/
|
|
284
|
-
type CustomCollectionDispatcher<TItem,
|
|
281
|
+
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>;
|
|
285
282
|
/**
|
|
286
283
|
* A callback that counts the number of items in a custom collection.
|
|
287
284
|
*
|
|
@@ -291,7 +288,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
|
291
288
|
* @param values The parameters of the requested URL.
|
|
292
289
|
* @since 1.8.0
|
|
293
290
|
*/
|
|
294
|
-
type CustomCollectionCounter<
|
|
291
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
|
295
292
|
/**
|
|
296
293
|
* A callback that returns a cursor for a custom collection.
|
|
297
294
|
*
|
|
@@ -304,10 +301,148 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
|
304
301
|
* @param values The parameters of the requested URL.
|
|
305
302
|
* @since 1.8.0
|
|
306
303
|
*/
|
|
307
|
-
type CustomCollectionCursor<
|
|
304
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/federation/mq.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* Additional options for enqueuing a message in a queue.
|
|
309
|
+
*
|
|
310
|
+
* @since 0.5.0
|
|
311
|
+
*/
|
|
312
|
+
interface MessageQueueEnqueueOptions {
|
|
313
|
+
/**
|
|
314
|
+
* The delay before the message is enqueued. No delay by default.
|
|
315
|
+
*
|
|
316
|
+
* It must not be negative.
|
|
317
|
+
*/
|
|
318
|
+
delay?: Temporal.Duration;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Additional options for listening to a message queue.
|
|
322
|
+
*
|
|
323
|
+
* @since 1.0.0
|
|
324
|
+
*/
|
|
325
|
+
interface MessageQueueListenOptions {
|
|
326
|
+
/**
|
|
327
|
+
* The signal to abort listening to the message queue.
|
|
328
|
+
*/
|
|
329
|
+
signal?: AbortSignal;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* An abstract interface for a message queue.
|
|
333
|
+
*
|
|
334
|
+
* @since 0.5.0
|
|
335
|
+
*/
|
|
336
|
+
interface MessageQueue {
|
|
337
|
+
/**
|
|
338
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
339
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
340
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
341
|
+
* using its own retry policies.
|
|
342
|
+
*
|
|
343
|
+
* @default `false`
|
|
344
|
+
* @since 1.7.0
|
|
345
|
+
*/
|
|
346
|
+
readonly nativeRetrial?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Enqueues a message in the queue.
|
|
349
|
+
* @param message The message to enqueue.
|
|
350
|
+
* @param options Additional options for enqueuing the message.
|
|
351
|
+
*/
|
|
352
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
353
|
+
/**
|
|
354
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
355
|
+
* and may not be supported by all implementations. If not supported,
|
|
356
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
357
|
+
*
|
|
358
|
+
* @param messages The messages to enqueue.
|
|
359
|
+
* @param options Additional options for enqueuing the messages.
|
|
360
|
+
*/
|
|
361
|
+
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
362
|
+
/**
|
|
363
|
+
* Listens for messages in the queue.
|
|
364
|
+
* @param handler The handler for messages in the queue.
|
|
365
|
+
* @param options Additional options for listening to the message queue.
|
|
366
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
367
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
368
|
+
* signal is provided, it never resolves.
|
|
369
|
+
*/
|
|
370
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
374
|
+
* @since 1.0.0
|
|
375
|
+
*/
|
|
376
|
+
interface InProcessMessageQueueOptions {
|
|
377
|
+
/**
|
|
378
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
379
|
+
* @default `{ seconds: 5 }`
|
|
380
|
+
*/
|
|
381
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* A message queue that processes messages in the same process.
|
|
385
|
+
* Do not use this in production as it does neither persist messages nor
|
|
386
|
+
* distribute them across multiple processes.
|
|
387
|
+
*
|
|
388
|
+
* @since 0.5.0
|
|
389
|
+
*/
|
|
390
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
391
|
+
#private;
|
|
392
|
+
/**
|
|
393
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
394
|
+
* @since 1.7.0
|
|
395
|
+
*/
|
|
396
|
+
readonly nativeRetrial = false;
|
|
397
|
+
/**
|
|
398
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
399
|
+
* @param options Additional options for the in-process message queue.
|
|
400
|
+
*/
|
|
401
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
402
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
403
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
404
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* A message queue that processes messages in parallel. It takes another
|
|
408
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
409
|
+
* number of workers.
|
|
410
|
+
*
|
|
411
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
412
|
+
*
|
|
413
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
414
|
+
* are not running in separate threads or processes. They are running in the
|
|
415
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
416
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
417
|
+
* workloads.
|
|
418
|
+
*
|
|
419
|
+
* @since 1.0.0
|
|
420
|
+
*/
|
|
421
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
422
|
+
#private;
|
|
423
|
+
readonly queue: MessageQueue;
|
|
424
|
+
readonly workers: number;
|
|
425
|
+
/**
|
|
426
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
427
|
+
* @since 1.7.0
|
|
428
|
+
*/
|
|
429
|
+
readonly nativeRetrial?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
432
|
+
* number of workers.
|
|
433
|
+
* @param queue The message queue to use under the hood. Note that
|
|
434
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
435
|
+
* @param workers The number of workers to process messages in parallel.
|
|
436
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
437
|
+
* {@link ParallelMessageQueue}.
|
|
438
|
+
*/
|
|
439
|
+
constructor(queue: MessageQueue, workers: number);
|
|
440
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
441
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
442
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
443
|
+
}
|
|
308
444
|
//#endregion
|
|
309
445
|
//#region src/federation/handler.d.ts
|
|
310
|
-
|
|
311
446
|
/**
|
|
312
447
|
* Options for the {@link respondWithObject} and
|
|
313
448
|
* {@link respondWithObjectIfAcceptable} functions.
|
|
@@ -434,8 +569,8 @@ declare function createFederationBuilder<TContextData>(): FederationBuilder<TCon
|
|
|
434
569
|
//#endregion
|
|
435
570
|
//#region src/federation/queue.d.ts
|
|
436
571
|
interface SenderKeyJwkPair {
|
|
437
|
-
keyId: string;
|
|
438
|
-
privateKey: JsonWebKey;
|
|
572
|
+
readonly keyId: string;
|
|
573
|
+
readonly privateKey: JsonWebKey;
|
|
439
574
|
}
|
|
440
575
|
/**
|
|
441
576
|
* A message that represents a task to be processed by the background worker.
|
|
@@ -448,44 +583,44 @@ interface SenderKeyJwkPair {
|
|
|
448
583
|
*/
|
|
449
584
|
type Message = FanoutMessage | OutboxMessage | InboxMessage;
|
|
450
585
|
interface FanoutMessage {
|
|
451
|
-
type: "fanout";
|
|
452
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
453
|
-
baseUrl: string;
|
|
454
|
-
keys: SenderKeyJwkPair[];
|
|
455
|
-
inboxes: Record<string, {
|
|
456
|
-
actorIds: string[];
|
|
457
|
-
sharedInbox: boolean;
|
|
458
|
-
}
|
|
459
|
-
activity: unknown;
|
|
460
|
-
activityId?: string;
|
|
461
|
-
activityType: string;
|
|
462
|
-
collectionSync?: string;
|
|
463
|
-
traceContext: Record<string, string
|
|
586
|
+
readonly type: "fanout";
|
|
587
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
588
|
+
readonly baseUrl: string;
|
|
589
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
590
|
+
readonly inboxes: Readonly<Record<string, {
|
|
591
|
+
readonly actorIds: readonly string[];
|
|
592
|
+
readonly sharedInbox: boolean;
|
|
593
|
+
}>>;
|
|
594
|
+
readonly activity: unknown;
|
|
595
|
+
readonly activityId?: string;
|
|
596
|
+
readonly activityType: string;
|
|
597
|
+
readonly collectionSync?: string;
|
|
598
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
464
599
|
}
|
|
465
600
|
interface OutboxMessage {
|
|
466
|
-
type: "outbox";
|
|
467
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
468
|
-
baseUrl: string;
|
|
469
|
-
keys: SenderKeyJwkPair[];
|
|
470
|
-
activity: unknown;
|
|
471
|
-
activityId?: string;
|
|
472
|
-
activityType: string;
|
|
473
|
-
inbox: string;
|
|
474
|
-
sharedInbox: boolean;
|
|
475
|
-
started: string;
|
|
476
|
-
attempt: number;
|
|
477
|
-
headers: Record<string, string
|
|
478
|
-
traceContext: Record<string, string
|
|
601
|
+
readonly type: "outbox";
|
|
602
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
603
|
+
readonly baseUrl: string;
|
|
604
|
+
readonly keys: readonly SenderKeyJwkPair[];
|
|
605
|
+
readonly activity: unknown;
|
|
606
|
+
readonly activityId?: string;
|
|
607
|
+
readonly activityType: string;
|
|
608
|
+
readonly inbox: string;
|
|
609
|
+
readonly sharedInbox: boolean;
|
|
610
|
+
readonly started: string;
|
|
611
|
+
readonly attempt: number;
|
|
612
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
613
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
479
614
|
}
|
|
480
615
|
interface InboxMessage {
|
|
481
|
-
type: "inbox";
|
|
482
|
-
id: ReturnType<typeof crypto.randomUUID>;
|
|
483
|
-
baseUrl: string;
|
|
484
|
-
activity: unknown;
|
|
485
|
-
started: string;
|
|
486
|
-
attempt: number;
|
|
487
|
-
identifier: string | null;
|
|
488
|
-
traceContext: Record<string, string
|
|
616
|
+
readonly type: "inbox";
|
|
617
|
+
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
618
|
+
readonly baseUrl: string;
|
|
619
|
+
readonly activity: unknown;
|
|
620
|
+
readonly started: string;
|
|
621
|
+
readonly attempt: number;
|
|
622
|
+
readonly identifier: string | null;
|
|
623
|
+
readonly traceContext: Readonly<Record<string, string>>;
|
|
489
624
|
}
|
|
490
625
|
//#endregion
|
|
491
626
|
//#region src/federation/retry.d.ts
|
|
@@ -569,19 +704,19 @@ interface FederationQueueOptions {
|
|
|
569
704
|
* The message queue for incoming activities. If not provided, incoming
|
|
570
705
|
* activities will not be queued and will be processed immediately.
|
|
571
706
|
*/
|
|
572
|
-
inbox?: MessageQueue;
|
|
707
|
+
readonly inbox?: MessageQueue;
|
|
573
708
|
/**
|
|
574
709
|
* The message queue for outgoing activities. If not provided, outgoing
|
|
575
710
|
* activities will not be queued and will be sent immediately.
|
|
576
711
|
*/
|
|
577
|
-
outbox?: MessageQueue;
|
|
712
|
+
readonly outbox?: MessageQueue;
|
|
578
713
|
/**
|
|
579
714
|
* The message queue for fanning out outgoing activities. If not provided,
|
|
580
715
|
* outgoing activities will not be fanned out in the background, but will be
|
|
581
716
|
* fanned out immediately, which causes slow response times on
|
|
582
717
|
* {@link Context.sendActivity} calls.
|
|
583
718
|
*/
|
|
584
|
-
fanout?: MessageQueue;
|
|
719
|
+
readonly fanout?: MessageQueue;
|
|
585
720
|
}
|
|
586
721
|
/**
|
|
587
722
|
* Prefixes for namespacing keys in the Deno KV store.
|
|
@@ -592,18 +727,18 @@ interface FederationKvPrefixes {
|
|
|
592
727
|
* processed or not.
|
|
593
728
|
* @default `["_fedify", "activityIdempotence"]`
|
|
594
729
|
*/
|
|
595
|
-
activityIdempotence: KvKey;
|
|
730
|
+
readonly activityIdempotence: KvKey;
|
|
596
731
|
/**
|
|
597
732
|
* The key prefix used for storing remote JSON-LD documents.
|
|
598
733
|
* @default `["_fedify", "remoteDocument"]`
|
|
599
734
|
*/
|
|
600
|
-
remoteDocument: KvKey;
|
|
735
|
+
readonly remoteDocument: KvKey;
|
|
601
736
|
/**
|
|
602
737
|
* The key prefix used for caching public keys.
|
|
603
738
|
* @default `["_fedify", "publicKey"]`
|
|
604
739
|
* @since 0.12.0
|
|
605
740
|
*/
|
|
606
|
-
publicKey: KvKey;
|
|
741
|
+
readonly publicKey: KvKey;
|
|
607
742
|
/**
|
|
608
743
|
* The key prefix used for caching HTTP Message Signatures specs.
|
|
609
744
|
* The cached spec is used to reduce the number of requests to make signed
|
|
@@ -611,7 +746,7 @@ interface FederationKvPrefixes {
|
|
|
611
746
|
* @default `["_fedify", "httpMessageSignaturesSpec"]`
|
|
612
747
|
* @since 1.6.0
|
|
613
748
|
*/
|
|
614
|
-
httpMessageSignaturesSpec: KvKey;
|
|
749
|
+
readonly httpMessageSignaturesSpec: KvKey;
|
|
615
750
|
}
|
|
616
751
|
/**
|
|
617
752
|
* Options for {@link CreateFederationOptions.origin} when it is not a string.
|
|
@@ -702,7 +837,7 @@ interface Federatable<TContextData> {
|
|
|
702
837
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
|
703
838
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
704
839
|
*/
|
|
705
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
840
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
706
841
|
/**
|
|
707
842
|
* Registers an object dispatcher.
|
|
708
843
|
*
|
|
@@ -716,9 +851,7 @@ interface Federatable<TContextData> {
|
|
|
716
851
|
* must have one or more variables.
|
|
717
852
|
* @param dispatcher An object dispatcher callback to register.
|
|
718
853
|
*/
|
|
719
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
720
|
-
typeId: URL;
|
|
721
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
854
|
+
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>;
|
|
722
855
|
/**
|
|
723
856
|
* Registers an object dispatcher.
|
|
724
857
|
*
|
|
@@ -732,9 +865,7 @@ interface Federatable<TContextData> {
|
|
|
732
865
|
* must have one or more variables.
|
|
733
866
|
* @param dispatcher An object dispatcher callback to register.
|
|
734
867
|
*/
|
|
735
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
736
|
-
typeId: URL;
|
|
737
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
868
|
+
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>;
|
|
738
869
|
/**
|
|
739
870
|
* Registers an object dispatcher.
|
|
740
871
|
*
|
|
@@ -748,9 +879,7 @@ interface Federatable<TContextData> {
|
|
|
748
879
|
* must have one or more variables.
|
|
749
880
|
* @param dispatcher An object dispatcher callback to register.
|
|
750
881
|
*/
|
|
751
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
752
|
-
typeId: URL;
|
|
753
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
882
|
+
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>;
|
|
754
883
|
/**
|
|
755
884
|
* Registers an object dispatcher.
|
|
756
885
|
*
|
|
@@ -764,9 +893,7 @@ interface Federatable<TContextData> {
|
|
|
764
893
|
* must have one or more variables.
|
|
765
894
|
* @param dispatcher An object dispatcher callback to register.
|
|
766
895
|
*/
|
|
767
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
768
|
-
typeId: URL;
|
|
769
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
896
|
+
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>;
|
|
770
897
|
/**
|
|
771
898
|
* Registers an object dispatcher.
|
|
772
899
|
*
|
|
@@ -780,9 +907,7 @@ interface Federatable<TContextData> {
|
|
|
780
907
|
* must have one or more variables.
|
|
781
908
|
* @param dispatcher An object dispatcher callback to register.
|
|
782
909
|
*/
|
|
783
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
784
|
-
typeId: URL;
|
|
785
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
910
|
+
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>;
|
|
786
911
|
/**
|
|
787
912
|
* Registers an object dispatcher.
|
|
788
913
|
*
|
|
@@ -796,9 +921,7 @@ interface Federatable<TContextData> {
|
|
|
796
921
|
* must have one or more variables.
|
|
797
922
|
* @param dispatcher An object dispatcher callback to register.
|
|
798
923
|
*/
|
|
799
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
|
800
|
-
typeId: URL;
|
|
801
|
-
}, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
924
|
+
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>;
|
|
802
925
|
/**
|
|
803
926
|
* Registers an inbox dispatcher.
|
|
804
927
|
*
|
|
@@ -810,7 +933,7 @@ interface Federatable<TContextData> {
|
|
|
810
933
|
* @param dispatcher An inbox dispatcher callback to register.
|
|
811
934
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
812
935
|
*/
|
|
813
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
936
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
814
937
|
/**
|
|
815
938
|
* Registers an outbox dispatcher.
|
|
816
939
|
*
|
|
@@ -834,7 +957,7 @@ interface Federatable<TContextData> {
|
|
|
834
957
|
* @param dispatcher An outbox dispatcher callback to register.
|
|
835
958
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
836
959
|
*/
|
|
837
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
960
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
838
961
|
/**
|
|
839
962
|
* Registers a following collection dispatcher.
|
|
840
963
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -846,7 +969,7 @@ interface Federatable<TContextData> {
|
|
|
846
969
|
* callbacks.
|
|
847
970
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
848
971
|
*/
|
|
849
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
972
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
850
973
|
/**
|
|
851
974
|
* Registers a followers collection dispatcher.
|
|
852
975
|
* @param path The URI path pattern for the followers collection. The syntax
|
|
@@ -858,7 +981,7 @@ interface Federatable<TContextData> {
|
|
|
858
981
|
* callbacks.
|
|
859
982
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
860
983
|
*/
|
|
861
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
984
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
862
985
|
/**
|
|
863
986
|
* Registers a liked collection dispatcher.
|
|
864
987
|
* @param path The URI path pattern for the liked collection. The syntax
|
|
@@ -870,7 +993,7 @@ interface Federatable<TContextData> {
|
|
|
870
993
|
* callbacks.
|
|
871
994
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
872
995
|
*/
|
|
873
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
996
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
874
997
|
/**
|
|
875
998
|
* Registers a featured collection dispatcher.
|
|
876
999
|
* @param path The URI path pattern for the featured collection. The syntax
|
|
@@ -882,7 +1005,7 @@ interface Federatable<TContextData> {
|
|
|
882
1005
|
* callbacks.
|
|
883
1006
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
884
1007
|
*/
|
|
885
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1008
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
886
1009
|
/**
|
|
887
1010
|
* Registers a featured tags collection dispatcher.
|
|
888
1011
|
* @param path The URI path pattern for the featured tags collection.
|
|
@@ -894,7 +1017,7 @@ interface Federatable<TContextData> {
|
|
|
894
1017
|
* callbacks.
|
|
895
1018
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
896
1019
|
*/
|
|
897
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1020
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
898
1021
|
/**
|
|
899
1022
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
|
900
1023
|
*
|
|
@@ -924,7 +1047,37 @@ interface Federatable<TContextData> {
|
|
|
924
1047
|
* @returns An object to register inbox listeners.
|
|
925
1048
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
|
926
1049
|
*/
|
|
927
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1050
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Registers a collection of objects dispatcher.
|
|
1053
|
+
*
|
|
1054
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1055
|
+
* @template TObject The type of objects to dispatch.
|
|
1056
|
+
* @template TParam The parameter names of the requested URL.
|
|
1057
|
+
* @param name A unique name for the collection dispatcher.
|
|
1058
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1059
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1060
|
+
* The syntax is based on URI Template
|
|
1061
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1062
|
+
* The path must have one or more variables.
|
|
1063
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1064
|
+
*/
|
|
1065
|
+
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>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Registers a collection of objects dispatcher.
|
|
1068
|
+
*
|
|
1069
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1070
|
+
* @template TObject The type of objects to dispatch.
|
|
1071
|
+
* @template TParam The parameter names of the requested URL.
|
|
1072
|
+
* @param name A unique name for the collection dispatcher.
|
|
1073
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1074
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1075
|
+
* The syntax is based on URI Template
|
|
1076
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1077
|
+
* The path must have one or more variables.
|
|
1078
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1079
|
+
*/
|
|
1080
|
+
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>;
|
|
928
1081
|
/**
|
|
929
1082
|
* Registers a collection of objects dispatcher.
|
|
930
1083
|
*
|
|
@@ -939,7 +1092,37 @@ interface Federatable<TContextData> {
|
|
|
939
1092
|
* The path must have one or more variables.
|
|
940
1093
|
* @param dispatcher A collection dispatcher callback to register.
|
|
941
1094
|
*/
|
|
942
|
-
setCollectionDispatcher<TObject extends Object$1,
|
|
1095
|
+
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>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1098
|
+
*
|
|
1099
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1100
|
+
* @template TObject The type of objects to dispatch.
|
|
1101
|
+
* @template TParam The parameter names of the requested URL.
|
|
1102
|
+
* @param name A unique name for the collection dispatcher.
|
|
1103
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1104
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1105
|
+
* The syntax is based on URI Template
|
|
1106
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1107
|
+
* The path must have one or more variables.
|
|
1108
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1109
|
+
*/
|
|
1110
|
+
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>;
|
|
1111
|
+
/**
|
|
1112
|
+
* Registers an ordered collection of objects dispatcher.
|
|
1113
|
+
*
|
|
1114
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
1115
|
+
* @template TObject The type of objects to dispatch.
|
|
1116
|
+
* @template TParam The parameter names of the requested URL.
|
|
1117
|
+
* @param name A unique name for the collection dispatcher.
|
|
1118
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
|
1119
|
+
* @param path The URI path pattern for the collection dispatcher.
|
|
1120
|
+
* The syntax is based on URI Template
|
|
1121
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
1122
|
+
* The path must have one or more variables.
|
|
1123
|
+
* @param dispatcher A collection dispatcher callback to register.
|
|
1124
|
+
*/
|
|
1125
|
+
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>;
|
|
943
1126
|
/**
|
|
944
1127
|
* Registers an ordered collection of objects dispatcher.
|
|
945
1128
|
*
|
|
@@ -954,7 +1137,7 @@ interface Federatable<TContextData> {
|
|
|
954
1137
|
* The path must have one or more variables.
|
|
955
1138
|
* @param dispatcher A collection dispatcher callback to register.
|
|
956
1139
|
*/
|
|
957
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
|
1140
|
+
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>;
|
|
958
1141
|
}
|
|
959
1142
|
/**
|
|
960
1143
|
* An object that registers federation-related business logic and dispatches
|
|
@@ -1090,12 +1273,6 @@ interface FederationOptions<TContextData> {
|
|
|
1090
1273
|
* @since 1.4.0
|
|
1091
1274
|
*/
|
|
1092
1275
|
contextLoaderFactory?: DocumentLoaderFactory;
|
|
1093
|
-
/**
|
|
1094
|
-
* A custom JSON-LD context loader. By default, this uses the same loader
|
|
1095
|
-
* as the document loader.
|
|
1096
|
-
* @deprecated Use {@link contextLoaderFactory} instead.
|
|
1097
|
-
*/
|
|
1098
|
-
contextLoader?: DocumentLoader;
|
|
1099
1276
|
/**
|
|
1100
1277
|
* A factory function that creates an authenticated document loader for a
|
|
1101
1278
|
* given identity. This is used for fetching documents that require
|
|
@@ -1432,38 +1609,38 @@ interface FederationFetchOptions<TContextData> {
|
|
|
1432
1609
|
/**
|
|
1433
1610
|
* Additional settings for a custom collection dispatcher.
|
|
1434
1611
|
*
|
|
1435
|
-
* @template
|
|
1612
|
+
* @template TParam The type of the parameters in the URL path.
|
|
1436
1613
|
* @template TContext The type of the context. {@link Context} or
|
|
1437
1614
|
* {@link RequestContext}.
|
|
1438
1615
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
1439
1616
|
* @template TFilter The type of filter for the collection.
|
|
1440
1617
|
*/
|
|
1441
|
-
interface CustomCollectionCallbackSetters<
|
|
1618
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
|
1442
1619
|
/**
|
|
1443
1620
|
* Sets the counter for the custom collection.
|
|
1444
1621
|
* @param counter A callback that returns the number of items in the custom collection.
|
|
1445
1622
|
* @returns The setters object so that settings can be chained.
|
|
1446
1623
|
*/
|
|
1447
|
-
setCounter(counter: CustomCollectionCounter<
|
|
1624
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1448
1625
|
/**
|
|
1449
1626
|
* Sets the first cursor for the custom collection.
|
|
1450
1627
|
* @param cursor The cursor for the first item in the custom collection.
|
|
1451
1628
|
* @returns The setters object so that settings can be chained.
|
|
1452
1629
|
*/
|
|
1453
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
|
1630
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1454
1631
|
/**
|
|
1455
1632
|
* Sets the last cursor for the custom collection.
|
|
1456
1633
|
* @param cursor The cursor for the last item in the custom collection.
|
|
1457
1634
|
* @returns The setters object so that settings can be chained.
|
|
1458
1635
|
*/
|
|
1459
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
|
1636
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1460
1637
|
/**
|
|
1461
1638
|
* Specifies the conditions under which requests are authorized.
|
|
1462
1639
|
* @param predicate A callback that returns whether a request is authorized.
|
|
1463
1640
|
* @returns The setters object so that settings can be chained.
|
|
1464
1641
|
* @since 0.7.0
|
|
1465
1642
|
*/
|
|
1466
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
|
1643
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
1467
1644
|
}
|
|
1468
1645
|
/**
|
|
1469
1646
|
* Represents an object with a type ID, which is either a constructor or an
|
|
@@ -1475,73 +1652,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
|
1475
1652
|
typeId: URL;
|
|
1476
1653
|
};
|
|
1477
1654
|
/**
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1484
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
|
1485
|
-
* let userPostPath: UserPostPath;
|
|
1486
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
|
1487
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
|
1488
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
|
1489
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
|
1490
|
-
* ```
|
|
1491
|
-
*/
|
|
1492
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
|
1493
|
-
/**
|
|
1494
|
-
* Represents a path with multiple parameters.
|
|
1495
|
-
* All permutations of the parameters are included in the union type.
|
|
1496
|
-
* The path must have all parameters in the form of `{paramName}`.
|
|
1497
|
-
* @param Params - A union of parameter names.
|
|
1498
|
-
* @returns A string representing the path with all parameters.
|
|
1499
|
-
* @example
|
|
1500
|
-
* ```ts
|
|
1501
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
|
1502
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
|
1503
|
-
* // =
|
|
1504
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
|
1505
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
|
1506
|
-
* let userPostPath: UserPostPath;
|
|
1507
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
|
1508
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
|
1509
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
|
1510
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
|
1511
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
|
1512
|
-
*/
|
|
1513
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
|
1514
|
-
/**
|
|
1515
|
-
* Represents a path with a single parameter.
|
|
1516
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
|
1517
|
-
* @param Param - The name of the parameter.
|
|
1518
|
-
* @returns A string representing the path with the parameter.
|
|
1519
|
-
* @example
|
|
1520
|
-
* ```ts
|
|
1521
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
|
1522
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
|
1523
|
-
* let userPostPath: UserPostPath;
|
|
1524
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
|
1525
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
|
1526
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
|
1527
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
|
1528
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
|
1529
|
-
*/
|
|
1530
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
|
1531
|
-
/**
|
|
1532
|
-
* Converts union types to intersection types.
|
|
1655
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
|
1656
|
+
* parameter name.
|
|
1657
|
+
*
|
|
1658
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
|
1659
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
|
1660
|
+
* single, named variable.
|
|
1533
1661
|
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1662
|
+
* The supported expression types are:
|
|
1663
|
+
* - `{Param}`: Simple string expansion
|
|
1664
|
+
* - `+{Param}`: Reserved string expansion
|
|
1665
|
+
* - `#{Param}`: Fragment expansion
|
|
1666
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
|
1667
|
+
* - `{/Param}`: Path segment expansion
|
|
1668
|
+
* - `{;Param}`: Path-style parameter expansion
|
|
1669
|
+
* - `{?Param}`: Query component expansion
|
|
1670
|
+
* - `{&Param}`: Query continuation expansion
|
|
1671
|
+
*
|
|
1672
|
+
* @template Param The name of the parameter to be used in the expressions.
|
|
1536
1673
|
* @example
|
|
1537
1674
|
* ```ts
|
|
1538
|
-
* type
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1675
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
|
1676
|
+
*
|
|
1677
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
|
1678
|
+
* const userPath: UserIdExpression = "{/userId}";
|
|
1679
|
+
* ```
|
|
1680
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
|
1543
1681
|
*/
|
|
1544
|
-
type
|
|
1682
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
|
1545
1683
|
//#endregion
|
|
1546
1684
|
//#region src/federation/context.d.ts
|
|
1547
1685
|
/**
|
|
@@ -1630,9 +1768,7 @@ interface Context<TContextData> {
|
|
|
1630
1768
|
* @throws {TypeError} If values are invalid.
|
|
1631
1769
|
* @since 0.7.0
|
|
1632
1770
|
*/
|
|
1633
|
-
getObjectUri<TObject extends Object$1>(cls:
|
|
1634
|
-
typeId: URL;
|
|
1635
|
-
}, values: Record<string, string>): URL;
|
|
1771
|
+
getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
|
|
1636
1772
|
/**
|
|
1637
1773
|
* Builds the URI of an actor's outbox with the given identifier.
|
|
1638
1774
|
* @param identifier The actor's identifier.
|
|
@@ -1946,9 +2082,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
1946
2082
|
* @throws {TypeError} If values are invalid.
|
|
1947
2083
|
* @since 0.7.0
|
|
1948
2084
|
*/
|
|
1949
|
-
getObject<TObject extends Object$1>(cls:
|
|
1950
|
-
typeId: URL;
|
|
1951
|
-
}, values: Record<string, string>): Promise<TObject | null>;
|
|
2085
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
|
|
1952
2086
|
/**
|
|
1953
2087
|
* Gets the public key of the sender, if any exists and it is verified.
|
|
1954
2088
|
* Otherwise, `null` is returned.
|
|
@@ -2026,7 +2160,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2026
2160
|
* inbox, it is `null`.
|
|
2027
2161
|
* @since 1.2.0
|
|
2028
2162
|
*/
|
|
2029
|
-
recipient: string | null;
|
|
2163
|
+
readonly recipient: string | null;
|
|
2030
2164
|
/**
|
|
2031
2165
|
* Creates a new context with the same properties as this one,
|
|
2032
2166
|
* but with the given data.
|
|
@@ -2092,9 +2226,7 @@ type ParseUriResult =
|
|
|
2092
2226
|
* The case of an object URI.
|
|
2093
2227
|
*/ | {
|
|
2094
2228
|
readonly type: "object";
|
|
2095
|
-
readonly class:
|
|
2096
|
-
typeId: URL;
|
|
2097
|
-
};
|
|
2229
|
+
readonly class: ConstructorWithTypeId<Object$1>;
|
|
2098
2230
|
readonly typeId: URL;
|
|
2099
2231
|
readonly values: Record<string, string>;
|
|
2100
2232
|
}
|
|
@@ -2218,7 +2350,7 @@ interface SendActivityOptions {
|
|
|
2218
2350
|
*
|
|
2219
2351
|
* @since 0.9.0
|
|
2220
2352
|
*/
|
|
2221
|
-
excludeBaseUris?: URL[];
|
|
2353
|
+
readonly excludeBaseUris?: readonly URL[];
|
|
2222
2354
|
}
|
|
2223
2355
|
/**
|
|
2224
2356
|
* Options for {@link Context.sendActivity} method when sending to a collection.
|
|
@@ -2301,15 +2433,15 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2301
2433
|
/**
|
|
2302
2434
|
* The URI of the public key, which is used for verifying HTTP Signatures.
|
|
2303
2435
|
*/
|
|
2304
|
-
keyId: URL;
|
|
2436
|
+
readonly keyId: URL;
|
|
2305
2437
|
/**
|
|
2306
2438
|
* A {@link CryptographicKey} instance of the public key.
|
|
2307
2439
|
*/
|
|
2308
|
-
cryptographicKey: CryptographicKey;
|
|
2440
|
+
readonly cryptographicKey: CryptographicKey;
|
|
2309
2441
|
/**
|
|
2310
2442
|
* A {@link Multikey} instance of the public key.
|
|
2311
2443
|
*/
|
|
2312
|
-
multikey: Multikey;
|
|
2444
|
+
readonly multikey: Multikey;
|
|
2313
2445
|
}
|
|
2314
2446
|
//#endregion
|
|
2315
|
-
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,
|
|
2447
|
+
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 };
|