@contentstack/cli-config 2.0.0-beta.1 → 2.0.0-beta.11

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/2.0.0-beta.1 linux-x64 node-v22.22.0
21
+ @contentstack/cli-config/2.0.0-beta.11 linux-x64 node-v22.22.3
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -457,7 +457,7 @@ Set region for CLI
457
457
  ```
458
458
  USAGE
459
459
  $ csdx config:set:region [REGION] [--cda <value> --cma <value> --ui-host <value> -n <value>] [--developer-hub
460
- <value>] [--personalize <value>] [--launch <value>] [--studio <value>]
460
+ <value>] [--personalize <value>] [--launch <value>] [--studio <value>] [--cs-assets <value>]
461
461
 
462
462
  ARGUMENTS
463
463
  [REGION] Name for the region
@@ -468,6 +468,7 @@ FLAGS
468
468
  name flags are required
469
469
  --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host
470
470
  and name flags are required
471
+ --cs-assets=<value> Custom host to set for Contentstack Assets API
471
472
  --developer-hub=<value> Custom host to set for Developer hub API
472
473
  --launch=<value> Custom host to set for Launch API
473
474
  --personalize=<value> Custom host to set for Personalize API
@@ -505,6 +506,8 @@ EXAMPLES
505
506
 
506
507
  $ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --studio <custom_studio_url>
507
508
 
509
+ $ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --cs-assets <cs_assets_url>
510
+
508
511
  $ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name "India" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url>
509
512
  ```
510
513
 
@@ -17,6 +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
+ cli_utilities_1.cliux.print(`Contentstack Assets URL: ${currentRegion.csAssetsUrl}`);
20
21
  cli_utilities_1.log.info(`Currently using ${currentRegion.name} region`, this.contextDetails);
21
22
  }
22
23
  }
@@ -14,6 +14,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
14
14
  let personalizeUrl = regionSetFlags['personalize'];
15
15
  let launchHubUrl = regionSetFlags['launch'];
16
16
  let composableStudioUrl = regionSetFlags['studio'];
17
+ let csAssetsUrl = regionSetFlags['cs-assets'];
17
18
  let selectedRegion = args.region;
18
19
  if (!(cda && cma && uiHost && name) && !selectedRegion) {
19
20
  selectedRegion = await utils_1.interactive.askRegions();
@@ -43,6 +44,9 @@ class RegionSetCommand extends base_command_1.BaseCommand {
43
44
  if (!composableStudioUrl) {
44
45
  composableStudioUrl = this.transformUrl(cma, 'composable-studio-api');
45
46
  }
47
+ if (!csAssetsUrl) {
48
+ csAssetsUrl = this.transformUrl(cma, 'am-api');
49
+ }
46
50
  let customRegion = {
47
51
  cda,
48
52
  cma,
@@ -52,6 +56,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
52
56
  personalizeUrl,
53
57
  launchHubUrl,
54
58
  composableStudioUrl,
59
+ csAssetsUrl,
55
60
  };
56
61
  customRegion = utils_1.regionHandler.setCustomRegion(customRegion);
57
62
  await cli_utilities_1.authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
@@ -63,6 +68,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
63
68
  cli_utilities_1.cliux.success(`Personalize URL: ${customRegion.personalizeUrl}`);
64
69
  cli_utilities_1.cliux.success(`Launch URL: ${customRegion.launchHubUrl}`);
65
70
  cli_utilities_1.cliux.success(`Studio URL: ${customRegion.composableStudioUrl}`);
71
+ cli_utilities_1.cliux.success(`Contentstack Assets URL: ${customRegion.csAssetsUrl}`);
66
72
  }
67
73
  catch (error) {
68
74
  (0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.contextDetails), { module: 'config-set-region' }));
@@ -79,6 +85,7 @@ class RegionSetCommand extends base_command_1.BaseCommand {
79
85
  cli_utilities_1.cliux.success(`Personalize URL: ${regionDetails.personalizeUrl}`);
80
86
  cli_utilities_1.cliux.success(`Launch URL: ${regionDetails.launchHubUrl}`);
81
87
  cli_utilities_1.cliux.success(`Studio URL: ${regionDetails.composableStudioUrl}`);
88
+ cli_utilities_1.cliux.success(`Contentstack Assets URL: ${regionDetails.csAssetsUrl}`);
82
89
  }
