Skip to content

Search the guides, deployment pages, and API reference.

Collection

import type { Collection } from "@pitlane/content";

The query surface of one collection.

Type Parameters

Name

Name extends string

Data

Data

Methods

getCollection()

getCollection(filter?): Promise<Entry<Data>[]>;

Every entry, sorted by id, keeping only those filter returns truthy for when one is given.

Parameters

filter?

(entry: Entry<Data>) => unknown

Returns

Promise<Entry<Data>[]>


getEntry()

getEntry(id): Promise<Entry<Data> | undefined>;

The entry with this id, or the one a Reference into this collection points at. Resolves to undefined when there is none.

Parameters

id

string | Reference<Name>

Returns

Promise<Entry<Data> | undefined>