multicloud_rule_manager 1.1.49 → 1.1.50

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.
@@ -9,49 +9,49 @@ export default {
9
9
  },
10
10
  handler: async (argv) => {
11
11
 
12
- function buildMapObject(children) {
13
- if (!Array.isArray(children) || children.length === 0) return [];
14
-
15
- return children
16
- .map(child => {
17
-
18
- const items = Array.isArray(child.map_object_items)
19
- ? child.map_object_items
20
- .filter(item => !item.system_record)
21
- .map(item => ({
22
- label: item.label,
23
- relationship_object: item.relationship_object,
24
- relationship_target_source_field: item.relationship_target_source_field,
25
- overridable: item.overridable,
26
- price_model_selectable: item.price_model_selectable,
27
- value: item.value,
28
- engine_field: item.engine_field,
29
- source_field: item.source_field,
30
- type: item.type,
31
- relationship_target_field: item.relationship_target_field,
32
- field_type: item.field_type,
33
- target_name: item.target_name
34
- }))
35
- : [];
36
-
37
- const childrenNodes = buildMapObject(child.map_objects);
38
-
39
- // ❗ se non ha né items né figli validi → scartalo
40
- if (items.length === 0 && childrenNodes.length === 0) {
41
- return null;
42
- }
12
+ function buildMapObject(children) {
13
+ if (!Array.isArray(children) || children.length === 0) return [];
14
+
15
+ return children
16
+ .map(child => {
17
+
18
+ const items = Array.isArray(child.map_object_items)
19
+ ? child.map_object_items
20
+ .filter(item => !item.system_record)
21
+ .map(item => ({
22
+ label: item.label,
23
+ relationship_object: item.relationship_object,
24
+ relationship_target_source_field: item.relationship_target_source_field,
25
+ overridable: item.overridable,
26
+ price_model_selectable: item.price_model_selectable,
27
+ value: item.value,
28
+ engine_field: item.engine_field,
29
+ source_field: item.source_field,
30
+ type: item.type,
31
+ relationship_target_field: item.relationship_target_field,
32
+ field_type: item.field_type,
33
+ target_name: item.target_name
34
+ }))
35
+ : [];
36
+
37
+ const childrenNodes = buildMapObject(child.map_objects);
38
+
39
+ // ❗ se non ha né items né figli validi → scartalo
40
+ if (items.length === 0 && childrenNodes.length === 0) {
41
+ return null;
42
+ }
43
43
 
44
- const template = {
45
- name: child.name || "NO_NAME"
46
- };
44
+ const template = {
45
+ name: child.name || "NO_NAME"
46
+ };
47
47
 
48
- if (items.length) template.map_object_items = items;
49
- if (childrenNodes.length) template.map_objects = childrenNodes;
48
+ if (items.length) template.map_object_items = items;
49
+ if (childrenNodes.length) template.map_objects = childrenNodes;
50
50
 
51
- return template;
52
- })
53
- .filter(Boolean); // rimuove i null
54
- }
51
+ return template;
52
+ })
53
+ .filter(Boolean); // rimuove i null
54
+ }
55
55
 
56
56
 
57
57
 
@@ -149,15 +149,9 @@ export default {
149
149
  };
150
150
 
151
151
  if (map) {
152
-
153
-
154
-
155
152
  if (Array.isArray(map)) {
156
- result = buildNodes(map);
153
+ result = buildMapObject(map);
157
154
  }
158
-
159
-
160
-
161
155
  if (Object.keys(result).length === 0) {
162
156
  console.warn(`⚠️ Nessun dato valido per ${record.name}`);
163
157
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.49",
3
+ "version": "1.1.50",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",