@mkeen/rxcouch
Version:
Real Time RxJs Based CouchDB Client
26 lines (25 loc) • 1.23 kB
TypeScript
import { Observable, BehaviorSubject } from 'rxjs';
import { HttpResponseWithHeaders } from '@mkeen/rxhttp';
import { AuthorizationBehavior, CouchDBCredentials, CouchDBSession, CouchDBUserContext } from './types';
export declare class CouchDBSessions {
authorizationBehavior: AuthorizationBehavior;
sessionUrl: string;
private credentials?;
authenticated: BehaviorSubject<boolean>;
loginAttemptMade: BehaviorSubject<boolean>;
userSession: BehaviorSubject<CouchDBSession | null>;
cookie: BehaviorSubject<string>;
context: BehaviorSubject<CouchDBUserContext | null>;
private lastCredentials;
constructor(authorizationBehavior: AuthorizationBehavior, sessionUrl?: string, credentials?: Observable<CouchDBCredentials> | undefined);
authenticate(providedCredentials?: CouchDBCredentials): Observable<boolean>;
reauthenticate(): Observable<boolean>;
get(): Observable<CouchDBSession>;
saveCookie: (httpResponse: HttpResponseWithHeaders<any>) => void;
extractResponse: (httpResponse: HttpResponseWithHeaders<any>) => any;
private attemptNewAuthentication;
private httpRequest;
private httpRequestOptions;
private cookieForRequestHeader;
destroy(): any;
}