@heroku/skynet 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,13 +41,14 @@ async function run (context) {
41
41
 
42
42
  if (file) {
43
43
  let apps = await readlines(file)
44
- await cli.action(`bulk app-owner suspension for ${cli.color.cyan(apps.length)} apps.`, skynet.bulkSuspendAppOwner(apps.join(), notes, category))
44
+ let response = await skynet.bulkSuspendAppOwner(apps.join(), notes, category)
45
+ cli.log(response)
45
46
  } else {
46
47
  if (!app) {
47
48
  throw new Error('Required flag: --owner OWNER or --infile FILE')
48
49
  }
49
50
 
50
- let response = await cli.action(`suspending the owner of ${cli.color.cyan(app)}`, skynet.suspendAppOwner(app, notes, category, force))
51
+ let response = await skynet.suspendAppOwner(app, notes, category, force)
51
52
  response = JSON.parse(response)
52
53
  cli.log(`${response.status}. ${response.message}`)
53
54
  }
@@ -42,13 +42,14 @@ async function run (context) {
42
42
 
43
43
  if (file) {
44
44
  let users = await readlines(file)
45
- await cli.action(`bulk user suspension for ${cli.color.cyan(users.length)} users.`, skynet.bulkSuspendUsers(users.join(), notes, category))
45
+ let response = await skynet.bulkSuspendUsers(users.join(), notes, category)
46
+ cli.log(response)
46
47
  } else {
47
48
  if (!user) {
48
49
  throw new Error('Required flag: --user USER or --infile FILE')
49
50
  }
50
51
 
51
- let response = await cli.action(`suspending ${cli.color.cyan(user)}`, skynet.suspendUser(user, notes, category, notify, force))
52
+ let response = await skynet.suspendUser(user, notes, category, notify, force)
52
53
  response = JSON.parse(response)
53
54
  cli.log(`${response.status}. ${response.message}`)
54
55
  }
package/lib/command.js CHANGED
@@ -4,10 +4,9 @@ module.exports = fn =>
4
4
  cli.command((context, client) =>
5
5
  fn(context, client).catch(err => {
6
6
  if (err.body) {
7
- console.log(JSON.stringify(err.body))
7
+ throw JSON.stringify(err.body)
8
8
  } else {
9
- console.log(err)
9
+ throw err
10
10
  }
11
- throw err
12
11
  })
13
12
  )
package/lib/skynet.js CHANGED
@@ -1,5 +1,4 @@
1
- const cli = require('heroku-cli-util')
2
- const qs = require('querystring')
1
+ const got = require('got')
3
2
  let skynetHost = 'https://skynet.herokai.com'
4
3
 
5
4
  if (process.env.SKYNET_HOST) {
@@ -21,11 +20,7 @@ module.exports = class SkynetAPI {
21
20
  'User-Agent': this.version
22
21
  })
23
22
 
24
- if (options.form) {
25
- options.headers['Content-Type'] = 'application/x-www-form-urlencoded'
26
- }
27
-
28
- return cli.got(SKYNET_BASE_URL + url, options).then(res => res.body)
23
+ return got(SKYNET_BASE_URL + url, options).then(res => res.body)
29
24
  }
30
25
 
31
26
  categories () {
@@ -42,7 +37,7 @@ module.exports = class SkynetAPI {
42
37
 
43
38
  return this.request(`/whitelist`, {
44
39
  method: 'POST',
45
- body: qs.stringify(body),
40
+ body: body,
46
41
  form: true
47
42
  })
48
43
  }
@@ -61,7 +56,7 @@ module.exports = class SkynetAPI {
61
56
 
62
57
  return this.request(`/userpass/remove`, {
63
58
  method: 'POST',
64
- body: qs.stringify(body),
59
+ body: body,
65
60
  form: true
66
61
  })
67
62
  }
@@ -74,7 +69,7 @@ module.exports = class SkynetAPI {
74
69
 
75
70
  return this.request(`/userpass/add`, {
76
71
  method: 'POST',
77
- body: qs.stringify(body),
72
+ body: body,
78
73
  form: true
79
74
  })
80
75
  }
@@ -90,7 +85,7 @@ module.exports = class SkynetAPI {
90
85
 
91
86
  return this.request('/suspend/app-owner', {
92
87
  method: 'POST',
93
- body: qs.stringify(body),
88
+ body: body,
94
89
  form: true
95
90
  })
96
91
  }
@@ -106,7 +101,7 @@ module.exports = class SkynetAPI {
106
101
 
107
102
  return this.request('/suspend/app', {
108
103
  method: 'POST',
109
- body: qs.stringify(body),
104
+ body: body,
110
105
  form: true
111
106
  })
112
107
  }
@@ -129,7 +124,7 @@ module.exports = class SkynetAPI {
129
124
 
130
125
  return this.request(`/suspend/user`, {
131
126
  method: 'POST',
132
- body: qs.stringify(body),
127
+ body: body,
133
128
  form: true
134
129
  })
135
130
  }
@@ -151,7 +146,7 @@ module.exports = class SkynetAPI {
151
146
 
152
147
  return this.request(`/suspend/user`, {
153
148
  method: 'POST',
154
- body: qs.stringify(body),
149
+ body: body,
155
150
  form: true
156
151
  })
157
152
  }
@@ -167,7 +162,7 @@ module.exports = class SkynetAPI {
167
162
 
168
163
  return this.request(`/suspend/app-owner`, {
169
164
  method: 'POST',
170
- body: qs.stringify(body),
165
+ body: body,
171
166
  form: true
172
167
  })
173
168
  }
@@ -183,7 +178,7 @@ module.exports = class SkynetAPI {
183
178
 
184
179
  return this.request(`/deprovision`, {
185
180
  method: 'POST',
186
- body: qs.stringify(body),
181
+ body: body,
187
182
  form: true
188
183
  })
189
184
  }
@@ -199,7 +194,7 @@ module.exports = class SkynetAPI {
199
194
 
200
195
  return this.request(`/deprovision`, {
201
196
  method: 'POST',
202
- body: qs.stringify(body),
197
+ body: body,
203
198
  form: true
204
199
  })
205
200
  }
@@ -212,7 +207,7 @@ module.exports = class SkynetAPI {
212
207
 
213
208
  return this.request(`/categories`, {
214
209
  method: 'POST',
215
- body: JSON.stringify(body),
210
+ body: body,
216
211
  json: true
217
212
  })
218
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/skynet",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "use Skynet from Heroku CLI",
5
5
  "main": "index.js",
6
6
  "author": "Bob Argenbright @byt3smith",
@@ -17,11 +17,12 @@
17
17
  "/commands"
18
18
  ],
19
19
  "dependencies": {
20
+ "got": "^9.6.0",
20
21
  "heroku-cli-util": "~6.2.12",
21
22
  "split": "^1.0.0"
22
23
  },
23
24
  "devDependencies": {
24
- "mocha": "^3.4.2",
25
+ "mocha": "^5.2.0",
25
26
  "mockdate": "^2.0.1",
26
27
  "nock": "~9.0.13",
27
28
  "np": "^3.1.0",