multicloud_rule_manager 1.1.43 → 1.1.45

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