@sap-ux/adp-tooling 0.18.53 → 0.18.55
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/dist/base/credentials.d.ts +14 -0
- package/dist/base/credentials.js +50 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/source/systems.js +8 -2
- package/dist/types.d.ts +2 -0
- package/package.json +5 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SystemLookup } from '../source';
|
|
2
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
+
import type { ConfigAnswers } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Stores system credentials securely using the @sap-ux/store service.
|
|
6
|
+
* Only stores credentials for ABAP environments when all required fields are provided.
|
|
7
|
+
*
|
|
8
|
+
* @param {ConfigAnswers} configAnswers - Configuration answers containing credentials and system info
|
|
9
|
+
* @param {SystemLookup} systemLookup - System lookup service for retrieving endpoint details
|
|
10
|
+
* @param {ToolsLogger} logger - Logger for informational and warning messages
|
|
11
|
+
* @returns {Promise<void>} Promise that resolves when credentials are stored or operation completes
|
|
12
|
+
*/
|
|
13
|
+
export declare function storeCredentials(configAnswers: ConfigAnswers, systemLookup: SystemLookup, logger: ToolsLogger): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeCredentials = storeCredentials;
|
|
4
|
+
const store_1 = require("@sap-ux/store");
|
|
5
|
+
/**
|
|
6
|
+
* Stores system credentials securely using the @sap-ux/store service.
|
|
7
|
+
* Only stores credentials for ABAP environments when all required fields are provided.
|
|
8
|
+
*
|
|
9
|
+
* @param {ConfigAnswers} configAnswers - Configuration answers containing credentials and system info
|
|
10
|
+
* @param {SystemLookup} systemLookup - System lookup service for retrieving endpoint details
|
|
11
|
+
* @param {ToolsLogger} logger - Logger for informational and warning messages
|
|
12
|
+
* @returns {Promise<void>} Promise that resolves when credentials are stored or operation completes
|
|
13
|
+
*/
|
|
14
|
+
async function storeCredentials(configAnswers, systemLookup, logger) {
|
|
15
|
+
if (!configAnswers.username || !configAnswers.password) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const systemEndpoint = await systemLookup.getSystemByName(configAnswers.system);
|
|
20
|
+
if (!systemEndpoint?.Url) {
|
|
21
|
+
logger.warn('Cannot store credentials: system endpoint or URL not found.');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const systemService = await (0, store_1.getService)({
|
|
25
|
+
entityName: 'system'
|
|
26
|
+
});
|
|
27
|
+
const backendSystemKey = new store_1.BackendSystemKey({
|
|
28
|
+
url: systemEndpoint.Url,
|
|
29
|
+
client: systemEndpoint.Client
|
|
30
|
+
});
|
|
31
|
+
const existingSystem = await systemService.read(backendSystemKey);
|
|
32
|
+
const backendSystem = new store_1.BackendSystem({
|
|
33
|
+
name: configAnswers.system,
|
|
34
|
+
url: systemEndpoint.Url,
|
|
35
|
+
client: systemEndpoint.Client,
|
|
36
|
+
username: configAnswers.username,
|
|
37
|
+
password: configAnswers.password,
|
|
38
|
+
systemType: systemEndpoint.SystemType || store_1.SystemType.AbapOnPrem,
|
|
39
|
+
connectionType: 'abap_catalog',
|
|
40
|
+
userDisplayName: configAnswers.username
|
|
41
|
+
});
|
|
42
|
+
await systemService.write(backendSystem, { force: !!existingSystem });
|
|
43
|
+
logger.info('System credentials have been stored securely.');
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
logger.error(`Failed to store credentials: ${error instanceof Error ? error.message : String(error)}`);
|
|
47
|
+
logger.debug(error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=credentials.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './ui5';
|
|
|
7
7
|
export * from './base/cf';
|
|
8
8
|
export * from './cf';
|
|
9
9
|
export * from './base/helper';
|
|
10
|
+
export * from './base/credentials';
|
|
10
11
|
export * from './base/constants';
|
|
11
12
|
export * from './base/project-builder';
|
|
12
13
|
export * from './base/abap/manifest-service';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./ui5"), exports);
|
|
|
24
24
|
__exportStar(require("./base/cf"), exports);
|
|
25
25
|
__exportStar(require("./cf"), exports);
|
|
26
26
|
__exportStar(require("./base/helper"), exports);
|
|
27
|
+
__exportStar(require("./base/credentials"), exports);
|
|
27
28
|
__exportStar(require("./base/constants"), exports);
|
|
28
29
|
__exportStar(require("./base/project-builder"), exports);
|
|
29
30
|
__exportStar(require("./base/abap/manifest-service"), exports);
|
package/dist/source/systems.js
CHANGED
|
@@ -28,6 +28,7 @@ const transformBackendSystem = (system) => ({
|
|
|
28
28
|
UserDisplayName: system.userDisplayName,
|
|
29
29
|
Scp: !!system.serviceKeys,
|
|
30
30
|
Authentication: system.authenticationType,
|
|
31
|
+
SystemType: system.systemType,
|
|
31
32
|
Credentials: {
|
|
32
33
|
username: system.username,
|
|
33
34
|
password: system.password
|
|
@@ -80,7 +81,7 @@ class SystemLookup {
|
|
|
80
81
|
entityName: 'system'
|
|
81
82
|
});
|
|
82
83
|
const backendSystems = await systemStore?.getAll();
|
|
83
|
-
endpoints = backendSystems.map(exports.transformBackendSystem);
|
|
84
|
+
endpoints = backendSystems.filter((system) => system.name !== undefined).map(exports.transformBackendSystem);
|
|
84
85
|
}
|
|
85
86
|
return endpoints;
|
|
86
87
|
}
|
|
@@ -116,7 +117,12 @@ class SystemLookup {
|
|
|
116
117
|
return found?.Authentication === 'NoAuthentication';
|
|
117
118
|
}
|
|
118
119
|
else {
|
|
119
|
-
|
|
120
|
+
if (!found) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
const isOnPrem = found.SystemType === store_1.SystemType.AbapOnPrem;
|
|
124
|
+
const hasMissingCredentials = !found.Credentials?.username || !found.Credentials?.password;
|
|
125
|
+
return isOnPrem && hasMissingCredentials;
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -125,6 +125,7 @@ export interface ConfigAnswers {
|
|
|
125
125
|
system: string;
|
|
126
126
|
username: string;
|
|
127
127
|
password: string;
|
|
128
|
+
storeCredentials?: boolean;
|
|
128
129
|
application: SourceApplication;
|
|
129
130
|
fioriId?: string;
|
|
130
131
|
ach?: string;
|
|
@@ -189,6 +190,7 @@ export interface Endpoint extends Partial<Destination> {
|
|
|
189
190
|
};
|
|
190
191
|
UserDisplayName?: string;
|
|
191
192
|
Scp?: boolean;
|
|
193
|
+
SystemType?: string;
|
|
192
194
|
}
|
|
193
195
|
export interface ChangeInboundNavigation {
|
|
194
196
|
/** Identifier for the inbound navigation. */
|
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%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.18.
|
|
12
|
+
"version": "0.18.55",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"@sap-ux/axios-extension": "1.25.10",
|
|
40
40
|
"@sap-ux/btp-utils": "1.1.7",
|
|
41
41
|
"@sap-ux/i18n": "0.3.7",
|
|
42
|
-
"@sap-ux/inquirer-common": "0.10.
|
|
42
|
+
"@sap-ux/inquirer-common": "0.10.24",
|
|
43
43
|
"@sap-ux/logger": "0.8.1",
|
|
44
44
|
"@sap-ux/nodejs-utils": "0.2.13",
|
|
45
45
|
"@sap-ux/odata-service-writer": "0.29.13",
|
|
46
46
|
"@sap-ux/project-access": "1.34.6",
|
|
47
47
|
"@sap-ux/project-input-validator": "0.6.50",
|
|
48
|
-
"@sap-ux/store": "1.5.
|
|
49
|
-
"@sap-ux/system-access": "0.6.
|
|
48
|
+
"@sap-ux/store": "1.5.4",
|
|
49
|
+
"@sap-ux/system-access": "0.6.48",
|
|
50
50
|
"@sap-ux/ui5-config": "0.29.15",
|
|
51
51
|
"@sap-ux/ui5-info": "0.13.11"
|
|
52
52
|
},
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"nock": "13.4.0",
|
|
69
69
|
"rimraf": "6.1.2",
|
|
70
70
|
"supertest": "7.1.4",
|
|
71
|
-
"@sap-ux/store": "1.5.
|
|
71
|
+
"@sap-ux/store": "1.5.4"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=20.x"
|