83
90
  else {
84
91
  cli_utilities_1.cliux.error(`Invalid region specified.`);
@@ -126,6 +133,9 @@ RegionSetCommand.flags = {
126
133
  studio: cli_utilities_1.flags.string({
127
134
  description: 'Custom host to set for Studio API',
128
135
  }),
136
+ 'cs-assets': cli_utilities_1.flags.string({
137
+ description: 'Custom host to set for Contentstack Assets API',
138
+ }),
129
139
  };
130
140
  RegionSetCommand.examples = [
131
141
  '$ csdx config:set:region',
@@ -141,6 +151,7 @@ RegionSetCommand.examples = [
141
151
  '$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --personalize <custom_personalize_url>',
142
152
  '$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --launch <custom_launch_url>',
143
153
  '$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --studio <custom_studio_url>',
154
+ '$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --cs-assets <cs_assets_url>',
144
155
  '$ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name "India" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url>',
145
156
  ];
146
157
  RegionSetCommand.args = {
@@ -17,6 +17,7 @@ export interface Region {
17
17
  personalizeUrl: string;
18
18
  launchHubUrl: string;
19
19
  composableStudioUrl: string;
20
+ csAssetsUrl?: string;
20
21
  }
21
22
  export interface Limit {
22
23
  value: number;
@@ -47,6 +47,7 @@ declare class UserConfig {
47
47
  personalizeUrl: any;
48
48
  launchHubUrl: any;
49
49
  composableStudioUrl: any;
50
+ csAssetsUrl: any;
50
51
  };
51
52
  }
52
53
  export { regions };
@@ -35,9 +35,10 @@ function getRegionObject(regionKey) {
35
35
  launchHubUrl: endpoints.launch,
36
36
  personalizeUrl: endpoints.personalizeManagement,
37
37
  composableStudioUrl: endpoints.composableStudio,
38
+ csAssetsUrl: endpoints.assetManagement,
38
39
  };
39
40
  }
40
- catch (error) {
41
+ catch (_a) {
41
42
  return null;
42
43
  }
43
44
  }
@@ -46,18 +47,7 @@ function getRegionObject(regionKey) {
46
47
  * This creates a regions object similar to the old hardcoded one but using @contentstack/utils
47
48
  */
48
49
  function getAvailableRegions() {
49
- const regionKeys = [
50
- 'NA',
51
- 'AWS-NA',
52
- 'EU',
53
- 'AWS-EU',
54
- 'AU',
55
- 'AWS-AU',
56
- 'AZURE-NA',
57
- 'AZURE-EU',
58
- 'GCP-NA',
59
- 'GCP-EU',
60
- ];
50
+ const regionKeys = ['NA', 'AWS-NA', 'EU', 'AWS-EU', 'AU', 'AWS-AU', 'AZURE-NA', 'AZURE-EU', 'GCP-NA', 'GCP-EU'];
61
51
  const regions = {};
62
52
  for (const key of regionKeys) {
63
53
  const regionObj = getRegionObject(key);
@@ -151,6 +141,7 @@ class UserConfig {
151
141
  personalizeUrl: regionObject['personalizeUrl'],
152
142
  launchHubUrl: regionObject['launchHubUrl'],
153
143
  composableStudioUrl: regionObject['composableStudioUrl'],
144
+ csAssetsUrl: regionObject['csAssetsUrl'],
154
145
  };
155
146
  return sanitizedRegion;
156
147
  }
@@ -567,6 +567,7 @@
567
567
  "$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name \"India\" --personalize <custom_personalize_url>",
568
568
  "$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name \"India\" --launch <custom_launch_url>",
569
569
  "$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name \"India\" --studio <custom_studio_url>",
570
+ "$ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name \"India\" --cs-assets <cs_assets_url>",
570
571
  "$ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name \"India\" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url>"
571
572
  ],
572
573
  "flags": {
@@ -646,6 +647,13 @@
646
647
  "hasDynamicHelp": false,
647
648
  "multiple": false,
648
649
  "type": "option"
650
+ },
651
+ "cs-assets": {
652
+ "description": "Custom host to set for Contentstack Assets API",
653
+ "name": "cs-assets",
654
+ "hasDynamicHelp": false,
655
+ "multiple": false,
656
+ "type": "option"
649
657
  }
650
658
  },
651
659
  "hasDynamicHelp": false,
@@ -665,5 +673,5 @@
665
673
  ]
666
674
  }
667
675
  },
668
- "version": "2.0.0-beta.1"
676
+ "version": "2.0.0-beta.11"
669
677
  }
