multicloud_rule_manager 1.1.86 → 1.1.87

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.
@@ -196,66 +196,80 @@ export default {
196
196
 
197
197
  console.log(`📂 Totale categorie: ${categories.length}`);
198
198
 
199
- for (const cat of categories) {
200
- const children = getChildren(cat.guid);
201
-
202
- console.log(
203
- `➡️ Categoria "${cat.name}" → ${children.length} children`
204
- );
205
-
206
- totalChildren += children.length;
207
-
208
- if (children.length === 0) {
209
- rows1.push({
210
- "Product Name": product.name,
211
- "Product Eligible": productStructureRoot.eligible,
212
- "Category Name": cat.name,
213
- "Category Visible": cat.visible,
214
- "Category Visible Cart": cat.visible_cart,
215
- "Child Product Name": "",
199
+ for (const cat of categories) {
200
+ const children = getChildren(cat.guid);
201
+
202
+ console.log(
203
+ `➡️ Categoria "${cat.name}" → ${children.length} children`
204
+ );
205
+
206
+ totalChildren += children.length;
207
+
208
+ const isNewCategory = lastCategory !== cat.name;
209
+
210
+ if (children.length === 0) {
211
+ rows1.push({
212
+ "Product Name": !lastProductWritten ? product.name : "",
213
+ "Product Eligible": !lastProductWritten
214
+ ? productStructureRoot.eligible
215
+ : "",
216
+ "Category Name": isNewCategory ? cat.name : "",
217
+ "Category Visible": isNewCategory ? cat.visible : "",
218
+ "Category Visible Cart": isNewCategory
219
+ ? cat.visible_cart
220
+ : "",
221
+ "Child Product Name": "",
222
+ });
223
+
224
+ lastProductWritten = true;
225
+ lastCategory = cat.name;
226
+ }
227
+
228
+ for (const child of children) {
229
+ rows1.push({
230
+ "Product Name": !lastProductWritten ? product.name : "",
231
+ "Product Eligible": !lastProductWritten
232
+ ? productStructureRoot.eligible
233
+ : "",
234
+ "Category Name": isNewCategory ? cat.name : "",
235
+ "Category Visible": isNewCategory ? cat.visible : "",
236
+ "Category Visible Cart": isNewCategory
237
+ ? cat.visible_cart
238
+ : "",
239
+ "Category Min Qty": isNewCategory ? cat.min_qty : "",
240
+ "Category Dft Qty": isNewCategory ? cat.default_qty : "",
241
+ "Category Max Qty": isNewCategory ? cat.max_qty : "",
242
+ "Child Product Name": child.name,
243
+ "Child Visible": child.visible,
244
+ "Child Visible Cart": child.visible_cart,
245
+ "Child Min Qty": child.min_qty,
246
+ "Child Dft Qty": child.default_qty,
247
+ "Child Max Qty": child.max_qty,
248
+ });
249
+
250
+ lastProductWritten = true;
251
+ lastCategory = cat.name;
252
+
253
+ if (!child.product_id) continue;
254
+
255
+ const families = await getFamilies(child.product_id);
256
+
257
+ for (const f of families) {
258
+ for (const attr of f.attributes) {
259
+ for (const dom of attr.domains) {
260
+ rows2.push({
261
+ product: product.name,
262
+ category: cat.name,
263
+ child: child.name,
264
+ family: f.name,
265
+ attribute: attr.name,
266
+ domain_value: dom.value,
216
267
  });
217
268
  }
218
-
219
- for (const child of children) {
220
- rows1.push({
221
- "Product Name": product.name,
222
- "Product Eligible": productStructureRoot.eligible,
223
- "Category Name": cat.name,
224
- "Category Visible": cat.visible,
225
- "Category Visible Cart": cat.visible_cart,
226
- "Category Min Qty": cat.min_qty,
227
- "Category Dft Qty": cat.default_qty,
228
- "Category Max Qty": cat.max_qty,
229
- "Child Product Name": child.name,
230
- "Category Visible": child.visible,
231
- "Category Visible Cart": child.visible_cart,
232
- "Category Min Qty": child.min_qty,
233
- "Category Dft Qty": child.default_qty,
234
- "Category Max Qty": child.max_qty
235
- });
236
-
237
- if (!child.product_id) continue;
238
-
239
- const families = await getFamilies(
240
- child.product_id
241
- );
242
-
243
- for (const f of families) {
244
- for (const attr of f.attributes) {
245
- for (const dom of attr.domains) {
246
- rows2.push({
247
- product: product.name,
248
- category: cat.name,
249
- child: child.name,
250
- family: f.name,
251
- attribute: attr.name,
252
- domain_value: dom.value,
253
- });
254
- }
255
- }
256
- }
257
- }
258
269
  }
270
+ }
271
+ }
272
+ }
259
273
 
260
274
  // =========================
261
275
  // 📊 RISULTATI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multicloud_rule_manager",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
4
4
  "description": "CLI interna per retrieve/upload con token",
5
5
  "main": "index.js",
6
6
  "type": "module",