A redux saga integration for firebase.
This release includes several breaking changes .
sync
API*database.sync(path, options)
now takes an option
object as argument.
The objects has three keys:
successActionCreator
(required): an action creator to dispatch an action on successfailureActionCreator
(optional): an action creator to dispatch an action on failuretransform
(optional): this is used to transform the data received from the database before it is passed to the success action creator.
Thanks, @BrunoGodefroy! 🎉*messaging.syncMessages(options)
now takes an option
object as argument (same as *database.sync(path, options)
). Thanks, @BrunoGodefroy! 🎉*messaging.syncToken(options)
now takes an option
object as argument (same as *database.sync(path, options)
). Thanks, @BrunoGodefroy! 🎉*firestore.addDocument(collectionRef, data)
: adds a new document to this collection with the specified data, assigning it a document ID automatically.firestore.channel(pathOrRef, type)
: returns a redux-saga Channel which emits every time the data at pathOrRef in firestore changes.*firestore.deleteDocument(documentRef)
: deletes the document referred to by this DocumentReference.*firestore.getCollection(collectionRef)
: reads the collection referred to by this collectionRef. Thanks, @sarovin! 🎉*firestore.getDocument(docRef)
: reads the document referred to by this documentRef. Thanks, @sarovin! 🎉*firestore.setDocument(docRef, data, options)
: writes to the document referred to by this DocumentReference. If the document does not exist yet, it will be created. If you pass options, the provided data can be merged into the existing document.*firestore.syncCollection(pathOrRef, options)
: automatically dispatches a redux action every time the collection at pathOrRef changes.*firestore.syncDocument(pathOrRef, options)
: automatically dispatches a redux action every time the document at pathOrRef changes.*firestore.updateDocument(docRef, ...args)
: updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist.*messaging.syncMessages(actionCreator)
: automatically dispatches a redux action every time a new message is received.Simpler messaging token management!
*messaging.syncToken(actionCreator)
: automatically dispatches a redux action every time a new registration token is received.Three new authentication features:
*auth.applyActionCode(code)
: applies a verification code sent to the user by email or other out-of-band mechanism. Thanks, @sarovin! 🎉*auth.confirmPasswordReset(code, newPassword)
: completes the password reset process, given a confirmation code and new password. Thanks, @sarovin! 🎉*auth.sendEmailVerification(actionCodeSettings)
: sends a verification email to a user. Thanks, @sarovin! 🎉*auth.sendPasswordResetEmail(email, actionCodeSettings)
: sends a password reset email to the given email address. Thanks, @sarovin! 🎉*auth.updatePassword(password)
: updates the current user's password. Thanks, @sarovin! 🎉*auth.createUserWithEmailAndPassword(email, password)
: creates a new user account associated with the specified email address and password. Thanks, @sarovin! 🎉pathOrRef
argument instead of the previous path
argument. This new argument can be either a string or a Firebase Database Reference. This is not a breaking change. Thanks, @ryansully! 🎉pathOrRef
argument instead of the previous path
argument. This new argument can be either a string or a Firebase Storage Reference. This is not a breaking change. Thanks, @ryansully! 🎉*auth.signInAndRetrieveDataWithCredential(credential)
: login with the given credentials and returns any available additional user information, such as user name.*auth.signInWithCredential(credential)
: login with the given credentials.*auth.signInWithCustomToken(token)
: login with a custom token.*auth.signInWithPhoneNumber(phoneNumber, applicationVerifier)
: login a phone number.*auth.signInWithRedirect(authProvider)
: sign in with an auth provider.*database.sync(path, actionCreator, transform)
: an easy-to-use saga to automatically sync data with your redux store.*rsf.signInAnonymously()
➡️ *rsf.auth.signInAnonymously()
*rsf.signInWithPopup(authProvider)
➡️ *rsf.auth.signInWithPopup(authProvider)
*rsf.logout()
➡️ *rsf.auth.signOut()
rsf.authChannel()
➡️ rsf.auth.channel()
*rsf.get(path)
➡️ *rsf.database.read(path)
*rsf.create(path, data)
➡️ *rsf.database.create(path, data)
*rsf.update(path, data)
➡️ *rsf.database.update(path, data)
*rsf.patch(path, data)
➡️ *rsf.database.patch(path, data)
*rsf.delete(path)
➡️ *rsf.database.delete(path)
rsf.channel(path, event)
➡️ rsf.database.channel(path, event)
*rsf.call(functionName, parameters={})
➡️ *rsf.functions.call(functionName, parameters={})
rsf.messageChannel()
➡️ rsf.messaging.channel()
rsf.tokenRefreshChannel()
➡️ rsf.messaging.tokenRefreshChannel()
rsf.upload(path, file, metadata)
➡️ rsf.storage.uploadFile(path, file, metadata)
rsf.uploadString(path, string, format metadata)
➡️ rsf.storage.uploadString(path, string, format, metadata)
*rsf.getDownloadURL(path)
➡️ *rsf.storage.getDownloadURL(path)
*rsf.getFileMetadata(path)
➡️ *rsf.storage.getFileMetadata(path)
*rsf.updateFileMetadata(path, newMetadata)
➡️ *rsf.storage.updateFileMetadata(path, newMetadata)
*rsf.deleteFile(path)
➡️ *rsf.storage.deleteFile(path)
rsf.database.channel(path, event)
(previously rsf.channel
) returns a channel which now emits objects instead of single values. This is to allow emitting null
or undefined
values.
The objects has two keys:
snapshot
: a firebase.database.DataSnapshot
value
: the result of snapshot.val()
, which is the actual value stored in the database (any type).*rsf.auth.signInWithEmailAndPassword(email, password)
: login with username and password.
Thanks @sarovin! 🎉rsf.upload
and rsf.uploadString
weren't returning UploadTask object as documented. It is now the case.