@heroku/skynet 1.6.21 → 1.8.0
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.
- package/commands/suspensions.js +1 -1
- package/commands/whitelists.js +30 -0
- package/index.js +1 -2
- package/lib/skynet.js +9 -21
- package/package.json +3 -3
- package/commands/categories/add.js +0 -21
- package/commands/categories/remove.js +0 -20
package/commands/suspensions.js
CHANGED
|
@@ -14,7 +14,7 @@ async function run (context) {
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
topic: 'skynet',
|
|
16
16
|
command: 'suspensions',
|
|
17
|
-
description: '(requires sudo)
|
|
17
|
+
description: '(requires sudo) suspension history of the given user account',
|
|
18
18
|
help: `Examples:
|
|
19
19
|
$ heroku skynet:suspensions -a [user account]`,
|
|
20
20
|
flags: [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../lib/command')
|
|
3
|
+
const SkynetAPI = require('../lib/skynet')
|
|
4
|
+
|
|
5
|
+
async function run (context) {
|
|
6
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
+
let response = await skynet.whitelists()
|
|
8
|
+
response = JSON.parse(response)
|
|
9
|
+
if (Object.keys(response).length > 0) {
|
|
10
|
+
cli.table(response, {
|
|
11
|
+
columns: [
|
|
12
|
+
{ key: 'Value' },
|
|
13
|
+
{ key: 'Notes' },
|
|
14
|
+
{ key: 'CreatedAt' },
|
|
15
|
+
{ key: 'UpdatedAt' },
|
|
16
|
+
{ key: 'DeletedAt' }
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
topic: 'skynet',
|
|
24
|
+
command: 'whitelists',
|
|
25
|
+
description: 'whitelists used by skynet',
|
|
26
|
+
help: `Examples:
|
|
27
|
+
$ heroku skynet:whitelists`,
|
|
28
|
+
flags: [],
|
|
29
|
+
run: command(run)
|
|
30
|
+
}
|
package/index.js
CHANGED
|
@@ -14,9 +14,8 @@ exports.commands = [
|
|
|
14
14
|
require('./commands/unsuspend/user.js'),
|
|
15
15
|
require('./commands/deprovision.js'),
|
|
16
16
|
require('./commands/categories.js'),
|
|
17
|
-
require('./commands/categories/add.js'),
|
|
18
|
-
require('./commands/categories/remove.js'),
|
|
19
17
|
require('./commands/whitelist/add.js'),
|
|
20
18
|
require('./commands/whitelist/remove.js'),
|
|
19
|
+
require('./commands/whitelists.js'),
|
|
21
20
|
require('./commands/suspensions.js')
|
|
22
21
|
]
|
package/lib/skynet.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const got = require('got')
|
|
2
2
|
let skynetHost = 'https://skynet.herokai.com'
|
|
3
3
|
|
|
4
|
+
// If test against local skynet environment, change shynet host to localhost:5000
|
|
5
|
+
// let skynetHost = 'http://localhost:5000'
|
|
6
|
+
|
|
4
7
|
if (process.env.SKYNET_HOST) {
|
|
5
8
|
skynetHost = process.env.SKYNET_HOST
|
|
6
9
|
}
|
|
@@ -29,6 +32,12 @@ module.exports = class SkynetAPI {
|
|
|
29
32
|
})
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
whitelists () {
|
|
36
|
+
return this.request('/whitelist', {
|
|
37
|
+
method: 'GET'
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
addWhitelist (appOrUserEmail, notes) {
|
|
33
42
|
var body = {
|
|
34
43
|
value: appOrUserEmail,
|
|
@@ -192,27 +201,6 @@ module.exports = class SkynetAPI {
|
|
|
192
201
|
})
|
|
193
202
|
}
|
|
194
203
|
|
|
195
|
-
addCategory (category, description) {
|
|
196
|
-
const body = {
|
|
197
|
-
category: category,
|
|
198
|
-
description: description
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return this.request('/categories', {
|
|
202
|
-
method: 'POST',
|
|
203
|
-
body: body,
|
|
204
|
-
json: true
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
removeCategory (category) {
|
|
209
|
-
return this.request(`/categories/${category}`, {
|
|
210
|
-
method: 'DELETE',
|
|
211
|
-
body: {},
|
|
212
|
-
json: true
|
|
213
|
-
})
|
|
214
|
-
}
|
|
215
|
-
|
|
216
204
|
suspensions (account) {
|
|
217
205
|
return this.request(`/v2/suspensions/${account}`, {
|
|
218
206
|
method: 'GET'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/skynet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "use Skynet from Heroku CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Bob Argenbright @byt3smith",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"split": "^1.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"acorn": "
|
|
25
|
+
"acorn": "^6.4.1",
|
|
26
26
|
"minimist": ">=1.2.2",
|
|
27
27
|
"mocha": "^5.2.0",
|
|
28
28
|
"mockdate": "^2.0.1",
|
|
29
29
|
"nock": "^12.0.3",
|
|
30
|
-
"np": "^6.
|
|
30
|
+
"np": "^6.5.0",
|
|
31
31
|
"standard": "^14.3.3",
|
|
32
32
|
"unexpected": "^10.29.0"
|
|
33
33
|
},
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(`adding new category: ${cli.color.cyan(context.flags.category)}`, skynet.addCategory(context.flags.category, context.flags.description))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
topic: 'skynet',
|
|
12
|
-
command: 'categories:add',
|
|
13
|
-
description: 'adds a value to suspension categories',
|
|
14
|
-
help: `Examples:
|
|
15
|
-
$ heroku sudo skynet:categories:add -c new-category -d "this is a new category"`,
|
|
16
|
-
flags: [
|
|
17
|
-
{ name: 'category', char: 'c', description: 'new category value', hasValue: true, required: true },
|
|
18
|
-
{ name: 'description', char: 'd', description: 'new category description', hasValue: true, required: true }
|
|
19
|
-
],
|
|
20
|
-
run: command(run)
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(`removing ${cli.color.cyan(context.flags.category)} from suspension categories`, skynet.removeCategory(context.flags.category))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
topic: 'skynet',
|
|
12
|
-
command: 'categories:remove',
|
|
13
|
-
description: 'removes a value from suspension categories',
|
|
14
|
-
help: `Examples:
|
|
15
|
-
$ heroku sudo skynet:categories:remove -c test-category`,
|
|
16
|
-
flags: [
|
|
17
|
-
{ name: 'category', char: 'c', description: 'category to remove', hasValue: true, required: true }
|
|
18
|
-
],
|
|
19
|
-
run: command(run)
|
|
20
|
-
}
|