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)
🐤 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:
🦙 Usage
This is wrapper for firestore, you can use firebase v8 or v9
work exactly like firelord, except that:
- any kind of
create
operations is not available, you can only create document usingset
oradd
- no
offset
- more parameter for
get
andonSnapshot
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