Comparing version 3.0.0-canary.5d9d78c to 3.0.0-canary.68bbf74
@@ -89,3 +89,3 @@ import DS from 'ember-data'; | ||
* enablePersistence: true, | ||
* persistenceSettings: { experimentalTabSynchronization: true } | ||
* persistenceSettings: { synchronizeTabs: true } | ||
* }); | ||
@@ -111,3 +111,3 @@ * ``` | ||
firebaseApp: Ember.ComputedProperty<FirebaseAppService, FirebaseAppService>; | ||
findRecord<K extends keyof ModelRegistry>(_store: DS.Store, type: ModelRegistry[K], id: string): RSVP.Promise<firestore.DocumentSnapshot>; | ||
findRecord<K extends keyof ModelRegistry>(store: DS.Store, type: ModelRegistry[K], id: string, snapshot: any): RSVP.Promise<firestore.DocumentSnapshot>; | ||
findAll<K extends keyof ModelRegistry>(store: DS.Store, type: ModelRegistry[K]): RSVP.Promise<firestore.QuerySnapshot>; | ||
@@ -120,4 +120,4 @@ findHasMany<K extends keyof ModelRegistry>(store: DS.Store, snapshot: DS.Snapshot<K>, url: string, relationship: { | ||
}): RSVP.Promise<any>; | ||
query<K extends keyof ModelRegistry>(_store: DS.Store, type: ModelRegistry[K], options?: QueryOptions, _recordArray?: DS.AdapterPopulatedRecordArray<any>): RSVP.Promise<firestore.QuerySnapshot>; | ||
queryRecord<K extends keyof ModelRegistry>(_store: DS.Store, type: ModelRegistry[K], options?: QueryOptions | QueryRecordOptions): RSVP.Promise<firestore.DocumentSnapshot>; | ||
query<K extends keyof ModelRegistry>(store: DS.Store, type: ModelRegistry[K], options?: QueryOptions, _recordArray?: DS.AdapterPopulatedRecordArray<any>): RSVP.Promise<firestore.QuerySnapshot>; | ||
queryRecord<K extends keyof ModelRegistry>(store: DS.Store, type: ModelRegistry[K], options?: QueryOptions | QueryRecordOptions): RSVP.Promise<firestore.DocumentSnapshot>; | ||
shouldBackgroundReloadRecord(): boolean; | ||
@@ -157,2 +157,3 @@ updateRecord<K extends keyof ModelRegistry>(_store: DS.Store, type: ModelRegistry[K], snapshot: DS.Snapshot<K>): RSVP.Promise<void>; | ||
}; | ||
export declare const rootCollection: (adapter: FirestoreAdapter, type: any) => RSVP.Promise<firestore.CollectionReference>; | ||
declare module 'ember-data' { | ||
@@ -159,0 +160,0 @@ interface AdapterRegistry { |
@@ -115,2 +115,3 @@ import RSVP from 'rsvp'; | ||
}; | ||
export declare const rootCollection: (adapter: RealtimeDatabaseAdapter, type: any) => RSVP.Promise<database.Reference>; | ||
declare module 'ember-data' { | ||
@@ -117,0 +118,0 @@ interface AdapterRegistry { |
@@ -7,2 +7,3 @@ import DS from 'ember-data'; | ||
import { camelize } from '@ember/string'; | ||
import { resolve } from 'rsvp'; | ||
/** | ||
@@ -30,4 +31,4 @@ * Persist your Ember Data models in Cloud Firestore | ||
}) { | ||
findRecord(_store, type, id) { | ||
return rootCollection(this, type).then(ref => ref.doc(id).get()); | ||
findRecord(store, type, id, snapshot) { | ||
return rootCollection(this, type).then(ref => includeRelationships(ref.doc(id).get(), store, this, snapshot, type)); | ||
} | ||
@@ -58,6 +59,6 @@ findAll(store, type) { | ||
} | ||
query(_store, type, options, _recordArray) { | ||
return rootCollection(this, type).then(collection => queryDocs(collection, queryOptionsToQueryFn(options))); | ||
query(store, type, options, _recordArray) { | ||
return rootCollection(this, type).then(collection => queryDocs(collection, queryOptionsToQueryFn(options))).then(q => includeCollectionRelationships(q, store, this, options, type)); | ||
} | ||
queryRecord(_store, type, options) { | ||
queryRecord(store, type, options) { | ||
return rootCollection(this, type).then((ref) => { | ||
@@ -72,7 +73,8 @@ const queryOrRef = queryRecordOptionsToQueryFn(options)(ref); | ||
else { | ||
return queryOrRef.get(); // TODO fix the types here, they're a little broken | ||
options.id = queryOrRef.id; | ||
return includeRelationships(queryOrRef.get(), store, this, options, type); // TODO fix the types here, they're a little broken | ||
} | ||
}).then((snapshot) => { | ||
if (isQuerySnapshot(snapshot)) { | ||
return snapshot.docs[0]; | ||
return includeRelationships(resolve(snapshot.docs[0]), store, this, options, type); | ||
} | ||
@@ -121,3 +123,3 @@ else { | ||
const getDocs = (query) => query.get(); | ||
const rootCollection = (adapter, type) => getFirestore(adapter).then(firestore => { | ||
export const rootCollection = (adapter, type) => getFirestore(adapter).then(firestore => { | ||
const namespace = get(adapter, 'namespace'); | ||
@@ -202,1 +204,76 @@ const root = namespace ? firestore.doc(namespace) : firestore; | ||
}; | ||
const includeCollectionRelationships = (collection, store, adapter, snapshot, type) => { | ||
if (snapshot && snapshot.include) { | ||
const includes = snapshot.include.split(','); | ||
const relationshipsToInclude = includes.map(e => type.relationshipsByName.get(e)).filter(r => !!r && !r.options.embedded); | ||
return Promise.all(relationshipsToInclude.map(r => { | ||
if (r.meta.kind == 'hasMany') { | ||
return Promise.all(collection.docs.map(d => adapter.findHasMany(store, { id: d.id }, '', r))); | ||
} | ||
else { | ||
const belongsToIds = [...new Set(collection.docs.map(d => d.data()[r.meta.key]).filter(id => !!id))]; | ||
return Promise.all(belongsToIds.map(id => adapter.findBelongsTo(store, { id }, '', r))); | ||
} | ||
})).then(allIncludes => { | ||
relationshipsToInclude.forEach((r, i) => { | ||
const relationship = r.meta; | ||
const pluralKey = pluralize(relationship.key); | ||
const key = relationship.kind == 'belongsTo' ? relationship.key : pluralKey; | ||
const includes = allIncludes[i]; | ||
collection.docs.forEach(doc => { | ||
if (relationship.kind == 'belongsTo') { | ||
const result = includes.find((r) => r.id == doc.data()[key]); | ||
if (result) { | ||
if (!doc._document._included) { | ||
doc._document._included = {}; | ||
} | ||
doc._document._included[key] = result; | ||
} | ||
} | ||
else { | ||
if (!doc._document._included) { | ||
doc._document._included = {}; | ||
} | ||
doc._document._included[pluralKey] = includes; | ||
} | ||
}); | ||
}); | ||
return collection; | ||
}); | ||
} | ||
else { | ||
return resolve(collection); | ||
} | ||
}; | ||
const includeRelationships = (promise, store, adapter, snapshot, type) => { | ||
if (snapshot && snapshot.include) { | ||
const includes = snapshot.include.split(','); | ||
const relationshipsToInclude = includes.map(e => type.relationshipsByName.get(e)).filter(r => !!r && !r.options.embedded); | ||
const hasManyRelationships = relationshipsToInclude.filter(r => r.meta.kind == 'hasMany'); | ||
const belongsToRelationships = relationshipsToInclude.filter(r => r.meta.kind == 'belongsTo'); | ||
return Promise.all([ | ||
promise, | ||
...hasManyRelationships.map(r => adapter.findHasMany(store, snapshot, '', r)) | ||
]).then(([doc, ...includes]) => { | ||
doc._document._included = hasManyRelationships.reduce((c, e, i) => { | ||
c[pluralize(e.key)] = includes[i]; | ||
return c; | ||
}, {}); | ||
return Promise.all([ | ||
resolve(doc), | ||
...belongsToRelationships.filter(r => !!doc.data()[r.meta.key]).map(r => { | ||
return adapter.findBelongsTo(store, { id: doc.data()[r.meta.key] }, '', r); | ||
}) | ||
]); | ||
}).then(([doc, ...includes]) => { | ||
doc._document._included = Object.assign(Object.assign({}, doc._document._included), belongsToRelationships.reduce((c, e, i) => { | ||
c[e.key] = includes[i]; | ||
return c; | ||
}, {})); | ||
return doc; | ||
}); | ||
} | ||
else { | ||
return promise; | ||
} | ||
}; |
@@ -153,3 +153,3 @@ import { pluralize } from 'ember-inflector'; | ||
const collectionNameForType = (type) => pluralize(camelize(typeof (type) === 'string' ? type : type.modelName)); | ||
const rootCollection = (adapter, type) => databaseInstance(adapter).then(database => database.ref([get(adapter, 'namespace'), collectionNameForType(type)].join('/'))); | ||
export const rootCollection = (adapter, type) => databaseInstance(adapter).then(database => database.ref([get(adapter, 'namespace'), collectionNameForType(type)].join('/'))); | ||
const getDocs = (query) => query.once('value').then(value => (value.query = query) && value); | ||
@@ -156,0 +156,0 @@ const docReference = (adapter, type, id) => rootCollection(adapter, type).then(ref => ref.child(id)); |
@@ -1,2 +0,3 @@ | ||
import * as firebase from 'firebase/app'; | ||
// @ts-ignore export for Node problem | ||
import _firebase from 'firebase/app'; | ||
import FirebaseAppService from '../services/firebase-app'; | ||
@@ -8,2 +9,3 @@ import RealtimeListenerService from '../services/realtime-listener'; | ||
import RealtimeDatabaseSerializer from '../serializers/realtime-database'; | ||
const firebase = _firebase; | ||
const initialize = (application) => { | ||
@@ -10,0 +12,0 @@ const environment = application.resolveRegistration('config:environment'); |
import DS from 'ember-data'; | ||
// @ts-ignore | ||
import { singularize } from 'ember-inflector'; | ||
// TODO aside from .data(), key vs. id, metadata, and subcollection this is basicly realtime-database, should refactor to reuse | ||
@@ -9,6 +11,12 @@ export default class FirestoreSerializer extends DS.JSONSerializer { | ||
const meta = extractMeta(payload); | ||
return Object.assign({}, normalize(store, primaryModelClass, payload), { meta }); | ||
let normalized = normalize(store, primaryModelClass, payload); | ||
this.applyTransforms(primaryModelClass, normalized.data.attributes); | ||
return Object.assign(Object.assign({}, normalized), { meta }); | ||
} | ||
normalizeArrayResponse(store, primaryModelClass, payload, _id, _requestType) { | ||
const normalizedPayload = payload.docs.map(snapshot => normalize(store, primaryModelClass, snapshot)); | ||
const normalizedPayload = payload.docs.map(snapshot => { | ||
let normalized = normalize(store, primaryModelClass, snapshot); | ||
this.applyTransforms(primaryModelClass, normalized.data.attributes); | ||
return normalized; | ||
}); | ||
const included = new Array().concat(...normalizedPayload.map(({ included }) => included)); | ||
@@ -20,11 +28,2 @@ const meta = extractMeta(payload); | ||
} | ||
export const normalize = (store, modelClass, snapshot) => { | ||
const id = snapshot.id; | ||
const type = modelClass.modelName; | ||
const _ref = snapshot.ref; | ||
const attributes = Object.assign({}, snapshot.data(), { _ref }); | ||
const { relationships, included } = normalizeRelationships(store, modelClass, attributes); | ||
const data = { id, type, attributes, relationships }; | ||
return { data, included }; | ||
}; | ||
function isQuerySnapshot(arg) { | ||
@@ -36,3 +35,3 @@ return arg.query !== undefined; | ||
const query = snapshot.query; | ||
return Object.assign({}, snapshot.metadata, { query }); | ||
return Object.assign(Object.assign({}, snapshot.metadata), { query }); | ||
} | ||
@@ -47,4 +46,18 @@ else { | ||
modelClass.eachRelationship((key, relationship) => { | ||
const attribute = attributes[key]; | ||
delete attributes[key]; | ||
const attribute = attributes.data()[key]; | ||
const payload = attributes._document && attributes._document._included && attributes._document._included[key]; | ||
if (payload) { | ||
const modelName = singularize(relationship.key); | ||
const modelClass = store.modelFor(modelName); | ||
const serializer = store.serializerFor(modelName); | ||
const { data } = relationship.kind === 'belongsTo' ? serializer.normalizeSingleResponse(store, modelClass, payload) : serializer.normalizeArrayResponse(store, modelClass, payload); | ||
if (Array.isArray(data)) { | ||
data.forEach((r) => { | ||
return included.splice(-1, 0, Object.assign({ links: { self: 'emberfire' } }, r)); | ||
}); | ||
} | ||
else { | ||
included.splice(-1, 0, Object.assign({ links: { self: 'emberfire' } }, data)); | ||
} | ||
} | ||
relationships[key] = normalizeRealtionship(relationship)(store, attribute, relationship, included); | ||
@@ -55,3 +68,3 @@ }, null); | ||
const normalizeRealtionship = (relationship) => { | ||
if (relationship.kind === 'belongsTo') { | ||
if (relationship.kind == 'belongsTo') { | ||
return normalizeBelongsTo; | ||
@@ -90,3 +103,8 @@ } | ||
.map(record => ({ id: record.id, type: record.type })); | ||
return { links: { related: 'emberfire' }, data }; | ||
if (data.length > 0) { | ||
return { links: { related: 'emberfire' }, data }; | ||
} | ||
else { | ||
return { links: { related: 'emberfire' } }; | ||
} | ||
} | ||
@@ -97,2 +115,20 @@ else { | ||
}; | ||
const normalizeHasMany = (_store, _attribute, _relationship, _included) => ({ links: { related: 'emberfire' } }); | ||
const normalizeHasMany = (_store, _payload, relationship, included) => { | ||
const relevantIncluded = included.filter(i => i.type == singularize(relationship.key)); | ||
const data = relevantIncluded.map((r) => ({ type: r.type, id: r.id })); | ||
if (data.length > 0) { | ||
return { links: { related: 'emberfire' }, data }; | ||
} | ||
else { | ||
return { links: { related: 'emberfire' } }; | ||
} | ||
}; | ||
export const normalize = (store, modelClass, snapshot) => { | ||
const id = snapshot.id; | ||
const type = modelClass.modelName; | ||
const _ref = snapshot.ref; | ||
const attributes = Object.assign(Object.assign({}, snapshot.data()), { _ref }); | ||
const { relationships, included } = normalizeRelationships(store, modelClass, snapshot); | ||
const data = { id, type, attributes, relationships }; | ||
return { data, included }; | ||
}; |
@@ -7,13 +7,17 @@ import DS from 'ember-data'; | ||
} | ||
return normalize(store, primaryModelClass, payload); | ||
let normalized = normalize(store, primaryModelClass, payload); | ||
this.applyTransforms(primaryModelClass, normalized.data.attributes); | ||
return normalized; | ||
} | ||
normalizeArrayResponse(store, primaryModelClass, payload, _id, _requestType) { | ||
const noramlizedRecords = []; | ||
const embeddedRecords = []; | ||
const normalizedPayload = []; | ||
payload.forEach(snapshot => { | ||
const { data, included } = normalize(store, primaryModelClass, snapshot); | ||
noramlizedRecords.push(data); | ||
Object.assign(embeddedRecords, [...embeddedRecords, ...included]); | ||
let normalized = normalize(store, primaryModelClass, snapshot); | ||
this.applyTransforms(primaryModelClass, normalized.data.attributes); | ||
normalizedPayload.push(normalized); | ||
}); | ||
return { data: noramlizedRecords, included: embeddedRecords, meta: { query: payload.query || payload.ref } }; | ||
const included = new Array().concat(...normalizedPayload.map(({ included }) => included)); | ||
const meta = { query: payload.query || payload.ref }; | ||
const data = normalizedPayload.map(({ data }) => data); | ||
return { data, included, meta }; | ||
} | ||
@@ -24,3 +28,3 @@ } | ||
const type = modelClass.modelName; | ||
const attributes = Object.assign({}, snapshot.val(), { _ref: snapshot.ref }); | ||
const attributes = Object.assign(Object.assign({}, snapshot.val()), { _ref: snapshot.ref }); | ||
const { relationships, included } = normalizeRelationships(store, modelClass, attributes); | ||
@@ -27,0 +31,0 @@ const data = { id, type, attributes, relationships }; |
@@ -6,9 +6,2 @@ import Service from '@ember/service'; | ||
const { resolve } = RSVP; | ||
// TODO move these over to dynamic imports | ||
import 'firebase/auth'; | ||
import 'firebase/database'; | ||
import 'firebase/firestore'; | ||
import 'firebase/functions'; | ||
import 'firebase/messaging'; | ||
import 'firebase/storage'; | ||
const getApp = (service) => { | ||
@@ -26,11 +19,15 @@ const firebase = get(service, 'firebase'); | ||
this.delete = () => getApp(this).delete(); | ||
this.auth = () => resolve(getApp(this).auth()); | ||
this.database = (databaseURL) => resolve(getApp(this).database(databaseURL)); | ||
this.firestore = () => resolve(getApp(this).firestore()); | ||
this.functions = (region) => resolve(getApp(this).functions(region)); | ||
this.messaging = () => resolve(getApp(this).messaging()); | ||
this.storage = (storageBucket) => resolve(getApp(this).storage(storageBucket)); | ||
this.auth = () => resolve(import('firebase/auth')).then(() => getApp(this).auth()); | ||
this.analytics = () => resolve(import('firebase/analytics')).then(() => getApp(this).analytics()); | ||
this.firestore = () => resolve(import('firebase/firestore')).then(() => getApp(this).firestore()); | ||
this.messaging = () => resolve(import('firebase/messaging')).then(() => getApp(this).messaging()); | ||
this.performance = () => resolve(import('firebase/performance')).then(() => getApp(this).performance()); | ||
this.remoteConfig = () => resolve(import('firebase/remote-config')).then(() => getApp(this).remoteConfig()); | ||
this.database = (url) => resolve(import('firebase/database')).then(() => getApp(this).database(url)); | ||
this.functions = (region) => resolve(import('firebase/functions')).then(() => getApp(this).functions(region)); | ||
this.storage = (url) => resolve(import('firebase/storage')).then(() => getApp(this).storage(url)); | ||
} | ||
init() { | ||
this._super(...arguments); | ||
init(...args) { | ||
// @ts-ignore because ember do pass arguments here | ||
super.init(...args); | ||
const app = getApp(this); | ||
@@ -37,0 +34,0 @@ set(this, 'options', app.options); |
@@ -1,3 +0,5 @@ | ||
import * as firebase from 'firebase/app'; | ||
// @ts-ignore Node.js issues | ||
import _firebase from 'firebase/app'; | ||
import Service from '@ember/service'; | ||
const firebase = _firebase; | ||
export default class FirebaseService extends Service { | ||
@@ -4,0 +6,0 @@ constructor() { |
@@ -6,4 +6,4 @@ import Service from '@ember/service'; | ||
// TODO don't hardcode these, but having trouble otherwise | ||
import { normalize as firestoreNormalize } from '../serializers/firestore'; | ||
import { normalize as databaseNormalize } from '../serializers/realtime-database'; | ||
import { rootCollection as firestoreRootCollection } from '../adapters/firestore'; | ||
import { rootCollection as realtimeDatabaseRootCollection } from '../adapters/realtime-database'; | ||
const getService = (object) => getOwner(object).lookup('service:realtime-listener'); | ||
@@ -15,16 +15,35 @@ const isFastboot = (object) => { | ||
export const subscribe = (route, model) => !isFastboot(route) && getService(route).subscribe(route, model); | ||
export const unsubscribe = (route) => !isFastboot(route) && getService(route).unsubscribe(route); | ||
const setRouteSubscription = (service, route, unsubscribe) => { | ||
export const unsubscribe = (route, model) => !isFastboot(route) && getService(route).unsubscribe(route, model); | ||
const setRouteSubscription = (service, route, uniqueIdentifier, unsubscribe) => { | ||
const routeSubscriptions = get(service, `routeSubscriptions`); | ||
const existingSubscription = get(routeSubscriptions, route.toString()); | ||
if (existingSubscription) { | ||
existingSubscription(); | ||
const existingSubscriptions = routeSubscriptions[route.toString()]; | ||
if (existingSubscriptions) { | ||
const existingSubscription = existingSubscriptions[uniqueIdentifier]; | ||
if (existingSubscription) { | ||
existingSubscription(); | ||
} | ||
} | ||
if (unsubscribe) { | ||
routeSubscriptions[route.toString()] = unsubscribe; | ||
} | ||
else { | ||
delete routeSubscriptions[route.toString()]; | ||
routeSubscriptions[route.toString()] = {}; | ||
} | ||
routeSubscriptions[route.toString()][uniqueIdentifier] = unsubscribe; | ||
}; | ||
const unsubscribeRoute = (service, route, uniqueIdentifier) => { | ||
const routeSubscriptions = get(service, `routeSubscriptions`); | ||
const existingSubscriptions = get(routeSubscriptions, route.toString()); | ||
if (existingSubscriptions) { | ||
if (uniqueIdentifier) { | ||
if (existingSubscriptions[uniqueIdentifier]) { | ||
existingSubscriptions[uniqueIdentifier](); | ||
delete existingSubscriptions[uniqueIdentifier]; | ||
} | ||
} | ||
else { | ||
Object.keys(existingSubscriptions).forEach(key => { | ||
existingSubscriptions[key](); | ||
}); | ||
delete routeSubscriptions[route.toString()]; | ||
} | ||
} | ||
}; | ||
function isFirestoreQuery(arg) { | ||
@@ -45,106 +64,16 @@ return arg.onSnapshot !== undefined; | ||
const ref = model.get('_internalModel._recordData._data._ref'); | ||
const uniqueIdentifier = model.toString(); | ||
const serializer = store.serializerFor(modelName); // TODO type | ||
const adapter = store.adapterFor(modelName); | ||
const args = { model, store, modelName, modelClass, uniqueIdentifier, serializer, adapter }; | ||
if (query) { | ||
if (isFirestoreQuery(query)) { | ||
const unsubscribe = query.onSnapshot(snapshot => { | ||
snapshot.docChanges().forEach(change => run(() => { | ||
const normalizedData = firestoreNormalize(store, modelClass, change.doc); | ||
switch (change.type) { | ||
case 'added': { | ||
const current = model.content.objectAt(change.newIndex); | ||
if (current == null || current.id !== change.doc.id) { | ||
const doc = store.push(normalizedData); | ||
model.content.insertAt(change.newIndex, doc._internalModel); | ||
} | ||
break; | ||
} | ||
case 'modified': { | ||
const current = model.content.objectAt(change.oldIndex); | ||
if (current == null || current.id == change.doc.id) { | ||
if (change.newIndex !== change.oldIndex) { | ||
model.content.removeAt(change.oldIndex); | ||
model.content.insertAt(change.newIndex, current); | ||
} | ||
} | ||
store.push(normalizedData); | ||
break; | ||
} | ||
case 'removed': { | ||
const current = model.content.objectAt(change.oldIndex); | ||
if (current && current.id == change.doc.id) { | ||
model.content.removeAt(change.oldIndex); | ||
} | ||
break; | ||
} | ||
} | ||
})); | ||
}); | ||
setRouteSubscription(this, route, unsubscribe); | ||
// Firestore query | ||
const unsubscribe = runFirestoreCollectionListener(Object.assign({ query }, args)); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
} | ||
else { | ||
const onChildAdded = query.on('child_added', (snapshot, priorKey) => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = databaseNormalize(store, modelClass, snapshot); | ||
const doc = store.push(normalizedData); | ||
const existing = model.content.find((record) => record.id === doc.id); | ||
if (existing) { | ||
model.content.removeObject(existing); | ||
} | ||
let insertIndex = 0; | ||
if (priorKey) { | ||
const record = model.content.find((record) => record.id === priorKey); | ||
insertIndex = model.content.indexOf(record) + 1; | ||
} | ||
const current = model.content.objectAt(insertIndex); | ||
if (current == null || current.id !== doc.id) { | ||
model.content.insertAt(insertIndex, doc._internalModel); | ||
} | ||
} | ||
}); | ||
}); | ||
const onChildRemoved = query.on('child_removed', snapshot => { | ||
run(() => { | ||
if (snapshot) { | ||
const record = model.content.find((record) => record.id === snapshot.key); | ||
if (record) { | ||
model.content.removeObject(record); | ||
} | ||
} | ||
}); | ||
}); | ||
const onChildChanged = query.on('child_changed', snapshot => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = databaseNormalize(store, modelClass, snapshot); | ||
store.push(normalizedData); | ||
} | ||
}); | ||
}); | ||
const onChildMoved = query.on('child_moved', (snapshot, priorKey) => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = databaseNormalize(store, modelClass, snapshot); | ||
const doc = store.push(normalizedData); | ||
const existing = model.content.find((record) => record.id === doc.id); | ||
if (existing) { | ||
model.content.removeObject(existing); | ||
} | ||
if (priorKey) { | ||
const record = model.content.find((record) => record.id === priorKey); | ||
const index = model.content.indexOf(record); | ||
model.content.insertAt(index + 1, doc._internalModel); | ||
} | ||
else { | ||
model.content.insertAt(0, doc._internalModel); | ||
} | ||
} | ||
}); | ||
}); | ||
const unsubscribe = () => { | ||
query.off('child_added', onChildAdded); | ||
query.off('child_removed', onChildRemoved); | ||
query.off('child_changed', onChildChanged); | ||
query.off('child_moved', onChildMoved); | ||
}; | ||
setRouteSubscription(this, route, unsubscribe); | ||
// RTDB query | ||
const unsubscribe = runRealtimeDatabaseListListener(Object.assign({ ref: query }, args)); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
} | ||
@@ -154,11 +83,13 @@ } | ||
if (isFirestoreDocumentRefernce(ref)) { | ||
// Firestore find | ||
const unsubscribe = ref.onSnapshot(doc => { | ||
run(() => { | ||
const normalizedData = firestoreNormalize(store, modelClass, doc); | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, doc); | ||
store.push(normalizedData); | ||
}); | ||
}); | ||
setRouteSubscription(this, route, unsubscribe); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
} | ||
else { | ||
// RTDB find | ||
const listener = ref.on('value', snapshot => { | ||
@@ -168,3 +99,3 @@ run(() => { | ||
if (snapshot.exists()) { | ||
const normalizedData = databaseNormalize(store, modelClass, snapshot); | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, snapshot); | ||
store.push(normalizedData); | ||
@@ -182,9 +113,130 @@ } | ||
const unsubscribe = () => ref.off('value', listener); | ||
setRouteSubscription(this, route, unsubscribe); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
} | ||
} | ||
else { | ||
// findAll ditches the metadata :( | ||
if (serializer.constructor.name == 'FirestoreSerializer') { | ||
// Firestore findAll | ||
firestoreRootCollection(adapter, modelName).then(query => { | ||
const unsubscribe = runFirestoreCollectionListener(Object.assign({ query }, args)); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
}); | ||
} | ||
else if (serializer.constructor.name == 'RealtimeDatabaseSerializer') { | ||
// RTDB findAll | ||
realtimeDatabaseRootCollection(adapter, modelName).then(ref => { | ||
const unsubscribe = runRealtimeDatabaseListListener(Object.assign({ ref }, args)); | ||
setRouteSubscription(this, route, uniqueIdentifier, unsubscribe); | ||
}); | ||
} | ||
} | ||
} | ||
unsubscribe(route) { | ||
setRouteSubscription(this, route, null); | ||
unsubscribe(route, model) { | ||
unsubscribeRoute(this, route, model && model.toString()); | ||
} | ||
} | ||
const runFirestoreCollectionListener = ({ query, model, store, serializer, modelClass }) => { | ||
const unsubscribe = query.onSnapshot(snapshot => { | ||
snapshot.docChanges().forEach(change => run(() => { | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, change.doc); | ||
switch (change.type) { | ||
case 'added': { | ||
const current = model.content.objectAt(change.newIndex); | ||
if (current == null || current.id !== change.doc.id) { | ||
const doc = store.push(normalizedData); | ||
model.content.insertAt(change.newIndex, doc._internalModel); | ||
} | ||
break; | ||
} | ||
case 'modified': { | ||
const current = model.content.objectAt(change.oldIndex); | ||
if (current == null || current.id == change.doc.id) { | ||
if (change.newIndex !== change.oldIndex) { | ||
model.content.removeAt(change.oldIndex); | ||
model.content.insertAt(change.newIndex, current); | ||
} | ||
} | ||
store.push(normalizedData); | ||
break; | ||
} | ||
case 'removed': { | ||
const current = model.content.objectAt(change.oldIndex); | ||
if (current && current.id == change.doc.id) { | ||
model.content.removeAt(change.oldIndex); | ||
} | ||
break; | ||
} | ||
} | ||
})); | ||
}); | ||
return unsubscribe; | ||
}; | ||
const runRealtimeDatabaseListListener = ({ model, ref, serializer, store, modelClass }) => { | ||
const onChildAdded = ref.on('child_added', (snapshot, priorKey) => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, snapshot); | ||
const doc = store.push(normalizedData); | ||
const existing = model.content.find((record) => record.id === doc.id); | ||
if (existing) { | ||
model.content.removeObject(existing); | ||
} | ||
let insertIndex = 0; | ||
if (priorKey) { | ||
const record = model.content.find((record) => record.id === priorKey); | ||
insertIndex = model.content.indexOf(record) + 1; | ||
} | ||
const current = model.content.objectAt(insertIndex); | ||
if (current == null || current.id !== doc.id) { | ||
model.content.insertAt(insertIndex, doc._internalModel); | ||
} | ||
} | ||
}); | ||
}); | ||
const onChildRemoved = ref.on('child_removed', snapshot => { | ||
run(() => { | ||
if (snapshot) { | ||
const record = model.content.find((record) => record.id === snapshot.key); | ||
if (record) { | ||
model.content.removeObject(record); | ||
} | ||
} | ||
}); | ||
}); | ||
const onChildChanged = ref.on('child_changed', snapshot => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, snapshot); | ||
store.push(normalizedData); | ||
} | ||
}); | ||
}); | ||
const onChildMoved = ref.on('child_moved', (snapshot, priorKey) => { | ||
run(() => { | ||
if (snapshot) { | ||
const normalizedData = serializer.normalizeSingleResponse(store, modelClass, snapshot); | ||
const doc = store.push(normalizedData); | ||
const existing = model.content.find((record) => record.id === doc.id); | ||
if (existing) { | ||
model.content.removeObject(existing); | ||
} | ||
if (priorKey) { | ||
const record = model.content.find((record) => record.id === priorKey); | ||
const index = model.content.indexOf(record); | ||
model.content.insertAt(index + 1, doc._internalModel); | ||
} | ||
else { | ||
model.content.insertAt(0, doc._internalModel); | ||
} | ||
} | ||
}); | ||
}); | ||
const unsubscribe = () => { | ||
ref.off('child_added', onChildAdded); | ||
ref.off('child_removed', onChildRemoved); | ||
ref.off('child_changed', onChildChanged); | ||
ref.off('child_moved', onChildMoved); | ||
}; | ||
return unsubscribe; | ||
}; |
@@ -6,3 +6,3 @@ import FirestoreAdapter from 'emberfire/adapters/firestore'; | ||
// enablePersistence: true, | ||
// persistenceSettings: { experimentalTabSynchronization: true } | ||
// persistenceSettings: { synchronizeTabs: true } | ||
}); |
@@ -16,3 +16,3 @@ /* eslint-env node */ | ||
return RSVP.all([ | ||
this.addPackageToProject('firebase', '^5.1.0'), | ||
this.addPackageToProject('firebase', '^6.0.3'), | ||
this.addAddonToProject('ember-auto-import', '^1.0.0') | ||
@@ -19,0 +19,0 @@ ]); |
@@ -154,2 +154,3 @@ # Authentication | ||
1. **User Authentication** | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -156,0 +157,0 @@ 1. [Querying Data](querying-data.md) |
@@ -7,2 +7,3 @@ # Deploying to Cloud Functions for Firebase | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -9,0 +10,0 @@ 1. [Querying Data](querying-data.md) |
@@ -46,2 +46,3 @@ # Deploying to Firebase Hosting | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -48,0 +49,0 @@ 1. [Querying Data](querying-data.md) |
@@ -7,2 +7,3 @@ # Fastboot Support | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -9,0 +10,0 @@ 1. [Querying Data](querying-data.md) |
@@ -31,3 +31,3 @@ # Integrating Firebase | ||
// enablePersistence: true, | ||
// persistenceSettings: { experimentalTabSynchronization: true } | ||
// persistenceSettings: { synchronizeTabs: true } | ||
}); | ||
@@ -66,2 +66,3 @@ ``` | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -68,0 +69,0 @@ 1. [Querying Data](querying-data.md) |
@@ -97,2 +97,3 @@ # Querying Data | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -99,0 +100,0 @@ 1. **Querying Data** |
@@ -5,2 +5,3 @@ # EmberFire Guide | ||
1. [User Authentication](authentication.md) - EmberFire handles user authentication and session management for you. | ||
1. [Collect Analytics](analytics.md) - Collect Google Analytics data automatically on Route changes. | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) - Create synchronized objects and experience three-way data binding. | ||
@@ -7,0 +8,0 @@ 1. [Querying Data](querying-data.md) - Create and modify arrays which stay in sync with the database. |
@@ -35,2 +35,3 @@ # Relationships | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -37,0 +38,0 @@ 1. [Querying Data](querying-data.md) |
@@ -114,2 +114,3 @@ # Saving and retrieving data | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. **Saving and Retrieving Data** | ||
@@ -116,0 +117,0 @@ 1. [Querying Data](querying-data.md) |
@@ -10,2 +10,3 @@ # Security Rules | ||
1. [User Authentication](authentication.md) | ||
1. [Collect Analytics](analytics.md) | ||
1. [Saving and Retrieving Data](saving-and-retrieving-data.md) | ||
@@ -12,0 +13,0 @@ 1. [Querying Data](querying-data.md) |
@@ -31,3 +31,3 @@ # 1. Create an account | ||
// enablePersistence: true, | ||
// persistenceSettings: { experimentalTabSynchronization: true } | ||
// persistenceSettings: { synchronizeTabs: true } | ||
}); | ||
@@ -34,0 +34,0 @@ ``` |
@@ -21,2 +21,3 @@ [EmberFire](../README.md) > [FirebaseAppService](../classes/firebaseappservice.md) | ||
* [analytics](firebaseappservice.md#analytics) | ||
* [auth](firebaseappservice.md#auth) | ||
@@ -29,2 +30,4 @@ * [database](firebaseappservice.md#database) | ||
* [messaging](firebaseappservice.md#messaging) | ||
* [performance](firebaseappservice.md#performance) | ||
* [remoteConfig](firebaseappservice.md#remoteconfig) | ||
* [storage](firebaseappservice.md#storage) | ||
@@ -42,3 +45,3 @@ | ||
*Defined in services/firebase-app.ts:35* | ||
*Defined in services/firebase-app.ts:24* | ||
@@ -52,3 +55,3 @@ ___ | ||
*Defined in services/firebase-app.ts:35* | ||
*Defined in services/firebase-app.ts:24* | ||
@@ -62,3 +65,3 @@ ___ | ||
*Defined in services/firebase-app.ts:37* | ||
*Defined in services/firebase-app.ts:26* | ||
@@ -69,2 +72,13 @@ ___ | ||
<a id="analytics"></a> | ||
### analytics | ||
▸ **analytics**(): `Promise`<`Analytics`> | ||
*Defined in services/firebase-app.ts:31* | ||
**Returns:** `Promise`<`Analytics`> | ||
___ | ||
<a id="auth"></a> | ||
@@ -76,3 +90,3 @@ | ||
*Defined in services/firebase-app.ts:40* | ||
*Defined in services/firebase-app.ts:30* | ||
@@ -86,5 +100,5 @@ **Returns:** `Promise`<`Auth`> | ||
▸ **database**(databaseURL?: *`undefined` \| `string`*): `Promise`<`Database`> | ||
▸ **database**(url?: *`undefined` \| `string`*): `Promise`<`Database`> | ||
*Defined in services/firebase-app.ts:41* | ||
*Defined in services/firebase-app.ts:37* | ||
@@ -95,3 +109,3 @@ **Parameters:** | ||
| ------ | ------ | | ||
| `Optional` databaseURL | `undefined` \| `string` | | ||
| `Optional` url | `undefined` \| `string` | | ||
@@ -107,3 +121,3 @@ **Returns:** `Promise`<`Database`> | ||
*Defined in services/firebase-app.ts:39* | ||
*Defined in services/firebase-app.ts:28* | ||
@@ -119,3 +133,3 @@ **Returns:** `Promise`<`any`> | ||
*Defined in services/firebase-app.ts:42* | ||
*Defined in services/firebase-app.ts:32* | ||
@@ -131,3 +145,3 @@ **Returns:** `Promise`<`Firestore`> | ||
*Defined in services/firebase-app.ts:43* | ||
*Defined in services/firebase-app.ts:38* | ||
@@ -147,6 +161,12 @@ **Parameters:** | ||
▸ **init**(): `void` | ||
▸ **init**(...args: *`any`[]*): `void` | ||
*Defined in services/firebase-app.ts:47* | ||
*Defined in services/firebase-app.ts:41* | ||
**Parameters:** | ||
| Name | Type | | ||
| ------ | ------ | | ||
| `Rest` args | `any`[] | | ||
**Returns:** `void` | ||
@@ -161,3 +181,3 @@ | ||
*Defined in services/firebase-app.ts:44* | ||
*Defined in services/firebase-app.ts:33* | ||
@@ -167,2 +187,24 @@ **Returns:** `Promise`<`Messaging`> | ||
___ | ||
<a id="performance"></a> | ||
### performance | ||
▸ **performance**(): `Promise`<`Performance`> | ||
*Defined in services/firebase-app.ts:34* | ||
**Returns:** `Promise`<`Performance`> | ||
___ | ||
<a id="remoteconfig"></a> | ||
### remoteConfig | ||
▸ **remoteConfig**(): `Promise`<`RemoteConfig`> | ||
*Defined in services/firebase-app.ts:35* | ||
**Returns:** `Promise`<`RemoteConfig`> | ||
___ | ||
<a id="storage"></a> | ||
@@ -172,5 +214,5 @@ | ||
▸ **storage**(storageBucket?: *`undefined` \| `string`*): `Promise`<`Storage`> | ||
▸ **storage**(url?: *`undefined` \| `string`*): `Promise`<`Storage`> | ||
*Defined in services/firebase-app.ts:45* | ||
*Defined in services/firebase-app.ts:39* | ||
@@ -181,3 +223,3 @@ **Parameters:** | ||
| ------ | ------ | | ||
| `Optional` storageBucket | `undefined` \| `string` | | ||
| `Optional` url | `undefined` \| `string` | | ||
@@ -184,0 +226,0 @@ **Returns:** `Promise`<`Storage`> |
@@ -32,3 +32,3 @@ [EmberFire](../README.md) > [FirebaseService](../classes/firebaseservice.md) | ||
*Defined in services/firebase.ts:7* | ||
*Defined in services/firebase.ts:10* | ||
@@ -45,3 +45,3 @@ ___ | ||
*Defined in services/firebase.ts:6* | ||
*Defined in services/firebase.ts:9* | ||
@@ -63,3 +63,3 @@ **Parameters:** | ||
*Defined in services/firebase.ts:8* | ||
*Defined in services/firebase.ts:11* | ||
@@ -66,0 +66,0 @@ **Parameters:** |
@@ -126,3 +126,3 @@ [EmberFire](../README.md) > [FirestoreAdapter](../classes/firestoreadapter.md) | ||
enablePersistence: true, | ||
persistenceSettings: { experimentalTabSynchronization: true } | ||
persistenceSettings: { synchronizeTabs: true } | ||
}); | ||
@@ -161,3 +161,3 @@ ``` | ||
*Defined in adapters/firestore.ts:181* | ||
*Defined in adapters/firestore.ts:186* | ||
@@ -184,3 +184,3 @@ **Type parameters:** | ||
*Defined in adapters/firestore.ts:192* | ||
*Defined in adapters/firestore.ts:197* | ||
@@ -207,3 +207,3 @@ **Type parameters:** | ||
*Defined in adapters/firestore.ts:124* | ||
*Defined in adapters/firestore.ts:126* | ||
@@ -229,3 +229,3 @@ **Type parameters:** | ||
*Defined in adapters/firestore.ts:139* | ||
*Defined in adapters/firestore.ts:141* | ||
@@ -253,3 +253,3 @@ **Type parameters:** | ||
*Defined in adapters/firestore.ts:128* | ||
*Defined in adapters/firestore.ts:130* | ||
@@ -275,3 +275,3 @@ **Type parameters:** | ||
▸ **findRecord**<`K`>(_store: *`Store`*, type: *`ModelRegistry[K]`*, id: *`string`*): `Promise`<`DocumentSnapshot`> | ||
▸ **findRecord**<`K`>(store: *`Store`*, type: *`ModelRegistry[K]`*, id: *`string`*, snapshot: *`any`*): `Promise`<`DocumentSnapshot`> | ||
@@ -287,5 +287,6 @@ *Defined in adapters/firestore.ts:120* | ||
| ------ | ------ | | ||
| _store | `Store` | | ||
| store | `Store` | | ||
| type | `ModelRegistry[K]` | | ||
| id | `string` | | ||
| snapshot | `any` | | ||
@@ -299,5 +300,5 @@ **Returns:** `Promise`<`DocumentSnapshot`> | ||
▸ **query**<`K`>(_store: *`Store`*, type: *`ModelRegistry[K]`*, options?: *[QueryOptions](../#queryoptions)*, _recordArray?: *`DS.AdapterPopulatedRecordArray`<`any`>*): `Promise`<`QuerySnapshot`> | ||
▸ **query**<`K`>(store: *`Store`*, type: *`ModelRegistry[K]`*, options?: *[QueryOptions](../#queryoptions)*, _recordArray?: *`DS.AdapterPopulatedRecordArray`<`any`>*): `Promise`<`QuerySnapshot`> | ||
*Defined in adapters/firestore.ts:148* | ||
*Defined in adapters/firestore.ts:150* | ||
@@ -311,3 +312,3 @@ **Type parameters:** | ||
| ------ | ------ | | ||
| _store | `Store` | | ||
| store | `Store` | | ||
| type | `ModelRegistry[K]` | | ||
@@ -324,5 +325,5 @@ | `Optional` options | [QueryOptions](../#queryoptions) | | ||
▸ **queryRecord**<`K`>(_store: *`Store`*, type: *`ModelRegistry[K]`*, options?: *[QueryOptions](../#queryoptions) \| [QueryRecordOptions](../#queryrecordoptions)*): `Promise`<`DocumentSnapshot`> | ||
▸ **queryRecord**<`K`>(store: *`Store`*, type: *`ModelRegistry[K]`*, options?: *[QueryOptions](../#queryoptions) \| [QueryRecordOptions](../#queryrecordoptions)*): `Promise`<`QueryDocumentSnapshot`> | ||
*Defined in adapters/firestore.ts:152* | ||
*Defined in adapters/firestore.ts:156* | ||
@@ -336,7 +337,7 @@ **Type parameters:** | ||
| ------ | ------ | | ||
| _store | `Store` | | ||
| store | `Store` | | ||
| type | `ModelRegistry[K]` | | ||
| `Optional` options | [QueryOptions](../#queryoptions) \| [QueryRecordOptions](../#queryrecordoptions) | | ||
**Returns:** `Promise`<`DocumentSnapshot`> | ||
**Returns:** `Promise`<`QueryDocumentSnapshot`> | ||
@@ -350,3 +351,3 @@ ___ | ||
*Defined in adapters/firestore.ts:170* | ||
*Defined in adapters/firestore.ts:175* | ||
@@ -362,3 +363,3 @@ **Returns:** `boolean` | ||
*Defined in adapters/firestore.ts:174* | ||
*Defined in adapters/firestore.ts:179* | ||
@@ -365,0 +366,0 @@ **Type parameters:** |
@@ -15,2 +15,3 @@ [EmberFire](../README.md) > [FirestoreSerializer](../classes/firestoreserializer.md) | ||
* [applyTransforms](firestoreserializer.md#applytransforms) | ||
* [attrs](firestoreserializer.md#attrs) | ||
@@ -62,2 +63,23 @@ * [primaryKey](firestoreserializer.md#primarykey) | ||
<a id="applytransforms"></a> | ||
### applyTransforms | ||
**● applyTransforms**: *`function`* | ||
*Defined in serializers/firestore.ts:13* | ||
#### Type declaration | ||
▸(a: *`Model`*, b: *`any`*): `void` | ||
**Parameters:** | ||
| Name | Type | | ||
| ------ | ------ | | ||
| a | `Model` | | ||
| b | `any` | | ||
**Returns:** `void` | ||
___ | ||
<a id="attrs"></a> | ||
@@ -71,3 +93,3 @@ | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1576* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1591* | ||
@@ -85,3 +107,3 @@ The `attrs` object can be used to declare a simple mapping between property names on `DS.Model` records and payload keys in the serialized JSON object representing the record. An object with the property `key` can also be used to designate the attribute's key on the response payload. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1568* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1583* | ||
@@ -99,3 +121,3 @@ The `primaryKey` is used when serializing and deserializing data. Ember Data always uses the `id` property to store the id of the record. The external source may not always follow this convention. In these cases it is useful to override the `primaryKey` property to match the `primaryKey` of your external store. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:2142* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:2157* | ||
@@ -116,3 +138,3 @@ The `store` property is the application's `store` that contains all records. It can be used to look up serializers for other model types that may be nested inside the payload response. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1692* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1707* | ||
@@ -139,3 +161,3 @@ Returns the resource's attributes formatted as a JSON-API "attributes object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1794* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1809* | ||
@@ -164,3 +186,3 @@ `extractErrors` is used to extract model errors when a call to `DS.Model#save` fails with an `InvalidError`. By default Ember Data expects error information to be located on the `errors` property of the payload object. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1688* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1703* | ||
@@ -187,3 +209,3 @@ Returns the resource's ID. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1787* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1802* | ||
@@ -211,3 +233,3 @@ `extractMeta` is used to deserialize any meta information in the adapter payload. By default Ember Data expects meta information to be located on the `meta` property of the payload object. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1703* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1718* | ||
@@ -235,3 +257,3 @@ Returns a polymorphic relationship formatted as a JSON-API "relationship object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1696* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1711* | ||
@@ -258,3 +280,3 @@ Returns a relationship formatted as a JSON-API "relationship object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1711* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1726* | ||
@@ -281,3 +303,3 @@ Returns the resource's relationships formatted as a JSON-API "relationships object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1804* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1819* | ||
@@ -304,3 +326,3 @@ `keyForAttribute` can be used to define rules for how to convert an attribute name in your model to a key in your JSON. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1819* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1834* | ||
@@ -327,3 +349,3 @@ `keyForLink` can be used to define a custom key when deserializing link properties. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1810* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1825* | ||
@@ -351,3 +373,3 @@ `keyForRelationship` can be used to define a custom key when serializing and deserializing relationship properties. By default `JSONSerializer` does not provide an implementation of this method. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1712* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1727* | ||
@@ -371,3 +393,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1820* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1835* | ||
@@ -393,3 +415,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1684* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1699* | ||
@@ -416,3 +438,3 @@ Normalizes a part of the JSON payload returned by the server. You should override this method, munge the hash and call super if you have generic normalization to do. | ||
*Defined in serializers/firestore.ts:16* | ||
*Defined in serializers/firestore.ts:23* | ||
@@ -440,3 +462,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1637* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1652* | ||
@@ -464,3 +486,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1644* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1659* | ||
@@ -488,3 +510,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1602* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1617* | ||
@@ -512,3 +534,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1609* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1624* | ||
@@ -536,3 +558,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1616* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1631* | ||
@@ -560,3 +582,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1623* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1638* | ||
@@ -584,3 +606,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1588* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1603* | ||
@@ -608,3 +630,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1595* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1610* | ||
@@ -632,3 +654,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1630* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1645* | ||
@@ -658,3 +680,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1581* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1596* | ||
@@ -684,3 +706,3 @@ The `normalizeResponse` method is used to normalize a payload from the server to a JSON-API Document. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1658* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1673* | ||
@@ -708,3 +730,3 @@ **Parameters:** | ||
*Defined in serializers/firestore.ts:10* | ||
*Defined in serializers/firestore.ts:15* | ||
@@ -732,3 +754,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1651* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1666* | ||
@@ -758,3 +780,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1725* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1740* | ||
@@ -784,3 +806,3 @@ Called when a record is saved in order to convert the record into JSON. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1747* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1762* | ||
@@ -812,3 +834,3 @@ `serializeAttribute` can be used to customize how `DS.attr` properties are serialized | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1757* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1772* | ||
@@ -839,3 +861,3 @@ `serializeBelongsTo` can be used to customize how `DS.belongsTo` properties are serialized. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1766* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1781* | ||
@@ -866,3 +888,3 @@ `serializeHasMany` can be used to customize how `DS.hasMany` properties are serialized. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1825* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1840* | ||
@@ -893,3 +915,3 @@ serializeId can be used to customize how id is serialized For example, your server may expect integer datatype of id | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1737* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1752* | ||
@@ -921,3 +943,3 @@ You can use this method to customize how a serialized record is added to the complete JSON hash to be sent to the server. By default the JSON Serializer does not namespace the payload and just sends the raw serialized JSON object. If your server expects namespaced keys, you should consider using the RESTSerializer. Otherwise you can override this method to customize how the record is added to the hash. The hash property should be modified by reference. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1777* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1792* | ||
@@ -948,3 +970,3 @@ You can use this method to customize how polymorphic objects are serialized. Objects are considered to be polymorphic if `{ polymorphic: true }` is pass as the second argument to the `DS.belongsTo` function. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1716* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1731* | ||
@@ -951,0 +973,0 @@ Check if the given hasMany relationship should be serialized |
@@ -15,2 +15,3 @@ [EmberFire](../README.md) > [RealtimeDatabaseSerializer](../classes/realtimedatabaseserializer.md) | ||
* [applyTransforms](realtimedatabaseserializer.md#applytransforms) | ||
* [attrs](realtimedatabaseserializer.md#attrs) | ||
@@ -62,2 +63,23 @@ * [primaryKey](realtimedatabaseserializer.md#primarykey) | ||
<a id="applytransforms"></a> | ||
### applyTransforms | ||
**● applyTransforms**: *`function`* | ||
*Defined in serializers/realtime-database.ts:8* | ||
#### Type declaration | ||
▸(a: *`Model`*, b: *`any`*): `void` | ||
**Parameters:** | ||
| Name | Type | | ||
| ------ | ------ | | ||
| a | `Model` | | ||
| b | `any` | | ||
**Returns:** `void` | ||
___ | ||
<a id="attrs"></a> | ||
@@ -71,3 +93,3 @@ | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1576* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1591* | ||
@@ -85,3 +107,3 @@ The `attrs` object can be used to declare a simple mapping between property names on `DS.Model` records and payload keys in the serialized JSON object representing the record. An object with the property `key` can also be used to designate the attribute's key on the response payload. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1568* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1583* | ||
@@ -99,3 +121,3 @@ The `primaryKey` is used when serializing and deserializing data. Ember Data always uses the `id` property to store the id of the record. The external source may not always follow this convention. In these cases it is useful to override the `primaryKey` property to match the `primaryKey` of your external store. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:2142* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:2157* | ||
@@ -116,3 +138,3 @@ The `store` property is the application's `store` that contains all records. It can be used to look up serializers for other model types that may be nested inside the payload response. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1692* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1707* | ||
@@ -139,3 +161,3 @@ Returns the resource's attributes formatted as a JSON-API "attributes object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1794* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1809* | ||
@@ -164,3 +186,3 @@ `extractErrors` is used to extract model errors when a call to `DS.Model#save` fails with an `InvalidError`. By default Ember Data expects error information to be located on the `errors` property of the payload object. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1688* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1703* | ||
@@ -187,3 +209,3 @@ Returns the resource's ID. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1787* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1802* | ||
@@ -211,3 +233,3 @@ `extractMeta` is used to deserialize any meta information in the adapter payload. By default Ember Data expects meta information to be located on the `meta` property of the payload object. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1703* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1718* | ||
@@ -235,3 +257,3 @@ Returns a polymorphic relationship formatted as a JSON-API "relationship object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1696* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1711* | ||
@@ -258,3 +280,3 @@ Returns a relationship formatted as a JSON-API "relationship object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1711* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1726* | ||
@@ -281,3 +303,3 @@ Returns the resource's relationships formatted as a JSON-API "relationships object". | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1804* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1819* | ||
@@ -304,3 +326,3 @@ `keyForAttribute` can be used to define rules for how to convert an attribute name in your model to a key in your JSON. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1819* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1834* | ||
@@ -327,3 +349,3 @@ `keyForLink` can be used to define a custom key when deserializing link properties. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1810* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1825* | ||
@@ -351,3 +373,3 @@ `keyForRelationship` can be used to define a custom key when serializing and deserializing relationship properties. By default `JSONSerializer` does not provide an implementation of this method. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1712* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1727* | ||
@@ -371,3 +393,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1820* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1835* | ||
@@ -393,3 +415,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1684* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1699* | ||
@@ -416,3 +438,3 @@ Normalizes a part of the JSON payload returned by the server. You should override this method, munge the hash and call super if you have generic normalization to do. | ||
*Defined in serializers/realtime-database.ts:12* | ||
*Defined in serializers/realtime-database.ts:17* | ||
@@ -440,3 +462,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1637* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1652* | ||
@@ -464,3 +486,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1644* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1659* | ||
@@ -488,3 +510,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1602* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1617* | ||
@@ -512,3 +534,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1609* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1624* | ||
@@ -536,3 +558,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1616* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1631* | ||
@@ -560,3 +582,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1623* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1638* | ||
@@ -584,3 +606,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1588* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1603* | ||
@@ -608,3 +630,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1595* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1610* | ||
@@ -632,3 +654,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1630* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1645* | ||
@@ -658,3 +680,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1581* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1596* | ||
@@ -684,3 +706,3 @@ The `normalizeResponse` method is used to normalize a payload from the server to a JSON-API Document. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1658* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1673* | ||
@@ -708,3 +730,3 @@ **Parameters:** | ||
*Defined in serializers/realtime-database.ts:7* | ||
*Defined in serializers/realtime-database.ts:10* | ||
@@ -732,3 +754,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1651* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1666* | ||
@@ -758,3 +780,3 @@ **Parameters:** | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1725* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1740* | ||
@@ -784,3 +806,3 @@ Called when a record is saved in order to convert the record into JSON. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1747* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1762* | ||
@@ -812,3 +834,3 @@ `serializeAttribute` can be used to customize how `DS.attr` properties are serialized | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1757* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1772* | ||
@@ -839,3 +861,3 @@ `serializeBelongsTo` can be used to customize how `DS.belongsTo` properties are serialized. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1766* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1781* | ||
@@ -866,3 +888,3 @@ `serializeHasMany` can be used to customize how `DS.hasMany` properties are serialized. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1825* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1840* | ||
@@ -893,3 +915,3 @@ serializeId can be used to customize how id is serialized For example, your server may expect integer datatype of id | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1737* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1752* | ||
@@ -921,3 +943,3 @@ You can use this method to customize how a serialized record is added to the complete JSON hash to be sent to the server. By default the JSON Serializer does not namespace the payload and just sends the raw serialized JSON object. If your server expects namespaced keys, you should consider using the RESTSerializer. Otherwise you can override this method to customize how the record is added to the hash. The hash property should be modified by reference. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1777* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1792* | ||
@@ -948,3 +970,3 @@ You can use this method to customize how polymorphic objects are serialized. Objects are considered to be polymorphic if `{ polymorphic: true }` is pass as the second argument to the `DS.belongsTo` function. | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1716* | ||
*Defined in /workspace/node_modules/@types/ember-data/index.d.ts:1731* | ||
@@ -951,0 +973,0 @@ Check if the given hasMany relationship should be serialized |
@@ -28,3 +28,3 @@ [EmberFire](../README.md) > [RealtimeListenerService](../classes/realtimelistenerservice.md) | ||
*Defined in services/realtime-listener.ts:46* | ||
*Defined in services/realtime-listener.ts:83* | ||
@@ -45,5 +45,5 @@ **Parameters:** | ||
▸ **unsubscribe**(route: *`Object`*): `void` | ||
▸ **unsubscribe**(route: *`Object`*, model?: *`DS.Model`*): `void` | ||
*Defined in services/realtime-listener.ts:178* | ||
*Defined in services/realtime-listener.ts:149* | ||
@@ -55,2 +55,3 @@ **Parameters:** | ||
| route | `Object` | | ||
| `Optional` model | `DS.Model` | | ||
@@ -57,0 +58,0 @@ **Returns:** `void` |
@@ -43,2 +43,3 @@ | ||
* [normalize](#normalize) | ||
* [rootCollection](#rootcollection) | ||
* [subscribe](#subscribe) | ||
@@ -57,3 +58,3 @@ * [unsubscribe](#unsubscribe) | ||
*Defined in adapters/firestore.ts:205* | ||
*Defined in adapters/firestore.ts:209* | ||
*Defined in adapters/realtime-database.ts:168* | ||
@@ -68,3 +69,3 @@ | ||
*Defined in adapters/firestore.ts:199* | ||
*Defined in adapters/firestore.ts:203* | ||
@@ -78,3 +79,3 @@ ___ | ||
*Defined in serializers/firestore.ts:4* | ||
*Defined in serializers/firestore.ts:6* | ||
@@ -88,3 +89,3 @@ ___ | ||
*Defined in adapters/firestore.ts:204* | ||
*Defined in adapters/firestore.ts:208* | ||
@@ -98,3 +99,3 @@ ___ | ||
*Defined in adapters/firestore.ts:200* | ||
*Defined in adapters/firestore.ts:204* | ||
*Defined in adapters/realtime-database.ts:163* | ||
@@ -120,3 +121,3 @@ | ||
*Defined in adapters/firestore.ts:212* | ||
*Defined in adapters/firestore.ts:216* | ||
*Defined in adapters/realtime-database.ts:175* | ||
@@ -131,3 +132,3 @@ | ||
*Defined in adapters/firestore.ts:207* | ||
*Defined in adapters/firestore.ts:211* | ||
*Defined in adapters/realtime-database.ts:170* | ||
@@ -144,3 +145,3 @@ | ||
*Defined in adapters/firestore.ts:201* | ||
*Defined in adapters/firestore.ts:205* | ||
@@ -165,3 +166,3 @@ #### Type declaration | ||
*Defined in adapters/firestore.ts:223* | ||
*Defined in adapters/firestore.ts:227* | ||
@@ -206,3 +207,3 @@ #### Type declaration | ||
*Defined in serializers/firestore.ts:5* | ||
*Defined in serializers/firestore.ts:7* | ||
@@ -216,3 +217,3 @@ ___ | ||
*Defined in adapters/firestore.ts:203* | ||
*Defined in adapters/firestore.ts:207* | ||
@@ -231,3 +232,3 @@ ___ | ||
*Defined in serializers/firestore.ts:32* | ||
*Defined in serializers/firestore.ts:133* | ||
@@ -244,3 +245,3 @@ **Parameters:** | ||
*Defined in serializers/realtime-database.ts:31* | ||
*Defined in serializers/realtime-database.ts:38* | ||
@@ -258,2 +259,33 @@ **Parameters:** | ||
___ | ||
<a id="rootcollection"></a> | ||
### `<Const>` rootCollection | ||
▸ **rootCollection**(adapter: *[FirestoreAdapter](classes/firestoreadapter.md)*, type: *`any`*): `Promise`<`CollectionReference`> | ||
▸ **rootCollection**(adapter: *[RealtimeDatabaseAdapter](classes/realtimedatabaseadapter.md)*, type: *`any`*): `Promise`<`Reference`> | ||
*Defined in adapters/firestore.ts:243* | ||
**Parameters:** | ||
| Name | Type | | ||
| ------ | ------ | | ||
| adapter | [FirestoreAdapter](classes/firestoreadapter.md) | | ||
| type | `any` | | ||
**Returns:** `Promise`<`CollectionReference`> | ||
*Defined in adapters/realtime-database.ts:229* | ||
**Parameters:** | ||
| Name | Type | | ||
| ------ | ------ | | ||
| adapter | [RealtimeDatabaseAdapter](classes/realtimedatabaseadapter.md) | | ||
| type | `any` | | ||
**Returns:** `Promise`<`Reference`> | ||
___ | ||
<a id="subscribe"></a> | ||
@@ -281,3 +313,3 @@ | ||
▸ **unsubscribe**(route: *`Object`*): `false` \| `void` | ||
▸ **unsubscribe**(route: *`Object`*, model?: *`DS.Model`*): `false` \| `void` | ||
@@ -291,2 +323,3 @@ *Defined in services/realtime-listener.ts:19* | ||
| route | `Object` | | ||
| `Optional` model | `DS.Model` | | ||
@@ -293,0 +326,0 @@ **Returns:** `false` \| `void` |
@@ -17,2 +17,5 @@ /* eslint-env node */ | ||
webpack: {} | ||
}, | ||
babel: { | ||
plugins: [ require.resolve('ember-auto-import/babel-plugin') ] | ||
} | ||
@@ -19,0 +22,0 @@ }, |
{ | ||
"name": "emberfire", | ||
"version": "3.0.0-canary.5d9d78c", | ||
"version": "3.0.0-canary.68bbf74", | ||
"description": "The officially supported adapter for using Firebase with Ember", | ||
@@ -33,20 +33,20 @@ "keywords": [ | ||
"broccoli-file-creator": "^2.1.1", | ||
"broccoli-funnel": "^2.0.1", | ||
"broccoli-funnel": "^2.0.2", | ||
"broccoli-merge-trees": "^3.0.2", | ||
"ember-auto-import": "^1.2.19", | ||
"ember-cli-babel": "^7.4.1", | ||
"firebase": "^5.8.2" | ||
"ember-auto-import": "^1.5.2", | ||
"ember-cli-babel": "^7.12.0", | ||
"firebase": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/ember": "^3.0.26", | ||
"@types/ember-data": "^3.1.3", | ||
"@types/ember": "^3.1.1", | ||
"@types/ember-data": "^3.1.8", | ||
"babel-eslint": "^10.0.3", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"codeclimate-test-reporter": "^0.5.1", | ||
"ember-ajax": "^4.0.2", | ||
"ember-cli": "^3.7.1", | ||
"ember-cli": "^3.13.1", | ||
"ember-cli-code-coverage": "^0.4.2", | ||
"ember-cli-dependency-checker": "^3.1.0", | ||
"ember-cli-dependency-checker": "^3.2.0", | ||
"ember-cli-eslint": "^5.0.1", | ||
"ember-cli-fastboot": "^2.0.4", | ||
"ember-cli-htmlbars": "^3.0.1", | ||
"ember-cli-htmlbars": "^3.1.0", | ||
"ember-cli-htmlbars-inline-precompile": "^2.1.0", | ||
@@ -59,18 +59,17 @@ "ember-cli-inject-live-reload": "^2.0.1", | ||
"ember-cli-uglify": "^2.1.0", | ||
"ember-data": "^3.7.0", | ||
"ember-data": "^3.13.1", | ||
"ember-disable-prototype-extensions": "^1.1.3", | ||
"ember-export-application-global": "^2.0.0", | ||
"ember-fetch": "^6.4.0", | ||
"ember-load-initializers": "^2.0.0", | ||
"ember-resolver": "^5.0.1", | ||
"ember-simple-auth": "^1.8.1", | ||
"ember-source": "^3.7.3", | ||
"eslint-plugin-ember": "^6.2.0", | ||
"ember-fetch": "^6.7.1", | ||
"ember-load-initializers": "^2.1.0", | ||
"ember-resolver": "^5.3.0", | ||
"ember-simple-auth": "^1.9.2", | ||
"ember-source": "^3.13.2", | ||
"eslint-plugin-ember": "^6.10.1", | ||
"eslint-plugin-node": "^8.0.1", | ||
"fastboot-express-middleware": "1.2.0", | ||
"loader.js": "^4.7.0", | ||
"typescript": "^3.2.1", | ||
"typedoc": "^0.14.2", | ||
"typedoc-plugin-markdown": "^1.1.26", | ||
"ws": "^6.1.3", | ||
"typedoc-plugin-markdown": "^1.2.1", | ||
"typescript": "^3.6.3", | ||
"ws": "^6.2.1", | ||
"xmlhttprequest": "^1.8.0" | ||
@@ -77,0 +76,0 @@ }, |
@@ -21,2 +21,3 @@ # EmberFire [![Build Status](https://travis-ci.org/firebase/emberfire.svg?branch=master)](https://travis-ci.org/firebase/emberfire) [![Version](https://badge.fury.io/gh/firebase%2Femberfire.svg)](http://badge.fury.io/gh/firebase%2Femberfire) [![Monthly Downloads](http://img.shields.io/npm/dm/emberfire.svg?style=flat)](https://www.npmjs.org/package/emberfire) [![Ember Observer Score](http://emberobserver.com/badges/emberfire.svg)](http://emberobserver.com/addons/emberfire) | ||
- **Authentication Providers** - Integrate [Firebase Authentication](https://firebase.google.com/docs/auth/) with your Ember application easily with providers for [Ember Simple Auth](http://ember-simple-auth.com/) and [Torii](http://vestorly.github.io/torii/) | ||
- **Analytics Collection** - The `AnalyticsRouteMixin` adds [Google Analytics](https://firebase.google.com/docs/analytics) screen tracking to your Ember Router. | ||
- **Offline Enabled** - Persist Ember Data models offline automatically with `FirestoreAdapter` | ||
@@ -39,3 +40,3 @@ - **Fastboot Compatible** - Perform initial rendering and fetching of your models server-side to increase application performance | ||
enablePersistence: true, | ||
persistenceSettings: { experimentalTabSynchronization: true } | ||
persistenceSettings: { synchronizeTabs: true } | ||
}); | ||
@@ -67,5 +68,13 @@ ``` | ||
} | ||
}) | ||
}); | ||
``` | ||
```js | ||
// app/routes/application.js | ||
import AnalyticsRouteMixin from 'emberfire/mixins/analytics-route'; | ||
import Route from '@ember/routing/route'; | ||
export default Route.extend(AnalyticsRouteMixin); | ||
``` | ||
## Documentation | ||
@@ -72,0 +81,0 @@ |
import DS from 'ember-data'; | ||
import { firestore } from 'firebase'; | ||
import { firestore } from 'firebase/app'; | ||
export declare type DocumentSnapshot = firestore.DocumentSnapshot | firestore.QueryDocumentSnapshot; | ||
export declare type Snapshot = firestore.DocumentSnapshot | firestore.QuerySnapshot; | ||
export default class FirestoreSerializer extends DS.JSONSerializer { | ||
applyTransforms: (a: DS.Model, b: any) => void; | ||
normalizeSingleResponse(store: DS.Store, primaryModelClass: DS.Model, payload: firestore.DocumentSnapshot, _id: string | number, _requestType: string): { | ||
@@ -7,0 +8,0 @@ meta: firestore.SnapshotMetadata | { |
import DS from 'ember-data'; | ||
import { database } from 'firebase'; | ||
import { database } from 'firebase/app'; | ||
export default class RealtimeDatabaseSerializer extends DS.JSONSerializer { | ||
applyTransforms: (a: DS.Model, b: any) => void; | ||
normalizeSingleResponse(store: DS.Store, primaryModelClass: DS.Model, payload: database.DataSnapshot, _id: string | number, _requestType: string): { | ||
@@ -5,0 +6,0 @@ data: { |
@@ -5,9 +5,2 @@ import Service from '@ember/service'; | ||
import RSVP from 'rsvp'; | ||
import 'firebase/auth'; | ||
import 'firebase/database'; | ||
import 'firebase/firestore'; | ||
import 'firebase/functions'; | ||
import 'firebase/messaging'; | ||
import 'firebase/storage'; | ||
import { auth, database, firestore, functions, messaging, storage } from 'firebase/app'; | ||
declare const FirebaseAppService_base: Readonly<typeof Service> & (new (properties?: object | undefined) => { | ||
@@ -25,9 +18,12 @@ name: undefined; | ||
delete: () => Promise<any>; | ||
auth: () => RSVP.Promise<auth.Auth>; | ||
database: (databaseURL?: string | undefined) => RSVP.Promise<database.Database>; | ||
firestore: () => RSVP.Promise<firestore.Firestore>; | ||
functions: (region?: string | undefined) => RSVP.Promise<functions.Functions>; | ||
messaging: () => RSVP.Promise<messaging.Messaging>; | ||
storage: (storageBucket?: string | undefined) => RSVP.Promise<storage.Storage>; | ||
init(): void; | ||
auth: () => RSVP.Promise<import("firebase").auth.Auth>; | ||
analytics: () => RSVP.Promise<import("firebase").analytics.Analytics>; | ||
firestore: () => RSVP.Promise<import("firebase").firestore.Firestore>; | ||
messaging: () => RSVP.Promise<import("firebase").messaging.Messaging>; | ||
performance: () => RSVP.Promise<import("firebase").performance.Performance>; | ||
remoteConfig: () => RSVP.Promise<import("firebase").remoteConfig.RemoteConfig>; | ||
database: (url?: string | undefined) => RSVP.Promise<import("firebase").database.Database>; | ||
functions: (region?: string | undefined) => RSVP.Promise<import("firebase").functions.Functions>; | ||
storage: (url?: string | undefined) => RSVP.Promise<import("firebase").storage.Storage>; | ||
init(...args: any[]): void; | ||
} | ||
@@ -34,0 +30,0 @@ declare module '@ember/service' { |
@@ -1,7 +0,6 @@ | ||
import * as firebase from 'firebase/app'; | ||
import Service from '@ember/service'; | ||
export default class FirebaseService extends Service { | ||
app: (name?: string | undefined) => firebase.app.App; | ||
apps: firebase.app.App[]; | ||
initializeApp: (options: Object, nameOrConfig?: string | Object | undefined) => firebase.app.App; | ||
app: (name?: string | undefined) => import("firebase").app.App; | ||
apps: import("firebase").app.App[]; | ||
initializeApp: (options: Object, nameOrConfig?: string | Object | undefined) => import("firebase").app.App; | ||
} | ||
@@ -8,0 +7,0 @@ declare module '@ember/service' { |
import Service from '@ember/service'; | ||
import DS from 'ember-data'; | ||
export declare const subscribe: (route: Object, model: DS.Model) => false | void; | ||
export declare const unsubscribe: (route: Object) => false | void; | ||
export declare const unsubscribe: (route: Object, model?: DS.Model | undefined) => false | void; | ||
declare const RealtimeListenerService_base: Readonly<typeof Service> & (new (properties?: object | undefined) => { | ||
routeSubscriptions: { | ||
[key: string]: () => void; | ||
[key: string]: { | ||
[key: string]: () => void; | ||
}; | ||
}; | ||
} & Service) & (new (...args: any[]) => { | ||
routeSubscriptions: { | ||
[key: string]: () => void; | ||
[key: string]: { | ||
[key: string]: () => void; | ||
}; | ||
}; | ||
@@ -16,3 +20,3 @@ } & Service); | ||
subscribe(route: Object, model: any): void; | ||
unsubscribe(route: Object): void; | ||
unsubscribe(route: Object, model?: DS.Model): void; | ||
} | ||
@@ -19,0 +23,0 @@ declare module '@ember/service' { |
@@ -16,4 +16,4 @@ import Evented from '@ember/object/evented'; | ||
clear: typeof RSVP.Promise.resolve; | ||
restore(): RSVP.Promise<{}>; | ||
restore(): RSVP.Promise<unknown>; | ||
} | ||
export {}; |
@@ -13,5 +13,5 @@ import EmberObject from '@ember/object'; | ||
open(user: any): string; | ||
restore(): RSVP.Promise<{}>; | ||
restore(): RSVP.Promise<unknown>; | ||
close(): RSVP.Promise<void>; | ||
} | ||
export {}; |
import EmberObject from '@ember/object'; | ||
import RSVP from 'rsvp'; | ||
declare const FirebaseToriiProvider_base: Readonly<typeof EmberObject> & (new (properties?: object | undefined) => EmberObject) & (new (...args: any[]) => EmberObject); | ||
declare const FirebaseToriiProvider_base: Readonly<typeof EmberObject> & (new (properties?: object | undefined) => import("@ember/object/-private/types").EmberClassArguments & EmberObject) & (new (...args: any[]) => import("@ember/object/-private/types").EmberClassArguments & EmberObject); | ||
export default class FirebaseToriiProvider extends FirebaseToriiProvider_base { | ||
@@ -5,0 +5,0 @@ open(): RSVP.Promise<never>; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
200898
34
85
1726
102
0
+ Added@firebase/analytics@0.6.0(transitive)
+ Added@firebase/analytics-types@0.4.0(transitive)
+ Added@firebase/app@0.6.11(transitive)
+ Added@firebase/app-types@0.6.1(transitive)
+ Added@firebase/auth@0.15.0(transitive)
+ Added@firebase/auth-interop-types@0.1.5(transitive)
+ Added@firebase/auth-types@0.10.1(transitive)
+ Added@firebase/component@0.1.19(transitive)
+ Added@firebase/database@0.6.13(transitive)
+ Added@firebase/database-types@0.5.2(transitive)
+ Added@firebase/firestore@1.18.0(transitive)
+ Added@firebase/firestore-types@1.14.0(transitive)
+ Added@firebase/functions@0.5.1(transitive)
+ Added@firebase/functions-types@0.3.17(transitive)
+ Added@firebase/installations@0.4.17(transitive)
+ Added@firebase/installations-types@0.3.4(transitive)
+ Added@firebase/logger@0.2.6(transitive)
+ Added@firebase/messaging@0.7.1(transitive)
+ Added@firebase/messaging-types@0.5.0(transitive)
+ Added@firebase/performance@0.4.2(transitive)
+ Added@firebase/performance-types@0.0.13(transitive)
+ Added@firebase/polyfill@0.3.36(transitive)
+ Added@firebase/remote-config@0.1.28(transitive)
+ Added@firebase/remote-config-types@0.1.9(transitive)
+ Added@firebase/storage@0.3.43(transitive)
+ Added@firebase/storage-types@0.3.13(transitive)
+ Added@firebase/util@0.3.2(transitive)
+ Added@firebase/webchannel-wrapper@0.4.0(transitive)
+ Added@grpc/grpc-js@1.12.2(transitive)
+ Added@grpc/proto-loader@0.5.60.7.13(transitive)
+ Added@js-sdsl/ordered-map@4.4.2(transitive)
+ Added@protobufjs/aspromise@1.1.2(transitive)
+ Added@protobufjs/base64@1.1.2(transitive)
+ Added@protobufjs/codegen@2.0.4(transitive)
+ Added@protobufjs/eventemitter@1.1.0(transitive)
+ Added@protobufjs/fetch@1.1.0(transitive)
+ Added@protobufjs/float@1.0.2(transitive)
+ Added@protobufjs/inquire@1.1.0(transitive)
+ Added@protobufjs/path@1.1.2(transitive)
+ Added@protobufjs/pool@1.1.0(transitive)
+ Added@protobufjs/utf8@1.1.0(transitive)
+ Added@types/long@4.0.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcliui@8.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcore-js@3.6.5(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfaye-websocket@0.11.3(transitive)
+ Addedfirebase@7.24.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlong@4.0.05.2.3(transitive)
+ Addednode-fetch@2.6.1(transitive)
+ Addedpromise-polyfill@8.1.3(transitive)
+ Addedprotobufjs@6.11.47.4.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@17.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
- Removed@firebase/app@0.3.17(transitive)
- Removed@firebase/app-types@0.3.10(transitive)
- Removed@firebase/auth@0.10.2(transitive)
- Removed@firebase/auth-types@0.6.1(transitive)
- Removed@firebase/database@0.3.20(transitive)
- Removed@firebase/database-types@0.3.11(transitive)
- Removed@firebase/firestore@1.2.2(transitive)
- Removed@firebase/firestore-types@1.2.1(transitive)
- Removed@firebase/functions@0.4.6(transitive)
- Removed@firebase/functions-types@0.3.5(transitive)
- Removed@firebase/installations@0.1.0(transitive)
- Removed@firebase/installations-types@0.1.0(transitive)
- Removed@firebase/logger@0.1.13(transitive)
- Removed@firebase/messaging@0.3.19(transitive)
- Removed@firebase/messaging-types@0.2.11(transitive)
- Removed@firebase/performance@0.2.1(transitive)
- Removed@firebase/performance-types@0.0.1(transitive)
- Removed@firebase/polyfill@0.3.13(transitive)
- Removed@firebase/storage@0.2.15(transitive)
- Removed@firebase/storage-types@0.2.11(transitive)
- Removed@firebase/util@0.2.14(transitive)
- Removed@firebase/webchannel-wrapper@0.2.19(transitive)
- Removedascli@1.0.1(transitive)
- Removedbytebuffer@5.0.1(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcolour@0.7.1(transitive)
- Removedcore-js@3.0.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfaye-websocket@0.11.1(transitive)
- Removedfirebase@5.11.1(transitive)
- Removedgrpc@1.20.0(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedlcid@1.0.0(transitive)
- Removedlodash.clone@4.5.0(transitive)
- Removedlong@3.2.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedoptjs@3.2.2(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedpromise-polyfill@8.1.0(transitive)
- Removedprotobufjs@5.0.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedtslib@1.9.3(transitive)
- Removedwindow-size@0.1.4(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyargs@3.32.0(transitive)
Updatedbroccoli-funnel@^2.0.2
Updatedember-auto-import@^1.5.2
Updatedember-cli-babel@^7.12.0
Updatedfirebase@^7.0.0