@posva/vuefire-core
Advanced tools
Comparing version 2.3.3 to 2.3.4
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.3.4](https://github.com/vuejs/vuefire/compare/@posva/vuefire-core@2.3.3...@posva/vuefire-core@2.3.4) (2020-12-07) | ||
**Note:** Version bump only for package @posva/vuefire-core | ||
## [2.3.3](https://github.com/vuejs/vuefire/compare/@posva/vuefire-core@2.3.2...@posva/vuefire-core@2.3.3) (2020-07-31) | ||
@@ -8,0 +16,0 @@ |
import { FirestoreSerializer } from './utils'; | ||
import { OperationsType } from '../shared'; | ||
import { firestore } from 'firebase'; | ||
import firebase from 'firebase/app'; | ||
export interface FirestoreOptions { | ||
@@ -20,7 +20,7 @@ maxRefDepth?: number; | ||
interface BindCollectionParamater extends CommonBindOptionsParameter { | ||
collection: firestore.CollectionReference | firestore.Query; | ||
collection: firebase.firestore.CollectionReference | firebase.firestore.Query; | ||
} | ||
export declare function bindCollection({ vm, key, collection, ops, resolve, reject }: BindCollectionParamater, extraOptions?: FirestoreOptions): (reset?: FirestoreOptions['reset']) => void; | ||
interface BindDocumentParamater extends CommonBindOptionsParameter { | ||
document: firestore.DocumentReference; | ||
document: firebase.firestore.DocumentReference; | ||
} | ||
@@ -27,0 +27,0 @@ /** |
@@ -1,9 +0,9 @@ | ||
import { firestore } from 'firebase'; | ||
import firebase from 'firebase/app'; | ||
import { TODO } from '../shared'; | ||
export declare type FirestoreReference = firestore.Query | firestore.DocumentReference | firestore.CollectionReference; | ||
export declare function createSnapshot(doc: firestore.DocumentSnapshot): TODO; | ||
export declare type FirestoreReference = firebase.firestore.Query | firebase.firestore.DocumentReference | firebase.firestore.CollectionReference; | ||
export declare function createSnapshot(doc: firebase.firestore.DocumentSnapshot): TODO; | ||
export declare type FirestoreSerializer = typeof createSnapshot; | ||
export declare function extractRefs(doc: firestore.DocumentData, oldDoc: firestore.DocumentData | void, subs: Record<string, { | ||
export declare function extractRefs(doc: firebase.firestore.DocumentData, oldDoc: firebase.firestore.DocumentData | void, subs: Record<string, { | ||
path: string; | ||
data: () => firestore.DocumentData | null; | ||
}>): [firestore.DocumentData, Record<string, firestore.DocumentReference>]; | ||
data: () => firebase.firestore.DocumentData | null; | ||
}>): [firebase.firestore.DocumentData, Record<string, firebase.firestore.DocumentReference>]; |
@@ -1,2 +0,2 @@ | ||
import { database } from 'firebase'; | ||
import firebase from 'firebase/app'; | ||
import { RTDBSerializer } from './utils'; | ||
@@ -19,3 +19,3 @@ import { OperationsType, ResetOption } from '../shared'; | ||
interface BindAsObjectParameter extends CommonBindOptionsParameter { | ||
document: database.Reference | database.Query; | ||
document: firebase.database.Reference | firebase.database.Query; | ||
} | ||
@@ -30,3 +30,3 @@ /** | ||
interface BindAsArrayParameter extends CommonBindOptionsParameter { | ||
collection: database.Reference | database.Query; | ||
collection: firebase.database.Reference | firebase.database.Query; | ||
} | ||
@@ -33,0 +33,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { database } from 'firebase'; | ||
import firebase from 'firebase/app'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Convert firebase RTDB snapshot into a bindable data record. | ||
*/ | ||
export declare function createRecordFromRTDBSnapshot(snapshot: database.DataSnapshot): any; | ||
export declare function createRecordFromRTDBSnapshot(snapshot: firebase.database.DataSnapshot): any; | ||
export declare type RTDBSerializer = typeof createRecordFromRTDBSnapshot; | ||
@@ -11,0 +11,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { firestore } from 'firebase'; | ||
import firebase from 'firebase/app'; | ||
export interface OperationsType { | ||
@@ -39,3 +39,3 @@ set: (target: Record<string, any>, key: string | number, value: any) => any; | ||
*/ | ||
export declare function isDocumentRef(o: any): o is firestore.DocumentReference; | ||
export declare function isDocumentRef(o: any): o is firebase.firestore.DocumentReference; | ||
/** | ||
@@ -42,0 +42,0 @@ * Wraps a function so it gets called only once |
/*! | ||
* @posva/vuefire-core v2.3.3 | ||
* @posva/vuefire-core v2.3.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
@@ -186,6 +186,3 @@ * @license MIT | ||
function extractRefs(doc, oldDoc, subs) { | ||
var dataAndRefs = [ | ||
{}, | ||
{}, | ||
]; | ||
var dataAndRefs = [{}, {}]; | ||
var subsByPath = Object.keys(subs).reduce(function (resultSubs, subKey) { | ||
@@ -192,0 +189,0 @@ var sub = subs[subKey]; |
/*! | ||
* @posva/vuefire-core v2.3.3 | ||
* @posva/vuefire-core v2.3.4 | ||
* (c) 2020 Eduardo San Martin Morote | ||
@@ -182,6 +182,3 @@ * @license MIT | ||
function extractRefs(doc, oldDoc, subs) { | ||
var dataAndRefs = [ | ||
{}, | ||
{}, | ||
]; | ||
var dataAndRefs = [{}, {}]; | ||
var subsByPath = Object.keys(subs).reduce(function (resultSubs, subKey) { | ||
@@ -188,0 +185,0 @@ var sub = subs[subKey]; |
{ | ||
"name": "@posva/vuefire-core", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"description": "Shared code for vue + Firebase apps used by vuefire and vuexfire", | ||
@@ -43,5 +43,5 @@ "author": "Eduardo San Martin Morote <posva13@gmail.com>", | ||
"devDependencies": { | ||
"@posva/vuefire-test-helpers": "^1.2.2" | ||
"@posva/vuefire-test-helpers": "^1.2.3" | ||
}, | ||
"gitHead": "4d504da28daaf7b3f8b9ec17f84007c54d8fee1c" | ||
"gitHead": "c879553a566ef82be71a3746ad92d6984a32491f" | ||
} |
import { createSnapshot, extractRefs, FirestoreSerializer } from './utils' | ||
import { walkGet, callOnceWithArg, OperationsType } from '../shared' | ||
import { firestore } from 'firebase' | ||
import firebase from 'firebase/app' | ||
@@ -24,3 +24,3 @@ export interface FirestoreOptions { | ||
path: string | ||
data: () => firestore.DocumentData | null | ||
data: () => firebase.firestore.DocumentData | null | ||
// // path inside the object to access the data items.3 | ||
@@ -40,3 +40,3 @@ // key: string | ||
path: string, | ||
snapshot: firestore.DocumentSnapshot, | ||
snapshot: firebase.firestore.DocumentSnapshot, | ||
subs: Record<string, FirestoreSubscription>, | ||
@@ -58,3 +58,3 @@ ops: CommonBindOptionsParameter['ops'], | ||
ops: CommonBindOptionsParameter['ops'] | ||
ref: firestore.DocumentReference | ||
ref: firebase.firestore.DocumentReference | ||
} | ||
@@ -85,3 +85,3 @@ | ||
target: CommonBindOptionsParameter['vm'] | ||
refs: Record<string, firestore.DocumentReference> | ||
refs: Record<string, firebase.firestore.DocumentReference> | ||
path: string | number | ||
@@ -101,3 +101,3 @@ depth: number | ||
subs: Record<string, FirestoreSubscription>, | ||
refs: Record<string, firestore.DocumentReference>, | ||
refs: Record<string, firebase.firestore.DocumentReference>, | ||
ops: CommonBindOptionsParameter['ops'], | ||
@@ -167,3 +167,3 @@ depth: number, | ||
interface BindCollectionParamater extends CommonBindOptionsParameter { | ||
collection: firestore.CollectionReference | firestore.Query | ||
collection: firebase.firestore.CollectionReference | firebase.firestore.Query | ||
} | ||
@@ -188,3 +188,3 @@ | ||
const change = { | ||
added: ({ newIndex, doc }: firestore.DocumentChange) => { | ||
added: ({ newIndex, doc }: firebase.firestore.DocumentChange) => { | ||
arraySubs.splice(newIndex, 0, Object.create(null)) | ||
@@ -196,3 +196,3 @@ const subs = arraySubs[newIndex] | ||
}, | ||
modified: ({ oldIndex, newIndex, doc }: firestore.DocumentChange) => { | ||
modified: ({ oldIndex, newIndex, doc }: firebase.firestore.DocumentChange) => { | ||
const subs = arraySubs[oldIndex] | ||
@@ -208,3 +208,3 @@ const oldData = array[oldIndex] | ||
}, | ||
removed: ({ oldIndex }: firestore.DocumentChange) => { | ||
removed: ({ oldIndex }: firebase.firestore.DocumentChange) => { | ||
ops.remove(array, oldIndex) | ||
@@ -227,3 +227,3 @@ unsubscribeAll(arraySubs.splice(oldIndex, 1)[0]) | ||
: /* istanbul ignore next to support firebase < 5*/ | ||
((snapshot.docChanges as unknown) as firestore.DocumentChange[]) | ||
((snapshot.docChanges as unknown) as firebase.firestore.DocumentChange[]) | ||
@@ -276,3 +276,3 @@ if (!isResolved && docChanges.length) { | ||
interface BindDocumentParamater extends CommonBindOptionsParameter { | ||
document: firestore.DocumentReference | ||
document: firebase.firestore.DocumentReference | ||
} | ||
@@ -279,0 +279,0 @@ |
@@ -1,11 +0,11 @@ | ||
import { firestore } from 'firebase' | ||
import firebase from 'firebase/app' | ||
import { isTimestamp, isObject, isDocumentRef, TODO } from '../shared' | ||
export type FirestoreReference = | ||
| firestore.Query | ||
| firestore.DocumentReference | ||
| firestore.CollectionReference | ||
| firebase.firestore.Query | ||
| firebase.firestore.DocumentReference | ||
| firebase.firestore.CollectionReference | ||
// TODO: fix type not to be any | ||
export function createSnapshot(doc: firestore.DocumentSnapshot): TODO { | ||
export function createSnapshot(doc: firebase.firestore.DocumentSnapshot): TODO { | ||
// TODO: it should create a deep copy instead because otherwise we will modify internal data | ||
@@ -19,10 +19,10 @@ // defaults everything to false, so no need to set | ||
export function extractRefs( | ||
doc: firestore.DocumentData, | ||
oldDoc: firestore.DocumentData | void, | ||
subs: Record<string, { path: string; data: () => firestore.DocumentData | null }> | ||
): [firestore.DocumentData, Record<string, firestore.DocumentReference>] { | ||
const dataAndRefs: [firestore.DocumentData, Record<string, firestore.DocumentReference>] = [ | ||
{}, | ||
{}, | ||
] | ||
doc: firebase.firestore.DocumentData, | ||
oldDoc: firebase.firestore.DocumentData | void, | ||
subs: Record<string, { path: string; data: () => firebase.firestore.DocumentData | null }> | ||
): [firebase.firestore.DocumentData, Record<string, firebase.firestore.DocumentReference>] { | ||
const dataAndRefs: [ | ||
firebase.firestore.DocumentData, | ||
Record<string, firebase.firestore.DocumentReference> | ||
] = [{}, {}] | ||
@@ -33,9 +33,9 @@ const subsByPath = Object.keys(subs).reduce((resultSubs, subKey) => { | ||
return resultSubs | ||
}, {} as Record<string, firestore.DocumentData | null>) | ||
}, {} as Record<string, firebase.firestore.DocumentData | null>) | ||
function recursiveExtract( | ||
doc: firestore.DocumentData, | ||
oldDoc: firestore.DocumentData | void, | ||
doc: firebase.firestore.DocumentData, | ||
oldDoc: firebase.firestore.DocumentData | void, | ||
path: string, | ||
result: [firestore.DocumentData, Record<string, firestore.DocumentReference>] | ||
result: [firebase.firestore.DocumentData, Record<string, firebase.firestore.DocumentReference>] | ||
): void { | ||
@@ -42,0 +42,0 @@ // make it easier to later on access the value |
@@ -1,2 +0,2 @@ | ||
import { database } from 'firebase' | ||
import firebase from 'firebase/app' | ||
import { createRecordFromRTDBSnapshot, indexForKey, RTDBSerializer } from './utils' | ||
@@ -30,3 +30,3 @@ import { OperationsType, ResetOption } from '../shared' | ||
interface BindAsObjectParameter extends CommonBindOptionsParameter { | ||
document: database.Reference | database.Query | ||
document: firebase.database.Reference | firebase.database.Query | ||
} | ||
@@ -64,3 +64,3 @@ | ||
interface BindAsArrayParameter extends CommonBindOptionsParameter { | ||
collection: database.Reference | database.Query | ||
collection: firebase.database.Reference | firebase.database.Query | ||
} | ||
@@ -67,0 +67,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { database } from 'firebase' | ||
import firebase from 'firebase/app' | ||
import { isObject } from '../shared' | ||
@@ -10,3 +10,3 @@ | ||
*/ | ||
export function createRecordFromRTDBSnapshot(snapshot: database.DataSnapshot): any { | ||
export function createRecordFromRTDBSnapshot(snapshot: firebase.database.DataSnapshot): any { | ||
const value = snapshot.val() | ||
@@ -13,0 +13,0 @@ const res = isObject(value) ? value : Object.defineProperty({}, '.value', { value }) |
@@ -1,2 +0,2 @@ | ||
import { firestore } from 'firebase' | ||
import firebase from 'firebase/app' | ||
@@ -65,3 +65,3 @@ export interface OperationsType { | ||
*/ | ||
export function isDocumentRef(o: any): o is firestore.DocumentReference { | ||
export function isDocumentRef(o: any): o is firebase.firestore.DocumentReference { | ||
return o && o.onSnapshot | ||
@@ -68,0 +68,0 @@ } |
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
70219
1653