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.4.8 to 0.5.0

13

lib/db.d.ts
import { SerializedQuery } from "serialized-query";
import { Mock } from "firemock";
import { rtdb } from "firebase-api-surface";
export interface IPathSetter<T = any> {
path: string;
value: T;
}
export declare type FirebaseEvent = "child_added" | "child_removed" | "child_changed" | "child_moved" | "value";

@@ -38,3 +42,10 @@ export declare enum FirebaseBoolean {

set<T = T>(path: string, value: T): Promise<void>;
update<T = T>(path: string, value: Partial<T>): Promise<any>;
multiPathSet(): {
basePath: string;
add<X = any>(pathValue: IPathSetter<X>): any;
readonly paths: string[];
callback(cb: (err: any, pathSetters: IPathSetter<any>[]) => void): void;
execute(): Promise<any>;
};
update<T = any>(path: string, value: Partial<T>): Promise<any>;
remove<T = T>(path: string, ignoreMissing?: boolean): Promise<void>;

@@ -41,0 +52,0 @@ getSnapshot(path: string | SerializedQuery): Promise<rtdb.IDataSnapshot>;

@@ -96,2 +96,53 @@ "use strict";

}
multiPathSet() {
const mps = [];
const ref = this.ref.bind(this);
let callback;
const api = {
basePath: "/",
add(pathValue) {
const exists = new Set(api.paths);
if (pathValue.path.indexOf("/") === -1) {
pathValue.path = "/" + pathValue.path;
}
if (exists.has(pathValue.path)) {
const e = new Error(`You have attempted to add the path "${pathValue.path}" twice.`);
e.code = "duplicate-path";
throw e;
}
mps.push(pathValue);
return api;
},
get paths() {
return mps.map(i => i.path);
},
callback(cb) {
callback = cb;
return;
},
execute() {
return __awaiter(this, void 0, void 0, function* () {
const updateHash = {};
mps.map(item => {
updateHash[item.path] = item.value;
});
return ref(api.basePath)
.update(updateHash)
.then(() => {
if (callback) {
callback(null, mps);
return;
}
})
.catch((e) => {
if (callback) {
callback(e, mps);
}
throw e;
});
});
}
};
return api;
}
update(path, value) {

@@ -98,0 +149,0 @@ return __awaiter(this, void 0, void 0, function* () {

3

package.json
{
"name": "abstracted-firebase",
"version": "0.4.8",
"version": "0.5.0",
"description": "Core library supporting 'abstracted-admin' and 'abstracted-client' libraries",

@@ -47,2 +47,3 @@ "license": "MIT",

"@types/rimraf": "^2.0.1",
"abstracted-admin": "^0.9.5",
"async-shelljs": "^0.1.2",

@@ -49,0 +50,0 @@ "chai": "^4.1.0",

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