@sap-ux/system-access 0.3.29 → 0.3.31

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.
@@ -85,10 +85,6 @@ function createAbapCloudServiceProvider(options, target, prompt, logger) {
85
85
  */
86
86
  function createAbapOnPremServiceProvider(options, target, prompt, logger) {
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
- options.baseURL = target.url;
89
- if (target.client) {
90
- options.params['sap-client'] = target.client;
91
- }
92
88
  if (!options.auth) {
93
89
  const storedOpts = yield (0, credentials_1.getCredentialsFromStore)(target, logger);
94
90
  if ((0, credentials_1.isBasicAuth)(storedOpts)) {
@@ -102,10 +98,17 @@ function createAbapOnPremServiceProvider(options, target, prompt, logger) {
102
98
  throw new Error('This is an ABAP Cloud system, please correct your configuration.');
103
99
  }
104
100
  if (prompt) {
105
- const credentials = yield (0, credentials_1.getCredentialsWithPrompts)(storedOpts === null || storedOpts === void 0 ? void 0 : storedOpts.username);
106
- options.auth = credentials;
107
- process.env.FIORI_TOOLS_USER = credentials.username;
108
- process.env.FIORI_TOOLS_PASSWORD = credentials.password;
101
+ const { authType } = yield (0, prompts_2.default)([prompts_1.questions.authType]);
102
+ if (authType === store_1.AuthenticationType.ReentranceTicket) {
103
+ target.authenticationType = store_1.AuthenticationType.ReentranceTicket;
104
+ return (0, axios_extension_1.createForAbapOnCloud)(Object.assign(Object.assign(Object.assign({}, options), target), { environment: axios_extension_1.AbapCloudEnvironment.EmbeddedSteampunk }));
105
+ }
106
+ else {
107
+ const credentials = yield (0, credentials_1.getCredentialsWithPrompts)(storedOpts === null || storedOpts === void 0 ? void 0 : storedOpts.username);
108
+ options.auth = credentials;
109
+ process.env.FIORI_TOOLS_USER = credentials.username;
110
+ process.env.FIORI_TOOLS_PASSWORD = credentials.password;
111
+ }
109
112
  }
110
113
  }
111
114
  }
@@ -172,13 +175,13 @@ function createAbapServiceProvider(target, requestOptions, prompt, logger) {
172
175
  provider = yield createAbapCloudServiceProvider(options, target, prompt, logger);
173
176
  }
174
177
  else if (target.authenticationType === store_1.AuthenticationType.ReentranceTicket) {
175
- provider = (0, axios_extension_1.createForAbapOnCloud)({
176
- ignoreCertErrors: options.ignoreCertErrors,
177
- environment: axios_extension_1.AbapCloudEnvironment.EmbeddedSteampunk,
178
- url: target.url
179
- });
178
+ provider = (0, axios_extension_1.createForAbapOnCloud)(Object.assign({ ignoreCertErrors: options.ignoreCertErrors, environment: axios_extension_1.AbapCloudEnvironment.EmbeddedSteampunk }, target));
180
179
  }
181
180
  else {
181
+ options.baseURL = target.url;
182
+ if (target.client) {
183
+ options.params['sap-client'] = target.client;
184
+ }
182
185
  provider = yield createAbapOnPremServiceProvider(options, target, prompt, logger);
183
186
  }
184
187
  }
@@ -3,6 +3,7 @@ import type { PromptObject } from 'prompts';
3
3
  * Export map of questions for usage with the prompts modules
4
4
  */
5
5
  export declare const questions: {
6
+ readonly authType: PromptObject<string>;
6
7
  readonly username: PromptObject<string>;
7
8
  readonly password: PromptObject<string>;
8
9
  readonly serviceKeysPath: PromptObject<string>;
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inquirer = exports.questions = void 0;
4
+ const store_1 = require("@sap-ux/store");
4
5
  const fs_1 = require("fs");
6
+ const authType = {
7
+ type: 'autocomplete',
8
+ name: 'authType',
9
+ message: 'Type of authentication:',
10
+ choices: [
11
+ { title: 'Basic authentication', value: store_1.AuthenticationType.Basic },
12
+ { title: 'SAP reentrance tickets', value: store_1.AuthenticationType.ReentranceTicket }
13
+ ]
14
+ };
5
15
  const username = {
6
16
  type: 'text',
7
17
  name: 'username',
@@ -34,6 +44,7 @@ const systemName = {
34
44
  * Export map of questions for usage with the prompts modules
35
45
  */
36
46
  exports.questions = {
47
+ authType,
37
48
  username,
38
49
  password,
39
50
  serviceKeysPath,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Asystem-access"
11
11
  },
12
- "version": "0.3.29",
12
+ "version": "0.3.31",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "prompts": "2.4.2",
26
- "@sap-ux/axios-extension": "1.12.4",
26
+ "@sap-ux/axios-extension": "1.12.5",
27
27
  "@sap-ux/btp-utils": "0.14.4",
28
28
  "@sap-ux/logger": "0.5.1",
29
29
  "@sap-ux/store": "0.5.0"
@@ -32,7 +32,7 @@
32
32
  "@types/prompts": "2.4.4",
33
33
  "nock": "13.4.0",
34
34
  "rimraf": "5.0.5",
35
- "@sap-ux/project-access": "1.20.0"
35
+ "@sap-ux/project-access": "1.20.1"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18.x"