import { FirestoreRef, Context } from '../types'; import { Commit } from 'vuex'; import { SubscribeOptionsParameter } from '../parameters'; import { Action } from 'stream-executor'; export declare class FirestoreStreamSubscriber { private _ref; private _actions; /** * Make FirestoreStreamSubscriber instance * @param ref: firebase.firestore.DocumentReference | firebase.firestore.CollectionReference | firebase.firestore.Query * @returns FirestoreStreamSubscriber */ static from(ref: FirestoreRef): FirestoreStreamSubscriber; constructor(ref: FirestoreRef); /** * Subscribe firestore data like rxjs * @description please see a comparison of usage with `from(ref).bindTo(statePropName)` * https://github.com/nor-ko-hi-jp/firex-store/blob/master/docs/v1/v1-usage.md#subscribe-firestore-using-like-rxjs * @description If you'd like to use helper method in pipe function, use stream-executor library. * https://github.com/nor-ko-hi-jp/stream-executor#helper-methods-and-those-descriptions-in-createstream-are * @param act1 (data: { isLast: boolean, data: T, bindTo: (statePropName: string) => void }) => U * @param act2 (data: T) => U * @param act3 (data: T) => U * @param act4 (data: T) => U * @param act5 (data: T) => U * @param act6 (data: T) => U * @param act7 (data: T) => U * @param act8 (data: T) => U * @param act9 (data: T) => U * @param act10 (data: T) => U * * @example * import { from, map, bndTo, firestoreMutations } from 'firex-store' * * const toCharactor = (data) => ({ id: data.docId, name: `${data.first_name} ${data.family_name}` }) * * export default { * state: { * charactors: null, * isLoaded: false * }, * mutations: { * ...firestoreMutations('all'), * setIsLoaded: (state, paylaod) => { * state.charactors = payload * } * }, * actions: { * subscribe: ({ commit, state }, { collectionName }) => { * from(firebase.collections(collectionName)) * .pipe( * map(toCharactor), * bindTo('charactor'), * ({ data }) => { * commit('setIsLoaded', data) * } * ) * .subscribe(state, commit) * } * } * } */ pipe(act1: Action>, A>, act2?: Action, act3?: Action, act4?: Action, act5?: Action, act6?: Action, act7?: Action, act8?: Action, act9?: Action, act10?: Action): Pick; /** * subscribe firestore data * @param state Vuex's state * @param commit Vuex's commit * @param options { errorHandler, notFoundHandler, completionHandler } */ subscribe(state: Record, commit: Commit, options?: Pick, 'errorHandler' | 'notFoundHandler' | 'completionHandler'>): void; private get _isDocumentRef(); } /** * subscribe firestore data to state property name * @param statePropName State property name that stores the data obtained from Firestore */ export declare const bindTo: >(statePropName: string) => (data: Context) => Context; /** * map firestore data * @param mapper (data: T) => U */ export declare const map: , U>(mapper: (data: T) => U) => (data: Context) => Context;