An object that registers federation-related business logic and dispatches requests to the appropriate handlers.
It also provides a middleware interface for handling requests before your web framework's router; see Federation.fetch.
startQueue(contextData: TContextData): Promise<void>
Manually start the task queue.
This method is useful when you set the manuallyStartQueue
option to
true
in the createFederation function.
createContext(baseUrl: URL,contextData: TContextData,): Context<TContextData>
Create a new context.
createContext(request: Request,contextData: TContextData,): RequestContext<TContextData>
Create a new context for a request.
setNodeInfoDispatcher(path: string,dispatcher: NodeInfoDispatcher<TContextData>,): void
Registers a NodeInfo dispatcher.
setActorDispatcher(dispatcher: ActorDispatcher<TContextData>,): ActorCallbackSetters<TContextData>
Registers an actor dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`,dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`,dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setObjectDispatcher<>(cls: (new (...args: any[]) => TObject) & { typeId: URL; },dispatcher: ObjectDispatcher<TContextData, TObject, TParam>,): ObjectCallbackSetters<TContextData, TObject, TParam>
Registers an object dispatcher.
setInboxDispatcher(dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers an inbox dispatcher.
setOutboxDispatcher(dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers an outbox dispatcher.
setFollowingDispatcher(dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers a following collection dispatcher.
setFollowersDispatcher(dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>,): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>
Registers a followers collection dispatcher.
setLikedDispatcher(dispatcher: CollectionDispatcher<Object | URL, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers a liked collection dispatcher.
setFeaturedDispatcher(dispatcher: CollectionDispatcher<Object, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers a featured collection dispatcher.
setFeaturedTagsDispatcher(dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>,): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>
Registers a featured tags collection dispatcher.
Assigns the URL path for the inbox and starts setting inbox listeners.
fetch(request: Request,options: FederationFetchOptions<TContextData>,): Promise<Response>
Handles a request related to federation. If a request is not related to
federation, the onNotFound
or onNotAcceptable
callback is called.
Usually, this method is called from a server's request handler or a web framework's middleware.