File tree Expand file tree Collapse file tree 5 files changed +47
-51
lines changed
Expand file tree Collapse file tree 5 files changed +47
-51
lines changed Original file line number Diff line number Diff line change 11'use strict'
22
3- const promisify = require ( 'promisify-es6 ' )
3+ const configure = require ( '../lib/configure ' )
44
5- module . exports = ( send ) => {
6- return promisify ( ( opts , callback ) => {
7- if ( typeof ( opts ) === 'function' ) {
8- callback = opts
9- opts = { }
10- }
5+ module . exports = configure ( ( { ky } ) => {
6+ return options => {
7+ options = options || { }
118
12- send ( {
13- path : 'diag/cmds' ,
14- qs : opts
15- } , callback )
16- } )
17- }
9+ const searchParams = new URLSearchParams ( options . searchParams )
10+ if ( options . verbose != null ) searchParams . set ( 'verbose' , options . verbose )
11+
12+ return ky . get ( 'diag/cmds' , {
13+ timeout : options . timeout ,
14+ signal : options . signal ,
15+ headers : options . headers ,
16+ searchParams
17+ } ) . json ( )
18+ }
19+ } )
Original file line number Diff line number Diff line change 11'use strict'
22
3- const moduleConfig = require ( '../utils/module-config ' )
3+ const callbackify = require ( 'callbackify ' )
44
5- module . exports = ( arg ) => {
6- const send = moduleConfig ( arg )
7-
8- return {
9- net : require ( './net' ) ( send ) ,
10- sys : require ( './sys' ) ( send ) ,
11- cmds : require ( './cmds' ) ( send )
12- }
13- }
5+ module . exports = config => ( {
6+ net : callbackify . variadic ( require ( './net' ) ( config ) ) ,
7+ sys : callbackify . variadic ( require ( './sys' ) ( config ) ) ,
8+ cmds : callbackify . variadic ( require ( './cmds' ) ( config ) )
9+ } )
Original file line number Diff line number Diff line change 11'use strict'
22
3- const promisify = require ( 'promisify-es6 ' )
3+ const configure = require ( '../lib/configure ' )
44
5- module . exports = ( send ) => {
6- return promisify ( ( opts , callback ) => {
7- if ( typeof ( opts ) === 'function' ) {
8- callback = opts
9- opts = { }
10- }
5+ module . exports = configure ( ( { ky } ) => {
6+ return options => {
7+ options = options || { }
118
12- send ( {
13- path : 'diag/net' ,
14- qs : opts
15- } , callback )
16- } )
17- }
9+ return ky . get ( 'diag/net' , {
10+ timeout : options . timeout ,
11+ signal : options . signal ,
12+ headers : options . headers ,
13+ searchParams : options . searchParams
14+ } ) . json ( )
15+ }
16+ } )
Original file line number Diff line number Diff line change 11'use strict'
22
3- const promisify = require ( 'promisify-es6 ' )
3+ const configure = require ( '../lib/configure ' )
44
5- module . exports = ( send ) => {
6- return promisify ( ( opts , callback ) => {
7- if ( typeof ( opts ) === 'function' ) {
8- callback = opts
9- opts = { }
10- }
5+ module . exports = configure ( ( { ky } ) => {
6+ return options => {
7+ options = options || { }
118
12- send ( {
13- path : 'diag/sys' ,
14- qs : opts
15- } , callback )
16- } )
17- }
9+ return ky . get ( 'diag/sys' , {
10+ timeout : options . timeout ,
11+ signal : options . signal ,
12+ headers : options . headers ,
13+ searchParams : options . searchParams
14+ } ) . json ( )
15+ }
16+ } )
Original file line number Diff line number Diff line change @@ -94,7 +94,8 @@ function requireCommands (send, config) {
9494 bootstrap : require ( '../bootstrap' ) ( config ) ,
9595 config : require ( '../config' ) ( config ) ,
9696 dag : require ( '../dag' ) ( config ) ,
97- dht : require ( '../dht' ) ( config )
97+ dht : require ( '../dht' ) ( config ) ,
98+ diag : require ( '../diag' ) ( config )
9899 }
99100
100101 Object . assign ( cmds . refs , {
@@ -123,7 +124,6 @@ function requireCommands (send, config) {
123124
124125 // Miscellaneous
125126 commands : require ( '../commands' ) ,
126- diag : require ( '../diag' ) ,
127127 id : require ( '../id' ) ,
128128 key : require ( '../key' ) ,
129129 log : require ( '../log' ) ,
You can’t perform that action at this time.
0 commit comments