@fedify/fedify 2.4.0-pr.936.41 → 2.5.0-dev.2271
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/README.md +50 -39
- package/dist/{assert-CJ1KXcvv.mjs → assert-D1Eafmd_.mjs} +1 -1
- package/dist/{assert_equals-BV7oLMxm.mjs → assert_equals-Z6IcEbWU.mjs} +2 -28
- package/dist/assert_exists-cffSpJ7X.mjs +28 -0
- package/dist/assert_false-CPdRnc3E.mjs +23 -0
- package/dist/assert_greater_or_equal-BlafOF4-.mjs +31 -0
- package/dist/{assert_instance_of-Q9KTBnrf.mjs → assert_instance_of-mrXWWNY-.mjs} +1 -1
- package/dist/{assert_not_equals-EPJPoxuf.mjs → assert_not_equals-CpPK2t89.mjs} +2 -1
- package/dist/assert_rejects-CTptdYck.mjs +39 -0
- package/dist/{assert_strict_equals-Ec20AUwa.mjs → assert_strict_equals-CYvBmkpC.mjs} +2 -1
- package/dist/{assert_throws-NiFfqbnH.mjs → assert_throws-BYITOvPO.mjs} +2 -1
- package/dist/assertion_error-B-cx0fFA.mjs +31 -0
- package/dist/audience-CHQ-FlLD.mjs +95 -0
- package/dist/{builder-DonuxRl_.mjs → builder-Bda6LK7A.mjs} +169 -14
- package/dist/{circuit-breaker-CBGyz5F7.mjs → circuit-breaker-XJ53md4S.mjs} +224 -17
- package/dist/circuit-breaker-test-utils-DW6YC_Pe.mjs +14 -0
- package/dist/{client-CjF5IYQS.mjs → client-CEnNz8O7.mjs} +144 -8
- package/dist/{codec-BBga-FWI.mjs → codec-C6rTrpIp.mjs} +26 -3
- package/dist/{collection-BIhlldqK.mjs → collection-CnnP1UAv.mjs} +1 -1
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/mod.js +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +71 -3
- package/dist/compat/public-audience.test.mjs +14 -5
- package/dist/compat/secured-document.test.d.mts +2 -0
- package/dist/compat/secured-document.test.mjs +58 -0
- package/dist/compat/transformers.test.mjs +5 -5
- package/dist/compound-proof-B-9mXxFW.mjs +989 -0
- package/dist/{context-Zii1f5xS.d.ts → context-7NyiqIcg.d.ts} +1600 -25
- package/dist/{context-BJXxPElm.mjs → context-8Tu9kea0.mjs} +21 -63
- package/dist/{context-lxX6I7as.d.cts → context-tsYPJ2Ew.d.cts} +1600 -25
- package/dist/{deno-BHzKn9Ig.mjs → deno-oR5aJKpU.mjs} +1 -1
- package/dist/dist-DJQM4u7i.mjs +189 -0
- package/dist/docloader-DBoYbvYW.mjs +87 -0
- package/dist/{esm-yYQfPhIY.mjs → esm-BHXXx4Wx.mjs} +13 -6
- package/dist/federation/audience.test.d.mts +2 -0
- package/dist/federation/audience.test.mjs +130 -0
- package/dist/federation/builder.test.mjs +54 -5
- package/dist/federation/circuit-breaker.test.mjs +838 -7
- package/dist/federation/collection.test.mjs +3 -3
- package/dist/federation/compound-fanout.test.d.mts +2 -0
- package/dist/federation/compound-fanout.test.mjs +228 -0
- package/dist/federation/handler-compound-proof.test.d.mts +2 -0
- package/dist/federation/handler-compound-proof.test.mjs +384 -0
- package/dist/federation/handler.test.mjs +385 -15
- package/dist/federation/hashlink-media.test.d.mts +2 -0
- package/dist/federation/hashlink-media.test.mjs +422 -0
- package/dist/federation/idempotency.test.mjs +6 -6
- package/dist/federation/inbox-report.test.d.mts +2 -0
- package/dist/federation/inbox-report.test.mjs +475 -0
- package/dist/federation/inbox.test.mjs +3 -3
- package/dist/federation/keycache.test.mjs +215 -14
- package/dist/federation/kv.test.mjs +3 -3
- package/dist/federation/metrics.test.mjs +5 -5
- package/dist/federation/middleware.test.mjs +967 -35
- package/dist/federation/mod.cjs +18 -261
- package/dist/federation/mod.d.cts +5 -5
- package/dist/federation/mod.d.ts +5 -5
- package/dist/federation/mod.js +279 -1
- package/dist/federation/mq.test.mjs +123 -47
- package/dist/federation/negotiation.test.mjs +4 -4
- package/dist/federation/outgoing-proof.test.d.mts +2 -0
- package/dist/federation/outgoing-proof.test.mjs +931 -0
- package/dist/federation/portable-actor.test.d.mts +2 -0
- package/dist/federation/portable-actor.test.mjs +496 -0
- package/dist/federation/portable-chain.test.d.mts +2 -0
- package/dist/federation/portable-chain.test.mjs +370 -0
- package/dist/federation/portable-collection.test.d.mts +2 -0
- package/dist/federation/portable-collection.test.mjs +832 -0
- package/dist/federation/portable-delivery.test.d.mts +2 -0
- package/dist/federation/portable-delivery.test.mjs +746 -0
- package/dist/federation/portable-gateway-keys.test.d.mts +2 -0
- package/dist/federation/portable-gateway-keys.test.mjs +686 -0
- package/dist/federation/portable-inbox.test.d.mts +2 -0
- package/dist/federation/portable-inbox.test.mjs +1535 -0
- package/dist/federation/portable-parse-uri.test.d.mts +2 -0
- package/dist/federation/portable-parse-uri.test.mjs +348 -0
- package/dist/federation/portable-route-activity.test.d.mts +2 -0
- package/dist/federation/portable-route-activity.test.mjs +259 -0
- package/dist/federation/portable.test.d.mts +2 -0
- package/dist/federation/portable.test.mjs +1072 -0
- package/dist/federation/retry.test.mjs +4 -3
- package/dist/federation/router.test.mjs +9 -159
- package/dist/federation/send.test.mjs +245 -27
- package/dist/federation/tasks/codec.test.mjs +4 -4
- package/dist/federation/tasks/enqueue.test.mjs +42 -4
- package/dist/federation/tasks/tasks.test.mjs +7 -6
- package/dist/federation/temporal.test.mjs +4 -4
- package/dist/federation/webfinger.test.mjs +275 -12
- package/dist/{middleware-FrSMAYEx.cjs → federation-CkZiAcWY.cjs} +8640 -3722
- package/dist/http-B5JT115n.cjs +10630 -0
- package/dist/http-DydWCB7R.js +6527 -0
- package/dist/{http-CPVMUgsW.mjs → http-siciWkmx.mjs} +397 -168
- package/dist/key-BspPiXqn.mjs +951 -0
- package/dist/key-C1nv7_jD.d.ts +1125 -0
- package/dist/key-DYxuyd-s.d.cts +1125 -0
- package/dist/key-owner-evidence-APB6NpSk.mjs +108 -0
- package/dist/keycache-Da8A8mZa.mjs +200 -0
- package/dist/{kv-D6hNiMTK.d.ts → kv-B2mzK5tl.d.cts} +3 -2
- package/dist/{kv-gJ8LYbxX.d.cts → kv-B2mzK5tl.d.ts} +3 -2
- package/dist/kv-DBRWVx3Q.mjs +104 -0
- package/dist/{kv-cache-KyGqJqSp.mjs → kv-cache-BF1hnW65.mjs} +1 -1
- package/dist/{kv-cache-5bnX3-Jq.js → kv-cache-CTQr1tbn.js} +54 -16
- package/dist/{kv-cache-DQ29C4XL.cjs → kv-cache-DCac1nEU.cjs} +55 -19
- package/dist/{ld-Cj9F_5AP.mjs → ld-CzaP-hJl.mjs} +44 -12
- package/dist/map-local-context-conflict-DOYEEJ3u.mjs +204 -0
- package/dist/map-local-create-note-B0SeXJms.mjs +214 -0
- package/dist/{metrics-DMk-nTxI.mjs → metrics-CYg9yxBL.mjs} +3 -2
- package/dist/metrics-DVKYY6K1.d.cts +36 -0
- package/dist/metrics-DoRtI0qU.d.ts +36 -0
- package/dist/{middleware-Y-kpsp6S.js → middleware-CsDDXKuL.js} +5493 -1103
- package/dist/{middleware-CvwTUgnP.mjs → middleware-D7_LO-Vs.mjs} +3157 -272
- package/dist/{middleware-CEctxBN6.mjs → middleware-DWjrfpcz.mjs} +1 -1
- package/dist/{mod-gOlPDuT8.d.cts → mod-BojP2Bw3.d.cts} +1 -1
- package/dist/mod-CavhAgLw.d.cts +320 -0
- package/dist/mod-CtpF2BU5.d.ts +320 -0
- package/dist/{mod-BtEaIEcD.d.cts → mod-DEZXwV6J.d.ts} +10 -4
- package/dist/{mod-UMmveiO0.d.ts → mod-Dw-nPxQh.d.cts} +10 -4
- package/dist/{mod-DLc2Ot6f.d.ts → mod-Xj5P4s4d.d.ts} +1 -1
- package/dist/mod.cjs +40 -39
- package/dist/mod.d.cts +10 -11
- package/dist/mod.d.ts +10 -11
- package/dist/mod.js +9 -9
- package/dist/{mq-llHKivST.mjs → mq-Dm1Wmtm-.mjs} +6 -0
- package/dist/nodeinfo/client.test.mjs +139 -4
- package/dist/nodeinfo/handler.test.mjs +5 -5
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/nodeinfo/types.test.mjs +4 -4
- package/dist/otel/exporter.test.mjs +3 -3
- package/dist/otel/mod.cjs +0 -1
- package/dist/otel/mod.d.cts +1 -1
- package/dist/otel/mod.d.ts +1 -1
- package/dist/{outgoing-jsonld-URuqsICz.mjs → outgoing-jsonld-4IJqPYos.mjs} +12 -10
- package/dist/{owner-DEvZuyOE.d.cts → owner-BF0L9cMt.d.cts} +11 -0
- package/dist/{owner-CnngXDNJ.d.ts → owner-BSzr5-I8.d.ts} +11 -0
- package/dist/owner-DYgfTFHy.mjs +267 -0
- package/dist/portable-collection-BpsVsRov.js +670 -0
- package/dist/portable-collection-C74P1vtC.mjs +418 -0
- package/dist/portable-collection-DZd2bm7M.cjs +686 -0
- package/dist/portable-key-BIMLrAP4.mjs +549 -0
- package/dist/portable-key-id-Ca30-hOa.mjs +248 -0
- package/dist/proof-Dxy6ByqI.mjs +1299 -0
- package/dist/{public-audience-Cr5MsnMq.mjs → public-audience--klBIOk1.mjs} +15 -10
- package/dist/router-u5O5KCQr.mjs +156 -0
- package/dist/runtime/mod.cjs +1 -1
- package/dist/runtime/mod.js +1 -1
- package/dist/secured-document-CxzZZ9nL.mjs +35 -0
- package/dist/send-C4dDpAxm.mjs +495 -0
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/compound-proof-discovery.test.d.mts +2 -0
- package/dist/sig/compound-proof-discovery.test.mjs +331 -0
- package/dist/sig/compound-proof-producer.test.d.mts +2 -0
- package/dist/sig/compound-proof-producer.test.mjs +107 -0
- package/dist/sig/compound-proof-verification.test.d.mts +2 -0
- package/dist/sig/compound-proof-verification.test.mjs +833 -0
- package/dist/sig/compound-proof.test.d.mts +2 -0
- package/dist/sig/compound-proof.test.mjs +411 -0
- package/dist/sig/http.test.mjs +702 -31
- package/dist/sig/key-owner-evidence.test.d.mts +2 -0
- package/dist/sig/key-owner-evidence.test.mjs +100 -0
- package/dist/sig/key.test.mjs +220 -8
- package/dist/sig/ld.test.mjs +65 -7
- package/dist/sig/mitra-receive-interop.test.d.mts +2 -0
- package/dist/sig/mitra-receive-interop.test.mjs +260 -0
- package/dist/sig/mitra-send-interop.test.d.mts +2 -0
- package/dist/sig/mitra-send-interop.test.mjs +461 -0
- package/dist/sig/mod.cjs +18 -16
- package/dist/sig/mod.d.cts +4 -4
- package/dist/sig/mod.d.ts +4 -4
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.mjs +108 -9
- package/dist/sig/portable-collection.test.d.mts +2 -0
- package/dist/sig/portable-collection.test.mjs +697 -0
- package/dist/sig/portable-interop.test.d.mts +2 -0
- package/dist/sig/portable-interop.test.mjs +156 -0
- package/dist/sig/portable-key-id.test.d.mts +2 -0
- package/dist/sig/portable-key-id.test.mjs +67 -0
- package/dist/sig/portable-key.test.d.mts +2 -0
- package/dist/sig/portable-key.test.mjs +1439 -0
- package/dist/sig/proof.test.mjs +1753 -16
- package/dist/sig/tootik-request-interop.test.d.mts +2 -0
- package/dist/sig/tootik-request-interop.test.mjs +190 -0
- package/dist/sig/tootik-send-interop.test.d.mts +2 -0
- package/dist/sig/tootik-send-interop.test.mjs +331 -0
- package/dist/sig/verification.test.d.mts +2 -0
- package/dist/sig/verification.test.mjs +310 -0
- package/dist/std__assert-DvMDRPes.mjs +8 -0
- package/dist/{testing-CO7ftO8A.mjs → tasks-IG3pHfvZ.mjs} +2 -2
- package/dist/{temporal-fsXO5IvD.mjs → temporal-D0KJI4NF.mjs} +3 -3
- package/dist/testing/context.test.d.mts +2 -0
- package/dist/testing/context.test.mjs +19 -0
- package/dist/testing/kv.test.d.mts +2 -0
- package/dist/testing/kv.test.mjs +101 -0
- package/dist/testing/mod.d.mts +1617 -48
- package/dist/testing/mod.mjs +6 -3
- package/dist/testing-t8xDeJZ5.mjs +8 -0
- package/dist/{transformers-DGwl-hD1.cjs → transformers-BalCrSsr.cjs} +0 -1
- package/dist/{types-DC1pNgJA.js → types-_S2_MeLF.js} +144 -8
- package/dist/{types-CPym83zc.cjs → types-poIao40f.cjs} +160 -7
- package/dist/utils/docloader.test.mjs +530 -8
- package/dist/utils/kv-cache.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/dist/verification-C3954hQh.mjs +5 -0
- package/dist/verification-Dpfcw8ml.mjs +105 -0
- package/dist/vocab/cjs.test.mjs +1 -1
- package/package.json +8 -8
- package/dist/assert_rejects-EgstcQy5.mjs +0 -82
- package/dist/docloader-e1khNUKy.mjs +0 -49
- package/dist/http-CsmQ-BQ4.js +0 -2483
- package/dist/http-VyDTd4G3.d.cts +0 -553
- package/dist/http-hlIjmewS.cjs +0 -2694
- package/dist/http-lf8Hsd91.d.ts +0 -553
- package/dist/key-DfPsX8hv.mjs +0 -453
- package/dist/keycache-_DHqz5z_.mjs +0 -97
- package/dist/metrics-CoUJLQhZ.d.cts +0 -276
- package/dist/metrics-Dc4jR-IC.d.ts +0 -276
- package/dist/mod-B0hW12_O.d.cts +0 -307
- package/dist/mod-COIAjwRS.d.ts +0 -307
- package/dist/owner-Br9YYzn_.mjs +0 -120
- package/dist/proof-B4ngoaNQ.mjs +0 -316
- package/dist/proof-B6E0XUXJ.js +0 -1415
- package/dist/proof-NN4xCQGL.cjs +0 -1562
- package/dist/send-CxHKUNzv.mjs +0 -239
- package/dist/std__assert-B2NnY9bq.mjs +0 -79
- package/dist/temporal-polyfill-BCdTHexd.cjs +0 -3565
- /package/dist/{accept-8PiolDP7.mjs → accept-CPVqki78.mjs} +0 -0
- /package/dist/{activity-listener-BtTSxZWA.mjs → activity-listener-C-BSbKI7.mjs} +0 -0
- /package/dist/{client-CAM_bQXx.d.cts → client-D-XP_Ccb.d.cts} +0 -0
- /package/dist/{client-CSddvgWN.d.ts → client-D-XP_Ccb.d.ts} +0 -0
- /package/dist/{keys-Dbyd7bhl.mjs → keys-DIJNHW-Y.mjs} +0 -0
- /package/dist/{kv-CXBAok3k.mjs → kv-DCHkaJ9-.mjs} +0 -0
- /package/dist/{negotiation-RuwrPFqi.mjs → negotiation-CCocWT_N.mjs} +0 -0
- /package/dist/{retry-DgFqeS5k.mjs → retry-zX5xw5e0.mjs} +0 -0
- /package/dist/{chunk-D5IdezsZ.js → rolldown-runtime-BC-Eo5Mj.js} +0 -0
- /package/dist/{chunk-Czpeue4M.cjs → rolldown-runtime-Dmm3t92W.cjs} +0 -0
- /package/dist/{transformers-DXze6FUB.js → transformers-DAtXl_Kc.js} +0 -0
- /package/dist/{types-CrtdVuDP.mjs → types-DE_LV1JB.mjs} +0 -0
|
@@ -1,17 +1,115 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-
|
|
3
|
-
import {
|
|
4
|
-
import { n as GetKeyOwnerOptions } from "./owner-
|
|
5
|
-
import { n as KvStore, t as KvKey } from "./kv-
|
|
6
|
-
import { i as MessageQueue } from "./metrics-Dc4jR-IC.js";
|
|
2
|
+
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-D-XP_Ccb.js";
|
|
3
|
+
import { _ as InboxVerificationKey, d as InboxProofPolicyFailureReason, h as InboxVerificationAttempt, w as VerifyRequestFailureReason, y as HttpMessageSignaturesSpec } from "./key-C1nv7_jD.js";
|
|
4
|
+
import { n as GetKeyOwnerOptions } from "./owner-BSzr5-I8.js";
|
|
5
|
+
import { n as KvStore, t as KvKey } from "./kv-B2mzK5tl.js";
|
|
7
6
|
import { Router } from "@fedify/uri-template";
|
|
8
7
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
9
8
|
import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
10
|
-
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
9
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions, PortableObjectVerifier } from "@fedify/vocab-runtime";
|
|
11
10
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
12
11
|
import { MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
13
12
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
14
13
|
|
|
14
|
+
//#region src/federation/inbox-report.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* A JSON value retained from the incoming request.
|
|
17
|
+
* @since 2.4.0
|
|
18
|
+
*/
|
|
19
|
+
type InboxJsonValue = null | boolean | number | string | readonly InboxJsonValue[] | {
|
|
20
|
+
readonly [key: string]: InboxJsonValue;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The final inbox authentication decision.
|
|
24
|
+
* @since 2.4.0
|
|
25
|
+
*/
|
|
26
|
+
type InboxAuthentication = {
|
|
27
|
+
readonly status: "verified"; /** Direct references to the attempts that authenticated this delivery. */
|
|
28
|
+
readonly attempts: readonly Extract<InboxVerificationAttempt, {
|
|
29
|
+
status: "verified";
|
|
30
|
+
}>[];
|
|
31
|
+
} | {
|
|
32
|
+
readonly status: "rejected";
|
|
33
|
+
readonly reason: {
|
|
34
|
+
readonly type: "verificationFailed";
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "actorKeyMismatch";
|
|
37
|
+
readonly key: InboxVerificationKey;
|
|
38
|
+
readonly actorIds: readonly URL[];
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: "proofPolicy";
|
|
41
|
+
readonly policy: "portableActor" | "portableActivity" | "compound";
|
|
42
|
+
readonly detail?: InboxProofPolicyFailureReason;
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: "invalidNonce";
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
readonly status: "skipped";
|
|
48
|
+
} | {
|
|
49
|
+
readonly status: "notDetermined";
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* How an inbox request finished.
|
|
53
|
+
* @since 2.4.0
|
|
54
|
+
*/
|
|
55
|
+
type InboxRequestOutcome = {
|
|
56
|
+
readonly type: "response";
|
|
57
|
+
readonly status: number;
|
|
58
|
+
readonly disposition: "processed" | "enqueued" | "duplicate" | "unhandled" | "customResponse";
|
|
59
|
+
} | {
|
|
60
|
+
readonly type: "response";
|
|
61
|
+
readonly status: number;
|
|
62
|
+
readonly disposition: "rejected";
|
|
63
|
+
readonly reason: "recipientNotFound" | "invalidJson" | "invalidJsonLd" | "invalidActivity" | "bodyTooLarge" | "missingActor" | "authentication";
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "response";
|
|
66
|
+
readonly status: number;
|
|
67
|
+
readonly disposition: "failed";
|
|
68
|
+
readonly reason: "bodyUnavailable" | "enqueueError" | "listenerError";
|
|
69
|
+
readonly error?: unknown;
|
|
70
|
+
} | {
|
|
71
|
+
readonly type: "exception";
|
|
72
|
+
readonly stage: "prepare" | "parse" | "verify" | "policy" | "dispatch" | "respond"; /** The original thrown value, including null/undefined. */
|
|
73
|
+
readonly error: unknown;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Observations of a single inbox delivery request.
|
|
77
|
+
* @since 2.4.0
|
|
78
|
+
*/
|
|
79
|
+
interface InboxRequestReport {
|
|
80
|
+
/** The delivery route, including a portable gateway route. */
|
|
81
|
+
readonly inbox: {
|
|
82
|
+
readonly kind: "personal" | "shared" | "portable";
|
|
83
|
+
readonly recipient: string | null;
|
|
84
|
+
};
|
|
85
|
+
/** Unavailable differs from a successfully parsed JSON null. */
|
|
86
|
+
readonly payload: {
|
|
87
|
+
readonly status: "unavailable";
|
|
88
|
+
} | {
|
|
89
|
+
readonly status: "parsed";
|
|
90
|
+
readonly value: InboxJsonValue;
|
|
91
|
+
};
|
|
92
|
+
/** The Activity obtained by the normal processing flow, if any. */
|
|
93
|
+
readonly activity: Activity | null;
|
|
94
|
+
/** Logical evaluations, including unsuccessful fallback paths. */
|
|
95
|
+
readonly attempts: readonly InboxVerificationAttempt[];
|
|
96
|
+
/** Cryptographic success alone does not imply this decision is verified. */
|
|
97
|
+
readonly authentication: InboxAuthentication;
|
|
98
|
+
/** Response status snapshot or the original exception. */
|
|
99
|
+
readonly outcome: InboxRequestOutcome;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Observes an inbox delivery after processing, before fetch resolves/rethrows.
|
|
103
|
+
* The callback is awaited. Its errors are logged and swallowed, preserving
|
|
104
|
+
* the original response/exception. The last registered callback replaces the
|
|
105
|
+
* previous one. It excludes inbox collection GETs, unmatched routes,
|
|
106
|
+
* programmatic routing, and queue workers. This is not an atomic persistence
|
|
107
|
+
* guarantee. Keys/owner/controller declarations remain untrusted unless the
|
|
108
|
+
* final authentication decision verifies them.
|
|
109
|
+
* @since 2.4.0
|
|
110
|
+
*/
|
|
111
|
+
type InboxRequestFinishedHandler<TContextData> = (context: RequestContext<TContextData>, report: InboxRequestReport) => void | Promise<void>;
|
|
112
|
+
//#endregion
|
|
15
113
|
//#region src/compat/types.d.ts
|
|
16
114
|
/**
|
|
17
115
|
* A function that transforms an activity object.
|
|
@@ -145,6 +243,25 @@ type ActorKeyPairsDispatcher<TContextData> = (context: Context<TContextData>, id
|
|
|
145
243
|
*/
|
|
146
244
|
type ActorHandleMapper<TContextData> = (context: Context<TContextData>, username: string) => string | null | Promise<string | null>;
|
|
147
245
|
/**
|
|
246
|
+
* A callback that maps an actor's internal identifier to the ID of the
|
|
247
|
+
* [FEP-ef61] portable actor it dispatches, or `null` if the actor is not
|
|
248
|
+
* portable.
|
|
249
|
+
*
|
|
250
|
+
* The returned ID is an `ap:` or `ap+ef61:` URI, e.g.,
|
|
251
|
+
* `ap+ef61://did:key:z6Mk.../actors/alice`, or its compatible identifier.
|
|
252
|
+
* It must be the same ID that the actor dispatcher puts in the actor's `id`,
|
|
253
|
+
* and must not have a fragment.
|
|
254
|
+
*
|
|
255
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
256
|
+
*
|
|
257
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
258
|
+
* @param context The context.
|
|
259
|
+
* @param identifier The actor's internal identifier.
|
|
260
|
+
* @returns The portable actor's ID, or `null` if the actor is not portable.
|
|
261
|
+
* @since 2.4.0
|
|
262
|
+
*/
|
|
263
|
+
type PortableActorIdMapper<TContextData> = (context: Context<TContextData>, identifier: string) => URL | null | Promise<URL | null>;
|
|
264
|
+
/**
|
|
148
265
|
* A callback that maps a WebFinger query to the corresponding actor's
|
|
149
266
|
* internal identifier or username, or `null` if the query is not found.
|
|
150
267
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
@@ -164,14 +281,18 @@ type ActorAliasMapper<TContextData> = (context: RequestContext<TContextData>, re
|
|
|
164
281
|
username: string;
|
|
165
282
|
} | null>;
|
|
166
283
|
/**
|
|
167
|
-
* A callback that dispatches an object.
|
|
284
|
+
* A callback that dispatches an object or a {@link Tombstone}.
|
|
285
|
+
*
|
|
286
|
+
* Return a {@link Tombstone} if the object has been deleted; Fedify then
|
|
287
|
+
* responds with `410 Gone` and the serialized tombstone. Return `null` if
|
|
288
|
+
* the object is not found.
|
|
168
289
|
*
|
|
169
290
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
170
291
|
* @template TObject The type of object to dispatch.
|
|
171
292
|
* @template TParam The parameter names of the requested URL.
|
|
172
293
|
* @since 0.7.0
|
|
173
294
|
*/
|
|
174
|
-
type ObjectDispatcher<TContextData, TObject extends Object$1, TParam extends string> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => TObject | null | Promise<TObject | null>;
|
|
295
|
+
type ObjectDispatcher<TContextData, TObject extends Object$1, TParam extends string> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => TObject | Tombstone | null | Promise<TObject | Tombstone | null>;
|
|
175
296
|
/**
|
|
176
297
|
* A callback that dispatches a collection.
|
|
177
298
|
*
|
|
@@ -260,6 +381,60 @@ type OutboxListener<TContextData, TActivity extends Activity> = (context: Outbox
|
|
|
260
381
|
*/
|
|
261
382
|
type MediaUploaderCallback<TContextData> = (context: RequestContext<TContextData>, identifier: string, file: File, object: Object$1) => Object$1 | URL | Promise<Object$1 | URL>;
|
|
262
383
|
/**
|
|
384
|
+
* A request for a resource addressed by a hashlink, which an
|
|
385
|
+
* [FEP-ef61](https://w3id.org/fep/ef61) gateway serves at
|
|
386
|
+
* `/.well-known/apgateway/hl:<digestMultibase>`.
|
|
387
|
+
*
|
|
388
|
+
* Fedify validates the hashlink before creating this object, so the digest is
|
|
389
|
+
* always a well-formed SHA-256 multihash.
|
|
390
|
+
*
|
|
391
|
+
* @since 2.4.0
|
|
392
|
+
*/
|
|
393
|
+
interface HashlinkMediaRequest {
|
|
394
|
+
/**
|
|
395
|
+
* The requested hashlink, i.e., `hl:` followed by
|
|
396
|
+
* {@link HashlinkMediaRequest.digestMultibase}, after percent-decoding and
|
|
397
|
+
* with its scheme lowercased.
|
|
398
|
+
*/
|
|
399
|
+
readonly hashlink: `hl:${string}`;
|
|
400
|
+
/**
|
|
401
|
+
* The multibase-encoded multihash as requested, which is the value that
|
|
402
|
+
* publishers put in the `digestMultibase` property. The same digest can be
|
|
403
|
+
* encoded in several multibase encodings; use
|
|
404
|
+
* {@link HashlinkMediaRequest.digest} as a storage key to find a resource
|
|
405
|
+
* regardless of the encoding.
|
|
406
|
+
*/
|
|
407
|
+
readonly digestMultibase: string;
|
|
408
|
+
/** The hash algorithm of the digest. */
|
|
409
|
+
readonly algorithm: "sha2-256";
|
|
410
|
+
/** The raw 32-byte SHA-256 digest of the resource. */
|
|
411
|
+
readonly digest: Uint8Array;
|
|
412
|
+
/**
|
|
413
|
+
* The multihash decoded from
|
|
414
|
+
* {@link HashlinkMediaRequest.digestMultibase}, i.e., the hash algorithm
|
|
415
|
+
* code and the digest length followed by the digest.
|
|
416
|
+
*/
|
|
417
|
+
readonly multihash: Uint8Array;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* A callback that serves a resource addressed by a hashlink through the
|
|
421
|
+
* [FEP-ef61](https://w3id.org/fep/ef61) gateway endpoint.
|
|
422
|
+
*
|
|
423
|
+
* The returned response is sent as is, so the callback can stream its body
|
|
424
|
+
* and set headers such as `Content-Type` and `Cache-Control`. Fedify does not
|
|
425
|
+
* verify the response body against the digest, so the complete
|
|
426
|
+
* representation must be the exact bytes that hash to the requested digest.
|
|
427
|
+
*
|
|
428
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
429
|
+
* @param context The request context.
|
|
430
|
+
* @param media The requested hashlink and its digest.
|
|
431
|
+
* @returns The response to send, or `null` if the resource is not stored on
|
|
432
|
+
* this server, which results in `404 Not Found`. It may be returned
|
|
433
|
+
* synchronously or wrapped in a `Promise`.
|
|
434
|
+
* @since 2.4.0
|
|
435
|
+
*/
|
|
436
|
+
type HashlinkMediaDispatcher<TContextData> = (context: RequestContext<TContextData>, media: HashlinkMediaRequest) => Response | null | Promise<Response | null>;
|
|
437
|
+
/**
|
|
263
438
|
* The reason why an incoming activity could not be verified.
|
|
264
439
|
*
|
|
265
440
|
* Unlike inbox listeners registered through {@link InboxListenerSetters.on},
|
|
@@ -414,6 +589,28 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
|
414
589
|
*/
|
|
415
590
|
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>;
|
|
416
591
|
/**
|
|
592
|
+
* A callback that maps a custom collection to the identifier of the actor
|
|
593
|
+
* that owns it, so that the collection can be served as an [FEP-ef61]
|
|
594
|
+
* portable collection through the gateway endpoint, e.g.,
|
|
595
|
+
* `GET /.well-known/apgateway/did:key:z6Mk.../users/alice/bookmarks`.
|
|
596
|
+
*
|
|
597
|
+
* Fedify serves such a request only if the returned actor is a portable actor
|
|
598
|
+
* whose ID is under the requested DID. The owner has to come from
|
|
599
|
+
* the application's data, not from the request, since the DID in the request
|
|
600
|
+
* path is not evidence that this server hosts collections for it.
|
|
601
|
+
*
|
|
602
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
603
|
+
*
|
|
604
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
605
|
+
* @template TParam The parameter names of the requested URL.
|
|
606
|
+
* @param context The context.
|
|
607
|
+
* @param values The parameters of the requested URL.
|
|
608
|
+
* @returns The internal identifier of the actor that owns the collection, or
|
|
609
|
+
* `null` if the collection is not a portable collection.
|
|
610
|
+
* @since 2.4.0
|
|
611
|
+
*/
|
|
612
|
+
type PortableCollectionOwnerMapper<TContextData, TParam extends string> = (context: Context<TContextData>, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
613
|
+
/**
|
|
417
614
|
* A callback that counts the number of items in a custom collection.
|
|
418
615
|
*
|
|
419
616
|
* @template TParams The parameter names of the requested URL.
|
|
@@ -509,6 +706,17 @@ type CircuitBreakerOptions = CircuitBreakerFailurePolicy & {
|
|
|
509
706
|
*/
|
|
510
707
|
readonly releaseInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
511
708
|
/**
|
|
709
|
+
* How long Fedify keeps circuit breaker state in the configured key-value
|
|
710
|
+
* store.
|
|
711
|
+
*
|
|
712
|
+
* When omitted, Fedify derives this from `failureWindow`, `recoveryDelay`, and
|
|
713
|
+
* `heldActivityTtl` for the default numeric failure policy. Custom `failure`
|
|
714
|
+
* callbacks do not have an inspectable time window, so their state expires
|
|
715
|
+
* after `recoveryDelay` plus `heldActivityTtl` unless this option overrides
|
|
716
|
+
* it.
|
|
717
|
+
*/
|
|
718
|
+
readonly stateTtl?: Temporal.Duration | Temporal.DurationLike;
|
|
719
|
+
/**
|
|
512
720
|
* Called whenever the circuit state changes.
|
|
513
721
|
*/
|
|
514
722
|
readonly onStateChange?: (remoteHost: string, previousState: CircuitBreakerState, newState: CircuitBreakerState) => void | Promise<void>;
|
|
@@ -527,6 +735,7 @@ interface NormalizedCircuitBreakerOptions {
|
|
|
527
735
|
readonly recoveryDelay: Temporal.Duration;
|
|
528
736
|
readonly heldActivityTtl: Temporal.Duration;
|
|
529
737
|
readonly releaseInterval: Temporal.Duration;
|
|
738
|
+
readonly stateTtl: Temporal.Duration | undefined;
|
|
530
739
|
readonly onStateChange?: CircuitBreakerOptions["onStateChange"];
|
|
531
740
|
readonly onActivityDrop?: CircuitBreakerOptions["onActivityDrop"];
|
|
532
741
|
}
|
|
@@ -587,6 +796,11 @@ declare class CircuitBreaker {
|
|
|
587
796
|
recordFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
588
797
|
dropActivity(remoteHost: string, details: CircuitBreakerActivityDrop): Promise<void>;
|
|
589
798
|
getState(remoteHost: string): Promise<CircuitBreakerKvState | undefined>;
|
|
799
|
+
/**
|
|
800
|
+
* The currently running background legacy sweep, if any.
|
|
801
|
+
* @internal
|
|
802
|
+
*/
|
|
803
|
+
get pendingSweep(): Promise<void> | undefined;
|
|
590
804
|
}
|
|
591
805
|
/**
|
|
592
806
|
* Normalizes user-provided circuit breaker options into the internal policy
|
|
@@ -595,7 +809,8 @@ declare class CircuitBreaker {
|
|
|
595
809
|
* @param options The public circuit breaker options supplied to Fedify.
|
|
596
810
|
* @returns The normalized failure predicate, failure pruning function,
|
|
597
811
|
* duration values, and optional callbacks with defaults applied.
|
|
598
|
-
* @throws {RangeError} If any configured duration is not positive
|
|
812
|
+
* @throws {RangeError} If any configured duration is not positive, or if
|
|
813
|
+
* `stateTtl` is shorter than `recoveryDelay`.
|
|
599
814
|
* @throws {TypeError} If `failureThreshold` is not a positive integer.
|
|
600
815
|
*/
|
|
601
816
|
declare function normalizeCircuitBreakerOptions(options: CircuitBreakerOptions): NormalizedCircuitBreakerOptions;
|
|
@@ -608,6 +823,264 @@ declare function normalizeCircuitBreakerOptions(options: CircuitBreakerOptions):
|
|
|
608
823
|
*/
|
|
609
824
|
declare function parseCircuitBreakerKvState(value: unknown): CircuitBreakerKvState | undefined;
|
|
610
825
|
//#endregion
|
|
826
|
+
//#region src/federation/mq.d.ts
|
|
827
|
+
/**
|
|
828
|
+
* Additional options for enqueuing a message in a queue.
|
|
829
|
+
*
|
|
830
|
+
* @since 0.5.0
|
|
831
|
+
*/
|
|
832
|
+
interface MessageQueueEnqueueOptions {
|
|
833
|
+
/**
|
|
834
|
+
* The delay before the message is enqueued. No delay by default.
|
|
835
|
+
*
|
|
836
|
+
* It must not be negative.
|
|
837
|
+
*/
|
|
838
|
+
readonly delay?: Temporal.Duration;
|
|
839
|
+
/**
|
|
840
|
+
* An optional key that ensures messages with the same ordering key are
|
|
841
|
+
* processed sequentially (one at a time). Messages with different ordering
|
|
842
|
+
* keys (or no ordering key) may be processed in parallel.
|
|
843
|
+
*
|
|
844
|
+
* This is useful for ensuring that related messages are processed in order,
|
|
845
|
+
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
846
|
+
* activity for the same object.
|
|
847
|
+
*
|
|
848
|
+
* @since 2.0.0
|
|
849
|
+
*/
|
|
850
|
+
readonly orderingKey?: string;
|
|
851
|
+
/**
|
|
852
|
+
* An optional key requesting at-most-once enqueue semantics for messages
|
|
853
|
+
* that share it. A backend that declares
|
|
854
|
+
* {@link MessageQueue.nativeDeduplication} `true` owns the check: a message
|
|
855
|
+
* whose `deduplicationKey` was already seen within the backend's
|
|
856
|
+
* deduplication window is dropped instead of enqueued. Backends without
|
|
857
|
+
* native deduplication ignore this field; Fedify performs its own
|
|
858
|
+
* best-effort deduplication before reaching them on the paths that support
|
|
859
|
+
* it.
|
|
860
|
+
*
|
|
861
|
+
* @since 2.4.0
|
|
862
|
+
*/
|
|
863
|
+
readonly deduplicationKey?: string;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Additional options for listening to a message queue.
|
|
867
|
+
*
|
|
868
|
+
* @since 1.0.0
|
|
869
|
+
*/
|
|
870
|
+
interface MessageQueueListenOptions {
|
|
871
|
+
/**
|
|
872
|
+
* The signal to abort listening to the message queue.
|
|
873
|
+
*/
|
|
874
|
+
signal?: AbortSignal;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* The number of messages waiting in a message queue.
|
|
878
|
+
*
|
|
879
|
+
* @since 2.3.0
|
|
880
|
+
*/
|
|
881
|
+
interface MessageQueueDepth {
|
|
882
|
+
/**
|
|
883
|
+
* The total number of messages still waiting in the backend queue.
|
|
884
|
+
*
|
|
885
|
+
* This does not include messages that have already been handed to a worker
|
|
886
|
+
* for processing.
|
|
887
|
+
*/
|
|
888
|
+
readonly queued: number;
|
|
889
|
+
/**
|
|
890
|
+
* The number of queued messages eligible for immediate processing.
|
|
891
|
+
*
|
|
892
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
893
|
+
* may omit this field.
|
|
894
|
+
*/
|
|
895
|
+
readonly ready?: number;
|
|
896
|
+
/**
|
|
897
|
+
* The number of queued messages scheduled for later delivery.
|
|
898
|
+
*
|
|
899
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
900
|
+
* may omit this field.
|
|
901
|
+
*/
|
|
902
|
+
readonly delayed?: number;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* An abstract interface for a message queue.
|
|
906
|
+
*
|
|
907
|
+
* @since 0.5.0
|
|
908
|
+
*/
|
|
909
|
+
interface MessageQueue {
|
|
910
|
+
/**
|
|
911
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
912
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
913
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
914
|
+
* using its own retry policies.
|
|
915
|
+
*
|
|
916
|
+
* @default `false`
|
|
917
|
+
* @since 1.7.0
|
|
918
|
+
*/
|
|
919
|
+
readonly nativeRetrial?: boolean;
|
|
920
|
+
/**
|
|
921
|
+
* Whether the message queue backend deduplicates messages that share a
|
|
922
|
+
* {@link MessageQueueEnqueueOptions.deduplicationKey} natively. When `true`,
|
|
923
|
+
* Fedify forwards the `deduplicationKey` and relies on the backend to drop
|
|
924
|
+
* duplicates; when `false` or omitted, Fedify applies its own best-effort
|
|
925
|
+
* key–value deduplication on the paths that request it.
|
|
926
|
+
*
|
|
927
|
+
* @default `false`
|
|
928
|
+
* @since 2.4.0
|
|
929
|
+
*/
|
|
930
|
+
readonly nativeDeduplication?: boolean;
|
|
931
|
+
/**
|
|
932
|
+
* Whether {@link enqueueMany} accepts either every message or no messages.
|
|
933
|
+
* Backends that implement `enqueueMany()` by sending messages individually
|
|
934
|
+
* must set this to `false`, so Fedify does not use that method for a batch
|
|
935
|
+
* governed by one `deduplicationKey`. `true` by default when `enqueueMany`
|
|
936
|
+
* is implemented.
|
|
937
|
+
*
|
|
938
|
+
* @default `true`
|
|
939
|
+
* @since 2.4.0
|
|
940
|
+
*/
|
|
941
|
+
readonly atomicEnqueueMany?: boolean;
|
|
942
|
+
/**
|
|
943
|
+
* Enqueues a message in the queue.
|
|
944
|
+
* @param message The message to enqueue.
|
|
945
|
+
* @param options Additional options for enqueuing the message.
|
|
946
|
+
*/
|
|
947
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
948
|
+
/**
|
|
949
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
950
|
+
* and may not be supported by all implementations. If not supported,
|
|
951
|
+
* Fedify will invoke {@link enqueue} for each message. An implementation
|
|
952
|
+
* that may accept only part of a batch before rejecting must declare
|
|
953
|
+
* {@link atomicEnqueueMany} `false`.
|
|
954
|
+
*
|
|
955
|
+
* @param messages The messages to enqueue.
|
|
956
|
+
* @param options Additional options for enqueuing the messages.
|
|
957
|
+
*/
|
|
958
|
+
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
959
|
+
/**
|
|
960
|
+
* Listens for messages in the queue.
|
|
961
|
+
* @param handler The handler for messages in the queue.
|
|
962
|
+
* @param options Additional options for listening to the message queue.
|
|
963
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
964
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
965
|
+
* signal is provided, it never resolves.
|
|
966
|
+
*/
|
|
967
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
968
|
+
/**
|
|
969
|
+
* Gets the number of messages waiting in the queue.
|
|
970
|
+
*
|
|
971
|
+
* This operation is optional, and may not be supported by all
|
|
972
|
+
* implementations. The returned counts exclude messages currently being
|
|
973
|
+
* handled by a worker.
|
|
974
|
+
*
|
|
975
|
+
* @since 2.3.0
|
|
976
|
+
*/
|
|
977
|
+
getDepth?(): Promise<MessageQueueDepth>;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
981
|
+
* @since 1.0.0
|
|
982
|
+
*/
|
|
983
|
+
interface InProcessMessageQueueOptions {
|
|
984
|
+
/**
|
|
985
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
986
|
+
* @default `{ seconds: 5 }`
|
|
987
|
+
*/
|
|
988
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* A message queue that processes messages in the same process.
|
|
992
|
+
* Do not use this in production as it does neither persist messages nor
|
|
993
|
+
* distribute them across multiple processes.
|
|
994
|
+
*
|
|
995
|
+
* @since 0.5.0
|
|
996
|
+
*/
|
|
997
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
998
|
+
#private;
|
|
999
|
+
/**
|
|
1000
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
1001
|
+
* @since 1.7.0
|
|
1002
|
+
*/
|
|
1003
|
+
readonly nativeRetrial = false;
|
|
1004
|
+
/**
|
|
1005
|
+
* In-process message queue does not deduplicate messages natively.
|
|
1006
|
+
* @since 2.4.0
|
|
1007
|
+
*/
|
|
1008
|
+
readonly nativeDeduplication = false;
|
|
1009
|
+
/**
|
|
1010
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
1011
|
+
* @param options Additional options for the in-process message queue.
|
|
1012
|
+
*/
|
|
1013
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
1014
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
1015
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
1016
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
1017
|
+
getDepth(): Promise<MessageQueueDepth>;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* A message queue that processes messages in parallel. It takes another
|
|
1021
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
1022
|
+
* number of workers.
|
|
1023
|
+
*
|
|
1024
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
1025
|
+
*
|
|
1026
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
1027
|
+
* are not running in separate threads or processes. They are running in the
|
|
1028
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
1029
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
1030
|
+
* workloads.
|
|
1031
|
+
*
|
|
1032
|
+
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
1033
|
+
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
1034
|
+
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
1035
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
1036
|
+
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
1037
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
1038
|
+
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
1039
|
+
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
1040
|
+
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
1041
|
+
*
|
|
1042
|
+
* Messages with the same ordering key will never be processed concurrently
|
|
1043
|
+
* by different workers, ensuring sequential processing within each key.
|
|
1044
|
+
* Messages with different ordering keys (or no ordering key) can still be
|
|
1045
|
+
* processed in parallel.
|
|
1046
|
+
*
|
|
1047
|
+
* @since 1.0.0
|
|
1048
|
+
*/
|
|
1049
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
1050
|
+
#private;
|
|
1051
|
+
readonly queue: MessageQueue;
|
|
1052
|
+
readonly workers: number;
|
|
1053
|
+
/**
|
|
1054
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
1055
|
+
* @since 1.7.0
|
|
1056
|
+
*/
|
|
1057
|
+
readonly nativeRetrial?: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* Inherits the native deduplication capability from the wrapped queue.
|
|
1060
|
+
* @since 2.4.0
|
|
1061
|
+
*/
|
|
1062
|
+
readonly nativeDeduplication?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* Inherits the atomic batch capability from the wrapped queue.
|
|
1065
|
+
* @since 2.4.0
|
|
1066
|
+
*/
|
|
1067
|
+
readonly atomicEnqueueMany?: boolean;
|
|
1068
|
+
readonly getDepth?: () => Promise<MessageQueueDepth>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
1071
|
+
* number of workers.
|
|
1072
|
+
* @param queue The message queue to use under the hood. Note that
|
|
1073
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
1074
|
+
* @param workers The number of workers to process messages in parallel.
|
|
1075
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
1076
|
+
* {@link ParallelMessageQueue}.
|
|
1077
|
+
*/
|
|
1078
|
+
constructor(queue: MessageQueue, workers: number);
|
|
1079
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
1080
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
1081
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
1082
|
+
}
|
|
1083
|
+
//#endregion
|
|
611
1084
|
//#region src/federation/handler.d.ts
|
|
612
1085
|
/**
|
|
613
1086
|
* Options for the {@link respondWithObject} and
|
|
@@ -885,6 +1358,18 @@ interface FanoutMessage {
|
|
|
885
1358
|
readonly inboxes: Readonly<Record<string, {
|
|
886
1359
|
readonly actorIds: readonly string[];
|
|
887
1360
|
readonly sharedInbox: boolean;
|
|
1361
|
+
/**
|
|
1362
|
+
* The canonical form of the FEP-ef61 portable inbox that the inbox
|
|
1363
|
+
* stands for.
|
|
1364
|
+
* @internal
|
|
1365
|
+
*/
|
|
1366
|
+
readonly portableInbox?: string;
|
|
1367
|
+
/**
|
|
1368
|
+
* The compatible identifiers of the portable inbox on each gateway to
|
|
1369
|
+
* deliver through, in order.
|
|
1370
|
+
* @internal
|
|
1371
|
+
*/
|
|
1372
|
+
readonly gatewayInboxes?: readonly string[];
|
|
888
1373
|
}>>;
|
|
889
1374
|
readonly activity: unknown;
|
|
890
1375
|
readonly activityId?: string;
|
|
@@ -928,6 +1413,27 @@ interface OutboxMessage {
|
|
|
928
1413
|
* @internal
|
|
929
1414
|
*/
|
|
930
1415
|
readonly circuitHeldSince?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* The canonical form of the FEP-ef61 portable inbox that {@link inbox}, its
|
|
1418
|
+
* compatible identifier on a gateway, stands for.
|
|
1419
|
+
* @internal
|
|
1420
|
+
*/
|
|
1421
|
+
readonly portableInbox?: string;
|
|
1422
|
+
/**
|
|
1423
|
+
* The compatible identifiers of the FEP-ef61 portable inbox on each gateway
|
|
1424
|
+
* that is still to be tried, in order. {@link inbox} is the first one.
|
|
1425
|
+
* If there is more than one, the activity is delivered through the first
|
|
1426
|
+
* gateway that accepts it.
|
|
1427
|
+
* @internal
|
|
1428
|
+
*/
|
|
1429
|
+
readonly gatewayInboxes?: readonly string[];
|
|
1430
|
+
/**
|
|
1431
|
+
* The times before which each of {@link gatewayInboxes} must not be tried
|
|
1432
|
+
* again, as their responses' `Retry-After` headers requested, keyed by
|
|
1433
|
+
* the inbox URL, in ISO 8601.
|
|
1434
|
+
* @internal
|
|
1435
|
+
*/
|
|
1436
|
+
readonly gatewayNotBefore?: Readonly<Record<string, string>>;
|
|
931
1437
|
readonly traceContext: Readonly<Record<string, string>>;
|
|
932
1438
|
}
|
|
933
1439
|
/**
|
|
@@ -1076,6 +1582,16 @@ interface FederationKvPrefixes {
|
|
|
1076
1582
|
* @since 2.4.0
|
|
1077
1583
|
*/
|
|
1078
1584
|
readonly taskDeduplication: KvKey;
|
|
1585
|
+
/**
|
|
1586
|
+
* The key prefix used for remembering which activities received in
|
|
1587
|
+
* [FEP-ef61] portable inboxes have been forwarded to which gateways, so that
|
|
1588
|
+
* each activity is forwarded at most once.
|
|
1589
|
+
*
|
|
1590
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
1591
|
+
* @default `["_fedify", "portableInboxForwarding"]`
|
|
1592
|
+
* @since 2.4.0
|
|
1593
|
+
*/
|
|
1594
|
+
readonly portableInboxForwarding: KvKey;
|
|
1079
1595
|
}
|
|
1080
1596
|
/**
|
|
1081
1597
|
* Options for {@link FederationOptions.origin} when it is not a string.
|
|
@@ -1101,6 +1617,8 @@ interface FederationOrigin {
|
|
|
1101
1617
|
* @returns A new {@link Federation} instance.
|
|
1102
1618
|
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
1103
1619
|
* specified.
|
|
1620
|
+
* @throws {RangeError} If {@link FederationOptions.maxHttpSignatures} is not
|
|
1621
|
+
* a positive integer or `Infinity`.
|
|
1104
1622
|
* @since 0.10.0
|
|
1105
1623
|
*/
|
|
1106
1624
|
declare function createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>;
|
|
@@ -1182,7 +1700,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1182
1700
|
* based on URI Template
|
|
1183
1701
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1184
1702
|
* must have one or more variables.
|
|
1185
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1703
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1704
|
+
* return an object, a `Tombstone` if the object has been
|
|
1705
|
+
* deleted, or `null` if the object is not found.
|
|
1186
1706
|
*/
|
|
1187
1707
|
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>;
|
|
1188
1708
|
/**
|
|
@@ -1196,7 +1716,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1196
1716
|
* based on URI Template
|
|
1197
1717
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1198
1718
|
* must have one or more variables.
|
|
1199
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1719
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1720
|
+
* return an object, a `Tombstone` if the object has been
|
|
1721
|
+
* deleted, or `null` if the object is not found.
|
|
1200
1722
|
*/
|
|
1201
1723
|
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>;
|
|
1202
1724
|
/**
|
|
@@ -1210,7 +1732,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1210
1732
|
* based on URI Template
|
|
1211
1733
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1212
1734
|
* must have one or more variables.
|
|
1213
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1735
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1736
|
+
* return an object, a `Tombstone` if the object has been
|
|
1737
|
+
* deleted, or `null` if the object is not found.
|
|
1214
1738
|
*/
|
|
1215
1739
|
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>;
|
|
1216
1740
|
/**
|
|
@@ -1224,7 +1748,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1224
1748
|
* based on URI Template
|
|
1225
1749
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1226
1750
|
* must have one or more variables.
|
|
1227
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1751
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1752
|
+
* return an object, a `Tombstone` if the object has been
|
|
1753
|
+
* deleted, or `null` if the object is not found.
|
|
1228
1754
|
*/
|
|
1229
1755
|
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>;
|
|
1230
1756
|
/**
|
|
@@ -1238,7 +1764,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1238
1764
|
* based on URI Template
|
|
1239
1765
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1240
1766
|
* must have one or more variables.
|
|
1241
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1767
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1768
|
+
* return an object, a `Tombstone` if the object has been
|
|
1769
|
+
* deleted, or `null` if the object is not found.
|
|
1242
1770
|
*/
|
|
1243
1771
|
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>;
|
|
1244
1772
|
/**
|
|
@@ -1252,7 +1780,9 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1252
1780
|
* based on URI Template
|
|
1253
1781
|
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
|
1254
1782
|
* must have one or more variables.
|
|
1255
|
-
* @param dispatcher An object dispatcher callback to register.
|
|
1783
|
+
* @param dispatcher An object dispatcher callback to register. It may
|
|
1784
|
+
* return an object, a `Tombstone` if the object has been
|
|
1785
|
+
* deleted, or `null` if the object is not found.
|
|
1256
1786
|
*/
|
|
1257
1787
|
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>;
|
|
1258
1788
|
/**
|
|
@@ -1360,6 +1890,53 @@ interface Federatable<TContextData> extends TaskRegistry<TContextData> {
|
|
|
1360
1890
|
*/
|
|
1361
1891
|
setMediaUploader(path: `${string}${Rfc6570Expression<"identifier">}${string}`, callback: MediaUploaderCallback<TContextData>): MediaUploaderSetters<TContextData>;
|
|
1362
1892
|
/**
|
|
1893
|
+
* Registers a dispatcher that serves resources addressed by hashlinks, such
|
|
1894
|
+
* as media attached to portable objects, through the
|
|
1895
|
+
* [FEP-ef61](https://w3id.org/fep/ef61) gateway endpoint, e.g.,
|
|
1896
|
+
* `GET /.well-known/apgateway/hl:zQmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n`.
|
|
1897
|
+
*
|
|
1898
|
+
* Fedify responds with `400 Bad Request` without calling the dispatcher if
|
|
1899
|
+
* the hashlink is malformed or its digest is not a SHA-256 multihash, and
|
|
1900
|
+
* with `404 Not Found` if the dispatcher returns `null`. Otherwise, the
|
|
1901
|
+
* response returned by the dispatcher is sent as is. Requests with methods
|
|
1902
|
+
* other than `GET` and `HEAD` get `405 Method Not Allowed`.
|
|
1903
|
+
*
|
|
1904
|
+
* Fedify does not verify the served bytes against the digest, as that would
|
|
1905
|
+
* require buffering the whole response body. The dispatcher must serve only
|
|
1906
|
+
* the resource whose complete representation hashes to the requested
|
|
1907
|
+
* digest, e.g., by using the digest as the storage key.
|
|
1908
|
+
*
|
|
1909
|
+
* This is not the upload API of the ActivityPub Media Upload extension,
|
|
1910
|
+
* which is registered through {@link Federatable.setMediaUploader}.
|
|
1911
|
+
*
|
|
1912
|
+
* @example
|
|
1913
|
+
* ``` typescript
|
|
1914
|
+
* federation.setHashlinkMediaDispatcher(async (ctx, media) => {
|
|
1915
|
+
* const file = await findPublicMedia(media.digest);
|
|
1916
|
+
* if (file == null) return null;
|
|
1917
|
+
* return new Response(
|
|
1918
|
+
* ctx.request.method === "HEAD" ? null : file.stream(),
|
|
1919
|
+
* {
|
|
1920
|
+
* headers: {
|
|
1921
|
+
* "Content-Type": file.mediaType,
|
|
1922
|
+
* "Content-Length": file.size.toString(),
|
|
1923
|
+
* "Cache-Control": "public, max-age=31536000, immutable",
|
|
1924
|
+
* "X-Content-Type-Options": "nosniff",
|
|
1925
|
+
* },
|
|
1926
|
+
* },
|
|
1927
|
+
* );
|
|
1928
|
+
* });
|
|
1929
|
+
* ```
|
|
1930
|
+
*
|
|
1931
|
+
* @param dispatcher A callback that returns the response serving the
|
|
1932
|
+
* requested resource, or `null` if it is not stored on
|
|
1933
|
+
* this server.
|
|
1934
|
+
* @throws {RouterError} Thrown if a hashlink media dispatcher is already
|
|
1935
|
+
* registered.
|
|
1936
|
+
* @since 2.4.0
|
|
1937
|
+
*/
|
|
1938
|
+
setHashlinkMediaDispatcher(dispatcher: HashlinkMediaDispatcher<TContextData>): void;
|
|
1939
|
+
/**
|
|
1363
1940
|
* Registers a following collection dispatcher.
|
|
1364
1941
|
* @param path The URI path pattern for the following collection. The syntax
|
|
1365
1942
|
* is based on URI Template
|
|
@@ -1635,6 +2212,47 @@ interface FederationBuilder<TContextData> extends Federatable<TContextData> {
|
|
|
1635
2212
|
build(options: FederationOptions<TContextData>): Promise<Federation<TContextData>>;
|
|
1636
2213
|
}
|
|
1637
2214
|
/**
|
|
2215
|
+
* Options for forwarding activities received in [FEP-ef61] portable inboxes to
|
|
2216
|
+
* the other gateways of their actors. See
|
|
2217
|
+
* {@link FederationOptions.portableInboxForwarding}.
|
|
2218
|
+
*
|
|
2219
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
2220
|
+
* @since 2.4.0
|
|
2221
|
+
*/
|
|
2222
|
+
interface PortableInboxForwardingOptions {
|
|
2223
|
+
/**
|
|
2224
|
+
* The maximum number of other gateways that a single delivery is forwarded
|
|
2225
|
+
* to. Gateways beyond it are skipped with a warning. `0` turns off
|
|
2226
|
+
* forwarding.
|
|
2227
|
+
* @default `10`
|
|
2228
|
+
*/
|
|
2229
|
+
maxTargets?: number;
|
|
2230
|
+
/**
|
|
2231
|
+
* How long Fedify remembers that it has forwarded an activity from
|
|
2232
|
+
* a portable inbox to a gateway, under
|
|
2233
|
+
* {@link FederationKvPrefixes.portableInboxForwarding}. Within it, the same
|
|
2234
|
+
* activity is never forwarded to the same gateway again; once it expires,
|
|
2235
|
+
* a redelivery of the activity may be forwarded again. It cannot have
|
|
2236
|
+
* calendar units, i.e., weeks, months, or years.
|
|
2237
|
+
* @default `{ days: 30 }`
|
|
2238
|
+
*/
|
|
2239
|
+
ttl?: Temporal.DurationLike;
|
|
2240
|
+
/**
|
|
2241
|
+
* How long a delivery waits for forwarding requests made immediately, i.e.,
|
|
2242
|
+
* when no outbox queue is configured, before Fedify responds to it.
|
|
2243
|
+
* Requests still running afterwards continue in the background. It also
|
|
2244
|
+
* bounds verifying the HTTP Signature that identifies the gateway which
|
|
2245
|
+
* forwarded the delivery, with or without an outbox queue; if the
|
|
2246
|
+
* verification does not finish in time, the activity is forwarded to that
|
|
2247
|
+
* gateway as well. It cannot have calendar units,
|
|
2248
|
+
* i.e., weeks, months, or years, and cannot be longer than
|
|
2249
|
+
* 2,147,483,647 milliseconds (about 24.8 days), the longest delay timers
|
|
2250
|
+
* support.
|
|
2251
|
+
* @default `{ seconds: 10 }`
|
|
2252
|
+
*/
|
|
2253
|
+
deadline?: Temporal.DurationLike;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
1638
2256
|
* Policy for emitting `Accept-Signature` challenges on inbox `401`
|
|
1639
2257
|
* responses, as defined in
|
|
1640
2258
|
* [RFC 9421 §5](https://www.rfc-editor.org/rfc/rfc9421#section-5).
|
|
@@ -1702,6 +2320,41 @@ interface FederationOptions<TContextData> {
|
|
|
1702
2320
|
*/
|
|
1703
2321
|
kvPrefixes?: Partial<FederationKvPrefixes>;
|
|
1704
2322
|
/**
|
|
2323
|
+
* The time-to-live for a remote actor's public key cached under
|
|
2324
|
+
* {@link FederationKvPrefixes.publicKey}. Once it expires, the next
|
|
2325
|
+
* signature verification that needs the key refetches it from the remote
|
|
2326
|
+
* server and caches it again.
|
|
2327
|
+
*
|
|
2328
|
+
* Shortening it bounds how long a revoked or rotated key stays in the cache,
|
|
2329
|
+
* at the cost of more requests to remote servers; refetching an expired key
|
|
2330
|
+
* fails while the peer is unavailable, so a very short value makes
|
|
2331
|
+
* verification depend on the peer being reachable.
|
|
2332
|
+
* @default `{ days: 30 }`
|
|
2333
|
+
* @since 2.4.0
|
|
2334
|
+
*/
|
|
2335
|
+
publicKeyTtl?: Temporal.DurationLike;
|
|
2336
|
+
/**
|
|
2337
|
+
* The time-to-live for a remote origin's remembered HTTP Message Signatures
|
|
2338
|
+
* spec cached under {@link FederationKvPrefixes.httpMessageSignaturesSpec}.
|
|
2339
|
+
* Once it expires, the next delivery to that origin relearns the spec by
|
|
2340
|
+
* double-knocking and remembers it again.
|
|
2341
|
+
*
|
|
2342
|
+
* Shortening it makes Fedify notice a peer's spec upgrade sooner, at the
|
|
2343
|
+
* cost of an extra signed request per delivery whenever the first spec tried
|
|
2344
|
+
* is rejected.
|
|
2345
|
+
* @default `{ days: 90 }`
|
|
2346
|
+
* @since 2.4.0
|
|
2347
|
+
*/
|
|
2348
|
+
httpMessageSignaturesSpecTtl?: Temporal.DurationLike;
|
|
2349
|
+
/**
|
|
2350
|
+
* Options for forwarding activities received in [FEP-ef61] portable inboxes
|
|
2351
|
+
* to the other gateways of their actors.
|
|
2352
|
+
*
|
|
2353
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
2354
|
+
* @since 2.4.0
|
|
2355
|
+
*/
|
|
2356
|
+
portableInboxForwarding?: PortableInboxForwardingOptions;
|
|
2357
|
+
/**
|
|
1705
2358
|
* The message queue for sending and receiving activities. If not provided,
|
|
1706
2359
|
* activities will not be queued and will be processed immediately.
|
|
1707
2360
|
*
|
|
@@ -1752,7 +2405,8 @@ interface FederationOptions<TContextData> {
|
|
|
1752
2405
|
*/
|
|
1753
2406
|
authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory;
|
|
1754
2407
|
/**
|
|
1755
|
-
* Whether to allow
|
|
2408
|
+
* Whether to allow private network addresses in the document loader and
|
|
2409
|
+
* outbound activity delivery, including redirects.
|
|
1756
2410
|
*
|
|
1757
2411
|
* If turned on, {@link FederationOptions.documentLoader},
|
|
1758
2412
|
* {@link FederationOptions.contextLoader}, and
|
|
@@ -1789,6 +2443,35 @@ interface FederationOptions<TContextData> {
|
|
|
1789
2443
|
*/
|
|
1790
2444
|
userAgent?: GetUserAgentOptions | string;
|
|
1791
2445
|
/**
|
|
2446
|
+
* The timeout for each call of the built-in document loader, context
|
|
2447
|
+
* loader, and authenticated document loader, e.g., when Fedify fetches
|
|
2448
|
+
* a key to verify a signature. The timeout is shared by all the steps of
|
|
2449
|
+
* a call, including every redirect it follows, retries, and reading the
|
|
2450
|
+
* response body. It does not cover the time spent reading from or
|
|
2451
|
+
* writing to the cache.
|
|
2452
|
+
*
|
|
2453
|
+
* A timed-out call throws a `FetchError` without a response, whose
|
|
2454
|
+
* `cause` is a `DOMException` named `"TimeoutError"`, so that, e.g.,
|
|
2455
|
+
* a key fetch that times out is reported as a `keyFetchError` and cached
|
|
2456
|
+
* like other failures to fetch a key.
|
|
2457
|
+
*
|
|
2458
|
+
* It does not affect loaders made by
|
|
2459
|
+
* {@link FederationOptions.documentLoaderFactory},
|
|
2460
|
+
* {@link FederationOptions.contextLoaderFactory}, or
|
|
2461
|
+
* {@link FederationOptions.authenticatedDocumentLoaderFactory}.
|
|
2462
|
+
* Note that if only {@link FederationOptions.documentLoaderFactory} is
|
|
2463
|
+
* set, it also makes context loaders.
|
|
2464
|
+
*
|
|
2465
|
+
* Set it to `null` to turn off the timeout.
|
|
2466
|
+
*
|
|
2467
|
+
* 10 seconds by default.
|
|
2468
|
+
* @throws {RangeError} If the duration is not positive, is longer than
|
|
2469
|
+
* about 24.8 days, or is given in calendar units
|
|
2470
|
+
* such as months.
|
|
2471
|
+
* @since 2.4.0
|
|
2472
|
+
*/
|
|
2473
|
+
documentLoaderTimeout?: Temporal.Duration | Temporal.DurationLike | null;
|
|
2474
|
+
/**
|
|
1792
2475
|
* A callback that handles errors during outbox processing. Note that this
|
|
1793
2476
|
* callback can be called multiple times for the same activity, because
|
|
1794
2477
|
* the delivery is retried according to the backoff schedule until it
|
|
@@ -1817,6 +2500,29 @@ interface FederationOptions<TContextData> {
|
|
|
1817
2500
|
*/
|
|
1818
2501
|
signatureTimeWindow?: Temporal.Duration | Temporal.DurationLike | false;
|
|
1819
2502
|
/**
|
|
2503
|
+
* The maximum number of [RFC 9421] signatures of an incoming request to
|
|
2504
|
+
* verify, e.g., in the inbox and in
|
|
2505
|
+
* {@link RequestContext.getSignedKey}. A request can carry several
|
|
2506
|
+
* signatures, each of which may make Fedify fetch the key that it names,
|
|
2507
|
+
* so only the first ones in the order of the `Signature-Input` header are
|
|
2508
|
+
* verified, and the rest are ignored as if they were absent. Every
|
|
2509
|
+
* signature among the first ones counts, even if it fails before its key
|
|
2510
|
+
* is fetched. See also the `maxSignatures` option of `verifyRequest()`.
|
|
2511
|
+
*
|
|
2512
|
+
* It has to be a positive integer, or `Infinity` to verify every
|
|
2513
|
+
* signature, which lets a single request make Fedify fetch any number of
|
|
2514
|
+
* keys. Draft-cavage HTTP Signatures carry a single signature, so this
|
|
2515
|
+
* option does not affect them.
|
|
2516
|
+
*
|
|
2517
|
+
* Three by default.
|
|
2518
|
+
*
|
|
2519
|
+
* [RFC 9421]: https://www.rfc-editor.org/rfc/rfc9421
|
|
2520
|
+
* @throws {RangeError} Thrown when the federation is created if the value
|
|
2521
|
+
* is not a positive integer or `Infinity`.
|
|
2522
|
+
* @since 2.4.0
|
|
2523
|
+
*/
|
|
2524
|
+
maxHttpSignatures?: number;
|
|
2525
|
+
/**
|
|
1820
2526
|
* Whether to skip HTTP Signatures verification for incoming activities.
|
|
1821
2527
|
* This is useful for testing purposes, but should not be used in production.
|
|
1822
2528
|
*
|
|
@@ -1995,6 +2701,30 @@ interface ActorCallbackSetters<TContextData> {
|
|
|
1995
2701
|
*/
|
|
1996
2702
|
mapAlias(mapper: ActorAliasMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
|
1997
2703
|
/**
|
|
2704
|
+
* Sets the callback function that maps an actor's identifier to the ID of
|
|
2705
|
+
* the [FEP-ef61] portable actor it dispatches. If the callback returns
|
|
2706
|
+
* a portable ID for an identifier, the key pairs of that actor are treated
|
|
2707
|
+
* as this server's *gateway keys* for the portable actor:
|
|
2708
|
+
* {@link Context.getActorKeyPairs} derives their key IDs from the actor's
|
|
2709
|
+
* compatible identifier on this server, e.g.,
|
|
2710
|
+
* `https://example.com/.well-known/apgateway/did:key:z6Mk.../actors/alice#main-key`,
|
|
2711
|
+
* and makes the portable actor their owner, so that requests this server
|
|
2712
|
+
* makes on behalf of the actor, such as activity deliveries and signed
|
|
2713
|
+
* fetches, are signed with them. Gateway keys are only used for HTTP
|
|
2714
|
+
* Signatures; they never make Object Integrity Proofs or Linked Data
|
|
2715
|
+
* Signatures.
|
|
2716
|
+
*
|
|
2717
|
+
* If it's omitted, or it returns `null`, the actor's keys are derived from
|
|
2718
|
+
* {@link Context.getActorUri} as usual.
|
|
2719
|
+
*
|
|
2720
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
2721
|
+
* @param mapper A callback that maps an actor's identifier to its portable
|
|
2722
|
+
* ID, or `null` if the actor is not portable.
|
|
2723
|
+
* @returns The setters object so that settings can be chained.
|
|
2724
|
+
* @since 2.4.0
|
|
2725
|
+
*/
|
|
2726
|
+
mapPortableActorId(mapper: PortableActorIdMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
|
2727
|
+
/**
|
|
1998
2728
|
* Maps a fixed path to a sentinel identifier. It is useful for exposing
|
|
1999
2729
|
* a single, instance-level actor at a fixed path, such as `/actor` for
|
|
2000
2730
|
* a relay or `/bot` for a bot.
|
|
@@ -2159,6 +2889,16 @@ interface InboxListenerSetters<TContextData> {
|
|
|
2159
2889
|
*/
|
|
2160
2890
|
onError(handler: InboxErrorHandler<TContextData>): InboxListenerSetters<TContextData>;
|
|
2161
2891
|
/**
|
|
2892
|
+
* Observes each configured inbox delivery once, before fetch finishes.
|
|
2893
|
+
* The callback is awaited and its errors do not alter delivery processing.
|
|
2894
|
+
* Calling this again replaces the previous callback. Built federations
|
|
2895
|
+
* retain the callback registered at build time.
|
|
2896
|
+
* @param handler The request completion observer.
|
|
2897
|
+
* @returns This setter for chaining.
|
|
2898
|
+
* @since 2.4.0
|
|
2899
|
+
*/
|
|
2900
|
+
onRequestFinished(handler: InboxRequestFinishedHandler<TContextData>): InboxListenerSetters<TContextData>;
|
|
2901
|
+
/**
|
|
2162
2902
|
* Registers a callback for incoming activities whose HTTP signatures could
|
|
2163
2903
|
* not be verified.
|
|
2164
2904
|
*
|
|
@@ -2297,6 +3037,21 @@ interface CustomCollectionCallbackSetters<TParam extends string, TContext extend
|
|
|
2297
3037
|
* @since 0.7.0
|
|
2298
3038
|
*/
|
|
2299
3039
|
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
3040
|
+
/**
|
|
3041
|
+
* Maps the custom collection to the actor that owns it, so that it is also
|
|
3042
|
+
* served as an [FEP-ef61] portable collection through the gateway endpoint,
|
|
3043
|
+
* e.g., `GET /.well-known/apgateway/did:key:z6Mk.../users/alice/bookmarks`,
|
|
3044
|
+
* if the owner is a portable actor under the requested DID. Without it,
|
|
3045
|
+
* the custom collection is not served through the gateway endpoint.
|
|
3046
|
+
*
|
|
3047
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3048
|
+
* @param mapper A callback that returns the identifier of the actor that
|
|
3049
|
+
* owns the collection, or `null` if the collection is not
|
|
3050
|
+
* portable.
|
|
3051
|
+
* @returns The setters object so that settings can be chained.
|
|
3052
|
+
* @since 2.4.0
|
|
3053
|
+
*/
|
|
3054
|
+
mapPortableOwner(mapper: PortableCollectionOwnerMapper<TContextData, TParam>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
|
2300
3055
|
}
|
|
2301
3056
|
/**
|
|
2302
3057
|
* Represents an object with a type ID, which is either a constructor or an
|
|
@@ -2393,6 +3148,28 @@ interface Context<TContextData> {
|
|
|
2393
3148
|
*/
|
|
2394
3149
|
readonly contextLoader: DocumentLoader;
|
|
2395
3150
|
/**
|
|
3151
|
+
* The [FEP-ef61] portable object policy that this context applies to
|
|
3152
|
+
* portable objects it dereferences. It is `verifyPortableObject()` with
|
|
3153
|
+
* this context's document loader, context loader, and tracer provider as
|
|
3154
|
+
* defaults, which the options passed to it override.
|
|
3155
|
+
*
|
|
3156
|
+
* Since its name is the same as the `verifyPortableObject` option of
|
|
3157
|
+
* property accessors, `lookupObject()`, and `traverseCollection()`, passing
|
|
3158
|
+
* a context as their options applies the policy, e.g.,
|
|
3159
|
+
* `await create.getObject(ctx)`. Objects parsed with a context as options,
|
|
3160
|
+
* such as activities that inboxes receive, and objects that accessors
|
|
3161
|
+
* fetch with a context as options also use it by default for their
|
|
3162
|
+
* property accessors. It never verifies an object by itself being
|
|
3163
|
+
* there: it only applies to objects that are dereferenced.
|
|
3164
|
+
*
|
|
3165
|
+
* It is optional only so that custom implementations of this interface
|
|
3166
|
+
* keep working; contexts that Fedify creates always have it.
|
|
3167
|
+
*
|
|
3168
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3169
|
+
* @since 2.4.0
|
|
3170
|
+
*/
|
|
3171
|
+
readonly verifyPortableObject?: PortableObjectVerifier;
|
|
3172
|
+
/**
|
|
2396
3173
|
* The federation object that this context belongs to.
|
|
2397
3174
|
* @since 1.6.0
|
|
2398
3175
|
*/
|
|
@@ -2421,16 +3198,108 @@ interface Context<TContextData> {
|
|
|
2421
3198
|
*/
|
|
2422
3199
|
getActorUri(identifier: string): URL;
|
|
2423
3200
|
/**
|
|
2424
|
-
* Builds the
|
|
2425
|
-
*
|
|
2426
|
-
*
|
|
2427
|
-
* @
|
|
3201
|
+
* Builds the [FEP-ef61] portable ID of an actor with the given identifier
|
|
3202
|
+
* under the given DID authority.
|
|
3203
|
+
*
|
|
3204
|
+
* The path is the same as the one {@link Context.getActorUri} builds, but
|
|
3205
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3206
|
+
* `ap+ef61://did:key:z6Mk.../users/alice`. Such an actor can be served
|
|
3207
|
+
* through the FEP-ef61 gateway endpoint,
|
|
3208
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice`, by the same actor
|
|
3209
|
+
* dispatcher.
|
|
3210
|
+
*
|
|
3211
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3212
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3213
|
+
* from `@fedify/vocab-runtime` to get the canonical string, e.g.,
|
|
3214
|
+
* `ap+ef61://did:key:z6Mk.../users/alice`.
|
|
3215
|
+
*
|
|
3216
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3217
|
+
*
|
|
3218
|
+
* @param identifier The actor's identifier.
|
|
3219
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3220
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3221
|
+
* a path, query, or fragment. A `did:key` DID must be
|
|
3222
|
+
* encoded in base58-btc, as FEP-ef61 requires; see
|
|
3223
|
+
* `exportDidKey()` from `@fedify/vocab-runtime`.
|
|
3224
|
+
* @returns The actor's portable ID.
|
|
3225
|
+
* @throws {RouterError} If no actor dispatcher is available.
|
|
3226
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3227
|
+
* DID that is not encoded in base58-btc.
|
|
3228
|
+
* @since 2.4.0
|
|
3229
|
+
*/
|
|
3230
|
+
getPortableActorUri(identifier: string, authority: string): URL;
|
|
3231
|
+
/**
|
|
3232
|
+
* Builds the URI of an object with the given class and values.
|
|
3233
|
+
* @param cls The class of the object.
|
|
3234
|
+
* @param values The values to pass to the object dispatcher.
|
|
3235
|
+
* @returns The object's URI.
|
|
2428
3236
|
* @throws {RouterError} If no object dispatcher is available for the class.
|
|
2429
3237
|
* @throws {TypeError} If values are invalid.
|
|
2430
3238
|
* @since 0.7.0
|
|
2431
3239
|
*/
|
|
2432
3240
|
getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
|
|
2433
3241
|
/**
|
|
3242
|
+
* Builds the [FEP-ef61] portable ID of an object with the given class and
|
|
3243
|
+
* values under the given DID authority.
|
|
3244
|
+
*
|
|
3245
|
+
* The path is the same as the one {@link Context.getObjectUri} builds from
|
|
3246
|
+
* the object dispatcher's path, but the result is an `ap+ef61:` URI whose
|
|
3247
|
+
* authority is the DID, e.g., `ap+ef61://did:key:z6Mk.../notes/123`.
|
|
3248
|
+
* Such an object can be served through the FEP-ef61 gateway endpoint,
|
|
3249
|
+
* `/.well-known/apgateway/did:key:z6Mk.../notes/123`, by the same object
|
|
3250
|
+
* dispatcher.
|
|
3251
|
+
*
|
|
3252
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3253
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3254
|
+
* from `@fedify/vocab-runtime` to get the canonical string, e.g.,
|
|
3255
|
+
* `ap+ef61://did:key:z6Mk.../notes/123`.
|
|
3256
|
+
*
|
|
3257
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3258
|
+
*
|
|
3259
|
+
* @param cls The class of the object.
|
|
3260
|
+
* @param values The values to pass to the object dispatcher.
|
|
3261
|
+
* @param authority The DID that controls the object, e.g.,
|
|
3262
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3263
|
+
* a path, query, or fragment.
|
|
3264
|
+
* @returns The object's portable ID.
|
|
3265
|
+
* @throws {RouterError} If no object dispatcher is available for the class.
|
|
3266
|
+
* @throws {TypeError} If values are invalid, or the authority is not a DID
|
|
3267
|
+
* or is a `did:key` DID that is not encoded in
|
|
3268
|
+
* base58-btc.
|
|
3269
|
+
* @since 2.4.0
|
|
3270
|
+
*/
|
|
3271
|
+
getPortableObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, authority: string): URL;
|
|
3272
|
+
/**
|
|
3273
|
+
* Builds the [FEP-ef61] portable ID of an actor's inbox with the given
|
|
3274
|
+
* identifier under the given DID authority.
|
|
3275
|
+
*
|
|
3276
|
+
* The path is the same as the one {@link Context.getInboxUri} builds from
|
|
3277
|
+
* the inbox path, but the result is an `ap+ef61:` URI whose authority is
|
|
3278
|
+
* the DID, e.g., `ap+ef61://did:key:z6Mk.../users/alice/inbox`. If
|
|
3279
|
+
* a portable actor has it as its `inbox` and lists this server in its
|
|
3280
|
+
* `gateways`, this server accepts deliveries to the inbox through
|
|
3281
|
+
* the FEP-ef61 gateway endpoint, e.g.,
|
|
3282
|
+
* `POST /.well-known/apgateway/did:key:z6Mk.../users/alice/inbox`, and
|
|
3283
|
+
* dispatches them to the inbox listeners.
|
|
3284
|
+
*
|
|
3285
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3286
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3287
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3288
|
+
*
|
|
3289
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3290
|
+
*
|
|
3291
|
+
* @param identifier The actor's identifier.
|
|
3292
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3293
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3294
|
+
* a path, query, or fragment.
|
|
3295
|
+
* @returns The inbox's portable ID.
|
|
3296
|
+
* @throws {RouterError} If no inbox path is registered.
|
|
3297
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3298
|
+
* DID that is not encoded in base58-btc.
|
|
3299
|
+
* @since 2.4.0
|
|
3300
|
+
*/
|
|
3301
|
+
getPortableInboxUri(identifier: string, authority: string): URL;
|
|
3302
|
+
/**
|
|
2434
3303
|
* Builds the URI of an actor's outbox with the given identifier.
|
|
2435
3304
|
* @param identifier The actor's identifier.
|
|
2436
3305
|
* @returns The actor's outbox URI.
|
|
@@ -2438,6 +3307,35 @@ interface Context<TContextData> {
|
|
|
2438
3307
|
*/
|
|
2439
3308
|
getOutboxUri(identifier: string): URL;
|
|
2440
3309
|
/**
|
|
3310
|
+
* Builds the [FEP-ef61] portable ID of an actor's outbox with the given
|
|
3311
|
+
* identifier under the given DID authority.
|
|
3312
|
+
*
|
|
3313
|
+
* The path is the same as the one {@link Context.getOutboxUri} builds, but
|
|
3314
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3315
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/outbox`. If a portable actor has
|
|
3316
|
+
* it as its `outbox` and its ID is under the same DID, the collection is
|
|
3317
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3318
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/outbox`, by the same
|
|
3319
|
+
* collection dispatcher.
|
|
3320
|
+
*
|
|
3321
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3322
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3323
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3324
|
+
*
|
|
3325
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3326
|
+
*
|
|
3327
|
+
* @param identifier The actor's identifier.
|
|
3328
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3329
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3330
|
+
* a path, query, or fragment.
|
|
3331
|
+
* @returns The outbox's portable ID.
|
|
3332
|
+
* @throws {RouterError} If no outbox dispatcher is available.
|
|
3333
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3334
|
+
* DID that is not encoded in base58-btc.
|
|
3335
|
+
* @since 2.4.0
|
|
3336
|
+
*/
|
|
3337
|
+
getPortableOutboxUri(identifier: string, authority: string): URL;
|
|
3338
|
+
/**
|
|
2441
3339
|
* Builds the URI of an actor's media upload endpoint with the given
|
|
2442
3340
|
* identifier. This is the endpoint advertised under `endpoints.uploadMedia`
|
|
2443
3341
|
* in the actor document.
|
|
@@ -2469,6 +3367,35 @@ interface Context<TContextData> {
|
|
|
2469
3367
|
*/
|
|
2470
3368
|
getFollowingUri(identifier: string): URL;
|
|
2471
3369
|
/**
|
|
3370
|
+
* Builds the [FEP-ef61] portable ID of an actor's following collection with the given
|
|
3371
|
+
* identifier under the given DID authority.
|
|
3372
|
+
*
|
|
3373
|
+
* The path is the same as the one {@link Context.getFollowingUri} builds, but
|
|
3374
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3375
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/following`. If a portable actor has
|
|
3376
|
+
* it as its `following` and its ID is under the same DID, the collection is
|
|
3377
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3378
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/following`, by the same
|
|
3379
|
+
* collection dispatcher.
|
|
3380
|
+
*
|
|
3381
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3382
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3383
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3384
|
+
*
|
|
3385
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3386
|
+
*
|
|
3387
|
+
* @param identifier The actor's identifier.
|
|
3388
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3389
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3390
|
+
* a path, query, or fragment.
|
|
3391
|
+
* @returns The following collection's portable ID.
|
|
3392
|
+
* @throws {RouterError} If no following collection is available.
|
|
3393
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3394
|
+
* DID that is not encoded in base58-btc.
|
|
3395
|
+
* @since 2.4.0
|
|
3396
|
+
*/
|
|
3397
|
+
getPortableFollowingUri(identifier: string, authority: string): URL;
|
|
3398
|
+
/**
|
|
2472
3399
|
* Builds the URI of an actor's followers collection with the given
|
|
2473
3400
|
* identifier.
|
|
2474
3401
|
* @param identifier The actor's identifier.
|
|
@@ -2477,6 +3404,35 @@ interface Context<TContextData> {
|
|
|
2477
3404
|
*/
|
|
2478
3405
|
getFollowersUri(identifier: string): URL;
|
|
2479
3406
|
/**
|
|
3407
|
+
* Builds the [FEP-ef61] portable ID of an actor's followers collection with the given
|
|
3408
|
+
* identifier under the given DID authority.
|
|
3409
|
+
*
|
|
3410
|
+
* The path is the same as the one {@link Context.getFollowersUri} builds, but
|
|
3411
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3412
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/followers`. If a portable actor has
|
|
3413
|
+
* it as its `followers` and its ID is under the same DID, the collection is
|
|
3414
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3415
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/followers`, by the same
|
|
3416
|
+
* collection dispatcher.
|
|
3417
|
+
*
|
|
3418
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3419
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3420
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3421
|
+
*
|
|
3422
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3423
|
+
*
|
|
3424
|
+
* @param identifier The actor's identifier.
|
|
3425
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3426
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3427
|
+
* a path, query, or fragment.
|
|
3428
|
+
* @returns The followers collection's portable ID.
|
|
3429
|
+
* @throws {RouterError} If no followers collection is available.
|
|
3430
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3431
|
+
* DID that is not encoded in base58-btc.
|
|
3432
|
+
* @since 2.4.0
|
|
3433
|
+
*/
|
|
3434
|
+
getPortableFollowersUri(identifier: string, authority: string): URL;
|
|
3435
|
+
/**
|
|
2480
3436
|
* Builds the URI of an actor's liked collection with the given identifier.
|
|
2481
3437
|
* @param identifier The actor's identifier.
|
|
2482
3438
|
* @returns The actor's liked collection URI.
|
|
@@ -2485,6 +3441,35 @@ interface Context<TContextData> {
|
|
|
2485
3441
|
*/
|
|
2486
3442
|
getLikedUri(identifier: string): URL;
|
|
2487
3443
|
/**
|
|
3444
|
+
* Builds the [FEP-ef61] portable ID of an actor's liked collection with the given
|
|
3445
|
+
* identifier under the given DID authority.
|
|
3446
|
+
*
|
|
3447
|
+
* The path is the same as the one {@link Context.getLikedUri} builds, but
|
|
3448
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3449
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/liked`. If a portable actor has
|
|
3450
|
+
* it as its `liked` and its ID is under the same DID, the collection is
|
|
3451
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3452
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/liked`, by the same
|
|
3453
|
+
* collection dispatcher.
|
|
3454
|
+
*
|
|
3455
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3456
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3457
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3458
|
+
*
|
|
3459
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3460
|
+
*
|
|
3461
|
+
* @param identifier The actor's identifier.
|
|
3462
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3463
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3464
|
+
* a path, query, or fragment.
|
|
3465
|
+
* @returns The liked collection's portable ID.
|
|
3466
|
+
* @throws {RouterError} If no liked collection is available.
|
|
3467
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3468
|
+
* DID that is not encoded in base58-btc.
|
|
3469
|
+
* @since 2.4.0
|
|
3470
|
+
*/
|
|
3471
|
+
getPortableLikedUri(identifier: string, authority: string): URL;
|
|
3472
|
+
/**
|
|
2488
3473
|
* Builds the URI of an actor's featured collection with the given identifier.
|
|
2489
3474
|
* @param identifier The actor's identifier.
|
|
2490
3475
|
* @returns The actor's featured collection URI.
|
|
@@ -2493,6 +3478,35 @@ interface Context<TContextData> {
|
|
|
2493
3478
|
*/
|
|
2494
3479
|
getFeaturedUri(identifier: string): URL;
|
|
2495
3480
|
/**
|
|
3481
|
+
* Builds the [FEP-ef61] portable ID of an actor's featured collection with the given
|
|
3482
|
+
* identifier under the given DID authority.
|
|
3483
|
+
*
|
|
3484
|
+
* The path is the same as the one {@link Context.getFeaturedUri} builds, but
|
|
3485
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3486
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/featured`. If a portable actor has
|
|
3487
|
+
* it as its `featured` and its ID is under the same DID, the collection is
|
|
3488
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3489
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/featured`, by the same
|
|
3490
|
+
* collection dispatcher.
|
|
3491
|
+
*
|
|
3492
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3493
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3494
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3495
|
+
*
|
|
3496
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3497
|
+
*
|
|
3498
|
+
* @param identifier The actor's identifier.
|
|
3499
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3500
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3501
|
+
* a path, query, or fragment.
|
|
3502
|
+
* @returns The featured collection's portable ID.
|
|
3503
|
+
* @throws {RouterError} If no featured collection is available.
|
|
3504
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3505
|
+
* DID that is not encoded in base58-btc.
|
|
3506
|
+
* @since 2.4.0
|
|
3507
|
+
*/
|
|
3508
|
+
getPortableFeaturedUri(identifier: string, authority: string): URL;
|
|
3509
|
+
/**
|
|
2496
3510
|
* Builds the URI of an actor's featured tags collection with the given
|
|
2497
3511
|
* identifier.
|
|
2498
3512
|
* @param identifier The actor's identifier.
|
|
@@ -2502,13 +3516,68 @@ interface Context<TContextData> {
|
|
|
2502
3516
|
*/
|
|
2503
3517
|
getFeaturedTagsUri(identifier: string): URL;
|
|
2504
3518
|
/**
|
|
3519
|
+
* Builds the [FEP-ef61] portable ID of an actor's featured tags collection with the given
|
|
3520
|
+
* identifier under the given DID authority.
|
|
3521
|
+
*
|
|
3522
|
+
* The path is the same as the one {@link Context.getFeaturedTagsUri} builds, but
|
|
3523
|
+
* the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3524
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/tags`. If a portable actor has
|
|
3525
|
+
* it as its `featuredTags` and its ID is under the same DID, the collection is
|
|
3526
|
+
* served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3527
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/tags`, by the same
|
|
3528
|
+
* collection dispatcher.
|
|
3529
|
+
*
|
|
3530
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3531
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3532
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3533
|
+
*
|
|
3534
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3535
|
+
*
|
|
3536
|
+
* @param identifier The actor's identifier.
|
|
3537
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3538
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3539
|
+
* a path, query, or fragment.
|
|
3540
|
+
* @returns The featured tags collection's portable ID.
|
|
3541
|
+
* @throws {RouterError} If no featured tags collection is available.
|
|
3542
|
+
* @throws {TypeError} If the authority is not a DID, or it is a `did:key`
|
|
3543
|
+
* DID that is not encoded in base58-btc.
|
|
3544
|
+
* @since 2.4.0
|
|
3545
|
+
*/
|
|
3546
|
+
getPortableFeaturedTagsUri(identifier: string, authority: string): URL;
|
|
3547
|
+
/**
|
|
2505
3548
|
* Determines the type of the URI and extracts the associated data.
|
|
3549
|
+
*
|
|
3550
|
+
* By default, only URIs on this server's origin are recognized. With
|
|
3551
|
+
* the `portable` option, [FEP-ef61] portable IDs, e.g.,
|
|
3552
|
+
* `ap+ef61://did:key:z6Mk.../users/alice`, and their compatible
|
|
3553
|
+
* identifiers on any gateway, e.g.,
|
|
3554
|
+
* `https://example.com/.well-known/apgateway/did:key:z6Mk.../users/alice`,
|
|
3555
|
+
* are also recognized by the same paths that the gateway endpoint routes
|
|
3556
|
+
* to the dispatchers, and the result has the DID in its `authority`
|
|
3557
|
+
* property.
|
|
3558
|
+
*
|
|
3559
|
+
* The DID of a portable ID is anyone's to choose, so recognizing it does
|
|
3560
|
+
* not mean that this server hosts anything for the DID. Check that
|
|
3561
|
+
* `authority` is the DID that the application stores for the actor or
|
|
3562
|
+
* object before acting on it:
|
|
3563
|
+
*
|
|
3564
|
+
* ~~~~ typescript
|
|
3565
|
+
* const parsed = ctx.parseUri(follow.objectId, { portable: true });
|
|
3566
|
+
* if (parsed?.type !== "actor") return;
|
|
3567
|
+
* const user = await getUser(parsed.identifier);
|
|
3568
|
+
* if (user == null) return;
|
|
3569
|
+
* if (parsed.authority != null && parsed.authority !== user.did) return;
|
|
3570
|
+
* ~~~~
|
|
3571
|
+
*
|
|
3572
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3573
|
+
*
|
|
2506
3574
|
* @param uri The URI to parse.
|
|
3575
|
+
* @param options Options for parsing the URI. Since 2.4.0.
|
|
2507
3576
|
* @returns The result of parsing the URI. If `null` is given or
|
|
2508
3577
|
* the URI is not recognized, `null` is returned.
|
|
2509
3578
|
* @since 0.9.0
|
|
2510
3579
|
*/
|
|
2511
|
-
parseUri(uri: URL | null): ParseUriResult | null;
|
|
3580
|
+
parseUri(uri: URL | null, options?: ParseUriOptions): ParseUriResult | null;
|
|
2512
3581
|
/**
|
|
2513
3582
|
* Gets the key pairs for an actor.
|
|
2514
3583
|
* @param identifier The actor's identifier.
|
|
@@ -2576,7 +3645,16 @@ interface Context<TContextData> {
|
|
|
2576
3645
|
* ```
|
|
2577
3646
|
*
|
|
2578
3647
|
* It's almost the same as the {@link lookupObject} function, but it uses
|
|
2579
|
-
* the context's document loader and context loader by default.
|
|
3648
|
+
* the context's document loader and context loader by default. It also
|
|
3649
|
+
* uses {@link Context.verifyPortableObject} as the `verifyPortableObject`
|
|
3650
|
+
* option by default (since 2.4.0), so [FEP-ef61] portable objects,
|
|
3651
|
+
* including portable actors found through WebFinger, are looked up through
|
|
3652
|
+
* their gateways and returned only if they have valid proofs, or, for
|
|
3653
|
+
* collections without proofs, if they are served by gateways that their
|
|
3654
|
+
* owners list. The returned object uses the same policy by default for
|
|
3655
|
+
* its property accessors.
|
|
3656
|
+
*
|
|
3657
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
2580
3658
|
*
|
|
2581
3659
|
* @param identifier The URI or fediverse handle to look up.
|
|
2582
3660
|
* @param options Lookup options.
|
|
@@ -2600,7 +3678,9 @@ interface Context<TContextData> {
|
|
|
2600
3678
|
* ```
|
|
2601
3679
|
*
|
|
2602
3680
|
* It's almost the same as the {@link traverseCollection} function, but it
|
|
2603
|
-
* uses the context's document loader and context loader by default.
|
|
3681
|
+
* uses the context's document loader and context loader by default. It
|
|
3682
|
+
* also uses {@link Context.verifyPortableObject} as the
|
|
3683
|
+
* `verifyPortableObject` option by default (since 2.4.0).
|
|
2604
3684
|
* @param collection The collection to traverse.
|
|
2605
3685
|
* @param options Options for traversing the collection.
|
|
2606
3686
|
* @returns An async iterable of each item in the collection.
|
|
@@ -2749,6 +3829,61 @@ interface Context<TContextData> {
|
|
|
2749
3829
|
* @since 1.8.0
|
|
2750
3830
|
*/
|
|
2751
3831
|
getCollectionUri<TParam extends Record<string, string>>(name: string | symbol, values: TParam): URL;
|
|
3832
|
+
/**
|
|
3833
|
+
* Builds the [FEP-ef61] portable ID of a custom collection with the given
|
|
3834
|
+
* name and values under the given DID authority.
|
|
3835
|
+
*
|
|
3836
|
+
* The path is the same as the one {@link Context.getCollectionUri} builds,
|
|
3837
|
+
* but the result is an `ap+ef61:` URI whose authority is the DID, e.g.,
|
|
3838
|
+
* `ap+ef61://did:key:z6Mk.../users/alice/bookmarks`. If the collection
|
|
3839
|
+
* dispatcher maps the collection to a portable actor under the same DID
|
|
3840
|
+
* with `CustomCollectionCallbackSetters.mapPortableOwner()`, the
|
|
3841
|
+
* collection is served through the FEP-ef61 gateway endpoint, e.g.,
|
|
3842
|
+
* `/.well-known/apgateway/did:key:z6Mk.../users/alice/bookmarks`.
|
|
3843
|
+
*
|
|
3844
|
+
* The returned `URL` keeps the DID authority percent-encoded, because
|
|
3845
|
+
* the `URL` class cannot represent the canonical form. Use `formatIri()`
|
|
3846
|
+
* from `@fedify/vocab-runtime` to get the canonical string.
|
|
3847
|
+
*
|
|
3848
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3849
|
+
*
|
|
3850
|
+
* @param name The name of the collection, which can be a string or a symbol.
|
|
3851
|
+
* @param values The values of the URI parameters.
|
|
3852
|
+
* @param authority The DID that controls the collection, e.g.,
|
|
3853
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3854
|
+
* a path, query, or fragment.
|
|
3855
|
+
* @returns The collection's portable ID.
|
|
3856
|
+
* @throws {RouterError} If no collection dispatcher is available for
|
|
3857
|
+
* the name.
|
|
3858
|
+
* @throws {TypeError} If values are invalid, or the authority is not a DID
|
|
3859
|
+
* or is a `did:key` DID that is not encoded in
|
|
3860
|
+
* base58-btc.
|
|
3861
|
+
* @since 2.4.0
|
|
3862
|
+
*/
|
|
3863
|
+
getPortableCollectionUri<TParam extends Record<string, string>>(name: string | symbol, values: TParam, authority: string): URL;
|
|
3864
|
+
}
|
|
3865
|
+
/**
|
|
3866
|
+
* Information about an [FEP-ef61] portable object requested through
|
|
3867
|
+
* the gateway endpoint. See {@link RequestContext.portableRequest}.
|
|
3868
|
+
*
|
|
3869
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3870
|
+
* @since 2.4.0
|
|
3871
|
+
*/
|
|
3872
|
+
interface PortableRequest {
|
|
3873
|
+
/**
|
|
3874
|
+
* The DID authority of the requested portable object, e.g.,
|
|
3875
|
+
* `did:key:z6Mk...`. It comes from the request path, so it is not
|
|
3876
|
+
* evidence that this server hosts objects for the DID.
|
|
3877
|
+
*/
|
|
3878
|
+
readonly authority: string;
|
|
3879
|
+
/**
|
|
3880
|
+
* The ID of the requested portable object or collection, e.g.,
|
|
3881
|
+
* `ap+ef61://did:key:z6Mk.../notes/123`, without a query. Like other
|
|
3882
|
+
* portable IDs, the `URL` keeps the DID authority percent-encoded; use
|
|
3883
|
+
* `formatIri()` from `@fedify/vocab-runtime` to get the canonical string.
|
|
3884
|
+
* Each access returns a new `URL` instance.
|
|
3885
|
+
*/
|
|
3886
|
+
readonly id: URL;
|
|
2752
3887
|
}
|
|
2753
3888
|
/**
|
|
2754
3889
|
* Options for {@link RequestContext.getActor}.
|
|
@@ -2764,6 +3899,23 @@ interface GetActorOptions {
|
|
|
2764
3899
|
readonly tombstone?: "suppress" | "passthrough";
|
|
2765
3900
|
}
|
|
2766
3901
|
/**
|
|
3902
|
+
* Options for {@link RequestContext.getObject}.
|
|
3903
|
+
* @since 2.4.0
|
|
3904
|
+
*/
|
|
3905
|
+
interface GetObjectOptions {
|
|
3906
|
+
/**
|
|
3907
|
+
* Controls how tombstoned objects are returned.
|
|
3908
|
+
*
|
|
3909
|
+
* By default, or if set to `"suppress"`, a {@link Tombstone} is returned as
|
|
3910
|
+
* `null`, unless it is an instance of the requested class, e.g., when
|
|
3911
|
+
* the requested class is `Object` or `Tombstone` itself. In that case,
|
|
3912
|
+
* the tombstone is returned as is, as it is an object of the requested
|
|
3913
|
+
* class. Set this to `"passthrough"` to always receive a {@link Tombstone}
|
|
3914
|
+
* result instead of `null`.
|
|
3915
|
+
*/
|
|
3916
|
+
readonly tombstone?: "suppress" | "passthrough";
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
2767
3919
|
* A context for a request.
|
|
2768
3920
|
*/
|
|
2769
3921
|
interface RequestContext<TContextData> extends Context<TContextData> {
|
|
@@ -2776,6 +3928,243 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
2776
3928
|
*/
|
|
2777
3929
|
readonly url: URL;
|
|
2778
3930
|
/**
|
|
3931
|
+
* Information about the [FEP-ef61] portable object requested through
|
|
3932
|
+
* the gateway endpoint, e.g.,
|
|
3933
|
+
* `GET /.well-known/apgateway/did:key:z6Mk.../notes/123`, which is served
|
|
3934
|
+
* by an object dispatcher, the actor dispatcher, or a collection
|
|
3935
|
+
* dispatcher. It is `undefined` for ordinary requests.
|
|
3936
|
+
*
|
|
3937
|
+
* The authority comes from the request path, so it is not evidence that
|
|
3938
|
+
* this server hosts objects for the DID. An object dispatcher or the actor
|
|
3939
|
+
* dispatcher has to check that by itself. A portable collection is served
|
|
3940
|
+
* only if its owner, which the actor dispatcher looks up without this
|
|
3941
|
+
* property, is a portable actor under the DID.
|
|
3942
|
+
*
|
|
3943
|
+
* It describes the incoming request, so it stays the same in contexts
|
|
3944
|
+
* derived from this one, e.g., by {@link RequestContext.getObject}.
|
|
3945
|
+
*
|
|
3946
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3947
|
+
* @since 2.4.0
|
|
3948
|
+
*/
|
|
3949
|
+
readonly portableRequest?: PortableRequest;
|
|
3950
|
+
/**
|
|
3951
|
+
* Builds the [FEP-ef61] portable ID of an actor with the given identifier.
|
|
3952
|
+
* It works the same as {@link Context.getPortableActorUri}, except that
|
|
3953
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
3954
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
3955
|
+
*
|
|
3956
|
+
* The DID in the request comes from the request path, so the default is
|
|
3957
|
+
* only a convenience for building IDs; it is not evidence that this server
|
|
3958
|
+
* hosts the actor for the DID.
|
|
3959
|
+
*
|
|
3960
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3961
|
+
*
|
|
3962
|
+
* @param identifier The actor's identifier.
|
|
3963
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
3964
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3965
|
+
* a path, query, or fragment. Defaults to the DID of
|
|
3966
|
+
* the requested portable object.
|
|
3967
|
+
* @returns The actor's portable ID.
|
|
3968
|
+
* @throws {RouterError} If no actor dispatcher is available.
|
|
3969
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
3970
|
+
* that is not encoded in base58-btc, or the authority
|
|
3971
|
+
* is omitted outside a portable gateway request.
|
|
3972
|
+
* @since 2.4.0
|
|
3973
|
+
*/
|
|
3974
|
+
getPortableActorUri(identifier: string, authority?: string): URL;
|
|
3975
|
+
/**
|
|
3976
|
+
* Builds the [FEP-ef61] portable ID of an object with the given class and
|
|
3977
|
+
* values. It works the same as {@link Context.getPortableObjectUri}, except
|
|
3978
|
+
* that the authority can be omitted while handling a portable gateway
|
|
3979
|
+
* request. In that case, the DID in {@link RequestContext.portableRequest}
|
|
3980
|
+
* is used.
|
|
3981
|
+
*
|
|
3982
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3983
|
+
*
|
|
3984
|
+
* @param cls The class of the object.
|
|
3985
|
+
* @param values The values to pass to the object dispatcher.
|
|
3986
|
+
* @param authority The DID that controls the object, e.g.,
|
|
3987
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
3988
|
+
* a path, query, or fragment. Defaults to the DID of
|
|
3989
|
+
* the requested portable object.
|
|
3990
|
+
* @returns The object's portable ID.
|
|
3991
|
+
* @throws {RouterError} If no object dispatcher is available for the class.
|
|
3992
|
+
* @throws {TypeError} If values are invalid, the authority is not a DID,
|
|
3993
|
+
* it is a `did:key` DID that is not encoded in
|
|
3994
|
+
* base58-btc, or the authority is omitted outside
|
|
3995
|
+
* a portable gateway request.
|
|
3996
|
+
* @since 2.4.0
|
|
3997
|
+
*/
|
|
3998
|
+
getPortableObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, authority?: string): URL;
|
|
3999
|
+
/**
|
|
4000
|
+
* Builds the [FEP-ef61] portable ID of an actor's inbox with the given
|
|
4001
|
+
* identifier. It works the same as {@link Context.getPortableInboxUri},
|
|
4002
|
+
* except that the authority can be omitted while handling a portable object
|
|
4003
|
+
* request, i.e., when {@link RequestContext.portableRequest} is set. In
|
|
4004
|
+
* that case, its DID is used. Deliveries to portable inboxes do not set
|
|
4005
|
+
* {@link RequestContext.portableRequest}, so pass the authority explicitly
|
|
4006
|
+
* while handling them.
|
|
4007
|
+
*
|
|
4008
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4009
|
+
*
|
|
4010
|
+
* @param identifier The actor's identifier.
|
|
4011
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4012
|
+
* `did:key:z6Mk...`. It must be a bare DID, without
|
|
4013
|
+
* a path, query, or fragment. Defaults to the DID of
|
|
4014
|
+
* the requested portable object, if any.
|
|
4015
|
+
* @returns The inbox's portable ID.
|
|
4016
|
+
* @throws {RouterError} If no inbox path is registered.
|
|
4017
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4018
|
+
* that is not encoded in base58-btc, or the authority
|
|
4019
|
+
* is omitted outside a portable gateway request.
|
|
4020
|
+
* @since 2.4.0
|
|
4021
|
+
*/
|
|
4022
|
+
getPortableInboxUri(identifier: string, authority?: string): URL;
|
|
4023
|
+
/**
|
|
4024
|
+
* Builds the [FEP-ef61] portable ID of an actor's outbox with the given
|
|
4025
|
+
* identifier. It works the same as {@link Context.getPortableOutboxUri}, except that
|
|
4026
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4027
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4028
|
+
*
|
|
4029
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4030
|
+
*
|
|
4031
|
+
* @param identifier The actor's identifier.
|
|
4032
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4033
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4034
|
+
* portable object or collection.
|
|
4035
|
+
* @returns The outbox's portable ID.
|
|
4036
|
+
* @throws {RouterError} If no outbox dispatcher is available.
|
|
4037
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4038
|
+
* that is not encoded in base58-btc, or the authority
|
|
4039
|
+
* is omitted outside a portable gateway request.
|
|
4040
|
+
* @since 2.4.0
|
|
4041
|
+
*/
|
|
4042
|
+
getPortableOutboxUri(identifier: string, authority?: string): URL;
|
|
4043
|
+
/**
|
|
4044
|
+
* Builds the [FEP-ef61] portable ID of an actor's following collection with the given
|
|
4045
|
+
* identifier. It works the same as {@link Context.getPortableFollowingUri}, except that
|
|
4046
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4047
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4048
|
+
*
|
|
4049
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4050
|
+
*
|
|
4051
|
+
* @param identifier The actor's identifier.
|
|
4052
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4053
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4054
|
+
* portable object or collection.
|
|
4055
|
+
* @returns The following collection's portable ID.
|
|
4056
|
+
* @throws {RouterError} If no following collection is available.
|
|
4057
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4058
|
+
* that is not encoded in base58-btc, or the authority
|
|
4059
|
+
* is omitted outside a portable gateway request.
|
|
4060
|
+
* @since 2.4.0
|
|
4061
|
+
*/
|
|
4062
|
+
getPortableFollowingUri(identifier: string, authority?: string): URL;
|
|
4063
|
+
/**
|
|
4064
|
+
* Builds the [FEP-ef61] portable ID of an actor's followers collection with the given
|
|
4065
|
+
* identifier. It works the same as {@link Context.getPortableFollowersUri}, except that
|
|
4066
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4067
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4068
|
+
*
|
|
4069
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4070
|
+
*
|
|
4071
|
+
* @param identifier The actor's identifier.
|
|
4072
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4073
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4074
|
+
* portable object or collection.
|
|
4075
|
+
* @returns The followers collection's portable ID.
|
|
4076
|
+
* @throws {RouterError} If no followers collection is available.
|
|
4077
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4078
|
+
* that is not encoded in base58-btc, or the authority
|
|
4079
|
+
* is omitted outside a portable gateway request.
|
|
4080
|
+
* @since 2.4.0
|
|
4081
|
+
*/
|
|
4082
|
+
getPortableFollowersUri(identifier: string, authority?: string): URL;
|
|
4083
|
+
/**
|
|
4084
|
+
* Builds the [FEP-ef61] portable ID of an actor's liked collection with the given
|
|
4085
|
+
* identifier. It works the same as {@link Context.getPortableLikedUri}, except that
|
|
4086
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4087
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4088
|
+
*
|
|
4089
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4090
|
+
*
|
|
4091
|
+
* @param identifier The actor's identifier.
|
|
4092
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4093
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4094
|
+
* portable object or collection.
|
|
4095
|
+
* @returns The liked collection's portable ID.
|
|
4096
|
+
* @throws {RouterError} If no liked collection is available.
|
|
4097
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4098
|
+
* that is not encoded in base58-btc, or the authority
|
|
4099
|
+
* is omitted outside a portable gateway request.
|
|
4100
|
+
* @since 2.4.0
|
|
4101
|
+
*/
|
|
4102
|
+
getPortableLikedUri(identifier: string, authority?: string): URL;
|
|
4103
|
+
/**
|
|
4104
|
+
* Builds the [FEP-ef61] portable ID of an actor's featured collection with the given
|
|
4105
|
+
* identifier. It works the same as {@link Context.getPortableFeaturedUri}, except that
|
|
4106
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4107
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4108
|
+
*
|
|
4109
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4110
|
+
*
|
|
4111
|
+
* @param identifier The actor's identifier.
|
|
4112
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4113
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4114
|
+
* portable object or collection.
|
|
4115
|
+
* @returns The featured collection's portable ID.
|
|
4116
|
+
* @throws {RouterError} If no featured collection is available.
|
|
4117
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4118
|
+
* that is not encoded in base58-btc, or the authority
|
|
4119
|
+
* is omitted outside a portable gateway request.
|
|
4120
|
+
* @since 2.4.0
|
|
4121
|
+
*/
|
|
4122
|
+
getPortableFeaturedUri(identifier: string, authority?: string): URL;
|
|
4123
|
+
/**
|
|
4124
|
+
* Builds the [FEP-ef61] portable ID of an actor's featured tags collection with the given
|
|
4125
|
+
* identifier. It works the same as {@link Context.getPortableFeaturedTagsUri}, except that
|
|
4126
|
+
* the authority can be omitted while handling a portable gateway request.
|
|
4127
|
+
* In that case, the DID in {@link RequestContext.portableRequest} is used.
|
|
4128
|
+
*
|
|
4129
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4130
|
+
*
|
|
4131
|
+
* @param identifier The actor's identifier.
|
|
4132
|
+
* @param authority The DID that controls the actor, e.g.,
|
|
4133
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4134
|
+
* portable object or collection.
|
|
4135
|
+
* @returns The featured tags collection's portable ID.
|
|
4136
|
+
* @throws {RouterError} If no featured tags collection is available.
|
|
4137
|
+
* @throws {TypeError} If the authority is not a DID, it is a `did:key` DID
|
|
4138
|
+
* that is not encoded in base58-btc, or the authority
|
|
4139
|
+
* is omitted outside a portable gateway request.
|
|
4140
|
+
* @since 2.4.0
|
|
4141
|
+
*/
|
|
4142
|
+
getPortableFeaturedTagsUri(identifier: string, authority?: string): URL;
|
|
4143
|
+
/**
|
|
4144
|
+
* Builds the [FEP-ef61] portable ID of a custom collection with the given
|
|
4145
|
+
* name and values. It works the same as
|
|
4146
|
+
* {@link Context.getPortableCollectionUri}, except that the authority can
|
|
4147
|
+
* be omitted while handling a portable gateway request. In that case,
|
|
4148
|
+
* the DID in {@link RequestContext.portableRequest} is used.
|
|
4149
|
+
*
|
|
4150
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4151
|
+
*
|
|
4152
|
+
* @param name The name of the collection, which can be a string or a symbol.
|
|
4153
|
+
* @param values The values of the URI parameters.
|
|
4154
|
+
* @param authority The DID that controls the collection, e.g.,
|
|
4155
|
+
* `did:key:z6Mk...`. Defaults to the DID of the requested
|
|
4156
|
+
* portable object or collection.
|
|
4157
|
+
* @returns The collection's portable ID.
|
|
4158
|
+
* @throws {RouterError} If no collection dispatcher is available for
|
|
4159
|
+
* the name.
|
|
4160
|
+
* @throws {TypeError} If values are invalid, the authority is not a DID,
|
|
4161
|
+
* it is a `did:key` DID that is not encoded in
|
|
4162
|
+
* base58-btc, or the authority is omitted outside
|
|
4163
|
+
* a portable gateway request.
|
|
4164
|
+
* @since 2.4.0
|
|
4165
|
+
*/
|
|
4166
|
+
getPortableCollectionUri<TParam extends Record<string, string>>(name: string | symbol, values: TParam, authority?: string): URL;
|
|
4167
|
+
/**
|
|
2779
4168
|
* Creates a new context with the same properties as this one,
|
|
2780
4169
|
* but with the given data.
|
|
2781
4170
|
* @param data The new data to associate with the context.
|
|
@@ -2837,13 +4226,62 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
2837
4226
|
* @param cls The class to instantiate.
|
|
2838
4227
|
* @param values The values to pass to the object dispatcher.
|
|
2839
4228
|
* @returns The object of the given class with the given values, or `null`
|
|
2840
|
-
* if the object is not found.
|
|
4229
|
+
* if the object is not found. Tombstoned objects are suppressed
|
|
4230
|
+
* unless the tombstone is an instance of `cls`.
|
|
2841
4231
|
* @throws {Error} If no object dispatcher is available for the class.
|
|
2842
4232
|
* @throws {TypeError} If values are invalid.
|
|
2843
4233
|
* @since 0.7.0
|
|
2844
4234
|
*/
|
|
2845
4235
|
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
|
|
2846
4236
|
/**
|
|
4237
|
+
* Gets an object of the given class, or a {@link Tombstone}, with the given
|
|
4238
|
+
* values.
|
|
4239
|
+
* @param cls The class to instantiate.
|
|
4240
|
+
* @param values The values to pass to the object dispatcher.
|
|
4241
|
+
* @param options Options for getting the object. Set `options.tombstone`
|
|
4242
|
+
* to `"passthrough"` to receive tombstoned objects instead
|
|
4243
|
+
* of `null`.
|
|
4244
|
+
* @returns The object of the given class with the given values,
|
|
4245
|
+
* a tombstone, or `null` if the object is not found.
|
|
4246
|
+
* @throws {Error} If no object dispatcher is available for the class.
|
|
4247
|
+
* @throws {TypeError} If values are invalid.
|
|
4248
|
+
* @since 2.4.0
|
|
4249
|
+
*/
|
|
4250
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, options: GetObjectOptions & {
|
|
4251
|
+
readonly tombstone: "passthrough";
|
|
4252
|
+
}): Promise<TObject | Tombstone | null>;
|
|
4253
|
+
/**
|
|
4254
|
+
* Gets an object of the given class with the given values.
|
|
4255
|
+
* @param cls The class to instantiate.
|
|
4256
|
+
* @param values The values to pass to the object dispatcher.
|
|
4257
|
+
* @param options Options for getting the object.
|
|
4258
|
+
* @returns The object of the given class with the given values, or `null`
|
|
4259
|
+
* if the object is not found. Tombstoned objects are suppressed
|
|
4260
|
+
* unless `options.tombstone` is `"passthrough"` or the tombstone
|
|
4261
|
+
* is an instance of `cls`.
|
|
4262
|
+
* @throws {Error} If no object dispatcher is available for the class.
|
|
4263
|
+
* @throws {TypeError} If values are invalid.
|
|
4264
|
+
* @since 2.4.0
|
|
4265
|
+
*/
|
|
4266
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, options: GetObjectOptions & {
|
|
4267
|
+
readonly tombstone?: "suppress" | undefined;
|
|
4268
|
+
}): Promise<TObject | null>;
|
|
4269
|
+
/**
|
|
4270
|
+
* Gets an object of the given class, or a {@link Tombstone}, with the given
|
|
4271
|
+
* values.
|
|
4272
|
+
* @param cls The class to instantiate.
|
|
4273
|
+
* @param values The values to pass to the object dispatcher.
|
|
4274
|
+
* @param options Options for getting the object.
|
|
4275
|
+
* @returns The object of the given class with the given values,
|
|
4276
|
+
* a tombstone, or `null` if the object is not found. This broad
|
|
4277
|
+
* overload is used when the caller passes an options value whose
|
|
4278
|
+
* `tombstone` mode is not known statically.
|
|
4279
|
+
* @throws {Error} If no object dispatcher is available for the class.
|
|
4280
|
+
* @throws {TypeError} If values are invalid.
|
|
4281
|
+
* @since 2.4.0
|
|
4282
|
+
*/
|
|
4283
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>, options: GetObjectOptions): Promise<TObject | Tombstone | null>;
|
|
4284
|
+
/**
|
|
2847
4285
|
* Gets the public key of the sender, if any exists and it is verified.
|
|
2848
4286
|
* Otherwise, `null` is returned.
|
|
2849
4287
|
*
|
|
@@ -2909,6 +4347,52 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
|
2909
4347
|
* [instance actor]: https://swicg.github.io/activitypub-http-signature/#instance-actor
|
|
2910
4348
|
*/
|
|
2911
4349
|
getSignedKeyOwner(options: GetKeyOwnerOptions): Promise<Actor | null>;
|
|
4350
|
+
/**
|
|
4351
|
+
* Checks whether the request is signed by an actor who belongs to
|
|
4352
|
+
* the intended audience of an object, i.e., the owner of the signed key
|
|
4353
|
+
* (see {@link RequestContext.getSignedKeyOwner}) is one of the object's
|
|
4354
|
+
* `to`, `cc`, `bto`, `bcc`, and `audience`, or a member of one of them
|
|
4355
|
+
* according to the `isMember` option.
|
|
4356
|
+
*
|
|
4357
|
+
* Everyone belongs to the audience of a publicly addressed object, so it
|
|
4358
|
+
* returns `true` for such an object even if the request is not signed.
|
|
4359
|
+
*
|
|
4360
|
+
* This can be used in authorization predicates for serving non-public
|
|
4361
|
+
* objects, which [FEP-ef61] requires of gateways serving portable objects.
|
|
4362
|
+
* [FEP-ef61] portable IDs are compared by their canonical forms, so
|
|
4363
|
+
* an `ap:` URI, an `ap+ef61:` URI, and a compatible identifier on any
|
|
4364
|
+
* gateway refer to the same actor.
|
|
4365
|
+
*
|
|
4366
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4367
|
+
*
|
|
4368
|
+
* @param object The object whose audience is checked.
|
|
4369
|
+
* @param options Options for checking the audience.
|
|
4370
|
+
* @returns `true` if the object is publicly addressed, or the request is
|
|
4371
|
+
* signed by an actor who belongs to its audience.
|
|
4372
|
+
* @since 2.4.0
|
|
4373
|
+
*/
|
|
4374
|
+
isSignedByAudience(object: Object$1, options?: IsSignedByAudienceOptions): Promise<boolean>;
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Options for {@link RequestContext.isSignedByAudience} method.
|
|
4378
|
+
* @since 2.4.0
|
|
4379
|
+
*/
|
|
4380
|
+
interface IsSignedByAudienceOptions extends GetKeyOwnerOptions {
|
|
4381
|
+
/**
|
|
4382
|
+
* Checks whether the actor who signed the request is a member of
|
|
4383
|
+
* an addressee of the object that is not the actor itself, e.g.,
|
|
4384
|
+
* a followers collection. Fedify does not resolve collections by itself,
|
|
4385
|
+
* as only the application can tell their members reliably.
|
|
4386
|
+
*
|
|
4387
|
+
* It is called for each such addressee in order until it returns `true`.
|
|
4388
|
+
* If it is omitted, only the actors that the object addresses directly
|
|
4389
|
+
* belong to its audience.
|
|
4390
|
+
* @param addressee The ID of the addressee, e.g., the ID of a followers
|
|
4391
|
+
* collection.
|
|
4392
|
+
* @param actor The actor who signed the request.
|
|
4393
|
+
* @returns `true` if the actor is a member of the addressee.
|
|
4394
|
+
*/
|
|
4395
|
+
isMember?: (addressee: URL, actor: Actor) => boolean | Promise<boolean>;
|
|
2912
4396
|
}
|
|
2913
4397
|
/**
|
|
2914
4398
|
* A context for inbox listeners.
|
|
@@ -3038,52 +4522,143 @@ interface OutboxContext<TContextData> extends Context<TContextData> {
|
|
|
3038
4522
|
clone(data: TContextData): OutboxContext<TContextData>;
|
|
3039
4523
|
}
|
|
3040
4524
|
/**
|
|
4525
|
+
* Options for {@link Context.parseUri}.
|
|
4526
|
+
* @since 2.4.0
|
|
4527
|
+
*/
|
|
4528
|
+
interface ParseUriOptions {
|
|
4529
|
+
/**
|
|
4530
|
+
* Whether to also recognize [FEP-ef61] portable IDs, i.e., `ap:` and
|
|
4531
|
+
* `ap+ef61:` URIs, and their compatible identifiers on any gateway.
|
|
4532
|
+
* The result of a portable ID has its DID, without percent-encoding, in
|
|
4533
|
+
* the `authority` property, which the caller has to compare with the DID
|
|
4534
|
+
* that it stores for the actor or object, since anyone can make a portable
|
|
4535
|
+
* ID with the same path under another DID.
|
|
4536
|
+
*
|
|
4537
|
+
* Like URIs on this server's origin, a portable ID is recognized by its
|
|
4538
|
+
* path, and its query, e.g., location hints, and fragment are ignored.
|
|
4539
|
+
* A shared inbox is never recognized in a portable ID, and a portable ID
|
|
4540
|
+
* with a malformed DID, or with a `did:key` DID that is not encoded in
|
|
4541
|
+
* base58-btc, is not recognized either.
|
|
4542
|
+
*
|
|
4543
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4544
|
+
* @default `false`
|
|
4545
|
+
*/
|
|
4546
|
+
readonly portable?: boolean;
|
|
4547
|
+
}
|
|
4548
|
+
/**
|
|
3041
4549
|
* A result of parsing an URI.
|
|
3042
4550
|
*/
|
|
3043
4551
|
type ParseUriResult = {
|
|
3044
4552
|
readonly type: "actor";
|
|
3045
4553
|
readonly identifier: string;
|
|
4554
|
+
/**
|
|
4555
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4556
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4557
|
+
* @since 2.4.0
|
|
4558
|
+
*/
|
|
4559
|
+
readonly authority?: string;
|
|
3046
4560
|
} | {
|
|
3047
4561
|
readonly type: "object";
|
|
3048
4562
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
3049
4563
|
readonly typeId: URL;
|
|
3050
4564
|
readonly values: Record<string, string>;
|
|
4565
|
+
/**
|
|
4566
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4567
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4568
|
+
* @since 2.4.0
|
|
4569
|
+
*/
|
|
4570
|
+
readonly authority?: string;
|
|
3051
4571
|
} | {
|
|
3052
4572
|
readonly type: "inbox";
|
|
3053
4573
|
readonly identifier: undefined;
|
|
4574
|
+
readonly authority?: undefined;
|
|
3054
4575
|
} | {
|
|
3055
4576
|
readonly type: "inbox";
|
|
3056
4577
|
readonly identifier: string;
|
|
4578
|
+
/**
|
|
4579
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4580
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4581
|
+
* @since 2.4.0
|
|
4582
|
+
*/
|
|
4583
|
+
readonly authority?: string;
|
|
3057
4584
|
} | {
|
|
3058
4585
|
readonly type: "outbox";
|
|
3059
4586
|
readonly identifier: string;
|
|
4587
|
+
/**
|
|
4588
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4589
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4590
|
+
* @since 2.4.0
|
|
4591
|
+
*/
|
|
4592
|
+
readonly authority?: string;
|
|
3060
4593
|
} | {
|
|
3061
4594
|
readonly type: "following";
|
|
3062
4595
|
readonly identifier: string;
|
|
4596
|
+
/**
|
|
4597
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4598
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4599
|
+
* @since 2.4.0
|
|
4600
|
+
*/
|
|
4601
|
+
readonly authority?: string;
|
|
3063
4602
|
} | {
|
|
3064
4603
|
readonly type: "followers";
|
|
3065
4604
|
readonly identifier: string;
|
|
4605
|
+
/**
|
|
4606
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4607
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4608
|
+
* @since 2.4.0
|
|
4609
|
+
*/
|
|
4610
|
+
readonly authority?: string;
|
|
3066
4611
|
} | {
|
|
3067
4612
|
readonly type: "liked";
|
|
3068
4613
|
readonly identifier: string;
|
|
4614
|
+
/**
|
|
4615
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4616
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4617
|
+
* @since 2.4.0
|
|
4618
|
+
*/
|
|
4619
|
+
readonly authority?: string;
|
|
3069
4620
|
} | {
|
|
3070
4621
|
readonly type: "featured";
|
|
3071
4622
|
readonly identifier: string;
|
|
4623
|
+
/**
|
|
4624
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4625
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4626
|
+
* @since 2.4.0
|
|
4627
|
+
*/
|
|
4628
|
+
readonly authority?: string;
|
|
3072
4629
|
} | {
|
|
3073
4630
|
readonly type: "featuredTags";
|
|
3074
4631
|
readonly identifier: string;
|
|
4632
|
+
/**
|
|
4633
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4634
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4635
|
+
* @since 2.4.0
|
|
4636
|
+
*/
|
|
4637
|
+
readonly authority?: string;
|
|
3075
4638
|
} | {
|
|
3076
4639
|
readonly type: "collection";
|
|
3077
4640
|
readonly name: string | symbol;
|
|
3078
4641
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
3079
4642
|
readonly typeId: URL;
|
|
3080
4643
|
readonly values: Record<string, string>;
|
|
4644
|
+
/**
|
|
4645
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4646
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4647
|
+
* @since 2.4.0
|
|
4648
|
+
*/
|
|
4649
|
+
readonly authority?: string;
|
|
3081
4650
|
} | {
|
|
3082
4651
|
readonly type: "orderedCollection";
|
|
3083
4652
|
readonly name: string | symbol;
|
|
3084
4653
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
3085
4654
|
readonly typeId: URL;
|
|
3086
4655
|
readonly values: Record<string, string>;
|
|
4656
|
+
/**
|
|
4657
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4658
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4659
|
+
* @since 2.4.0
|
|
4660
|
+
*/
|
|
4661
|
+
readonly authority?: string;
|
|
3087
4662
|
};
|
|
3088
4663
|
/**
|
|
3089
4664
|
* Options for {@link Context.sendActivity} method.
|
|
@@ -3250,4 +4825,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
3250
4825
|
readonly multikey: Multikey;
|
|
3251
4826
|
}
|
|
3252
4827
|
//#endregion
|
|
3253
|
-
export {
|
|
4828
|
+
export { respondWithObject as $, digest as $t, InboxChallengePolicy as A, CustomCollectionDispatcher as At, createFederation as B, OutboxListener as Bt, FederationBenchmarkOptions as C, ActorKeyPairsDispatcher as Ct, FederationStartQueueOptions as D, CollectionDispatcher as Dt, FederationOptions as E, CollectionCursor as Et, PortableInboxForwardingOptions as F, MediaUploaderCallback as Ft, TaskEnqueueOptions as G, SharedInboxKeyDispatcher as Gt, createFederationBuilder as H, OutboxPermanentFailureHandler as Ht, Rfc6570Expression as I, NodeInfoDispatcher as It, CreateExponentialBackoffPolicyOptions as J, WebFingerLinksDispatcher as Jt, TaskHandler as K, UnverifiedActivityHandler as Kt, FederationKvPrefixes as L, ObjectAuthorizePredicate as Lt, MediaUploaderSetters as M, HashlinkMediaRequest as Mt, ObjectCallbackSetters as N, InboxErrorHandler as Nt, IdempotencyKeyCallback as O, CustomCollectionCounter as Ot, OutboxListenerSetters as P, InboxListener as Pt, RespondWithObjectOptions as Q, buildCollectionSynchronizationHeader as Qt, FederationOrigin as R, ObjectDispatcher as Rt, Federation as S, ActorHandleMapper as St, FederationFetchOptions as T, CollectionCounter as Tt, TaskDefinition as U, PortableActorIdMapper as Ut, Message as V, OutboxListenerErrorHandler as Vt, TaskDefinitionOptions as W, PortableCollectionOwnerMapper as Wt, RetryPolicy as X, SenderKeyPair as Xt, RetryContext as Y, SendActivityError as Yt, createExponentialBackoffPolicy as Z, PageItems as Zt, ActorCallbackSetters as _, NormalizedCircuitBreakerOptions as _t, GetObjectOptions as a, InboxRequestReport as an, MessageQueueEnqueueOptions as at, CustomCollectionCallbackSetters as b, ActorAliasMapper as bt, IsSignedByAudienceOptions as c, CircuitBreaker as ct, ParseUriResult as d, CircuitBreakerCreateOptions as dt, ActivityTransformer as en, respondWithObjectIfAcceptable as et, PortableRequest as f, CircuitBreakerFailurePolicy as ft, SendActivityOptionsForCollection as g, CircuitBreakerStateChange as gt, SendActivityOptions as h, CircuitBreakerState as ht, GetActorOptions as i, InboxRequestOutcome as in, MessageQueueDepth as it, InboxListenerSetters as j, HashlinkMediaDispatcher as jt, IdempotencyStrategy as k, CustomCollectionCursor as kt, OutboxContext as l, CircuitBreakerActivityDrop as lt, RouteActivityOptions as m, CircuitBreakerOptions as mt, Context as n, InboxJsonValue as nn, InProcessMessageQueueOptions as nt, GetSignedKeyOptions as o, MessageQueueListenOptions as ot, RequestContext as p, CircuitBreakerKvState as pt, TaskRegistry as q, UnverifiedActivityReason as qt, ForwardActivityOptions as r, InboxRequestFinishedHandler as rn, MessageQueue as rt, InboxContext as s, ParallelMessageQueue as st, ActorKeyPair as t, InboxAuthentication as tn, InProcessMessageQueue as tt, ParseUriOptions as u, CircuitBreakerBeforeSendDecision as ut, CollectionCallbackSetters as v, normalizeCircuitBreakerOptions as vt, FederationBuilder as w, AuthorizePredicate as wt, Federatable as x, ActorDispatcher as xt, ConstructorWithTypeId as y, parseCircuitBreakerKvState as yt, FederationQueueOptions as z, OutboxErrorHandler as zt };
|