multicloud_rule_manager 1.1.15 → 1.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,7 +15,7 @@ export function validateRule(fileName, content) {
15
15
  const line = lines[i];
16
16
 
17
17
  // verifica blocco when {} then {}
18
- if (!hasWhenThenBlock(content, fileName)) {
18
+ if (!hasValidWhenThenBlock(content, fileName)) {
19
19
  continue;
20
20
  }
21
21
 
@@ -74,11 +74,15 @@ export function validateRule(fileName, content) {
74
74
  return { valid: true };
75
75
  }
76
76
 
77
- function hasWhenThenBlock(content, fileName) {
78
- const whenThenRegex = /when\s*{[\s\S]*?}\s*[\r\n\s]*then\s*{/i;
77
+ function hasValidWhenThenBlock(content, fileName) {
78
+ // breakdown:
79
+ // - when\s*{ => 'when' seguito da { con eventuali spazi/tab/line break
80
+ // - [\s\S]*? => qualsiasi contenuto multilinea dentro il blocco when
81
+ // - }\s*then\s*{ => chiusura block '}' e apertura 'then {' con spazi/tab/line break tra di loro
82
+ const regex = /when\s*{[\s\S]*?}\s*then\s*{/i;
79
83
 
80
- if (!whenThenRegex.test(content)) {
81
- console.error(`❌ Il file ${fileName} deve contenere un blocco "when {} then {}"`);
84
+ if (!regex.test(content)) {
85
+ console.error(`❌ Il file ${fileName} deve contenere un blocco "when {} then {}" valido`);
82
86
  return false;
83
87
  }
84
88