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

fire-repo

v1.1.9

Published

This package is create to add repository pattern to firebase and implementing a helpers for help developers to write fast code.

Downloads

26

Readme

FIRE-REPO 🔥

This library is an implementation of the firebase repository pattern and some helpers to facilitate the work of developers using firebase. - (ts projects only)

Main actions

npm i fire-repo

Table of Contents

Installation

Only you need download the code and install the dependencies running the command npm install.

Libraries

The used libraries are:

Project structure

  • 📁 .github : Contains the github actions configurations.

  • 📁 example : Contains the example of usage from library.

    • ts configuration.ts : Example of configuration.
    • ts index.ts : Example of usage.
  • 📁 helpers : Contains the helpers of library.

    • ts fire-file.helper.ts : Helper to work with firebase files.
    • ts fire-mapping.helper.ts : Helper to mapping the firebase data.
    • ts index.ts : Export the helpers.
  • 📁 models : Contains the models of library

    • ts base.model.ts : Base model.
  • 📁 repositories : Contains the repositories of library

    • 📁 implementations: Contains the implementations of repositories.
    • 📁 interfaces : Contains the interfaces of library.
      • ts index.ts : Export the interfaces.
      • ts read.interface.ts : Interface to read data.
      • ts write.interface.ts : Interface to write data.
    • 📁 types: Contains the types of library.
      • ts filter.type.ts: Type to filter data.
      • ts index.ts: Export the types.
  • 📁 test

    • 📁 helpers: Contains the test of helpers.
    • 📁 repositories: Contains the test of repositories

Use

For use the library in you project you need install the fire-repo library running the command npm i fire-repo and import the library in your project.

import { FireRepository } from "fire-repo";
import { BaseModel } from "fire-repo";

Create your model extending the base model.

class User extends BaseModel {
  name: string;
  email: string;
}

Create your service class for work with the repository and manage the entity and data.

class UserService extends FireRepository<User> {
  constructor() {
    /**
     * @param {initializeApp} firebaseConfiguration firebase configuration
     * @param {string} collection firebase collection "/test"
     */
    super(firebaseConfiguration, collection);
  }
}

Methods

  • add: Create a new entity.
  • update: Update an entity.
  • deleteEntity: Delete an entity.
  • remove: Applied the soft delete a entity.
  • getAll: Get all entities.
  • getOne: Get One entity.
  • getDocId: Get the document id.
  • getCollection: Get the collection.

Helpers

  • fileUpload: Upload a file to firebase storage.
  • removeFile: Remove a file from firebase storage.
  • toEntityArray: Convert an array of firebase data to an array of entities.
  • getFormateadFirebaseData: Format the retrieved data from firebase. (Date - timestamp)

Contribution

If you want to contribute to the library you can create a branch in the repository and send a pull request. Remember create great unit tests and documentation updates.

Branches

Remember usage this structure:

  • feature/[name]
  • fix/[name]
  • bug/[name]

Report an issuer

If you have an issue or a problem with the library you can report it in the issues