UNPKG

@constl/bohr-db

Version:

Type-safe databases for orbit-db.

16 lines (15 loc) 532 B
import { type JSONSchemaType } from "ajv"; import { SetDatabaseType } from "@orbitdb/set-db"; import { DBElements } from "./types"; export type TypedSet<T extends DBElements> = Omit<SetDatabaseType, "add" | "del" | "all"> & { add: (value: T) => Promise<string>; del: (value: T) => Promise<string>; all: () => Promise<{ value: T; hash: string; }[]>; }; export declare const typedSet: <T extends DBElements>({ db, schema, }: { db: SetDatabaseType; schema: JSONSchemaType<T>; }) => TypedSet<T>;