@fedify/fedify 1.0.0-dev.396 → 1.0.0-dev.398
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +17 -0
- package/esm/federation/federation.js +1 -0
- package/esm/federation/handler.js +3 -3
- package/esm/federation/middleware.js +222 -42
- package/esm/federation/mod.js +2 -1
- package/esm/federation/send.js +9 -63
- package/esm/sig/ld.js +7 -1
- package/esm/sig/mod.js +1 -1
- package/esm/webfinger/handler.js +11 -0
- package/package.json +1 -1
- package/types/federation/callback.d.ts +5 -2
- package/types/federation/callback.d.ts.map +1 -1
- package/types/federation/context.d.ts +52 -2
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/federation.d.ts +462 -0
- package/types/federation/federation.d.ts.map +1 -0
- package/types/federation/handler.d.ts +3 -2
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +125 -426
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/federation/mod.d.ts +2 -1
- package/types/federation/mod.d.ts.map +1 -1
- package/types/federation/queue.d.ts +1 -0
- package/types/federation/queue.d.ts.map +1 -1
- package/types/federation/send.d.ts +7 -14
- package/types/federation/send.d.ts.map +1 -1
- package/types/sig/ld.d.ts +11 -0
- package/types/sig/ld.d.ts.map +1 -1
- package/types/sig/mod.d.ts +1 -1
- package/types/sig/mod.d.ts.map +1 -1
- package/types/webfinger/handler.d.ts.map +1 -1
- package/types/x/hono.d.ts +1 -1
@@ -289,6 +289,42 @@ export interface RequestContext<TContextData> extends Context<TContextData> {
|
|
289
289
|
*/
|
290
290
|
getSignedKeyOwner(): Promise<Actor | null>;
|
291
291
|
}
|
292
|
+
/**
|
293
|
+
* A context for inbox listeners.
|
294
|
+
* @since 1.0.0
|
295
|
+
*/
|
296
|
+
export interface InboxContext<TContextData> extends Context<TContextData> {
|
297
|
+
/**
|
298
|
+
* Forwards a received activity to the recipients' inboxes. The forwarded
|
299
|
+
* activity will be signed in HTTP Signatures by the forwarder, but its
|
300
|
+
* payload will not be modified, i.e., Linked Data Signatures and Object
|
301
|
+
* Integrity Proofs will not be added. Therefore, if the activity is not
|
302
|
+
* signed (i.e., it has neither Linked Data Signatures nor Object Integrity
|
303
|
+
* Proofs), the recipient probably will not trust the activity.
|
304
|
+
* @param forwarder The forwarder's handle or the forwarder's key pair(s).
|
305
|
+
* @param recipients The recipients of the activity.
|
306
|
+
* @param options Options for forwarding the activity.
|
307
|
+
* @since 1.0.0
|
308
|
+
*/
|
309
|
+
forwardActivity(forwarder: SenderKeyPair | SenderKeyPair[] | {
|
310
|
+
handle: string;
|
311
|
+
}, recipients: Recipient | Recipient[], options?: ForwardActivityOptions): Promise<void>;
|
312
|
+
/**
|
313
|
+
* Forwards a received activity to the recipients' inboxes. The forwarded
|
314
|
+
* activity will be signed in HTTP Signatures by the forwarder, but its
|
315
|
+
* payload will not be modified, i.e., Linked Data Signatures and Object
|
316
|
+
* Integrity Proofs will not be added. Therefore, if the activity is not
|
317
|
+
* signed (i.e., it has neither Linked Data Signatures nor Object Integrity
|
318
|
+
* Proofs), the recipient probably will not trust the activity.
|
319
|
+
* @param forwarder The forwarder's handle.
|
320
|
+
* @param recipients In this case, it must be `"followers"`.
|
321
|
+
* @param options Options for forwarding the activity.
|
322
|
+
* @since 1.0.0
|
323
|
+
*/
|
324
|
+
forwardActivity(forwarder: {
|
325
|
+
handle: string;
|
326
|
+
}, recipients: "followers", options?: ForwardActivityOptions): Promise<void>;
|
327
|
+
}
|
292
328
|
/**
|
293
329
|
* A result of parsing an URI.
|
294
330
|
*/
|
@@ -365,8 +401,7 @@ export type ParseUriResult =
|
|
365
401
|
handle: string;
|
366
402
|
};
|
367
403
|
/**
|
368
|
-
* Options for {@link Context.sendActivity} method
|
369
|
-
* {@link Federation.sendActivity} method.
|
404
|
+
* Options for {@link Context.sendActivity} method.
|
370
405
|
*/
|
371
406
|
export interface SendActivityOptions {
|
372
407
|
/**
|
@@ -391,6 +426,21 @@ export interface SendActivityOptions {
|
|
391
426
|
*/
|
392
427
|
excludeBaseUris?: URL[];
|
393
428
|
}
|
429
|
+
/**
|
430
|
+
* Options for {@link InboxContext.forwardActivity} method.
|
431
|
+
* @since 1.0.0
|
432
|
+
*/
|
433
|
+
export interface ForwardActivityOptions extends SendActivityOptions {
|
434
|
+
/**
|
435
|
+
* Whether to skip forwarding the activity if it is not signed, i.e., it has
|
436
|
+
* neither Linked Data Signatures nor Object Integrity Proofs.
|
437
|
+
*
|
438
|
+
* If the activity is not signed, the recipient probably will not trust the
|
439
|
+
* activity. Therefore, it is recommended to skip forwarding the activity
|
440
|
+
* if it is not signed.
|
441
|
+
*/
|
442
|
+
skipIfUnsigned: boolean;
|
443
|
+
}
|
394
444
|
/**
|
395
445
|
* A pair of a public key and a private key in various formats.
|
396
446
|
* @since 0.10.0
|
@@ -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,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,YAAY;IACnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B;;OAEG;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,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACvC;;GAEG;GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACvC;;;GAGG;GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACnC;;;GAGG;GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACtC;;;GAGG;GACD;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE;;;;;;;OAOG;IACH,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,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"}
|
@@ -0,0 +1,462 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import type { Actor, Recipient } from "../vocab/actor.js";
|
4
|
+
import type { Activity, Hashtag, Object } from "../vocab/vocab.js";
|
5
|
+
import type { ActorDispatcher, ActorHandleMapper, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectDispatcher, SharedInboxKeyDispatcher } from "./callback.js";
|
6
|
+
import type { Context, RequestContext } from "./context.js";
|
7
|
+
/**
|
8
|
+
* An object that registers federation-related business logic and dispatches
|
9
|
+
* requests to the appropriate handlers.
|
10
|
+
*
|
11
|
+
* It also provides a middleware interface for handling requests before your
|
12
|
+
* web framework's router; see {@link Federation.fetch}.
|
13
|
+
*
|
14
|
+
* @since 0.13.0
|
15
|
+
*/
|
16
|
+
export interface Federation<TContextData> {
|
17
|
+
/**
|
18
|
+
* Manually start the task queue.
|
19
|
+
*
|
20
|
+
* This method is useful when you set the `manuallyStartQueue` option to
|
21
|
+
* `true` in the {@link createFederation} function.
|
22
|
+
* @param contextData The context data to pass to the context.
|
23
|
+
*/
|
24
|
+
startQueue(contextData: TContextData): Promise<void>;
|
25
|
+
/**
|
26
|
+
* Create a new context.
|
27
|
+
* @param baseUrl The base URL of the server. The `pathname` remains root,
|
28
|
+
* and the `search` and `hash` are stripped.
|
29
|
+
* @param contextData The context data to pass to the context.
|
30
|
+
* @returns The new context.
|
31
|
+
*/
|
32
|
+
createContext(baseUrl: URL, contextData: TContextData): Context<TContextData>;
|
33
|
+
/**
|
34
|
+
* Create a new context for a request.
|
35
|
+
* @param request The request object.
|
36
|
+
* @param contextData The context data to pass to the context.
|
37
|
+
* @returns The new request context.
|
38
|
+
*/
|
39
|
+
createContext(request: Request, contextData: TContextData): RequestContext<TContextData>;
|
40
|
+
/**
|
41
|
+
* Registers a NodeInfo dispatcher.
|
42
|
+
* @param path The URI path pattern for the NodeInfo dispatcher. The syntax
|
43
|
+
* is based on URI Template
|
44
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
45
|
+
* must have no variables.
|
46
|
+
* @param dispatcher A NodeInfo dispatcher callback to register.
|
47
|
+
* @throws {RouterError} Thrown if the path pattern is invalid.
|
48
|
+
*/
|
49
|
+
setNodeInfoDispatcher(path: string, dispatcher: NodeInfoDispatcher<TContextData>): void;
|
50
|
+
/**
|
51
|
+
* Registers an actor dispatcher.
|
52
|
+
*
|
53
|
+
* @example
|
54
|
+
* ``` typescript
|
55
|
+
* federation.setActorDispatcher(
|
56
|
+
* "/users/{handle}",
|
57
|
+
* async (ctx, handle) => {
|
58
|
+
* return new Person({
|
59
|
+
* id: ctx.getActorUri(handle),
|
60
|
+
* preferredUsername: handle,
|
61
|
+
* // ...
|
62
|
+
* });
|
63
|
+
* }
|
64
|
+
* );
|
65
|
+
* ```
|
66
|
+
*
|
67
|
+
* @param path The URI path pattern for the actor dispatcher. The syntax is
|
68
|
+
* based on URI Template
|
69
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
70
|
+
* must have one variable: `{handle}`.
|
71
|
+
* @param dispatcher An actor dispatcher callback to register.
|
72
|
+
* @returns An object with methods to set other actor dispatcher callbacks.
|
73
|
+
* @throws {RouterError} Thrown if the path pattern is invalid.
|
74
|
+
*/
|
75
|
+
setActorDispatcher(path: `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
76
|
+
/**
|
77
|
+
* Registers an object dispatcher.
|
78
|
+
*
|
79
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
80
|
+
* @typeParam TObject The type of object to dispatch.
|
81
|
+
* @typeParam TParam The parameter names of the requested URL.
|
82
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
83
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
84
|
+
* based on URI Template
|
85
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
86
|
+
* must have one or more variables.
|
87
|
+
* @param dispatcher An object dispatcher callback to register.
|
88
|
+
*/
|
89
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
90
|
+
typeId: URL;
|
91
|
+
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
92
|
+
/**
|
93
|
+
* Registers an object dispatcher.
|
94
|
+
*
|
95
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
96
|
+
* @typeParam TObject The type of object to dispatch.
|
97
|
+
* @typeParam TParam The parameter names of the requested URL.
|
98
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
99
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
100
|
+
* based on URI Template
|
101
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
102
|
+
* must have one or more variables.
|
103
|
+
* @param dispatcher An object dispatcher callback to register.
|
104
|
+
*/
|
105
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
106
|
+
typeId: URL;
|
107
|
+
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
108
|
+
/**
|
109
|
+
* Registers an object dispatcher.
|
110
|
+
*
|
111
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
112
|
+
* @typeParam TObject The type of object to dispatch.
|
113
|
+
* @typeParam TParam The parameter names of the requested URL.
|
114
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
115
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
116
|
+
* based on URI Template
|
117
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
118
|
+
* must have one or more variables.
|
119
|
+
* @param dispatcher An object dispatcher callback to register.
|
120
|
+
*/
|
121
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
122
|
+
typeId: URL;
|
123
|
+
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
124
|
+
/**
|
125
|
+
* Registers an object dispatcher.
|
126
|
+
*
|
127
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
128
|
+
* @typeParam TObject The type of object to dispatch.
|
129
|
+
* @typeParam TParam The parameter names of the requested URL.
|
130
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
131
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
132
|
+
* based on URI Template
|
133
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
134
|
+
* must have one or more variables.
|
135
|
+
* @param dispatcher An object dispatcher callback to register.
|
136
|
+
*/
|
137
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
138
|
+
typeId: URL;
|
139
|
+
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
140
|
+
/**
|
141
|
+
* Registers an object dispatcher.
|
142
|
+
*
|
143
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
144
|
+
* @typeParam TObject The type of object to dispatch.
|
145
|
+
* @typeParam TParam The parameter names of the requested URL.
|
146
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
147
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
148
|
+
* based on URI Template
|
149
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
150
|
+
* must have one or more variables.
|
151
|
+
* @param dispatcher An object dispatcher callback to register.
|
152
|
+
*/
|
153
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
154
|
+
typeId: URL;
|
155
|
+
}, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
156
|
+
/**
|
157
|
+
* Registers an object dispatcher.
|
158
|
+
*
|
159
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
160
|
+
* @typeParam TObject The type of object to dispatch.
|
161
|
+
* @typeParam TParam The parameter names of the requested URL.
|
162
|
+
* @param cls The Activity Vocabulary class of the object to dispatch.
|
163
|
+
* @param path The URI path pattern for the object dispatcher. The syntax is
|
164
|
+
* based on URI Template
|
165
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
166
|
+
* must have one or more variables.
|
167
|
+
* @param dispatcher An object dispatcher callback to register.
|
168
|
+
*/
|
169
|
+
setObjectDispatcher<TObject extends Object, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
170
|
+
typeId: URL;
|
171
|
+
}, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
172
|
+
/**
|
173
|
+
* Registers an inbox dispatcher.
|
174
|
+
*
|
175
|
+
* @param path The URI path pattern for the outbox dispatcher. The syntax is
|
176
|
+
* based on URI Template
|
177
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
178
|
+
* must have one variable: `{handle}`, and must match the inbox
|
179
|
+
* listener path.
|
180
|
+
* @param dispatcher An inbox dispatcher callback to register.
|
181
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
182
|
+
*/
|
183
|
+
setInboxDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
184
|
+
/**
|
185
|
+
* Registers an outbox dispatcher.
|
186
|
+
*
|
187
|
+
* @example
|
188
|
+
* ``` typescript
|
189
|
+
* federation.setOutboxDispatcher(
|
190
|
+
* "/users/{handle}/outbox",
|
191
|
+
* async (ctx, handle, options) => {
|
192
|
+
* let items: Activity[];
|
193
|
+
* let nextCursor: string;
|
194
|
+
* // ...
|
195
|
+
* return { items, nextCursor };
|
196
|
+
* }
|
197
|
+
* );
|
198
|
+
* ```
|
199
|
+
*
|
200
|
+
* @param path The URI path pattern for the outbox dispatcher. The syntax is
|
201
|
+
* based on URI Template
|
202
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
203
|
+
* must have one variable: `{handle}`.
|
204
|
+
* @param dispatcher An outbox dispatcher callback to register.
|
205
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
206
|
+
*/
|
207
|
+
setOutboxDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
208
|
+
/**
|
209
|
+
* Registers a following collection dispatcher.
|
210
|
+
* @param path The URI path pattern for the following collection. The syntax
|
211
|
+
* is based on URI Template
|
212
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
213
|
+
* must have one variable: `{handle}`.
|
214
|
+
* @param dispatcher A following collection callback to register.
|
215
|
+
* @returns An object with methods to set other following collection
|
216
|
+
* callbacks.
|
217
|
+
* @throws {RouterError} Thrown if the path pattern is invalid.
|
218
|
+
*/
|
219
|
+
setFollowingDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
220
|
+
/**
|
221
|
+
* Registers a followers collection dispatcher.
|
222
|
+
* @param path The URI path pattern for the followers collection. The syntax
|
223
|
+
* is based on URI Template
|
224
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
225
|
+
* must have one variable: `{handle}`.
|
226
|
+
* @param dispatcher A followers collection callback to register.
|
227
|
+
* @returns An object with methods to set other followers collection
|
228
|
+
* callbacks.
|
229
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
230
|
+
*/
|
231
|
+
setFollowersDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
232
|
+
/**
|
233
|
+
* Registers a liked collection dispatcher.
|
234
|
+
* @param path The URI path pattern for the liked collection. The syntax
|
235
|
+
* is based on URI Template
|
236
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
237
|
+
* must have one variable: `{handle}`.
|
238
|
+
* @param dispatcher A liked collection callback to register.
|
239
|
+
* @returns An object with methods to set other liked collection
|
240
|
+
* callbacks.
|
241
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
242
|
+
*/
|
243
|
+
setLikedDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
244
|
+
/**
|
245
|
+
* Registers a featured collection dispatcher.
|
246
|
+
* @param path The URI path pattern for the featured collection. The syntax
|
247
|
+
* is based on URI Template
|
248
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
249
|
+
* must have one variable: `{handle}`.
|
250
|
+
* @param dispatcher A featured collection callback to register.
|
251
|
+
* @returns An object with methods to set other featured collection
|
252
|
+
* callbacks.
|
253
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
254
|
+
*/
|
255
|
+
setFeaturedDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
256
|
+
/**
|
257
|
+
* Registers a featured tags collection dispatcher.
|
258
|
+
* @param path The URI path pattern for the featured tags collection.
|
259
|
+
* The syntax is based on URI Template
|
260
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
|
261
|
+
* must have one variable: `{handle}`.
|
262
|
+
* @param dispatcher A featured tags collection callback to register.
|
263
|
+
* @returns An object with methods to set other featured tags collection
|
264
|
+
* callbacks.
|
265
|
+
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
266
|
+
*/
|
267
|
+
setFeaturedTagsDispatcher(path: `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
268
|
+
/**
|
269
|
+
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
270
|
+
*
|
271
|
+
* @example
|
272
|
+
* ``` typescript
|
273
|
+
* federation
|
274
|
+
* .setInboxListeners("/users/{handle/inbox", "/inbox")
|
275
|
+
* .on(Follow, async (ctx, follow) => {
|
276
|
+
* const from = await follow.getActor(ctx);
|
277
|
+
* if (!isActor(from)) return;
|
278
|
+
* // ...
|
279
|
+
* await ctx.sendActivity({ })
|
280
|
+
* })
|
281
|
+
* .on(Undo, async (ctx, undo) => {
|
282
|
+
* // ...
|
283
|
+
* });
|
284
|
+
* ```
|
285
|
+
*
|
286
|
+
* @param inboxPath The URI path pattern for the inbox. The syntax is based
|
287
|
+
* on URI Template
|
288
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
289
|
+
* The path must have one variable: `{handle}`, and must
|
290
|
+
* match the inbox dispatcher path.
|
291
|
+
* @param sharedInboxPath An optional URI path pattern for the shared inbox.
|
292
|
+
* The syntax is based on URI Template
|
293
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
294
|
+
* The path must have no variables.
|
295
|
+
* @returns An object to register inbox listeners.
|
296
|
+
* @throws {RouteError} Thrown if the path pattern is invalid.
|
297
|
+
*/
|
298
|
+
setInboxListeners(inboxPath: `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
299
|
+
/**
|
300
|
+
* Handles a request related to federation. If a request is not related to
|
301
|
+
* federation, the `onNotFound` or `onNotAcceptable` callback is called.
|
302
|
+
*
|
303
|
+
* Usually, this method is called from a server's request handler or
|
304
|
+
* a web framework's middleware.
|
305
|
+
*
|
306
|
+
* @param request The request object.
|
307
|
+
* @param parameters The parameters for handling the request.
|
308
|
+
* @returns The response to the request.
|
309
|
+
*/
|
310
|
+
fetch(request: Request, options: FederationFetchOptions<TContextData>): Promise<Response>;
|
311
|
+
}
|
312
|
+
/**
|
313
|
+
* Additional settings for the actor dispatcher.
|
314
|
+
*
|
315
|
+
* ``` typescript
|
316
|
+
* const federation = createFederation<void>({ ... });
|
317
|
+
* federation.setActorDispatcher("/users/{handle}", async (ctx, handle, key) => {
|
318
|
+
* ...
|
319
|
+
* })
|
320
|
+
* .setKeyPairsDispatcher(async (ctxData, handle) => {
|
321
|
+
* ...
|
322
|
+
* });
|
323
|
+
* ```
|
324
|
+
*/
|
325
|
+
export interface ActorCallbackSetters<TContextData> {
|
326
|
+
/**
|
327
|
+
* Sets the key pairs dispatcher for actors.
|
328
|
+
* @param dispatcher A callback that returns the key pairs for an actor.
|
329
|
+
* @returns The setters object so that settings can be chained.
|
330
|
+
* @since 0.10.0
|
331
|
+
*/
|
332
|
+
setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
333
|
+
/**
|
334
|
+
* Sets the callback function that maps a WebFinger username to
|
335
|
+
* the corresponding actor's internal handle. If it's omitted, the handle
|
336
|
+
* is assumed to be the same as the WebFinger username, which makes your
|
337
|
+
* actors have the immutable handles. If you want to let your actors change
|
338
|
+
* their fediverse handles, you should set this dispatcher.
|
339
|
+
* @since 0.15.0
|
340
|
+
*/
|
341
|
+
mapHandle(mapper: ActorHandleMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
342
|
+
/**
|
343
|
+
* Specifies the conditions under which requests are authorized.
|
344
|
+
* @param predicate A callback that returns whether a request is authorized.
|
345
|
+
* @returns The setters object so that settings can be chained.
|
346
|
+
* @since 0.7.0
|
347
|
+
*/
|
348
|
+
authorize(predicate: AuthorizePredicate<TContextData>): ActorCallbackSetters<TContextData>;
|
349
|
+
}
|
350
|
+
/**
|
351
|
+
* Additional settings for an object dispatcher.
|
352
|
+
*/
|
353
|
+
export interface ObjectCallbackSetters<TContextData, TObject extends Object, TParam extends string> {
|
354
|
+
/**
|
355
|
+
* Specifies the conditions under which requests are authorized.
|
356
|
+
* @param predicate A callback that returns whether a request is authorized.
|
357
|
+
* @returns The setters object so that settings can be chained.
|
358
|
+
* @since 0.7.0
|
359
|
+
*/
|
360
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
361
|
+
}
|
362
|
+
/**
|
363
|
+
* Additional settings for a collection dispatcher.
|
364
|
+
*
|
365
|
+
* @typeParam TContext The type of the context. {@link Context} or
|
366
|
+
* {@link RequestContext}.
|
367
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
368
|
+
* @typeParam TFilter The type of filter for the collection.
|
369
|
+
*/
|
370
|
+
export interface CollectionCallbackSetters<TContext extends Context<TContextData>, TContextData, TFilter> {
|
371
|
+
/**
|
372
|
+
* Sets the counter for the collection.
|
373
|
+
* @param counter A callback that returns the number of items in the collection.
|
374
|
+
* @returns The setters object so that settings can be chained.
|
375
|
+
*/
|
376
|
+
setCounter(counter: CollectionCounter<TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
377
|
+
/**
|
378
|
+
* Sets the first cursor for the collection.
|
379
|
+
* @param cursor The cursor for the first item in the collection.
|
380
|
+
* @returns The setters object so that settings can be chained.
|
381
|
+
*/
|
382
|
+
setFirstCursor(cursor: CollectionCursor<TContext, TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
383
|
+
/**
|
384
|
+
* Sets the last cursor for the collection.
|
385
|
+
* @param cursor The cursor for the last item in the collection.
|
386
|
+
* @returns The setters object so that settings can be chained.
|
387
|
+
*/
|
388
|
+
setLastCursor(cursor: CollectionCursor<TContext, TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
389
|
+
/**
|
390
|
+
* Specifies the conditions under which requests are authorized.
|
391
|
+
* @param predicate A callback that returns whether a request is authorized.
|
392
|
+
* @returns The setters object so that settings can be chained.
|
393
|
+
* @since 0.7.0
|
394
|
+
*/
|
395
|
+
authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
396
|
+
}
|
397
|
+
/**
|
398
|
+
* Registry for inbox listeners for different activity types.
|
399
|
+
*/
|
400
|
+
export interface InboxListenerSetters<TContextData> {
|
401
|
+
/**
|
402
|
+
* Registers a listener for a specific incoming activity type.
|
403
|
+
*
|
404
|
+
* @param type A subclass of {@link Activity} to listen to.
|
405
|
+
* @param listener A callback to handle an incoming activity.
|
406
|
+
* @returns The setters object so that settings can be chained.
|
407
|
+
*/
|
408
|
+
on<TActivity extends Activity>(type: new (...args: any[]) => TActivity, listener: InboxListener<TContextData, TActivity>): InboxListenerSetters<TContextData>;
|
409
|
+
/**
|
410
|
+
* Registers an error handler for inbox listeners. Any exceptions thrown
|
411
|
+
* from the listeners are caught and passed to this handler.
|
412
|
+
*
|
413
|
+
* @param handler A callback to handle an error.
|
414
|
+
* @returns The setters object so that settings can be chained.
|
415
|
+
*/
|
416
|
+
onError(handler: InboxErrorHandler<TContextData>): InboxListenerSetters<TContextData>;
|
417
|
+
/**
|
418
|
+
* Configures a callback to dispatch the key pair for the authenticated
|
419
|
+
* document loader of the {@link Context} passed to the shared inbox listener.
|
420
|
+
*
|
421
|
+
* @param dispatcher A callback to dispatch the key pair for the authenticated
|
422
|
+
* document loader.
|
423
|
+
* @returns The setters object so that settings can be chained.
|
424
|
+
* @since 0.11.0
|
425
|
+
*/
|
426
|
+
setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
|
427
|
+
}
|
428
|
+
/**
|
429
|
+
* Parameters of {@link Federation.fetch} method.
|
430
|
+
*
|
431
|
+
* @typeParam TContextData The context data to pass to the {@link Context}.
|
432
|
+
* @since 0.6.0
|
433
|
+
*/
|
434
|
+
export interface FederationFetchOptions<TContextData> {
|
435
|
+
/**
|
436
|
+
* The context data to pass to the {@link Context}.
|
437
|
+
*/
|
438
|
+
contextData: TContextData;
|
439
|
+
/**
|
440
|
+
* A callback to handle a request when the route is not found.
|
441
|
+
* If not provided, a 404 response is returned.
|
442
|
+
* @param request The request object.
|
443
|
+
* @returns The response to the request.
|
444
|
+
*/
|
445
|
+
onNotFound?: (request: Request) => Response | Promise<Response>;
|
446
|
+
/**
|
447
|
+
* A callback to handle a request when the request's `Accept` header is not
|
448
|
+
* acceptable. If not provided, a 406 response is returned.
|
449
|
+
* @param request The request object.
|
450
|
+
* @returns The response to the request.
|
451
|
+
*/
|
452
|
+
onNotAcceptable?: (request: Request) => Response | Promise<Response>;
|
453
|
+
/**
|
454
|
+
* A callback to handle a request when the request is unauthorized.
|
455
|
+
* If not provided, a 401 response is returned.
|
456
|
+
* @param request The request object.
|
457
|
+
* @returns The response to the request.
|
458
|
+
* @since 0.7.0
|
459
|
+
*/
|
460
|
+
onUnauthorized?: (request: Request) => Response | Promise<Response>;
|
461
|
+
}
|
462
|
+
//# sourceMappingURL=federation.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"federation.d.ts","sourceRoot":"","sources":["../../src/federation/federation.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D;;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;IAEtC;;;;;;;;OAQG;IACH,sBAAsB,CACpB,UAAU,EAAE,wBAAwB,CAAC,YAAY,CAAC,GACjD,oBAAoB,CAAC,YAAY,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB,CAAC,YAAY;IAClD;;OAEG;IACH,WAAW,EAAE,YAAY,CAAC;IAE1B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAErE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACrE"}
|
@@ -5,7 +5,7 @@ import type { DocumentLoader } from "../runtime/docloader.js";
|
|
5
5
|
import type { Recipient } from "../vocab/actor.js";
|
6
6
|
import { Link, Object } from "../vocab/vocab.js";
|
7
7
|
import type { ActorDispatcher, AuthorizePredicate, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, ObjectAuthorizePredicate, ObjectDispatcher } from "./callback.js";
|
8
|
-
import type { Context, RequestContext } from "./context.js";
|
8
|
+
import type { Context, InboxContext, RequestContext } from "./context.js";
|
9
9
|
import type { InboxListenerSet } from "./inbox.js";
|
10
10
|
import type { KvKey, KvStore } from "./kv.js";
|
11
11
|
import type { MessageQueue } from "./mq.js";
|
@@ -71,6 +71,7 @@ export declare function handleCollection<TItem extends URL | Object | Link | Rec
|
|
71
71
|
export interface InboxHandlerParameters<TContextData> {
|
72
72
|
handle: string | null;
|
73
73
|
context: RequestContext<TContextData>;
|
74
|
+
inboxContextFactory(activity: unknown): InboxContext<TContextData>;
|
74
75
|
kv: KvStore;
|
75
76
|
kvPrefixes: {
|
76
77
|
activityIdempotence: KvKey;
|
@@ -84,7 +85,7 @@ export interface InboxHandlerParameters<TContextData> {
|
|
84
85
|
signatureTimeWindow: dntShim.Temporal.DurationLike | false;
|
85
86
|
skipSignatureVerification: boolean;
|
86
87
|
}
|
87
|
-
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
88
|
+
export declare function handleInbox<TContextData>(request: Request, { handle, context, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
88
89
|
/**
|
89
90
|
* Options for the {@link respondWithObject} and
|
90
91
|
* {@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;AAM9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAGL,IAAI,EAEJ,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,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,K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