@sap-ux/adp-tooling 1.0.1 → 1.0.4
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/btp/api.d.ts +9 -0
- package/dist/btp/api.js +21 -4
- package/dist/translations/adp-tooling.i18n.json +1 -0
- package/dist/types.d.ts +13 -4
- package/package.json +7 -7
package/dist/btp/api.d.ts
CHANGED
|
@@ -20,6 +20,15 @@ export declare function getToken(uaa: Uaa, logger?: ToolsLogger): Promise<string
|
|
|
20
20
|
* @returns The destinationConfiguration object (e.g. Name, ProxyType, URL, Authentication) or undefined on failure.
|
|
21
21
|
*/
|
|
22
22
|
export declare function getBtpDestinationConfig(uri: string, token: string, destinationName: string, logger?: ToolsLogger): Promise<BtpDestinationConfig | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Normalise destination-service credentials (nested `{ uaa: { ... } }` or flat) into a flat UAA + `uri`.
|
|
25
|
+
*
|
|
26
|
+
* @param credentials - Destination service credentials.
|
|
27
|
+
* @returns Flat UAA credentials, or `undefined` if any required field is missing.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getDestinationServiceUaa(credentials: CfDestinationServiceCredentials | undefined): (Uaa & {
|
|
30
|
+
uri: string;
|
|
31
|
+
}) | undefined;
|
|
23
32
|
/**
|
|
24
33
|
* Lists all subaccount destinations from the BTP Destination Configuration API.
|
|
25
34
|
*
|
package/dist/btp/api.js
CHANGED
|
@@ -53,6 +53,22 @@ export async function getBtpDestinationConfig(uri, token, destinationName, logge
|
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Normalise destination-service credentials (nested `{ uaa: { ... } }` or flat) into a flat UAA + `uri`.
|
|
58
|
+
*
|
|
59
|
+
* @param credentials - Destination service credentials.
|
|
60
|
+
* @returns Flat UAA credentials, or `undefined` if any required field is missing.
|
|
61
|
+
*/
|
|
62
|
+
export function getDestinationServiceUaa(credentials) {
|
|
63
|
+
if (!credentials) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const uaa = 'uaa' in credentials ? credentials.uaa : credentials;
|
|
67
|
+
if (!uaa?.clientid || !uaa.clientsecret || !uaa.url || !uaa.uri) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return uaa;
|
|
71
|
+
}
|
|
56
72
|
/**
|
|
57
73
|
* Lists all subaccount destinations from the BTP Destination Configuration API.
|
|
58
74
|
*
|
|
@@ -60,11 +76,12 @@ export async function getBtpDestinationConfig(uri, token, destinationName, logge
|
|
|
60
76
|
* @returns {Promise<Destinations>} Map of destination name to Destination object.
|
|
61
77
|
*/
|
|
62
78
|
export async function listBtpDestinations(credentials) {
|
|
63
|
-
const uaa =
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
const uaa = getDestinationServiceUaa(credentials);
|
|
80
|
+
if (!uaa) {
|
|
81
|
+
throw new Error(t('error.failedToListBtpDestinations', { error: t('error.incompleteDestinationServiceCredentials') }));
|
|
82
|
+
}
|
|
66
83
|
const token = await getToken(uaa);
|
|
67
|
-
const url = `${
|
|
84
|
+
const url = `${uaa.uri}/destination-configuration/v1/subaccountDestinations`;
|
|
68
85
|
try {
|
|
69
86
|
const response = await axios.get(url, {
|
|
70
87
|
headers: { Authorization: `Bearer ${token}` }
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
"couldNotFetchServiceKeys": "Cannot fetch the service keys. Error: {{error}}",
|
|
129
129
|
"metadataFetchingNotSupportedForCF": "Metadata fetching is not supported for Cloud Foundry projects.",
|
|
130
130
|
"failedToListBtpDestinations": "Failed to list BTP destinations. Error: {{error}}",
|
|
131
|
+
"incompleteDestinationServiceCredentials": "Incomplete destination service credentials",
|
|
131
132
|
"destinationServiceNotFoundInMtaYaml": "Destination service instance not found in mta.yaml. Ensure a resource with 'service: destination' is declared.",
|
|
132
133
|
"noServiceKeysFoundForDestination": "No service keys found for destination service instance '{{serviceInstanceName}}'. Ensure the service is provisioned and try again.",
|
|
133
134
|
"errorFetchingDestinations": "An error occurred when fetching destinations. For more information, see the logs.",
|
package/dist/types.d.ts
CHANGED
|
@@ -788,14 +788,23 @@ export interface XsApp {
|
|
|
788
788
|
export interface Uaa {
|
|
789
789
|
clientid: string;
|
|
790
790
|
clientsecret: string;
|
|
791
|
+
/** Auth server URL (used to request OAuth tokens). */
|
|
791
792
|
url: string;
|
|
793
|
+
/** Present on destination-service uaa bindings. */
|
|
794
|
+
uri?: string;
|
|
792
795
|
}
|
|
796
|
+
/**
|
|
797
|
+
* CF destination-service service-key credentials.
|
|
798
|
+
* - nested: `{ uaa: { clientid, clientsecret, url, uri, ... } }`
|
|
799
|
+
* - flat: `{ clientid, clientsecret, url, uri, ... }`
|
|
800
|
+
*/
|
|
793
801
|
export type CfDestinationServiceCredentials = {
|
|
802
|
+
uaa: Uaa & {
|
|
803
|
+
uri: string;
|
|
804
|
+
};
|
|
805
|
+
} | (Uaa & {
|
|
794
806
|
uri: string;
|
|
795
|
-
|
|
796
|
-
} | ({
|
|
797
|
-
uri: string;
|
|
798
|
-
} & Uaa);
|
|
807
|
+
});
|
|
799
808
|
export interface CfAppParams {
|
|
800
809
|
appName: string;
|
|
801
810
|
appVersion: string;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
12
12
|
},
|
|
13
|
-
"version": "1.0.
|
|
13
|
+
"version": "1.0.4",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"author": "@SAP/ux-tools-team",
|
|
16
16
|
"main": "dist/index.js",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"@sap-ux/axios-extension": "2.0.0",
|
|
41
41
|
"@sap-ux/btp-utils": "2.0.0",
|
|
42
42
|
"@sap-ux/i18n": "1.0.0",
|
|
43
|
-
"@sap-ux/inquirer-common": "1.0.
|
|
43
|
+
"@sap-ux/inquirer-common": "1.0.3",
|
|
44
44
|
"@sap-ux/logger": "1.0.0",
|
|
45
|
-
"@sap-ux/nodejs-utils": "1.0.
|
|
46
|
-
"@sap-ux/odata-service-writer": "1.0.
|
|
47
|
-
"@sap-ux/project-access": "2.0.
|
|
48
|
-
"@sap-ux/project-input-validator": "1.0.
|
|
45
|
+
"@sap-ux/nodejs-utils": "1.0.1",
|
|
46
|
+
"@sap-ux/odata-service-writer": "1.0.2",
|
|
47
|
+
"@sap-ux/project-access": "2.0.2",
|
|
48
|
+
"@sap-ux/project-input-validator": "1.0.2",
|
|
49
49
|
"@sap-ux/store": "2.0.0",
|
|
50
50
|
"@sap-ux/system-access": "1.0.0",
|
|
51
|
-
"@sap-ux/ui5-config": "1.0.
|
|
51
|
+
"@sap-ux/ui5-config": "1.0.1",
|
|
52
52
|
"@sap-ux/ui5-info": "1.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|