
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
firebase-firestore-extra
Advanced tools
Cool stuff that speed up your work with Cloud Firestore Database.
If you want to contribute just create pull rquest.
Currently web sdk only (not yet for Node.js. Expect separate package).
Tested with "firebase": "7.2.0"
(firebase skd should be also installed with npm i -S firebase
)
Compiled with TypeScript 3.6.3
$ npm i -S firebase-firestore-extra
Active augmentations in TypeScript app (when using plain JavaScript it is enough to require('firebase-firestore-extra')
):
// Mandatory line, even if you are importing something using 'from' syntax
// In case of Angular app put it in main.ts
import 'firebase-firestore-extra';
// Then import required types, even in the same file as above import...
import { DocRef } from 'firebase-firestore-extra';
import { Doc, DocRef, ColRef, Query } from 'firebase-firestore-extra';
import * as firebase from 'firebase';
interface IData = Doc<{name: string, age: number}>
// configure firebase...
let db = fireStoreDb;
// Of course await inside async function only
let colRef: ColRef<IData> = db.collection('col') as ColRef<IData>;
let docRef: DocRef<IData> = colRef.doc('docId');
let typedList: IData[] = await colRef.xGet();
let typedObj: IData = await docRef.xGet();
let myObject: IData = {} as any;
let stop = docRef.xWatch(myObject, {otherOptions});
// You can deduce other options from typings
// Variable myObject will be synced with database document until stop() called
stop();
let myArray: IData = {} as any;
let stop = colRef.xWatch(myArray, {otherOptions});
// You can deduce other options from typings
// Array myObject will be synced with database documents list until stop() called
stop();
// You can also query with typings
colRef.where('name', '==', 'Nejm').limit(10).xWatch(myArray, {otherOptions});
// Firebase native options objects:
//
// onError handler
// firebase.firestore.GetOptions
// firebase.firestore.SnapshotOptions
// firebase.firestore.SnapshotListenOptions
// The only additional options provided by firestore-extra are hooks:
colRef.xWatch(myArray, {
hooks: {
afterAdded: handlerFunc // You can sound alarm if you received new document created later than Date.now()
afterMofified: handlerFunction
afterRemoved: handlerFunction
}
});
// !!
// If handlerFunction will be method of some class remember to use bind
Just check examples and typings.
For more advanced use cases please check firebase/firestore documentaion and find corresponding options when usign xGet
and xWatch
methods
FAQs
Augmentations and typings for firebase/firestore
We found that firebase-firestore-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.