UNPKG

@mkeen/rxcouch

Version:

Real Time RxJs Based CouchDB Client

181 lines (180 loc) 4.33 kB
import { BehaviorSubject, Subscription } from 'rxjs'; import { HttpRequestHeaders } from '@mkeen/rxhttp'; export declare type WatcherConfig = [string[], // 0 string, // 1 string, // 2 number, // 3 boolean, // 4 string, // 5 boolean, // 6 boolean]; export declare const IDS = 0; export declare const DATABASE_NAME = 1; export declare const HOST = 2; export declare const PORT = 3; export declare const SSL = 4; export declare const COOKIE = 5; export declare const TRACK_CHANGES = 6; export declare const AUTHENTICATED = 7; export declare type CouchDBDocument = { _id: string; _rev: string; } & { [prop: string]: any; }; export declare type CouchDBPreDocument = {} & { [prop: string]: any; }; export declare type CouchDBDocumentIndex = {} & { [prop: string]: BehaviorSubject<CouchDBDocument>; }; export declare type CouchDBHashIndex = {} & { [prop: string]: String; }; export declare type CouchDBAppChangesSubscriptions = {} & { [prop: string]: Subscription; }; export declare type CouchDBFindSelector = {} & { [prop: string]: any; }; export declare type CouchDBFindSort = { [prop: string]: string; }; export declare type CouchDBDesignView = 'view'; export declare type CouchDBDesignList = 'list'; export declare type CouchDBAuthentication = (name: string, password: string) => void; export interface CouchDBBasicResponse { ok: boolean; } export interface CouchDBChange { rev: string; } export interface RxCouchConfig { dbName?: string; host?: string; port?: number; ssl?: boolean; cookie?: string | null; trackChanges?: boolean; } export interface CouchDBChanges { id: string; doc: CouchDBDocument; changes: CouchDBChange[]; last_seq?: string; seq?: string; deleted?: boolean; } export interface CouchDBChangeFeed { last_seq: string; pending: number; results: CouchDBChanges[]; } export interface CouchDBDocumentRevisionResponse { id: string; rev: string; error?: string; ok?: boolean; reason?: string; } export interface CouchDBError { error: string; reason: string; } export interface CouchDBHeaders extends HttpRequestHeaders { Cookie?: any; } export interface CouchDBDesignViewResponse { total_rows: number; offset: number; rows: CouchDBDocument[]; } export interface CouchDBDesignViewOptions { attachments?: boolean; conflicts?: boolean; descending?: boolean; endkey?: any; endkey_docid?: string; group?: boolean; group_level?: number; include_docs?: boolean; att_encoding_info?: boolean; inclusive_end?: boolean; key?: any; keys?: any; limit?: number; reduce?: boolean; skip?: number; sorted?: boolean; stable?: boolean; stale?: boolean; startkey?: any; startkey_docid?: any; update?: string; update_seq?: boolean; } export interface CouchDBAuthenticationResponse { ok: boolean; name: string; roles: string[]; } export interface CouchDBSessionInfo { authenticated: string; authentication_db: string; authentication_handler: string[]; } export interface CouchDBUserContext { name: string; roles: string[]; } export interface CouchDBSessionInfo { ok: boolean; info: CouchDBSessionInfo; userCtx: CouchDBUserContext; } export declare enum AuthorizationBehavior { cookie = "cookie", open = "open", jwt = "jwt" } export interface CouchDBCredentials { name: string; password: string; access_token?: string; } export interface CouchDBFindQuery { selector?: CouchDBFindSelector; limit?: number; skip?: number; sort?: CouchDBFindSort[]; fields?: string[]; use_index?: string | []; r?: number; bookmark?: string; update?: boolean; stable?: boolean; stale?: string; execution_stats?: boolean; } export interface CouchDBFindResponse { docs: CouchDBDocument[]; warning: string; execution_states: object; bookmark: string; } export interface CouchDBGenericResponse { id: string; ok: boolean; rev: string; } export interface CouchDBUUIDSResponse { uuids: string[]; } export interface CouchDBDocumentRoles { names: string[]; roles: string[]; } export interface CouchDBSecurity { admins: CouchDBDocumentRoles; members: CouchDBDocumentRoles; }