multicloud_rule_manager 1.1.56 → 1.1.58
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/commands/deploy.js +11 -2
- package/commands/retrieve.js +1 -1
- package/package.json +1 -1
package/commands/deploy.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getAlias } from "../utils/aliasManager.js";
|
|
|
4
4
|
import { validateRule } from "../utils/ruleValidator.js";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
command: "
|
|
7
|
+
command: "deployrule <alias>",
|
|
8
8
|
describe: "Deploy dei file rules su API",
|
|
9
9
|
handler: async (argv) => {
|
|
10
10
|
try {
|
|
@@ -56,6 +56,8 @@ export default {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const guid = match[1];
|
|
59
|
+
const filename = file.substring(0, file.lastIndexOf("_"));
|
|
60
|
+
const startDate = new Date().toISOString().replace("Z", "000");
|
|
59
61
|
// --- POST API ---
|
|
60
62
|
try {
|
|
61
63
|
const resp = await fetch(`https://${cred.realm}.bit2win.cloud/api/data/v1/rules/${guid}`, {
|
|
@@ -66,7 +68,14 @@ export default {
|
|
|
66
68
|
},
|
|
67
69
|
body: JSON.stringify({
|
|
68
70
|
|
|
71
|
+
context: "catalog",
|
|
72
|
+
name: filename,
|
|
73
|
+
end_date: null,
|
|
74
|
+
agenda_group: "always",
|
|
75
|
+
status: "draft",
|
|
76
|
+
start_date: startDate,
|
|
69
77
|
dsl_internal: content
|
|
78
|
+
|
|
70
79
|
})
|
|
71
80
|
});
|
|
72
81
|
|
|
@@ -81,7 +90,7 @@ export default {
|
|
|
81
90
|
) {
|
|
82
91
|
console.warn(`⚠️ Rule ${guid} non trovata, provo creazione...`);
|
|
83
92
|
|
|
84
|
-
const resp = await fetch(`https://${cred.realm}.bit2win.cloud/api/data/v1/rules
|
|
93
|
+
const resp = await fetch(`https://${cred.realm}.bit2win.cloud/api/data/v1/rules`, {
|
|
85
94
|
method: "POST",
|
|
86
95
|
headers: {
|
|
87
96
|
"Authorization": `Bearer ${accessToken}`,
|
package/commands/retrieve.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import { getAlias } from "../utils/aliasManager.js";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
command: "
|
|
5
|
+
command: "retrieverule <alias> [output]",
|
|
6
6
|
describe: "Recupera dati API con token automatico",
|
|
7
7
|
builder: {
|
|
8
8
|
output: { type: "string", default: "retrieve.json", describe: "File di output" }
|