UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

21 lines (20 loc) 1.07 kB
import { FetchStore } from "../../store/FetchStore.js"; import type { Data } from "../../util/data.js"; import type { Identifier, Item, OptionalItem } from "../../util/item.js"; import type { Collection } from "../collection/Collection.js"; import type { DBProvider } from "../provider/DBProvider.js"; import type { MemoryDBProvider } from "../provider/MemoryDBProvider.js"; /** Store that stores a single item in a collection from a database provider. */ export declare class ItemStore<I extends Identifier, T extends Data> extends FetchStore<OptionalItem<I, T>> { readonly provider: DBProvider<I>; readonly collection: Collection<string, I, T>; readonly id: I; /** * The required item data of this store. * @throws {RequiredError} if item doesn't exist (i.e. if `this.value` is `undefined` */ get item(): Item<I, T>; set item(data: T | Item<I, T>); constructor(collection: Collection<string, I, T>, id: I, provider: DBProvider<I>, memory?: MemoryDBProvider<I>); _fetch(_signal: AbortSignal): Promise<OptionalItem<I, T>>; }