@heroku/skynet 1.6.13 → 1.6.15
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/categories/add.js +3 -3
- package/commands/categories/remove.js +3 -3
- package/commands/categories.js +4 -4
- package/commands/deprovision.js +9 -9
- package/commands/suspend/app-owner.js +14 -14
- package/commands/suspend/apps.js +4 -4
- package/commands/suspend/user.js +15 -15
- package/commands/suspensions.js +24 -0
- package/commands/unsuspend/apps.js +7 -7
- package/commands/unsuspend/user.js +7 -7
- package/commands/userpass/add.js +3 -3
- package/commands/userpass/remove.js +3 -3
- package/commands/whitelist/add.js +3 -3
- package/commands/whitelist/remove.js +3 -3
- package/index.js +2 -1
- package/lib/command.js +1 -1
- package/lib/skynet.js +15 -9
- package/package.json +5 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
package/commands/categories.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../lib/command')
|
|
3
|
+
const sudo = require('../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../lib/skynet')
|
|
5
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
package/commands/deprovision.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../lib/command')
|
|
3
|
+
const sudo = require('../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../lib/skynet')
|
|
5
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
|
8
8
|
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const user = context.flags.user || process.env.HEROKU_USER
|
|
10
|
+
const notes = context.flags.notes
|
|
11
|
+
const category = context.flags.category
|
|
12
|
+
const force = context.flags.bypass
|
|
13
|
+
const notify = !context.flags['no-notify']
|
|
14
14
|
|
|
15
15
|
if (!user) {
|
|
16
16
|
throw new Error('Required flag: --user USER')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const sudo = require('../../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
5
5
|
|
|
6
6
|
function readlines (file) {
|
|
7
7
|
return new Promise(function (resolve, reject) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const split = require('split')
|
|
9
|
+
const fs = require('fs')
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const users = []
|
|
12
12
|
|
|
13
13
|
fs.createReadStream(file).pipe(split())
|
|
14
14
|
.on('data', function (line) {
|
|
@@ -29,19 +29,19 @@ function readlines (file) {
|
|
|
29
29
|
async function run (context) {
|
|
30
30
|
sudo()
|
|
31
31
|
const skynet = new SkynetAPI(context.auth.password)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const app = context.flags.app
|
|
33
|
+
const file = context.flags.infile
|
|
34
|
+
const notes = context.flags.notes
|
|
35
|
+
const category = context.flags.category
|
|
36
|
+
const force = context.flags.bypass
|
|
37
37
|
|
|
38
38
|
if (app && file) {
|
|
39
39
|
throw new Error('Either --app or --infile must be passed, but not both')
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (file) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const apps = await readlines(file)
|
|
44
|
+
const response = await skynet.bulkSuspendAppOwner(apps.join(), notes, category)
|
|
45
45
|
cli.log(response)
|
|
46
46
|
} else {
|
|
47
47
|
if (!app) {
|
package/commands/suspend/apps.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const sudo = require('../../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
5
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
package/commands/suspend/user.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const sudo = require('../../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
5
5
|
|
|
6
6
|
function readlines (file) {
|
|
7
7
|
return new Promise(function (resolve, reject) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const split = require('split')
|
|
9
|
+
const fs = require('fs')
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const users = []
|
|
12
12
|
|
|
13
13
|
fs.createReadStream(file).pipe(split())
|
|
14
14
|
.on('data', function (line) {
|
|
@@ -29,20 +29,20 @@ function readlines (file) {
|
|
|
29
29
|
async function run (context) {
|
|
30
30
|
sudo()
|
|
31
31
|
const skynet = new SkynetAPI(context.auth.password)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
const user = context.flags.user || process.env.HEROKU_USER
|
|
33
|
+
const file = context.flags.infile
|
|
34
|
+
const notes = context.flags.notes
|
|
35
|
+
const category = context.flags.category
|
|
36
|
+
const force = context.flags.bypass
|
|
37
|
+
const notify = !context.flags['no-notify']
|
|
38
38
|
|
|
39
39
|
if (user && file) {
|
|
40
40
|
throw new Error('Either --user USER or --infile must be passed, but not both')
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (file) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const users = await readlines(file)
|
|
45
|
+
const response = await skynet.bulkSuspendUsers(users.join(), notes, category, notify, force)
|
|
46
46
|
cli.log(response)
|
|
47
47
|
} else {
|
|
48
48
|
if (!user) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../lib/command')
|
|
3
|
+
const sudo = require('../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../lib/skynet')
|
|
5
|
+
|
|
6
|
+
async function run (context) {
|
|
7
|
+
sudo()
|
|
8
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
+
let response = await skynet.suspensions(context.flags.user)
|
|
10
|
+
response = JSON.parse(response)
|
|
11
|
+
cli.log(response)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
topic: 'skynet',
|
|
16
|
+
command: 'suspensions',
|
|
17
|
+
description: '(requires sudo) suspnesions history of the given user account',
|
|
18
|
+
help: `Examples:
|
|
19
|
+
$ heroku skynet:suspensions -u [user account]`,
|
|
20
|
+
flags: [
|
|
21
|
+
{ name: 'user', char: 'u', description: 'user account id or email', hasValue: true, required: true }
|
|
22
|
+
],
|
|
23
|
+
run: command(run)
|
|
24
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const sudo = require('../../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
5
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
|
8
8
|
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const app = context.flags.app
|
|
10
|
+
const category = context.flags.category
|
|
11
|
+
const notes = context.flags.notes
|
|
12
12
|
|
|
13
13
|
if (!app) {
|
|
14
14
|
throw new Error('Required flag: --app APP')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const sudo = require('../../lib/sudo')
|
|
4
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
5
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
|
8
8
|
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const user = context.flags.user || process.env.HEROKU_USER
|
|
10
|
+
const category = context.flags.category
|
|
11
|
+
const notes = context.flags.notes
|
|
12
12
|
|
|
13
13
|
if (!user) {
|
|
14
14
|
throw new Error('Required flag: --user USER')
|
package/commands/userpass/add.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../../lib/command')
|
|
3
|
+
const SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
async function run (context) {
|
|
6
6
|
const skynet = new SkynetAPI(context.auth.password)
|
package/index.js
CHANGED
|
@@ -17,5 +17,6 @@ exports.commands = [
|
|
|
17
17
|
require('./commands/categories/add.js'),
|
|
18
18
|
require('./commands/categories/remove.js'),
|
|
19
19
|
require('./commands/whitelist/add.js'),
|
|
20
|
-
require('./commands/whitelist/remove.js')
|
|
20
|
+
require('./commands/whitelist/remove.js'),
|
|
21
|
+
require('./commands/suspensions.js')
|
|
21
22
|
]
|
package/lib/command.js
CHANGED
package/lib/skynet.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = class SkynetAPI {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
categories () {
|
|
27
|
-
return this.request(
|
|
27
|
+
return this.request('/categories', {
|
|
28
28
|
method: 'GET'
|
|
29
29
|
})
|
|
30
30
|
}
|
|
@@ -35,7 +35,7 @@ module.exports = class SkynetAPI {
|
|
|
35
35
|
notes: notes
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return this.request(
|
|
38
|
+
return this.request('/whitelist', {
|
|
39
39
|
method: 'POST',
|
|
40
40
|
body: body,
|
|
41
41
|
form: true
|
|
@@ -56,7 +56,7 @@ module.exports = class SkynetAPI {
|
|
|
56
56
|
flag: flag
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return this.request(
|
|
59
|
+
return this.request('/userpass/remove', {
|
|
60
60
|
method: 'POST',
|
|
61
61
|
body: body,
|
|
62
62
|
form: true
|
|
@@ -69,7 +69,7 @@ module.exports = class SkynetAPI {
|
|
|
69
69
|
flag: flag
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return this.request(
|
|
72
|
+
return this.request('/userpass/add', {
|
|
73
73
|
method: 'POST',
|
|
74
74
|
body: body,
|
|
75
75
|
form: true
|
|
@@ -126,7 +126,7 @@ module.exports = class SkynetAPI {
|
|
|
126
126
|
notify: notify
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
return this.request(
|
|
129
|
+
return this.request('/suspend/user', {
|
|
130
130
|
method: 'POST',
|
|
131
131
|
body: body,
|
|
132
132
|
form: true
|
|
@@ -152,7 +152,7 @@ module.exports = class SkynetAPI {
|
|
|
152
152
|
notify: notify
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return this.request(
|
|
155
|
+
return this.request('/suspend/user', {
|
|
156
156
|
method: 'POST',
|
|
157
157
|
body: body,
|
|
158
158
|
form: true
|
|
@@ -168,7 +168,7 @@ module.exports = class SkynetAPI {
|
|
|
168
168
|
bulk: 'true'
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
return this.request(
|
|
171
|
+
return this.request('/suspend/app-owner', {
|
|
172
172
|
method: 'POST',
|
|
173
173
|
body: body,
|
|
174
174
|
form: true
|
|
@@ -185,7 +185,7 @@ module.exports = class SkynetAPI {
|
|
|
185
185
|
notify: notify
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
return this.request(
|
|
188
|
+
return this.request('/deprovision', {
|
|
189
189
|
method: 'POST',
|
|
190
190
|
body: body,
|
|
191
191
|
form: true
|
|
@@ -198,7 +198,7 @@ module.exports = class SkynetAPI {
|
|
|
198
198
|
description: description
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
return this.request(
|
|
201
|
+
return this.request('/categories', {
|
|
202
202
|
method: 'POST',
|
|
203
203
|
body: body,
|
|
204
204
|
json: true
|
|
@@ -212,4 +212,10 @@ module.exports = class SkynetAPI {
|
|
|
212
212
|
json: true
|
|
213
213
|
})
|
|
214
214
|
}
|
|
215
|
+
|
|
216
|
+
suspensions (user) {
|
|
217
|
+
return this.request(`/v2/suspensions/${user}`, {
|
|
218
|
+
method: 'GET'
|
|
219
|
+
})
|
|
220
|
+
}
|
|
215
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/skynet",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"description": "use Skynet from Heroku CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Bob Argenbright @byt3smith",
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
"split": "^1.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"acorn": ">=6.4.1",
|
|
26
|
+
"minimist": ">=1.2.2",
|
|
25
27
|
"mocha": "^5.2.0",
|
|
26
28
|
"mockdate": "^2.0.1",
|
|
27
|
-
"nock": "
|
|
29
|
+
"nock": "^12.0.3",
|
|
28
30
|
"np": "^3.1.0",
|
|
29
|
-
"standard": "^
|
|
31
|
+
"standard": "^14.3.3",
|
|
30
32
|
"unexpected": "^10.29.0"
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|