UNPKG

waterbase

Version:
55 lines (54 loc) 2.1 kB
"use strict"; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _Client; const Auth_1 = __importDefault(require("./lib/services/Auth")); const Database_1 = __importDefault(require("./lib/services/Database")); const Storage_1 = __importDefault(require("./lib/services/Storage")); const Client_1 = __importDefault(require("./lib/Client")); class Waterbase { constructor() { _Client.set(this, void 0); this.initialize = (config) => { __classPrivateFieldSet(this, _Client, new Client_1.default(config)); }; this.Auth = () => { if (this.auth !== {}) { this.auth = new Auth_1.default(__classPrivateFieldGet(this, _Client)); } return this.auth; }; this.Database = () => { if (this.database !== {}) { this.database = new Database_1.default(__classPrivateFieldGet(this, _Client)); } return this.database; }; this.Storage = () => { if (this.storage !== {}) { this.storage = new Storage_1.default(__classPrivateFieldGet(this, _Client)); } return this.storage; }; __classPrivateFieldSet(this, _Client, {}); this.auth = {}; this.database = {}; this.storage = {}; } } _Client = new WeakMap(); module.exports = new Waterbase();