Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
cycle-fire
Advanced tools
A Firebase driver for Cycle.js.
import firebaseConfig from './firebaseConfig';
import { button, div, h2, makeDOMDriver } from '@cycle/dom';
import { firebaseActions, makeFirebaseDriver } from 'cycle-fire';
import { run } from '@cycle/run';
function main(sources) {
const action$ = sources.DOM
.select('.shuffle')
.events('click')
.map(() => Math.ceil(Math.random() * 99))
.map(firebaseActions.database.ref('test').set);
const vdom$ = sources.firebase.database
.ref('test')
.value.map(value => div([h2(value), button('.shuffle', 'Shuffle')]));
return {
DOM: vdom$,
firebase: action$
};
}
run(main, {
DOM: makeDOMDriver('Application'),
firebase: makeFirebaseDriver(firebaseConfig)
});
firebaseActions
Write effects to the connected Firebase database are requested by calling an action generator—a function defined on the firebaseActions
object—and passed to the firebase
sink.
firebaseActions: object
containing:
auth: object
containing:
applyActionCode(code: string)
– triggers Auth.applyActionCode
checkActionCode(code: string)
– triggers Auth.checkActionCode
confirmPasswordReset(code: string, newPassword: string)
– triggers Auth.confirmPasswordReset
createUserWithEmailAndPassword(email: string, password: string)
– triggers Auth.createUserWithEmailAndPassword
sendPasswordResetEmail(email: string)
– triggers Auth.sendPasswordResetEmail
setPersistence(persistence: firebase.auth.Auth.Persistence)
– triggers Auth.setPersistence
signInAndRetrieveDataWithCredential(credential: firebase.auth.AuthCredential)
– triggers Auth.signInAndRetrieveDataUsingCredential
signInAnonymously()
– triggers Auth.signInAnonymously
signInWithCredential(credential: firebase.auth.AuthCredential)
– triggers Auth.signInWithCredential
signInWithCustomToken(token: string)
– triggers Auth.signInWithCustomToken
signInWithEmailAndPassword(email: string, password: string)
– triggers Auth.signInWithEmailAndPassword
signInWithPhoneNumber(phoneNumber: string, verifier: firebase.auth.ApplicationVerifier)
– triggers Auth.signInWithPhoneNumber
signInWithPopup(provider: firebase.auth.AuthProvider)
– triggers Auth.signInWithPopup
signInWithRedirect(provider: firebase.auth.AuthProvider)
– triggers Auth.signInWithRedirect
signOut()
– triggers Auth.signOut
user(user: firebase.User): object
containing:
unlink()
– triggers User.unlink
updateEmail(email: string)
– triggers User.updateEmail
updatePassword(password: string)
– triggers User.updatePassword
updatePhoneNumber(phoneNumber: string)
– triggers User.updatePhoneNumber
updateProfile(profile: { displayName: (null|string), photoURL: (null|string) })
– triggers User.updateProfile
verifyPasswordResetCode(code: string)
– triggers Auth.verifyPasswordResetCode
database: object
containing:
goOffline()
– triggers Database.goOffline
goOnline()
– triggers Database.goOnline
ref(path: string) => object
containing:
push(value: any)
– triggers Reference.push
remove()
– triggers Reference.remove
set(value: any)
– triggers Reference.set
setPriority(priority: (null|number|string))
– triggers Reference.setPriority
setWithPriority(value: any, priority: (null|number|string))
– triggers Reference.setWithPriority
transaction(updateFn: (value: any) => any)
– triggers Reference.transaction
update(values: any)
– triggers Reference.update
<action>.as(category: string)
Effectively attaches a category
to the action's result stream, allowing for lookup using the source's select()
.
import { firebaseActions } from 'cycle-fire';
import xs from 'xstream';
function Cycle(sources) {
const setAction = firebaseActions.database
.ref('test')
.set('newValue')
.as('setTestValue');
sources.firebase.select('setTestValue').addListener({
error: err => {
console.error(err);
},
next: response => {
console.log(response);
}
});
return {
firebase: xs.of(setAction)
};
}
makeFirebaseDriver(config, name?)
config: object
apiKey: string
authDomain: string
databaseURL: string
messagingSenderId: string
projectId: string
storageBucket: string
name?: string
Initializes a connection to a Firebase database by calling firebase.initializeApp()
, returning a source object containing the following:
auth: object
containing:
authState: MemoryStream
emitting values from Auth.onAuthStateChanged
currentUser: MemoryStream
emitting changed values of Auth.currentUser
when triggered by Auth.onIdTokenChanged
idToken: MemoryStream
emitting values from Auth.onIdTokenChanged
providersForEmail(email: string): MemoryStream
emitting values from Auth.fetchProvidersForEmail
redirectResult: MemoryStream
emitting values from Auth.getRedirectResult
database: object
containing:
ref(path: string): ReferenceSource
containing:
child(path: string): ReferenceSource
events(eventType: string): MemoryStream
of the ref
's eventType
events, using Reference.on
value: MemoryStream
– a shortcut stream equivalent to events('value')
refFromURL(url: string): ReferenceSource
select(category: string): Stream
of results from action requests that were categorized using <action>.as()
.FAQs
A Firebase driver for Cycle.js
The npm package cycle-fire receives a total of 21 weekly downloads. As such, cycle-fire popularity was classified as not popular.
We found that cycle-fire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.