@cristian-israel/giganet_lib_conecta 1.0.148 → 1.0.149
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +52 -34
- package/dist/index.mjs +52 -34
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11307,7 +11307,7 @@ declare class OnuSignalSummaryResource {
|
|
|
11307
11307
|
private readonly endpoint;
|
|
11308
11308
|
constructor(client: APIClient);
|
|
11309
11309
|
/**
|
|
11310
|
-
* Retorna o resumo de potência (sinal) de uma ONU pelo ID
|
|
11310
|
+
* Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
|
|
11311
11311
|
* O endpoint retorna HTML, que é tratado e convertido para JSON.
|
|
11312
11312
|
*/
|
|
11313
11313
|
get(data: GetOnuSignalSummaryInput): Promise<OnuSignalSummary>;
|
package/dist/index.d.ts
CHANGED
|
@@ -11307,7 +11307,7 @@ declare class OnuSignalSummaryResource {
|
|
|
11307
11307
|
private readonly endpoint;
|
|
11308
11308
|
constructor(client: APIClient);
|
|
11309
11309
|
/**
|
|
11310
|
-
* Retorna o resumo de potência (sinal) de uma ONU pelo ID
|
|
11310
|
+
* Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
|
|
11311
11311
|
* O endpoint retorna HTML, que é tratado e convertido para JSON.
|
|
11312
11312
|
*/
|
|
11313
11313
|
get(data: GetOnuSignalSummaryInput): Promise<OnuSignalSummary>;
|
package/dist/index.js
CHANGED
|
@@ -670,48 +670,66 @@ var LoginDisconnectionsResource = class {
|
|
|
670
670
|
};
|
|
671
671
|
|
|
672
672
|
// src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.types.ts
|
|
673
|
-
function extractValue(text, prefix) {
|
|
674
|
-
const regex = new RegExp(`${escapeRegex(prefix)}([^<\\n]*)`);
|
|
675
|
-
const match = text.match(regex);
|
|
676
|
-
return match ? match[1].trim() : null;
|
|
677
|
-
}
|
|
678
|
-
function escapeRegex(str) {
|
|
679
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
680
|
-
}
|
|
681
673
|
function toNumberOrNull(value) {
|
|
682
674
|
if (value === null) return null;
|
|
683
675
|
const parsed = parseFloat(value);
|
|
684
676
|
return isNaN(parsed) ? null : parsed;
|
|
685
677
|
}
|
|
678
|
+
function normalizeLabel(label) {
|
|
679
|
+
return label.replace(/\s+/g, "").toLowerCase();
|
|
680
|
+
}
|
|
681
|
+
function buildLabelMap(html) {
|
|
682
|
+
const map = /* @__PURE__ */ new Map();
|
|
683
|
+
const decoded = html.replace(/ê/gi, "\xEA").replace(/ú/gi, "\xFA").replace(/Ç/gi, "\xC7").replace(/Õ/gi, "\xD5").replace(/ã/gi, "\xE3").replace(/ç/gi, "\xE7").replace(/õ/gi, "\xF5").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/á/gi, "\xE1").replace(/é/gi, "\xE9").replace(/í/gi, "\xED").replace(/ó/gi, "\xF3").replace(/ñ/gi, "\xF1");
|
|
684
|
+
const divRegex = /<div[^>]*>([\s\S]*?)<\/div>/gi;
|
|
685
|
+
let match;
|
|
686
|
+
while ((match = divRegex.exec(decoded)) !== null) {
|
|
687
|
+
const text = match[1].replace(/<[^>]+>/g, "").trim();
|
|
688
|
+
const separatorIndex = text.indexOf(": ");
|
|
689
|
+
if (separatorIndex === -1) continue;
|
|
690
|
+
const rawLabel = text.substring(0, separatorIndex);
|
|
691
|
+
const value = text.substring(separatorIndex + 2).trim();
|
|
692
|
+
if (!rawLabel || !value) continue;
|
|
693
|
+
map.set(normalizeLabel(rawLabel), value);
|
|
694
|
+
}
|
|
695
|
+
return map;
|
|
696
|
+
}
|
|
697
|
+
function get(map, ...keys) {
|
|
698
|
+
for (const key of keys) {
|
|
699
|
+
const value = map.get(normalizeLabel(key));
|
|
700
|
+
if (value !== void 0) return value;
|
|
701
|
+
}
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
686
704
|
function parseOnuSignalSummaryHtml(html) {
|
|
687
|
-
const
|
|
705
|
+
const map = buildLabelMap(html);
|
|
688
706
|
return {
|
|
689
|
-
lastDropCause:
|
|
690
|
-
rxSignal: toNumberOrNull(
|
|
691
|
-
temperature: toNumberOrNull(
|
|
692
|
-
voltage: toNumberOrNull(
|
|
693
|
-
txSignal: toNumberOrNull(
|
|
694
|
-
signalStatus:
|
|
695
|
-
fsp:
|
|
696
|
-
onuId:
|
|
697
|
-
controlFlag:
|
|
698
|
-
runState:
|
|
699
|
-
configState:
|
|
707
|
+
lastDropCause: get(map, "Causa da \xFAltima queda", "Causada\xFAltimaqueda"),
|
|
708
|
+
rxSignal: toNumberOrNull(get(map, "Sinal Rx", "SinalRx")),
|
|
709
|
+
temperature: toNumberOrNull(get(map, "Temperatura")),
|
|
710
|
+
voltage: toNumberOrNull(get(map, "Voltagem")),
|
|
711
|
+
txSignal: toNumberOrNull(get(map, "Sinal Tx", "SinalTx")),
|
|
712
|
+
signalStatus: get(map, "Status pot\xEAncia", "Statuspot\xEAncia", "Statuspot\xEAncia"),
|
|
713
|
+
fsp: get(map, "F/s/p"),
|
|
714
|
+
onuId: get(map, "Onu id", "Onuid"),
|
|
715
|
+
controlFlag: get(map, "Control flag", "Controlflag"),
|
|
716
|
+
runState: get(map, "Run state", "Runstate"),
|
|
717
|
+
configState: get(map, "Config state", "Configstate"),
|
|
700
718
|
ontDistanceMeters: toNumberOrNull(
|
|
701
|
-
|
|
719
|
+
get(map, "Ont distance(m)", "Ontdistance(m)")
|
|
702
720
|
),
|
|
703
|
-
memoryOccupation:
|
|
704
|
-
cpuOccupation:
|
|
705
|
-
mac:
|
|
706
|
-
description:
|
|
707
|
-
lastUpTime:
|
|
708
|
-
lastDownTime:
|
|
709
|
-
lastDyingGaspTime:
|
|
710
|
-
onlineDuration:
|
|
711
|
-
macRouter:
|
|
712
|
-
vendorSn:
|
|
713
|
-
txOlt: toNumberOrNull(
|
|
714
|
-
rxOlt: toNumberOrNull(
|
|
721
|
+
memoryOccupation: get(map, "Memory occupation", "Memoryoccupation"),
|
|
722
|
+
cpuOccupation: get(map, "Cpu occupation", "Cpuoccupation"),
|
|
723
|
+
mac: get(map, "Mac"),
|
|
724
|
+
description: get(map, "Description"),
|
|
725
|
+
lastUpTime: get(map, "Last up time", "Lastuptime"),
|
|
726
|
+
lastDownTime: get(map, "Last down time", "Lastdowntime"),
|
|
727
|
+
lastDyingGaspTime: get(map, "Last dying gasp time", "Lastdyinggasptime"),
|
|
728
|
+
onlineDuration: get(map, "Online duration", "Onlineduration"),
|
|
729
|
+
macRouter: get(map, "Mac router", "Macrouter"),
|
|
730
|
+
vendorSn: get(map, "Vendor sn", "Vendorsn"),
|
|
731
|
+
txOlt: toNumberOrNull(get(map, "Tx olt", "Txolt")),
|
|
732
|
+
rxOlt: toNumberOrNull(get(map, "Rx olt", "Rxolt"))
|
|
715
733
|
};
|
|
716
734
|
}
|
|
717
735
|
|
|
@@ -722,7 +740,7 @@ var OnuSignalSummaryResource = class {
|
|
|
722
740
|
this.endpoint = "/radpop_radio_cliente_fibra_29661";
|
|
723
741
|
}
|
|
724
742
|
/**
|
|
725
|
-
* Retorna o resumo de potência (sinal) de uma ONU pelo ID
|
|
743
|
+
* Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
|
|
726
744
|
* O endpoint retorna HTML, que é tratado e convertido para JSON.
|
|
727
745
|
*/
|
|
728
746
|
async get(data) {
|
package/dist/index.mjs
CHANGED
|
@@ -617,48 +617,66 @@ var LoginDisconnectionsResource = class {
|
|
|
617
617
|
};
|
|
618
618
|
|
|
619
619
|
// src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.types.ts
|
|
620
|
-
function extractValue(text, prefix) {
|
|
621
|
-
const regex = new RegExp(`${escapeRegex(prefix)}([^<\\n]*)`);
|
|
622
|
-
const match = text.match(regex);
|
|
623
|
-
return match ? match[1].trim() : null;
|
|
624
|
-
}
|
|
625
|
-
function escapeRegex(str) {
|
|
626
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
627
|
-
}
|
|
628
620
|
function toNumberOrNull(value) {
|
|
629
621
|
if (value === null) return null;
|
|
630
622
|
const parsed = parseFloat(value);
|
|
631
623
|
return isNaN(parsed) ? null : parsed;
|
|
632
624
|
}
|
|
625
|
+
function normalizeLabel(label) {
|
|
626
|
+
return label.replace(/\s+/g, "").toLowerCase();
|
|
627
|
+
}
|
|
628
|
+
function buildLabelMap(html) {
|
|
629
|
+
const map = /* @__PURE__ */ new Map();
|
|
630
|
+
const decoded = html.replace(/ê/gi, "\xEA").replace(/ú/gi, "\xFA").replace(/Ç/gi, "\xC7").replace(/Õ/gi, "\xD5").replace(/ã/gi, "\xE3").replace(/ç/gi, "\xE7").replace(/õ/gi, "\xF5").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/á/gi, "\xE1").replace(/é/gi, "\xE9").replace(/í/gi, "\xED").replace(/ó/gi, "\xF3").replace(/ñ/gi, "\xF1");
|
|
631
|
+
const divRegex = /<div[^>]*>([\s\S]*?)<\/div>/gi;
|
|
632
|
+
let match;
|
|
633
|
+
while ((match = divRegex.exec(decoded)) !== null) {
|
|
634
|
+
const text = match[1].replace(/<[^>]+>/g, "").trim();
|
|
635
|
+
const separatorIndex = text.indexOf(": ");
|
|
636
|
+
if (separatorIndex === -1) continue;
|
|
637
|
+
const rawLabel = text.substring(0, separatorIndex);
|
|
638
|
+
const value = text.substring(separatorIndex + 2).trim();
|
|
639
|
+
if (!rawLabel || !value) continue;
|
|
640
|
+
map.set(normalizeLabel(rawLabel), value);
|
|
641
|
+
}
|
|
642
|
+
return map;
|
|
643
|
+
}
|
|
644
|
+
function get(map, ...keys) {
|
|
645
|
+
for (const key of keys) {
|
|
646
|
+
const value = map.get(normalizeLabel(key));
|
|
647
|
+
if (value !== void 0) return value;
|
|
648
|
+
}
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
633
651
|
function parseOnuSignalSummaryHtml(html) {
|
|
634
|
-
const
|
|
652
|
+
const map = buildLabelMap(html);
|
|
635
653
|
return {
|
|
636
|
-
lastDropCause:
|
|
637
|
-
rxSignal: toNumberOrNull(
|
|
638
|
-
temperature: toNumberOrNull(
|
|
639
|
-
voltage: toNumberOrNull(
|
|
640
|
-
txSignal: toNumberOrNull(
|
|
641
|
-
signalStatus:
|
|
642
|
-
fsp:
|
|
643
|
-
onuId:
|
|
644
|
-
controlFlag:
|
|
645
|
-
runState:
|
|
646
|
-
configState:
|
|
654
|
+
lastDropCause: get(map, "Causa da \xFAltima queda", "Causada\xFAltimaqueda"),
|
|
655
|
+
rxSignal: toNumberOrNull(get(map, "Sinal Rx", "SinalRx")),
|
|
656
|
+
temperature: toNumberOrNull(get(map, "Temperatura")),
|
|
657
|
+
voltage: toNumberOrNull(get(map, "Voltagem")),
|
|
658
|
+
txSignal: toNumberOrNull(get(map, "Sinal Tx", "SinalTx")),
|
|
659
|
+
signalStatus: get(map, "Status pot\xEAncia", "Statuspot\xEAncia", "Statuspot\xEAncia"),
|
|
660
|
+
fsp: get(map, "F/s/p"),
|
|
661
|
+
onuId: get(map, "Onu id", "Onuid"),
|
|
662
|
+
controlFlag: get(map, "Control flag", "Controlflag"),
|
|
663
|
+
runState: get(map, "Run state", "Runstate"),
|
|
664
|
+
configState: get(map, "Config state", "Configstate"),
|
|
647
665
|
ontDistanceMeters: toNumberOrNull(
|
|
648
|
-
|
|
666
|
+
get(map, "Ont distance(m)", "Ontdistance(m)")
|
|
649
667
|
),
|
|
650
|
-
memoryOccupation:
|
|
651
|
-
cpuOccupation:
|
|
652
|
-
mac:
|
|
653
|
-
description:
|
|
654
|
-
lastUpTime:
|
|
655
|
-
lastDownTime:
|
|
656
|
-
lastDyingGaspTime:
|
|
657
|
-
onlineDuration:
|
|
658
|
-
macRouter:
|
|
659
|
-
vendorSn:
|
|
660
|
-
txOlt: toNumberOrNull(
|
|
661
|
-
rxOlt: toNumberOrNull(
|
|
668
|
+
memoryOccupation: get(map, "Memory occupation", "Memoryoccupation"),
|
|
669
|
+
cpuOccupation: get(map, "Cpu occupation", "Cpuoccupation"),
|
|
670
|
+
mac: get(map, "Mac"),
|
|
671
|
+
description: get(map, "Description"),
|
|
672
|
+
lastUpTime: get(map, "Last up time", "Lastuptime"),
|
|
673
|
+
lastDownTime: get(map, "Last down time", "Lastdowntime"),
|
|
674
|
+
lastDyingGaspTime: get(map, "Last dying gasp time", "Lastdyinggasptime"),
|
|
675
|
+
onlineDuration: get(map, "Online duration", "Onlineduration"),
|
|
676
|
+
macRouter: get(map, "Mac router", "Macrouter"),
|
|
677
|
+
vendorSn: get(map, "Vendor sn", "Vendorsn"),
|
|
678
|
+
txOlt: toNumberOrNull(get(map, "Tx olt", "Txolt")),
|
|
679
|
+
rxOlt: toNumberOrNull(get(map, "Rx olt", "Rxolt"))
|
|
662
680
|
};
|
|
663
681
|
}
|
|
664
682
|
|
|
@@ -669,7 +687,7 @@ var OnuSignalSummaryResource = class {
|
|
|
669
687
|
this.endpoint = "/radpop_radio_cliente_fibra_29661";
|
|
670
688
|
}
|
|
671
689
|
/**
|
|
672
|
-
* Retorna o resumo de potência (sinal) de uma ONU pelo ID
|
|
690
|
+
* Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
|
|
673
691
|
* O endpoint retorna HTML, que é tratado e convertido para JSON.
|
|
674
692
|
*/
|
|
675
693
|
async get(data) {
|