-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
49 lines (39 loc) · 1.05 KB
/
index.ts
File metadata and controls
49 lines (39 loc) · 1.05 KB
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
import Auth from './lib/services/Auth';
import Database from './lib/services/Database';
import Storage from './lib/services/Storage';
import Client from './lib/Client';
import { WaterbaseConfig } from './lib/models/Config';
class Waterbase {
private auth: Auth;
private database: Database;
private storage: Storage;
#Client: Client;
constructor() {
this.#Client = {} as Client;
this.auth = {} as Auth;
this.database = {} as Database;
this.storage = {} as Storage;
}
initialize = (config: WaterbaseConfig) => {
this.#Client = new Client(config);
};
Auth = (): Auth => {
if (this.auth !== ({} as Auth)) {
this.auth = new Auth(this.#Client);
}
return this.auth;
};
Database = (): Database => {
if (this.database !== ({} as Database)) {
this.database = new Database(this.#Client);
}
return this.database;
};
Storage = (): Storage => {
if (this.storage !== ({} as Storage)) {
this.storage = new Storage(this.#Client);
}
return this.storage;
};
}
export = new Waterbase();