This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 5 files changed +51
-10
lines changed
5 files changed +51
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ id : res . Id ,
8
+ name : res . Name
9
+ } )
10
+ }
11
+
5
12
module . exports = ( send ) => {
6
13
return promisify ( ( args , opts , callback ) => {
7
14
if ( typeof ( opts ) === 'function' ) {
8
15
callback = opts
9
16
opts = { }
10
17
}
11
- send ( {
18
+
19
+ send . andTransform ( {
12
20
path : 'key/gen' ,
13
21
args : args ,
14
22
qs : opts
15
- } , callback )
23
+ } , transform , callback )
16
24
} )
17
25
}
Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ id : res . Id ,
8
+ name : res . Name
9
+ } )
10
+ }
11
+
5
12
module . exports = ( send ) => {
6
13
return promisify ( ( name , pem , password , callback ) => {
7
- send ( {
14
+ send . andTransform ( {
8
15
path : 'key/import' ,
9
16
args : name ,
10
17
qs : {
11
18
pem : pem ,
12
19
password : password
13
20
}
14
- } , callback )
21
+ } , transform , callback )
15
22
} )
16
23
}
Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , res . Keys . map ( key => {
7
+ return {
8
+ id : key . Id ,
9
+ name : key . Name
10
+ }
11
+ } ) )
12
+ }
13
+
5
14
module . exports = ( send ) => {
6
15
return promisify ( ( opts , callback ) => {
7
16
if ( typeof ( opts ) === 'function' ) {
8
17
callback = opts
9
18
opts = { }
10
19
}
11
- send ( {
20
+
21
+ send . andTransform ( {
12
22
path : 'key/list' ,
13
23
qs : opts
14
- } , callback )
24
+ } , transform , callback )
15
25
} )
16
26
}
Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ id : res . Id ,
8
+ was : res . Was ,
9
+ now : res . Now ,
10
+ overwrite : res . Overwrite
11
+ } )
12
+ }
13
+
5
14
module . exports = ( send ) => {
6
15
return promisify ( ( oldName , newName , callback ) => {
7
- send ( {
16
+ send . andTransform ( {
8
17
path : 'key/rename' ,
9
18
args : [ oldName , newName ]
10
- } , callback )
19
+ } , transform , callback )
11
20
} )
12
21
}
Original file line number Diff line number Diff line change 2
2
3
3
const promisify = require ( 'promisify-es6' )
4
4
5
+ const transform = function ( res , callback ) {
6
+ callback ( null , {
7
+ id : res . Keys [ 0 ] . Id ,
8
+ name : res . Keys [ 0 ] . Name
9
+ } )
10
+ }
11
+
5
12
module . exports = ( send ) => {
6
13
return promisify ( ( args , callback ) => {
7
- send ( {
14
+ send . andTransform ( {
8
15
path : 'key/rm' ,
9
16
args : args
10
- } , callback )
17
+ } , transform , callback )
11
18
} )
12
19
}
You can’t perform that action at this time.
0 commit comments