package/package.json CHANGED
@@ -1,47 +1,43 @@
1
1
  {
2
2
  "name": "@contentstack/cli-config",
3
3
  "description": "Contentstack CLI plugin for configuration",
4
- "version": "2.0.0-beta.1",
4
+ "version": "2.0.0-beta.11",
5
5
  "author": "Contentstack",
6
6
  "scripts": {
7
- "build": "npm run clean && npm run compile",
8
- "clean": "rm -rf ./lib ./node_modules tsconfig.build.tsbuildinfo",
7
+ "build": "pnpm compile && oclif manifest && oclif readme",
8
+ "clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
9
9
  "compile": "tsc -b tsconfig.json",
10
10
  "postpack": "rm -f oclif.manifest.json",
11
11
  "prepack": "pnpm compile && oclif manifest && oclif readme",
12
12
  "version": "oclif readme && git add README.md",
13
- "test:report": "tsc -p test && nyc --reporter=lcov --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
14
- "pretest": "tsc -p test",
15
- "test": "mocha --require ts-node/register 'test/**/*.test.ts'",
16
- "posttest": "npm run lint",
17
- "lint": "eslint src/**/*.ts",
18
- "format": "eslint src/**/*.ts --fix",
19
- "test:integration": "mocha --forbid-only \"test/run.test.ts\" --integration-test",
20
- "test:unit": "mocha --forbid-only \"test/unit/**/*.test.ts\" --unit-test",
21
- "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
13
+ "test": "mocha \"test/unit/**/*.test.ts\"",
14
+ "lint": "eslint src/**/*.ts"
22
15
  },
23
16
  "dependencies": {
24
- "@contentstack/cli-command": "~2.0.0-beta",
25
- "@contentstack/cli-utilities": "~2.0.0-beta",
26
- "@contentstack/utils": "~1.7.0",
27
- "@oclif/core": "^4.3.0",
28
- "@oclif/plugin-help": "^6.2.28",
29
- "lodash": "^4.17.23"
17
+ "@contentstack/cli-command": "~2.0.0-beta.8",
18
+ "@contentstack/cli-utilities": "~2.0.0-beta.9",
19
+ "@contentstack/utils": "~1.9.1",
20
+ "@oclif/core": "^4.11.4"
21
+ },
22
+ "overrides": {
23
+ "@oclif/core": {
24
+ "picomatch": "^4.0.4"
25
+ }
30
26
  },
31
27
  "devDependencies": {
32
- "@oclif/test": "^4.1.13",
28
+ "@oclif/test": "^4.1.18",
33
29
  "@types/chai": "^4.3.20",
34
30
  "@types/mocha": "^8.2.3",
35
31
  "@types/node": "^14.18.63",
36
- "@types/sinon": "^21.0.0",
32
+ "@types/sinon": "^21.0.1",
37
33
  "chai": "^4.5.0",
38
- "eslint": "^8.57.1",
39
- "eslint-config-oclif": "^6.0.62",
34
+ "eslint": "^9.26.0",
35
+ "eslint-config-oclif": "^6.0.166",
40
36
  "eslint-config-oclif-typescript": "^3.1.14",
41
37
  "mocha": "10.8.2",
42
38
  "nyc": "^15.1.0",
43
- "oclif": "^4.17.46",
44
- "sinon": "^21.0.1",
39
+ "oclif": "^4.23.8",
40
+ "sinon": "^21.1.2",
45
41
  "ts-node": "^10.9.2",
46
42
  "typescript": "^4.9.5"
47
43
  },
@@ -67,7 +63,21 @@
67
63
  "protected": [
68
64
  "config:get:region"
69
65
  ],
70
- "repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-config/<%- commandPath %>"
66
+ "repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-config/<%- commandPath %>",
67
+ "topics": {
68
+ "config": {
69
+ "description": "Perform configuration related activities"
70
+ },
71
+ "config:get": {
72
+ "description": "View the list of set configuration values"
73
+ },
74
+ "config:set": {
75
+ "description": "Set configuration values"
76
+ },
77
+ "config:remove": {
78
+ "description": "Remove set configuration values"
79
+ }
80
+ }
71
81
  },
72
82
  "csdxConfig": {
73
83
  "shortCommandName": {
@@ -81,4 +91,4 @@
81
91
  }
82
92
  },
83
93
  "repository": "contentstack/cli"
84
- }
94
+ }