@axway/axway-central-cli 4.9.0-rc.0 → 4.9.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.
@@ -3,26 +3,35 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.sensediaTAEnvVarTemplate = exports.sensediaDAEnvVarTemplate = exports.SensediaAgentValues = void 0;
6
+ exports.sensediaTAEnvVarTemplate = exports.sensediaDAEnvVarTemplate = exports.SensediaAuthType = exports.SensediaAgentValues = void 0;
7
7
  var _types = require("../../../../common/types");
8
8
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
10
10
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ let SensediaAuthType = exports.SensediaAuthType = /*#__PURE__*/function (SensediaAuthType) {
12
+ SensediaAuthType["OAuth"] = "OAuth Client ID and Client Secret";
13
+ SensediaAuthType["StaticToken"] = "Static Token";
14
+ return SensediaAuthType;
15
+ }({});
11
16
  /**
12
17
  * @description Parameters to provide to the Sensedia handlebars templates.
13
18
  */
14
19
  class SensediaAgentValues {
15
20
  constructor() {
16
21
  _defineProperty(this, "baseUrl", void 0);
22
+ _defineProperty(this, "authType", void 0);
17
23
  _defineProperty(this, "clientId", void 0);
18
24
  _defineProperty(this, "clientSecret", void 0);
25
+ _defineProperty(this, "authToken", void 0);
19
26
  _defineProperty(this, "developerEmail", void 0);
20
27
  _defineProperty(this, "environments", void 0);
21
28
  _defineProperty(this, "centralConfig", void 0);
22
29
  _defineProperty(this, "traceabilityConfig", void 0);
23
30
  this.baseUrl = '';
31
+ this.authType = '';
24
32
  this.clientId = '';
25
33
  this.clientSecret = '';
34
+ this.authToken = '';
26
35
  this.developerEmail = '';
27
36
  this.environments = [];
28
37
  this.centralConfig = new _types.CentralAgentConfig();
@@ -37,8 +46,13 @@ exports.SensediaAgentValues = SensediaAgentValues;
37
46
  const sensediaTAEnvVarTemplate = () => {
38
47
  return `# Sensedia configs
39
48
  SENSEDIA_BASEURL={{baseUrl}}
49
+ {{#if clientId}}
40
50
  SENSEDIA_AUTH_CLIENTID={{clientId}}
41
51
  SENSEDIA_AUTH_CLIENTSECRET={{clientSecret}}
52
+ {{/if}}
53
+ {{#if authToken}}
54
+ SENSEDIA_AUTH_TOKEN={{authToken}}
55
+ {{/if}}
42
56
  {{#if environments.length}}
43
57
  SENSEDIA_ENVIRONMENTS={{environments}}
44
58
  {{/if}}
@@ -70,8 +84,13 @@ exports.sensediaTAEnvVarTemplate = sensediaTAEnvVarTemplate;
70
84
  const sensediaDAEnvVarTemplate = () => {
71
85
  return `# Sensedia configs
72
86
  SENSEDIA_BASEURL={{baseUrl}}
87
+ {{#if clientId}}
73
88
  SENSEDIA_AUTH_CLIENTID={{clientId}}
74
89
  SENSEDIA_AUTH_CLIENTSECRET={{clientSecret}}
90
+ {{/if}}
91
+ {{#if authToken}}
92
+ SENSEDIA_AUTH_TOKEN={{authToken}}
93
+ {{/if}}
75
94
  SENSEDIA_DEVELOPEREMAIL={{developerEmail}}
76
95
  {{#if environments.length}}
77
96
  SENSEDIA_ENVIRONMENTS={{environments}}
@@ -34,8 +34,10 @@ const ConfigFiles = exports.ConfigFiles = {
34
34
  const SensediaPrompts = {
35
35
  configTypeMsg: 'Select the mode of installation',
36
36
  enterBaseUrl: 'Enter the Sensedia Base URL',
37
+ selectAuthMethod: 'Select the authentication method',
37
38
  enterClientId: 'Enter the Sensedia Client ID',
38
39
  enterClientSecret: 'Enter the Sensedia Client Secret',
40
+ enterAuthToken: 'Enter the Sensedia Authentication Token',
39
41
  enterDeveloperEmail: 'Enter the Developer Email',
40
42
  enterEnvironments: 'Do you want to configure specific environments for discovery and reporting? If no value is provided, discovery occurs on all the environments',
41
43
  enterMoreEnvironments: 'Enter an environment name (or press Enter to finish)',
@@ -65,12 +67,25 @@ const askSensediaBaseUrl = async () => await (0, _basicPrompts.askInput)({
65
67
  msg: SensediaPrompts.enterBaseUrl,
66
68
  validate: (0, _basicPrompts.validateRegex)(helpers.SensediaRegexPatterns.urlRegex, helpers.invalidValueExampleErrMsg('baseURL', 'https://sensedia.com'))
67
69
  });
70
+ const askSensediaAuthMethod = async () => await (0, _basicPrompts.askList)({
71
+ msg: SensediaPrompts.selectAuthMethod,
72
+ choices: [{
73
+ name: helpers.SensediaAuthType.OAuth,
74
+ value: helpers.SensediaAuthType.OAuth
75
+ }, {
76
+ name: helpers.SensediaAuthType.StaticToken,
77
+ value: helpers.SensediaAuthType.StaticToken
78
+ }]
79
+ });
68
80
  const askSensediaClientId = async () => await (0, _basicPrompts.askInput)({
69
81
  msg: SensediaPrompts.enterClientId
70
82
  });
71
83
  const askSensediaClientSecret = async () => await (0, _basicPrompts.askInput)({
72
84
  msg: SensediaPrompts.enterClientSecret
73
85
  });
86
+ const askSensediaAuthToken = async () => await (0, _basicPrompts.askInput)({
87
+ msg: SensediaPrompts.enterAuthToken
88
+ });
74
89
  const askSensediaDeveloperEmail = async () => await (0, _basicPrompts.askInput)({
75
90
  msg: SensediaPrompts.enterDeveloperEmail,
76
91
  validate: (0, _basicPrompts.validateRegex)(helpers.SensediaRegexPatterns.emailRegex, helpers.invalidValueExampleErrMsg('DeveloperEmail', 'dev@gmail.com'))
@@ -156,10 +171,17 @@ const dockerSuccessMsg = installConfig => {
156
171
  async function askDiscoveryPrompts(sensediaAgentValues) {
157
172
  // Sensedia Base URL
158
173
  sensediaAgentValues.baseUrl = await askSensediaBaseUrl();
159
- // Sensedia Client Id
160
- sensediaAgentValues.clientId = await askSensediaClientId();
161
- // Sensedia Client Secret
162
- sensediaAgentValues.clientSecret = await askSensediaClientSecret();
174
+
175
+ // Sensedia Authentication Method
176
+ sensediaAgentValues.authType = await askSensediaAuthMethod();
177
+ if (sensediaAgentValues.authType === helpers.SensediaAuthType.OAuth) {
178
+ // OAuth authentication
179
+ sensediaAgentValues.clientId = await askSensediaClientId();
180
+ sensediaAgentValues.clientSecret = await askSensediaClientSecret();
181
+ } else {
182
+ // Static token authentication
183
+ sensediaAgentValues.authToken = await askSensediaAuthToken();
184
+ }
163
185
 
164
186
  // Sensedia Developer Email
165
187
  sensediaAgentValues.developerEmail = await askSensediaDeveloperEmail();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "4.9.0-rc.0",
3
+ "version": "4.9.0",
4
4
  "description": "Manage APIs, services and publish to the Amplify Marketplace",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {