@constl/bohr-db
Version:
Type-safe databases for orbit-db.
15 lines (14 loc) • 501 B
TypeScript
import type { JSONSchemaType } from "ajv";
import type { FeedDatabaseType } from "@orbitdb/feed-db";
import type { DBElements } from "./types";
export type TypedFeed<T extends DBElements> = Omit<FeedDatabaseType, "add" | "all"> & {
add: (value: T) => Promise<string>;
all: () => Promise<{
value: T;
hash: string;
}[]>;
};
export declare const typedFeed: <T extends DBElements>({ db, schema, }: {
db: FeedDatabaseType;
schema: JSONSchemaType<T>;
}) => TypedFeed<T>;