Skip to content

Commit

Permalink
Merge branch 'release/0.35.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeeinlondon committed Dec 4, 2019
2 parents f21ed27 + e66ee73 commit 0f3d74d
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 4 deletions.
5 changes: 5 additions & 0 deletions dist/cjs/ClientError.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare class ClientError extends Error {
kind: string;
code: string;
constructor(message: string, classification?: string);
}
13 changes: 13 additions & 0 deletions dist/cjs/ClientError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ClientError extends Error {
constructor(message, classification = "abstracted-client/unknown") {
super(message);
this.kind = "ClientError";
const parts = classification.split("/");
const [type, subType] = parts.length === 1 ? ["abstracted-client", parts[0]] : parts;
this.name = `${type}/${subType}`;
this.code = subType;
}
}
exports.ClientError = ClientError;
6 changes: 6 additions & 0 deletions dist/cjs/db.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RealTimeDB, IFirebaseClientConfig } from "abstracted-firebase";
import { EventManager } from "./EventManager";
import { FirebaseNamespace } from "@firebase/app-types";
export declare enum FirebaseBoolean {
true = 1,
false = 0
Expand All @@ -20,8 +21,13 @@ export declare class DB extends RealTimeDB<FirebaseAuth> {
protected _clientType: "client" | "admin";
protected _database: FirebaseDatabase;
protected _auth: FirebaseAuth;
protected _authProviders: FirebaseNamespace["auth"];
protected app: any;
constructor(config: IFirebaseClientConfig);
/**
* access to provider specific providers
*/
get authProviders(): FirebaseNamespace["auth"];
auth(): Promise<FirebaseAuth>;
/**
* connect
Expand Down
13 changes: 13 additions & 0 deletions dist/cjs/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const abstracted_firebase_1 = require("abstracted-firebase");
const EventManager_1 = require("./EventManager");
const ClientError_1 = require("./ClientError");
var FirebaseBoolean;
(function (FirebaseBoolean) {
FirebaseBoolean[FirebaseBoolean["true"] = 1] = "true";
Expand Down Expand Up @@ -32,6 +33,15 @@ class DB extends abstracted_firebase_1.RealTimeDB {
await Promise.resolve().then(() => require("@firebase/database"));
return Array.from(new Set(fb.firebase.apps.map(i => i.name)));
}
/**
* access to provider specific providers
*/
get authProviders() {
if (!this._authProviders) {
throw new ClientError_1.ClientError(`Attempt to get the authProviders getter before connecting to the database!`);
}
return this._authProviders;
}
async auth() {
if (this._auth) {
return this._auth;
Expand Down Expand Up @@ -60,6 +70,8 @@ class DB extends abstracted_firebase_1.RealTimeDB {
db: config.mockData || {},
auth: config.mockAuth || {}
});
this._authProviders = this._mock
.authProviders;
this._isConnected = true;
}
else {
Expand Down Expand Up @@ -95,6 +107,7 @@ class DB extends abstracted_firebase_1.RealTimeDB {
throw e;
}
}
this._authProviders = fb.default.auth;
this._database = this.app.database();
}
else {
Expand Down
5 changes: 5 additions & 0 deletions dist/esnext/ClientError.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare class ClientError extends Error {
kind: string;
code: string;
constructor(message: string, classification?: string);
}
10 changes: 10 additions & 0 deletions dist/esnext/ClientError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export class ClientError extends Error {
constructor(message, classification = "abstracted-client/unknown") {
super(message);
this.kind = "ClientError";
const parts = classification.split("/");
const [type, subType] = parts.length === 1 ? ["abstracted-client", parts[0]] : parts;
this.name = `${type}/${subType}`;
this.code = subType;
}
}
6 changes: 6 additions & 0 deletions dist/esnext/db.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RealTimeDB, IFirebaseClientConfig } from "abstracted-firebase";
import { EventManager } from "./EventManager";
import { FirebaseNamespace } from "@firebase/app-types";
export declare enum FirebaseBoolean {
true = 1,
false = 0
Expand All @@ -20,8 +21,13 @@ export declare class DB extends RealTimeDB<FirebaseAuth> {
protected _clientType: "client" | "admin";
protected _database: FirebaseDatabase;
protected _auth: FirebaseAuth;
protected _authProviders: FirebaseNamespace["auth"];
protected app: any;
constructor(config: IFirebaseClientConfig);
/**
* access to provider specific providers
*/
get authProviders(): FirebaseNamespace["auth"];
auth(): Promise<FirebaseAuth>;
/**
* connect
Expand Down
13 changes: 13 additions & 0 deletions dist/esnext/db.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RealTimeDB, isMockConfig } from "abstracted-firebase";
import { EventManager } from "./EventManager";
import { ClientError } from "./ClientError";
export var FirebaseBoolean;
(function (FirebaseBoolean) {
FirebaseBoolean[FirebaseBoolean["true"] = 1] = "true";
Expand Down Expand Up @@ -30,6 +31,15 @@ export class DB extends RealTimeDB {
await import("@firebase/database");
return Array.from(new Set(fb.firebase.apps.map(i => i.name)));
}
/**
* access to provider specific providers
*/
get authProviders() {
if (!this._authProviders) {
throw new ClientError(`Attempt to get the authProviders getter before connecting to the database!`);
}
return this._authProviders;
}
async auth() {
if (this._auth) {
return this._auth;
Expand Down Expand Up @@ -58,6 +68,8 @@ export class DB extends RealTimeDB {
db: config.mockData || {},
auth: config.mockAuth || {}
});
this._authProviders = this._mock
.authProviders;
this._isConnected = true;
}
else {
Expand Down Expand Up @@ -93,6 +105,7 @@ export class DB extends RealTimeDB {
throw e;
}
}
this._authProviders = fb.default.auth;
this._database = this.app.database();
}
else {
Expand Down
5 changes: 5 additions & 0 deletions dist/umd/ClientError.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare class ClientError extends Error {
kind: string;
code: string;
constructor(message: string, classification?: string);
}
23 changes: 23 additions & 0 deletions dist/umd/ClientError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ClientError extends Error {
constructor(message, classification = "abstracted-client/unknown") {
super(message);
this.kind = "ClientError";
const parts = classification.split("/");
const [type, subType] = parts.length === 1 ? ["abstracted-client", parts[0]] : parts;
this.name = `${type}/${subType}`;
this.code = subType;
}
}
exports.ClientError = ClientError;
});
6 changes: 6 additions & 0 deletions dist/umd/db.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RealTimeDB, IFirebaseClientConfig } from "abstracted-firebase";
import { EventManager } from "./EventManager";
import { FirebaseNamespace } from "@firebase/app-types";
export declare enum FirebaseBoolean {
true = 1,
false = 0
Expand All @@ -20,8 +21,13 @@ export declare class DB extends RealTimeDB<FirebaseAuth> {
protected _clientType: "client" | "admin";
protected _database: FirebaseDatabase;
protected _auth: FirebaseAuth;
protected _authProviders: FirebaseNamespace["auth"];
protected app: any;
constructor(config: IFirebaseClientConfig);
/**
* access to provider specific providers
*/
get authProviders(): FirebaseNamespace["auth"];
auth(): Promise<FirebaseAuth>;
/**
* connect
Expand Down
15 changes: 14 additions & 1 deletion dist/umd/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "abstracted-firebase", "./EventManager"], factory);
define(["require", "exports", "abstracted-firebase", "./EventManager", "./ClientError"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
const abstracted_firebase_1 = require("abstracted-firebase");
const EventManager_1 = require("./EventManager");
const ClientError_1 = require("./ClientError");
var FirebaseBoolean;
(function (FirebaseBoolean) {
FirebaseBoolean[FirebaseBoolean["true"] = 1] = "true";
Expand Down Expand Up @@ -42,6 +43,15 @@
await (__syncRequire ? Promise.resolve().then(() => require("@firebase/database")) : new Promise((resolve_2, reject_2) => { require(["@firebase/database"], resolve_2, reject_2); }));
return Array.from(new Set(fb.firebase.apps.map(i => i.name)));
}
/**
* access to provider specific providers
*/
get authProviders() {
if (!this._authProviders) {
throw new ClientError_1.ClientError(`Attempt to get the authProviders getter before connecting to the database!`);
}
return this._authProviders;
}
async auth() {
if (this._auth) {
return this._auth;
Expand Down Expand Up @@ -70,6 +80,8 @@
db: config.mockData || {},
auth: config.mockAuth || {}
});
this._authProviders = this._mock
.authProviders;
this._isConnected = true;
}
else {
Expand Down Expand Up @@ -105,6 +117,7 @@
throw e;
}
}
this._authProviders = fb.default.auth;
this._database = this.app.database();
}
else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abstracted-client",
"version": "0.35.1",
"version": "0.35.2",
"description": "Helpful abstraction on the Firebase client API",
"license": "MIT",
"repository": "https://github.com/forest-fire/abstracted-client",
Expand Down
4 changes: 2 additions & 2 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class DB extends RealTimeDB<FirebaseAuth> {
protected _clientType: "client" | "admin" = "client";
protected _database: FirebaseDatabase;
protected _auth: FirebaseAuth;
protected _authProviders;
protected _authProviders: FirebaseNamespace["auth"];
protected app: any;

constructor(config: IFirebaseClientConfig) {
Expand All @@ -57,7 +57,7 @@ export class DB extends RealTimeDB<FirebaseAuth> {
/**
* access to provider specific providers
*/
get authProviders() {
get authProviders(): FirebaseNamespace["auth"] {
if (!this._authProviders) {
throw new ClientError(
`Attempt to get the authProviders getter before connecting to the database!`
Expand Down

0 comments on commit 0f3d74d

Please sign in to comment.