@contentstack/cli-auth 0.1.1-beta.2 → 0.1.1-beta.3
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/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
|
|
|
18
18
|
$ csdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ csdx (-v|--version|version)
|
|
21
|
-
@contentstack/cli-auth/0.1.1-beta.
|
|
21
|
+
@contentstack/cli-auth/0.1.1-beta.3 linux-x64 node-v12.22.7
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
|
@@ -53,7 +53,7 @@ ALIASES
|
|
|
53
53
|
$ csdx login
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
_See code: [src/commands/auth/login.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
56
|
+
_See code: [src/commands/auth/login.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/login.js)_
|
|
57
57
|
|
|
58
58
|
## `csdx auth:logout`
|
|
59
59
|
|
|
@@ -72,7 +72,7 @@ ALIASES
|
|
|
72
72
|
$ csdx logout
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
_See code: [src/commands/auth/logout.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
75
|
+
_See code: [src/commands/auth/logout.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/logout.js)_
|
|
76
76
|
|
|
77
77
|
## `csdx auth:tokens`
|
|
78
78
|
|
|
@@ -99,7 +99,7 @@ ALIASES
|
|
|
99
99
|
$ csdx tokens
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
_See code: [src/commands/auth/tokens/index.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
102
|
+
_See code: [src/commands/auth/tokens/index.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/tokens/index.js)_
|
|
103
103
|
|
|
104
104
|
## `csdx auth:tokens:add`
|
|
105
105
|
|
|
@@ -130,7 +130,7 @@ ALIASES
|
|
|
130
130
|
$ csdx tokens:add
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
_See code: [src/commands/auth/tokens/add.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
133
|
+
_See code: [src/commands/auth/tokens/add.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/tokens/add.js)_
|
|
134
134
|
|
|
135
135
|
## `csdx auth:tokens:remove`
|
|
136
136
|
|
|
@@ -152,7 +152,7 @@ ALIASES
|
|
|
152
152
|
$ csdx tokens:remove
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
_See code: [src/commands/auth/tokens/remove.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
155
|
+
_See code: [src/commands/auth/tokens/remove.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/tokens/remove.js)_
|
|
156
156
|
|
|
157
157
|
## `csdx auth:whoami`
|
|
158
158
|
|
|
@@ -169,5 +169,5 @@ ALIASES
|
|
|
169
169
|
$ csdx whoami
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
_See code: [src/commands/auth/whoami.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.
|
|
172
|
+
_See code: [src/commands/auth/whoami.js](https://github.com/contentstack/cli/blob/v0.1.1-beta.3/packages/auth/src/commands/auth/whoami.js)_
|
|
173
173
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.1.1-beta.
|
|
1
|
+
{"version":"0.1.1-beta.3","commands":{"auth:login":{"id":"auth:login","description":"Login to Contentstack and save the session for further use","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["login"],"flags":{"username":{"name":"username","type":"option","char":"u","description":"Email address of your Contentstack account"}},"args":[]},"auth:logout":{"id":"auth:logout","description":"Log out from Contentstack and clear the session","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["logout"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"Exclude confirmation to logout","allowNo":false}},"args":[]},"auth:whoami":{"id":"auth:whoami","description":"Display current users email address\n","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["whoami"],"flags":{},"args":[]},"auth:tokens:add":{"id":"auth:tokens:add","description":"Adds management/delivery tokens to your session to use it with further CLI command\nby default it adds management token if either of management or delivery flags are not set","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["tokens:add"],"flags":{"alias":{"name":"alias","type":"option","char":"a"},"delivery":{"name":"delivery","type":"boolean","char":"d","description":"Set this while saving delivery token","allowNo":false},"management":{"name":"management","type":"boolean","char":"m","description":"Set this while saving management token","allowNo":false},"environment":{"name":"environment","type":"option","char":"e","description":"Environment name for delivery token"},"api-key":{"name":"api-key","type":"option","char":"k","description":"Stack API key for the token"},"force":{"name":"force","type":"boolean","char":"f","description":"Exclude confirmation to replace existing alias","allowNo":false},"token":{"name":"token","type":"option","char":"t","description":"Sets token. Can be set via environment variable 'TOKEN'. We recommend to use env variable"}},"args":[]},"auth:tokens":{"id":"auth:tokens","description":"Lists all existing tokens added to the session \n","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["tokens"],"flags":{"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)"},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"auth:tokens:remove":{"id":"auth:tokens:remove","description":"Removes stored tokens","pluginName":"@contentstack/cli-auth","pluginType":"core","aliases":["tokens:remove"],"flags":{"alias":{"name":"alias","type":"option","char":"a","description":"Alias (name) of the token to remove"},"ignore":{"name":"ignore","type":"boolean","char":"i","description":"Ignores if token not present. Command shows show list of available aliases with multi select option to delete tokens from that list.","allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-auth",
|
|
3
3
|
"description": "Contentstack CLI plugin for authentication activities",
|
|
4
|
-
"version": "0.1.1-beta.
|
|
4
|
+
"version": "0.1.1-beta.3",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "0.1.1-beta.
|
|
8
|
+
"@contentstack/cli-command": "^0.1.1-beta.6",
|
|
9
9
|
"@oclif/command": "^1.6.1",
|
|
10
10
|
"@oclif/config": "^1.15.1",
|
|
11
11
|
"chalk": "^4.0.0",
|
|
@@ -15,8 +15,8 @@ class LoginCommand extends Command {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const authHandler = new AuthHandler(opts)
|
|
18
|
-
const
|
|
19
|
-
let username =
|
|
18
|
+
const loginCommandFlags = this.parse(LoginCommand).flags
|
|
19
|
+
let username = loginCommandFlags.username ? loginCommandFlags.username : await cli.prompt(messages.promptEmailAddress)
|
|
20
20
|
|
|
21
21
|
const password = await cli.prompt(messages.promptPassword, {type: 'hide'})
|
|
22
22
|
try {
|
|
@@ -8,9 +8,9 @@ const messages = new Messages('logout').msgs
|
|
|
8
8
|
|
|
9
9
|
class LogoutCommand extends Command {
|
|
10
10
|
async run() {
|
|
11
|
-
const
|
|
11
|
+
const logoutCommandFlags = this.parse(LogoutCommand).flags
|
|
12
12
|
let confirm = false
|
|
13
|
-
confirm =
|
|
13
|
+
confirm = logoutCommandFlags.force ? true : await cli.confirm(messages.promptConfirmLogout)
|
|
14
14
|
const opts = {
|
|
15
15
|
contentstackClient: this.managementAPIClient,
|
|
16
16
|
}
|
|
@@ -11,14 +11,14 @@ const config = new Configstore('contentstack_cli')
|
|
|
11
11
|
class AddCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
13
|
let isReplace = false
|
|
14
|
-
const
|
|
15
|
-
let forced =
|
|
16
|
-
let alias =
|
|
17
|
-
let apiKey =
|
|
18
|
-
let token =
|
|
19
|
-
let isDelivery =
|
|
20
|
-
let isManagement =
|
|
21
|
-
let environment =
|
|
14
|
+
const addCommandFlags = this.parse(AddCommand).flags
|
|
15
|
+
let forced = addCommandFlags.force
|
|
16
|
+
let alias = addCommandFlags.alias
|
|
17
|
+
let apiKey = addCommandFlags['api-key']
|
|
18
|
+
let token = addCommandFlags.token
|
|
19
|
+
let isDelivery = addCommandFlags.delivery
|
|
20
|
+
let isManagement = addCommandFlags.management
|
|
21
|
+
let environment = addCommandFlags.environment
|
|
22
22
|
let configKeyTokens = 'tokens'
|
|
23
23
|
let type = (isDelivery || Boolean(environment)) ? 'delivery' : 'management'
|
|
24
24
|
debug(`Adding ${type} token`)
|
|
@@ -9,9 +9,9 @@ const config = new Configstore('contentstack_cli')
|
|
|
9
9
|
|
|
10
10
|
class RemoveCommand extends Command {
|
|
11
11
|
async run() {
|
|
12
|
-
const
|
|
13
|
-
let alias =
|
|
14
|
-
let ignore =
|
|
12
|
+
const removeCommandFlags = this.parse(RemoveCommand).flags
|
|
13
|
+
let alias = removeCommandFlags.alias
|
|
14
|
+
let ignore = removeCommandFlags.ignore
|
|
15
15
|
|
|
16
16
|
let token = config.get(`tokens.${alias}`)
|
|
17
17
|
const tokens = config.get('tokens')
|