@fedify/fedify 0.12.0-dev.262 → 0.12.0-dev.265
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +43 -0
- package/esm/federation/handler.js +41 -21
- package/esm/federation/middleware.js +211 -41
- package/esm/federation/mod.js +1 -0
- package/esm/federation/mq.js +1 -1
- package/esm/federation/retry.js +34 -0
- package/package.json +1 -1
- package/types/federation/callback.d.ts +7 -7
- package/types/federation/callback.d.ts.map +1 -1
- package/types/federation/context.d.ts +19 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/handler.d.ts +4 -2
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +22 -6
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/federation/mod.d.ts +1 -0
- package/types/federation/mod.d.ts.map +1 -1
- package/types/federation/mq.d.ts +2 -0
- package/types/federation/mq.d.ts.map +1 -1
- package/types/federation/queue.d.ts +11 -1
- package/types/federation/queue.d.ts.map +1 -1
- package/types/federation/retry.d.ts +64 -0
- package/types/federation/retry.d.ts.map +1 -0
- package/types/federation/retry.test.d.ts.map +1 -0
- package/types/testing/context.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -8,8 +8,51 @@ Version 0.12.0
|
|
8
8
|
|
9
9
|
To be released.
|
10
10
|
|
11
|
+
- Incoming activities are now queued before being dispatched to the inbox
|
12
|
+
listener if the `queue` option is provided to the `createFederation()`
|
13
|
+
function. [[#70]]
|
14
|
+
|
15
|
+
- The type of `InboxListener` callback type's first parameter became
|
16
|
+
`Context` (was `RequestContext`).
|
17
|
+
- The type of `InboxErrorHandler` callback type's first parameter became
|
18
|
+
`Context` (was `RequestContext`).
|
19
|
+
- The type of `SharedInboxKeyDispatcher` callback type's first parameter
|
20
|
+
became `Context` (was `RequestContext`).
|
21
|
+
|
22
|
+
- Implemented fully customizable retry policy for failed tasks in the task
|
23
|
+
queue. By default, the task queue retries the failed tasks with
|
24
|
+
an exponential backoff policy with decorrelated jitter.
|
25
|
+
|
26
|
+
- Added `outboxRetryPolicy` option to `CreateFederationOptions` interface.
|
27
|
+
- Added `inboxRetryPolicy` option to `CreateFederationOptions` interface.
|
28
|
+
[[#70]]
|
29
|
+
- Added `RetryPolicy` callback type.
|
30
|
+
- Added `RetryContext` interface.
|
31
|
+
- Added `createExponentialBackoffPolicy()` function.
|
32
|
+
- Added `CreateExponentialBackoffPolicyOptions` interface.
|
33
|
+
|
11
34
|
- Added `ChatMessage` class to Activity Vocabulary API. [[#85]]
|
12
35
|
|
36
|
+
- Improved multitenancy (virtual hosting) support. [[#66]]
|
37
|
+
|
38
|
+
- Added `Context.hostname` property.
|
39
|
+
- Added `Context.host` property.
|
40
|
+
- Added `Context.origin` property.
|
41
|
+
- The type of `ActorKeyPairsDispatcher<TContextData>`'s first parameter
|
42
|
+
became `Context` (was `TContextData`).
|
43
|
+
|
44
|
+
- Deprecated `Federation.sendActivity()` method.
|
45
|
+
|
46
|
+
- The last parameter of `Federation.sendActivity()` method is no longer
|
47
|
+
optional. Also, it now takes the required `contextData` option.
|
48
|
+
|
49
|
+
- Added more log messages using the [LogTape] library. Currently the below
|
50
|
+
logger categories are used:
|
51
|
+
|
52
|
+
- `["fedify", "federation", "queue"]`
|
53
|
+
|
54
|
+
[#66]: https://github.com/dahlia/fedify/issues/66
|
55
|
+
[#70]: https://github.com/dahlia/fedify/issues/70
|
13
56
|
[#85]: https://github.com/dahlia/fedify/issues/85
|
14
57
|
|
15
58
|
|
@@ -166,7 +166,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
166
166
|
}
|
167
167
|
return result;
|
168
168
|
}
|
169
|
-
export async function handleInbox(request, { handle, context, kv, kvPrefix, actorDispatcher,
|
169
|
+
export async function handleInbox(request, { handle, context, kv, kvPrefix, queue, actorDispatcher, inboxListenerDispatcher, inboxErrorHandler, onNotFound, signatureTimeWindow, }) {
|
170
170
|
const logger = getLogger(["fedify", "federation", "inbox"]);
|
171
171
|
if (actorDispatcher == null) {
|
172
172
|
logger.error("Actor dispatcher is not set.", { handle });
|
@@ -185,7 +185,12 @@ export async function handleInbox(request, { handle, context, kv, kvPrefix, acto
|
|
185
185
|
}
|
186
186
|
catch (error) {
|
187
187
|
logger.error("Failed to parse JSON:\n{error}", { handle, error });
|
188
|
-
|
188
|
+
try {
|
189
|
+
await inboxErrorHandler?.(context, error);
|
190
|
+
}
|
191
|
+
catch (error) {
|
192
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", { error, activity: json });
|
193
|
+
}
|
189
194
|
return new Response("Invalid JSON.", {
|
190
195
|
status: 400,
|
191
196
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
@@ -197,7 +202,12 @@ export async function handleInbox(request, { handle, context, kv, kvPrefix, acto
|
|
197
202
|
}
|
198
203
|
catch (error) {
|
199
204
|
logger.error("Failed to parse activity:\n{error}", { handle, json, error });
|
200
|
-
|
205
|
+
try {
|
206
|
+
await inboxErrorHandler?.(context, error);
|
207
|
+
}
|
208
|
+
catch (error) {
|
209
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", { error, activity: json });
|
210
|
+
}
|
201
211
|
return new Response("Invalid activity.", {
|
202
212
|
status: 400,
|
203
213
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
@@ -256,29 +266,39 @@ export async function handleInbox(request, { handle, context, kv, kvPrefix, acto
|
|
256
266
|
});
|
257
267
|
return response;
|
258
268
|
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
269
|
+
if (queue != null) {
|
270
|
+
await queue.enqueue({
|
271
|
+
type: "inbox",
|
272
|
+
baseUrl: request.url,
|
273
|
+
activity: json,
|
274
|
+
handle,
|
275
|
+
attempt: 0,
|
276
|
+
started: new Date().toISOString(),
|
277
|
+
});
|
278
|
+
return new Response("Activity is enqueued.", {
|
279
|
+
status: 202,
|
280
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
281
|
+
});
|
282
|
+
}
|
283
|
+
const listener = inboxListenerDispatcher(activity);
|
284
|
+
if (listener == null) {
|
285
|
+
logger.error("Unsupported activity type:\n{activity}", { activity: json });
|
286
|
+
return new Response("", {
|
287
|
+
status: 202,
|
288
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
289
|
+
});
|
274
290
|
}
|
275
|
-
const listener = inboxListeners.get(cls);
|
276
291
|
try {
|
277
292
|
await listener(context, activity);
|
278
293
|
}
|
279
294
|
catch (error) {
|
280
|
-
|
281
|
-
|
295
|
+
try {
|
296
|
+
await inboxErrorHandler?.(context, error);
|
297
|
+
}
|
298
|
+
catch (error) {
|
299
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", { error, activityId: activity.id?.href, activity: json });
|
300
|
+
}
|
301
|
+
logger.error("Failed to process the incoming activity {activityId}:\n{error}", { error, activityId: activity.id?.href, activity: json });
|
282
302
|
return new Response("Internal server error.", {
|
283
303
|
status: 500,
|
284
304
|
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
@@ -9,6 +9,7 @@ import { Activity, CryptographicKey, Multikey, } from "../vocab/vocab.js";
|
|
9
9
|
import { handleWebFinger } from "../webfinger/handler.js";
|
10
10
|
import { buildCollectionSynchronizationHeader } from "./collection.js";
|
11
11
|
import { handleActor, handleCollection, handleInbox, handleObject, } from "./handler.js";
|
12
|
+
import { createExponentialBackoffPolicy } from "./retry.js";
|
12
13
|
import { Router, RouterError } from "./router.js";
|
13
14
|
import { extractInboxes, sendActivity } from "./send.js";
|
14
15
|
const invokedByCreateFederation = Symbol("invokedByCreateFederation");
|
@@ -25,6 +26,7 @@ export function createFederation(options) {
|
|
25
26
|
[invokedByCreateFederation]: true,
|
26
27
|
});
|
27
28
|
}
|
29
|
+
const invokedByContext = Symbol("invokedByContext");
|
28
30
|
/**
|
29
31
|
* An object that registers federation-related business logic and dispatches
|
30
32
|
* requests to the appropriate handlers.
|
@@ -59,13 +61,15 @@ export class Federation {
|
|
59
61
|
#treatHttps;
|
60
62
|
#onOutboxError;
|
61
63
|
#signatureTimeWindow;
|
62
|
-
#
|
64
|
+
#outboxRetryPolicy;
|
65
|
+
#inboxRetryPolicy;
|
63
66
|
/**
|
64
67
|
* Create a new {@link Federation} instance.
|
65
68
|
* @param parameters Parameters for initializing the instance.
|
66
69
|
* @deprecated Use {@link createFederation} method instead.
|
67
70
|
*/
|
68
|
-
constructor(
|
71
|
+
constructor(parameters) {
|
72
|
+
const options = parameters;
|
69
73
|
const logger = getLogger(["fedify", "federation"]);
|
70
74
|
// @ts-ignore: This is a private symbol.
|
71
75
|
if (!options[invokedByCreateFederation]) {
|
@@ -97,37 +101,42 @@ export class Federation {
|
|
97
101
|
options.authenticatedDocumentLoaderFactory ??
|
98
102
|
getAuthenticatedDocumentLoader;
|
99
103
|
this.#onOutboxError = options.onOutboxError;
|
100
|
-
this.#treatHttps =
|
101
|
-
if (
|
104
|
+
this.#treatHttps = parameters.treatHttps ?? false;
|
105
|
+
if (parameters.treatHttps) {
|
102
106
|
logger.warn("The treatHttps option is deprecated and will be removed in " +
|
103
107
|
"a future release. Instead, use the x-forwarded-fetch library" +
|
104
108
|
" to recognize the X-Forwarded-Host and X-Forwarded-Proto " +
|
105
109
|
"headers. See also: <https://github.com/dahlia/x-forwarded-fetch>.");
|
106
110
|
}
|
107
111
|
this.#signatureTimeWindow = options.signatureTimeWindow ?? { minutes: 1 };
|
108
|
-
this.#
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
15 * 60000,
|
113
|
-
60 * 60000,
|
114
|
-
].map((ms) => dntShim.Temporal.Duration.from({ milliseconds: ms }));
|
112
|
+
this.#outboxRetryPolicy = options.outboxRetryPolicy ??
|
113
|
+
createExponentialBackoffPolicy();
|
114
|
+
this.#inboxRetryPolicy = options.inboxRetryPolicy ??
|
115
|
+
createExponentialBackoffPolicy();
|
115
116
|
}
|
116
|
-
#startQueue() {
|
117
|
+
#startQueue(ctxData) {
|
117
118
|
if (this.#queue != null && !this.#queueStarted) {
|
118
|
-
const logger = getLogger(["fedify", "federation", "
|
119
|
-
logger.debug("Starting
|
120
|
-
this.#queue?.listen(this.#listenQueue
|
119
|
+
const logger = getLogger(["fedify", "federation", "queue"]);
|
120
|
+
logger.debug("Starting a task queue.");
|
121
|
+
this.#queue?.listen((msg) => this.#listenQueue(ctxData, msg));
|
121
122
|
this.#queueStarted = true;
|
122
123
|
}
|
123
124
|
}
|
124
|
-
async #listenQueue(message) {
|
125
|
+
async #listenQueue(ctxData, message) {
|
126
|
+
if (message.type === "outbox") {
|
127
|
+
await this.#listenOutboxMessage(ctxData, message);
|
128
|
+
}
|
129
|
+
else if (message.type === "inbox") {
|
130
|
+
await this.#listenInboxMessage(ctxData, message);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
async #listenOutboxMessage(_, message) {
|
125
134
|
const logger = getLogger(["fedify", "federation", "outbox"]);
|
126
135
|
const logData = {
|
127
136
|
keyIds: message.keys.map((pair) => pair.keyId),
|
128
137
|
inbox: message.inbox,
|
129
138
|
activity: message.activity,
|
130
|
-
|
139
|
+
attempt: message.attempt,
|
131
140
|
headers: message.headers,
|
132
141
|
};
|
133
142
|
let activity = null;
|
@@ -167,22 +176,120 @@ export class Federation {
|
|
167
176
|
catch (error) {
|
168
177
|
logger.error("An unexpected error occurred in onError handler:\n{error}", { ...logData, error, activityId: activity?.id?.href });
|
169
178
|
}
|
170
|
-
|
171
|
-
|
172
|
-
|
179
|
+
const delay = this.#outboxRetryPolicy({
|
180
|
+
elapsedTime: dntShim.Temporal.Instant.from(message.started).until(dntShim.Temporal.Now.instant()),
|
181
|
+
attempts: message.attempt,
|
182
|
+
});
|
183
|
+
if (delay != null) {
|
184
|
+
logger.error("Failed to send activity {activityId} to {inbox} (attempt " +
|
185
|
+
"#{attempt}); retry...:\n{error}", { ...logData, error, activityId: activity?.id?.href });
|
173
186
|
this.#queue?.enqueue({
|
174
187
|
...message,
|
175
|
-
|
176
|
-
}, {
|
188
|
+
attempt: message.attempt + 1,
|
189
|
+
}, {
|
190
|
+
delay: dntShim.Temporal.Duration.compare(delay, { seconds: 0 }) < 0
|
191
|
+
? dntShim.Temporal.Duration.from({ seconds: 0 })
|
192
|
+
: delay,
|
193
|
+
});
|
177
194
|
}
|
178
195
|
else {
|
179
|
-
logger.error("Failed to send activity {activityId} to {inbox} after {
|
180
|
-
"
|
196
|
+
logger.error("Failed to send activity {activityId} to {inbox} after {attempt} " +
|
197
|
+
"attempts; giving up:\n{error}", { ...logData, error, activityId: activity?.id?.href });
|
181
198
|
}
|
182
199
|
return;
|
183
200
|
}
|
184
201
|
logger.info("Successfully sent activity {activityId} to {inbox}.", { ...logData, activityId: activity?.id?.href });
|
185
202
|
}
|
203
|
+
async #listenInboxMessage(ctxData, message) {
|
204
|
+
const logger = getLogger(["fedify", "federation", "inbox"]);
|
205
|
+
const baseUrl = new URL(message.baseUrl);
|
206
|
+
let context = this.#createContext(baseUrl, ctxData);
|
207
|
+
if (message.handle) {
|
208
|
+
context = this.#createContext(baseUrl, ctxData, {
|
209
|
+
documentLoader: await context.getDocumentLoader({
|
210
|
+
handle: message.handle,
|
211
|
+
}),
|
212
|
+
});
|
213
|
+
}
|
214
|
+
else if (this.#sharedInboxKeyDispatcher != null) {
|
215
|
+
const identity = await this.#sharedInboxKeyDispatcher(context);
|
216
|
+
if (identity != null) {
|
217
|
+
context = this.#createContext(baseUrl, ctxData, {
|
218
|
+
documentLoader: "handle" in identity
|
219
|
+
? await context.getDocumentLoader(identity)
|
220
|
+
: context.getDocumentLoader(identity),
|
221
|
+
});
|
222
|
+
}
|
223
|
+
}
|
224
|
+
const activity = await Activity.fromJsonLd(message.activity, context);
|
225
|
+
const cacheKey = activity.id == null ? null : [
|
226
|
+
...this.#kvPrefixes.activityIdempotence,
|
227
|
+
activity.id.href,
|
228
|
+
];
|
229
|
+
if (cacheKey != null) {
|
230
|
+
const cached = await this.#kv.get(cacheKey);
|
231
|
+
if (cached === true) {
|
232
|
+
logger.debug("Activity {activityId} has already been processed.", {
|
233
|
+
activityId: activity.id?.href,
|
234
|
+
activity: message.activity,
|
235
|
+
});
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
const listener = this.#dispatchInboxListener(activity);
|
240
|
+
if (listener == null) {
|
241
|
+
logger.error("Unsupported activity type:\n{activity}", { activity: message.activity, trial: message.attempt });
|
242
|
+
return;
|
243
|
+
}
|
244
|
+
try {
|
245
|
+
await listener(context, activity);
|
246
|
+
}
|
247
|
+
catch (error) {
|
248
|
+
try {
|
249
|
+
await this.#inboxErrorHandler?.(context, error);
|
250
|
+
}
|
251
|
+
catch (error) {
|
252
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
253
|
+
error,
|
254
|
+
trial: message.attempt,
|
255
|
+
activityId: activity.id?.href,
|
256
|
+
activity: message.activity,
|
257
|
+
});
|
258
|
+
}
|
259
|
+
const delay = this.#inboxRetryPolicy({
|
260
|
+
elapsedTime: dntShim.Temporal.Instant.from(message.started).until(dntShim.Temporal.Now.instant()),
|
261
|
+
attempts: message.attempt,
|
262
|
+
});
|
263
|
+
if (delay != null) {
|
264
|
+
logger.error("Failed to process the incoming activity {activityId} (attempt " +
|
265
|
+
"#{attempt}); retry...:\n{error}", {
|
266
|
+
error,
|
267
|
+
attempt: message.attempt,
|
268
|
+
activityId: activity.id?.href,
|
269
|
+
activity: message.activity,
|
270
|
+
});
|
271
|
+
this.#queue?.enqueue({
|
272
|
+
...message,
|
273
|
+
attempt: message.attempt + 1,
|
274
|
+
}, {
|
275
|
+
delay: dntShim.Temporal.Duration.compare(delay, { seconds: 0 }) < 0
|
276
|
+
? dntShim.Temporal.Duration.from({ seconds: 0 })
|
277
|
+
: delay,
|
278
|
+
});
|
279
|
+
}
|
280
|
+
else {
|
281
|
+
logger.error("Failed to process the incoming activity {activityId} after " +
|
282
|
+
"{trial} attempts; giving up:\n{error}", { error, activityId: activity.id?.href, activity: message.activity });
|
283
|
+
}
|
284
|
+
return;
|
285
|
+
}
|
286
|
+
if (cacheKey != null) {
|
287
|
+
await this.#kv.set(cacheKey, true, {
|
288
|
+
ttl: dntShim.Temporal.Duration.from({ days: 1 }),
|
289
|
+
});
|
290
|
+
}
|
291
|
+
logger.info("Activity {activityId} has been processed.", { activityId: activity.id?.href, activity: message.activity });
|
292
|
+
}
|
186
293
|
createContext(urlOrRequest, contextData) {
|
187
294
|
return urlOrRequest instanceof Request
|
188
295
|
? this.#createContext(urlOrRequest, contextData)
|
@@ -410,8 +517,8 @@ export class Federation {
|
|
410
517
|
getLogger(["fedify", "federation", "actor"]).warn("The ActorCallbackSetters.setKeyPairDispatcher() method is " +
|
411
518
|
"deprecated. Use the ActorCallbackSetters.setKeyPairsDispatcher() " +
|
412
519
|
"instead.");
|
413
|
-
callbacks.keyPairsDispatcher = async (
|
414
|
-
const key = await dispatcher(
|
520
|
+
callbacks.keyPairsDispatcher = async (ctx, handle) => {
|
521
|
+
const key = await dispatcher(ctx.data, handle);
|
415
522
|
if (key == null)
|
416
523
|
return [];
|
417
524
|
return [key];
|
@@ -849,6 +956,25 @@ export class Federation {
|
|
849
956
|
};
|
850
957
|
return setters;
|
851
958
|
}
|
959
|
+
#dispatchInboxListener(activity) {
|
960
|
+
// deno-lint-ignore no-explicit-any
|
961
|
+
let cls = activity
|
962
|
+
// deno-lint-ignore no-explicit-any
|
963
|
+
.constructor;
|
964
|
+
const inboxListeners = this.#inboxListeners;
|
965
|
+
if (inboxListeners == null) {
|
966
|
+
return null;
|
967
|
+
}
|
968
|
+
while (true) {
|
969
|
+
if (inboxListeners.has(cls))
|
970
|
+
break;
|
971
|
+
if (cls === Activity)
|
972
|
+
return null;
|
973
|
+
cls = globalThis.Object.getPrototypeOf(cls);
|
974
|
+
}
|
975
|
+
const listener = inboxListeners.get(cls);
|
976
|
+
return listener;
|
977
|
+
}
|
852
978
|
/**
|
853
979
|
* Sends an activity to recipients' inboxes. You would typically use
|
854
980
|
* {@link Context.sendActivity} instead of this method.
|
@@ -858,9 +984,15 @@ export class Federation {
|
|
858
984
|
* @param activity The activity to send.
|
859
985
|
* @param options Options for sending the activity.
|
860
986
|
* @throws {TypeError} If the activity to send does not have an actor.
|
987
|
+
* @deprecated Use {@link Context.sendActivity} instead.
|
861
988
|
*/
|
862
|
-
async sendActivity(keys, recipients, activity,
|
989
|
+
async sendActivity(keys, recipients, activity, options) {
|
863
990
|
const logger = getLogger(["fedify", "federation", "outbox"]);
|
991
|
+
if (!(invokedByContext in options) || !options[invokedByContext]) {
|
992
|
+
logger.warn("The Federation.sendActivity() method is deprecated. Use " +
|
993
|
+
"Context.sendActivity() instead.");
|
994
|
+
}
|
995
|
+
const { preferSharedInbox, immediate, excludeBaseUris, collectionSync, contextData, } = options;
|
864
996
|
if (keys.length < 1) {
|
865
997
|
throw new TypeError("The sender's keys must not be empty.");
|
866
998
|
}
|
@@ -871,7 +1003,7 @@ export class Federation {
|
|
871
1003
|
logger.error("Activity {activityId} to send does not have an actor.", { activity, activityId: activity?.id?.href });
|
872
1004
|
throw new TypeError("The activity to send must have at least one actor property.");
|
873
1005
|
}
|
874
|
-
this.#startQueue();
|
1006
|
+
this.#startQueue(contextData);
|
875
1007
|
if (activity.id == null) {
|
876
1008
|
activity = activity.clone({
|
877
1009
|
id: new URL(`urn:uuid:${dntShim.crypto.randomUUID()}`),
|
@@ -925,7 +1057,8 @@ export class Federation {
|
|
925
1057
|
keys: keyJwkPairs,
|
926
1058
|
activity: activityJson,
|
927
1059
|
inbox,
|
928
|
-
|
1060
|
+
started: new Date().toISOString(),
|
1061
|
+
attempt: 0,
|
929
1062
|
headers: collectionSync == null ? {} : {
|
930
1063
|
"Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox]),
|
931
1064
|
},
|
@@ -1067,7 +1200,7 @@ export class Federation {
|
|
1067
1200
|
kv: this.#kv,
|
1068
1201
|
kvPrefix: this.#kvPrefixes.activityIdempotence,
|
1069
1202
|
actorDispatcher: this.#actorCallbacks?.dispatcher,
|
1070
|
-
|
1203
|
+
inboxListenerDispatcher: this.#dispatchInboxListener.bind(this),
|
1071
1204
|
inboxErrorHandler: this.#inboxErrorHandler,
|
1072
1205
|
onNotFound,
|
1073
1206
|
signatureTimeWindow: this.#signatureTimeWindow,
|
@@ -1150,7 +1283,8 @@ class ContextImpl {
|
|
1150
1283
|
documentLoader;
|
1151
1284
|
contextLoader;
|
1152
1285
|
#authenticatedDocumentLoaderFactory;
|
1153
|
-
|
1286
|
+
#invokedFromActorKeyPairsDispatcher;
|
1287
|
+
constructor({ url, federation, router, objectTypeIds, objectCallbacks, actorCallbacks, data, documentLoader, contextLoader, authenticatedDocumentLoaderFactory, invokedFromActorKeyPairsDispatcher, }) {
|
1154
1288
|
this.#url = url;
|
1155
1289
|
this.#federation = federation;
|
1156
1290
|
this.#router = router;
|
@@ -1162,6 +1296,17 @@ class ContextImpl {
|
|
1162
1296
|
this.contextLoader = contextLoader;
|
1163
1297
|
this.#authenticatedDocumentLoaderFactory =
|
1164
1298
|
authenticatedDocumentLoaderFactory;
|
1299
|
+
this.#invokedFromActorKeyPairsDispatcher =
|
1300
|
+
invokedFromActorKeyPairsDispatcher;
|
1301
|
+
}
|
1302
|
+
get hostname() {
|
1303
|
+
return this.#url.hostname;
|
1304
|
+
}
|
1305
|
+
get host() {
|
1306
|
+
return this.#url.host;
|
1307
|
+
}
|
1308
|
+
get origin() {
|
1309
|
+
return this.#url.origin;
|
1165
1310
|
}
|
1166
1311
|
getNodeInfoUri() {
|
1167
1312
|
const path = this.#router.build("nodeInfo", {});
|
@@ -1304,13 +1449,21 @@ class ContextImpl {
|
|
1304
1449
|
return null;
|
1305
1450
|
}
|
1306
1451
|
async getActorKeyPairs(handle) {
|
1452
|
+
const logger = getLogger(["fedify", "federation", "actor"]);
|
1453
|
+
if (this.#invokedFromActorKeyPairsDispatcher != null) {
|
1454
|
+
logger.warn("Context.getActorKeyPairs({getActorKeyPairsHandle}) method is " +
|
1455
|
+
"invoked from the actor key pairs dispatcher " +
|
1456
|
+
"({actorKeyPairsDispatcherHandle}); this may cause an infinite loop.", {
|
1457
|
+
getActorKeyPairsHandle: handle,
|
1458
|
+
actorKeyPairsDispatcherHandle: this.#invokedFromActorKeyPairsDispatcher.handle,
|
1459
|
+
});
|
1460
|
+
}
|
1307
1461
|
let keyPairs;
|
1308
1462
|
try {
|
1309
|
-
keyPairs = await this.getKeyPairsFromHandle(
|
1463
|
+
keyPairs = await this.getKeyPairsFromHandle(handle);
|
1310
1464
|
}
|
1311
1465
|
catch (_) {
|
1312
|
-
|
1313
|
-
.warn("No actor key pairs dispatcher registered.");
|
1466
|
+
logger.warn("No actor key pairs dispatcher registered.");
|
1314
1467
|
return [];
|
1315
1468
|
}
|
1316
1469
|
const owner = this.getActorUri(handle);
|
@@ -1333,7 +1486,7 @@ class ContextImpl {
|
|
1333
1486
|
}
|
1334
1487
|
return result;
|
1335
1488
|
}
|
1336
|
-
async getKeyPairsFromHandle(
|
1489
|
+
async getKeyPairsFromHandle(handle) {
|
1337
1490
|
const logger = getLogger(["fedify", "federation", "actor"]);
|
1338
1491
|
if (this.actorCallbacks?.keyPairsDispatcher == null) {
|
1339
1492
|
throw new Error("No actor key pairs dispatcher registered.");
|
@@ -1343,8 +1496,20 @@ class ContextImpl {
|
|
1343
1496
|
logger.warn("No actor dispatcher registered.");
|
1344
1497
|
return [];
|
1345
1498
|
}
|
1346
|
-
const actorUri = new URL(path, url);
|
1347
|
-
const keyPairs = await this.actorCallbacks?.keyPairsDispatcher(
|
1499
|
+
const actorUri = new URL(path, this.#url);
|
1500
|
+
const keyPairs = await this.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
|
1501
|
+
url: this.#url,
|
1502
|
+
federation: this.#federation,
|
1503
|
+
router: this.#router,
|
1504
|
+
objectTypeIds: this.#objectTypeIds,
|
1505
|
+
objectCallbacks: this.objectCallbacks,
|
1506
|
+
actorCallbacks: this.actorCallbacks,
|
1507
|
+
data: this.data,
|
1508
|
+
documentLoader: this.documentLoader,
|
1509
|
+
contextLoader: this.contextLoader,
|
1510
|
+
authenticatedDocumentLoaderFactory: this.#authenticatedDocumentLoaderFactory,
|
1511
|
+
invokedFromActorKeyPairsDispatcher: { handle },
|
1512
|
+
}), handle);
|
1348
1513
|
if (keyPairs.length < 1) {
|
1349
1514
|
logger.warn("No key pairs found for actor {handle}.", { handle });
|
1350
1515
|
}
|
@@ -1380,7 +1545,7 @@ class ContextImpl {
|
|
1380
1545
|
});
|
1381
1546
|
}
|
1382
1547
|
async getRsaKeyPairFromHandle(handle) {
|
1383
|
-
const keyPairs = await this.getKeyPairsFromHandle(
|
1548
|
+
const keyPairs = await this.getKeyPairsFromHandle(handle);
|
1384
1549
|
for (const keyPair of keyPairs) {
|
1385
1550
|
const { privateKey } = keyPair;
|
1386
1551
|
if (privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" &&
|
@@ -1405,7 +1570,7 @@ class ContextImpl {
|
|
1405
1570
|
async sendActivity(sender, recipients, activity, options = {}) {
|
1406
1571
|
let keys;
|
1407
1572
|
if ("handle" in sender) {
|
1408
|
-
keys = await this.getKeyPairsFromHandle(
|
1573
|
+
keys = await this.getKeyPairsFromHandle(sender.handle);
|
1409
1574
|
if (keys.length < 1) {
|
1410
1575
|
throw new Error(`No key pair found for actor ${JSON.stringify(sender.handle)}.`);
|
1411
1576
|
}
|
@@ -1419,7 +1584,12 @@ class ContextImpl {
|
|
1419
1584
|
else {
|
1420
1585
|
keys = [sender];
|
1421
1586
|
}
|
1422
|
-
const opts = {
|
1587
|
+
const opts = {
|
1588
|
+
contextData: this.data,
|
1589
|
+
...options,
|
1590
|
+
// @ts-ignore: This is a private symbol
|
1591
|
+
[invokedByContext]: true,
|
1592
|
+
};
|
1423
1593
|
let expandedRecipients;
|
1424
1594
|
if (Array.isArray(recipients)) {
|
1425
1595
|
expandedRecipients = recipients;
|
@@ -1494,7 +1664,7 @@ class RequestContextImpl extends ContextImpl {
|
|
1494
1664
|
throw new Error("No actor dispatcher registered.");
|
1495
1665
|
}
|
1496
1666
|
if (this.#invokedFromActorDispatcher != null) {
|
1497
|
-
getLogger(["fedify", "federation"]).warn("RequestContext.getActor({getActorHandle}) is invoked from " +
|
1667
|
+
getLogger(["fedify", "federation", "actor"]).warn("RequestContext.getActor({getActorHandle}) is invoked from " +
|
1498
1668
|
"the actor dispatcher ({actorDispatcherHandle}); " +
|
1499
1669
|
"this may cause an infinite loop.", {
|
1500
1670
|
getActorHandle: handle,
|
package/esm/federation/mod.js
CHANGED
package/esm/federation/mq.js
CHANGED
@@ -13,7 +13,7 @@ export class InProcessMessageQueue {
|
|
13
13
|
enqueue(message, options) {
|
14
14
|
const delay = options?.delay == null
|
15
15
|
? 0
|
16
|
-
: options.delay.total("millisecond");
|
16
|
+
: Math.max(options.delay.total("millisecond"), 0);
|
17
17
|
setTimeout(() => {
|
18
18
|
for (const handler of this.#handlers)
|
19
19
|
handler(message);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* The context passed to a {@link RetryPolicy} callback.
|
3
|
+
* @since 0.12.0
|
4
|
+
*/
|
5
|
+
import * as dntShim from "../_dnt.shims.js";
|
6
|
+
/**
|
7
|
+
* Creates an exponential backoff retry policy. The delay between retries
|
8
|
+
* starts at the `initialDelay` and is multiplied by the `factor` for each
|
9
|
+
* subsequent retry, up to the `maxDelay`. The policy will give up after
|
10
|
+
* `maxAttempts` attempts. The actual delay is randomized to avoid
|
11
|
+
* synchronization (jitter).
|
12
|
+
* @param options The options for the policy.
|
13
|
+
* @returns The retry policy.
|
14
|
+
* @since 0.12.0
|
15
|
+
*/
|
16
|
+
export function createExponentialBackoffPolicy(options = {}) {
|
17
|
+
const initialDelay = dntShim.Temporal.Duration.from(options.initialDelay ?? { seconds: 1 });
|
18
|
+
const maxDelay = dntShim.Temporal.Duration.from(options.maxDelay ?? { hours: 12 });
|
19
|
+
const maxAttempts = options.maxAttempts ?? 10;
|
20
|
+
const factor = options.factor ?? 2;
|
21
|
+
const jitter = options.jitter ?? true;
|
22
|
+
return ({ attempts }) => {
|
23
|
+
if (attempts >= maxAttempts)
|
24
|
+
return null;
|
25
|
+
let milliseconds = initialDelay.total("millisecond");
|
26
|
+
milliseconds *= factor ** attempts;
|
27
|
+
if (jitter) {
|
28
|
+
milliseconds *= 1 + Math.random();
|
29
|
+
milliseconds = Math.round(milliseconds);
|
30
|
+
}
|
31
|
+
const delay = dntShim.Temporal.Duration.from({ milliseconds });
|
32
|
+
return dntShim.Temporal.Duration.compare(delay, maxDelay) > 0 ? maxDelay : delay;
|
33
|
+
};
|
34
|
+
}
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@ import type { Actor } from "../vocab/actor.js";
|
|
4
4
|
import type { Activity, CryptographicKey } from "../vocab/mod.js";
|
5
5
|
import type { Object } from "../vocab/vocab.js";
|
6
6
|
import type { PageItems } from "./collection.js";
|
7
|
-
import type { RequestContext } from "./context.js";
|
7
|
+
import type { Context, RequestContext } from "./context.js";
|
8
8
|
import type { SenderKeyPair } from "./send.js";
|
9
9
|
/**
|
10
10
|
* A callback that dispatches a {@link NodeInfo} object.
|
@@ -27,12 +27,12 @@ export type ActorDispatcher<TContextData> = (context: RequestContext<TContextDat
|
|
27
27
|
* A callback that dispatches key pairs for an actor.
|
28
28
|
*
|
29
29
|
* @typeParam TContextData The context data to pass to the {@link Context}.
|
30
|
-
* @param
|
30
|
+
* @param context The context.
|
31
31
|
* @param handle The actor's handle.
|
32
32
|
* @returns The key pairs.
|
33
33
|
* @since 0.10.0
|
34
34
|
*/
|
35
|
-
export type ActorKeyPairsDispatcher<TContextData> = (
|
35
|
+
export type ActorKeyPairsDispatcher<TContextData> = (context: Context<TContextData>, handle: string) => dntShim.CryptoKeyPair[] | Promise<dntShim.CryptoKeyPair[]>;
|
36
36
|
/**
|
37
37
|
* A callback that dispatches a key pair for an actor.
|
38
38
|
*
|
@@ -73,25 +73,25 @@ export type CollectionCursor<TContextData, TFilter> = (context: RequestContext<T
|
|
73
73
|
* @typeParam TContextData The context data to pass to the {@link Context}.
|
74
74
|
* @typeParam TActivity The type of activity to listen for.
|
75
75
|
*/
|
76
|
-
export type InboxListener<TContextData, TActivity extends Activity> = (context:
|
76
|
+
export type InboxListener<TContextData, TActivity extends Activity> = (context: Context<TContextData>, activity: TActivity) => void | Promise<void>;
|
77
77
|
/**
|
78
78
|
* A callback that handles errors in an inbox.
|
79
79
|
*
|
80
80
|
* @typeParam TContextData The context data to pass to the {@link Context}.
|
81
81
|
*/
|
82
|
-
export type InboxErrorHandler<TContextData> = (context:
|
82
|
+
export type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: Error) => void | Promise<void>;
|
83
83
|
/**
|
84
84
|
* A callback that dispatches the key pair for the authenticated document loader
|
85
85
|
* of the {@link Context} passed to the shared inbox listener.
|
86
86
|
*
|
87
87
|
* @typeParam TContextData The context data to pass to the {@link Context}.
|
88
|
-
* @param context The
|
88
|
+
* @param context The context.
|
89
89
|
* @returns The handle of the actor or the key pair for the authenticated
|
90
90
|
* document loader of the {@link Context} passed to the shared inbox
|
91
91
|
* listener. If `null` is returned, the request is not authorized.
|
92
92
|
* @since 0.11.0
|
93
93
|
*/
|
94
|
-
export type SharedInboxKeyDispatcher<TContextData> = (context:
|
94
|
+
export type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) => SenderKeyPair | {
|
95
95
|
handle: string;
|
96
96
|
} | null | Promise<SenderKeyPair | {
|
97
97
|
handle: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/federation/callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA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AAEhC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wBAAwB,CAAC,YAAY,EAAE,MAAM,SAAS,MAAM,IAAI,CAC1E,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,EACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,SAAS,EAAE,gBAAgB,GAAG,IAAI,EAClC,cAAc,EAAE,KAAK,GAAG,IAAI,KACzB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
@@ -9,6 +9,25 @@ import type { SenderKeyPair } from "./send.js";
|
|
9
9
|
* A context.
|
10
10
|
*/
|
11
11
|
export interface Context<TContextData> {
|
12
|
+
/**
|
13
|
+
* The origin of the federated server, including the scheme (`http://` or
|
14
|
+
* `https://`) and the host (e.g., `example.com:8080`).
|
15
|
+
* @since 0.12.0
|
16
|
+
*/
|
17
|
+
readonly origin: string;
|
18
|
+
/**
|
19
|
+
* The host of the federated server, including the hostname
|
20
|
+
* (e.g., `example.com`) and the port following a colon (e.g., `:8080`)
|
21
|
+
* if it is not the default port for the scheme.
|
22
|
+
* @since 0.12.0
|
23
|
+
*/
|
24
|
+
readonly host: string;
|
25
|
+
/**
|
26
|
+
* The hostname of the federated server (e.g., `example.com`). This is
|
27
|
+
* the same as the host without the port.
|
28
|
+
* @since 0.12.0
|
29
|
+
*/
|
30
|
+
readonly hostname: string;
|
12
31
|
/**
|
13
32
|
* The user-defined data associated with the context.
|
14
33
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/federation/context.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,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Q,OAAO,CAAC,aAAa;IACzD;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB"}
|
@@ -7,6 +7,7 @@ import { Activity, Link, Object } from "../vocab/vocab.js";
|
|
7
7
|
import type { ActorDispatcher, AuthorizePredicate, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener, ObjectAuthorizePredicate, ObjectDispatcher } from "./callback.js";
|
8
8
|
import type { RequestContext } from "./context.js";
|
9
9
|
import type { KvKey, KvStore } from "./kv.js";
|
10
|
+
import type { MessageQueue } from "./mq.js";
|
10
11
|
export declare function acceptsJsonLd(request: Request): boolean;
|
11
12
|
export interface ActorHandlerParameters<TContextData> {
|
12
13
|
handle: string;
|
@@ -70,13 +71,14 @@ export interface InboxHandlerParameters<TContextData> {
|
|
70
71
|
context: RequestContext<TContextData>;
|
71
72
|
kv: KvStore;
|
72
73
|
kvPrefix: KvKey;
|
74
|
+
queue?: MessageQueue;
|
73
75
|
actorDispatcher?: ActorDispatcher<TContextData>;
|
74
|
-
|
76
|
+
inboxListenerDispatcher: (activity: Activity) => InboxListener<TContextData, Activity> | null;
|
75
77
|
inboxErrorHandler?: InboxErrorHandler<TContextData>;
|
76
78
|
onNotFound(request: Request): Response | Promise<Response>;
|
77
79
|
signatureTimeWindow: dntShim.Temporal.DurationLike;
|
78
80
|
}
|
79
|
-
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefix, actorDispatcher,
|
81
|
+
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefix, queue, actorDispatcher, inboxListenerDispatcher, inboxErrorHandler, onNotFound, signatureTimeWindow, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
80
82
|
/**
|
81
83
|
* Options for the {@link respondWithObject} and
|
82
84
|
* {@link respondWithObjectIfAcceptable} functions.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,QAAQ,EAER,IAAI,EACJ,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,QAAQ,EAER,IAAI,EACJ,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EA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EAChB,EACE,MAAM,EACN,OAAO,EACP,EAAE,EACF,QAAQ,EACR,KAAK,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,mBAAmB,GACpB,EAAE,sBAAsB,CAAC,YAAY,CAAC,GACtC,OAAO,CAAC,QAAQ,CAAC,CAuKnB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,aAAa,EAAE,cAAc,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAK1B"}
|
@@ -8,6 +8,7 @@ import type { ActorDispatcher, ActorKeyPairDispatcher, ActorKeyPairsDispatcher,
|
|
8
8
|
import type { Context, RequestContext, SendActivityOptions } from "./context.js";
|
9
9
|
import type { KvKey, KvStore } from "./kv.js";
|
10
10
|
import type { MessageQueue } from "./mq.js";
|
11
|
+
import { type RetryPolicy } from "./retry.js";
|
11
12
|
import { type SenderKeyPair } from "./send.js";
|
12
13
|
/**
|
13
14
|
* Options for {@link createFederation} function.
|
@@ -60,12 +61,26 @@ export interface CreateFederationOptions {
|
|
60
61
|
* the window is a minute.
|
61
62
|
*/
|
62
63
|
signatureTimeWindow?: dntShim.Temporal.DurationLike;
|
64
|
+
/**
|
65
|
+
* The retry policy for sending activities to recipients' inboxes.
|
66
|
+
* By default, this uses an exponential backoff strategy with a maximum of
|
67
|
+
* 10 attempts and a maximum delay of 12 hours.
|
68
|
+
* @since 0.12.0
|
69
|
+
*/
|
70
|
+
outboxRetryPolicy?: RetryPolicy;
|
71
|
+
/**
|
72
|
+
* The retry policy for processing incoming activities. By default, this
|
73
|
+
* uses an exponential backoff strategy with a maximum of 10 attempts and a
|
74
|
+
* maximum delay of 12 hours.
|
75
|
+
* @since 0.12.0
|
76
|
+
*/
|
77
|
+
inboxRetryPolicy?: RetryPolicy;
|
63
78
|
}
|
64
79
|
/**
|
65
80
|
* Parameters for initializing a {@link Federation} instance.
|
66
81
|
* @deprecated
|
67
82
|
*/
|
68
|
-
export interface FederationParameters extends CreateFederationOptions {
|
83
|
+
export interface FederationParameters extends Omit<CreateFederationOptions, "outboxRetryPolicy" | "inboxRetryPolicy"> {
|
69
84
|
/**
|
70
85
|
* The message queue for sending activities to recipients' inboxes.
|
71
86
|
* If not provided, activities will not be queued and will be sent
|
@@ -118,7 +133,6 @@ export interface FederationParameters extends CreateFederationOptions {
|
|
118
133
|
* @deprecated
|
119
134
|
*/
|
120
135
|
treatHttps?: boolean;
|
121
|
-
backoffSchedule?: dntShim.Temporal.Duration[];
|
122
136
|
}
|
123
137
|
/**
|
124
138
|
* Prefixes for namespacing keys in the Deno KV store.
|
@@ -156,7 +170,7 @@ export declare class Federation<TContextData> {
|
|
156
170
|
* @param parameters Parameters for initializing the instance.
|
157
171
|
* @deprecated Use {@link createFederation} method instead.
|
158
172
|
*/
|
159
|
-
constructor(
|
173
|
+
constructor(parameters: FederationParameters);
|
160
174
|
/**
|
161
175
|
* Create a new context.
|
162
176
|
* @param baseUrl The base URL of the server. The `pathname` remains root,
|
@@ -451,8 +465,9 @@ export declare class Federation<TContextData> {
|
|
451
465
|
* @param activity The activity to send.
|
452
466
|
* @param options Options for sending the activity.
|
453
467
|
* @throws {TypeError} If the activity to send does not have an actor.
|
468
|
+
* @deprecated Use {@link Context.sendActivity} instead.
|
454
469
|
*/
|
455
|
-
sendActivity(keys: SenderKeyPair[], recipients: Recipient | Recipient[], activity: Activity,
|
470
|
+
sendActivity(keys: SenderKeyPair[], recipients: Recipient | Recipient[], activity: Activity, options: SendActivityInternalOptions<TContextData>): Promise<void>;
|
456
471
|
/**
|
457
472
|
* Handles a request related to federation. If a request is not related to
|
458
473
|
* federation, the `onNotFound` or `onNotAcceptable` callback is called.
|
@@ -528,7 +543,7 @@ export interface ActorCallbackSetters<TContextData> {
|
|
528
543
|
* Use {@link ActorCallbackSetters.setKeyPairsDispatcher} instead.
|
529
544
|
* @param dispatcher A callback that returns the key pair for an actor.
|
530
545
|
* @returns The setters object so that settings can be chained.
|
531
|
-
* @deprecated
|
546
|
+
* @deprecated Use {@link ActorCallbackSetters.setKeyPairsDispatcher} instead.
|
532
547
|
*/
|
533
548
|
setKeyPairDispatcher(dispatcher: ActorKeyPairDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
534
549
|
/**
|
@@ -615,8 +630,9 @@ export interface InboxListenerSetters<TContextData> {
|
|
615
630
|
*/
|
616
631
|
setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
|
617
632
|
}
|
618
|
-
interface SendActivityInternalOptions extends SendActivityOptions {
|
633
|
+
interface SendActivityInternalOptions<TContextData> extends SendActivityOptions {
|
619
634
|
collectionSync?: string;
|
635
|
+
contextData: TContextData;
|
620
636
|
}
|
621
637
|
export {};
|
622
638
|
//# sourceMappingURL=middleware.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,QAAQ,EAER,KAAK,OAAO,EACZ,KAAK,IAAI,EAET,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAEV,OAAO,EAEP,cAAc,EACd,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,QAAQ,EAER,KAAK,OAAO,EACZ,KAAK,IAAI,EAET,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAEV,OAAO,EAEP,cAAc,EACd,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO5C,OAAO,EAAkC,KAAK,WAAW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AS,CAAC,GAC/C,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEtC;;;;;;OAMG;IACH,OAAO,CACL,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,sBAAsB,CACpB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,GACjD,oBAAoB,CAAC,YAAY,CAAC,CAAC;CACvC;AAED,UAAU,2BAA2B,CAAC,YAAY,CAChD,SAAQ,mBAAmB;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,YAAY,CAAC;CAC3B"}
|
@@ -10,6 +10,7 @@ export { respondWithObject, respondWithObjectIfAcceptable, type RespondWithObjec
|
|
10
10
|
export * from "./kv.js";
|
11
11
|
export * from "./middleware.js";
|
12
12
|
export * from "./mq.js";
|
13
|
+
export * from "./retry.js";
|
13
14
|
export * from "./router.js";
|
14
15
|
export { type SenderKeyPair } from "./send.js";
|
15
16
|
//# sourceMappingURL=mod.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/federation/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/federation/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/types/federation/mq.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../src/federation/mq.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,0BAA0B;IACzC
|
1
|
+
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../src/federation/mq.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;CAC/D;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,YAAY;;IAGxD;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1E;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;CAG9D"}
|
@@ -3,12 +3,22 @@ export interface SenderKeyJwkPair {
|
|
3
3
|
keyId: string;
|
4
4
|
privateKey: dntShim.JsonWebKey;
|
5
5
|
}
|
6
|
+
export type Message = OutboxMessage | InboxMessage;
|
6
7
|
export interface OutboxMessage {
|
7
8
|
type: "outbox";
|
8
9
|
keys: SenderKeyJwkPair[];
|
9
10
|
activity: unknown;
|
10
11
|
inbox: string;
|
11
|
-
|
12
|
+
started: string;
|
13
|
+
attempt: number;
|
12
14
|
headers: Record<string, string>;
|
13
15
|
}
|
16
|
+
export interface InboxMessage {
|
17
|
+
type: "inbox";
|
18
|
+
baseUrl: string;
|
19
|
+
activity: unknown;
|
20
|
+
started: string;
|
21
|
+
attempt: number;
|
22
|
+
handle: string | null;
|
23
|
+
}
|
14
24
|
//# sourceMappingURL=queue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/federation/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/federation/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;CAChC;AAED,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,YAAY,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* The context passed to a {@link RetryPolicy} callback.
|
3
|
+
* @since 0.12.0
|
4
|
+
*/
|
5
|
+
import * as dntShim from "../_dnt.shims.js";
|
6
|
+
export interface RetryContext {
|
7
|
+
/**
|
8
|
+
* The elapsed time since the first attempt.
|
9
|
+
*/
|
10
|
+
readonly elapsedTime: dntShim.Temporal.Duration;
|
11
|
+
/**
|
12
|
+
* The number of attempts so far.
|
13
|
+
*/
|
14
|
+
readonly attempts: number;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* A policy that determines the delay before the next retry.
|
18
|
+
* @param context The retry context.
|
19
|
+
* @returns The delay before the next retry, or `null` to stop retrying.
|
20
|
+
* It must not negative.
|
21
|
+
* @since 0.12.0
|
22
|
+
*/
|
23
|
+
export type RetryPolicy = (context: RetryContext) => dntShim.Temporal.Duration | null;
|
24
|
+
/**
|
25
|
+
* Options for {@link createExponentialBackoffPolicy} function.
|
26
|
+
* @since 0.12.0
|
27
|
+
*/
|
28
|
+
export interface CreateExponentialBackoffPolicyOptions {
|
29
|
+
/**
|
30
|
+
* The initial delay before the first retry. Defaults to 1 second.
|
31
|
+
*/
|
32
|
+
readonly initialDelay?: dntShim.Temporal.DurationLike;
|
33
|
+
/**
|
34
|
+
* The maximum delay between retries. Defaults to 12 hours.
|
35
|
+
*/
|
36
|
+
readonly maxDelay?: dntShim.Temporal.DurationLike;
|
37
|
+
/**
|
38
|
+
* The maximum number of attempts before giving up.
|
39
|
+
* Defaults to 10.
|
40
|
+
*/
|
41
|
+
readonly maxAttempts?: number;
|
42
|
+
/**
|
43
|
+
* The factor to multiply the previous delay by for each retry.
|
44
|
+
* Defaults to 2.
|
45
|
+
*/
|
46
|
+
readonly factor?: number;
|
47
|
+
/**
|
48
|
+
* Whether to add jitter to the delay to avoid synchronization.
|
49
|
+
* Turned on by default.
|
50
|
+
*/
|
51
|
+
readonly jitter?: boolean;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Creates an exponential backoff retry policy. The delay between retries
|
55
|
+
* starts at the `initialDelay` and is multiplied by the `factor` for each
|
56
|
+
* subsequent retry, up to the `maxDelay`. The policy will give up after
|
57
|
+
* `maxAttempts` attempts. The actual delay is randomized to avoid
|
58
|
+
* synchronization (jitter).
|
59
|
+
* @param options The options for the policy.
|
60
|
+
* @returns The retry policy.
|
61
|
+
* @since 0.12.0
|
62
|
+
*/
|
63
|
+
export declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
|
64
|
+
//# sourceMappingURL=retry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/federation/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAElD;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,qCAA0C,GAClD,WAAW,CAmBb"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"retry.test.d.ts","sourceRoot":"","sources":["../../src/federation/retry.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAKxE,wBAAgB,aAAa,CAAC,YAAY,EACxC,EACE,IAAI,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAKxE,wBAAgB,aAAa,CAAC,YAAY,EACxC,EACE,GAAG,EACH,IAAI,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GACpE,OAAO,CAAC,YAAY,CAAC,CAgEvB;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAC/C,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;CACpB,GACA,cAAc,CAAC,YAAY,CAAC,CAa9B"}
|