Releases: CyCraft/magnetar
Releases · CyCraft/magnetar
v1.2.1
see CHANGELOG
Breaking: closing streams
highly improved the way streams can be closed. MUCH easier to use syntax now!!
breaking changes
stream
Before:
magnetar.collection('my-collection').stream()
// close stream:
const closeStream = magnetar.collection('my-collection').openStreams.get(undefined)
closeStream()
After:
magnetar.collection('my-collection').stream()
// close stream:
magnetar.collection('my-collection').closeStream()
See the new docs at: https://magnetar.cycraft.co/docs#stream-realtime-updates
Breaking: update return types for fetch and write actions.
breaking changes
fetch
fetch()
now returns the fetched data immediately:
Before:
const myModule = await magnetar.collection('my-collection').doc('my-doc').fetch()
const data = myModule.data
After:
const data = await magnetar.collection('my-collection').doc('my-doc').fetch()
// or
const myModule = magnetar.collection('my-collection').doc('my-doc')
await myModule.fetch()
const data = myModule.data
merge, assign, replace, deleteProp
Before:
const myModule = await magnetar.collection('my-collection').doc('my-doc').merge({ key: 'value' })
myModule // the same `doc('my-doc')` ref
After:
const newData = await magnetar.collection('my-collection').doc('my-doc').merge({ key: 'value' })
newData // the modified data after `merge()`
delete
Before:
const myModule = await magnetar.collection('my-collection').doc('my-doc').delete()
myModule // the same `doc('my-doc')` ref
After:
const result = await magnetar.collection('my-collection').doc('my-doc').merge({ key: 'value' })
result // undefined
@magnetarjs/plugin-firestore@0.1.0
@magnetarjs/plugin-firestore: 0.1.0
breaking change:
You need to pass Firebase instance now, as opposed to the Firestore instance.
Eg.
// ---------------------------------------------
// 0. Make sure firebase is instantialized BEFORE magnetar
// ---------------------------------------------
import firebase from 'firebase/app'
import 'firebase/firestore'
firebase.initializeApp({
// ...
})
// ---------------------------------------------
// 1. the plugin firestore for remote data store
// ---------------------------------------------
import { CreatePlugin as PluginFirestore } from '@magnetarjs/plugin-firestore'
import firebase from 'firebase/app'
// create the remote store plugin instance:
const remote = PluginFirestore({ firebase })