This repository was archived by the owner on Mar 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 11# UNRELEASED
22- [ FIXED] Add missing ` maxAttempt ` parameter to TypeScript definition.
3+ - [ FIXED] Include client initialization callback in TypeScript definition.
34- [ FIXED] Removed test and lint data that bloated npm package size.
45- [ FIXED] Support Cloudant query when using promises request plugin.
56
Original file line number Diff line number Diff line change @@ -784,8 +784,7 @@ type. For example:
784784` ` ` js
785785import * as Cloudant from ' @cloudant/cloudant' ;
786786
787- var cloudant = Cloudant ({ account: ' me' , password: ' password' , plugins: [ ' promises' ] });
788- var client = cloudant as Cloudant .ServerScope ;
787+ var client = Cloudant ({ account: ' me' , password: ' password' , plugins: [ ' promises' ] });
789788
790789(client .db .list () as any).then ((d ) => { console .log (d); });
791790` ` `
Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ import * as nano from 'nano';
1616import { Request , CoreOptions } from "request" ;
1717
1818declare function cloudant (
19- config : cloudant . Configuration | string
20- ) : cloudant . ServerScope | cloudant . DocumentScope < any > ;
19+ config : cloudant . Configuration | string ,
20+ callback ?: ( error : any , client ?: cloudant . ServerScope , pong ?: any ) => void
21+ ) : cloudant . ServerScope ;
2122
2223declare namespace cloudant {
2324 type Callback < R > = ( error : any , response : R , headers ?: any ) => void ;
Original file line number Diff line number Diff line change @@ -27,12 +27,21 @@ const config: cloudant.Configuration = {
2727
2828const cfgInstance = cloudant ( config ) ;
2929
30+ /*
31+ * Run Initialization Callback
32+ */
33+ cloudant ( config , ( error , client , pong ) => {
34+ if ( error ) {
35+ return ;
36+ } else if ( client ) {
37+ client . db . list ( ( error , allDbs ) => { } ) ;
38+ }
39+ } ) ;
40+
3041/*
3142 * Server Scope
3243 */
33- const instance = < cloudant . ServerScope > cloudant (
34- "http://localhost:5984/emails"
35- ) ;
44+ const instance = cloudant ( "http://localhost:5984" ) ;
3645
3746instance . ping ( ( pong ) => { } ) ;
3847
You can’t perform that action at this time.
0 commit comments