multicloud_rule_manager 1.1.42 → 1.1.44

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.
@@ -13,21 +13,40 @@ export default {
13
13
  function buildNodes(children) {
14
14
  if (!Array.isArray(children) || children.length === 0) return [];
15
15
 
16
- const sorted = sortNodes(children);
16
+ const sorted = (children);
17
17
 
18
18
  return sorted.map(child => {
19
19
  const template = {
20
- key: child._key || "products",
21
- attributes: [],
22
- children: []
20
+ name: child.name || "NO_NAME"
23
21
  };
24
22
 
25
- if (Array.isArray(child._attributes)) {
26
- template.attributes = sortNodes(child._attributes);
23
+ if (Array.isArray(child.map_object_items)) {
24
+ for (const item of hild.map_object_items) {
25
+
26
+ if (!item.system_record) {
27
+ var ultimoNodo = {
28
+
29
+ "label": item.label,
30
+ "relationship_object": item.relationship_object,
31
+ "relationship_target_source_field": item.relationship_target_source_field,
32
+ "overridable": item.overridable,
33
+ "price_model_selectable": item.price_model_selectable,
34
+ "value": item.value,
35
+ "engine_field": item.engine_field,
36
+ "source_field": item.source_field,
37
+ "type": item.type,
38
+ "relationship_target_field": item.relationship_target_field,
39
+ "field_type": item.field_type,
40
+ "target_name": item.target_name
41
+ }
42
+
43
+ template.map_object_items = (ultimoNodo);
44
+ }
45
+ }
27
46
  }
28
47
 
29
- if (Array.isArray(child._children) && child._children.length > 0) {
30
- template.children = buildNodes(child._children); // ricorsione
48
+ if (Array.isArray(child.map_objects) && child.map_objects.length > 0) {
49
+ template.map_objects = buildNodes(child.map_objects); // ricorsione
31
50
  }
32
51
 
33
52
  return template;
@@ -36,31 +55,6 @@ export default {
36
55
 
37
56
 
38
57
 
39
- function sortNodes(nodes) {
40
- if (!Array.isArray(nodes)) return nodes;
41
-
42
- // ordina alfabeticamente per _key
43
- nodes.sort((a, b) => {
44
- const ka = (a._key || "").toLowerCase();
45
- const kb = (b._key || "").toLowerCase();
46
- return ka.localeCompare(kb);
47
- });
48
-
49
- // ricorsione su nodi annidati
50
- for (const node of nodes) {
51
- if (Array.isArray(node._children)) {
52
- node._children = sortNodes(node._children);
53
- }
54
-
55
- if (Array.isArray(node._attributes)) {
56
- node._attributes = sortNodes(node._attributes);
57
- }
58
- }
59
-
60
- return nodes;
61
- }
62
-
63
-
64
58
 
65
59
  try {
66
60
  console.log("🔹 Retrieve Datamap in corso..");
@@ -148,22 +142,18 @@ export default {
148
142
 
149
143
  const mapData = await mapResp.json();
150
144
 
151
- var map = mapData?.map_j2j_published;
145
+ var map = mapData?.map_objects;
152
146
 
153
147
  // costruzione JSON finale
154
148
  const result = {
155
- attributes: [],
156
- children: []
157
149
  };
158
150
 
159
151
  if (map) {
160
152
 
161
- if (Array.isArray(map._attributes)) {
162
- result.attributes = sortNodes(map._attributes);
163
- }
164
153
 
165
- if (Array.isArray(map._children) && map._children.length > 0) {
166
- result.children = buildNodes(map._children);
154
+
155
+ if (Array.isArray(map)) {
156
+ result = buildNodes(map);
167
157
  }
168
158
 
169
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",