@contentstack/cli-config 1.16.2 → 1.18.0
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 +66 -1
- package/lib/base-command.d.ts +11 -2
- package/lib/base-command.js +3 -2
- package/lib/commands/config/get/base-branch.js +1 -1
- package/lib/commands/config/get/early-access-header.js +1 -1
- package/lib/commands/config/get/log.js +1 -1
- package/lib/commands/config/get/proxy.d.ts +6 -0
- package/lib/commands/config/get/proxy.js +54 -0
- package/lib/commands/config/get/rate-limit.js +1 -1
- package/lib/commands/config/get/region.js +2 -2
- package/lib/commands/config/remove/base-branch.js +1 -1
- package/lib/commands/config/remove/early-access-header.js +5 -2
- package/lib/commands/config/remove/proxy.d.ts +6 -0
- package/lib/commands/config/remove/proxy.js +25 -0
- package/lib/commands/config/remove/rate-limit.js +1 -1
- package/lib/commands/config/set/base-branch.js +1 -1
- package/lib/commands/config/set/early-access-header.js +1 -1
- package/lib/commands/config/set/log.js +1 -1
- package/lib/commands/config/set/proxy.d.ts +8 -0
- package/lib/commands/config/set/proxy.js +73 -0
- package/lib/commands/config/set/rate-limit.js +1 -0
- package/lib/commands/config/set/region.js +1 -2
- package/lib/utils/interactive.d.ts +1 -0
- package/lib/utils/interactive.js +12 -1
- package/oclif.manifest.json +112 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
|
|
|
18
18
|
$ csdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ csdx (--version)
|
|
21
|
-
@contentstack/cli-config/1.
|
|
21
|
+
@contentstack/cli-config/1.18.0 linux-x64 node-v22.22.0
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
|
@@ -33,16 +33,19 @@ USAGE
|
|
|
33
33
|
* [`csdx config:get:ea-header`](#csdx-configgetea-header)
|
|
34
34
|
* [`csdx config:get:early-access-header`](#csdx-configgetearly-access-header)
|
|
35
35
|
* [`csdx config:get:log`](#csdx-configgetlog)
|
|
36
|
+
* [`csdx config:get:proxy`](#csdx-configgetproxy)
|
|
36
37
|
* [`csdx config:get:rate-limit`](#csdx-configgetrate-limit)
|
|
37
38
|
* [`csdx config:get:region`](#csdx-configgetregion)
|
|
38
39
|
* [`csdx config:remove:base-branch`](#csdx-configremovebase-branch)
|
|
39
40
|
* [`csdx config:remove:ea-header`](#csdx-configremoveea-header)
|
|
40
41
|
* [`csdx config:remove:early-access-header`](#csdx-configremoveearly-access-header)
|
|
42
|
+
* [`csdx config:remove:proxy`](#csdx-configremoveproxy)
|
|
41
43
|
* [`csdx config:remove:rate-limit`](#csdx-configremoverate-limit)
|
|
42
44
|
* [`csdx config:set:base-branch`](#csdx-configsetbase-branch)
|
|
43
45
|
* [`csdx config:set:ea-header`](#csdx-configsetea-header)
|
|
44
46
|
* [`csdx config:set:early-access-header`](#csdx-configsetearly-access-header)
|
|
45
47
|
* [`csdx config:set:log`](#csdx-configsetlog)
|
|
48
|
+
* [`csdx config:set:proxy`](#csdx-configsetproxy)
|
|
46
49
|
* [`csdx config:set:rate-limit`](#csdx-configsetrate-limit)
|
|
47
50
|
* [`csdx config:set:region [REGION]`](#csdx-configsetregion-region)
|
|
48
51
|
|
|
@@ -118,6 +121,23 @@ EXAMPLES
|
|
|
118
121
|
|
|
119
122
|
_See code: [src/commands/config/get/log.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/get/log.ts)_
|
|
120
123
|
|
|
124
|
+
## `csdx config:get:proxy`
|
|
125
|
+
|
|
126
|
+
Get proxy configuration for CLI
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
USAGE
|
|
130
|
+
$ csdx config:get:proxy
|
|
131
|
+
|
|
132
|
+
DESCRIPTION
|
|
133
|
+
Get proxy configuration for CLI
|
|
134
|
+
|
|
135
|
+
EXAMPLES
|
|
136
|
+
$ csdx config:get:proxy
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
_See code: [src/commands/config/get/proxy.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/get/proxy.ts)_
|
|
140
|
+
|
|
121
141
|
## `csdx config:get:rate-limit`
|
|
122
142
|
|
|
123
143
|
Get rate-limit of organizations
|
|
@@ -227,6 +247,23 @@ EXAMPLES
|
|
|
227
247
|
|
|
228
248
|
_See code: [src/commands/config/remove/early-access-header.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/remove/early-access-header.ts)_
|
|
229
249
|
|
|
250
|
+
## `csdx config:remove:proxy`
|
|
251
|
+
|
|
252
|
+
Remove proxy configuration from global config
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
USAGE
|
|
256
|
+
$ csdx config:remove:proxy
|
|
257
|
+
|
|
258
|
+
DESCRIPTION
|
|
259
|
+
Remove proxy configuration from global config
|
|
260
|
+
|
|
261
|
+
EXAMPLES
|
|
262
|
+
$ csdx config:remove:proxy
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
_See code: [src/commands/config/remove/proxy.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/remove/proxy.ts)_
|
|
266
|
+
|
|
230
267
|
## `csdx config:remove:rate-limit`
|
|
231
268
|
|
|
232
269
|
Remove rate-limit of the organization
|
|
@@ -358,6 +395,34 @@ EXAMPLES
|
|
|
358
395
|
|
|
359
396
|
_See code: [src/commands/config/set/log.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/log.ts)_
|
|
360
397
|
|
|
398
|
+
## `csdx config:set:proxy`
|
|
399
|
+
|
|
400
|
+
Set proxy configuration for CLI
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
USAGE
|
|
404
|
+
$ csdx config:set:proxy --host <value> --port <value> --protocol http|https [--username <value>]
|
|
405
|
+
|
|
406
|
+
FLAGS
|
|
407
|
+
--host=<value> (required) Proxy host address
|
|
408
|
+
--port=<value> (required) Proxy port number
|
|
409
|
+
--protocol=<option> (required) [default: http] Proxy protocol (http or https)
|
|
410
|
+
<options: http|https>
|
|
411
|
+
--username=<value> Proxy username (optional)
|
|
412
|
+
|
|
413
|
+
DESCRIPTION
|
|
414
|
+
Set proxy configuration for CLI
|
|
415
|
+
|
|
416
|
+
EXAMPLES
|
|
417
|
+
$ csdx config:set:proxy --host 127.0.0.1 --port 3128
|
|
418
|
+
|
|
419
|
+
$ csdx config:set:proxy --host proxy.example.com --port 8080 --protocol https
|
|
420
|
+
|
|
421
|
+
$ csdx config:set:proxy --host proxy.example.com --port 8080 --username user
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
_See code: [src/commands/config/set/proxy.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/proxy.ts)_
|
|
425
|
+
|
|
361
426
|
## `csdx config:set:rate-limit`
|
|
362
427
|
|
|
363
428
|
Set rate-limit for CLI
|
package/lib/base-command.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { Command } from '@contentstack/cli-command';
|
|
2
|
-
import { ArgInput, Interfaces
|
|
2
|
+
import { ArgInput, Interfaces } from '@contentstack/cli-utilities';
|
|
3
3
|
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
4
4
|
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
|
|
5
5
|
export declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
6
|
-
|
|
6
|
+
contextDetails: {
|
|
7
|
+
command: string;
|
|
8
|
+
module: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
email: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
orgId: string;
|
|
14
|
+
authenticationMethod: string;
|
|
15
|
+
};
|
|
7
16
|
protected args: Args<T>;
|
|
8
17
|
protected flags: Flags<T>;
|
|
9
18
|
static args: ArgInput<{
|
package/lib/base-command.js
CHANGED
|
@@ -9,9 +9,10 @@ class BaseCommand extends cli_command_1.Command {
|
|
|
9
9
|
* plugins, registering the configuration, and initializing the logger.
|
|
10
10
|
*/
|
|
11
11
|
async init() {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
await super.init();
|
|
13
|
-
// Init logger
|
|
14
|
-
this.
|
|
14
|
+
// Init logger context
|
|
15
|
+
this.contextDetails = Object.assign({}, (0, cli_utilities_1.createLogContext)(((_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.command) || 'config', '', cli_utilities_1.configHandler.get('authenticationMethod')));
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* The catch function is used to handle errors from a command, either by adding custom logic or
|
|
@@ -26,7 +26,7 @@ class GetEarlyAccessHeaderCommand extends cli_command_1.Command {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
|
|
29
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-get-early-access-header' });
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 ProxyGetCommand extends base_command_1.BaseCommand {
|
|
6
|
+
async run() {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
try {
|
|
9
|
+
cli_utilities_1.log.debug('Starting proxy configuration retrieval', this.contextDetails);
|
|
10
|
+
const globalProxyConfig = cli_utilities_1.configHandler.get('proxy');
|
|
11
|
+
if (globalProxyConfig) {
|
|
12
|
+
cli_utilities_1.log.debug('Proxy configuration found in global config', this.contextDetails);
|
|
13
|
+
let usernameValue = 'Not set';
|
|
14
|
+
if ((_a = globalProxyConfig.auth) === null || _a === void 0 ? void 0 : _a.username) {
|
|
15
|
+
usernameValue = globalProxyConfig.auth.username;
|
|
16
|
+
}
|
|
17
|
+
const proxyConfigList = [
|
|
18
|
+
{
|
|
19
|
+
Setting: 'Host',
|
|
20
|
+
Value: globalProxyConfig.host || 'Not set',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
Setting: 'Port',
|
|
24
|
+
Value: globalProxyConfig.port ? String(globalProxyConfig.port) : 'Not set',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
Setting: 'Protocol',
|
|
28
|
+
Value: globalProxyConfig.protocol || 'Not set',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
Setting: 'Username',
|
|
32
|
+
Value: usernameValue,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
Setting: 'Password',
|
|
36
|
+
Value: ((_b = globalProxyConfig.auth) === null || _b === void 0 ? void 0 : _b.password) ? '***' : 'Not set',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
const headers = [{ value: 'Setting' }, { value: 'Value' }];
|
|
40
|
+
cli_utilities_1.cliux.table(headers, proxyConfigList);
|
|
41
|
+
cli_utilities_1.log.info('Proxy configuration displayed successfully', this.contextDetails);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
cli_utilities_1.log.debug('No proxy configuration found in global config', this.contextDetails);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-get-proxy' }));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = ProxyGetCommand;
|
|
53
|
+
ProxyGetCommand.description = 'Get proxy configuration for CLI';
|
|
54
|
+
ProxyGetCommand.examples = ['csdx config:get:proxy'];
|
|
@@ -30,7 +30,7 @@ class RateLimitGetCommand extends cli_command_1.Command {
|
|
|
30
30
|
cli_utilities_1.cliux.table(headers, tableData);
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
|
-
|
|
33
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-get-rate-limit' });
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -6,7 +6,7 @@ class RegionGetCommand extends base_command_1.BaseCommand {
|
|
|
6
6
|
async run() {
|
|
7
7
|
let currentRegion = this.region;
|
|
8
8
|
if (!currentRegion) {
|
|
9
|
-
|
|
9
|
+
cli_utilities_1.log.error('No region is set.', this.contextDetails);
|
|
10
10
|
cli_utilities_1.cliux.error('CLI_CONFIG_GET_REGION_NOT_FOUND');
|
|
11
11
|
this.exit();
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@ class RegionGetCommand extends base_command_1.BaseCommand {
|
|
|
17
17
|
cli_utilities_1.cliux.print(`Developer Hub URL: ${currentRegion.developerHubUrl}`);
|
|
18
18
|
cli_utilities_1.cliux.print(`Launch URL: ${currentRegion.launchHubUrl}`);
|
|
19
19
|
cli_utilities_1.cliux.print(`Personalize URL: ${currentRegion.personalizeUrl}`);
|
|
20
|
-
|
|
20
|
+
cli_utilities_1.log.info(`Currently using ${currentRegion.name} region`, this.contextDetails);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.default = RegionGetCommand;
|
|
@@ -24,7 +24,7 @@ class RemoveEarlyAccessHeader extends cli_command_1.Command {
|
|
|
24
24
|
cli_utilities_1.cliux.success(`Early Access header has been successfully removed`);
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
27
|
-
|
|
27
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-remove-early-access-header' });
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -33,7 +33,10 @@ RemoveEarlyAccessHeader.description = 'Remove Early Access header';
|
|
|
33
33
|
RemoveEarlyAccessHeader.aliases = ['config:remove:ea-header'];
|
|
34
34
|
RemoveEarlyAccessHeader.flags = {
|
|
35
35
|
'header-alias': cli_utilities_1.flags.string({ description: '(optional) Provide the Early Access header alias name.' }),
|
|
36
|
-
yes: cli_utilities_1.flags.boolean({
|
|
36
|
+
yes: cli_utilities_1.flags.boolean({
|
|
37
|
+
char: 'y',
|
|
38
|
+
description: '(optional) Force the removal of Early Access header configuration by skipping the confirmation.',
|
|
39
|
+
}),
|
|
37
40
|
};
|
|
38
41
|
RemoveEarlyAccessHeader.examples = [
|
|
39
42
|
'$ <%= config.bin %> <%= command.id %>',
|
|
@@ -0,0 +1,25 @@
|
|
|
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 ProxyRemoveCommand extends base_command_1.BaseCommand {
|
|
6
|
+
async run() {
|
|
7
|
+
try {
|
|
8
|
+
cli_utilities_1.log.debug('Starting proxy configuration removal', this.contextDetails);
|
|
9
|
+
const currentProxy = cli_utilities_1.configHandler.get('proxy');
|
|
10
|
+
if (!currentProxy) {
|
|
11
|
+
cli_utilities_1.log.debug('No proxy configuration found in global config', this.contextDetails);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
cli_utilities_1.log.debug('Removing proxy configuration from global config', this.contextDetails);
|
|
15
|
+
cli_utilities_1.configHandler.delete('proxy');
|
|
16
|
+
cli_utilities_1.log.success('Proxy configuration removed from global config successfully', this.contextDetails);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-remove-proxy' }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = ProxyRemoveCommand;
|
|
24
|
+
ProxyRemoveCommand.description = 'Remove proxy configuration from global config';
|
|
25
|
+
ProxyRemoveCommand.examples = ['csdx config:remove:proxy'];
|
|
@@ -20,7 +20,7 @@ class RateLimitRemoveCommand extends cli_command_1.Command {
|
|
|
20
20
|
cli_utilities_1.cliux.print(`Rate limit entry for organization UID ${org} has been removed.`, { color: 'green' });
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
|
-
|
|
23
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-remove-rate-limit' });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -21,7 +21,7 @@ class BranchSetCommand extends cli_command_1.Command {
|
|
|
21
21
|
cli_utilities_1.cliux.success(`Base branch configuration for stack-api-key: ${apiKey} and branch: ${baseBranch} set successfully`);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
cli_utilities_1.
|
|
24
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-set-base-branch' });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -18,7 +18,7 @@ class SetEarlyAccessHeaderCommand extends cli_command_1.Command {
|
|
|
18
18
|
cli_utilities_1.cliux.success(`Early Access header has been successfully set`);
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
|
-
|
|
21
|
+
(0, cli_utilities_1.handleAndLogError)(error, { module: 'config-set-early-access-header' });
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
2
|
+
import { BaseCommand } from '../../../base-command';
|
|
3
|
+
export default class ProxySetCommand extends BaseCommand<typeof ProxySetCommand> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: FlagInput;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
run(): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
4
|
+
const interactive_1 = require("../../../utils/interactive");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
class ProxySetCommand extends base_command_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
try {
|
|
9
|
+
cli_utilities_1.log.debug('Starting proxy configuration setup', this.contextDetails);
|
|
10
|
+
const { flags } = await this.parse(ProxySetCommand);
|
|
11
|
+
cli_utilities_1.log.debug('Parsed proxy configuration flags', this.contextDetails);
|
|
12
|
+
// Validate host - must not be empty or whitespace-only
|
|
13
|
+
if (!flags.host || flags.host.trim() === '') {
|
|
14
|
+
cli_utilities_1.log.error('Invalid host provided - host cannot be empty or whitespace-only', this.contextDetails);
|
|
15
|
+
cli_utilities_1.cliux.error('Invalid host address. Host cannot be empty or contain only whitespace.');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const port = Number.parseInt(flags.port, 10);
|
|
19
|
+
if (Number.isNaN(port) || port < 1 || port > 65535) {
|
|
20
|
+
cli_utilities_1.log.error('Invalid port number provided', this.contextDetails);
|
|
21
|
+
cli_utilities_1.cliux.error('Invalid port number. Port must be between 1 and 65535.');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const proxyConfig = {
|
|
25
|
+
protocol: flags.protocol || 'http',
|
|
26
|
+
host: flags.host.trim(),
|
|
27
|
+
port: port,
|
|
28
|
+
};
|
|
29
|
+
if (flags.username) {
|
|
30
|
+
cli_utilities_1.log.debug('Username provided, prompting for password', this.contextDetails);
|
|
31
|
+
// Prompt for password when username is provided
|
|
32
|
+
const password = await (0, interactive_1.askProxyPassword)();
|
|
33
|
+
proxyConfig.auth = {
|
|
34
|
+
username: flags.username,
|
|
35
|
+
password: password || '',
|
|
36
|
+
};
|
|
37
|
+
cli_utilities_1.log.debug('Proxy authentication configured', this.contextDetails);
|
|
38
|
+
}
|
|
39
|
+
cli_utilities_1.log.debug('Saving proxy configuration to global config', this.contextDetails);
|
|
40
|
+
cli_utilities_1.configHandler.set('proxy', proxyConfig);
|
|
41
|
+
cli_utilities_1.log.success('Proxy configuration set successfully', this.contextDetails);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-set-proxy' }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = ProxySetCommand;
|
|
49
|
+
ProxySetCommand.description = 'Set proxy configuration for CLI';
|
|
50
|
+
ProxySetCommand.flags = {
|
|
51
|
+
host: cli_utilities_1.flags.string({
|
|
52
|
+
description: 'Proxy host address',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
port: cli_utilities_1.flags.string({
|
|
56
|
+
description: 'Proxy port number',
|
|
57
|
+
required: true,
|
|
58
|
+
}),
|
|
59
|
+
protocol: cli_utilities_1.flags.string({
|
|
60
|
+
description: 'Proxy protocol (http or https)',
|
|
61
|
+
options: ['http', 'https'],
|
|
62
|
+
default: 'http',
|
|
63
|
+
required: true,
|
|
64
|
+
}),
|
|
65
|
+
username: cli_utilities_1.flags.string({
|
|
66
|
+
description: 'Proxy username (optional)',
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
ProxySetCommand.examples = [
|
|
70
|
+
'csdx config:set:proxy --host 127.0.0.1 --port 3128',
|
|
71
|
+
'csdx config:set:proxy --host proxy.example.com --port 8080 --protocol https',
|
|
72
|
+
'csdx config:set:proxy --host proxy.example.com --port 8080 --username user',
|
|
73
|
+
];
|
|
@@ -52,6 +52,7 @@ class SetRateLimitCommand extends base_command_1.BaseCommand {
|
|
|
52
52
|
await limitHandler.setRateLimit(config);
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-set-rate-limit' }));
|
|
55
56
|
if (error === null || error === void 0 ? void 0 : error.message) {
|
|
56
57
|
cli_utilities_1.cliux.error(error.message);
|
|
57
58
|
}
|
|
@@ -65,8 +65,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
|
|
|
65
65
|
cli_utilities_1.cliux.success(`Studio URL: ${customRegion.composableStudioUrl}`);
|
|
66
66
|
}
|
|
67
67
|
catch (error) {
|
|
68
|
-
|
|
69
|
-
cli_utilities_1.cliux.error(`Failed to set region due to: ${error.message}`);
|
|
68
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-set-region' }));
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
else if (['NA', 'EU', 'AU', 'AWS-NA', 'AWS-EU', 'AWS-AU', 'AZURE-NA', 'AZURE-EU', 'GCP-NA', 'GCP-EU'].includes(selectedRegion)) {
|
|
@@ -9,3 +9,4 @@ export declare function askEarlyAccessHeaderAlias(): Promise<string>;
|
|
|
9
9
|
export declare const askOrgID: () => Promise<string>;
|
|
10
10
|
export declare function askLogLevel(): Promise<string>;
|
|
11
11
|
export declare function askLogPath(): Promise<string>;
|
|
12
|
+
export declare function askProxyPassword(): Promise<string>;
|
package/lib/utils/interactive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askLogPath = exports.askLogLevel = exports.askOrgID = exports.askEarlyAccessHeaderAlias = exports.askEarlyAccessHeaderValue = exports.inquireRequireFieldValidation = exports.askConfirmation = exports.askBaseBranch = exports.askStackAPIKey = exports.askCustomRegion = exports.askRegions = void 0;
|
|
3
|
+
exports.askProxyPassword = exports.askLogPath = exports.askLogLevel = exports.askOrgID = exports.askEarlyAccessHeaderAlias = exports.askEarlyAccessHeaderValue = exports.inquireRequireFieldValidation = exports.askConfirmation = exports.askBaseBranch = exports.askStackAPIKey = exports.askCustomRegion = exports.askRegions = void 0;
|
|
4
4
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
5
5
|
const askRegions = async () => {
|
|
6
6
|
return cli_utilities_1.cliux.inquire({
|
|
@@ -127,3 +127,14 @@ async function askLogPath() {
|
|
|
127
127
|
return logPath;
|
|
128
128
|
}
|
|
129
129
|
exports.askLogPath = askLogPath;
|
|
130
|
+
async function askProxyPassword() {
|
|
131
|
+
return cli_utilities_1.cliux.inquire({
|
|
132
|
+
type: 'input',
|
|
133
|
+
message: 'Enter proxy password:',
|
|
134
|
+
name: 'password',
|
|
135
|
+
transformer: (password) => {
|
|
136
|
+
return '*'.repeat(password.length);
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
exports.askProxyPassword = askProxyPassword;
|
package/oclif.manifest.json
CHANGED
|
@@ -74,6 +74,30 @@
|
|
|
74
74
|
"log.js"
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
|
+
"config:get:proxy": {
|
|
78
|
+
"aliases": [],
|
|
79
|
+
"args": {},
|
|
80
|
+
"description": "Get proxy configuration for CLI",
|
|
81
|
+
"examples": [
|
|
82
|
+
"csdx config:get:proxy"
|
|
83
|
+
],
|
|
84
|
+
"flags": {},
|
|
85
|
+
"hasDynamicHelp": false,
|
|
86
|
+
"hiddenAliases": [],
|
|
87
|
+
"id": "config:get:proxy",
|
|
88
|
+
"pluginAlias": "@contentstack/cli-config",
|
|
89
|
+
"pluginName": "@contentstack/cli-config",
|
|
90
|
+
"pluginType": "core",
|
|
91
|
+
"strict": true,
|
|
92
|
+
"isESM": false,
|
|
93
|
+
"relativePath": [
|
|
94
|
+
"lib",
|
|
95
|
+
"commands",
|
|
96
|
+
"config",
|
|
97
|
+
"get",
|
|
98
|
+
"proxy.js"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
77
101
|
"config:get:rate-limit": {
|
|
78
102
|
"aliases": [],
|
|
79
103
|
"args": {},
|
|
@@ -205,6 +229,30 @@
|
|
|
205
229
|
"early-access-header.js"
|
|
206
230
|
]
|
|
207
231
|
},
|
|
232
|
+
"config:remove:proxy": {
|
|
233
|
+
"aliases": [],
|
|
234
|
+
"args": {},
|
|
235
|
+
"description": "Remove proxy configuration from global config",
|
|
236
|
+
"examples": [
|
|
237
|
+
"csdx config:remove:proxy"
|
|
238
|
+
],
|
|
239
|
+
"flags": {},
|
|
240
|
+
"hasDynamicHelp": false,
|
|
241
|
+
"hiddenAliases": [],
|
|
242
|
+
"id": "config:remove:proxy",
|
|
243
|
+
"pluginAlias": "@contentstack/cli-config",
|
|
244
|
+
"pluginName": "@contentstack/cli-config",
|
|
245
|
+
"pluginType": "core",
|
|
246
|
+
"strict": true,
|
|
247
|
+
"isESM": false,
|
|
248
|
+
"relativePath": [
|
|
249
|
+
"lib",
|
|
250
|
+
"commands",
|
|
251
|
+
"config",
|
|
252
|
+
"remove",
|
|
253
|
+
"proxy.js"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
208
256
|
"config:remove:rate-limit": {
|
|
209
257
|
"aliases": [],
|
|
210
258
|
"args": {},
|
|
@@ -378,6 +426,69 @@
|
|
|
378
426
|
"log.js"
|
|
379
427
|
]
|
|
380
428
|
},
|
|
429
|
+
"config:set:proxy": {
|
|
430
|
+
"aliases": [],
|
|
431
|
+
"args": {},
|
|
432
|
+
"description": "Set proxy configuration for CLI",
|
|
433
|
+
"examples": [
|
|
434
|
+
"csdx config:set:proxy --host 127.0.0.1 --port 3128",
|
|
435
|
+
"csdx config:set:proxy --host proxy.example.com --port 8080 --protocol https",
|
|
436
|
+
"csdx config:set:proxy --host proxy.example.com --port 8080 --username user"
|
|
437
|
+
],
|
|
438
|
+
"flags": {
|
|
439
|
+
"host": {
|
|
440
|
+
"description": "Proxy host address",
|
|
441
|
+
"name": "host",
|
|
442
|
+
"required": true,
|
|
443
|
+
"hasDynamicHelp": false,
|
|
444
|
+
"multiple": false,
|
|
445
|
+
"type": "option"
|
|
446
|
+
},
|
|
447
|
+
"port": {
|
|
448
|
+
"description": "Proxy port number",
|
|
449
|
+
"name": "port",
|
|
450
|
+
"required": true,
|
|
451
|
+
"hasDynamicHelp": false,
|
|
452
|
+
"multiple": false,
|
|
453
|
+
"type": "option"
|
|
454
|
+
},
|
|
455
|
+
"protocol": {
|
|
456
|
+
"description": "Proxy protocol (http or https)",
|
|
457
|
+
"name": "protocol",
|
|
458
|
+
"required": true,
|
|
459
|
+
"default": "http",
|
|
460
|
+
"hasDynamicHelp": false,
|
|
461
|
+
"multiple": false,
|
|
462
|
+
"options": [
|
|
463
|
+
"http",
|
|
464
|
+
"https"
|
|
465
|
+
],
|
|
466
|
+
"type": "option"
|
|
467
|
+
},
|
|
468
|
+
"username": {
|
|
469
|
+
"description": "Proxy username (optional)",
|
|
470
|
+
"name": "username",
|
|
471
|
+
"hasDynamicHelp": false,
|
|
472
|
+
"multiple": false,
|
|
473
|
+
"type": "option"
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
"hasDynamicHelp": false,
|
|
477
|
+
"hiddenAliases": [],
|
|
478
|
+
"id": "config:set:proxy",
|
|
479
|
+
"pluginAlias": "@contentstack/cli-config",
|
|
480
|
+
"pluginName": "@contentstack/cli-config",
|
|
481
|
+
"pluginType": "core",
|
|
482
|
+
"strict": true,
|
|
483
|
+
"isESM": false,
|
|
484
|
+
"relativePath": [
|
|
485
|
+
"lib",
|
|
486
|
+
"commands",
|
|
487
|
+
"config",
|
|
488
|
+
"set",
|
|
489
|
+
"proxy.js"
|
|
490
|
+
]
|
|
491
|
+
},
|
|
381
492
|
"config:set:rate-limit": {
|
|
382
493
|
"aliases": [],
|
|
383
494
|
"args": {},
|
|
@@ -556,5 +667,5 @@
|
|
|
556
667
|
]
|
|
557
668
|
}
|
|
558
669
|
},
|
|
559
|
-
"version": "1.
|
|
670
|
+
"version": "1.18.0"
|
|
560
671
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-config",
|
|
3
3
|
"description": "Contentstack CLI plugin for configuration",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run clean && npm run compile",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@contentstack/cli-command": "~1.7.
|
|
25
|
-
"@contentstack/cli-utilities": "~1.
|
|
24
|
+
"@contentstack/cli-command": "~1.7.2",
|
|
25
|
+
"@contentstack/cli-utilities": "~1.17.0",
|
|
26
26
|
"@oclif/core": "^4.3.0",
|
|
27
27
|
"@oclif/plugin-help": "^6.2.28",
|
|
28
28
|
"lodash": "^4.17.21"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/chai": "^4.3.20",
|
|
33
33
|
"@types/mocha": "^8.2.3",
|
|
34
34
|
"@types/node": "^14.18.63",
|
|
35
|
-
"@types/sinon": "^
|
|
35
|
+
"@types/sinon": "^21.0.0",
|
|
36
36
|
"chai": "^4.5.0",
|
|
37
37
|
"eslint": "^8.57.1",
|
|
38
38
|
"eslint-config-oclif": "^6.0.62",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"mocha": "10.8.2",
|
|
41
41
|
"nyc": "^15.1.0",
|
|
42
42
|
"oclif": "^4.17.46",
|
|
43
|
-
"sinon": "^
|
|
43
|
+
"sinon": "^21.0.1",
|
|
44
44
|
"ts-node": "^10.9.2",
|
|
45
45
|
"typescript": "^4.9.5"
|
|
46
46
|
},
|