@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 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 do cliente.
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 do cliente.
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(/&ecirc;/gi, "\xEA").replace(/&uacute;/gi, "\xFA").replace(/&Ccedil;/gi, "\xC7").replace(/&Otilde;/gi, "\xD5").replace(/&atilde;/gi, "\xE3").replace(/&ccedil;/gi, "\xE7").replace(/&otilde;/gi, "\xF5").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&aacute;/gi, "\xE1").replace(/&eacute;/gi, "\xE9").replace(/&iacute;/gi, "\xED").replace(/&oacute;/gi, "\xF3").replace(/&ntilde;/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 decoded = html.replace(/&ecirc;/gi, "\xEA").replace(/&uacute;/gi, "\xFA").replace(/&Ccedil;/gi, "\xC7").replace(/&Otilde;/gi, "\xD5").replace(/&atilde;/gi, "\xE3").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"');
705
+ const map = buildLabelMap(html);
688
706
  return {
689
- lastDropCause: extractValue(decoded, "Causa da \xFAltima queda: "),
690
- rxSignal: toNumberOrNull(extractValue(decoded, "Sinal Rx: ")),
691
- temperature: toNumberOrNull(extractValue(decoded, "Temperatura: ")),
692
- voltage: toNumberOrNull(extractValue(decoded, "Voltagem: ")),
693
- txSignal: toNumberOrNull(extractValue(decoded, "Sinal Tx: ")),
694
- signalStatus: extractValue(decoded, "Status pot\xEAncia: "),
695
- fsp: extractValue(decoded, "F/s/p: "),
696
- onuId: extractValue(decoded, "Onu id: "),
697
- controlFlag: extractValue(decoded, "Control flag: "),
698
- runState: extractValue(decoded, "Run state: "),
699
- configState: extractValue(decoded, "Config state: "),
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
- extractValue(decoded, "Ont distance(m): ")
719
+ get(map, "Ont distance(m)", "Ontdistance(m)")
702
720
  ),
703
- memoryOccupation: extractValue(decoded, "Memory occupation: "),
704
- cpuOccupation: extractValue(decoded, "Cpu occupation: "),
705
- mac: extractValue(decoded, "Mac: "),
706
- description: extractValue(decoded, "Description: "),
707
- lastUpTime: extractValue(decoded, "Last up time: "),
708
- lastDownTime: extractValue(decoded, "Last down time: "),
709
- lastDyingGaspTime: extractValue(decoded, "Last dying gasp time: "),
710
- onlineDuration: extractValue(decoded, "Online duration: "),
711
- macRouter: extractValue(decoded, "Mac router: "),
712
- vendorSn: extractValue(decoded, "Vendor sn: "),
713
- txOlt: toNumberOrNull(extractValue(decoded, "Tx olt: ")),
714
- rxOlt: toNumberOrNull(extractValue(decoded, "Rx olt: "))
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 do cliente.
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(/&ecirc;/gi, "\xEA").replace(/&uacute;/gi, "\xFA").replace(/&Ccedil;/gi, "\xC7").replace(/&Otilde;/gi, "\xD5").replace(/&atilde;/gi, "\xE3").replace(/&ccedil;/gi, "\xE7").replace(/&otilde;/gi, "\xF5").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&aacute;/gi, "\xE1").replace(/&eacute;/gi, "\xE9").replace(/&iacute;/gi, "\xED").replace(/&oacute;/gi, "\xF3").replace(/&ntilde;/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 decoded = html.replace(/&ecirc;/gi, "\xEA").replace(/&uacute;/gi, "\xFA").replace(/&Ccedil;/gi, "\xC7").replace(/&Otilde;/gi, "\xD5").replace(/&atilde;/gi, "\xE3").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"');
652
+ const map = buildLabelMap(html);
635
653
  return {
636
- lastDropCause: extractValue(decoded, "Causa da \xFAltima queda: "),
637
- rxSignal: toNumberOrNull(extractValue(decoded, "Sinal Rx: ")),
638
- temperature: toNumberOrNull(extractValue(decoded, "Temperatura: ")),
639
- voltage: toNumberOrNull(extractValue(decoded, "Voltagem: ")),
640
- txSignal: toNumberOrNull(extractValue(decoded, "Sinal Tx: ")),
641
- signalStatus: extractValue(decoded, "Status pot\xEAncia: "),
642
- fsp: extractValue(decoded, "F/s/p: "),
643
- onuId: extractValue(decoded, "Onu id: "),
644
- controlFlag: extractValue(decoded, "Control flag: "),
645
- runState: extractValue(decoded, "Run state: "),
646
- configState: extractValue(decoded, "Config state: "),
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
- extractValue(decoded, "Ont distance(m): ")
666
+ get(map, "Ont distance(m)", "Ontdistance(m)")
649
667
  ),
650
- memoryOccupation: extractValue(decoded, "Memory occupation: "),
651
- cpuOccupation: extractValue(decoded, "Cpu occupation: "),
652
- mac: extractValue(decoded, "Mac: "),
653
- description: extractValue(decoded, "Description: "),
654
- lastUpTime: extractValue(decoded, "Last up time: "),
655
- lastDownTime: extractValue(decoded, "Last down time: "),
656
- lastDyingGaspTime: extractValue(decoded, "Last dying gasp time: "),
657
- onlineDuration: extractValue(decoded, "Online duration: "),
658
- macRouter: extractValue(decoded, "Mac router: "),
659
- vendorSn: extractValue(decoded, "Vendor sn: "),
660
- txOlt: toNumberOrNull(extractValue(decoded, "Tx olt: ")),
661
- rxOlt: toNumberOrNull(extractValue(decoded, "Rx olt: "))
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 do cliente.
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.148",
3
+ "version": "1.0.149",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",