@cristian-israel/giganet_lib_conecta 1.0.91 → 1.0.92

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
@@ -38314,40 +38314,42 @@ declare class GigacenterMongoService {
38314
38314
  getCollection<K extends keyof GigacenterMongoCollectionsModels>(key: K): GigacenterMongoCollectionsModels[K];
38315
38315
  }
38316
38316
 
38317
- type PonsRow = {
38318
- id: number;
38319
- interface: string;
38320
- transmissor: string;
38321
- slot: number;
38322
- numero: number;
38323
- vlan: string;
38324
- onus_vinculadas: number;
38325
- onus_autorizadas: number;
38326
- sinal_alto: number;
38327
- os_pendentes: number;
38328
- os_recolha: number;
38329
- rompimentos: number;
38330
- offlines_menos_3_meses: number;
38331
- };
38332
- type PonsSnapshot = {
38333
- rows: PonsRow[];
38334
- updatedAt: string;
38335
- updatedAtStatic?: string;
38336
- };
38337
- type PonsUpdateMeta = {
38338
- updatedAt: string;
38339
- };
38317
+ declare const MonitoringPonsSnapshotSchema: z.ZodObject<{
38318
+ rows: z.ZodArray<z.ZodObject<{
38319
+ id: z.ZodNumber;
38320
+ interface: z.ZodString;
38321
+ transmissor: z.ZodString;
38322
+ slot: z.ZodNumber;
38323
+ numero: z.ZodNumber;
38324
+ vlan: z.ZodString;
38325
+ onus_vinculadas: z.ZodNumber;
38326
+ onus_autorizadas: z.ZodNumber;
38327
+ sinal_alto: z.ZodNumber;
38328
+ os_pendentes: z.ZodNumber;
38329
+ os_recolha: z.ZodNumber;
38330
+ rompimentos: z.ZodNumber;
38331
+ offlines_menos_3_meses: z.ZodNumber;
38332
+ }, z.core.$strict>>;
38333
+ updatedAt: z.ZodString;
38334
+ updatedAtStatic: z.ZodOptional<z.ZodString>;
38335
+ }, z.core.$strict>;
38336
+ declare const MonitoringPonsUpdateMetaSchema: z.ZodObject<{
38337
+ updatedAt: z.ZodString;
38338
+ }, z.core.$strict>;
38339
+ type MonitoringPonsSnapshot = z.infer<typeof MonitoringPonsSnapshotSchema>;
38340
+ type MonitoringPonsUpdateMeta = z.infer<typeof MonitoringPonsUpdateMetaSchema>;
38341
+
38340
38342
  type PonsStore = {
38341
- getSnapshot(): Promise<PonsSnapshot | null>;
38342
- setSnapshot(snapshot: PonsSnapshot): Promise<void>;
38343
- publishUpdate(meta: PonsUpdateMeta): Promise<void>;
38344
- subscribe(onUpdate: (meta: PonsUpdateMeta) => void): () => void;
38343
+ getSnapshot(): Promise<MonitoringPonsSnapshot | null>;
38344
+ setSnapshot(snapshot: MonitoringPonsSnapshot): Promise<void>;
38345
+ publishUpdate(meta: MonitoringPonsUpdateMeta): Promise<void>;
38346
+ subscribe(onUpdate: (meta: MonitoringPonsUpdateMeta) => void): () => void;
38345
38347
  };
38346
38348
 
38347
- declare function createPonsStore(client: Redis__default, basePrefix: string): PonsStore;
38349
+ declare function createMonitoringPonsStore(client: Redis__default, basePrefix: string): PonsStore;
38348
38350
 
38349
38351
  declare const storeFactories: {
38350
- readonly pons: typeof createPonsStore;
38352
+ readonly monitoring_pons: typeof createMonitoringPonsStore;
38351
38353
  };
38352
38354
 
