Skip to content

Releases: CyCraft/magnetar

v1.2.1

03 Jun 16:46
Compare
Choose a tag to compare

see CHANGELOG

05 Oct 10:08
Compare
Choose a tag to compare

Breaking: closing streams

22 Sep 12:52
Compare
Choose a tag to compare

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.

12 May 04:21
Compare
Choose a tag to compare

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

14 Apr 15:57
Compare
Choose a tag to compare

@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 })