Loading federation/context.ts +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ export interface Context<TContextData> { * Builds the URI of the NodeInfo document. * @returns The NodeInfo URI. * @throws {RouterError} If no NodeInfo dispatcher is available. * @since 0.2.0 */ getNodeInfoUri(): URL; Loading Loading @@ -93,6 +94,7 @@ export interface Context<TContextData> { * @returns The authenticated document loader. * @throws {Error} If the identity is not valid. * @throws {TypeError} If the key is invalid or unsupported. * @since 0.4.0 */ getDocumentLoader(identity: { handle: string }): Promise<DocumentLoader>; Loading @@ -104,6 +106,7 @@ export interface Context<TContextData> { * The actor's key pair. * @returns The authenticated document loader. * @throws {TypeError} If the key is invalid or unsupported. * @since 0.4.0 */ getDocumentLoader( identity: { keyId: URL; privateKey: CryptoKey }, Loading federation/handler.ts +3 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,7 @@ export async function handleInbox<TContextData>( /** * Options for the {@link respondWithObject} and * {@link respondWithObjectIfAcceptable} functions. * @since 0.3.0 */ export interface RespondWithObjectOptions { /** Loading @@ -358,6 +359,7 @@ export interface RespondWithObjectOptions { * * @param object The object to respond with. * @param options Options. * @since 0.3.0 */ export async function respondWithObject( object: Object, Loading @@ -378,6 +380,7 @@ export async function respondWithObject( * @param object The object to respond with. * @param request The request to check for JSON-LD acceptability. * @param options Options. * @since 0.3.0 */ export async function respondWithObjectIfAcceptable( object: Object, Loading federation/kv.ts +8 −0 Original line number Diff line number Diff line Loading @@ -2,11 +2,15 @@ import { Temporal } from "@js-temporal/polyfill"; /** * A key for a key-value store. An array of one or more strings. * * @since 0.5.0 */ export type KvKey = readonly [string] | readonly [string, ...string[]]; /** * Additional options for setting a value in a key-value store. * * @since 0.5.0 */ export interface KvStoreSetOptions { /** Loading @@ -17,6 +21,8 @@ export interface KvStoreSetOptions { /** * An abstract interface for a key-value store. * * @since 0.5.0 */ export interface KvStore { /** Loading Loading @@ -45,6 +51,8 @@ export interface KvStore { /** * A key-value store that stores values in memory. * Do not use this in production as it does not persist values. * * @since 0.5.0 */ export class MemoryKvStore implements KvStore { #values: Record<string, [unknown, null | Temporal.Instant]> = {}; Loading federation/middleware.ts +3 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ export interface FederationParameters { * A factory function that creates an authenticated document loader for a * given identity. This is used for fetching documents that require * authentication. * * @since 0.4.0 */ authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory; Loading Loading @@ -388,6 +390,7 @@ export class Federation<TContextData> { * must have no variables. * @param dispatcher A NodeInfo dispatcher callback to register. * @throws {RouterError} Thrown if the path pattern is invalid. * @since 0.2.0 */ setNodeInfoDispatcher( path: string, Loading federation/mq.ts +6 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ import type { Temporal } from "@js-temporal/polyfill"; /** * Additional options for enqueuing a message in a queue. * * @since 0.5.0 */ export interface MessageQueueEnqueueOptions { /** Loading @@ -13,6 +15,8 @@ export interface MessageQueueEnqueueOptions { /** * An abstract interface for a message queue. * * @since 0.5.0 */ export interface MessageQueue { /** Loading @@ -32,6 +36,8 @@ export interface MessageQueue { /** * A message queue that processes messages in the same process. * Do not use this in production as it does not persist messages. * * @since 0.5.0 */ export class InProcessMessageQueue implements MessageQueue { #handlers: ((message: any) => Promise<void> | void)[] = []; Loading Loading
federation/context.ts +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ export interface Context<TContextData> { * Builds the URI of the NodeInfo document. * @returns The NodeInfo URI. * @throws {RouterError} If no NodeInfo dispatcher is available. * @since 0.2.0 */ getNodeInfoUri(): URL; Loading Loading @@ -93,6 +94,7 @@ export interface Context<TContextData> { * @returns The authenticated document loader. * @throws {Error} If the identity is not valid. * @throws {TypeError} If the key is invalid or unsupported. * @since 0.4.0 */ getDocumentLoader(identity: { handle: string }): Promise<DocumentLoader>; Loading @@ -104,6 +106,7 @@ export interface Context<TContextData> { * The actor's key pair. * @returns The authenticated document loader. * @throws {TypeError} If the key is invalid or unsupported. * @since 0.4.0 */ getDocumentLoader( identity: { keyId: URL; privateKey: CryptoKey }, Loading
federation/handler.ts +3 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,7 @@ export async function handleInbox<TContextData>( /** * Options for the {@link respondWithObject} and * {@link respondWithObjectIfAcceptable} functions. * @since 0.3.0 */ export interface RespondWithObjectOptions { /** Loading @@ -358,6 +359,7 @@ export interface RespondWithObjectOptions { * * @param object The object to respond with. * @param options Options. * @since 0.3.0 */ export async function respondWithObject( object: Object, Loading @@ -378,6 +380,7 @@ export async function respondWithObject( * @param object The object to respond with. * @param request The request to check for JSON-LD acceptability. * @param options Options. * @since 0.3.0 */ export async function respondWithObjectIfAcceptable( object: Object, Loading
federation/kv.ts +8 −0 Original line number Diff line number Diff line Loading @@ -2,11 +2,15 @@ import { Temporal } from "@js-temporal/polyfill"; /** * A key for a key-value store. An array of one or more strings. * * @since 0.5.0 */ export type KvKey = readonly [string] | readonly [string, ...string[]]; /** * Additional options for setting a value in a key-value store. * * @since 0.5.0 */ export interface KvStoreSetOptions { /** Loading @@ -17,6 +21,8 @@ export interface KvStoreSetOptions { /** * An abstract interface for a key-value store. * * @since 0.5.0 */ export interface KvStore { /** Loading Loading @@ -45,6 +51,8 @@ export interface KvStore { /** * A key-value store that stores values in memory. * Do not use this in production as it does not persist values. * * @since 0.5.0 */ export class MemoryKvStore implements KvStore { #values: Record<string, [unknown, null | Temporal.Instant]> = {}; Loading
federation/middleware.ts +3 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ export interface FederationParameters { * A factory function that creates an authenticated document loader for a * given identity. This is used for fetching documents that require * authentication. * * @since 0.4.0 */ authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory; Loading Loading @@ -388,6 +390,7 @@ export class Federation<TContextData> { * must have no variables. * @param dispatcher A NodeInfo dispatcher callback to register. * @throws {RouterError} Thrown if the path pattern is invalid. * @since 0.2.0 */ setNodeInfoDispatcher( path: string, Loading
federation/mq.ts +6 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ import type { Temporal } from "@js-temporal/polyfill"; /** * Additional options for enqueuing a message in a queue. * * @since 0.5.0 */ export interface MessageQueueEnqueueOptions { /** Loading @@ -13,6 +15,8 @@ export interface MessageQueueEnqueueOptions { /** * An abstract interface for a message queue. * * @since 0.5.0 */ export interface MessageQueue { /** Loading @@ -32,6 +36,8 @@ export interface MessageQueue { /** * A message queue that processes messages in the same process. * Do not use this in production as it does not persist messages. * * @since 0.5.0 */ export class InProcessMessageQueue implements MessageQueue { #handlers: ((message: any) => Promise<void> | void)[] = []; Loading