UNPKG

@orbitdb/set-db

Version:

Set database type for orbit-db.

64 lines (63 loc) 2.31 kB
import type { Identity, Storage, AccessController, MetaData, DagCborEncodable, Log, LogEntry, InternalDatabase } from "@orbitdb/core"; import type { Libp2p } from "libp2p"; import type { HeliaLibp2p } from "helia"; import type { ServiceMap } from "@libp2p/interface"; export type SetDatabaseType = Awaited<ReturnType<ReturnType<typeof SetDb>>>; declare const SetDb: { (): <T extends ServiceMap = ServiceMap>({ ipfs, identity, address, name, access, directory, meta, headsStorage, entryStorage, indexStorage, referencesCount, syncAutomatically, onUpdate, }: { ipfs: HeliaLibp2p<Libp2p<T>>; identity?: Identity; address: string; name?: string; access?: AccessController; directory?: string; meta?: MetaData; headsStorage?: Storage; entryStorage?: Storage; indexStorage?: Storage; referencesCount?: number; syncAutomatically?: boolean; onUpdate?: (log: Log, entry: LogEntry) => void; }) => Promise<{ type: "set"; add: (value: DagCborEncodable) => Promise<string>; del: (value: DagCborEncodable) => Promise<string>; iterator: ({ amount, }?: { amount?: number; }) => AsyncGenerator<{ value: unknown; hash: string; }, void, unknown>; all: () => Promise<Set<unknown>>; address: string; name: string; identity: Identity; meta: MetaData; close: () => Promise<void>; drop: () => Promise<void>; addOperation: (op: DagCborEncodable) => Promise<string>; log: Log; sync: import("@orbitdb/core").Sync; peers: Set<string>; events: TypedEmitter<import("@orbitdb/core").DatabaseEvents>; access: AccessController; }>; type: "set"; }; export declare const SetApi: { ({ database }: { database: InternalDatabase; }): { add: (value: DagCborEncodable) => Promise<string>; del: (value: DagCborEncodable) => Promise<string>; iterator: ({ amount, }?: { amount?: number; }) => AsyncGenerator<{ value: unknown; hash: string; }, void, unknown>; all: () => Promise<Set<unknown>>; }; type: "set"; }; export default SetDb;