-
Notifications
You must be signed in to change notification settings - Fork 36
/
OrbitDB.d.ts
81 lines (67 loc) · 3.23 KB
/
OrbitDB.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/// <reference path="./DBOptions.d.ts" />
/// <reference path="./LogEntry.d.ts" />
declare module 'orbit-db' {
import Store from "orbit-db-store";
import KeyValueStore from "orbit-db-kvstore";
import FeedStore from "orbit-db-feedstore";
import EventStore from "orbit-db-eventstore";
import DocumentStore from "orbit-db-docstore";
import CounterStore from "orbit-db-counterstore";
import { Keystore } from "orbit-db-keystore";
import Cache from "orbit-db-cache";
import { Identity } from "orbit-db-identity-provider";
import * as IPFS from "ipfs";
import * as elliptic from "elliptic";
import OrbitDBAddress from 'orbit-db'
export class OrbitDB {
_ipfs: IPFS;
id: string;
stores: any;
directory: string;
keystore: Keystore;
// For OpenTelemetry Plugin
span?: any;
static databaseTypes: string[];
constructor(ipfs: IPFS, directory?: string, options?: {
peerId?: string,
keystore?: Keystore
});
/**
* Creates and returns an instance of OrbitDB.
* @param ipfs
* @param options Other options:
* <ul>
* <li>directory (string): path to be used for the database files. By default it uses './orbitdb'.</li>
* <li>peerId (string): By default it uses the base58 string of the ipfs peer id.</li>
* <li>keystore (Keystore Instance) : By default creates an instance of Keystore.</li>
* <li>cache (Cache Instance) : By default creates an instance of Cache. A custom cache instance can also be used.</li>
* <li>identity (Identity Instance): By default it creates an instance of Identity</li>
* </ul>
*/
static createInstance(ipfs: IPFS, options?: {
directory?: string,
peerId?: string,
keystore?: Keystore,
cache?: Cache<any>,
identity?: Identity
}): Promise<OrbitDB>
create(name: string, type: TStoreType, options?: ICreateOptions): Promise<Store>;
open(address: string, options?: IOpenOptions): Promise<Store>;
disconnect(): Promise<void>;
stop(): Promise<void>;
feed<T>(address: string, options?: IStoreOptions): Promise<FeedStore<T>>;
log<T>(address: string, options?: IStoreOptions): Promise<EventStore<T>>;
eventlog<T>(address: string, options?: IStoreOptions): Promise<EventStore<T>>;
keyvalue<T>(address: string, options?: IStoreOptions): Promise<KeyValueStore<T>>;
kvstore<T>(address: string, options?: IStoreOptions): Promise<KeyValueStore<T>>;
counter(address: string, options?: IStoreOptions): Promise<CounterStore>;
docs<T>(address: string, options?: IStoreOptions): Promise<DocumentStore<T>>;
docstore<T>(address: string, options?: IStoreOptions): Promise<DocumentStore<T>>;
determineAddress(name: string, type: TStoreType, options?: ICreateOptions): Promise<OrbitDBAddress>
static isValidType(type: TStoreType): boolean;
static addDatabaseType(type: string, store: typeof Store): void;
static getDatabaseTypes(): {};
static isValidAddress(address: string): boolean;
}
export default OrbitDB;
}