npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sliit-foss/firebase

v1.1.1

Published

A wrapper around the Firebase JS SDK with firestore and realtime database support for filtering sorting, limiting, error handling, and success scenarios

Downloads

6

Readme

@sliit-foss/firebase

A wrapper around the Firebase JS SDK with firestore and realtime database support for filtering sorting, limiting, error handling, and success scenarios

Installation

# using npm
npm install @sliit-foss/firebase

# using yarn
yarn add @sliit-foss/firebase

Usage

# using require
const { firestoreService } = require("@sliit-foss/firebase");

# using import
import { firestoreService } from "@sliit-foss/firebase";

Example - Firestore

// read
const users = await firestoreService.read({ collection: "users" });

// write
const result = await firestoreService.write({
  collection: "users",
  payload: { name: "Ciri", age: 19 },
});

// update
const result = await firestoreService.update({
  collection: "users",
  payload: { age: 20 },
  filters: [
    {
      key: "name",
      operator: "==",
      value: "Ciri",
    },
  ],
});

// delete
const result = await firestoreService.remove({ collection: "users" });

Additional Options

  • The read, update and delete functions can take in the additional parameter filters which is an array of objects indicating the filtering criteria of the results. The supported operators are the same as the ones provided in the firebase docs (https://cloud.google.com/firestore/docs/query-data/queries#query_operators)

  • The read function can take in the additional parameters sorts and recordLimit where sorts is an array of objects indicating the sorting criteria of the results and recordLimit is an integer which limits the number of records returned from the query.

  • The write function can take in the additional parameters documentId which will allow you to create documents with a provided documentId as opposed to its auto generated behavior and merge which will allow you to merge the newly provided payload with the existing data at the provided path if it exists.

  • All functions can take in the additional parameters onSuccess and onError which are callback functions which will get executed on success and failure scenarios respectively. The onSuccess callback is passed the result of the operation as a parameter by default whereas the onError function is passed the error or details of the error which occurred.


Based on the original cloud firebase package by Google (https://www.npmjs.com/package/firebase)