@contentstack/cli-auth 2.0.0-beta.9 → 2.0.1
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 +43 -44
- package/lib/commands/auth/tokens/add.js +0 -6
- package/lib/commands/auth/tokens/index.d.ts +4 -4
- package/lib/commands/auth/tokens/index.js +17 -61
- package/lib/commands/auth/tokens/list.d.ts +8 -0
- package/lib/commands/auth/tokens/list.js +63 -0
- package/lib/commands/auth/tokens/remove.js +7 -5
- package/lib/commands/auth/whoami.js +1 -1
- package/lib/interfaces/index.d.ts +1 -1
- package/oclif.manifest.json +90 -23
- package/package.json +25 -26
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/
|
|
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
|
[](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.
|
|
21
|
+
@contentstack/cli-auth/2.0.1 linux-x64 node-v22.23.2
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
|
@@ -33,11 +33,11 @@ USAGE
|
|
|
33
33
|
* [`csdx auth:logout`](#csdx-authlogout)
|
|
34
34
|
* [`csdx auth:tokens`](#csdx-authtokens)
|
|
35
35
|
* [`csdx auth:tokens:add [-a <value>] [--delivery] [--management] [-e <value>] [-k <value>] [-y] [--token <value>]`](#csdx-authtokensadd--a-value---delivery---management--e-value--k-value--y---token-value)
|
|
36
|
+
* [`csdx auth:tokens:list`](#csdx-authtokenslist)
|
|
36
37
|
* [`csdx auth:tokens:remove`](#csdx-authtokensremove)
|
|
37
38
|
* [`csdx auth:whoami`](#csdx-authwhoami)
|
|
38
39
|
* [`csdx login`](#csdx-login)
|
|
39
40
|
* [`csdx logout`](#csdx-logout)
|
|
40
|
-
* [`csdx tokens`](#csdx-tokens)
|
|
41
41
|
* [`csdx whoami`](#csdx-whoami)
|
|
42
42
|
|
|
43
43
|
## `csdx auth:login`
|
|
@@ -102,7 +102,7 @@ _See code: [src/commands/auth/logout.ts](https://github.com/contentstack/cli/blo
|
|
|
102
102
|
|
|
103
103
|
## `csdx auth:tokens`
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Manage authentication tokens for API access
|
|
106
106
|
|
|
107
107
|
```
|
|
108
108
|
USAGE
|
|
@@ -120,13 +120,14 @@ TABLE FLAGS
|
|
|
120
120
|
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
121
121
|
|
|
122
122
|
DESCRIPTION
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
ALIASES
|
|
126
|
-
$ csdx tokens
|
|
123
|
+
Manage authentication tokens for API access
|
|
127
124
|
|
|
128
125
|
EXAMPLES
|
|
129
|
-
$ csdx auth:tokens
|
|
126
|
+
$ csdx auth:tokens:list
|
|
127
|
+
|
|
128
|
+
$ csdx auth:tokens:add --alias mytoken
|
|
129
|
+
|
|
130
|
+
$ csdx auth:tokens:remove --alias mytoken
|
|
130
131
|
```
|
|
131
132
|
|
|
132
133
|
_See code: [src/commands/auth/tokens/index.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-auth/src/commands/auth/tokens/index.ts)_
|
|
@@ -177,17 +178,44 @@ EXAMPLES
|
|
|
177
178
|
|
|
178
179
|
_See code: [src/commands/auth/tokens/add.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-auth/src/commands/auth/tokens/add.ts)_
|
|
179
180
|
|
|
181
|
+
## `csdx auth:tokens:list`
|
|
182
|
+
|
|
183
|
+
Lists all existing tokens added to the session
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
USAGE
|
|
187
|
+
$ csdx auth:tokens:list [--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate]
|
|
188
|
+
[--no-header] [--output csv|json|yaml]
|
|
189
|
+
|
|
190
|
+
TABLE FLAGS
|
|
191
|
+
--columns=<value> Specify columns to display, comma-separated.
|
|
192
|
+
--csv Output results in CSV format.
|
|
193
|
+
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
194
|
+
--no-header Hide table headers in output.
|
|
195
|
+
--no-truncate Prevent truncation of long text in columns.
|
|
196
|
+
--output=<option> Specify output format: csv, json, or yaml.
|
|
197
|
+
<options: csv|json|yaml>
|
|
198
|
+
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
199
|
+
|
|
200
|
+
DESCRIPTION
|
|
201
|
+
Lists all existing tokens added to the session
|
|
202
|
+
|
|
203
|
+
EXAMPLES
|
|
204
|
+
$ csdx auth:tokens:list
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
_See code: [src/commands/auth/tokens/list.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-auth/src/commands/auth/tokens/list.ts)_
|
|
208
|
+
|
|
180
209
|
## `csdx auth:tokens:remove`
|
|
181
210
|
|
|
182
211
|
Removes selected tokens
|
|
183
212
|
|
|
184
213
|
```
|
|
185
214
|
USAGE
|
|
186
|
-
$ csdx auth:tokens:remove [-a <value>]
|
|
215
|
+
$ csdx auth:tokens:remove [-a <value>]
|
|
187
216
|
|
|
188
217
|
FLAGS
|
|
189
218
|
-a, --alias=<value> Alias (name) of the token to delete.
|
|
190
|
-
-i, --ignore Ignores if the token is not present.
|
|
191
219
|
|
|
192
220
|
DESCRIPTION
|
|
193
221
|
Removes selected tokens
|
|
@@ -202,14 +230,14 @@ _See code: [src/commands/auth/tokens/remove.ts](https://github.com/contentstack/
|
|
|
202
230
|
|
|
203
231
|
## `csdx auth:whoami`
|
|
204
232
|
|
|
205
|
-
Display current
|
|
233
|
+
Display current user's email address
|
|
206
234
|
|
|
207
235
|
```
|
|
208
236
|
USAGE
|
|
209
237
|
$ csdx auth:whoami
|
|
210
238
|
|
|
211
239
|
DESCRIPTION
|
|
212
|
-
Display current
|
|
240
|
+
Display current user's email address
|
|
213
241
|
|
|
214
242
|
ALIASES
|
|
215
243
|
$ csdx whoami
|
|
@@ -276,45 +304,16 @@ EXAMPLES
|
|
|
276
304
|
$ csdx auth:logout --yes
|
|
277
305
|
```
|
|
278
306
|
|
|
279
|
-
## `csdx tokens`
|
|
280
|
-
|
|
281
|
-
Lists all existing tokens added to the session
|
|
282
|
-
|
|
283
|
-
```
|
|
284
|
-
USAGE
|
|
285
|
-
$ csdx tokens [--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate]
|
|
286
|
-
[--no-header] [--output csv|json|yaml]
|
|
287
|
-
|
|
288
|
-
TABLE FLAGS
|
|
289
|
-
--columns=<value> Specify columns to display, comma-separated.
|
|
290
|
-
--csv Output results in CSV format.
|
|
291
|
-
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
292
|
-
--no-header Hide table headers in output.
|
|
293
|
-
--no-truncate Prevent truncation of long text in columns.
|
|
294
|
-
--output=<option> Specify output format: csv, json, or yaml.
|
|
295
|
-
<options: csv|json|yaml>
|
|
296
|
-
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
297
|
-
|
|
298
|
-
DESCRIPTION
|
|
299
|
-
Lists all existing tokens added to the session
|
|
300
|
-
|
|
301
|
-
ALIASES
|
|
302
|
-
$ csdx tokens
|
|
303
|
-
|
|
304
|
-
EXAMPLES
|
|
305
|
-
$ csdx auth:tokens
|
|
306
|
-
```
|
|
307
|
-
|
|
308
307
|
## `csdx whoami`
|
|
309
308
|
|
|
310
|
-
Display current
|
|
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
|
|
316
|
+
Display current user's email address
|
|
318
317
|
|
|
319
318
|
ALIASES
|
|
320
319
|
$ csdx whoami
|
|
@@ -158,11 +158,5 @@ TokensAddCommand.flags = {
|
|
|
158
158
|
description: 'Add the token name',
|
|
159
159
|
env: 'TOKEN',
|
|
160
160
|
}),
|
|
161
|
-
branch: cli_utilities_1.flags.string({
|
|
162
|
-
required: false,
|
|
163
|
-
multiple: false,
|
|
164
|
-
description: 'Branch name',
|
|
165
|
-
hidden: true,
|
|
166
|
-
}),
|
|
167
161
|
};
|
|
168
162
|
TokensAddCommand.usage = 'auth:tokens:add [-a <value>] [--delivery] [--management] [-e <value>] [-k <value>] [-y] [--token <value>]';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FlagInput } from '@contentstack/cli-utilities';
|
|
2
1
|
import { BaseCommand } from '../../../base-command';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
static examples: string[];
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class AuthTokensCommand extends BaseCommand<typeof AuthTokensCommand> {
|
|
6
4
|
static description: string;
|
|
5
|
+
static strict: boolean;
|
|
6
|
+
static examples: string[];
|
|
7
7
|
static flags: FlagInput;
|
|
8
8
|
run(): Promise<any>;
|
|
9
9
|
}
|
|
@@ -1,69 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
|
-
|
|
5
|
+
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
|
+
class AuthTokensCommand extends base_command_1.BaseCommand {
|
|
6
7
|
async run() {
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const managementTokens = cli_utilities_1.configHandler.get('tokens');
|
|
12
|
-
cli_utilities_1.log.debug('Tokens retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: managementTokens ? Object.keys(managementTokens).length : 0 }));
|
|
13
|
-
const tokens = [];
|
|
14
|
-
if (managementTokens && Object.keys(managementTokens).length > 0) {
|
|
15
|
-
cli_utilities_1.log.debug('Processing tokens for display.', this.contextDetails);
|
|
16
|
-
Object.keys(managementTokens).forEach(function (item) {
|
|
17
|
-
tokens.push({
|
|
18
|
-
alias: item,
|
|
19
|
-
token: managementTokens[item].token,
|
|
20
|
-
apiKey: managementTokens[item].apiKey,
|
|
21
|
-
environment: managementTokens[item].environment ? managementTokens[item].environment : '-',
|
|
22
|
-
type: managementTokens[item].type,
|
|
23
|
-
});
|
|
24
|
-
cli_utilities_1.log.debug(`Token processed: ${item}`, { tokenType: managementTokens[item].type });
|
|
25
|
-
});
|
|
26
|
-
const { flags } = await this.parse(TokensListCommand);
|
|
27
|
-
cli_utilities_1.log.debug('Token list flags parsed.', Object.assign(Object.assign({}, this.contextDetails), { flags }));
|
|
28
|
-
const headers = [
|
|
29
|
-
{
|
|
30
|
-
value: 'alias',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
value: 'token',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
value: 'apiKey',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: 'environment',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
value: 'type',
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
cli_utilities_1.log.debug('Displaying token table.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: tokens.length }));
|
|
46
|
-
cli_utilities_1.cliux.table(headers, tokens, flags);
|
|
47
|
-
cli_utilities_1.log.debug('Token table displayed successfully.', this.contextDetails);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
cli_utilities_1.log.debug('No tokens found in configuration.', this.contextDetails);
|
|
51
|
-
cli_utilities_1.cliux.print('CLI_AUTH_TOKENS_LIST_NO_TOKENS');
|
|
52
|
-
}
|
|
53
|
-
cli_utilities_1.log.debug('Token list command completed successfully.', this.contextDetails);
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
cli_utilities_1.log.debug('Token list command failed.', Object.assign(Object.assign({}, this.contextDetails), { error }));
|
|
57
|
-
cli_utilities_1.cliux.print('CLI_AUTH_TOKENS_LIST_FAILED', { color: 'yellow' });
|
|
58
|
-
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.contextDetails));
|
|
59
|
-
}
|
|
8
|
+
await this.parse(AuthTokensCommand, this.argv.filter((a) => a !== '-help' && a !== '-h'));
|
|
9
|
+
const cmd = this.config.findCommand('auth:tokens');
|
|
10
|
+
if (cmd)
|
|
11
|
+
await new core_1.Help(this.config).showCommandHelp(cmd);
|
|
60
12
|
}
|
|
61
13
|
}
|
|
62
|
-
exports.default =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
14
|
+
exports.default = AuthTokensCommand;
|
|
15
|
+
AuthTokensCommand.description = 'Manage authentication tokens for API access';
|
|
16
|
+
AuthTokensCommand.strict = false;
|
|
17
|
+
AuthTokensCommand.examples = [
|
|
18
|
+
'$ csdx auth:tokens:list',
|
|
19
|
+
'$ csdx auth:tokens:add --alias mytoken',
|
|
20
|
+
'$ csdx auth:tokens:remove --alias mytoken',
|
|
21
|
+
];
|
|
22
|
+
AuthTokensCommand.flags = cli_utilities_1.CLITable.getTableFlags([
|
|
67
23
|
'columns',
|
|
68
24
|
'sort',
|
|
69
25
|
'filter',
|
|
@@ -71,4 +27,4 @@ TokensListCommand.flags = cli_utilities_1.CLITable.getTableFlags([
|
|
|
71
27
|
'no-truncate',
|
|
72
28
|
'no-header',
|
|
73
29
|
'output',
|
|
74
|
-
]);
|
|
30
|
+
]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
2
|
+
import { BaseCommand } from '../../../base-command';
|
|
3
|
+
export default class AuthTokensListCommand extends BaseCommand<typeof AuthTokensListCommand> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: FlagInput;
|
|
7
|
+
run(): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
class AuthTokensListCommand extends base_command_1.BaseCommand {
|
|
6
|
+
async run() {
|
|
7
|
+
cli_utilities_1.log.debug('AuthTokensListCommand run method started.', this.contextDetails);
|
|
8
|
+
this.contextDetails.module = 'auth-tokens-list';
|
|
9
|
+
try {
|
|
10
|
+
cli_utilities_1.log.debug('Retrieving tokens from configuration.', this.contextDetails);
|
|
11
|
+
const managementTokens = cli_utilities_1.configHandler.get('tokens');
|
|
12
|
+
cli_utilities_1.log.debug('Tokens retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: managementTokens ? Object.keys(managementTokens).length : 0 }));
|
|
13
|
+
const tokens = [];
|
|
14
|
+
if (managementTokens && Object.keys(managementTokens).length > 0) {
|
|
15
|
+
cli_utilities_1.log.debug('Processing tokens for display.', this.contextDetails);
|
|
16
|
+
Object.keys(managementTokens).forEach(function (item) {
|
|
17
|
+
tokens.push({
|
|
18
|
+
alias: item,
|
|
19
|
+
token: managementTokens[item].token,
|
|
20
|
+
apiKey: managementTokens[item].apiKey,
|
|
21
|
+
environment: managementTokens[item].environment ? managementTokens[item].environment : '-',
|
|
22
|
+
type: managementTokens[item].type,
|
|
23
|
+
});
|
|
24
|
+
cli_utilities_1.log.debug(`Token processed: ${item}`, { tokenType: managementTokens[item].type });
|
|
25
|
+
});
|
|
26
|
+
const { flags } = await this.parse(AuthTokensListCommand);
|
|
27
|
+
cli_utilities_1.log.debug('Token list flags parsed.', Object.assign(Object.assign({}, this.contextDetails), { flags }));
|
|
28
|
+
const headers = [
|
|
29
|
+
{ value: 'alias' },
|
|
30
|
+
{ value: 'token' },
|
|
31
|
+
{ value: 'apiKey' },
|
|
32
|
+
{ value: 'environment' },
|
|
33
|
+
{ value: 'type' },
|
|
34
|
+
];
|
|
35
|
+
cli_utilities_1.log.debug('Displaying token table.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: tokens.length }));
|
|
36
|
+
cli_utilities_1.cliux.table(headers, tokens, flags);
|
|
37
|
+
cli_utilities_1.log.debug('Token table displayed successfully.', this.contextDetails);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
cli_utilities_1.log.debug('No tokens found in configuration.', this.contextDetails);
|
|
41
|
+
cli_utilities_1.cliux.print('CLI_AUTH_TOKENS_LIST_NO_TOKENS');
|
|
42
|
+
}
|
|
43
|
+
cli_utilities_1.log.debug('Token list command completed successfully.', this.contextDetails);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
cli_utilities_1.log.debug('Token list command failed.', Object.assign(Object.assign({}, this.contextDetails), { error }));
|
|
47
|
+
cli_utilities_1.cliux.print('CLI_AUTH_TOKENS_LIST_FAILED', { color: 'yellow' });
|
|
48
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.contextDetails));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = AuthTokensListCommand;
|
|
53
|
+
AuthTokensListCommand.description = 'Lists all existing tokens added to the session';
|
|
54
|
+
AuthTokensListCommand.examples = ['$ csdx auth:tokens:list'];
|
|
55
|
+
AuthTokensListCommand.flags = cli_utilities_1.CLITable.getTableFlags([
|
|
56
|
+
'columns',
|
|
57
|
+
'sort',
|
|
58
|
+
'filter',
|
|
59
|
+
'csv',
|
|
60
|
+
'no-truncate',
|
|
61
|
+
'no-header',
|
|
62
|
+
'output',
|
|
63
|
+
]);
|
|
@@ -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
|
-
|
|
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
|
|
22
|
-
cli_utilities_1.log.debug('Token found
|
|
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 =
|
|
29
|
+
WhoamiCommand.description = "Display current user's email address";
|
|
30
30
|
WhoamiCommand.examples = ['$ csdx auth:whoami'];
|
|
31
31
|
WhoamiCommand.aliases = ['whoami'];
|
package/oclif.manifest.json
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"whoami"
|
|
107
107
|
],
|
|
108
108
|
"args": {},
|
|
109
|
-
"description": "Display current
|
|
109
|
+
"description": "Display current user's email address",
|
|
110
110
|
"examples": [
|
|
111
111
|
"$ csdx auth:whoami"
|
|
112
112
|
],
|
|
@@ -204,15 +204,6 @@
|
|
|
204
204
|
"hasDynamicHelp": false,
|
|
205
205
|
"multiple": false,
|
|
206
206
|
"type": "option"
|
|
207
|
-
},
|
|
208
|
-
"branch": {
|
|
209
|
-
"description": "Branch name",
|
|
210
|
-
"hidden": true,
|
|
211
|
-
"name": "branch",
|
|
212
|
-
"required": false,
|
|
213
|
-
"hasDynamicHelp": false,
|
|
214
|
-
"multiple": false,
|
|
215
|
-
"type": "option"
|
|
216
207
|
}
|
|
217
208
|
},
|
|
218
209
|
"hasDynamicHelp": false,
|
|
@@ -233,13 +224,96 @@
|
|
|
233
224
|
]
|
|
234
225
|
},
|
|
235
226
|
"auth:tokens": {
|
|
236
|
-
"aliases": [
|
|
237
|
-
|
|
227
|
+
"aliases": [],
|
|
228
|
+
"args": {},
|
|
229
|
+
"description": "Manage authentication tokens for API access",
|
|
230
|
+
"examples": [
|
|
231
|
+
"$ csdx auth:tokens:list",
|
|
232
|
+
"$ csdx auth:tokens:add --alias mytoken",
|
|
233
|
+
"$ csdx auth:tokens:remove --alias mytoken"
|
|
238
234
|
],
|
|
235
|
+
"flags": {
|
|
236
|
+
"columns": {
|
|
237
|
+
"description": "Specify columns to display, comma-separated.",
|
|
238
|
+
"helpGroup": "TABLE",
|
|
239
|
+
"name": "columns",
|
|
240
|
+
"hasDynamicHelp": false,
|
|
241
|
+
"multiple": false,
|
|
242
|
+
"type": "option"
|
|
243
|
+
},
|
|
244
|
+
"sort": {
|
|
245
|
+
"description": "Sort the table by a column. Use \"-\" for descending.",
|
|
246
|
+
"helpGroup": "TABLE",
|
|
247
|
+
"name": "sort",
|
|
248
|
+
"hasDynamicHelp": false,
|
|
249
|
+
"multiple": false,
|
|
250
|
+
"type": "option"
|
|
251
|
+
},
|
|
252
|
+
"filter": {
|
|
253
|
+
"description": "Filter rows by a column value (e.g., name=foo).",
|
|
254
|
+
"helpGroup": "TABLE",
|
|
255
|
+
"name": "filter",
|
|
256
|
+
"hasDynamicHelp": false,
|
|
257
|
+
"multiple": false,
|
|
258
|
+
"type": "option"
|
|
259
|
+
},
|
|
260
|
+
"csv": {
|
|
261
|
+
"description": "Output results in CSV format.",
|
|
262
|
+
"helpGroup": "TABLE",
|
|
263
|
+
"name": "csv",
|
|
264
|
+
"allowNo": false,
|
|
265
|
+
"type": "boolean"
|
|
266
|
+
},
|
|
267
|
+
"no-truncate": {
|
|
268
|
+
"description": "Prevent truncation of long text in columns.",
|
|
269
|
+
"helpGroup": "TABLE",
|
|
270
|
+
"name": "no-truncate",
|
|
271
|
+
"allowNo": false,
|
|
272
|
+
"type": "boolean"
|
|
273
|
+
},
|
|
274
|
+
"no-header": {
|
|
275
|
+
"description": "Hide table headers in output.",
|
|
276
|
+
"helpGroup": "TABLE",
|
|
277
|
+
"name": "no-header",
|
|
278
|
+
"allowNo": false,
|
|
279
|
+
"type": "boolean"
|
|
280
|
+
},
|
|
281
|
+
"output": {
|
|
282
|
+
"description": "Specify output format: csv, json, or yaml.",
|
|
283
|
+
"helpGroup": "TABLE",
|
|
284
|
+
"name": "output",
|
|
285
|
+
"hasDynamicHelp": false,
|
|
286
|
+
"multiple": false,
|
|
287
|
+
"options": [
|
|
288
|
+
"csv",
|
|
289
|
+
"json",
|
|
290
|
+
"yaml"
|
|
291
|
+
],
|
|
292
|
+
"type": "option"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"hasDynamicHelp": false,
|
|
296
|
+
"hiddenAliases": [],
|
|
297
|
+
"id": "auth:tokens",
|
|
298
|
+
"pluginAlias": "@contentstack/cli-auth",
|
|
299
|
+
"pluginName": "@contentstack/cli-auth",
|
|
300
|
+
"pluginType": "core",
|
|
301
|
+
"strict": false,
|
|
302
|
+
"isESM": false,
|
|
303
|
+
"relativePath": [
|
|
304
|
+
"lib",
|
|
305
|
+
"commands",
|
|
306
|
+
"auth",
|
|
307
|
+
"tokens",
|
|
308
|
+
"index.js"
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"auth:tokens:list": {
|
|
312
|
+
"aliases": [],
|
|
239
313
|
"args": {},
|
|
240
314
|
"description": "Lists all existing tokens added to the session",
|
|
241
315
|
"examples": [
|
|
242
|
-
"$ csdx auth:tokens"
|
|
316
|
+
"$ csdx auth:tokens:list"
|
|
243
317
|
],
|
|
244
318
|
"flags": {
|
|
245
319
|
"columns": {
|
|
@@ -303,7 +377,7 @@
|
|
|
303
377
|
},
|
|
304
378
|
"hasDynamicHelp": false,
|
|
305
379
|
"hiddenAliases": [],
|
|
306
|
-
"id": "auth:tokens",
|
|
380
|
+
"id": "auth:tokens:list",
|
|
307
381
|
"pluginAlias": "@contentstack/cli-auth",
|
|
308
382
|
"pluginName": "@contentstack/cli-auth",
|
|
309
383
|
"pluginType": "core",
|
|
@@ -314,7 +388,7 @@
|
|
|
314
388
|
"commands",
|
|
315
389
|
"auth",
|
|
316
390
|
"tokens",
|
|
317
|
-
"
|
|
391
|
+
"list.js"
|
|
318
392
|
]
|
|
319
393
|
},
|
|
320
394
|
"auth:tokens:remove": {
|
|
@@ -333,13 +407,6 @@
|
|
|
333
407
|
"hasDynamicHelp": false,
|
|
334
408
|
"multiple": false,
|
|
335
409
|
"type": "option"
|
|
336
|
-
},
|
|
337
|
-
"ignore": {
|
|
338
|
-
"char": "i",
|
|
339
|
-
"description": "Ignores if the token is not present.",
|
|
340
|
-
"name": "ignore",
|
|
341
|
-
"allowNo": false,
|
|
342
|
-
"type": "boolean"
|
|
343
410
|
}
|
|
344
411
|
},
|
|
345
412
|
"hasDynamicHelp": false,
|
|
@@ -359,5 +426,5 @@
|
|
|
359
426
|
]
|
|
360
427
|
}
|
|
361
428
|
},
|
|
362
|
-
"version": "2.0.
|
|
429
|
+
"version": "2.0.1"
|
|
363
430
|
}
|
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.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"scripts": {
|
|
@@ -11,46 +11,41 @@
|
|
|
11
11
|
"postpack": "rm -f oclif.manifest.json",
|
|
12
12
|
"prepack": "pnpm compile && oclif manifest && oclif readme",
|
|
13
13
|
"version": "oclif readme && git add README.md",
|
|
14
|
-
"test
|
|
15
|
-
"
|
|
16
|
-
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
17
|
-
"posttest": "npm run lint",
|
|
18
|
-
"lint": "eslint src/**/*.ts",
|
|
19
|
-
"format": "eslint src/**/*.ts --fix",
|
|
20
|
-
"test:integration": "mocha --forbid-only \"test/integration/*.test.ts\"",
|
|
21
|
-
"test:unit": "mocha --forbid-only \"test/unit/**/*.test.ts\"",
|
|
22
|
-
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
|
|
14
|
+
"test": "mocha \"test/unit/**/*.test.ts\"",
|
|
15
|
+
"lint": "eslint src/**/*.ts"
|
|
23
16
|
},
|
|
24
17
|
"dependencies": {
|
|
25
|
-
"@contentstack/cli-command": "~2.0.
|
|
26
|
-
"@contentstack/cli-utilities": "~2.0.
|
|
27
|
-
"@oclif/core": "^4.
|
|
28
|
-
"@oclif/plugin-help": "^6.2.28",
|
|
18
|
+
"@contentstack/cli-command": "~2.0.1",
|
|
19
|
+
"@contentstack/cli-utilities": "~2.0.1",
|
|
20
|
+
"@oclif/core": "^4.11.14",
|
|
29
21
|
"otplib": "^12.0.1"
|
|
30
22
|
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"@oclif/core": {
|
|
25
|
+
"picomatch": "^4.0.7"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
31
28
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@oclif/plugin-help": "^6.2.28",
|
|
34
|
-
"@oclif/test": "^4.1.13",
|
|
29
|
+
"@oclif/test": "^4.1.20",
|
|
35
30
|
"@types/chai": "^4.3.20",
|
|
36
|
-
"@types/mkdirp": "^1.0.2",
|
|
37
31
|
"@types/mocha": "^8.2.3",
|
|
38
32
|
"@types/node": "^14.18.63",
|
|
39
|
-
"@types/sinon": "^21.0.
|
|
33
|
+
"@types/sinon": "^21.0.1",
|
|
40
34
|
"chai": "^4.5.0",
|
|
41
|
-
"dotenv": "^16.
|
|
42
|
-
"eslint": "^
|
|
35
|
+
"dotenv": "^16.6.1",
|
|
36
|
+
"eslint": "^10.6.0",
|
|
43
37
|
"eslint-config-oclif": "^5.2.2",
|
|
44
38
|
"eslint-config-oclif-typescript": "^3.1.14",
|
|
45
39
|
"mocha": "10.8.2",
|
|
40
|
+
"nock": "^13.5.6",
|
|
46
41
|
"nyc": "^15.1.0",
|
|
47
|
-
"oclif": "^4.
|
|
48
|
-
"sinon": "^21.
|
|
42
|
+
"oclif": "^4.23.27",
|
|
43
|
+
"sinon": "^21.1.2",
|
|
49
44
|
"ts-node": "^10.9.2",
|
|
50
45
|
"typescript": "^4.9.5"
|
|
51
46
|
},
|
|
52
47
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
48
|
+
"node": ">=22.0.0"
|
|
54
49
|
},
|
|
55
50
|
"files": [
|
|
56
51
|
"/lib",
|
|
@@ -80,5 +75,9 @@
|
|
|
80
75
|
"auth:tokens:remove": "RMVTKN"
|
|
81
76
|
}
|
|
82
77
|
},
|
|
83
|
-
"repository":
|
|
84
|
-
|
|
78
|
+
"repository": {
|
|
79
|
+
"type": "git",
|
|
80
|
+
"url": "git+https://github.com/contentstack/cli.git",
|
|
81
|
+
"directory": "packages/contentstack-auth"
|
|
82
|
+
}
|
|
83
|
+
}
|