@fedify/fedify 2.3.0-dev.994 → 2.3.0-pr.809.36
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 +16 -7
- package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
- package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
- package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
- package/dist/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DN60FHPX.mjs} +28 -3
- package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
- package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
- package/dist/{builder-yAlpiIqP.mjs → builder-DSZ7FZmg.mjs} +96 -42
- package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
- package/dist/circuit-breaker-CSWsyoef.mjs +337 -0
- package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
- package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
- package/dist/compat/mod.d.cts +2 -1
- package/dist/compat/mod.d.ts +2 -3
- package/dist/compat/mod.js +3 -3
- package/dist/compat/outgoing-jsonld.test.mjs +4 -4
- package/dist/compat/public-audience.test.mjs +4 -4
- package/dist/compat/transformers.test.mjs +5 -5
- package/dist/{context-BzH2-ajs.d.ts → context-BBVLF7lx.d.cts} +342 -269
- package/dist/{context-DJGagtNd.d.cts → context-BU6jSQdo.d.ts} +344 -266
- package/dist/{context-Dk_tacqz.mjs → context-DVoTs_wM.mjs} +64 -5
- package/dist/{deno-XBVlKnOX.mjs → deno-DCdM7d93.mjs} +1 -1
- package/dist/{docloader-DPp-X6gk.mjs → docloader-B7mVwA5_.mjs} +4 -4
- package/dist/{esm-DVILvP5e.mjs → esm-vrlUxr60.mjs} +4 -7
- package/dist/federation/builder.test.mjs +163 -11
- package/dist/federation/circuit-breaker.test.d.mts +2 -0
- package/dist/federation/circuit-breaker.test.mjs +446 -0
- package/dist/federation/collection.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +1770 -29
- package/dist/federation/idempotency.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +4 -4
- package/dist/federation/keycache.test.mjs +5 -5
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/metrics.test.d.mts +2 -0
- package/dist/federation/metrics.test.mjs +634 -0
- package/dist/federation/middleware.test.mjs +4036 -146
- package/dist/federation/mod.cjs +195 -14
- package/dist/federation/mod.d.cts +6 -4
- package/dist/federation/mod.d.ts +6 -6
- package/dist/federation/mod.js +192 -14
- package/dist/federation/mq.test.mjs +176 -15
- package/dist/federation/negotiation.test.mjs +4 -4
- package/dist/federation/retry.test.mjs +3 -3
- package/dist/federation/router.test.mjs +190 -9
- package/dist/federation/send.test.mjs +153 -15
- package/dist/federation/temporal.test.d.mts +2 -0
- package/dist/federation/temporal.test.mjs +71 -0
- package/dist/federation/webfinger.test.mjs +150 -5
- package/dist/{http-CSlLA54v.mjs → http-BufbkLuW.mjs} +146 -47
- package/dist/{http-B4rrzxtg.js → http-Dh18nwJg.js} +994 -64
- package/dist/{http-aQzN9Ayi.d.ts → http-VyDTd4G3.d.cts} +15 -3
- package/dist/{http-BrGqJDXL.cjs → http-gOiudB3g.cjs} +1099 -61
- package/dist/{http-CrGuipxe.d.cts → http-lf8Hsd91.d.ts} +15 -1
- package/dist/{key-Bzx--sHD.mjs → key-DZdKLJXT.mjs} +43 -18
- package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
- package/dist/{kv-cache-DI-Sk7-I.cjs → kv-cache-BuK_nlpY.cjs} +20 -3
- package/dist/{kv-cache-U__xU4qR.mjs → kv-cache-C7SQnkGI.mjs} +21 -3
- package/dist/{kv-cache-EMIqoIuB.js → kv-cache-DNDSb6Po.js} +20 -3
- package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
- package/dist/ld-0Lsznacf.mjs +626 -0
- package/dist/metrics-BHeWd24f.mjs +815 -0
- package/dist/{middleware-zjZ6AFCW.mjs → middleware-BNANvDh2.mjs} +1 -1
- package/dist/{middleware-nidH7VZH.js → middleware-BgzRkDcm.js} +2260 -556
- package/dist/{middleware-An4DjES4.cjs → middleware-D-iES1nQ.cjs} +2318 -623
- package/dist/{middleware-K1g6bEkV.mjs → middleware-EV6J_eAc.mjs} +1639 -373
- package/dist/{mod-CR8soWa9.d.ts → mod-B0hW12_O.d.cts} +26 -4
- package/dist/mod-C0F6kvgS.d.cts +182 -0
- package/dist/{mod-Cr3f-ACa.d.cts → mod-COIAjwRS.d.ts} +26 -2
- package/dist/{mod-CMEbIaNh.d.cts → mod-DFvNJcNb.d.ts} +56 -4
- package/dist/mod-vPYVoa5n.d.ts +182 -0
- package/dist/{mod-CLgIXe9w.d.ts → mod-yvIXFAEi.d.cts} +56 -6
- package/dist/mod.cjs +9 -6
- package/dist/mod.d.cts +12 -10
- package/dist/mod.d.ts +12 -12
- package/dist/mod.js +11 -11
- package/dist/mq-D-nlpY04.d.ts +208 -0
- package/dist/mq-D8uSFzxe.d.cts +208 -0
- package/dist/{negotiation-SQvQgUqe.mjs → negotiation-DDstyBvc.mjs} +29 -0
- package/dist/nodeinfo/client.test.mjs +4 -4
- package/dist/nodeinfo/handler.test.mjs +4 -4
- package/dist/nodeinfo/mod.d.cts +2 -1
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.mjs +3 -3
- package/dist/otel/exporter.test.mjs +28 -25
- package/dist/otel/mod.cjs +6 -5
- package/dist/otel/mod.d.cts +5 -3
- package/dist/otel/mod.d.ts +5 -5
- package/dist/otel/mod.js +8 -7
- package/dist/{outgoing-jsonld-CNmZLixq.mjs → outgoing-jsonld-L_DbOaFe.mjs} +2 -2
- package/dist/{owner-C-tqfvxn.mjs → owner-Cl-1cAR8.mjs} +2 -2
- package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
- package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
- package/dist/{proof-Bbbwf8_x.js → proof-CyXndf6-.js} +378 -15
- package/dist/{proof-BlmRPzrK.mjs → proof-Dnz8jtiQ.mjs} +26 -8
- package/dist/{proof-BW89QMVB.cjs → proof-tz35unOj.cjs} +432 -15
- package/dist/runtime/mod.d.cts +1 -0
- package/dist/runtime/mod.d.ts +1 -2
- package/dist/runtime/mod.js +3 -3
- package/dist/{send-05pJLcb6.mjs → send-DIbBYN5P.mjs} +72 -26
- package/dist/sig/http.test.mjs +356 -33
- package/dist/sig/key.test.mjs +103 -6
- package/dist/sig/ld.test.mjs +696 -7
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +4 -3
- package/dist/sig/mod.d.ts +4 -5
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +169 -8
- package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BBjXFNOb.mjs} +5 -30
- package/dist/temporal-BEwob1Vg.mjs +95 -0
- package/dist/testing/mod.d.mts +110 -10
- package/dist/testing/mod.mjs +1 -2
- package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
- package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
- package/dist/utils/docloader.test.mjs +6 -6
- package/dist/utils/kv-cache.test.mjs +67 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +2 -1
- package/dist/utils/mod.d.ts +2 -3
- package/dist/utils/mod.js +3 -3
- package/dist/vocab/cjs.test.mjs +1 -1
- package/dist/vocab/mod.d.cts +1 -0
- package/dist/vocab/mod.d.ts +1 -2
- package/dist/vocab/mod.js +2 -2
- package/package.json +16 -16
- package/dist/ld-DR78beiv.mjs +0 -279
- package/dist/middleware-BFBaR0mF.cjs +0 -4
- package/dist/mod-2d12ffz3.d.ts +0 -64
- package/dist/mod-D35TRn09.d.cts +0 -62
- package/dist/router-CrMLXoOr.mjs +0 -114
- package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
- package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
- package/dist/{client-D_1QpnWt.mjs → client-ByXmQhYD.mjs} +1 -1
- package/dist/{collection-D-HqUuA2.mjs → collection-Cc3DVAhE.mjs} +0 -0
- package/dist/{keycache-EGATflN-.mjs → keycache-BeU0LCII.mjs} +0 -0
- package/dist/{public-audience-DYFHzm_c.mjs → public-audience-Cvbr2Gzt.mjs} +1 -1
- /package/dist/{retry-bMXBL97A.mjs → retry-CXg_MBI-.mjs} +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { o as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CAM_bQXx.cjs";
|
|
3
|
+
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-VyDTd4G3.cjs";
|
|
4
|
+
import { n as GetKeyOwnerOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
|
+
import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
6
|
+
import { r as MessageQueue } from "./mq-D8uSFzxe.cjs";
|
|
7
7
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
8
|
-
import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
9
8
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
10
9
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
11
|
-
|
|
10
|
+
import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
12
11
|
//#region src/compat/types.d.ts
|
|
13
12
|
/**
|
|
14
13
|
* A function that transforms an activity object.
|
|
@@ -16,6 +15,177 @@ import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fed
|
|
|
16
15
|
*/
|
|
17
16
|
type ActivityTransformer<TContextData> = (activity: Activity, context: Context<TContextData>) => Activity;
|
|
18
17
|
//#endregion
|
|
18
|
+
//#region src/federation/circuit-breaker.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* The state of a remote host circuit breaker.
|
|
21
|
+
* @since 2.3.0
|
|
22
|
+
*/
|
|
23
|
+
type CircuitBreakerState = "closed" | "open" | "half-open";
|
|
24
|
+
/**
|
|
25
|
+
* The JSON-serializable state stored in the configured {@link KvStore}.
|
|
26
|
+
* @since 2.3.0
|
|
27
|
+
*/
|
|
28
|
+
interface CircuitBreakerKvState {
|
|
29
|
+
readonly state: CircuitBreakerState;
|
|
30
|
+
readonly failures: readonly string[];
|
|
31
|
+
readonly opened?: string;
|
|
32
|
+
readonly halfOpened?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Details passed to {@link CircuitBreakerOptions.onActivityDrop} when a held
|
|
36
|
+
* activity expires before the remote host recovers.
|
|
37
|
+
* @since 2.3.0
|
|
38
|
+
*/
|
|
39
|
+
interface CircuitBreakerActivityDrop {
|
|
40
|
+
/** The inbox URL that would have received the activity. */
|
|
41
|
+
readonly inbox: URL;
|
|
42
|
+
/** The activity that was dropped. */
|
|
43
|
+
readonly activity: Activity;
|
|
44
|
+
/** The activity ID, when known. */
|
|
45
|
+
readonly activityId?: string;
|
|
46
|
+
/** The activity type. */
|
|
47
|
+
readonly activityType: string;
|
|
48
|
+
/** The actor IDs represented by this inbox. */
|
|
49
|
+
readonly actorIds: readonly URL[];
|
|
50
|
+
/** The time when Fedify first held this activity. */
|
|
51
|
+
readonly heldSince: Temporal.Instant;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configures how a remote host circuit opens after repeated delivery
|
|
55
|
+
* failures.
|
|
56
|
+
* @since 2.3.0
|
|
57
|
+
*/
|
|
58
|
+
type CircuitBreakerFailurePolicy = {
|
|
59
|
+
failure(timestamps: readonly Temporal.Instant[]): boolean;
|
|
60
|
+
readonly failureThreshold?: never;
|
|
61
|
+
readonly failureWindow?: never;
|
|
62
|
+
} | {
|
|
63
|
+
readonly failure?: never;
|
|
64
|
+
readonly failureThreshold?: number;
|
|
65
|
+
readonly failureWindow?: Temporal.Duration | Temporal.DurationLike;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Options for Fedify's outbound activity circuit breaker.
|
|
69
|
+
* @since 2.3.0
|
|
70
|
+
*/
|
|
71
|
+
type CircuitBreakerOptions = CircuitBreakerFailurePolicy & {
|
|
72
|
+
/**
|
|
73
|
+
* How long an open circuit waits before allowing a half-open recovery probe.
|
|
74
|
+
* @default `{ minutes: 30 }`
|
|
75
|
+
*/
|
|
76
|
+
readonly recoveryDelay?: Temporal.Duration | Temporal.DurationLike;
|
|
77
|
+
/**
|
|
78
|
+
* How long Fedify keeps requeueing activities held by an open circuit before
|
|
79
|
+
* dropping them.
|
|
80
|
+
* @default `{ days: 7 }`
|
|
81
|
+
*/
|
|
82
|
+
readonly heldActivityTtl?: Temporal.Duration | Temporal.DurationLike;
|
|
83
|
+
/**
|
|
84
|
+
* How often other held activities retry while a half-open probe is in
|
|
85
|
+
* flight. The probe is treated as stale after the recovery delay.
|
|
86
|
+
* @default `{ seconds: 1 }`
|
|
87
|
+
*/
|
|
88
|
+
readonly releaseInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
89
|
+
/**
|
|
90
|
+
* Called whenever the circuit state changes.
|
|
91
|
+
*/
|
|
92
|
+
readonly onStateChange?: (remoteHost: string, previousState: CircuitBreakerState, newState: CircuitBreakerState) => void | Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Called when an activity held by the circuit breaker expires.
|
|
95
|
+
*/
|
|
96
|
+
readonly onActivityDrop?: (remoteHost: string, details: CircuitBreakerActivityDrop) => void | Promise<void>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Normalized circuit breaker options used internally by Fedify.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
interface NormalizedCircuitBreakerOptions {
|
|
103
|
+
readonly failure: (timestamps: readonly Temporal.Instant[]) => boolean;
|
|
104
|
+
readonly pruneFailures: (timestamps: readonly Temporal.Instant[], now: Temporal.Instant) => readonly Temporal.Instant[];
|
|
105
|
+
readonly recoveryDelay: Temporal.Duration;
|
|
106
|
+
readonly heldActivityTtl: Temporal.Duration;
|
|
107
|
+
readonly releaseInterval: Temporal.Duration;
|
|
108
|
+
readonly onStateChange?: CircuitBreakerOptions["onStateChange"];
|
|
109
|
+
readonly onActivityDrop?: CircuitBreakerOptions["onActivityDrop"];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Constructor options for {@link CircuitBreaker}.
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
interface CircuitBreakerCreateOptions {
|
|
116
|
+
readonly kv: KvStore;
|
|
117
|
+
readonly prefix: KvKey;
|
|
118
|
+
readonly options?: CircuitBreakerOptions;
|
|
119
|
+
readonly now?: () => Temporal.Instant;
|
|
120
|
+
/**
|
|
121
|
+
* Observes state changes after user callbacks have run.
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
readonly stateChangeObserver?: (remoteHost: string, previousState: CircuitBreakerState, newState: CircuitBreakerState) => void | Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The delivery decision returned by {@link CircuitBreaker.beforeSend}.
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
type CircuitBreakerBeforeSendDecision = {
|
|
131
|
+
readonly type: "send";
|
|
132
|
+
readonly probe: boolean;
|
|
133
|
+
readonly stateChange?: CircuitBreakerStateChange;
|
|
134
|
+
} | {
|
|
135
|
+
readonly type: "hold";
|
|
136
|
+
readonly state: "open" | "half-open";
|
|
137
|
+
readonly delay: Temporal.Duration;
|
|
138
|
+
readonly heldSince: Temporal.Instant;
|
|
139
|
+
} | {
|
|
140
|
+
readonly type: "drop";
|
|
141
|
+
readonly heldSince: Temporal.Instant;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* A circuit breaker state transition.
|
|
145
|
+
* @since 2.3.0
|
|
146
|
+
*/
|
|
147
|
+
interface CircuitBreakerStateChange {
|
|
148
|
+
readonly previousState: CircuitBreakerState;
|
|
149
|
+
readonly newState: CircuitBreakerState;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Tracks reachability state for remote outbox delivery hosts.
|
|
153
|
+
* @since 2.3.0
|
|
154
|
+
*/
|
|
155
|
+
declare class CircuitBreaker {
|
|
156
|
+
#private;
|
|
157
|
+
constructor(options: CircuitBreakerCreateOptions);
|
|
158
|
+
get options(): NormalizedCircuitBreakerOptions;
|
|
159
|
+
capHeldDelay(heldSince: Temporal.Instant, delay: Temporal.Duration): Temporal.Duration;
|
|
160
|
+
beforeSend(remoteHost: string, message: {
|
|
161
|
+
readonly circuitHeldSince?: string;
|
|
162
|
+
}): Promise<CircuitBreakerBeforeSendDecision>;
|
|
163
|
+
recordSuccess(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
164
|
+
recordReachableFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
165
|
+
recordFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
166
|
+
dropActivity(remoteHost: string, details: CircuitBreakerActivityDrop): Promise<void>;
|
|
167
|
+
getState(remoteHost: string): Promise<CircuitBreakerKvState | undefined>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Normalizes user-provided circuit breaker options into the internal policy
|
|
171
|
+
* shape used while processing queued outbox deliveries.
|
|
172
|
+
*
|
|
173
|
+
* @param options The public circuit breaker options supplied to Fedify.
|
|
174
|
+
* @returns The normalized failure predicate, failure pruning function,
|
|
175
|
+
* duration values, and optional callbacks with defaults applied.
|
|
176
|
+
* @throws {RangeError} If any configured duration is not positive.
|
|
177
|
+
* @throws {TypeError} If `failureThreshold` is not a positive integer.
|
|
178
|
+
*/
|
|
179
|
+
declare function normalizeCircuitBreakerOptions(options: CircuitBreakerOptions): NormalizedCircuitBreakerOptions;
|
|
180
|
+
/**
|
|
181
|
+
* Parses a value loaded from the circuit breaker KV store.
|
|
182
|
+
*
|
|
183
|
+
* @param value The raw KV value to validate.
|
|
184
|
+
* @returns A circuit breaker state when `value` has a recognized state and
|
|
185
|
+
* valid instant strings, or `undefined` when the stored value is malformed.
|
|
186
|
+
*/
|
|
187
|
+
declare function parseCircuitBreakerKvState(value: unknown): CircuitBreakerKvState | undefined;
|
|
188
|
+
//#endregion
|
|
19
189
|
//#region src/federation/collection.d.ts
|
|
20
190
|
/**
|
|
21
191
|
* A page of items.
|
|
@@ -82,13 +252,19 @@ declare class SendActivityError extends Error {
|
|
|
82
252
|
*/
|
|
83
253
|
readonly responseBody: string;
|
|
84
254
|
/**
|
|
255
|
+
* The response headers from the inbox.
|
|
256
|
+
* @since 2.3.0
|
|
257
|
+
*/
|
|
258
|
+
readonly responseHeaders: Headers;
|
|
259
|
+
/**
|
|
85
260
|
* Creates a new {@link SendActivityError}.
|
|
86
261
|
* @param inbox The inbox URL.
|
|
87
262
|
* @param statusCode The HTTP status code.
|
|
88
263
|
* @param message The error message.
|
|
89
264
|
* @param responseBody The response body.
|
|
265
|
+
* @param responseHeaders The response headers.
|
|
90
266
|
*/
|
|
91
|
-
constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
|
|
267
|
+
constructor(inbox: URL, statusCode: number, message: string, responseBody: string, responseHeaders?: HeadersInit);
|
|
92
268
|
}
|
|
93
269
|
//#endregion
|
|
94
270
|
//#region src/federation/callback.d.ts
|
|
@@ -311,11 +487,28 @@ type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Pr
|
|
|
311
487
|
* @since 2.0.0
|
|
312
488
|
*/
|
|
313
489
|
type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
|
|
314
|
-
/**
|
|
490
|
+
/**
|
|
491
|
+
* Why Fedify is giving up on delivery.
|
|
492
|
+
*
|
|
493
|
+
* `"http"` means the inbox returned a configured permanent-failure HTTP
|
|
494
|
+
* status. `"circuit-breaker-ttl"` means the outbound circuit breaker held
|
|
495
|
+
* the activity until its retention period expired.
|
|
496
|
+
*
|
|
497
|
+
* @since 2.3.0
|
|
498
|
+
*/
|
|
499
|
+
readonly reason: "http" | "circuit-breaker-ttl"; /** The inbox URL that failed. */
|
|
500
|
+
readonly inbox: URL; /** The activity that failed to deliver. */
|
|
315
501
|
readonly activity: Activity; /** The error that occurred. */
|
|
316
502
|
readonly error: SendActivityError; /** The HTTP status code returned by the inbox. */
|
|
317
503
|
readonly statusCode: number;
|
|
318
504
|
/**
|
|
505
|
+
* The time when the circuit breaker first held the activity, if
|
|
506
|
+
* {@link reason} is `"circuit-breaker-ttl"`.
|
|
507
|
+
*
|
|
508
|
+
* @since 2.3.0
|
|
509
|
+
*/
|
|
510
|
+
readonly circuitHeldSince?: Temporal.Instant;
|
|
511
|
+
/**
|
|
319
512
|
* The actor IDs that were supposed to receive the activity at this inbox.
|
|
320
513
|
*/
|
|
321
514
|
readonly actorIds: readonly URL[];
|
|
@@ -382,172 +575,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
382
575
|
*/
|
|
383
576
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
384
577
|
//#endregion
|
|
385
|
-
//#region src/federation/mq.d.ts
|
|
386
|
-
/**
|
|
387
|
-
* Additional options for enqueuing a message in a queue.
|
|
388
|
-
*
|
|
389
|
-
* @since 0.5.0
|
|
390
|
-
*/
|
|
391
|
-
interface MessageQueueEnqueueOptions {
|
|
392
|
-
/**
|
|
393
|
-
* The delay before the message is enqueued. No delay by default.
|
|
394
|
-
*
|
|
395
|
-
* It must not be negative.
|
|
396
|
-
*/
|
|
397
|
-
readonly delay?: Temporal.Duration;
|
|
398
|
-
/**
|
|
399
|
-
* An optional key that ensures messages with the same ordering key are
|
|
400
|
-
* processed sequentially (one at a time). Messages with different ordering
|
|
401
|
-
* keys (or no ordering key) may be processed in parallel.
|
|
402
|
-
*
|
|
403
|
-
* This is useful for ensuring that related messages are processed in order,
|
|
404
|
-
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
405
|
-
* activity for the same object.
|
|
406
|
-
*
|
|
407
|
-
* @since 2.0.0
|
|
408
|
-
*/
|
|
409
|
-
readonly orderingKey?: string;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Additional options for listening to a message queue.
|
|
413
|
-
*
|
|
414
|
-
* @since 1.0.0
|
|
415
|
-
*/
|
|
416
|
-
interface MessageQueueListenOptions {
|
|
417
|
-
/**
|
|
418
|
-
* The signal to abort listening to the message queue.
|
|
419
|
-
*/
|
|
420
|
-
signal?: AbortSignal;
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* An abstract interface for a message queue.
|
|
424
|
-
*
|
|
425
|
-
* @since 0.5.0
|
|
426
|
-
*/
|
|
427
|
-
interface MessageQueue {
|
|
428
|
-
/**
|
|
429
|
-
* Whether the message queue backend provides native retry mechanisms.
|
|
430
|
-
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
431
|
-
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
432
|
-
* using its own retry policies.
|
|
433
|
-
*
|
|
434
|
-
* @default `false`
|
|
435
|
-
* @since 1.7.0
|
|
436
|
-
*/
|
|
437
|
-
readonly nativeRetrial?: boolean;
|
|
438
|
-
/**
|
|
439
|
-
* Enqueues a message in the queue.
|
|
440
|
-
* @param message The message to enqueue.
|
|
441
|
-
* @param options Additional options for enqueuing the message.
|
|
442
|
-
*/
|
|
443
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
444
|
-
/**
|
|
445
|
-
* Enqueues multiple messages in the queue. This operation is optional,
|
|
446
|
-
* and may not be supported by all implementations. If not supported,
|
|
447
|
-
* Fedify will invoke {@link enqueue} for each message.
|
|
448
|
-
*
|
|
449
|
-
* @param messages The messages to enqueue.
|
|
450
|
-
* @param options Additional options for enqueuing the messages.
|
|
451
|
-
*/
|
|
452
|
-
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
453
|
-
/**
|
|
454
|
-
* Listens for messages in the queue.
|
|
455
|
-
* @param handler The handler for messages in the queue.
|
|
456
|
-
* @param options Additional options for listening to the message queue.
|
|
457
|
-
* @returns A promise that resolves when the listening is done. It never
|
|
458
|
-
* rejects, and is resolved when the signal is aborted. If no
|
|
459
|
-
* signal is provided, it never resolves.
|
|
460
|
-
*/
|
|
461
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Additional options for {@link InProcessMessageQueue}.
|
|
465
|
-
* @since 1.0.0
|
|
466
|
-
*/
|
|
467
|
-
interface InProcessMessageQueueOptions {
|
|
468
|
-
/**
|
|
469
|
-
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
470
|
-
* @default `{ seconds: 5 }`
|
|
471
|
-
*/
|
|
472
|
-
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* A message queue that processes messages in the same process.
|
|
476
|
-
* Do not use this in production as it does neither persist messages nor
|
|
477
|
-
* distribute them across multiple processes.
|
|
478
|
-
*
|
|
479
|
-
* @since 0.5.0
|
|
480
|
-
*/
|
|
481
|
-
declare class InProcessMessageQueue implements MessageQueue {
|
|
482
|
-
#private;
|
|
483
|
-
/**
|
|
484
|
-
* In-process message queue does not provide native retry mechanisms.
|
|
485
|
-
* @since 1.7.0
|
|
486
|
-
*/
|
|
487
|
-
readonly nativeRetrial = false;
|
|
488
|
-
/**
|
|
489
|
-
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
490
|
-
* @param options Additional options for the in-process message queue.
|
|
491
|
-
*/
|
|
492
|
-
constructor(options?: InProcessMessageQueueOptions);
|
|
493
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
494
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
495
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* A message queue that processes messages in parallel. It takes another
|
|
499
|
-
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
500
|
-
* number of workers.
|
|
501
|
-
*
|
|
502
|
-
* Actually, it's rather a decorator than a queue itself.
|
|
503
|
-
*
|
|
504
|
-
* Note that the workers do not run in truly parallel, in the sense that they
|
|
505
|
-
* are not running in separate threads or processes. They are running in the
|
|
506
|
-
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
507
|
-
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
508
|
-
* workloads.
|
|
509
|
-
*
|
|
510
|
-
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
511
|
-
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
512
|
-
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
513
|
-
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
514
|
-
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
515
|
-
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
516
|
-
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
517
|
-
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
518
|
-
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
519
|
-
*
|
|
520
|
-
* Messages with the same ordering key will never be processed concurrently
|
|
521
|
-
* by different workers, ensuring sequential processing within each key.
|
|
522
|
-
* Messages with different ordering keys (or no ordering key) can still be
|
|
523
|
-
* processed in parallel.
|
|
524
|
-
*
|
|
525
|
-
* @since 1.0.0
|
|
526
|
-
*/
|
|
527
|
-
declare class ParallelMessageQueue implements MessageQueue {
|
|
528
|
-
#private;
|
|
529
|
-
readonly queue: MessageQueue;
|
|
530
|
-
readonly workers: number;
|
|
531
|
-
/**
|
|
532
|
-
* Inherits the native retry capability from the wrapped queue.
|
|
533
|
-
* @since 1.7.0
|
|
534
|
-
*/
|
|
535
|
-
readonly nativeRetrial?: boolean;
|
|
536
|
-
/**
|
|
537
|
-
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
538
|
-
* number of workers.
|
|
539
|
-
* @param queue The message queue to use under the hood. Note that
|
|
540
|
-
* {@link ParallelMessageQueue} cannot be nested.
|
|
541
|
-
* @param workers The number of workers to process messages in parallel.
|
|
542
|
-
* @throws {TypeError} If the given queue is an instance of
|
|
543
|
-
* {@link ParallelMessageQueue}.
|
|
544
|
-
*/
|
|
545
|
-
constructor(queue: MessageQueue, workers: number);
|
|
546
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
547
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
548
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
549
|
-
}
|
|
550
|
-
//#endregion
|
|
551
578
|
//#region src/federation/handler.d.ts
|
|
552
579
|
/**
|
|
553
580
|
* Options for the {@link respondWithObject} and
|
|
@@ -580,91 +607,6 @@ declare function respondWithObject(object: Object$1, options?: RespondWithObject
|
|
|
580
607
|
*/
|
|
581
608
|
declare function respondWithObjectIfAcceptable(object: Object$1, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
|
|
582
609
|
//#endregion
|
|
583
|
-
//#region src/federation/router.d.ts
|
|
584
|
-
/**
|
|
585
|
-
* Options for the {@link Router}.
|
|
586
|
-
* @since 0.12.0
|
|
587
|
-
*/
|
|
588
|
-
interface RouterOptions {
|
|
589
|
-
/**
|
|
590
|
-
* Whether to ignore trailing slashes when matching paths.
|
|
591
|
-
*/
|
|
592
|
-
trailingSlashInsensitive?: boolean;
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* The result of {@link Router.route} method.
|
|
596
|
-
* @since 1.3.0
|
|
597
|
-
*/
|
|
598
|
-
interface RouterRouteResult {
|
|
599
|
-
/**
|
|
600
|
-
* The matched route name.
|
|
601
|
-
*/
|
|
602
|
-
name: string;
|
|
603
|
-
/**
|
|
604
|
-
* The URL template of the matched route.
|
|
605
|
-
*/
|
|
606
|
-
template: string;
|
|
607
|
-
/**
|
|
608
|
-
* The values extracted from the URL.
|
|
609
|
-
*/
|
|
610
|
-
values: Record<string, string>;
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* URL router and constructor based on URI Template
|
|
614
|
-
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
615
|
-
*/
|
|
616
|
-
declare class Router {
|
|
617
|
-
#private;
|
|
618
|
-
/**
|
|
619
|
-
* Whether to ignore trailing slashes when matching paths.
|
|
620
|
-
* @since 1.6.0
|
|
621
|
-
*/
|
|
622
|
-
trailingSlashInsensitive: boolean;
|
|
623
|
-
/**
|
|
624
|
-
* Create a new {@link Router}.
|
|
625
|
-
* @param options Options for the router.
|
|
626
|
-
*/
|
|
627
|
-
constructor(options?: RouterOptions);
|
|
628
|
-
clone(): Router;
|
|
629
|
-
/**
|
|
630
|
-
* Checks if a path name exists in the router.
|
|
631
|
-
* @param name The name of the path.
|
|
632
|
-
* @returns `true` if the path name exists, otherwise `false`.
|
|
633
|
-
*/
|
|
634
|
-
has(name: string): boolean;
|
|
635
|
-
/**
|
|
636
|
-
* Adds a new path rule to the router.
|
|
637
|
-
* @param template The path pattern.
|
|
638
|
-
* @param name The name of the path.
|
|
639
|
-
* @returns The names of the variables in the path pattern.
|
|
640
|
-
*/
|
|
641
|
-
add(template: string, name: string): Set<string>;
|
|
642
|
-
/**
|
|
643
|
-
* Resolves a path name and values from a URL, if any match.
|
|
644
|
-
* @param url The URL to resolve.
|
|
645
|
-
* @returns The name of the path and its values, if any match. Otherwise,
|
|
646
|
-
* `null`.
|
|
647
|
-
*/
|
|
648
|
-
route(url: string): RouterRouteResult | null;
|
|
649
|
-
/**
|
|
650
|
-
* Constructs a URL/path from a path name and values.
|
|
651
|
-
* @param name The name of the path.
|
|
652
|
-
* @param values The values to expand the path with.
|
|
653
|
-
* @returns The URL/path, if the name exists. Otherwise, `null`.
|
|
654
|
-
*/
|
|
655
|
-
build(name: string, values: Record<string, string>): string | null;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* An error thrown by the {@link Router}.
|
|
659
|
-
*/
|
|
660
|
-
declare class RouterError extends Error {
|
|
661
|
-
/**
|
|
662
|
-
* Create a new {@link RouterError}.
|
|
663
|
-
* @param message The error message.
|
|
664
|
-
*/
|
|
665
|
-
constructor(message: string);
|
|
666
|
-
}
|
|
667
|
-
//#endregion
|
|
668
610
|
//#region src/federation/builder.d.ts
|
|
669
611
|
/**
|
|
670
612
|
* Creates a new {@link FederationBuilder} instance.
|
|
@@ -728,6 +670,17 @@ interface OutboxMessage {
|
|
|
728
670
|
readonly attempt: number;
|
|
729
671
|
readonly headers: Readonly<Record<string, string>>;
|
|
730
672
|
readonly orderingKey?: string;
|
|
673
|
+
/**
|
|
674
|
+
* Whether this message is currently held by the outbound circuit breaker.
|
|
675
|
+
* @internal
|
|
676
|
+
*/
|
|
677
|
+
readonly circuitHeld?: true;
|
|
678
|
+
/**
|
|
679
|
+
* When Fedify first held this message because the remote host circuit was
|
|
680
|
+
* open.
|
|
681
|
+
* @internal
|
|
682
|
+
*/
|
|
683
|
+
readonly circuitHeldSince?: string;
|
|
731
684
|
readonly traceContext: Readonly<Record<string, string>>;
|
|
732
685
|
}
|
|
733
686
|
interface InboxMessage {
|
|
@@ -735,6 +688,42 @@ interface InboxMessage {
|
|
|
735
688
|
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
736
689
|
readonly baseUrl: string;
|
|
737
690
|
readonly activity: unknown;
|
|
691
|
+
/**
|
|
692
|
+
* The normalized JSON-LD representation of a signed inbox activity that
|
|
693
|
+
* Fedify already compacted successfully while accepting the request. Queue
|
|
694
|
+
* workers can reuse this producer-side parse cache under stricter loader or
|
|
695
|
+
* network constraints without changing the raw payload preserved for
|
|
696
|
+
* forwarding.
|
|
697
|
+
*
|
|
698
|
+
* This may exist even when {@link ldSignatureVerified} is `false`, because
|
|
699
|
+
* fallback-authenticated traffic and already-queued backlog items can still
|
|
700
|
+
* depend on the cached normalized form to avoid re-fetching remote custom
|
|
701
|
+
* contexts during worker processing.
|
|
702
|
+
*
|
|
703
|
+
* This is optional for backward compatibility with messages that were
|
|
704
|
+
* queued by older Fedify versions or that were already in a queue before
|
|
705
|
+
* upgrading.
|
|
706
|
+
*
|
|
707
|
+
* Fedify keeps this on the queued message itself instead of an external
|
|
708
|
+
* sidecar because generic queue backends do not provide reliable lifecycle
|
|
709
|
+
* guarantees for auxiliary storage across retries and redeliveries.
|
|
710
|
+
*
|
|
711
|
+
* @internal
|
|
712
|
+
*/
|
|
713
|
+
readonly normalizedActivity?: unknown;
|
|
714
|
+
/**
|
|
715
|
+
* Whether the producer actually verified the Linked Data Signature before
|
|
716
|
+
* queueing this message. This lets workers distinguish verified LDS replay
|
|
717
|
+
* from other authenticated inbox traffic that merely happened to include a
|
|
718
|
+
* signature block. This provenance marker is separate from the optional
|
|
719
|
+
* normalizedActivity parse cache.
|
|
720
|
+
*
|
|
721
|
+
* `undefined` preserves backward compatibility with older queued messages
|
|
722
|
+
* that predate this marker.
|
|
723
|
+
*
|
|
724
|
+
* @internal
|
|
725
|
+
*/
|
|
726
|
+
readonly ldSignatureVerified?: boolean;
|
|
738
727
|
readonly started: string;
|
|
739
728
|
readonly attempt: number;
|
|
740
729
|
readonly identifier: string | null;
|
|
@@ -865,6 +854,12 @@ interface FederationKvPrefixes {
|
|
|
865
854
|
* @since 2.1.0
|
|
866
855
|
*/
|
|
867
856
|
readonly acceptSignatureNonce: KvKey;
|
|
857
|
+
/**
|
|
858
|
+
* The key prefix used for storing outbound delivery circuit breaker state.
|
|
859
|
+
* @default `["_fedify", "circuit"]`
|
|
860
|
+
* @since 2.3.0
|
|
861
|
+
*/
|
|
862
|
+
readonly circuitBreaker: KvKey;
|
|
868
863
|
}
|
|
869
864
|
/**
|
|
870
865
|
* Options for {@link FederationOptions.origin} when it is not a string.
|
|
@@ -886,8 +881,10 @@ interface FederationOrigin {
|
|
|
886
881
|
}
|
|
887
882
|
/**
|
|
888
883
|
* Create a new {@link Federation} instance.
|
|
889
|
-
* @param
|
|
884
|
+
* @param options Parameters for initializing the instance.
|
|
890
885
|
* @returns A new {@link Federation} instance.
|
|
886
|
+
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
887
|
+
* specified.
|
|
891
888
|
* @since 0.10.0
|
|
892
889
|
*/
|
|
893
890
|
declare function createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>;
|
|
@@ -1372,7 +1369,10 @@ interface Federation<TContextData> extends Federatable<TContextData> {
|
|
|
1372
1369
|
interface FederationBuilder<TContextData> extends Federatable<TContextData> {
|
|
1373
1370
|
/**
|
|
1374
1371
|
* Builds the federation object.
|
|
1372
|
+
* @param options Parameters for initializing the federation object.
|
|
1375
1373
|
* @returns The federation object.
|
|
1374
|
+
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
1375
|
+
* specified.
|
|
1376
1376
|
*/
|
|
1377
1377
|
build(options: FederationOptions<TContextData>): Promise<Federation<TContextData>>;
|
|
1378
1378
|
}
|
|
@@ -1410,6 +1410,25 @@ interface InboxChallengePolicy {
|
|
|
1410
1410
|
nonceTtlSeconds?: number;
|
|
1411
1411
|
}
|
|
1412
1412
|
/**
|
|
1413
|
+
* Options for cooperative benchmark mode.
|
|
1414
|
+
* @since 2.3.0
|
|
1415
|
+
*/
|
|
1416
|
+
interface FederationBenchmarkOptions {
|
|
1417
|
+
/**
|
|
1418
|
+
* Server-controlled inbox URLs that the benchmark trigger endpoint may
|
|
1419
|
+
* deliver to.
|
|
1420
|
+
*/
|
|
1421
|
+
triggerSinks?: readonly (string | URL)[];
|
|
1422
|
+
/**
|
|
1423
|
+
* Whether the benchmark trigger endpoint may deliver to recipients outside
|
|
1424
|
+
* {@link FederationBenchmarkOptions.triggerSinks}.
|
|
1425
|
+
*
|
|
1426
|
+
* Do not enable this option unless the benchmark endpoint is only reachable
|
|
1427
|
+
* by a trusted benchmark controller.
|
|
1428
|
+
*/
|
|
1429
|
+
allowUnsafeTriggerRecipients?: boolean;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1413
1432
|
* Options for creating a {@link Federation} object.
|
|
1414
1433
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
1415
1434
|
* @since 1.6.0
|
|
@@ -1489,6 +1508,21 @@ interface FederationOptions<TContextData> {
|
|
|
1489
1508
|
*/
|
|
1490
1509
|
allowPrivateAddress?: boolean;
|
|
1491
1510
|
/**
|
|
1511
|
+
* Whether to enable cooperative benchmark mode. This mode exposes
|
|
1512
|
+
* benchmark-only endpoints and relaxes selected defaults for benchmark
|
|
1513
|
+
* targets. Pass an object to configure benchmark trigger delivery.
|
|
1514
|
+
* Do not enable this option in production.
|
|
1515
|
+
*
|
|
1516
|
+
* When enabled, {@link FederationOptions.allowPrivateAddress} defaults to
|
|
1517
|
+
* `true` unless {@link FederationOptions.documentLoaderFactory} or
|
|
1518
|
+
* {@link FederationOptions.contextLoaderFactory} is configured, and
|
|
1519
|
+
* {@link FederationOptions.signatureTimeWindow} defaults to `false`.
|
|
1520
|
+
*
|
|
1521
|
+
* Turned off by default.
|
|
1522
|
+
* @since 2.3.0
|
|
1523
|
+
*/
|
|
1524
|
+
benchmarkMode?: boolean | FederationBenchmarkOptions;
|
|
1525
|
+
/**
|
|
1492
1526
|
* Options for making `User-Agent` strings for HTTP requests.
|
|
1493
1527
|
* If a string is provided, it is used as the `User-Agent` header.
|
|
1494
1528
|
* If an object is provided, it is passed to the {@link getUserAgent}
|
|
@@ -1568,6 +1602,16 @@ interface FederationOptions<TContextData> {
|
|
|
1568
1602
|
*/
|
|
1569
1603
|
outboxRetryPolicy?: RetryPolicy;
|
|
1570
1604
|
/**
|
|
1605
|
+
* The circuit breaker for queued outbound activity delivery. When enabled,
|
|
1606
|
+
* Fedify tracks repeated failures per remote host and temporarily holds
|
|
1607
|
+
* queued activities instead of repeatedly hammering an unreachable server.
|
|
1608
|
+
*
|
|
1609
|
+
* Passing `false` disables the circuit breaker.
|
|
1610
|
+
*
|
|
1611
|
+
* @since 2.3.0
|
|
1612
|
+
*/
|
|
1613
|
+
circuitBreaker?: false | CircuitBreakerOptions;
|
|
1614
|
+
/**
|
|
1571
1615
|
* The retry policy for processing incoming activities. By default, this
|
|
1572
1616
|
* uses an exponential backoff strategy with a maximum of 10 attempts and a
|
|
1573
1617
|
* maximum delay of 12 hours.
|
|
@@ -1596,6 +1640,12 @@ interface FederationOptions<TContextData> {
|
|
|
1596
1640
|
* @since 1.3.0
|
|
1597
1641
|
*/
|
|
1598
1642
|
tracerProvider?: TracerProvider;
|
|
1643
|
+
/**
|
|
1644
|
+
* The OpenTelemetry meter provider for recording metrics. If not provided,
|
|
1645
|
+
* the default global meter provider is used.
|
|
1646
|
+
* @since 2.3.0
|
|
1647
|
+
*/
|
|
1648
|
+
meterProvider?: MeterProvider;
|
|
1599
1649
|
}
|
|
1600
1650
|
/**
|
|
1601
1651
|
* Additional settings for the actor dispatcher.
|
|
@@ -1643,6 +1693,18 @@ interface ActorCallbackSetters<TContextData> {
|
|
|
1643
1693
|
*/
|
|
1644
1694
|
mapAlias(mapper: ActorAliasMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
|
1645
1695
|
/**
|
|
1696
|
+
* Maps a fixed path to a sentinel identifier. It is useful for exposing
|
|
1697
|
+
* a single, instance-level actor at a fixed path, such as `/actor` for
|
|
1698
|
+
* a relay or `/bot` for a bot.
|
|
1699
|
+
* @param path The fixed path to map to the identifier.
|
|
1700
|
+
* @param identifier The sentinel identifier to map the path to.
|
|
1701
|
+
* @returns The setters object so that settings can be chained.
|
|
1702
|
+
* @throws {RouterError} If the provided path or identifier is invalid or fails
|
|
1703
|
+
* runtime validation.
|
|
1704
|
+
* @since 2.3.0
|
|
1705
|
+
*/
|
|
1706
|
+
mapActorAlias(path: `/${string}`, identifier: string): ActorCallbackSetters<TContextData>;
|
|
1707
|
+
/**
|
|
1646
1708
|
* Specifies the conditions under which requests are authorized.
|
|
1647
1709
|
* @param predicate A callback that returns whether a request is authorized.
|
|
1648
1710
|
* @returns The setters object so that settings can be chained.
|
|
@@ -2001,6 +2063,11 @@ interface Context<TContextData> {
|
|
|
2001
2063
|
*/
|
|
2002
2064
|
readonly tracerProvider: TracerProvider;
|
|
2003
2065
|
/**
|
|
2066
|
+
* The OpenTelemetry meter provider.
|
|
2067
|
+
* @since 2.3.0
|
|
2068
|
+
*/
|
|
2069
|
+
readonly meterProvider?: MeterProvider;
|
|
2070
|
+
/**
|
|
2004
2071
|
* The document loader for loading remote JSON-LD documents.
|
|
2005
2072
|
*/
|
|
2006
2073
|
readonly documentLoader: DocumentLoader;
|
|
@@ -2498,9 +2565,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2498
2565
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2499
2566
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2500
2567
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2501
|
-
* Integrity Proofs will not be added.
|
|
2502
|
-
*
|
|
2503
|
-
*
|
|
2568
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2569
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2570
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2571
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2572
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2573
|
+
* recipient probably will not trust the activity.
|
|
2504
2574
|
* @param forwarder The forwarder's identifier or the forwarder's username
|
|
2505
2575
|
* or the forwarder's key pair(s).
|
|
2506
2576
|
* @param recipients The recipients of the activity.
|
|
@@ -2516,9 +2586,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2516
2586
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2517
2587
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2518
2588
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2519
|
-
* Integrity Proofs will not be added.
|
|
2520
|
-
*
|
|
2521
|
-
*
|
|
2589
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2590
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2591
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2592
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2593
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2594
|
+
* recipient probably will not trust the activity.
|
|
2522
2595
|
* @param forwarder The forwarder's identifier or the forwarder's username.
|
|
2523
2596
|
* @param recipients In this case, it must be `"followers"`.
|
|
2524
2597
|
* @param options Options for forwarding the activity.
|
|
@@ -2808,4 +2881,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2808
2881
|
readonly multikey: Multikey;
|
|
2809
2882
|
}
|
|
2810
2883
|
//#endregion
|
|
2811
|
-
export {
|
|
2884
|
+
export { CustomCollectionCursor as $, Rfc6570Expression as A, parseCircuitBreakerKvState as At, createFederationBuilder as B, FederationStartQueueOptions as C, CircuitBreakerFailurePolicy as Ct, InboxListenerSetters as D, CircuitBreakerStateChange as Dt, InboxChallengePolicy as E, CircuitBreakerState as Et, CreateExponentialBackoffPolicyOptions as F, ActorDispatcher as G, respondWithObject as H, RetryContext as I, AuthorizePredicate as J, ActorHandleMapper as K, RetryPolicy as L, FederationOrigin as M, FederationQueueOptions as N, ObjectCallbackSetters as O, NormalizedCircuitBreakerOptions as Ot, createFederation as P, CustomCollectionCounter as Q, createExponentialBackoffPolicy as R, FederationOptions as S, CircuitBreakerCreateOptions as St, IdempotencyStrategy as T, CircuitBreakerOptions as Tt, respondWithObjectIfAcceptable as U, RespondWithObjectOptions as V, ActorAliasMapper as W, CollectionCursor as X, CollectionCounter as Y, CollectionDispatcher as Z, Federatable as _, buildCollectionSynchronizationHeader as _t, GetSignedKeyOptions as a, ObjectDispatcher as at, FederationBuilder as b, CircuitBreakerActivityDrop as bt, ParseUriResult as c, OutboxListenerErrorHandler as ct, SendActivityOptions as d, UnverifiedActivityHandler as dt, CustomCollectionDispatcher as et, SendActivityOptionsForCollection as f, UnverifiedActivityReason as ft, CustomCollectionCallbackSetters as g, PageItems as gt, ConstructorWithTypeId as h, SenderKeyPair as ht, GetActorOptions as i, ObjectAuthorizePredicate as it, FederationKvPrefixes as j, ActivityTransformer as jt, OutboxListenerSetters as k, normalizeCircuitBreakerOptions as kt, RequestContext as l, OutboxPermanentFailureHandler as lt, CollectionCallbackSetters as m, SendActivityError as mt, Context as n, InboxListener as nt, InboxContext as o, OutboxErrorHandler as ot, ActorCallbackSetters as p, WebFingerLinksDispatcher as pt, ActorKeyPairsDispatcher as q, ForwardActivityOptions as r, NodeInfoDispatcher as rt, OutboxContext as s, OutboxListener as st, ActorKeyPair as t, InboxErrorHandler as tt, RouteActivityOptions as u, SharedInboxKeyDispatcher as ut, Federation as v, digest as vt, IdempotencyKeyCallback as w, CircuitBreakerKvState as wt, FederationFetchOptions as x, CircuitBreakerBeforeSendDecision as xt, FederationBenchmarkOptions as y, CircuitBreaker as yt, Message as z };
|