@axway/axway-central-cli 4.6.0 → 4.7.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.
@@ -242,7 +242,7 @@ const agents = exports.agents = {
242
242
  process.exit(0);
243
243
  }
244
244
  },
245
- desc: 'Amplify API Gateway / Amazon API Gateway / Azure API Gateway / Istio / Apigee X Gateway / GitHub / GitLab / Kafka / SwaggerHub/ Software AG WebMethods',
245
+ desc: 'Amplify API Gateway / Apigee X Gateway / Amazon API Gateway / Azure API Gateway / Azure EventHub / Backstage / GitLab / Istio / Kafka /' + ' Graylog / IBM API Connect / SwaggerHub / Software AG WebMethods / Traceable / SAP API Portal / Sensedia / WSO2',
246
246
  options: {
247
247
  ..._types.commonCmdArgsDescription
248
248
  }
@@ -275,7 +275,7 @@ function checkUserRole(isCentralAdmin, isPlatformAdmin, accountInfo, render) {
275
275
  process.exit(1);
276
276
  }
277
277
  }
278
- const validateFrequency = () => input => {
278
+ const validateFrequency = lowerLimit => input => {
279
279
  let val = (0, _basicPrompts.validateRegex)(helpers.frequencyRegex, helpers.invalidValueExampleErrMsg('frequency', '3d5h12m'))(input);
280
280
  if (typeof val === 'string') {
281
281
  return val;
@@ -284,8 +284,10 @@ const validateFrequency = () => input => {
284
284
  if (r) {
285
285
  // only minutes
286
286
  let mins = r[1];
287
- if (parseInt(mins, 10) < 30) {
288
- return 'Minimum frequency is 30m';
287
+ const minValue = parseInt(mins, 10);
288
+ const minimumRequired = lowerLimit !== null && lowerLimit !== void 0 ? lowerLimit : 30; // Use provided lowerLimit or default to 30
289
+ if (minValue < minimumRequired) {
290
+ return `Minimum frequency is ${minimumRequired}m`;
289
291
  }
290
292
  }
291
293
  return true;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.resourceRegex = exports.namespaceRegex = exports.maskingRegex = exports.keyFromKeyValuePairRegex = exports.invalidResourceMsg = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.WSO2RegexPatterns = exports.KafkaRegexPatterns = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
6
+ exports.resourceRegex = exports.namespaceRegex = exports.maskingRegex = exports.keyFromKeyValuePairRegex = exports.invalidResourceMsg = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.WSO2RegexPatterns = exports.SensediaRegexPatterns = exports.KafkaRegexPatterns = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
7
7
  const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
8
8
  const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
9
9
  const domainNameRegex = exports.domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$';
@@ -64,4 +64,9 @@ const KafkaRegexPatterns = exports.KafkaRegexPatterns = {
64
64
  };
65
65
  const WSO2RegexPatterns = exports.WSO2RegexPatterns = {
66
66
  wso2BaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
67
+ };
68
+ const SensediaRegexPatterns = exports.SensediaRegexPatterns = {
69
+ noCommaRegex: '^[^,]+$',
70
+ emailRegex: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$',
71
+ urlRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
67
72
  };
@@ -37,8 +37,9 @@ const SensediaPrompts = {
37
37
  enterClientId: 'Enter the Sensedia Client ID',
38
38
  enterClientSecret: 'Enter the Sensedia Client Secret',
39
39
  enterDeveloperEmail: 'Enter the Developer Email',
40
- enterEnvironments: 'Enter the environments used to discover APIs and for reporting transactions ?',
41
- enterMoreEnvironments: 'Do you want to add another environment?'
40
+ enterEnvironments: 'Do you want to configure specific environments for discovery and reporting? If no value is provided, discovery occurs on all the environments',
41
+ enterMoreEnvironments: 'Enter an environment name (or press Enter to finish)',
42
+ invalidEnvironmentMessage: 'Commas are not allowed in the name due to the way the agent parses the environments list. Make sure you input one environment name at a time'
42
43
  };
43
44
  const askBundleType = async gateway => {
44
45
  console.log(gateway);
@@ -61,7 +62,8 @@ const askConfigType = async () => {
61
62
  //
62
63
  exports.askConfigType = askConfigType;
63
64
  const askSensediaBaseUrl = async () => await (0, _basicPrompts.askInput)({
64
- msg: SensediaPrompts.enterBaseUrl
65
+ msg: SensediaPrompts.enterBaseUrl,
66
+ validate: (0, _basicPrompts.validateRegex)(helpers.SensediaRegexPatterns.urlRegex, helpers.invalidValueExampleErrMsg('baseURL', 'https://sensedia.com'))
65
67
  });
66
68
  const askSensediaClientId = async () => await (0, _basicPrompts.askInput)({
67
69
  msg: SensediaPrompts.enterClientId
@@ -70,24 +72,27 @@ const askSensediaClientSecret = async () => await (0, _basicPrompts.askInput)({
70
72
  msg: SensediaPrompts.enterClientSecret
71
73
  });
72
74
  const askSensediaDeveloperEmail = async () => await (0, _basicPrompts.askInput)({
73
- msg: SensediaPrompts.enterDeveloperEmail
75
+ msg: SensediaPrompts.enterDeveloperEmail,
76
+ validate: (0, _basicPrompts.validateRegex)(helpers.SensediaRegexPatterns.emailRegex, helpers.invalidValueExampleErrMsg('DeveloperEmail', 'dev@gmail.com'))
74
77
  });
75
78
  const askSensediaEnvironments = async () => {
76
79
  let environments = [];
77
- let askMoreEnvironments = true;
78
- while (askMoreEnvironments) {
80
+ let addEnvironments = (await (0, _basicPrompts.askList)({
81
+ msg: SensediaPrompts.enterEnvironments,
82
+ default: _types.YesNo.No,
83
+ choices: _types.YesNoChoices
84
+ })) === _types.YesNo.Yes;
85
+ while (addEnvironments) {
79
86
  const env = await (0, _basicPrompts.askInput)({
80
- msg: SensediaPrompts.enterEnvironments,
87
+ msg: SensediaPrompts.enterMoreEnvironments,
88
+ validate: (0, _basicPrompts.validateRegex)(helpers.SensediaRegexPatterns.noCommaRegex, SensediaPrompts.invalidEnvironmentMessage),
81
89
  allowEmptyInput: true
82
90
  });
83
91
  if (env && env.trim() !== '') {
84
92
  environments.push(env);
93
+ } else {
94
+ return environments;
85
95
  }
86
- askMoreEnvironments = (await (0, _basicPrompts.askList)({
87
- msg: SensediaPrompts.enterMoreEnvironments,
88
- default: _types.YesNo.No,
89
- choices: _types.YesNoChoices
90
- })) === _types.YesNo.Yes;
91
96
  }
92
97
  return environments;
93
98
  };
@@ -160,7 +165,7 @@ async function askDiscoveryPrompts(sensediaAgentValues) {
160
165
  sensediaAgentValues.developerEmail = await askSensediaDeveloperEmail();
161
166
 
162
167
  // Sensedia Environments
163
- sensediaAgentValues.environments = await askSensediaEnvironments();
168
+ sensediaAgentValues.environments = [...new Set(await askSensediaEnvironments())];
164
169
  }
165
170
  const completeInstall = async installConfig => {
166
171
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "description": "Manage APIs, services and publish to the Amplify Marketplace",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {