@cristian-israel/giganet_lib_conecta 1.0.147 → 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
@@ -11248,12 +11248,78 @@ declare class LoginDisconnectionsResource {
11248
11248
  listar(data: GetLoginDisconnectionsInput): Promise<GetLoginDisconnectionsResponse>;
11249
11249
  }
11250
11250
 
11251
+ interface GetOnuSignalSummaryInput {
11252
+ id: number;
11253
+ }
11254
+ interface OnuSignalSummary {
11255
+ /** Causa da última queda */
11256
+ lastDropCause: string | null;
11257
+ /** Sinal Rx (dBm) */
11258
+ rxSignal: number | null;
11259
+ /** Temperatura (°C) */
11260
+ temperature: number | null;
11261
+ /** Voltagem (V) */
11262
+ voltage: number | null;
11263
+ /** Sinal Tx (dBm) */
11264
+ txSignal: number | null;
11265
+ /** Status da potência (ex: Regular, Ótimo, Ruim) */
11266
+ signalStatus: string | null;
11267
+ /** F/s/p */
11268
+ fsp: string | null;
11269
+ /** ONU id */
11270
+ onuId: string | null;
11271
+ /** Control flag */
11272
+ controlFlag: string | null;
11273
+ /** Run state */
11274
+ runState: string | null;
11275
+ /** Config state */
11276
+ configState: string | null;
11277
+ /** Distância da ONT em metros */
11278
+ ontDistanceMeters: number | null;
11279
+ /** Ocupação de memória (%) */
11280
+ memoryOccupation: string | null;
11281
+ /** Ocupação de CPU (%) */
11282
+ cpuOccupation: string | null;
11283
+ /** MAC address */
11284
+ mac: string | null;
11285
+ /** Descrição */
11286
+ description: string | null;
11287
+ /** Último horário de online */
11288
+ lastUpTime: string | null;
11289
+ /** Último horário de offline */
11290
+ lastDownTime: string | null;
11291
+ /** Último dying gasp */
11292
+ lastDyingGaspTime: string | null;
11293
+ /** Duração online */
11294
+ onlineDuration: string | null;
11295
+ /** MAC do roteador */
11296
+ macRouter: string | null;
11297
+ /** Vendor SN */
11298
+ vendorSn: string | null;
11299
+ /** Tx OLT (dBm) */
11300
+ txOlt: number | null;
11301
+ /** Rx OLT (dBm) */
11302
+ rxOlt: number | null;
11303
+ }
11304
+
11305
+ declare class OnuSignalSummaryResource {
11306
+ private readonly client;
11307
+ private readonly endpoint;
11308
+ constructor(client: APIClient);
11309
+ /**
11310
+ * Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
11311
+ * O endpoint retorna HTML, que é tratado e convertido para JSON.
11312
+ */
11313
+ get(data: GetOnuSignalSummaryInput): Promise<OnuSignalSummary>;
11314
+ }
11315
+
11251
11316
  declare class IXCSoftAPIClient extends APIClient {
11252
11317
  readonly ordensDeServico: SuOssChamadoResource;
11253
11318
  readonly monthlyFeesForClient: MonthlyFeesForClientResource;
11254
11319
  readonly veiculosDespesas: VeiculosDespesasResource;
11255
11320
  readonly fnApagar: FnApagarResource;
11256
11321
  readonly loginDisconnections: LoginDisconnectionsResource;
11322
+ readonly onuSignalSummary: OnuSignalSummaryResource;
11257
11323
  constructor(config: APIConfigType);
11258
11324
  }
11259
11325
 
package/dist/index.d.ts CHANGED
@@ -11248,12 +11248,78 @@ declare class LoginDisconnectionsResource {
11248
11248
  listar(data: GetLoginDisconnectionsInput): Promise<GetLoginDisconnectionsResponse>;
11249
11249
  }
11250
11250
 
11251
+ interface GetOnuSignalSummaryInput {
11252
+ id: number;
11253
+ }
11254
+ interface OnuSignalSummary {
11255
+ /** Causa da última queda */
11256
+ lastDropCause: string | null;
11257
+ /** Sinal Rx (dBm) */
11258
+ rxSignal: number | null;
11259
+ /** Temperatura (°C) */
11260
+ temperature: number | null;
11261
+ /** Voltagem (V) */
11262
+ voltage: number | null;
11263
+ /** Sinal Tx (dBm) */
11264
+ txSignal: number | null;
11265
+ /** Status da potência (ex: Regular, Ótimo, Ruim) */
11266
+ signalStatus: string | null;
11267
+ /** F/s/p */
11268
+ fsp: string | null;
11269
+ /** ONU id */
11270
+ onuId: string | null;
11271
+ /** Control flag */
11272
+ controlFlag: string | null;
11273
+ /** Run state */
11274
+ runState: string | null;
11275
+ /** Config state */
11276
+ configState: string | null;
11277
+ /** Distância da ONT em metros */
11278
+ ontDistanceMeters: number | null;
11279
+ /** Ocupação de memória (%) */
11280
+ memoryOccupation: string | null;
11281
+ /** Ocupação de CPU (%) */
11282
+ cpuOccupation: string | null;
11283
+ /** MAC address */
11284
+ mac: string | null;
11285
+ /** Descrição */
11286
+ description: string | null;
11287
+ /** Último horário de online */
11288
+ lastUpTime: string | null;
11289
+ /** Último horário de offline */
11290
+ lastDownTime: string | null;
11291
+ /** Último dying gasp */
11292
+ lastDyingGaspTime: string | null;
11293
+ /** Duração online */
11294
+ onlineDuration: string | null;
11295
+ /** MAC do roteador */
11296
+ macRouter: string | null;
11297
+ /** Vendor SN */
11298
+ vendorSn: string | null;
11299
+ /** Tx OLT (dBm) */
11300
+ txOlt: number | null;
11301
+ /** Rx OLT (dBm) */
11302
+ rxOlt: number | null;
11303
+ }
11304
+
11305
+ declare class OnuSignalSummaryResource {
11306
+ private readonly client;
11307
+ private readonly endpoint;
11308
+ constructor(client: APIClient);
11309
+ /**
11310
+ * Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
11311
+ * O endpoint retorna HTML, que é tratado e convertido para JSON.
11312
+ */
11313
+ get(data: GetOnuSignalSummaryInput): Promise<OnuSignalSummary>;
11314
+ }
11315
+
11251
11316
  declare class IXCSoftAPIClient extends APIClient {
11252
11317
  readonly ordensDeServico: SuOssChamadoResource;
11253
11318
  readonly monthlyFeesForClient: MonthlyFeesForClientResource;
11254
11319
  readonly veiculosDespesas: VeiculosDespesasResource;
11255
11320
  readonly fnApagar: FnApagarResource;
11256
11321
  readonly loginDisconnections: LoginDisconnectionsResource;
11322
+ readonly onuSignalSummary: OnuSignalSummaryResource;
11257
11323
  constructor(config: APIConfigType);
11258
11324
  }
11259
11325
 
package/dist/index.js CHANGED
@@ -669,6 +669,94 @@ var LoginDisconnectionsResource = class {
669
669
  }
670
670
  };
671
671
 
672
+ // src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.types.ts
673
+ function toNumberOrNull(value) {
674
+ if (value === null) return null;
675
+ const parsed = parseFloat(value);
676
+ return isNaN(parsed) ? null : parsed;
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
+ }
704
+ function parseOnuSignalSummaryHtml(html) {
705
+ const map = buildLabelMap(html);
706
+ return {
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"),
718
+ ontDistanceMeters: toNumberOrNull(
719
+ get(map, "Ont distance(m)", "Ontdistance(m)")
720
+ ),
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"))
733
+ };
734
+ }
735
+
736
+ // src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.resource.ts
737
+ var OnuSignalSummaryResource = class {
738
+ constructor(client) {
739
+ this.client = client;
740
+ this.endpoint = "/radpop_radio_cliente_fibra_29661";
741
+ }
742
+ /**
743
+ * Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
744
+ * O endpoint retorna HTML, que é tratado e convertido para JSON.
745
+ */
746
+ async get(data) {
747
+ const payload = {
748
+ id: data.id
749
+ };
750
+ const html = await this.client.post(this.endpoint, {
751
+ data: payload,
752
+ headers: {
753
+ "Content-Type": "application/json"
754
+ }
755
+ });
756
+ return parseOnuSignalSummaryHtml(html);
757
+ }
758
+ };
759
+
672
760
  // src/apis/clients/ixc-soft/ixc-soft-api.client.ts
673
761
  var IXCSoftAPIClient = class extends APIClient {
674
762
  constructor(config) {
@@ -687,6 +775,7 @@ var IXCSoftAPIClient = class extends APIClient {
687
775
  this.veiculosDespesas = new VeiculosDespesasResource(this);
688
776
  this.fnApagar = new FnApagarResource(this);
689
777
  this.loginDisconnections = new LoginDisconnectionsResource(this);
778
+ this.onuSignalSummary = new OnuSignalSummaryResource(this);
690
779
  }
691
780
  };
692
781
 
package/dist/index.mjs CHANGED
@@ -616,6 +616,94 @@ var LoginDisconnectionsResource = class {
616
616
  }
617
617
  };
618
618
 
619
+ // src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.types.ts
620
+ function toNumberOrNull(value) {
621
+ if (value === null) return null;
622
+ const parsed = parseFloat(value);
623
+ return isNaN(parsed) ? null : parsed;
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
+ }
651
+ function parseOnuSignalSummaryHtml(html) {
652
+ const map = buildLabelMap(html);
653
+ return {
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"),
665
+ ontDistanceMeters: toNumberOrNull(
666
+ get(map, "Ont distance(m)", "Ontdistance(m)")
667
+ ),
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"))
680
+ };
681
+ }
682
+
683
+ // src/apis/clients/ixc-soft/resources/onu-signal-summary/ixc-soft-onu-signal-summary.resource.ts
684
+ var OnuSignalSummaryResource = class {
685
+ constructor(client) {
686
+ this.client = client;
687
+ this.endpoint = "/radpop_radio_cliente_fibra_29661";
688
+ }
689
+ /**
690
+ * Retorna o resumo de potência (sinal) de uma ONU pelo ID da Fibra.
691
+ * O endpoint retorna HTML, que é tratado e convertido para JSON.
692
+ */
693
+ async get(data) {
694
+ const payload = {
695
+ id: data.id
696
+ };
697
+ const html = await this.client.post(this.endpoint, {
698
+ data: payload,
699
+ headers: {
700
+ "Content-Type": "application/json"
701
+ }
702
+ });
703
+ return parseOnuSignalSummaryHtml(html);
704
+ }
705
+ };
706
+
619
707
  // src/apis/clients/ixc-soft/ixc-soft-api.client.ts
620
708
  var IXCSoftAPIClient = class extends APIClient {
621
709
  constructor(config) {
@@ -634,6 +722,7 @@ var IXCSoftAPIClient = class extends APIClient {
634
722
  this.veiculosDespesas = new VeiculosDespesasResource(this);
635
723
  this.fnApagar = new FnApagarResource(this);
636
724
  this.loginDisconnections = new LoginDisconnectionsResource(this);
725
+ this.onuSignalSummary = new OnuSignalSummaryResource(this);
637
726
  }
638
727
  };
639
728
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.147",
3
+ "version": "1.0.149",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",