JSPM

firelordjs

0.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 191
  • Score
    100M100P100Q82465F
  • License MIT

🔥 firestore js wrapper with deeper typing solution.

Package Exports

  • firelordjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (firelordjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

firelordjs(BETA, js only)

npm GitHub PRs Welcome

🐤 firestore js wrapper with deeper typing solution.

🚀 All read and write operation are typed, field path, field value, collection path, document path, everything is typed!

🔥 Automatically convert base type to corresponding read and write time(good at handling timestamp and field value).

✨ Api closely resemble firestore api, low learning curve.

🐉 Zero dependency.

⛲️ Out of box typescript support.

Variants:

  1. react native
  2. nodejs

🦙 Usage

This is wrapper for firestore, you can use firebase v8 or v9

work exactly like firelord, except that:

  1. any kind of create operations is not available, you can only create document using set or add
  2. no offset
  3. more parameter for get and onSnapshot

instead of

// from firelord doc
// don't do this
import { firelord, Firelord } from 'firelord'
import { firestore } from 'firebase-admin'

// create wrapper
const wrapper = firelord(firestore)

do

// do this
import { firelord, Firelord } from 'firelordjs'
// firebase 8
import firebase from 'firebase'
import 'firebase/firestore'

// firebase 9
// import firebase from 'firebase/compat/app'
// import 'firebase/compat/firestore'

firebase.initializeApp({
    apiKey: '### FIREBASE API KEY ###',
    authDomain: '### FIREBASE AUTH DOMAIN ###',
    projectId: '### CLOUD FIRESTORE PROJECT ID ###',
})

const firestore = firebase.firestore

// create wrapper
const wrapper = firelord(firestore)

get and onSnapshot

// import user

// options?:{source: 'default' | 'server' | 'cache'}
user.get(options)

// observer: {
// 	next?: (
// 		snapshot: FirelordFirestore.DocumentSnapshot<Read>
// 	) => void
// 	error?: (error: Error) => void
// },
// options?: { includeMetadataChanges: boolean }
user.onSnapshot(observer, options)

no surprise here, everything is similar to firestore api

the rest is exactly the same as firelord