38353
38355
  type RoutinesRedisStores = {
@@ -38378,4 +38380,4 @@ declare class RoutinesRedisService {
38378
38380
  getStore<K extends keyof RoutinesRedisStores>(key: K): RoutinesRedisStores[K];
38379
38381
  }
38380
38382
 
38381
- export { type ExpensesFleetMongoCollectionsModels, type ExpensesFleetMongoDocuments, ExpensesFleetMongoService, GeminiLIBClient, geminiLib_types as GeminiLIBTypes, type GigacenterMongoCollectionsModels, type GigacenterMongoDocuments, GigacenterMongoService, IXCSoftAPIClient, ixcSoftApi_types as IXCSoftAPITypes, type IXCSoftMysqlModels, type IXCSoftMysqlModelsAttributes, IXCSoftMysqlService, type MCPGiganetMongoCollectionsModels, type MCPGiganetMongoDocuments, MCPGiganetMongoService, NtfyAPIClient, ntfyApi_types as NtfyAPITypes, type OPASuiteMongoCollectionsModels, type OPASuiteMongoDocuments, OPASuiteMongoService, type PonsRow, type PonsSnapshot, type PonsStore, type PonsUpdateMeta, RoutinesAPIClient, routinesApi_types as RoutinesAPITypes, type RoutinesMongoCollectionsModels, type RoutinesMongoDocuments, RoutinesMongoService, type RoutinesMysqlModels, type RoutinesMysqlModelsAttributes, RoutinesMysqlService, RoutinesRedisService, type RoutinesRedisStores, type ToolsMongoCollectionsModels, type ToolsMongoDocuments, ToolsMongoService, loger, printSignature };
38383
+ export { type ExpensesFleetMongoCollectionsModels, type ExpensesFleetMongoDocuments, ExpensesFleetMongoService, GeminiLIBClient, geminiLib_types as GeminiLIBTypes, type GigacenterMongoCollectionsModels, type GigacenterMongoDocuments, GigacenterMongoService, IXCSoftAPIClient, ixcSoftApi_types as IXCSoftAPITypes, type IXCSoftMysqlModels, type IXCSoftMysqlModelsAttributes, IXCSoftMysqlService, type MCPGiganetMongoCollectionsModels, type MCPGiganetMongoDocuments, MCPGiganetMongoService, NtfyAPIClient, ntfyApi_types as NtfyAPITypes, type OPASuiteMongoCollectionsModels, type OPASuiteMongoDocuments, OPASuiteMongoService, RoutinesAPIClient, routinesApi_types as RoutinesAPITypes, type RoutinesMongoCollectionsModels, type RoutinesMongoDocuments, RoutinesMongoService, type RoutinesMysqlModels, type RoutinesMysqlModelsAttributes, RoutinesMysqlService, RoutinesRedisService, type RoutinesRedisStores, type ToolsMongoCollectionsModels, type ToolsMongoDocuments, ToolsMongoService, loger, printSignature };
package/dist/index.d.ts CHANGED
@@ -38314,40 +38314,42 @@ declare class GigacenterMongoService {
38314
38314
  getCollection<K extends keyof GigacenterMongoCollectionsModels>(key: K): GigacenterMongoCollectionsModels[K];
38315
38315
  }
38316
38316
 
38317
- type PonsRow = {
38318
- id: number;
38319
- interface: string;
38320
- transmissor: string;
38321
- slot: number;
38322
- numero: number;
38323
- vlan: string;
38324
- onus_vinculadas: number;
38325
- onus_autorizadas: number;
38326
- sinal_alto: number;
38327
- os_pendentes: number;
38328
- os_recolha: number;
38329
- rompimentos: number;
38330
- offlines_menos_3_meses: number;
38331
- };
38332
- type PonsSnapshot = {
38333
- rows: PonsRow[];
38334
- updatedAt: string;
38335
- updatedAtStatic?: string;
38336
- };
38337
- type PonsUpdateMeta = {
38338
- updatedAt: string;
38339
- };
38317
+ declare const MonitoringPonsSnapshotSchema: z.ZodObject<{
38318
+ rows: z.ZodArray<z.ZodObject<{
38319
+ id: z.ZodNumber;
38320
+ interface: z.ZodString;
38321
+ transmissor: z.ZodString;
38322
+ slot: z.ZodNumber;
38323
+ numero: z.ZodNumber;
38324
+ vlan: z.ZodString;
38325
+ onus_vinculadas: z.ZodNumber;
38326
+ onus_autorizadas: z.ZodNumber;
38327
+ sinal_alto: z.ZodNumber;
38328
+ os_pendentes: z.ZodNumber;
38329
+ os_recolha: z.ZodNumber;
38330
+ rompimentos: z.ZodNumber;
38331
+ offlines_menos_3_meses: z.ZodNumber;
38332
+ }, z.core.$strict>>;
38333
+ updatedAt: z.ZodString;
38334
+ updatedAtStatic: z.ZodOptional<z.ZodString>;
38335
+ }, z.core.$strict>;
38336
+ declare const MonitoringPonsUpdateMetaSchema: z.ZodObject<{
38337
+ updatedAt: z.ZodString;
38338
+ }, z.core.$strict>;
38339
+ type MonitoringPonsSnapshot = z.infer<typeof MonitoringPonsSnapshotSchema>;
38340
+ type MonitoringPonsUpdateMeta = z.infer<typeof MonitoringPonsUpdateMetaSchema>;
38341
+
38340
38342
  type PonsStore = {
38341
- getSnapshot(): Promise<PonsSnapshot | null>;
38342
- setSnapshot(snapshot: PonsSnapshot): Promise<void>;
38343
- publishUpdate(meta: PonsUpdateMeta): Promise<void>;
38344
- subscribe(onUpdate: (meta: PonsUpdateMeta) => void): () => void;
38343
+ getSnapshot(): Promise<MonitoringPonsSnapshot | null>;
38344
+ setSnapshot(snapshot: MonitoringPonsSnapshot): Promise<void>;
38345
+ publishUpdate(meta: MonitoringPonsUpdateMeta): Promise<void>;
38346
+ subscribe(onUpdate: (meta: MonitoringPonsUpdateMeta) => void): () => void;
38345
38347
  };
38346
38348
 
38347
- declare function createPonsStore(client: Redis__default, basePrefix: string): PonsStore;
38349
+ declare function createMonitoringPonsStore(client: Redis__default, basePrefix: string): PonsStore;
38348
38350
 
38349
38351
  declare const storeFactories: {
38350
- readonly pons: typeof createPonsStore;
38352
+ readonly monitoring_pons: typeof createMonitoringPonsStore;
38351
38353
  };
38352
38354
 
38353
38355
  type RoutinesRedisStores = {
@@ -38378,4 +38380,4 @@ declare class RoutinesRedisService {
38378
38380
  getStore<K extends keyof RoutinesRedisStores>(key: K): RoutinesRedisStores[K];
38379
38381
  }
38380
38382
 
38381
- export { type ExpensesFleetMongoCollectionsModels, type ExpensesFleetMongoDocuments, ExpensesFleetMongoService, GeminiLIBClient, geminiLib_types as GeminiLIBTypes, type GigacenterMongoCollectionsModels, type GigacenterMongoDocuments, GigacenterMongoService, IXCSoftAPIClient, ixcSoftApi_types as IXCSoftAPITypes, type IXCSoftMysqlModels, type IXCSoftMysqlModelsAttributes, IXCSoftMysqlService, type MCPGiganetMongoCollectionsModels, type MCPGiganetMongoDocuments, MCPGiganetMongoService, NtfyAPIClient, ntfyApi_types as NtfyAPITypes, type OPASuiteMongoCollectionsModels, type OPASuiteMongoDocuments, OPASuiteMongoService, type PonsRow, type PonsSnapshot, type PonsStore, type PonsUpdateMeta, RoutinesAPIClient, routinesApi_types as RoutinesAPITypes, type RoutinesMongoCollectionsModels, type RoutinesMongoDocuments, RoutinesMongoService, type RoutinesMysqlModels, type RoutinesMysqlModelsAttributes, RoutinesMysqlService, RoutinesRedisService, type RoutinesRedisStores, type ToolsMongoCollectionsModels, type ToolsMongoDocuments, ToolsMongoService, loger, printSignature };
38383
+ export { type ExpensesFleetMongoCollectionsModels, type ExpensesFleetMongoDocuments, ExpensesFleetMongoService, GeminiLIBClient, geminiLib_types as GeminiLIBTypes, type GigacenterMongoCollectionsModels, type GigacenterMongoDocuments, GigacenterMongoService, IXCSoftAPIClient, ixcSoftApi_types as IXCSoftAPITypes, type IXCSoftMysqlModels, type IXCSoftMysqlModelsAttributes, IXCSoftMysqlService, type MCPGiganetMongoCollectionsModels, type MCPGiganetMongoDocuments, MCPGiganetMongoService, NtfyAPIClient, ntfyApi_types as NtfyAPITypes, type OPASuiteMongoCollectionsModels, type OPASuiteMongoDocuments, OPASuiteMongoService, RoutinesAPIClient, routinesApi_types as RoutinesAPITypes, type RoutinesMongoCollectionsModels, type RoutinesMongoDocuments, RoutinesMongoService, type RoutinesMysqlModels, type RoutinesMysqlModelsAttributes, RoutinesMysqlService, RoutinesRedisService, type RoutinesRedisStores, type ToolsMongoCollectionsModels, type ToolsMongoDocuments, ToolsMongoService, loger, printSignature };
package/dist/index.js CHANGED
@@ -92895,10 +92895,36 @@ var configRoutinesRedis = {
92895
92895
  domain: "REDIS"
92896
92896
  };
92897
92897
 
92898
- // src/databases/redis/routines/stores/pons/pons.ts
92898
+ // src/databases/redis/routines/stores/monitoring-pons/monitoring-pons.schemas.ts
92899
+ var import_zod4 = require("zod");
92900
+ var MonitoringPonsRowSchema = import_zod4.z.object({
92901
+ id: import_zod4.z.number(),
92902
+ interface: import_zod4.z.string(),
92903
+ transmissor: import_zod4.z.string(),
92904
+ slot: import_zod4.z.number(),
92905
+ numero: import_zod4.z.number(),
92906
+ vlan: import_zod4.z.string(),
92907
+ onus_vinculadas: import_zod4.z.number(),
92908
+ onus_autorizadas: import_zod4.z.number(),
92909
+ sinal_alto: import_zod4.z.number(),
92910
+ os_pendentes: import_zod4.z.number(),
92911
+ os_recolha: import_zod4.z.number(),
92912
+ rompimentos: import_zod4.z.number(),
92913
+ offlines_menos_3_meses: import_zod4.z.number()
92914
+ }).strict();
92915
+ var MonitoringPonsSnapshotSchema = import_zod4.z.object({
92916
+ rows: import_zod4.z.array(MonitoringPonsRowSchema),
92917
+ updatedAt: import_zod4.z.string(),
92918
+ updatedAtStatic: import_zod4.z.string().optional()
92919
+ }).strict();
92920
+ var MonitoringPonsUpdateMetaSchema = import_zod4.z.object({
92921
+ updatedAt: import_zod4.z.string()
92922
+ }).strict();
92923
+
92924
+ // src/databases/redis/routines/stores/monitoring-pons/monitoring-pons.ts
92899
92925
  var SNAPSHOT_KEY = "snapshot";
92900
92926
  var UPDATES_CHANNEL = "updates";
92901
- function createPonsStore(client, basePrefix) {
92927
+ function createMonitoringPonsStore(client, basePrefix) {
92902
92928
  const prefix = `${basePrefix}pons:`;
92903
92929
  const snapshotKey = `${prefix}${SNAPSHOT_KEY}`;
92904
92930
  const updatesChannel = `${client.options.keyPrefix ?? ""}${prefix}${UPDATES_CHANNEL}`;
@@ -92906,20 +92932,34 @@ function createPonsStore(client, basePrefix) {
92906
92932
  async getSnapshot() {
92907
92933
  const value = await client.get(snapshotKey);
92908
92934
  if (value === null) return null;
92909
- return JSON.parse(value);
92935
+ return MonitoringPonsSnapshotSchema.parse(JSON.parse(value));
92910
92936
  },
92911
92937
  async setSnapshot(snapshot) {
92912
- await client.set(snapshotKey, JSON.stringify(snapshot));
92938
+ const validated = MonitoringPonsSnapshotSchema.parse(snapshot);
92939
+ await client.set(snapshotKey, JSON.stringify(validated));
92913
92940
  },
92914
92941
  async publishUpdate(meta) {
92915
- await client.publish(updatesChannel, JSON.stringify(meta));
92942
+ const validated = MonitoringPonsUpdateMetaSchema.parse(meta);
92943
+ await client.publish(updatesChannel, JSON.stringify(validated));
92916
92944
  },
92917
92945
  subscribe(onUpdate) {
92918
92946
  const subscriber = client.duplicate();
92919
92947
  subscriber.subscribe(updatesChannel);
92920
92948
  subscriber.on("message", (channel, message) => {
92921
92949
  if (channel !== updatesChannel) return;
92922
- onUpdate(JSON.parse(message));
92950
+ const parsed = MonitoringPonsUpdateMetaSchema.safeParse(
92951
+ JSON.parse(message)
92952
+ );
92953
+ if (!parsed.success) {
92954
+ loger({
92955
+ level: "WARN",
92956
+ context: "PonsStore",
92957
+ domain: "REDIS",
92958
+ message: `Ignoring invalid pons update message: ${parsed.error.message}`
92959
+ });
92960
+ return;
92961
+ }
92962
+ onUpdate(parsed.data);
92923
92963
  });
92924
92964
  return () => {
92925
92965
  subscriber.unsubscribe(updatesChannel);
@@ -92931,7 +92971,7 @@ function createPonsStore(client, basePrefix) {
92931
92971
 
92932
92972
  // src/databases/redis/routines/stores/index.ts
92933
92973
  var storeFactories = {
92934
- pons: createPonsStore
92974
+ monitoring_pons: createMonitoringPonsStore
92935
92975
  };
92936
92976
 
92937
92977
  // src/databases/redis/routines/routines.redis.connection.ts
package/dist/index.mjs CHANGED
@@ -92847,10 +92847,36 @@ var configRoutinesRedis = {
92847
92847
  domain: "REDIS"
92848
92848
  };
92849
92849
 
92850
- // src/databases/redis/routines/stores/pons/pons.ts
92850
+ // src/databases/redis/routines/stores/monitoring-pons/monitoring-pons.schemas.ts
92851
+ import { z as z4 } from "zod";
92852
+ var MonitoringPonsRowSchema = z4.object({
92853
+ id: z4.number(),
92854
+ interface: z4.string(),
92855
+ transmissor: z4.string(),
92856
+ slot: z4.number(),
92857
+ numero: z4.number(),
92858
+ vlan: z4.string(),
92859
+ onus_vinculadas: z4.number(),
92860
+ onus_autorizadas: z4.number(),
92861
+ sinal_alto: z4.number(),
92862
+ os_pendentes: z4.number(),
92863
+ os_recolha: z4.number(),
92864
+ rompimentos: z4.number(),
92865
+ offlines_menos_3_meses: z4.number()
92866
+ }).strict();
92867
+ var MonitoringPonsSnapshotSchema = z4.object({
92868
+ rows: z4.array(MonitoringPonsRowSchema),
92869
+ updatedAt: z4.string(),
92870
+ updatedAtStatic: z4.string().optional()
92871
+ }).strict();
92872
+ var MonitoringPonsUpdateMetaSchema = z4.object({
92873
+ updatedAt: z4.string()
92874
+ }).strict();
92875
+
92876
+ // src/databases/redis/routines/stores/monitoring-pons/monitoring-pons.ts
92851
92877
  var SNAPSHOT_KEY = "snapshot";
92852
92878
  var UPDATES_CHANNEL = "updates";
92853
- function createPonsStore(client, basePrefix) {
92879
+ function createMonitoringPonsStore(client, basePrefix) {
92854
92880
  const prefix = `${basePrefix}pons:`;
92855
92881
  const snapshotKey = `${prefix}${SNAPSHOT_KEY}`;
92856
92882
  const updatesChannel = `${client.options.keyPrefix ?? ""}${prefix}${UPDATES_CHANNEL}`;
@@ -92858,20 +92884,34 @@ function createPonsStore(client, basePrefix) {
92858
92884
  async getSnapshot() {
92859
92885
  const value = await client.get(snapshotKey);
92860
92886
  if (value === null) return null;
92861
- return JSON.parse(value);
92887
+ return MonitoringPonsSnapshotSchema.parse(JSON.parse(value));
92862
92888
  },
92863
92889
  async setSnapshot(snapshot) {
92864
- await client.set(snapshotKey, JSON.stringify(snapshot));
92890
+ const validated = MonitoringPonsSnapshotSchema.parse(snapshot);
92891
+ await client.set(snapshotKey, JSON.stringify(validated));
92865
92892
  },
92866
92893
  async publishUpdate(meta) {
92867
- await client.publish(updatesChannel, JSON.stringify(meta));
92894
+ const validated = MonitoringPonsUpdateMetaSchema.parse(meta);
92895
+ await client.publish(updatesChannel, JSON.stringify(validated));
92868
92896
  },
92869
92897
  subscribe(onUpdate) {
92870
92898
  const subscriber = client.duplicate();
92871
92899
  subscriber.subscribe(updatesChannel);
92872
92900
  subscriber.on("message", (channel, message) => {
92873
92901
  if (channel !== updatesChannel) return;
92874
- onUpdate(JSON.parse(message));
92902
+ const parsed = MonitoringPonsUpdateMetaSchema.safeParse(
92903
+ JSON.parse(message)
92904
+ );
92905
+ if (!parsed.success) {
92906
+ loger({
92907
+ level: "WARN",
92908
+ context: "PonsStore",
92909
+ domain: "REDIS",
92910
+ message: `Ignoring invalid pons update message: ${parsed.error.message}`
92911
+ });
92912
+ return;
92913
+ }
92914
+ onUpdate(parsed.data);
92875
92915
  });
92876
92916
  return () => {
92877
92917
  subscriber.unsubscribe(updatesChannel);
@@ -92883,7 +92923,7 @@ function createPonsStore(client, basePrefix) {
92883
92923
 
92884
92924
  // src/databases/redis/routines/stores/index.ts
92885
92925
  var storeFactories = {
92886
- pons: createPonsStore
92926
+ monitoring_pons: createMonitoringPonsStore
92887
92927
  };
92888
92928
 
92889
92929
  // src/databases/redis/routines/routines.redis.connection.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -12,6 +12,7 @@
12
12
  "build": "tsup src/index.ts --format cjs,esm --dts --clean --external mongoose,sequelize,mysql2,ioredis,zod",
13
13
  "release": "npm version patch && npm publish && npm view @cristian-israel/giganet_lib_conecta",
14
14
  "br": "pnpm run build && pnpm run release",
15
+ "test": "vitest run",
15
16
  "type-check": "tsc --noEmit > type-check.log 2>&1",
16
17
  "dev": "tsup src/index.ts --watch"
17
18
  },
@@ -43,11 +44,13 @@
43
44
  "homepage": "https://github.com/cristian-israel/giganet_lib_conecta#readme",
44
45
  "devDependencies": {
45
46
  "@types/node": "^25.6.0",
47
+ "ioredis-mock": "^8.9.0",
46
48
  "ioredis": "^5.4.0",
47
49
  "mongoose": "^9.4.1",
48
50
  "sequelize-auto": "^0.8.8",
49
51
  "tsup": "^8.5.1",
50
52
  "typescript": "^6.0.2",
53
+ "vitest": "^3.2.4",
51
54
  "zod": "^4.3.6"
52
55
  },
53
56
  "peerDependencies": {