@contentstack/cli-config 1.12.0 → 1.13.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 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.12.0 linux-x64 node-v22.14.0
21
+ @contentstack/cli-config/1.13.0 linux-x64 node-v22.16.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -358,14 +358,12 @@ DESCRIPTION
358
358
  EXAMPLES
359
359
  $ csdx config:set:region
360
360
 
361
- $ csdx config:set:region NA
362
-
363
- $ csdx config:set:region EU
364
-
365
361
  $ csdx config:set:region AWS-NA
366
362
 
367
363
  $ csdx config:set:region AWS-EU
368
364
 
365
+ $ csdx config:set:region AWS-AU
366
+
369
367
  $ csdx config:set:region AZURE-NA
370
368
 
371
369
  $ csdx config:set:region AZURE-EU
@@ -55,7 +55,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
55
55
  cli_utilities_1.cliux.error(`Failed to set region due to: ${error.message}`);
56
56
  }
57
57
  }
58
- else if (['NA', 'EU', 'AWS-NA', 'AWS-EU', 'AZURE-NA', 'AZURE-EU', 'GCP-NA', 'GCP-EU'].includes(selectedRegion)) {
58
+ else if (['NA', 'EU', 'AU', 'AWS-NA', 'AWS-EU', 'AWS-AU', 'AZURE-NA', 'AZURE-EU', 'GCP-NA', 'GCP-EU'].includes(selectedRegion)) {
59
59
  const regionDetails = utils_1.regionHandler.setRegion(selectedRegion);
60
60
  await cli_utilities_1.authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
61
61
  cli_utilities_1.cliux.success(`Region has been set to ${regionDetails.name}`);
@@ -75,7 +75,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
75
75
  if (transformedUrl.startsWith('http')) {
76
76
  transformedUrl = transformedUrl.split('//')[1];
77
77
  }
78
- transformedUrl = transformedUrl.startsWith('dev11') ? transformedUrl.replace('dev11', 'dev') : transformedUrl;
78
+ transformedUrl = transformedUrl.replace(/^dev\d+/, 'dev'); // Replaces any 'dev1', 'dev2', etc. with 'dev'
79
79
  transformedUrl = transformedUrl.endsWith('io') ? transformedUrl.replace('io', 'com') : transformedUrl;
80
80
  return `https://${transformedUrl}`;
81
81
  }
@@ -116,10 +116,9 @@ RegionSetCommand.flags = {
116
116
  };
117
117
  RegionSetCommand.examples = [
118
118
  '$ csdx config:set:region',
119
- '$ csdx config:set:region NA',
120
- '$ csdx config:set:region EU',
121
119
  '$ csdx config:set:region AWS-NA',
122
120
  '$ csdx config:set:region AWS-EU',
121
+ '$ csdx config:set:region AWS-AU',
123
122
  '$ csdx config:set:region AZURE-NA',
124
123
  '$ csdx config:set:region AZURE-EU',
125
124
  '$ csdx config:set:region GCP-NA',
@@ -8,10 +8,9 @@ const askRegions = async () => {
8
8
  name: 'selectedRegion',
9
9
  message: 'CLI_CONFIG_SELECT_REGION',
10
10
  choices: [
11
- { name: 'NA', value: 'NA' },
12
- { name: 'EU', value: 'EU' },
13
11
  { name: 'AWS-NA', value: 'AWS-NA' },
14
12
  { name: 'AWS-EU', value: 'AWS-EU' },
13
+ { name: 'AWS-AU', value: 'AWS-AU' },
15
14
  { name: 'AZURE-NA', value: 'AZURE-NA' },
16
15
  { name: 'AZURE-EU', value: 'AZURE-EU' },
17
16
  { name: 'GCP-NA', value: 'GCP-NA' },
@@ -62,6 +62,7 @@ class RateLimitHandler {
62
62
  });
63
63
  }
64
64
  catch (error) {
65
+ console.log('Something went wrong while setting rate limit for org:', (0, cli_utilities_1.formatError)(error));
65
66
  throw new Error(error);
66
67
  }
67
68
  }
@@ -2,7 +2,7 @@ declare class UserConfig {
2
2
  /**
3
3
  *
4
4
  * Set region to config store
5
- * @param {string} region It Can be NA, EU
5
+ * @param {string} region It Can be AWS-NA, AWS-EU, AWS-AU, AZURE-NA, AZURE-EU, GCP-NA, GCP-EU
6
6
  * @returns {object} region object with cma, cda, region property
7
7
  */
8
8
  setRegion(region: any): any;
@@ -50,6 +50,24 @@ const regions = {
50
50
  launchHubUrl: 'https://eu-launch-api.contentstack.com',
51
51
  personalizeUrl: 'https://eu-personalize-api.contentstack.com',
52
52
  },
53
+ AU: {
54
+ name: 'AU',
55
+ cma: 'https://au-api.contentstack.com',
56
+ cda: 'https://au-cdn.contentstack.com',
57
+ uiHost: 'https://au-app.contentstack.com',
58
+ developerHubUrl: 'https://au-developerhub-api.contentstack.com',
59
+ launchHubUrl: 'https://au-launch-api.contentstack.com',
60
+ personalizeUrl: 'https://au-personalize-api.contentstack.com',
61
+ },
62
+ 'AWS-AU': {
63
+ name: 'AWS-AU',
64
+ cma: 'https://au-api.contentstack.com',
65
+ cda: 'https://au-cdn.contentstack.com',
66
+ uiHost: 'https://au-app.contentstack.com',
67
+ developerHubUrl: 'https://au-developerhub-api.contentstack.com',
68
+ launchHubUrl: 'https://au-launch-api.contentstack.com',
69
+ personalizeUrl: 'https://au-personalize-api.contentstack.com',
70
+ },
53
71
  'AZURE-NA': {
54
72
  name: 'AZURE-NA',
55
73
  cma: 'https://azure-na-api.contentstack.com',
@@ -91,7 +109,7 @@ class UserConfig {
91
109
  /**
92
110
  *
93
111
  * Set region to config store
94
- * @param {string} region It Can be NA, EU
112
+ * @param {string} region It Can be AWS-NA, AWS-EU, AWS-AU, AZURE-NA, AZURE-EU, GCP-NA, GCP-EU
95
113
  * @returns {object} region object with cma, cda, region property
96
114
  */
97
115
  setRegion(region) {
@@ -110,8 +128,8 @@ class UserConfig {
110
128
  const regionDetails = cli_utilities_1.configHandler.get('region');
111
129
  if (regionDetails)
112
130
  return regionDetails;
113
- // returns NA region if not found in config
114
- return regions.NA;
131
+ // returns AWS-NA region if not found in config
132
+ return regions['AWS-NA'];
115
133
  }
116
134
  /**
117
135
  *
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "CLI_CONFIG_SET_REGION_DESCRIPTION": "Set region for CLI",
3
3
  "CLI_CONFIG_SET_REGION_FLAG_D_DESCRIPTION": "Custom host to set for content delivery API, if this flag is added then cma and name flags are required",
4
- "CLI_CONFIG_SET_REGION_FLAG_M_DESCRIPTION": "Custom host to set for content management API, , if this flag is added then cda and name flags are required",
4
+ "CLI_CONFIG_SET_REGION_FLAG_M_DESCRIPTION": "Custom host to set for content management API, if this flag is added then cda and name flags are required",
5
5
  "CLI_CONFIG_SET_REGION_FLAG_N_DESCRIPTION": "Name for the region, if this flag is added then cda and cma flags are required",
6
- "CLI_CONFIG_SET_REGION_DEFAULT": "No argument or custom flag provided. Setting region to default NA",
6
+ "CLI_CONFIG_SET_REGION_DEFAULT": "No argument or custom flag provided. Setting region to default AWS-NA",
7
7
  "CLI_CONFIG_GET_REGION_DESCRIPTION": "Get current region set for CLI",
8
8
  "CLI_CONFIG_GET_REGION_NOT_FOUND": "No region found, please set by running command $ csdx config:set:region",
9
9
  "CLI_CONFIG_INQUIRE_REGION_NAME": "Enter custom region name",
@@ -16,4 +16,4 @@
16
16
  "CLI_CONFIG_INQUIRE_EARLY_ACCESS_HEADER_VALUE": "Please enter Early Access header value",
17
17
  "CLI_CONFIG_INQUIRE_EARLY_ACCESS_HEADER_ALIAS": "Please enter Early Access header alias",
18
18
  "CLI_BRANCH_REQUIRED_FIELD": "Please enter the required field details"
19
- }
19
+ }
@@ -362,10 +362,9 @@
362
362
  "description": "Set region for CLI",
363
363
  "examples": [
364
364
  "$ csdx config:set:region",
365
- "$ csdx config:set:region NA",
366
- "$ csdx config:set:region EU",
367
365
  "$ csdx config:set:region AWS-NA",
368
366
  "$ csdx config:set:region AWS-EU",
367
+ "$ csdx config:set:region AWS-AU",
369
368
  "$ csdx config:set:region AZURE-NA",
370
369
  "$ csdx config:set:region AZURE-EU",
371
370
  "$ csdx config:set:region GCP-NA",
@@ -467,5 +466,5 @@
467
466
  ]
468
467
  }
469
468
  },
470
- "version": "1.12.0"
469
+ "version": "1.13.0"
471
470
  }
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.12.0",
4
+ "version": "1.13.0",
5
5
  "author": "Contentstack",
6
6
  "scripts": {
7
7
  "build": "npm run clean && npm run compile",
@@ -22,23 +22,25 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@contentstack/cli-command": "~1.5.0",
25
- "@contentstack/cli-utilities": "~1.11.0",
25
+ "@contentstack/cli-utilities": "~1.12.0",
26
+ "@oclif/core": "^4.3.0",
27
+ "@oclif/plugin-help": "^6.2.28",
26
28
  "lodash": "^4.17.21"
27
29
  },
28
30
  "devDependencies": {
29
- "@oclif/test": "^4.1.6",
31
+ "@oclif/test": "^4.1.13",
30
32
  "@types/chai": "^4.3.20",
31
33
  "@types/mocha": "^8.2.3",
32
34
  "@types/node": "^14.18.63",
33
35
  "@types/sinon": "^10.0.20",
34
36
  "chai": "^4.5.0",
35
37
  "eslint": "^8.57.1",
36
- "eslint-config-oclif": "^6.0.15",
37
- "eslint-config-oclif-typescript": "^3.1.13",
38
+ "eslint-config-oclif": "^6.0.62",
39
+ "eslint-config-oclif-typescript": "^3.1.14",
38
40
  "mocha": "10.8.2",
39
41
  "nyc": "^15.1.0",
40
- "oclif": "^4.17.30",
41
- "sinon": "^19.0.2",
42
+ "oclif": "^4.17.46",
43
+ "sinon": "^19.0.5",
42
44
  "ts-node": "^10.9.2",
43
45
  "typescript": "^4.9.5"
44
46
  },