kalai-attach 1.0.16 → 1.0.18
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/lib/destinations.js +10 -7
- package/package.json +1 -1
package/lib/destinations.js
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
const xsenv = require('@sap/xsenv');
|
|
3
3
|
const axios = require('axios');
|
|
4
4
|
xsenv.loadEnv();
|
|
5
|
-
const dest_service = xsenv.getServices({ dest: { tag: 'destination' } }).dest;
|
|
6
5
|
|
|
7
6
|
async function getAccessToken() {
|
|
8
7
|
try {
|
|
8
|
+
|
|
9
|
+
const dest_service = xsenv.getServices({ dest: { tag: 'destination' } }).dest;
|
|
10
|
+
if (!dest_service) {
|
|
11
|
+
throw new Error("Destination service Instance Binding is nedded")
|
|
12
|
+
}
|
|
9
13
|
const response = await axios({
|
|
10
14
|
method: 'post',
|
|
11
15
|
url: `${dest_service.url}/oauth/token`,
|
|
@@ -19,8 +23,7 @@ async function getAccessToken() {
|
|
|
19
23
|
return response.data.access_token;
|
|
20
24
|
} catch (error) {
|
|
21
25
|
console.error('Error fetching access token:', error.response.data);
|
|
22
|
-
|
|
23
|
-
return error.response.data;
|
|
26
|
+
throw new Error("Error fetching access token" + error)
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -38,7 +41,7 @@ module.exports = {
|
|
|
38
41
|
const response = await axios.get(`${destService.uri}/destination-configuration/v1/destinations/${destinationName}`, {
|
|
39
42
|
headers,
|
|
40
43
|
});
|
|
41
|
-
console.log("responsessss"+response.data.destinationConfiguration);
|
|
44
|
+
console.log("responsessss" + response.data.destinationConfiguration);
|
|
42
45
|
|
|
43
46
|
const config = response.data.destinationConfiguration;;
|
|
44
47
|
|
|
@@ -46,14 +49,14 @@ module.exports = {
|
|
|
46
49
|
throw new Error(`Destination ${destinationName} not found in BTP Cockpit`);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
const { container_name, connection_string, sas_token,container_uri } = config;
|
|
52
|
+
const { container_name, connection_string, sas_token, container_uri } = config;
|
|
50
53
|
|
|
51
54
|
if (!container_name || !sas_token || !connection_string) {
|
|
52
55
|
throw new Error(`Azure configuration fields are missing in destination: ${destinationName}`);
|
|
53
56
|
}
|
|
54
|
-
return { container_name, connection_string, sas_token,container_uri }
|
|
57
|
+
return { container_name, connection_string, sas_token, container_uri }
|
|
55
58
|
} catch (err) {
|
|
56
|
-
throw new Error("Configuration of Azure Container is Missing")
|
|
59
|
+
throw new Error("Configuration of Azure Container is Missing" + err)
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kalai-attach",
|
|
3
3
|
"description": "CAP cds-plugin providing image and attachment storing out-of-the-box.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.18",
|
|
5
5
|
"repository": "capjsattachments-kalai",
|
|
6
6
|
"author": "Kalai",
|
|
7
7
|
"homepage": "https://github.com/Kalaikovan-airdit",
|