10
10
// License for the specific language governing permissions and limitations under
11
11
// the License.
12
12
13
- const { HttpsCookieAgent, HttpCookieAgent } = require ( 'http-cookie-agent' )
13
+ const { HttpsCookieAgent, HttpCookieAgent } = require ( 'http-cookie-agent/http ' )
14
14
const { URL } = require ( 'url' )
15
15
const assert = require ( 'assert' )
16
16
const querystring = require ( 'qs' )
@@ -126,7 +126,7 @@ module.exports = exports = function dbScope (cfg) {
126
126
// let parsed
127
127
const responseHeaders = Object . assign ( {
128
128
uri : scrubURL ( req . url ) ,
129
- statusCode : statusCode
129
+ statusCode
130
130
} , response . headers )
131
131
if ( ! response . status ) {
132
132
if ( axios . isCancel ( response ) ) {
@@ -139,7 +139,7 @@ module.exports = exports = function dbScope (cfg) {
139
139
return
140
140
}
141
141
142
- log ( { err : 'socket' , body : body , headers : responseHeaders } )
142
+ log ( { err : 'socket' , body, headers : responseHeaders } )
143
143
if ( reject ) {
144
144
reject ( new Error ( `error happened in your connection. Reason: ${ response . message } ` ) )
145
145
}
@@ -162,7 +162,7 @@ module.exports = exports = function dbScope (cfg) {
162
162
} */
163
163
164
164
if ( statusCode >= 200 && statusCode < 400 ) {
165
- log ( { err : null , body : body , headers : responseHeaders } )
165
+ log ( { err : null , body, headers : responseHeaders } )
166
166
if ( resolve ) {
167
167
resolve ( body )
168
168
}
@@ -187,7 +187,7 @@ module.exports = exports = function dbScope (cfg) {
187
187
// scrub credentials
188
188
scrubRequest ( req )
189
189
190
- log ( { err : 'couch' , body : body , headers : responseHeaders } )
190
+ log ( { err : 'couch' , body, headers : responseHeaders } )
191
191
192
192
const message = body . message || 'couch returned ' + statusCode
193
193
const errors = new Error ( message )
@@ -223,7 +223,7 @@ module.exports = exports = function dbScope (cfg) {
223
223
224
224
const responseHeaders = Object . assign ( {
225
225
uri : req . url ,
226
- statusCode : statusCode
226
+ statusCode
227
227
} , response . headers )
228
228
229
229
const error = new Error ( message )
@@ -267,7 +267,7 @@ module.exports = exports = function dbScope (cfg) {
267
267
268
268
const req = Object . assign ( {
269
269
method : ( opts . method || 'GET' ) ,
270
- headers : headers ,
270
+ headers,
271
271
uri : cfg . url
272
272
} , {
273
273
...cfg . requestDefaults ,
@@ -385,8 +385,8 @@ module.exports = exports = function dbScope (cfg) {
385
385
req . method = req . method . toLowerCase ( )
386
386
req . params = req . qs
387
387
delete req . qs
388
- req . paramsSerializer = ( params ) => {
389
- return querystring . stringify ( params , { arrayFormat : 'brackets' } )
388
+ req . paramsSerializer = {
389
+ serialize : ( params ) => querystring . stringify ( params , { arrayFormat : 'brackets' } )
390
390
}
391
391
req . data = req . body
392
392
delete req . body
@@ -453,7 +453,7 @@ module.exports = exports = function dbScope (cfg) {
453
453
db : '_session' ,
454
454
form : {
455
455
name : username ,
456
- password : password
456
+ password
457
457
}
458
458
} , callback )
459
459
}
@@ -579,7 +579,7 @@ module.exports = exports = function dbScope (cfg) {
579
579
count = 1
580
580
}
581
581
count = count || 1
582
- return relax ( { method : 'GET' , path : '_uuids' , qs : { count : count } } , callback )
582
+ return relax ( { method : 'GET' , path : '_uuids' , qs : { count } } , callback )
583
583
}
584
584
585
585
// http://guide.couchdb.org/draft/replication.html
@@ -616,7 +616,7 @@ module.exports = exports = function dbScope (cfg) {
616
616
db : '_replicator' ,
617
617
method : 'DELETE' ,
618
618
path : id ,
619
- qs : Object . assign ( opts , { rev : rev } )
619
+ qs : Object . assign ( opts , { rev } )
620
620
}
621
621
return relax ( req , callback )
622
622
}
@@ -658,7 +658,7 @@ module.exports = exports = function dbScope (cfg) {
658
658
db : dbName ,
659
659
doc : docName ,
660
660
method : 'DELETE' ,
661
- qs : { rev : rev }
661
+ qs : { rev }
662
662
} , callback )
663
663
}
664
664
@@ -787,7 +787,7 @@ module.exports = exports = function dbScope (cfg) {
787
787
path : viewPath ,
788
788
method : 'POST' ,
789
789
qs : qs1 ,
790
- body : body ,
790
+ body,
791
791
stream : meta . stream
792
792
} , callback )
793
793
} else if ( qs1 && qs1 . queries ) {
@@ -798,7 +798,7 @@ module.exports = exports = function dbScope (cfg) {
798
798
path : viewPath ,
799
799
method : 'POST' ,
800
800
qs : qs1 ,
801
- body : body
801
+ body
802
802
} , callback )
803
803
} else {
804
804
const req = {
@@ -858,7 +858,7 @@ module.exports = exports = function dbScope (cfg) {
858
858
return view ( ddoc , viewName + '/' + encodeURIComponent ( docName ) , {
859
859
type : 'update' ,
860
860
method : 'PUT' ,
861
- body : body
861
+ body
862
862
} , callback )
863
863
}
864
864
@@ -925,8 +925,8 @@ module.exports = exports = function dbScope (cfg) {
925
925
method : 'PUT' ,
926
926
contentType : 'multipart/related' ,
927
927
doc : docName ,
928
- qs : qs ,
929
- multipart : multipart
928
+ qs,
929
+ multipart
930
930
} , callback )
931
931
}
932
932
@@ -957,7 +957,7 @@ module.exports = exports = function dbScope (cfg) {
957
957
db : dbName ,
958
958
att : attName ,
959
959
method : 'PUT' ,
960
- contentType : contentType ,
960
+ contentType,
961
961
doc : docName ,
962
962
qs : opts ,
963
963
body : att ,
@@ -1004,7 +1004,7 @@ module.exports = exports = function dbScope (cfg) {
1004
1004
att : attName ,
1005
1005
method : 'DELETE' ,
1006
1006
doc : docName ,
1007
- qs : qs
1007
+ qs
1008
1008
} , callback )
1009
1009
}
1010
1010
@@ -1071,7 +1071,7 @@ module.exports = exports = function dbScope (cfg) {
1071
1071
return relax ( {
1072
1072
db : dbName ,
1073
1073
path : '_partition/' + encodeURIComponent ( partitionKey ) + '/_all_docs' ,
1074
- qs : qs ,
1074
+ qs,
1075
1075
stream : true
1076
1076
} )
1077
1077
}
@@ -1157,8 +1157,8 @@ module.exports = exports = function dbScope (cfg) {
1157
1157
return changesDbAsStream ( dbName , qs )
1158
1158
} ,
1159
1159
changesReader : new ChangesReader ( dbName , relax ) ,
1160
- auth : auth ,
1161
- session : session ,
1160
+ auth,
1161
+ session,
1162
1162
insert : insertDoc ,
1163
1163
get : getDoc ,
1164
1164
head : headDoc ,
@@ -1167,7 +1167,7 @@ module.exports = exports = function dbScope (cfg) {
1167
1167
list : listDoc ,
1168
1168
listAsStream : listDocAsStream ,
1169
1169
fetch : fetchDocs ,
1170
- fetchRevs : fetchRevs ,
1170
+ fetchRevs,
1171
1171
config : { url : cfg . url , db : dbName } ,
1172
1172
multipart : {
1173
1173
insert : insertMultipart ,
@@ -1181,17 +1181,17 @@ module.exports = exports = function dbScope (cfg) {
1181
1181
} ,
1182
1182
show : showDoc ,
1183
1183
atomic : updateWithHandler ,
1184
- updateWithHandler : updateWithHandler ,
1184
+ updateWithHandler,
1185
1185
baseView : view ,
1186
1186
search : viewSearch ,
1187
1187
searchAsStream : viewSearchAsStream ,
1188
1188
view : viewDocs ,
1189
1189
viewAsStream : viewDocsAsStream ,
1190
- find : find ,
1191
- findAsStream : findAsStream ,
1192
- createIndex : createIndex ,
1193
- viewWithList : viewWithList ,
1194
- viewWithListAsStream : viewWithListAsStream ,
1190
+ find,
1191
+ findAsStream,
1192
+ createIndex,
1193
+ viewWithList,
1194
+ viewWithListAsStream,
1195
1195
server : serverScope ,
1196
1196
replication : {
1197
1197
enable : function ( target , opts , cb ) {
@@ -1204,15 +1204,15 @@ module.exports = exports = function dbScope (cfg) {
1204
1204
return queryReplication ( id , opts , cb )
1205
1205
}
1206
1206
} ,
1207
- partitionInfo : partitionInfo ,
1208
- partitionedList : partitionedList ,
1209
- partitionedListAsStream : partitionedListAsStream ,
1210
- partitionedFind : partitionedFind ,
1211
- partitionedFindAsStream : partitionedFindAsStream ,
1212
- partitionedSearch : partitionedSearch ,
1213
- partitionedSearchAsStream : partitionedSearchAsStream ,
1214
- partitionedView : partitionedView ,
1215
- partitionedViewAsStream : partitionedViewAsStream
1207
+ partitionInfo,
1208
+ partitionedList,
1209
+ partitionedListAsStream,
1210
+ partitionedFind,
1211
+ partitionedFindAsStream,
1212
+ partitionedSearch,
1213
+ partitionedSearchAsStream,
1214
+ partitionedView,
1215
+ partitionedViewAsStream
1216
1216
}
1217
1217
1218
1218
docScope . view . compact = function ( ddoc , cb ) {
@@ -1240,18 +1240,18 @@ module.exports = exports = function dbScope (cfg) {
1240
1240
query : queryReplication
1241
1241
} ,
1242
1242
changes : changesDb ,
1243
- updates : updates
1243
+ updates
1244
1244
} ,
1245
1245
use : docModule ,
1246
1246
scope : docModule ,
1247
1247
request : relax ,
1248
- relax : relax ,
1248
+ relax,
1249
1249
dinosaur : relax ,
1250
- auth : auth ,
1251
- session : session ,
1252
- updates : updates ,
1253
- uuids : uuids ,
1254
- info : info
1250
+ auth,
1251
+ session,
1252
+ updates,
1253
+ uuids,
1254
+ info
1255
1255
} )
1256
1256
1257
1257
const db = maybeExtractDatabaseComponent ( )
0 commit comments