@contentstack/cli-auth 1.3.12 → 1.3.13

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 (--version)
21
- @contentstack/cli-auth/1.3.12 linux-x64 node-v18.17.0
21
+ @contentstack/cli-auth/1.3.13 linux-x64 node-v18.17.1
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -17,21 +17,21 @@ class LogoutCommand extends cli_command_1.Command {
17
17
  try {
18
18
  const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)({ host: this.cmaHost, skipTokenValidity: true });
19
19
  utils_1.authHandler.client = managementAPIClient;
20
- if ((await cli_utilities_1.authHandler.isAuthenticated()) && (await cli_utilities_1.authHandler.isAuthorisationTypeBasic())) {
21
- if (confirm === true) {
22
- cli_utilities_1.cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
20
+ if (confirm === true && (await cli_utilities_1.authHandler.isAuthenticated())) {
21
+ cli_utilities_1.cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
22
+ if (await cli_utilities_1.authHandler.isAuthorisationTypeBasic()) {
23
23
  await utils_1.authHandler.logout(cli_utilities_1.configHandler.get('authtoken'));
24
- cli_utilities_1.cliux.loader('');
25
- cli_utilities_1.logger.info('successfully logged out');
26
- cli_utilities_1.cliux.success('CLI_AUTH_LOGOUT_SUCCESS');
27
24
  }
28
- }
29
- else {
30
- cli_utilities_1.cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
25
+ else if (await cli_utilities_1.authHandler.isAuthorisationTypeOAuth()) {
26
+ await cli_utilities_1.authHandler.oauthLogout();
27
+ }
31
28
  cli_utilities_1.cliux.loader('');
32
29
  cli_utilities_1.logger.info('successfully logged out');
33
30
  cli_utilities_1.cliux.success('CLI_AUTH_LOGOUT_SUCCESS');
34
31
  }
32
+ else {
33
+ cli_utilities_1.cliux.success('CLI_AUTH_LOGOUT_ALREADY');
34
+ }
35
35
  }
36
36
  catch (error) {
37
37
  let errorMessage = '';
@@ -17,6 +17,7 @@
17
17
  "CLI_AUTH_LOGOUT_FAILED": "Error in logout, please login again",
18
18
  "CLI_AUTH_LOGOUT_DESCRIPTION": "User session logout",
19
19
  "CLI_AUTH_LOGOUT_FLAG_FORCE": "Force logging out for skipping the confirmation",
20
+ "CLI_AUTH_LOGOUT_ALREADY": "You're already logged out",
20
21
  "CLI_AUTH_WHOAMI_LOGGED_IN_AS": "You are currently logged in with email",
21
22
  "CLI_AUTH_WHOAMI_FAILED": "Failed to get the current user details",
22
23
  "CLI_AUTH_WHOAMI_DESCRIPTION": "Display current users email address",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.12",
2
+ "version": "1.3.13",
3
3
  "commands": {
4
4
  "auth:login": {
5
5
  "id": "auth:login",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-auth",
3
3
  "description": "Contentstack CLI plugin for authentication activities",
4
- "version": "1.3.12",
4
+ "version": "1.3.13",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
23
23
  },
24
24
  "dependencies": {
25
- "@contentstack/cli-command": "^1.2.11",
26
- "@contentstack/cli-utilities": "^1.5.1",
25
+ "@contentstack/cli-command": "~1.2.12",
26
+ "@contentstack/cli-utilities": "~1.5.2",
27
27
  "chalk": "^4.0.0",
28
28
  "debug": "^4.1.1",
29
29
  "inquirer": "8.2.4",