myio-js-library 0.1.45 → 0.1.47
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/dist/index.cjs +38 -4
- package/dist/index.js +38 -4
- package/dist/myio-js-library.umd.js +38 -4
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6942,9 +6942,7 @@ var AllReportModal = class {
|
|
|
6942
6942
|
debugEnabled;
|
|
6943
6943
|
// Debug logging helper
|
|
6944
6944
|
debugLog(message, data) {
|
|
6945
|
-
|
|
6946
|
-
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6947
|
-
}
|
|
6945
|
+
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6948
6946
|
}
|
|
6949
6947
|
// Helper: normalize identifiers (upper, strip spaces and non-alphanum)
|
|
6950
6948
|
normalizeId(v) {
|
|
@@ -7474,6 +7472,8 @@ var AllReportModal = class {
|
|
|
7474
7472
|
mapCustomerTotalsResponse(apiResponse) {
|
|
7475
7473
|
this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
|
|
7476
7474
|
const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
|
|
7475
|
+
console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
|
|
7476
|
+
console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
|
|
7477
7477
|
this.debugLog("\u{1F4CB} API data array extracted", {
|
|
7478
7478
|
isDataProperty: !!apiResponse?.data,
|
|
7479
7479
|
isDirectArray: Array.isArray(apiResponse),
|
|
@@ -7487,9 +7487,20 @@ var AllReportModal = class {
|
|
|
7487
7487
|
}
|
|
7488
7488
|
const sumByApiId = /* @__PURE__ */ new Map();
|
|
7489
7489
|
let apiItemsWithoutId = 0;
|
|
7490
|
+
let totalApiConsumption = 0;
|
|
7490
7491
|
this.debugLog("\u{1F528} Building ID index from API data...");
|
|
7491
7492
|
for (const [index, item] of apiArray.entries()) {
|
|
7492
7493
|
const consumption = this.pickConsumption(item);
|
|
7494
|
+
totalApiConsumption += consumption;
|
|
7495
|
+
if (index < 3) {
|
|
7496
|
+
console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
|
|
7497
|
+
id: item?.id,
|
|
7498
|
+
name: item?.name,
|
|
7499
|
+
assetName: item?.assetName,
|
|
7500
|
+
total_value: item?.total_value,
|
|
7501
|
+
extractedConsumption: consumption
|
|
7502
|
+
});
|
|
7503
|
+
}
|
|
7493
7504
|
this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
|
|
7494
7505
|
item,
|
|
7495
7506
|
extractedConsumption: consumption,
|
|
@@ -7505,17 +7516,28 @@ var AllReportModal = class {
|
|
|
7505
7516
|
this.debugLog(`\u274C API item without ID:`, item);
|
|
7506
7517
|
}
|
|
7507
7518
|
}
|
|
7519
|
+
console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
|
|
7520
|
+
console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
|
|
7508
7521
|
this.debugLog("\u{1F4CA} ID index built", {
|
|
7509
7522
|
sumByApiIdSize: sumByApiId.size,
|
|
7510
7523
|
sumByApiIdEntries: Array.from(sumByApiId.entries()),
|
|
7511
7524
|
apiItemsWithoutId
|
|
7512
7525
|
});
|
|
7513
7526
|
let matchedById = 0, matchedBySubstring = 0;
|
|
7527
|
+
let totalMappedConsumption = 0;
|
|
7514
7528
|
this.debugLog("\u{1F3AF} Starting itemsList mapping...");
|
|
7515
7529
|
const rows = this.params.itemsList.map((listItem, index) => {
|
|
7516
7530
|
this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
|
|
7517
7531
|
let consumption = sumByApiId.get(listItem.id) ?? 0;
|
|
7518
7532
|
this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
|
|
7533
|
+
if (index < 3) {
|
|
7534
|
+
console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
|
|
7535
|
+
id: listItem.id,
|
|
7536
|
+
identifier: listItem.identifier,
|
|
7537
|
+
label: listItem.label,
|
|
7538
|
+
idMatchConsumption: consumption
|
|
7539
|
+
});
|
|
7540
|
+
}
|
|
7519
7541
|
if (consumption > 0) {
|
|
7520
7542
|
matchedById++;
|
|
7521
7543
|
this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
|
|
@@ -7529,6 +7551,14 @@ var AllReportModal = class {
|
|
|
7529
7551
|
if (assetNameMatch || nameMatch) {
|
|
7530
7552
|
const itemConsumption = this.pickConsumption(apiItem);
|
|
7531
7553
|
consumption += itemConsumption;
|
|
7554
|
+
if (index < 3) {
|
|
7555
|
+
console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
|
|
7556
|
+
apiItemName: name,
|
|
7557
|
+
apiItemAssetName: assetName,
|
|
7558
|
+
itemConsumption,
|
|
7559
|
+
totalConsumption: consumption
|
|
7560
|
+
});
|
|
7561
|
+
}
|
|
7532
7562
|
this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
|
|
7533
7563
|
listItemIdentifier: listItem.identifier,
|
|
7534
7564
|
apiItemAssetName: assetName,
|
|
@@ -7552,6 +7582,7 @@ var AllReportModal = class {
|
|
|
7552
7582
|
name: listItem.label,
|
|
7553
7583
|
consumption: Math.round(consumption * 100) / 100
|
|
7554
7584
|
};
|
|
7585
|
+
totalMappedConsumption += result.consumption;
|
|
7555
7586
|
this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
|
|
7556
7587
|
return result;
|
|
7557
7588
|
});
|
|
@@ -7562,8 +7593,11 @@ var AllReportModal = class {
|
|
|
7562
7593
|
matchedById,
|
|
7563
7594
|
matchedBySubstring,
|
|
7564
7595
|
unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
|
|
7565
|
-
apiItemsWithoutId
|
|
7596
|
+
apiItemsWithoutId,
|
|
7597
|
+
totalApiConsumption,
|
|
7598
|
+
totalMappedConsumption
|
|
7566
7599
|
};
|
|
7600
|
+
console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
|
|
7567
7601
|
this.debugLog("\u{1F4CA} Final mapping stats:", stats);
|
|
7568
7602
|
console.log("[AllReportModal] Mapping stats:", stats);
|
|
7569
7603
|
return rows;
|
package/dist/index.js
CHANGED
|
@@ -6875,9 +6875,7 @@ var AllReportModal = class {
|
|
|
6875
6875
|
debugEnabled;
|
|
6876
6876
|
// Debug logging helper
|
|
6877
6877
|
debugLog(message, data) {
|
|
6878
|
-
|
|
6879
|
-
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6880
|
-
}
|
|
6878
|
+
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6881
6879
|
}
|
|
6882
6880
|
// Helper: normalize identifiers (upper, strip spaces and non-alphanum)
|
|
6883
6881
|
normalizeId(v) {
|
|
@@ -7407,6 +7405,8 @@ var AllReportModal = class {
|
|
|
7407
7405
|
mapCustomerTotalsResponse(apiResponse) {
|
|
7408
7406
|
this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
|
|
7409
7407
|
const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
|
|
7408
|
+
console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
|
|
7409
|
+
console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
|
|
7410
7410
|
this.debugLog("\u{1F4CB} API data array extracted", {
|
|
7411
7411
|
isDataProperty: !!apiResponse?.data,
|
|
7412
7412
|
isDirectArray: Array.isArray(apiResponse),
|
|
@@ -7420,9 +7420,20 @@ var AllReportModal = class {
|
|
|
7420
7420
|
}
|
|
7421
7421
|
const sumByApiId = /* @__PURE__ */ new Map();
|
|
7422
7422
|
let apiItemsWithoutId = 0;
|
|
7423
|
+
let totalApiConsumption = 0;
|
|
7423
7424
|
this.debugLog("\u{1F528} Building ID index from API data...");
|
|
7424
7425
|
for (const [index, item] of apiArray.entries()) {
|
|
7425
7426
|
const consumption = this.pickConsumption(item);
|
|
7427
|
+
totalApiConsumption += consumption;
|
|
7428
|
+
if (index < 3) {
|
|
7429
|
+
console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
|
|
7430
|
+
id: item?.id,
|
|
7431
|
+
name: item?.name,
|
|
7432
|
+
assetName: item?.assetName,
|
|
7433
|
+
total_value: item?.total_value,
|
|
7434
|
+
extractedConsumption: consumption
|
|
7435
|
+
});
|
|
7436
|
+
}
|
|
7426
7437
|
this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
|
|
7427
7438
|
item,
|
|
7428
7439
|
extractedConsumption: consumption,
|
|
@@ -7438,17 +7449,28 @@ var AllReportModal = class {
|
|
|
7438
7449
|
this.debugLog(`\u274C API item without ID:`, item);
|
|
7439
7450
|
}
|
|
7440
7451
|
}
|
|
7452
|
+
console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
|
|
7453
|
+
console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
|
|
7441
7454
|
this.debugLog("\u{1F4CA} ID index built", {
|
|
7442
7455
|
sumByApiIdSize: sumByApiId.size,
|
|
7443
7456
|
sumByApiIdEntries: Array.from(sumByApiId.entries()),
|
|
7444
7457
|
apiItemsWithoutId
|
|
7445
7458
|
});
|
|
7446
7459
|
let matchedById = 0, matchedBySubstring = 0;
|
|
7460
|
+
let totalMappedConsumption = 0;
|
|
7447
7461
|
this.debugLog("\u{1F3AF} Starting itemsList mapping...");
|
|
7448
7462
|
const rows = this.params.itemsList.map((listItem, index) => {
|
|
7449
7463
|
this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
|
|
7450
7464
|
let consumption = sumByApiId.get(listItem.id) ?? 0;
|
|
7451
7465
|
this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
|
|
7466
|
+
if (index < 3) {
|
|
7467
|
+
console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
|
|
7468
|
+
id: listItem.id,
|
|
7469
|
+
identifier: listItem.identifier,
|
|
7470
|
+
label: listItem.label,
|
|
7471
|
+
idMatchConsumption: consumption
|
|
7472
|
+
});
|
|
7473
|
+
}
|
|
7452
7474
|
if (consumption > 0) {
|
|
7453
7475
|
matchedById++;
|
|
7454
7476
|
this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
|
|
@@ -7462,6 +7484,14 @@ var AllReportModal = class {
|
|
|
7462
7484
|
if (assetNameMatch || nameMatch) {
|
|
7463
7485
|
const itemConsumption = this.pickConsumption(apiItem);
|
|
7464
7486
|
consumption += itemConsumption;
|
|
7487
|
+
if (index < 3) {
|
|
7488
|
+
console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
|
|
7489
|
+
apiItemName: name,
|
|
7490
|
+
apiItemAssetName: assetName,
|
|
7491
|
+
itemConsumption,
|
|
7492
|
+
totalConsumption: consumption
|
|
7493
|
+
});
|
|
7494
|
+
}
|
|
7465
7495
|
this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
|
|
7466
7496
|
listItemIdentifier: listItem.identifier,
|
|
7467
7497
|
apiItemAssetName: assetName,
|
|
@@ -7485,6 +7515,7 @@ var AllReportModal = class {
|
|
|
7485
7515
|
name: listItem.label,
|
|
7486
7516
|
consumption: Math.round(consumption * 100) / 100
|
|
7487
7517
|
};
|
|
7518
|
+
totalMappedConsumption += result.consumption;
|
|
7488
7519
|
this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
|
|
7489
7520
|
return result;
|
|
7490
7521
|
});
|
|
@@ -7495,8 +7526,11 @@ var AllReportModal = class {
|
|
|
7495
7526
|
matchedById,
|
|
7496
7527
|
matchedBySubstring,
|
|
7497
7528
|
unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
|
|
7498
|
-
apiItemsWithoutId
|
|
7529
|
+
apiItemsWithoutId,
|
|
7530
|
+
totalApiConsumption,
|
|
7531
|
+
totalMappedConsumption
|
|
7499
7532
|
};
|
|
7533
|
+
console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
|
|
7500
7534
|
this.debugLog("\u{1F4CA} Final mapping stats:", stats);
|
|
7501
7535
|
console.log("[AllReportModal] Mapping stats:", stats);
|
|
7502
7536
|
return rows;
|
|
@@ -6864,9 +6864,7 @@
|
|
|
6864
6864
|
debugEnabled;
|
|
6865
6865
|
// Debug logging helper
|
|
6866
6866
|
debugLog(message, data) {
|
|
6867
|
-
|
|
6868
|
-
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6869
|
-
}
|
|
6867
|
+
console.log(`[AllReportModal DEBUG] ${message}`, data || "");
|
|
6870
6868
|
}
|
|
6871
6869
|
// Helper: normalize identifiers (upper, strip spaces and non-alphanum)
|
|
6872
6870
|
normalizeId(v) {
|
|
@@ -7396,6 +7394,8 @@
|
|
|
7396
7394
|
mapCustomerTotalsResponse(apiResponse) {
|
|
7397
7395
|
this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
|
|
7398
7396
|
const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
|
|
7397
|
+
console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
|
|
7398
|
+
console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
|
|
7399
7399
|
this.debugLog("\u{1F4CB} API data array extracted", {
|
|
7400
7400
|
isDataProperty: !!apiResponse?.data,
|
|
7401
7401
|
isDirectArray: Array.isArray(apiResponse),
|
|
@@ -7409,9 +7409,20 @@
|
|
|
7409
7409
|
}
|
|
7410
7410
|
const sumByApiId = /* @__PURE__ */ new Map();
|
|
7411
7411
|
let apiItemsWithoutId = 0;
|
|
7412
|
+
let totalApiConsumption = 0;
|
|
7412
7413
|
this.debugLog("\u{1F528} Building ID index from API data...");
|
|
7413
7414
|
for (const [index, item] of apiArray.entries()) {
|
|
7414
7415
|
const consumption = this.pickConsumption(item);
|
|
7416
|
+
totalApiConsumption += consumption;
|
|
7417
|
+
if (index < 3) {
|
|
7418
|
+
console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
|
|
7419
|
+
id: item?.id,
|
|
7420
|
+
name: item?.name,
|
|
7421
|
+
assetName: item?.assetName,
|
|
7422
|
+
total_value: item?.total_value,
|
|
7423
|
+
extractedConsumption: consumption
|
|
7424
|
+
});
|
|
7425
|
+
}
|
|
7415
7426
|
this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
|
|
7416
7427
|
item,
|
|
7417
7428
|
extractedConsumption: consumption,
|
|
@@ -7427,17 +7438,28 @@
|
|
|
7427
7438
|
this.debugLog(`\u274C API item without ID:`, item);
|
|
7428
7439
|
}
|
|
7429
7440
|
}
|
|
7441
|
+
console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
|
|
7442
|
+
console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
|
|
7430
7443
|
this.debugLog("\u{1F4CA} ID index built", {
|
|
7431
7444
|
sumByApiIdSize: sumByApiId.size,
|
|
7432
7445
|
sumByApiIdEntries: Array.from(sumByApiId.entries()),
|
|
7433
7446
|
apiItemsWithoutId
|
|
7434
7447
|
});
|
|
7435
7448
|
let matchedById = 0, matchedBySubstring = 0;
|
|
7449
|
+
let totalMappedConsumption = 0;
|
|
7436
7450
|
this.debugLog("\u{1F3AF} Starting itemsList mapping...");
|
|
7437
7451
|
const rows = this.params.itemsList.map((listItem, index) => {
|
|
7438
7452
|
this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
|
|
7439
7453
|
let consumption = sumByApiId.get(listItem.id) ?? 0;
|
|
7440
7454
|
this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
|
|
7455
|
+
if (index < 3) {
|
|
7456
|
+
console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
|
|
7457
|
+
id: listItem.id,
|
|
7458
|
+
identifier: listItem.identifier,
|
|
7459
|
+
label: listItem.label,
|
|
7460
|
+
idMatchConsumption: consumption
|
|
7461
|
+
});
|
|
7462
|
+
}
|
|
7441
7463
|
if (consumption > 0) {
|
|
7442
7464
|
matchedById++;
|
|
7443
7465
|
this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
|
|
@@ -7451,6 +7473,14 @@
|
|
|
7451
7473
|
if (assetNameMatch || nameMatch) {
|
|
7452
7474
|
const itemConsumption = this.pickConsumption(apiItem);
|
|
7453
7475
|
consumption += itemConsumption;
|
|
7476
|
+
if (index < 3) {
|
|
7477
|
+
console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
|
|
7478
|
+
apiItemName: name,
|
|
7479
|
+
apiItemAssetName: assetName,
|
|
7480
|
+
itemConsumption,
|
|
7481
|
+
totalConsumption: consumption
|
|
7482
|
+
});
|
|
7483
|
+
}
|
|
7454
7484
|
this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
|
|
7455
7485
|
listItemIdentifier: listItem.identifier,
|
|
7456
7486
|
apiItemAssetName: assetName,
|
|
@@ -7474,6 +7504,7 @@
|
|
|
7474
7504
|
name: listItem.label,
|
|
7475
7505
|
consumption: Math.round(consumption * 100) / 100
|
|
7476
7506
|
};
|
|
7507
|
+
totalMappedConsumption += result.consumption;
|
|
7477
7508
|
this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
|
|
7478
7509
|
return result;
|
|
7479
7510
|
});
|
|
@@ -7484,8 +7515,11 @@
|
|
|
7484
7515
|
matchedById,
|
|
7485
7516
|
matchedBySubstring,
|
|
7486
7517
|
unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
|
|
7487
|
-
apiItemsWithoutId
|
|
7518
|
+
apiItemsWithoutId,
|
|
7519
|
+
totalApiConsumption,
|
|
7520
|
+
totalMappedConsumption
|
|
7488
7521
|
};
|
|
7522
|
+
console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
|
|
7489
7523
|
this.debugLog("\u{1F4CA} Final mapping stats:", stats);
|
|
7490
7524
|
console.log("[AllReportModal] Mapping stats:", stats);
|
|
7491
7525
|
return rows;
|