yalento
Version:
An awesome integration of Google Firebase for Angular and Node
63 lines (62 loc) • 1.95 kB
TypeScript
import { BehaviorSubject, Observable } from 'rxjs';
import { IEntity, Repository } from '../Repository';
import { AbstractConnector } from './AbstractConnector';
export declare class Firestore {
}
export declare class Firebase {
}
export declare class User {
readonly uid: string | null;
constructor(uid: string | null);
}
export declare type ConnectionFirestoreDataMode = 'PRIVATE' | 'ALL';
export interface IParentConnection {
modelName: string;
documentId: string;
}
export interface IConnectionFirestoreNearBy {
long: BehaviorSubject<number>;
lat: BehaviorSubject<number>;
radius: BehaviorSubject<number>;
}
export interface IConnectionFirestore {
parent?: IParentConnection[];
dataMode?: ConnectionFirestoreDataMode;
realtimeMode?: boolean;
nearBy?: IConnectionFirestoreNearBy;
debug?: boolean;
}
export declare class FirestoreConnector<T> extends AbstractConnector<T> {
readonly options: IConnectionFirestore;
private db;
private app;
private readonly dataMode;
private readonly realtimeMode;
private readonly debug;
private currentUser;
private currentUser$;
private lastSql;
private observers;
private firestoreCollectionSnapshotUnsubscribe;
constructor(repository: Repository<T>, db: Firestore, options?: IConnectionFirestore);
getUserUuid(): Observable<string>;
isPrivateMode(): boolean;
add(items: IEntity<T>[]): Promise<any>;
update(items: IEntity<T>[]): Promise<any>;
remove(items: IEntity<T>[]): Promise<undefined>;
select(sql: string): Promise<void>;
disconnect(): Promise<void>;
selectOneByIdentifier(identifier: string): Promise<any>;
/**
*
* @param sql
* @param hasGeoCondition
*/
private replaceSql;
private debugMessage;
private getGeohashRange;
private getPath;
private getParentDocumentPath;
private getFirebaseCollection;
private evaluateAstValue;
}