multicloud_rule_manager 1.0.14 → 1.0.16

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.
@@ -27,27 +27,27 @@ export default {
27
27
  })
28
28
  });
29
29
 
30
- const loginText = await loginResp.text();
30
+ const loginData = await loginResp.json(); // leggi direttamente JSON
31
+ const access_token = loginData.access_token;
31
32
 
32
- let loginData;
33
- try {
34
- loginData = JSON.parse(loginText);
35
- var access_token = loginData.access_token;
36
- console.log("🔹 Token response raw:", access_token);
37
- if (!access_token) throw new Error("Token non ricevuto nel campo 'access'");
38
- } catch (err) {
39
- throw new Error(`Token JSON parsing failed: ${err.message}`);
40
- }
33
+ console.log("🔹 Token response raw:", access_token);
34
+
35
+ if (!access_token) {
36
+ throw new Error("Token non ricevuto nel campo 'access_token'");
37
+ }
41
38
 
42
39
 
43
40
 
44
41
  // --- SECONDA CHIAMATA: retrieve ---
45
42
  console.log("🔹 Inizio richiesta dati API...");
46
43
  const apiResp = await fetch(`https://eon-dev-01.bit2win.cloud/api/data/v1/rules/`, { // usa dominio fisso
47
- method: "GET",
48
- headers: {
49
- Authorization: `Bearer ${access_token}`
50
- }
44
+ method: "GET",
45
+ headers: {
46
+ Authorization: `Bearer ${access_token}`,
47
+ Accept: "*/*",
48
+ "User-Agent": "PostmanRuntime/7.51.1",
49
+ "Host": "eon-dev-01.bit2win.cloud"
50
+ }
51
51
  });
52
52
 
53
53
  console.log("🔹 API status:", apiResp.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",