abstracted-firebase
Advanced tools
Comparing version 0.27.7 to 0.27.8
export declare class AbstractedError extends Error { | ||
code: string; | ||
constructor(message: string, errorCode: string); | ||
constructor( | ||
/** a human friendly error message */ | ||
message: string, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class AbstractedError extends Error { | ||
constructor(message, errorCode) { | ||
constructor( | ||
/** a human friendly error message */ | ||
message, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode) { | ||
super(message); | ||
this.code = `abstracted-firebase/${errorCode}`; | ||
this.name = this.code.split("/")[1]; | ||
const parts = errorCode.split("/"); | ||
const [type, subType] = parts.length === 1 ? ["abstracted-firebase", parts[0]] : parts; | ||
this.name = `${type}/${subType}`; | ||
this.code = subType; | ||
} | ||
} | ||
exports.AbstractedError = AbstractedError; |
@@ -1,3 +0,3 @@ | ||
import { IDictionary } from "common-types"; | ||
import { RealTimeDB } from "./db"; | ||
export declare function slashNotation(path: string): string; | ||
export declare function _getFirebaseType(context: IDictionary, kind: string): any; | ||
export declare function _getFirebaseType<T extends RealTimeDB>(context: T, kind: string): any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const errors_1 = require("./errors"); | ||
function slashNotation(path) { | ||
@@ -10,13 +11,10 @@ return path.substr(0, 5) === ".info" | ||
function _getFirebaseType(context, kind) { | ||
if (!this.app) { | ||
const e = new Error(`You must first connect before using the ${kind}() API`); | ||
e.name = "NotAllowed"; | ||
throw e; | ||
if (!context.isConnected) { | ||
throw new errors_1.AbstractedError(`You must first connect before using the ${kind}() API`, "not-ready"); | ||
} | ||
const property = `_${kind}`; | ||
if (!context[property]) { | ||
context[property] = this.app.storage(); | ||
if (!context.app[kind]) { | ||
throw new errors_1.AbstractedError(`An attempt was made to load the "${kind}" API but that API does not appear to exist!`, "not-allowed"); | ||
} | ||
return context[property]; | ||
return context.app[kind](); | ||
} | ||
exports._getFirebaseType = _getFirebaseType; |
export declare class AbstractedError extends Error { | ||
code: string; | ||
constructor(message: string, errorCode: string); | ||
constructor( | ||
/** a human friendly error message */ | ||
message: string, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode: string); | ||
} |
export class AbstractedError extends Error { | ||
constructor(message, errorCode) { | ||
constructor( | ||
/** a human friendly error message */ | ||
message, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode) { | ||
super(message); | ||
this.code = `abstracted-firebase/${errorCode}`; | ||
this.name = this.code.split("/")[1]; | ||
const parts = errorCode.split("/"); | ||
const [type, subType] = parts.length === 1 ? ["abstracted-firebase", parts[0]] : parts; | ||
this.name = `${type}/${subType}`; | ||
this.code = subType; | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
import { IDictionary } from "common-types"; | ||
import { RealTimeDB } from "./db"; | ||
export declare function slashNotation(path: string): string; | ||
export declare function _getFirebaseType(context: IDictionary, kind: string): any; | ||
export declare function _getFirebaseType<T extends RealTimeDB>(context: T, kind: string): any; |
@@ -0,1 +1,2 @@ | ||
import { AbstractedError } from "./errors"; | ||
export function slashNotation(path) { | ||
@@ -7,12 +8,9 @@ return path.substr(0, 5) === ".info" | ||
export function _getFirebaseType(context, kind) { | ||
if (!this.app) { | ||
const e = new Error(`You must first connect before using the ${kind}() API`); | ||
e.name = "NotAllowed"; | ||
throw e; | ||
if (!context.isConnected) { | ||
throw new AbstractedError(`You must first connect before using the ${kind}() API`, "not-ready"); | ||
} | ||
const property = `_${kind}`; | ||
if (!context[property]) { | ||
context[property] = this.app.storage(); | ||
if (!context.app[kind]) { | ||
throw new AbstractedError(`An attempt was made to load the "${kind}" API but that API does not appear to exist!`, "not-allowed"); | ||
} | ||
return context[property]; | ||
return context.app[kind](); | ||
} |
export declare class AbstractedError extends Error { | ||
code: string; | ||
constructor(message: string, errorCode: string); | ||
constructor( | ||
/** a human friendly error message */ | ||
message: string, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode: string); | ||
} |
@@ -13,6 +13,15 @@ (function (factory) { | ||
class AbstractedError extends Error { | ||
constructor(message, errorCode) { | ||
constructor( | ||
/** a human friendly error message */ | ||
message, | ||
/** | ||
* either of the syntax `type/subType` or alternatively just | ||
* `subType` where type will be defaulted to **abstracted-firebase** | ||
*/ | ||
errorCode) { | ||
super(message); | ||
this.code = `abstracted-firebase/${errorCode}`; | ||
this.name = this.code.split("/")[1]; | ||
const parts = errorCode.split("/"); | ||
const [type, subType] = parts.length === 1 ? ["abstracted-firebase", parts[0]] : parts; | ||
this.name = `${type}/${subType}`; | ||
this.code = subType; | ||
} | ||
@@ -19,0 +28,0 @@ } |
@@ -1,3 +0,3 @@ | ||
import { IDictionary } from "common-types"; | ||
import { RealTimeDB } from "./db"; | ||
export declare function slashNotation(path: string): string; | ||
export declare function _getFirebaseType(context: IDictionary, kind: string): any; | ||
export declare function _getFirebaseType<T extends RealTimeDB>(context: T, kind: string): any; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
define(["require", "exports", "./errors"], factory); | ||
} | ||
@@ -13,2 +13,3 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const errors_1 = require("./errors"); | ||
function slashNotation(path) { | ||
@@ -21,14 +22,11 @@ return path.substr(0, 5) === ".info" | ||
function _getFirebaseType(context, kind) { | ||
if (!this.app) { | ||
const e = new Error(`You must first connect before using the ${kind}() API`); | ||
e.name = "NotAllowed"; | ||
throw e; | ||
if (!context.isConnected) { | ||
throw new errors_1.AbstractedError(`You must first connect before using the ${kind}() API`, "not-ready"); | ||
} | ||
const property = `_${kind}`; | ||
if (!context[property]) { | ||
context[property] = this.app.storage(); | ||
if (!context.app[kind]) { | ||
throw new errors_1.AbstractedError(`An attempt was made to load the "${kind}" API but that API does not appear to exist!`, "not-allowed"); | ||
} | ||
return context[property]; | ||
return context.app[kind](); | ||
} | ||
exports._getFirebaseType = _getFirebaseType; | ||
}); |
{ | ||
"name": "abstracted-firebase", | ||
"version": "0.27.7", | ||
"version": "0.27.8", | ||
"description": "Core functional library supporting 'abstracted-admin' and 'abstracted-client'", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150993
3617