Skip to content

Commit cb62414

Browse files
committed
Update handler documents
1 parent f917681 commit cb62414

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

packages/fedify/src/federation/handler.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ export interface CustomCollectionCallbacks<
910910
/**
911911
* Parameters for handling a custom collection.
912912
* @template TItem The type of items in the collection.
913-
* @template TParams The parameter names of the requested URL.
913+
* @template TParam The parameter names of the requested URL.
914914
* @template TContext The type of the context, extending {@link RequestContext}.
915915
* @template TContextData The context data to pass to the `TContext`.
916916
* @since 1.8.0
@@ -1001,7 +1001,7 @@ async function _handleCustomCollection<
10011001
/**
10021002
* Handles an ordered collection request.
10031003
* @template TItem The type of items in the collection.
1004-
* @template TParams The parameter names of the requested URL.
1004+
* @template TParam The parameter names of the requested URL.
10051005
* @template TContext The type of the context, extending {@link RequestContext}.
10061006
* @template TContextData The context data to pass to the `TContext`.
10071007
* @param request The HTTP request.
@@ -1067,7 +1067,7 @@ async function _handleOrderedCollection<
10671067
* The main flow is on `getCollection`, `dispatch`.
10681068
*
10691069
* @template TItem The type of items in the collection.
1070-
* @template TParams The parameter names of the requested URL.
1070+
* @template TParam The parameter names of the requested URL.
10711071
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
10721072
* @template TContextData The context data to pass to the `TContext`.
10731073
* @template TCollection The type of the collection, extending {@link Collection}.
@@ -1114,14 +1114,14 @@ class CustomCollectionHandler<
11141114

11151115
/**
11161116
* Creates a new CustomCollection instance.
1117-
* @param {string} name The name of the collection.
1118-
* @param {TParams} values The parameter values for the collection.
1119-
* @param {TContext} context The request context.
1120-
* @param {CustomCollectionCallbacks} callbacks The collection callbacks.
1121-
* @param {TracerProvider} tracerProvider The tracer provider for telemetry.
1122-
* @param {ConstructorWithTypeId<TCollection>} Collection The Collection constructor.
1123-
* @param {ConstructorWithTypeId<TCollectionPage>} CollectionPage The CollectionPage constructor.
1124-
* @param {(item: TItem) => boolean} filterPredicate Optional filter predicate for items.
1117+
* @param name The name of the collection.
1118+
* @param values The parameter values for the collection.
1119+
* @param context The request context.
1120+
* @param callbacks The collection callbacks.
1121+
* @param tracerProvider The tracer provider for telemetry.
1122+
* @param Collection The Collection constructor.
1123+
* @param CollectionPage The CollectionPage constructor.
1124+
* @param filterPredicate Optional filter predicate for items.
11251125
*/
11261126
constructor(
11271127
private readonly name: string,
@@ -1277,7 +1277,7 @@ class CustomCollectionHandler<
12771277
/**
12781278
* Creates a function to wrap the dispatcher so tracing can be applied.
12791279
* @param params Parameters including cursor and total items.
1280-
* @returns {(span: Span) => Promise<PageItems<TItem>>} A function that handles the span operation.
1280+
* @returns A function that handles the span operation.
12811281
*/
12821282
spanPages: (params: {
12831283
totalItems?: number | null;
@@ -1305,8 +1305,8 @@ class CustomCollectionHandler<
13051305

13061306
/**
13071307
* Dispatches the collection request to get items.
1308-
* @param {string | null} cursor The cursor for pagination, or null for the first page.
1309-
* @returns {Promise<PageItems<TItem>>} A promise that resolves to the page items.
1308+
* @param cursor The cursor for pagination, or null for the first page.
1309+
* @returns A promise that resolves to the page items.
13101310
*/
13111311
async dispatch(
13121312
cursor: string | null = null,
@@ -1320,16 +1320,16 @@ class CustomCollectionHandler<
13201320

13211321
/**
13221322
* Filters the items in the collection.
1323-
* @param {TItem[]} items The items to filter.
1324-
* @returns {(Object | Link | URL)[]} The filtered items.
1323+
* @param items The items to filter.
1324+
* @returns The filtered items.
13251325
*/
13261326
filterItems(items: TItem[]): (Object | Link | URL)[] {
13271327
return filterCollectionItems(items, this.name, this.filterPredicate);
13281328
}
13291329

13301330
/**
13311331
* Appends a cursor to the URL if it exists.
1332-
* @param {string | null | undefined} cursor The cursor to append, or null/undefined.
1332+
* @param cursor The cursor to append, or null/undefined.
13331333
* @returns The URL with cursor appended, or null if cursor is null/undefined.
13341334
*/
13351335
appendToUrl<Cursor extends string | null | undefined>(
@@ -1340,8 +1340,7 @@ class CustomCollectionHandler<
13401340

13411341
/**
13421342
* Gets the stored collection or collection page.
1343-
* @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to
1344-
the collection or collection page.
1343+
* @returns A promise that resolves to the collection or collection page.
13451344
*/
13461345
get collection(): Promise<TCollection | TCollectionPage> {
13471346
if (this.#collection === null) {
@@ -1352,8 +1351,8 @@ class CustomCollectionHandler<
13521351

13531352
/**
13541353
* Gets the total number of items in the collection.
1355-
* @returns {Promise<number | null>} A promise that
1356-
resolves to the total items count, or null if not available.
1354+
* @returns A promise that resolves to the total items count,
1355+
* or null if not available.
13571356
*/
13581357
get totalItems(): Promise<number | null> {
13591358
if (this.#totalItems === undefined) {
@@ -1376,8 +1375,8 @@ class CustomCollectionHandler<
13761375

13771376
/**
13781377
* Gets the first cursor for pagination.
1379-
* @returns {Promise<string | null>} A promise that resolves to the first cursor,
1380-
or null if not available.
1378+
* @returns A promise that resolves to the first cursor,
1379+
* or null if not available.
13811380
*/
13821381
get firstCursor(): Promise<string | null> {
13831382
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
@@ -1396,6 +1395,7 @@ class CustomCollectionHandler<
13961395
TYPE: "activitypub.collection.type",
13971396
} as const;
13981397
}
1398+
13991399
/** Type for `CustomCollection.TotalItems`.*/
14001400
type TotalItems = number | bigint | null | undefined;
14011401

0 commit comments

Comments
 (0)