Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abstracted-firebase

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstracted-firebase - npm Package Compare versions

Comparing version 0.15.8 to 0.15.9

1

dist/cjs/db.d.ts

@@ -117,5 +117,4 @@ import { SerializedQuery } from "serialized-query";

protected abstract listenForConnectionStatus(): void;
protected handleError(e: any, name: string, message?: string): Promise<never>;
protected getFireMock(): Promise<void>;
}
export {};

139

dist/cjs/db.js

@@ -47,34 +47,48 @@ "use strict";

}
events.map(evt => {
const dispatch = WatcherEventWrapper_1.WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(util_1.slashNotation(target)).on(evt, dispatch);
try {
events.map(evt => {
const dispatch = WatcherEventWrapper_1.WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(util_1.slashNotation(target)).on(evt, dispatch);
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
}
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/watch";
throw e;
}
}
unWatch(events, cb) {
try {
if (!Array.isArray(events)) {
events = [events];
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
if (!events) {
this.ref().off();
return;
}
});
}
unWatch(events, cb) {
if (!Array.isArray(events)) {
events = [events];
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}
if (!events) {
this.ref().off();
return;
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/unWatch";
throw e;
}
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}

@@ -271,5 +285,3 @@ /**

catch (e) {
if (e.name === "Error") {
e.name = "AbstractedFirebaseUpdateError";
}
e.name = e.code;
e.code = "abstracted-firebase/update";

@@ -290,6 +302,8 @@ if (e.message.indexOf("First argument path specified exceeds the maximum depth") !==

catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/remove";
if (ignoreMissing && e.message.indexOf("key is not defined") !== -1) {
return;
}
throw common_types_1.createError("abstracted-firebase/remove", e.message, e);
throw e;
}

@@ -299,10 +313,25 @@ }

async getSnapshot(path) {
return typeof path === "string"
? this.ref(util_1.slashNotation(path)).once("value")
: path.setDB(this).execute();
try {
const response = (await typeof path) === "string"
? this.ref(util_1.slashNotation(path)).once("value")
: path.setDB(this).execute();
return response;
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getSnapshot";
throw e;
}
}
/** returns the JS value at a given path in the database */
async getValue(path) {
const snap = await this.getSnapshot(path);
return snap.val();
try {
const snap = await this.getSnapshot(path);
return snap.val();
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getValue";
throw e;
}
}

@@ -315,3 +344,4 @@ /**

async getRecord(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
let object = snap.val();

@@ -322,3 +352,8 @@ if (typeof object !== "object") {

return Object.assign({}, object, { [idProp]: snap.key });
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getRecord";
throw e;
}
}

@@ -332,5 +367,11 @@ /**

async getList(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
return snap.val() ? convert.snapshotToArray(snap, idProp) : [];
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getList";
throw e;
}
}

@@ -358,3 +399,10 @@ /**

async push(path, value) {
this.ref(path).push(value);
try {
this.ref(path).push(value);
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/push";
throw e;
}
}

@@ -365,9 +413,2 @@ /** validates the existance of a path in the database */

}
handleError(e, name, message = "") {
console.error(`Error ${message}:`, e);
return Promise.reject({
code: `firebase/${name}`,
message: message + e.message || e
});
}
async getFireMock() {

@@ -374,0 +415,0 @@ try {

@@ -117,5 +117,4 @@ import { SerializedQuery } from "serialized-query";

protected abstract listenForConnectionStatus(): void;
protected handleError(e: any, name: string, message?: string): Promise<never>;
protected getFireMock(): Promise<void>;
}
export {};

@@ -45,34 +45,48 @@ // tslint:disable:no-implicit-dependencies

}
events.map(evt => {
const dispatch = WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(slashNotation(target)).on(evt, dispatch);
try {
events.map(evt => {
const dispatch = WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(slashNotation(target)).on(evt, dispatch);
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
}
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/watch";
throw e;
}
}
unWatch(events, cb) {
try {
if (!Array.isArray(events)) {
events = [events];
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
if (!events) {
this.ref().off();
return;
}
});
}
unWatch(events, cb) {
if (!Array.isArray(events)) {
events = [events];
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}
if (!events) {
this.ref().off();
return;
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/unWatch";
throw e;
}
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}

@@ -269,5 +283,3 @@ /**

catch (e) {
if (e.name === "Error") {
e.name = "AbstractedFirebaseUpdateError";
}
e.name = e.code;
e.code = "abstracted-firebase/update";

@@ -288,6 +300,8 @@ if (e.message.indexOf("First argument path specified exceeds the maximum depth") !==

catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/remove";
if (ignoreMissing && e.message.indexOf("key is not defined") !== -1) {
return;
}
throw createError("abstracted-firebase/remove", e.message, e);
throw e;
}

@@ -297,10 +311,25 @@ }

async getSnapshot(path) {
return typeof path === "string"
? this.ref(slashNotation(path)).once("value")
: path.setDB(this).execute();
try {
const response = (await typeof path) === "string"
? this.ref(slashNotation(path)).once("value")
: path.setDB(this).execute();
return response;
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getSnapshot";
throw e;
}
}
/** returns the JS value at a given path in the database */
async getValue(path) {
const snap = await this.getSnapshot(path);
return snap.val();
try {
const snap = await this.getSnapshot(path);
return snap.val();
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getValue";
throw e;
}
}

@@ -313,3 +342,4 @@ /**

async getRecord(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
let object = snap.val();

@@ -320,3 +350,8 @@ if (typeof object !== "object") {

return Object.assign({}, object, { [idProp]: snap.key });
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getRecord";
throw e;
}
}

@@ -330,5 +365,11 @@ /**

async getList(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
return snap.val() ? convert.snapshotToArray(snap, idProp) : [];
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getList";
throw e;
}
}

@@ -356,3 +397,10 @@ /**

async push(path, value) {
this.ref(path).push(value);
try {
this.ref(path).push(value);
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/push";
throw e;
}
}

@@ -363,9 +411,2 @@ /** validates the existance of a path in the database */

}
handleError(e, name, message = "") {
console.error(`Error ${message}:`, e);
return Promise.reject({
code: `firebase/${name}`,
message: message + e.message || e
});
}
async getFireMock() {

@@ -372,0 +413,0 @@ try {

@@ -117,5 +117,4 @@ import { SerializedQuery } from "serialized-query";

protected abstract listenForConnectionStatus(): void;
protected handleError(e: any, name: string, message?: string): Promise<never>;
protected getFireMock(): Promise<void>;
}
export {};

@@ -57,34 +57,48 @@ (function (factory) {

}
events.map(evt => {
const dispatch = WatcherEventWrapper_1.WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(util_1.slashNotation(target)).on(evt, dispatch);
try {
events.map(evt => {
const dispatch = WatcherEventWrapper_1.WatcherEventWrapper({
eventType: evt,
targetType: "path"
})(cb);
if (typeof target === "string") {
this.ref(util_1.slashNotation(target)).on(evt, dispatch);
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
}
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/watch";
throw e;
}
}
unWatch(events, cb) {
try {
if (!Array.isArray(events)) {
events = [events];
}
else {
target
.setDB(this)
.deserialize()
.on(evt, dispatch);
if (!events) {
this.ref().off();
return;
}
});
}
unWatch(events, cb) {
if (!Array.isArray(events)) {
events = [events];
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}
if (!events) {
this.ref().off();
return;
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/unWatch";
throw e;
}
events.map(evt => {
if (cb) {
this.ref().off(evt, cb);
}
else {
this.ref().off(evt);
}
});
}

@@ -281,5 +295,3 @@ /**

catch (e) {
if (e.name === "Error") {
e.name = "AbstractedFirebaseUpdateError";
}
e.name = e.code;
e.code = "abstracted-firebase/update";

@@ -300,6 +312,8 @@ if (e.message.indexOf("First argument path specified exceeds the maximum depth") !==

catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/remove";
if (ignoreMissing && e.message.indexOf("key is not defined") !== -1) {
return;
}
throw common_types_1.createError("abstracted-firebase/remove", e.message, e);
throw e;
}

@@ -309,10 +323,25 @@ }

async getSnapshot(path) {
return typeof path === "string"
? this.ref(util_1.slashNotation(path)).once("value")
: path.setDB(this).execute();
try {
const response = (await typeof path) === "string"
? this.ref(util_1.slashNotation(path)).once("value")
: path.setDB(this).execute();
return response;
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getSnapshot";
throw e;
}
}
/** returns the JS value at a given path in the database */
async getValue(path) {
const snap = await this.getSnapshot(path);
return snap.val();
try {
const snap = await this.getSnapshot(path);
return snap.val();
}
catch (e) {
e.name = e.code;
e.code = "abstracted-firebase/getValue";
throw e;
}
}

@@ -325,3 +354,4 @@ /**

async getRecord(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
let object = snap.val();

@@ -332,3 +362,8 @@ if (typeof object !== "object") {

return Object.assign({}, object, { [idProp]: snap.key });
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getRecord";
throw e;
}
}

@@ -342,5 +377,11 @@ /**

async getList(path, idProp = "id") {
return this.getSnapshot(path).then(snap => {
try {
const snap = await this.getSnapshot(path);
return snap.val() ? convert.snapshotToArray(snap, idProp) : [];
});
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/getList";
throw e;
}
}

@@ -368,3 +409,10 @@ /**

async push(path, value) {
this.ref(path).push(value);
try {
this.ref(path).push(value);
}
catch (e) {
e.name = e.code.contains("abstracted-firebase") ? "AbstractedFirebase" : e.code;
e.code = "abstracted-firebase/push";
throw e;
}
}

@@ -375,9 +423,2 @@ /** validates the existance of a path in the database */

}
handleError(e, name, message = "") {
console.error(`Error ${message}:`, e);
return Promise.reject({
code: `firebase/${name}`,
message: message + e.message || e
});
}
async getFireMock() {

@@ -384,0 +425,0 @@ try {

{
"name": "abstracted-firebase",
"version": "0.15.8",
"version": "0.15.9",
"description": "Core functional library supporting 'abstracted-admin' and 'abstracted-client'",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc