@@ -4,7 +4,7 @@ const eu = encodeURIComponent
4
4
const npmFetch = require ( 'npm-registry-fetch' )
5
5
const validate = require ( 'aproba' )
6
6
7
- const cmd = module . exports = { }
7
+ const cmd = module . exports
8
8
9
9
cmd . create = ( entity , opts = { } ) => {
10
10
return Promise . resolve ( ) . then ( ( ) => {
@@ -21,51 +21,42 @@ cmd.create = (entity, opts = {}) => {
21
21
}
22
22
23
23
cmd . destroy = ( entity , opts = { } ) => {
24
- return Promise . resolve ( ) . then ( ( ) => {
25
- const { scope, team } = splitEntity ( entity )
26
- validate ( 'SSO' , [ scope , team , opts ] )
27
- const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } `
28
- return npmFetch . json ( uri , {
29
- ...opts ,
30
- method : 'DELETE' ,
31
- scope
32
- } )
24
+ const { scope, team } = splitEntity ( entity )
25
+ validate ( 'SSO' , [ scope , team , opts ] )
26
+ const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } `
27
+ return npmFetch . json ( uri , {
28
+ ...opts ,
29
+ method : 'DELETE' ,
30
+ scope
33
31
} )
34
32
}
35
33
36
34
cmd . add = ( user , entity , opts = { } ) => {
37
- return Promise . resolve ( ) . then ( ( ) => {
38
- const { scope, team } = splitEntity ( entity )
39
- validate ( 'SSO' , [ scope , team , opts ] )
40
- const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
41
- return npmFetch . json ( uri , {
42
- ...opts ,
43
- method : 'PUT' ,
44
- scope,
45
- body : { user }
46
- } )
35
+ const { scope, team } = splitEntity ( entity )
36
+ validate ( 'SSO' , [ scope , team , opts ] )
37
+ const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
38
+ return npmFetch . json ( uri , {
39
+ ...opts ,
40
+ method : 'PUT' ,
41
+ scope,
42
+ body : { user }
47
43
} )
48
44
}
49
45
50
46
cmd . rm = ( user , entity , opts = { } ) => {
51
- return Promise . resolve ( ) . then ( ( ) => {
52
- const { scope, team } = splitEntity ( entity )
53
- validate ( 'SSO' , [ scope , team , opts ] )
54
- const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
55
- return npmFetch . json ( uri , {
56
- ...opts ,
57
- method : 'DELETE' ,
58
- scope,
59
- body : { user }
60
- } )
47
+ const { scope, team } = splitEntity ( entity )
48
+ validate ( 'SSO' , [ scope , team , opts ] )
49
+ const uri = `/-/team/${ eu ( scope ) } /${ eu ( team ) } /user`
50
+ return npmFetch . json ( uri , {
51
+ ...opts ,
52
+ method : 'DELETE' ,
53
+ scope,
54
+ body : { user }
61
55
} )
62
56
}
63
57
64
- cmd . lsTeams = ( scope , opts = { } ) => {
65
- return Promise . resolve ( ) . then ( ( ) => {
66
- return cmd . lsTeams . stream ( scope , { ...opts } ) . collect ( )
67
- } )
68
- }
58
+ cmd . lsTeams = ( ...args ) => cmd . lsTeams . stream ( ...args ) . collect ( )
59
+
69
60
cmd . lsTeams . stream = ( scope , opts = { } ) => {
70
61
validate ( 'SO' , [ scope , opts ] )
71
62
const uri = `/-/org/${ eu ( scope ) } /team`
@@ -75,11 +66,8 @@ cmd.lsTeams.stream = (scope, opts = {}) => {
75
66
} )
76
67
}
77
68
78
- cmd . lsUsers = ( entity , opts = { } ) => {
79
- return Promise . resolve ( ) . then ( ( ) => {
80
- return cmd . lsUsers . stream ( entity , { ...opts } ) . collect ( )
81
- } )
82
- }
69
+ cmd . lsUsers = ( ...args ) => cmd . lsUsers . stream ( ...args ) . collect ( )
70
+
83
71
cmd . lsUsers . stream = ( entity , opts = { } ) => {
84
72
const { scope, team } = splitEntity ( entity )
85
73
validate ( 'SSO' , [ scope , team , opts ] )
0 commit comments