@contentstack/cli-auth 2.0.0-beta.14 → 2.0.0-beta.16

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
@@ -1,6 +1,6 @@
1
1
  # @contentstack/cli-auth
2
2
 
3
- It is Contentstack’s CLI plugin to perform authentication-related activities. To get started with authentication, refer to the [CLI’s Authentication documentation](https://www.contentstack.com/docs/developers/cli/authentication)
3
+ It is Contentstack’s CLI plugin to perform authentication-related activities. To get started with authentication, refer to the [CLI’s Authentication documentation](https://www.contentstack.com/docs/headless-cms/cli/authentication)
4
4
 
5
5
  [![License](https://img.shields.io/npm/l/@contentstack/cli)](https://github.com/contentstack/cli/blob/main/LICENSE)
6
6
 
@@ -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/2.0.0-beta.14 linux-x64 node-v22.23.0
21
+ @contentstack/cli-auth/2.0.0-beta.16 linux-x64 node-v22.23.1
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -212,11 +212,10 @@ Removes selected tokens
212
212
 
213
213
  ```
214
214
  USAGE
215
- $ csdx auth:tokens:remove [-a <value>] [-i]
215
+ $ csdx auth:tokens:remove [-a <value>]
216
216
 
217
217
  FLAGS
218
218
  -a, --alias=<value> Alias (name) of the token to delete.
219
- -i, --ignore Ignores if the token is not present.
220
219
 
221
220
  DESCRIPTION
222
221
  Removes selected tokens
@@ -231,14 +230,14 @@ _See code: [src/commands/auth/tokens/remove.ts](https://github.com/contentstack/
231
230
 
232
231
  ## `csdx auth:whoami`
233
232
 
234
- Display current users email address
233
+ Display current user's email address
235
234
 
236
235
  ```
237
236
  USAGE
238
237
  $ csdx auth:whoami
239
238
 
240
239
  DESCRIPTION
241
- Display current users email address
240
+ Display current user's email address
242
241
 
243
242
  ALIASES
244
243
  $ csdx whoami
@@ -307,14 +306,14 @@ EXAMPLES
307
306
 
308
307
  ## `csdx whoami`
309
308
 
310
- Display current users email address
309
+ Display current user's email address
311
310
 
312
311
  ```
313
312
  USAGE
314
313
  $ csdx whoami
315
314
 
316
315
  DESCRIPTION
317
- Display current users email address
316
+ Display current user's email address
318
317
 
319
318
  ALIASES
320
319
  $ csdx whoami
@@ -9,17 +9,20 @@ class TokensRemoveCommand extends base_command_1.BaseCommand {
9
9
  const { flags: removeTokenFlags } = await this.parse(TokensRemoveCommand);
10
10
  cli_utilities_1.log.debug('Token removal flags parsed.', Object.assign(Object.assign({}, this.contextDetails), { flags: removeTokenFlags }));
11
11
  const alias = removeTokenFlags.alias;
12
- const ignore = removeTokenFlags.ignore;
13
- cli_utilities_1.log.debug('Token removal parameters set.', Object.assign(Object.assign({}, this.contextDetails), { alias, ignore }));
12
+ cli_utilities_1.log.debug('Token removal parameters set.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
14
13
  try {
15
14
  cli_utilities_1.log.debug('Retrieving token from configuration.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
16
15
  const token = cli_utilities_1.configHandler.get(`tokens.${alias}`);
17
16
  cli_utilities_1.log.debug('Token retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token, tokenType: token === null || token === void 0 ? void 0 : token.type }));
17
+ if (alias && !token) {
18
+ cli_utilities_1.log.debug('Alias provided but token not found.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
19
+ return cli_utilities_1.cliux.print(`No token found with alias '${alias}'.`, { color: 'yellow' });
20
+ }
18
21
  const tokens = cli_utilities_1.configHandler.get('tokens');
19
22
  cli_utilities_1.log.debug('All tokens retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: tokens ? Object.keys(tokens).length : 0 }));
20
23
  const tokenOptions = [];
21
- if (token || ignore) {
22
- cli_utilities_1.log.debug('Token found, or ignore flag set.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token, ignore }));
24
+ if (token) {
25
+ cli_utilities_1.log.debug('Token found.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token }));
23
26
  cli_utilities_1.configHandler.delete(`tokens.${alias}`);
24
27
  cli_utilities_1.log.debug('Token removed from configuration.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
25
28
  return cli_utilities_1.cliux.success(`CLI_AUTH_TOKENS_REMOVE_SUCCESS`);
@@ -74,5 +77,4 @@ TokensRemoveCommand.description = 'Removes selected tokens';
74
77
  TokensRemoveCommand.examples = ['$ csdx auth:tokens:remove', '$ csdx auth:tokens:remove -a <alias>'];
75
78
  TokensRemoveCommand.flags = {
76
79
  alias: cli_utilities_1.flags.string({ char: 'a', description: 'Alias (name) of the token to delete.' }),
77
- ignore: cli_utilities_1.flags.boolean({ char: 'i', description: 'Ignores if the token is not present.' }),
78
80
  };
@@ -26,6 +26,6 @@ class WhoamiCommand extends base_command_1.BaseCommand {
26
26
  }
27
27
  }
28
28
  exports.default = WhoamiCommand;
29
- WhoamiCommand.description = 'Display current users email address';
29
+ WhoamiCommand.description = "Display current user's email address";
30
30
  WhoamiCommand.examples = ['$ csdx auth:whoami'];
31
31
  WhoamiCommand.aliases = ['whoami'];
@@ -106,7 +106,7 @@
106
106
  "whoami"
107
107
  ],
108
108
  "args": {},
109
- "description": "Display current users email address",
109
+ "description": "Display current user's email address",
110
110
  "examples": [
111
111
  "$ csdx auth:whoami"
112
112
  ],
@@ -416,13 +416,6 @@
416
416
  "hasDynamicHelp": false,
417
417
  "multiple": false,
418
418
  "type": "option"
419
- },
420
- "ignore": {
421
- "char": "i",
422
- "description": "Ignores if the token is not present.",
423
- "name": "ignore",
424
- "allowNo": false,
425
- "type": "boolean"
426
419
  }
427
420
  },
428
421
  "hasDynamicHelp": false,
@@ -442,5 +435,5 @@
442
435
  ]
443
436
  }
444
437
  },
445
- "version": "2.0.0-beta.14"
438
+ "version": "2.0.0-beta.16"
446
439
  }
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": "2.0.0-beta.14",
4
+ "version": "2.0.0-beta.16",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "scripts": {
@@ -15,8 +15,8 @@
15
15
  "lint": "eslint src/**/*.ts"
16
16
  },
17
17
  "dependencies": {
18
- "@contentstack/cli-command": "~2.0.0-beta.9",
19
- "@contentstack/cli-utilities": "~2.0.0-beta.10",
18
+ "@contentstack/cli-command": "~2.0.0-beta.10",
19
+ "@contentstack/cli-utilities": "~2.0.0-beta.11",
20
20
  "@oclif/core": "^4.11.4",
21
21
  "otplib": "^12.0.1"
22
22
  },
@@ -75,5 +75,9 @@
75
75
  "auth:tokens:remove": "RMVTKN"
76
76
  }
77
77
  },
78
- "repository": "contentstack/cli"
79
- }
78
+ "repository": {
79
+ "type": "git",
80
+ "url": "git+https://github.com/contentstack/cli.git",
81
+ "directory": "packages/contentstack-auth"
82
+ }
83
+ }