@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,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CSddvgWN.js";
|
|
3
|
+
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-lf8Hsd91.js";
|
|
4
|
+
import { n as GetKeyOwnerOptions } from "./owner-CnngXDNJ.js";
|
|
5
|
+
import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
6
|
+
import { r as MessageQueue } from "./mq-D-nlpY04.js";
|
|
7
|
+
import { Router } from "@fedify/uri-template";
|
|
5
8
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
9
|
+
import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
6
10
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
7
11
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
8
|
-
import {
|
|
12
|
+
import { MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
9
13
|
|
|
10
14
|
//#region src/compat/types.d.ts
|
|
11
15
|
/**
|
|
@@ -14,6 +18,177 @@ import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
|
14
18
|
*/
|
|
15
19
|
type ActivityTransformer<TContextData> = (activity: Activity, context: Context<TContextData>) => Activity;
|
|
16
20
|
//#endregion
|
|
21
|
+
//#region src/federation/circuit-breaker.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The state of a remote host circuit breaker.
|
|
24
|
+
* @since 2.3.0
|
|
25
|
+
*/
|
|
26
|
+
type CircuitBreakerState = "closed" | "open" | "half-open";
|
|
27
|
+
/**
|
|
28
|
+
* The JSON-serializable state stored in the configured {@link KvStore}.
|
|
29
|
+
* @since 2.3.0
|
|
30
|
+
*/
|
|
31
|
+
interface CircuitBreakerKvState {
|
|
32
|
+
readonly state: CircuitBreakerState;
|
|
33
|
+
readonly failures: readonly string[];
|
|
34
|
+
readonly opened?: string;
|
|
35
|
+
readonly halfOpened?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Details passed to {@link CircuitBreakerOptions.onActivityDrop} when a held
|
|
39
|
+
* activity expires before the remote host recovers.
|
|
40
|
+
* @since 2.3.0
|
|
41
|
+
*/
|
|
42
|
+
interface CircuitBreakerActivityDrop {
|
|
43
|
+
/** The inbox URL that would have received the activity. */
|
|
44
|
+
readonly inbox: URL;
|
|
45
|
+
/** The activity that was dropped. */
|
|
46
|
+
readonly activity: Activity;
|
|
47
|
+
/** The activity ID, when known. */
|
|
48
|
+
readonly activityId?: string;
|
|
49
|
+
/** The activity type. */
|
|
50
|
+
readonly activityType: string;
|
|
51
|
+
/** The actor IDs represented by this inbox. */
|
|
52
|
+
readonly actorIds: readonly URL[];
|
|
53
|
+
/** The time when Fedify first held this activity. */
|
|
54
|
+
readonly heldSince: Temporal.Instant;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Configures how a remote host circuit opens after repeated delivery
|
|
58
|
+
* failures.
|
|
59
|
+
* @since 2.3.0
|
|
60
|
+
*/
|
|
61
|
+
type CircuitBreakerFailurePolicy = {
|
|
62
|
+
failure(timestamps: readonly Temporal.Instant[]): boolean;
|
|
63
|
+
readonly failureThreshold?: never;
|
|
64
|
+
readonly failureWindow?: never;
|
|
65
|
+
} | {
|
|
66
|
+
readonly failure?: never;
|
|
67
|
+
readonly failureThreshold?: number;
|
|
68
|
+
readonly failureWindow?: Temporal.Duration | Temporal.DurationLike;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Options for Fedify's outbound activity circuit breaker.
|
|
72
|
+
* @since 2.3.0
|
|
73
|
+
*/
|
|
74
|
+
type CircuitBreakerOptions = CircuitBreakerFailurePolicy & {
|
|
75
|
+
/**
|
|
76
|
+
* How long an open circuit waits before allowing a half-open recovery probe.
|
|
77
|
+
* @default `{ minutes: 30 }`
|
|
78
|
+
*/
|
|
79
|
+
readonly recoveryDelay?: Temporal.Duration | Temporal.DurationLike;
|
|
80
|
+
/**
|
|
81
|
+
* How long Fedify keeps requeueing activities held by an open circuit before
|
|
82
|
+
* dropping them.
|
|
83
|
+
* @default `{ days: 7 }`
|
|
84
|
+
*/
|
|
85
|
+
readonly heldActivityTtl?: Temporal.Duration | Temporal.DurationLike;
|
|
86
|
+
/**
|
|
87
|
+
* How often other held activities retry while a half-open probe is in
|
|
88
|
+
* flight. The probe is treated as stale after the recovery delay.
|
|
89
|
+
* @default `{ seconds: 1 }`
|
|
90
|
+
*/
|
|
91
|
+
readonly releaseInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
92
|
+
/**
|
|
93
|
+
* Called whenever the circuit state changes.
|
|
94
|
+
*/
|
|
95
|
+
readonly onStateChange?: (remoteHost: string, previousState: CircuitBreakerState, newState: CircuitBreakerState) => void | Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Called when an activity held by the circuit breaker expires.
|
|
98
|
+
*/
|
|
99
|
+
readonly onActivityDrop?: (remoteHost: string, details: CircuitBreakerActivityDrop) => void | Promise<void>;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Normalized circuit breaker options used internally by Fedify.
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
interface NormalizedCircuitBreakerOptions {
|
|
106
|
+
readonly failure: (timestamps: readonly Temporal.Instant[]) => boolean;
|
|
107
|
+
readonly pruneFailures: (timestamps: readonly Temporal.Instant[], now: Temporal.Instant) => readonly Temporal.Instant[];
|
|
108
|
+
readonly recoveryDelay: Temporal.Duration;
|
|
109
|
+
readonly heldActivityTtl: Temporal.Duration;
|
|
110
|
+
readonly releaseInterval: Temporal.Duration;
|
|
111
|
+
readonly onStateChange?: CircuitBreakerOptions["onStateChange"];
|
|
112
|
+
readonly onActivityDrop?: CircuitBreakerOptions["onActivityDrop"];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Constructor options for {@link CircuitBreaker}.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
interface CircuitBreakerCreateOptions {
|
|
119
|
+
readonly kv: KvStore;
|
|
120
|
+
readonly prefix: KvKey;
|
|
121
|
+
readonly options?: CircuitBreakerOptions;
|
|
122
|
+
readonly now?: () => Temporal.Instant;
|
|
123
|
+
/**
|
|
124
|
+
* Observes state changes after user callbacks have run.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
readonly stateChangeObserver?: (remoteHost: string, previousState: CircuitBreakerState, newState: CircuitBreakerState) => void | Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The delivery decision returned by {@link CircuitBreaker.beforeSend}.
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
type CircuitBreakerBeforeSendDecision = {
|
|
134
|
+
readonly type: "send";
|
|
135
|
+
readonly probe: boolean;
|
|
136
|
+
readonly stateChange?: CircuitBreakerStateChange;
|
|
137
|
+
} | {
|
|
138
|
+
readonly type: "hold";
|
|
139
|
+
readonly state: "open" | "half-open";
|
|
140
|
+
readonly delay: Temporal.Duration;
|
|
141
|
+
readonly heldSince: Temporal.Instant;
|
|
142
|
+
} | {
|
|
143
|
+
readonly type: "drop";
|
|
144
|
+
readonly heldSince: Temporal.Instant;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* A circuit breaker state transition.
|
|
148
|
+
* @since 2.3.0
|
|
149
|
+
*/
|
|
150
|
+
interface CircuitBreakerStateChange {
|
|
151
|
+
readonly previousState: CircuitBreakerState;
|
|
152
|
+
readonly newState: CircuitBreakerState;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Tracks reachability state for remote outbox delivery hosts.
|
|
156
|
+
* @since 2.3.0
|
|
157
|
+
*/
|
|
158
|
+
declare class CircuitBreaker {
|
|
159
|
+
#private;
|
|
160
|
+
constructor(options: CircuitBreakerCreateOptions);
|
|
161
|
+
get options(): NormalizedCircuitBreakerOptions;
|
|
162
|
+
capHeldDelay(heldSince: Temporal.Instant, delay: Temporal.Duration): Temporal.Duration;
|
|
163
|
+
beforeSend(remoteHost: string, message: {
|
|
164
|
+
readonly circuitHeldSince?: string;
|
|
165
|
+
}): Promise<CircuitBreakerBeforeSendDecision>;
|
|
166
|
+
recordSuccess(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
167
|
+
recordReachableFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
168
|
+
recordFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>;
|
|
169
|
+
dropActivity(remoteHost: string, details: CircuitBreakerActivityDrop): Promise<void>;
|
|
170
|
+
getState(remoteHost: string): Promise<CircuitBreakerKvState | undefined>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Normalizes user-provided circuit breaker options into the internal policy
|
|
174
|
+
* shape used while processing queued outbox deliveries.
|
|
175
|
+
*
|
|
176
|
+
* @param options The public circuit breaker options supplied to Fedify.
|
|
177
|
+
* @returns The normalized failure predicate, failure pruning function,
|
|
178
|
+
* duration values, and optional callbacks with defaults applied.
|
|
179
|
+
* @throws {RangeError} If any configured duration is not positive.
|
|
180
|
+
* @throws {TypeError} If `failureThreshold` is not a positive integer.
|
|
181
|
+
*/
|
|
182
|
+
declare function normalizeCircuitBreakerOptions(options: CircuitBreakerOptions): NormalizedCircuitBreakerOptions;
|
|
183
|
+
/**
|
|
184
|
+
* Parses a value loaded from the circuit breaker KV store.
|
|
185
|
+
*
|
|
186
|
+
* @param value The raw KV value to validate.
|
|
187
|
+
* @returns A circuit breaker state when `value` has a recognized state and
|
|
188
|
+
* valid instant strings, or `undefined` when the stored value is malformed.
|
|
189
|
+
*/
|
|
190
|
+
declare function parseCircuitBreakerKvState(value: unknown): CircuitBreakerKvState | undefined;
|
|
191
|
+
//#endregion
|
|
17
192
|
//#region src/federation/collection.d.ts
|
|
18
193
|
/**
|
|
19
194
|
* A page of items.
|
|
@@ -80,13 +255,19 @@ declare class SendActivityError extends Error {
|
|
|
80
255
|
*/
|
|
81
256
|
readonly responseBody: string;
|
|
82
257
|
/**
|
|
258
|
+
* The response headers from the inbox.
|
|
259
|
+
* @since 2.3.0
|
|
260
|
+
*/
|
|
261
|
+
readonly responseHeaders: Headers;
|
|
262
|
+
/**
|
|
83
263
|
* Creates a new {@link SendActivityError}.
|
|
84
264
|
* @param inbox The inbox URL.
|
|
85
265
|
* @param statusCode The HTTP status code.
|
|
86
266
|
* @param message The error message.
|
|
87
267
|
* @param responseBody The response body.
|
|
268
|
+
* @param responseHeaders The response headers.
|
|
88
269
|
*/
|
|
89
|
-
constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
|
|
270
|
+
constructor(inbox: URL, statusCode: number, message: string, responseBody: string, responseHeaders?: HeadersInit);
|
|
90
271
|
}
|
|
91
272
|
//#endregion
|
|
92
273
|
//#region src/federation/callback.d.ts
|
|
@@ -309,11 +490,28 @@ type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Pr
|
|
|
309
490
|
* @since 2.0.0
|
|
310
491
|
*/
|
|
311
492
|
type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
|
|
312
|
-
/**
|
|
493
|
+
/**
|
|
494
|
+
* Why Fedify is giving up on delivery.
|
|
495
|
+
*
|
|
496
|
+
* `"http"` means the inbox returned a configured permanent-failure HTTP
|
|
497
|
+
* status. `"circuit-breaker-ttl"` means the outbound circuit breaker held
|
|
498
|
+
* the activity until its retention period expired.
|
|
499
|
+
*
|
|
500
|
+
* @since 2.3.0
|
|
501
|
+
*/
|
|
502
|
+
readonly reason: "http" | "circuit-breaker-ttl"; /** The inbox URL that failed. */
|
|
503
|
+
readonly inbox: URL; /** The activity that failed to deliver. */
|
|
313
504
|
readonly activity: Activity; /** The error that occurred. */
|
|
314
505
|
readonly error: SendActivityError; /** The HTTP status code returned by the inbox. */
|
|
315
506
|
readonly statusCode: number;
|
|
316
507
|
/**
|
|
508
|
+
* The time when the circuit breaker first held the activity, if
|
|
509
|
+
* {@link reason} is `"circuit-breaker-ttl"`.
|
|
510
|
+
*
|
|
511
|
+
* @since 2.3.0
|
|
512
|
+
*/
|
|
513
|
+
readonly circuitHeldSince?: Temporal.Instant;
|
|
514
|
+
/**
|
|
317
515
|
* The actor IDs that were supposed to receive the activity at this inbox.
|
|
318
516
|
*/
|
|
319
517
|
readonly actorIds: readonly URL[];
|
|
@@ -380,172 +578,6 @@ type CustomCollectionCounter<TParam extends string, TContextData> = (context: Re
|
|
|
380
578
|
*/
|
|
381
579
|
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
|
382
580
|
//#endregion
|
|
383
|
-
//#region src/federation/mq.d.ts
|
|
384
|
-
/**
|
|
385
|
-
* Additional options for enqueuing a message in a queue.
|
|
386
|
-
*
|
|
387
|
-
* @since 0.5.0
|
|
388
|
-
*/
|
|
389
|
-
interface MessageQueueEnqueueOptions {
|
|
390
|
-
/**
|
|
391
|
-
* The delay before the message is enqueued. No delay by default.
|
|
392
|
-
*
|
|
393
|
-
* It must not be negative.
|
|
394
|
-
*/
|
|
395
|
-
readonly delay?: Temporal.Duration;
|
|
396
|
-
/**
|
|
397
|
-
* An optional key that ensures messages with the same ordering key are
|
|
398
|
-
* processed sequentially (one at a time). Messages with different ordering
|
|
399
|
-
* keys (or no ordering key) may be processed in parallel.
|
|
400
|
-
*
|
|
401
|
-
* This is useful for ensuring that related messages are processed in order,
|
|
402
|
-
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
403
|
-
* activity for the same object.
|
|
404
|
-
*
|
|
405
|
-
* @since 2.0.0
|
|
406
|
-
*/
|
|
407
|
-
readonly orderingKey?: string;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Additional options for listening to a message queue.
|
|
411
|
-
*
|
|
412
|
-
* @since 1.0.0
|
|
413
|
-
*/
|
|
414
|
-
interface MessageQueueListenOptions {
|
|
415
|
-
/**
|
|
416
|
-
* The signal to abort listening to the message queue.
|
|
417
|
-
*/
|
|
418
|
-
signal?: AbortSignal;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* An abstract interface for a message queue.
|
|
422
|
-
*
|
|
423
|
-
* @since 0.5.0
|
|
424
|
-
*/
|
|
425
|
-
interface MessageQueue {
|
|
426
|
-
/**
|
|
427
|
-
* Whether the message queue backend provides native retry mechanisms.
|
|
428
|
-
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
429
|
-
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
430
|
-
* using its own retry policies.
|
|
431
|
-
*
|
|
432
|
-
* @default `false`
|
|
433
|
-
* @since 1.7.0
|
|
434
|
-
*/
|
|
435
|
-
readonly nativeRetrial?: boolean;
|
|
436
|
-
/**
|
|
437
|
-
* Enqueues a message in the queue.
|
|
438
|
-
* @param message The message to enqueue.
|
|
439
|
-
* @param options Additional options for enqueuing the message.
|
|
440
|
-
*/
|
|
441
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
442
|
-
/**
|
|
443
|
-
* Enqueues multiple messages in the queue. This operation is optional,
|
|
444
|
-
* and may not be supported by all implementations. If not supported,
|
|
445
|
-
* Fedify will invoke {@link enqueue} for each message.
|
|
446
|
-
*
|
|
447
|
-
* @param messages The messages to enqueue.
|
|
448
|
-
* @param options Additional options for enqueuing the messages.
|
|
449
|
-
*/
|
|
450
|
-
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
451
|
-
/**
|
|
452
|
-
* Listens for messages in the queue.
|
|
453
|
-
* @param handler The handler for messages in the queue.
|
|
454
|
-
* @param options Additional options for listening to the message queue.
|
|
455
|
-
* @returns A promise that resolves when the listening is done. It never
|
|
456
|
-
* rejects, and is resolved when the signal is aborted. If no
|
|
457
|
-
* signal is provided, it never resolves.
|
|
458
|
-
*/
|
|
459
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Additional options for {@link InProcessMessageQueue}.
|
|
463
|
-
* @since 1.0.0
|
|
464
|
-
*/
|
|
465
|
-
interface InProcessMessageQueueOptions {
|
|
466
|
-
/**
|
|
467
|
-
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
468
|
-
* @default `{ seconds: 5 }`
|
|
469
|
-
*/
|
|
470
|
-
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* A message queue that processes messages in the same process.
|
|
474
|
-
* Do not use this in production as it does neither persist messages nor
|
|
475
|
-
* distribute them across multiple processes.
|
|
476
|
-
*
|
|
477
|
-
* @since 0.5.0
|
|
478
|
-
*/
|
|
479
|
-
declare class InProcessMessageQueue implements MessageQueue {
|
|
480
|
-
#private;
|
|
481
|
-
/**
|
|
482
|
-
* In-process message queue does not provide native retry mechanisms.
|
|
483
|
-
* @since 1.7.0
|
|
484
|
-
*/
|
|
485
|
-
readonly nativeRetrial = false;
|
|
486
|
-
/**
|
|
487
|
-
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
488
|
-
* @param options Additional options for the in-process message queue.
|
|
489
|
-
*/
|
|
490
|
-
constructor(options?: InProcessMessageQueueOptions);
|
|
491
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
492
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
493
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* A message queue that processes messages in parallel. It takes another
|
|
497
|
-
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
498
|
-
* number of workers.
|
|
499
|
-
*
|
|
500
|
-
* Actually, it's rather a decorator than a queue itself.
|
|
501
|
-
*
|
|
502
|
-
* Note that the workers do not run in truly parallel, in the sense that they
|
|
503
|
-
* are not running in separate threads or processes. They are running in the
|
|
504
|
-
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
505
|
-
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
506
|
-
* workloads.
|
|
507
|
-
*
|
|
508
|
-
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
509
|
-
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
510
|
-
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
511
|
-
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
512
|
-
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
513
|
-
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
514
|
-
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
515
|
-
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
516
|
-
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
517
|
-
*
|
|
518
|
-
* Messages with the same ordering key will never be processed concurrently
|
|
519
|
-
* by different workers, ensuring sequential processing within each key.
|
|
520
|
-
* Messages with different ordering keys (or no ordering key) can still be
|
|
521
|
-
* processed in parallel.
|
|
522
|
-
*
|
|
523
|
-
* @since 1.0.0
|
|
524
|
-
*/
|
|
525
|
-
declare class ParallelMessageQueue implements MessageQueue {
|
|
526
|
-
#private;
|
|
527
|
-
readonly queue: MessageQueue;
|
|
528
|
-
readonly workers: number;
|
|
529
|
-
/**
|
|
530
|
-
* Inherits the native retry capability from the wrapped queue.
|
|
531
|
-
* @since 1.7.0
|
|
532
|
-
*/
|
|
533
|
-
readonly nativeRetrial?: boolean;
|
|
534
|
-
/**
|
|
535
|
-
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
536
|
-
* number of workers.
|
|
537
|
-
* @param queue The message queue to use under the hood. Note that
|
|
538
|
-
* {@link ParallelMessageQueue} cannot be nested.
|
|
539
|
-
* @param workers The number of workers to process messages in parallel.
|
|
540
|
-
* @throws {TypeError} If the given queue is an instance of
|
|
541
|
-
* {@link ParallelMessageQueue}.
|
|
542
|
-
*/
|
|
543
|
-
constructor(queue: MessageQueue, workers: number);
|
|
544
|
-
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
545
|
-
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
546
|
-
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
547
|
-
}
|
|
548
|
-
//#endregion
|
|
549
581
|
//#region src/federation/handler.d.ts
|
|
550
582
|
/**
|
|
551
583
|
* Options for the {@link respondWithObject} and
|
|
@@ -578,91 +610,6 @@ declare function respondWithObject(object: Object$1, options?: RespondWithObject
|
|
|
578
610
|
*/
|
|
579
611
|
declare function respondWithObjectIfAcceptable(object: Object$1, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
|
|
580
612
|
//#endregion
|
|
581
|
-
//#region src/federation/router.d.ts
|
|
582
|
-
/**
|
|
583
|
-
* Options for the {@link Router}.
|
|
584
|
-
* @since 0.12.0
|
|
585
|
-
*/
|
|
586
|
-
interface RouterOptions {
|
|
587
|
-
/**
|
|
588
|
-
* Whether to ignore trailing slashes when matching paths.
|
|
589
|
-
*/
|
|
590
|
-
trailingSlashInsensitive?: boolean;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* The result of {@link Router.route} method.
|
|
594
|
-
* @since 1.3.0
|
|
595
|
-
*/
|
|
596
|
-
interface RouterRouteResult {
|
|
597
|
-
/**
|
|
598
|
-
* The matched route name.
|
|
599
|
-
*/
|
|
600
|
-
name: string;
|
|
601
|
-
/**
|
|
602
|
-
* The URL template of the matched route.
|
|
603
|
-
*/
|
|
604
|
-
template: string;
|
|
605
|
-
/**
|
|
606
|
-
* The values extracted from the URL.
|
|
607
|
-
*/
|
|
608
|
-
values: Record<string, string>;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* URL router and constructor based on URI Template
|
|
612
|
-
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
613
|
-
*/
|
|
614
|
-
declare class Router {
|
|
615
|
-
#private;
|
|
616
|
-
/**
|
|
617
|
-
* Whether to ignore trailing slashes when matching paths.
|
|
618
|
-
* @since 1.6.0
|
|
619
|
-
*/
|
|
620
|
-
trailingSlashInsensitive: boolean;
|
|
621
|
-
/**
|
|
622
|
-
* Create a new {@link Router}.
|
|
623
|
-
* @param options Options for the router.
|
|
624
|
-
*/
|
|
625
|
-
constructor(options?: RouterOptions);
|
|
626
|
-
clone(): Router;
|
|
627
|
-
/**
|
|
628
|
-
* Checks if a path name exists in the router.
|
|
629
|
-
* @param name The name of the path.
|
|
630
|
-
* @returns `true` if the path name exists, otherwise `false`.
|
|
631
|
-
*/
|
|
632
|
-
has(name: string): boolean;
|
|
633
|
-
/**
|
|
634
|
-
* Adds a new path rule to the router.
|
|
635
|
-
* @param template The path pattern.
|
|
636
|
-
* @param name The name of the path.
|
|
637
|
-
* @returns The names of the variables in the path pattern.
|
|
638
|
-
*/
|
|
639
|
-
add(template: string, name: string): Set<string>;
|
|
640
|
-
/**
|
|
641
|
-
* Resolves a path name and values from a URL, if any match.
|
|
642
|
-
* @param url The URL to resolve.
|
|
643
|
-
* @returns The name of the path and its values, if any match. Otherwise,
|
|
644
|
-
* `null`.
|
|
645
|
-
*/
|
|
646
|
-
route(url: string): RouterRouteResult | null;
|
|
647
|
-
/**
|
|
648
|
-
* Constructs a URL/path from a path name and values.
|
|
649
|
-
* @param name The name of the path.
|
|
650
|
-
* @param values The values to expand the path with.
|
|
651
|
-
* @returns The URL/path, if the name exists. Otherwise, `null`.
|
|
652
|
-
*/
|
|
653
|
-
build(name: string, values: Record<string, string>): string | null;
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* An error thrown by the {@link Router}.
|
|
657
|
-
*/
|
|
658
|
-
declare class RouterError extends Error {
|
|
659
|
-
/**
|
|
660
|
-
* Create a new {@link RouterError}.
|
|
661
|
-
* @param message The error message.
|
|
662
|
-
*/
|
|
663
|
-
constructor(message: string);
|
|
664
|
-
}
|
|
665
|
-
//#endregion
|
|
666
613
|
//#region src/federation/builder.d.ts
|
|
667
614
|
/**
|
|
668
615
|
* Creates a new {@link FederationBuilder} instance.
|
|
@@ -726,6 +673,17 @@ interface OutboxMessage {
|
|
|
726
673
|
readonly attempt: number;
|
|
727
674
|
readonly headers: Readonly<Record<string, string>>;
|
|
728
675
|
readonly orderingKey?: string;
|
|
676
|
+
/**
|
|
677
|
+
* Whether this message is currently held by the outbound circuit breaker.
|
|
678
|
+
* @internal
|
|
679
|
+
*/
|
|
680
|
+
readonly circuitHeld?: true;
|
|
681
|
+
/**
|
|
682
|
+
* When Fedify first held this message because the remote host circuit was
|
|
683
|
+
* open.
|
|
684
|
+
* @internal
|
|
685
|
+
*/
|
|
686
|
+
readonly circuitHeldSince?: string;
|
|
729
687
|
readonly traceContext: Readonly<Record<string, string>>;
|
|
730
688
|
}
|
|
731
689
|
interface InboxMessage {
|
|
@@ -733,6 +691,42 @@ interface InboxMessage {
|
|
|
733
691
|
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
734
692
|
readonly baseUrl: string;
|
|
735
693
|
readonly activity: unknown;
|
|
694
|
+
/**
|
|
695
|
+
* The normalized JSON-LD representation of a signed inbox activity that
|
|
696
|
+
* Fedify already compacted successfully while accepting the request. Queue
|
|
697
|
+
* workers can reuse this producer-side parse cache under stricter loader or
|
|
698
|
+
* network constraints without changing the raw payload preserved for
|
|
699
|
+
* forwarding.
|
|
700
|
+
*
|
|
701
|
+
* This may exist even when {@link ldSignatureVerified} is `false`, because
|
|
702
|
+
* fallback-authenticated traffic and already-queued backlog items can still
|
|
703
|
+
* depend on the cached normalized form to avoid re-fetching remote custom
|
|
704
|
+
* contexts during worker processing.
|
|
705
|
+
*
|
|
706
|
+
* This is optional for backward compatibility with messages that were
|
|
707
|
+
* queued by older Fedify versions or that were already in a queue before
|
|
708
|
+
* upgrading.
|
|
709
|
+
*
|
|
710
|
+
* Fedify keeps this on the queued message itself instead of an external
|
|
711
|
+
* sidecar because generic queue backends do not provide reliable lifecycle
|
|
712
|
+
* guarantees for auxiliary storage across retries and redeliveries.
|
|
713
|
+
*
|
|
714
|
+
* @internal
|
|
715
|
+
*/
|
|
716
|
+
readonly normalizedActivity?: unknown;
|
|
717
|
+
/**
|
|
718
|
+
* Whether the producer actually verified the Linked Data Signature before
|
|
719
|
+
* queueing this message. This lets workers distinguish verified LDS replay
|
|
720
|
+
* from other authenticated inbox traffic that merely happened to include a
|
|
721
|
+
* signature block. This provenance marker is separate from the optional
|
|
722
|
+
* normalizedActivity parse cache.
|
|
723
|
+
*
|
|
724
|
+
* `undefined` preserves backward compatibility with older queued messages
|
|
725
|
+
* that predate this marker.
|
|
726
|
+
*
|
|
727
|
+
* @internal
|
|
728
|
+
*/
|
|
729
|
+
readonly ldSignatureVerified?: boolean;
|
|
736
730
|
readonly started: string;
|
|
737
731
|
readonly attempt: number;
|
|
738
732
|
readonly identifier: string | null;
|
|
@@ -863,6 +857,12 @@ interface FederationKvPrefixes {
|
|
|
863
857
|
* @since 2.1.0
|
|
864
858
|
*/
|
|
865
859
|
readonly acceptSignatureNonce: KvKey;
|
|
860
|
+
/**
|
|
861
|
+
* The key prefix used for storing outbound delivery circuit breaker state.
|
|
862
|
+
* @default `["_fedify", "circuit"]`
|
|
863
|
+
* @since 2.3.0
|
|
864
|
+
*/
|
|
865
|
+
readonly circuitBreaker: KvKey;
|
|
866
866
|
}
|
|
867
867
|
/**
|
|
868
868
|
* Options for {@link FederationOptions.origin} when it is not a string.
|
|
@@ -884,8 +884,10 @@ interface FederationOrigin {
|
|
|
884
884
|
}
|
|
885
885
|
/**
|
|
886
886
|
* Create a new {@link Federation} instance.
|
|
887
|
-
* @param
|
|
887
|
+
* @param options Parameters for initializing the instance.
|
|
888
888
|
* @returns A new {@link Federation} instance.
|
|
889
|
+
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
890
|
+
* specified.
|
|
889
891
|
* @since 0.10.0
|
|
890
892
|
*/
|
|
891
893
|
declare function createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>;
|
|
@@ -1370,7 +1372,10 @@ interface Federation<TContextData> extends Federatable<TContextData> {
|
|
|
1370
1372
|
interface FederationBuilder<TContextData> extends Federatable<TContextData> {
|
|
1371
1373
|
/**
|
|
1372
1374
|
* Builds the federation object.
|
|
1375
|
+
* @param options Parameters for initializing the federation object.
|
|
1373
1376
|
* @returns The federation object.
|
|
1377
|
+
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
1378
|
+
* specified.
|
|
1374
1379
|
*/
|
|
1375
1380
|
build(options: FederationOptions<TContextData>): Promise<Federation<TContextData>>;
|
|
1376
1381
|
}
|
|
@@ -1408,6 +1413,25 @@ interface InboxChallengePolicy {
|
|
|
1408
1413
|
nonceTtlSeconds?: number;
|
|
1409
1414
|
}
|
|
1410
1415
|
/**
|
|
1416
|
+
* Options for cooperative benchmark mode.
|
|
1417
|
+
* @since 2.3.0
|
|
1418
|
+
*/
|
|
1419
|
+
interface FederationBenchmarkOptions {
|
|
1420
|
+
/**
|
|
1421
|
+
* Server-controlled inbox URLs that the benchmark trigger endpoint may
|
|
1422
|
+
* deliver to.
|
|
1423
|
+
*/
|
|
1424
|
+
triggerSinks?: readonly (string | URL)[];
|
|
1425
|
+
/**
|
|
1426
|
+
* Whether the benchmark trigger endpoint may deliver to recipients outside
|
|
1427
|
+
* {@link FederationBenchmarkOptions.triggerSinks}.
|
|
1428
|
+
*
|
|
1429
|
+
* Do not enable this option unless the benchmark endpoint is only reachable
|
|
1430
|
+
* by a trusted benchmark controller.
|
|
1431
|
+
*/
|
|
1432
|
+
allowUnsafeTriggerRecipients?: boolean;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1411
1435
|
* Options for creating a {@link Federation} object.
|
|
1412
1436
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
1413
1437
|
* @since 1.6.0
|
|
@@ -1487,6 +1511,21 @@ interface FederationOptions<TContextData> {
|
|
|
1487
1511
|
*/
|
|
1488
1512
|
allowPrivateAddress?: boolean;
|
|
1489
1513
|
/**
|
|
1514
|
+
* Whether to enable cooperative benchmark mode. This mode exposes
|
|
1515
|
+
* benchmark-only endpoints and relaxes selected defaults for benchmark
|
|
1516
|
+
* targets. Pass an object to configure benchmark trigger delivery.
|
|
1517
|
+
* Do not enable this option in production.
|
|
1518
|
+
*
|
|
1519
|
+
* When enabled, {@link FederationOptions.allowPrivateAddress} defaults to
|
|
1520
|
+
* `true` unless {@link FederationOptions.documentLoaderFactory} or
|
|
1521
|
+
* {@link FederationOptions.contextLoaderFactory} is configured, and
|
|
1522
|
+
* {@link FederationOptions.signatureTimeWindow} defaults to `false`.
|
|
1523
|
+
*
|
|
1524
|
+
* Turned off by default.
|
|
1525
|
+
* @since 2.3.0
|
|
1526
|
+
*/
|
|
1527
|
+
benchmarkMode?: boolean | FederationBenchmarkOptions;
|
|
1528
|
+
/**
|
|
1490
1529
|
* Options for making `User-Agent` strings for HTTP requests.
|
|
1491
1530
|
* If a string is provided, it is used as the `User-Agent` header.
|
|
1492
1531
|
* If an object is provided, it is passed to the {@link getUserAgent}
|
|
@@ -1566,6 +1605,16 @@ interface FederationOptions<TContextData> {
|
|
|
1566
1605
|
*/
|
|
1567
1606
|
outboxRetryPolicy?: RetryPolicy;
|
|
1568
1607
|
/**
|
|
1608
|
+
* The circuit breaker for queued outbound activity delivery. When enabled,
|
|
1609
|
+
* Fedify tracks repeated failures per remote host and temporarily holds
|
|
1610
|
+
* queued activities instead of repeatedly hammering an unreachable server.
|
|
1611
|
+
*
|
|
1612
|
+
* Passing `false` disables the circuit breaker.
|
|
1613
|
+
*
|
|
1614
|
+
* @since 2.3.0
|
|
1615
|
+
*/
|
|
1616
|
+
circuitBreaker?: false | CircuitBreakerOptions;
|
|
1617
|
+
/**
|
|
1569
1618
|
* The retry policy for processing incoming activities. By default, this
|
|
1570
1619
|
* uses an exponential backoff strategy with a maximum of 10 attempts and a
|
|
1571
1620
|
* maximum delay of 12 hours.
|
|
@@ -1594,6 +1643,12 @@ interface FederationOptions<TContextData> {
|
|
|
1594
1643
|
* @since 1.3.0
|
|
1595
1644
|
*/
|
|
1596
1645
|
tracerProvider?: TracerProvider;
|
|
1646
|
+
/**
|
|
1647
|
+
* The OpenTelemetry meter provider for recording metrics. If not provided,
|
|
1648
|
+
* the default global meter provider is used.
|
|
1649
|
+
* @since 2.3.0
|
|
1650
|
+
*/
|
|
1651
|
+
meterProvider?: MeterProvider;
|
|
1597
1652
|
}
|
|
1598
1653
|
/**
|
|
1599
1654
|
* Additional settings for the actor dispatcher.
|
|
@@ -1641,6 +1696,18 @@ interface ActorCallbackSetters<TContextData> {
|
|
|
1641
1696
|
*/
|
|
1642
1697
|
mapAlias(mapper: ActorAliasMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
|
1643
1698
|
/**
|
|
1699
|
+
* Maps a fixed path to a sentinel identifier. It is useful for exposing
|
|
1700
|
+
* a single, instance-level actor at a fixed path, such as `/actor` for
|
|
1701
|
+
* a relay or `/bot` for a bot.
|
|
1702
|
+
* @param path The fixed path to map to the identifier.
|
|
1703
|
+
* @param identifier The sentinel identifier to map the path to.
|
|
1704
|
+
* @returns The setters object so that settings can be chained.
|
|
1705
|
+
* @throws {RouterError} If the provided path or identifier is invalid or fails
|
|
1706
|
+
* runtime validation.
|
|
1707
|
+
* @since 2.3.0
|
|
1708
|
+
*/
|
|
1709
|
+
mapActorAlias(path: `/${string}`, identifier: string): ActorCallbackSetters<TContextData>;
|
|
1710
|
+
/**
|
|
1644
1711
|
* Specifies the conditions under which requests are authorized.
|
|
1645
1712
|
* @param predicate A callback that returns whether a request is authorized.
|
|
1646
1713
|
* @returns The setters object so that settings can be chained.
|
|
@@ -1999,6 +2066,11 @@ interface Context<TContextData> {
|
|
|
1999
2066
|
*/
|
|
2000
2067
|
readonly tracerProvider: TracerProvider;
|
|
2001
2068
|
/**
|
|
2069
|
+
* The OpenTelemetry meter provider.
|
|
2070
|
+
* @since 2.3.0
|
|
2071
|
+
*/
|
|
2072
|
+
readonly meterProvider?: MeterProvider;
|
|
2073
|
+
/**
|
|
2002
2074
|
* The document loader for loading remote JSON-LD documents.
|
|
2003
2075
|
*/
|
|
2004
2076
|
readonly documentLoader: DocumentLoader;
|
|
@@ -2496,9 +2568,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2496
2568
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2497
2569
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2498
2570
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2499
|
-
* Integrity Proofs will not be added.
|
|
2500
|
-
*
|
|
2501
|
-
*
|
|
2571
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2572
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2573
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2574
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2575
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2576
|
+
* recipient probably will not trust the activity.
|
|
2502
2577
|
* @param forwarder The forwarder's identifier or the forwarder's username
|
|
2503
2578
|
* or the forwarder's key pair(s).
|
|
2504
2579
|
* @param recipients The recipients of the activity.
|
|
@@ -2514,9 +2589,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2514
2589
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2515
2590
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2516
2591
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2517
|
-
* Integrity Proofs will not be added.
|
|
2518
|
-
*
|
|
2519
|
-
*
|
|
2592
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2593
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2594
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2595
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2596
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2597
|
+
* recipient probably will not trust the activity.
|
|
2520
2598
|
* @param forwarder The forwarder's identifier or the forwarder's username.
|
|
2521
2599
|
* @param recipients In this case, it must be `"followers"`.
|
|
2522
2600
|
* @param options Options for forwarding the activity.
|
|
@@ -2806,4 +2884,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2806
2884
|
readonly multikey: Multikey;
|
|
2807
2885
|
}
|
|
2808
2886
|
//#endregion
|
|
2809
|
-
export {
|
|
2887
|
+
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 };
|