multicloud_rule_manager 1.1.73 → 1.1.74
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.
|
@@ -5,7 +5,7 @@ import { getAlias } from "../utils/aliasManager.js";
|
|
|
5
5
|
export default {
|
|
6
6
|
command: "retrieveproduct <alias> <productName>",
|
|
7
7
|
describe: "Recupera struttura prodotto e genera Excel",
|
|
8
|
-
|
|
8
|
+
handler: async (argv) => {
|
|
9
9
|
try {
|
|
10
10
|
console.log("🔹 Retrieve in corso..");
|
|
11
11
|
console.log("🔹 Recupero credenziali per alias:", argv.alias);
|
|
@@ -25,7 +25,6 @@ export default {
|
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
const loginData = await loginResp.json(); // leggi direttamente JSON
|
|
30
29
|
const access_token = loginData.access_token;
|
|
31
30
|
|
|
@@ -36,12 +35,10 @@ export default {
|
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const productsResp = await fetch(
|
|
44
|
-
`https://${cred.realm}.bit2win.cloud/api/data/v1/rules/`,
|
|
38
|
+
// --- SECONDA CHIAMATA: retrieve ---
|
|
39
|
+
console.log("🔹 Inizio richiesta dati API...");
|
|
40
|
+
const apiResp = await fetch(
|
|
41
|
+
`https://${cred.realm}.bit2win.cloud/api/data/v1/products/`,
|
|
45
42
|
{
|
|
46
43
|
method: "GET",
|
|
47
44
|
headers: {
|
|
@@ -52,8 +49,11 @@ export default {
|
|
|
52
49
|
}
|
|
53
50
|
);
|
|
54
51
|
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
55
|
console.log(" Chiamo products"+argv.productName);
|
|
56
|
-
const products = await safeJson(
|
|
56
|
+
const products = await safeJson(apiResp, "products");
|
|
57
57
|
|
|
58
58
|
console.log(" Chiamo products finita "+argv.productName);
|
|
59
59
|
const product = products.find(p => p.name === argv.productName);
|