@cristian-israel/giganet_lib_conecta 1.0.113 → 1.0.114

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
@@ -39355,10 +39355,11 @@ type MonitoringPonsPatchOptions = {
39355
39355
  updatedAt?: string;
39356
39356
  updatedAtStatic?: string;
39357
39357
  removedIds?: number[];
39358
+ expiresInSeconds?: number;
39358
39359
  };
39359
39360
  type MonitoringPonsStore = {
39360
39361
  getSnapshot(): Promise<MonitoringPonsSnapshot | null>;
39361
- setSnapshot(snapshot: MonitoringPonsSnapshot): Promise<void>;
39362
+ setSnapshot(snapshot: MonitoringPonsSnapshot, expiresInSeconds?: number): Promise<void>;
39362
39363
  patchRows(rows: MonitoringPonsRow[], options?: MonitoringPonsPatchOptions): Promise<MonitoringPonsRow[]>;
39363
39364
  publishUpdate(meta: MonitoringPonsUpdateMeta): Promise<void>;
39364
39365
  publishDelta(meta: MonitoringPonsUpdateMeta): Promise<void>;
@@ -39516,10 +39517,11 @@ type MonitoringTransmissoresPatchOptions = {
39516
39517
  updatedAt?: string;
39517
39518
  updatedAtStatic?: string;
39518
39519
  removedIds?: number[];
39520
+ expiresInSeconds?: number;
39519
39521
  };
39520
39522
  type MonitoringTransmissoresStore = {
39521
39523
  getSnapshot(): Promise<MonitoringTransmissoresSnapshot | null>;
39522
- setSnapshot(snapshot: MonitoringTransmissoresSnapshot): Promise<void>;
39524
+ setSnapshot(snapshot: MonitoringTransmissoresSnapshot, expiresInSeconds?: number): Promise<void>;
39523
39525
  patchRows(rows: MonitoringTransmissoresRow[], options?: MonitoringTransmissoresPatchOptions): Promise<MonitoringTransmissoresRow[]>;
39524
39526
  publishUpdate(meta: MonitoringTransmissoresUpdateMeta): Promise<void>;
39525
39527
  publishDelta(meta: MonitoringTransmissoresUpdateMeta): Promise<void>;
@@ -39528,13 +39530,13 @@ type MonitoringTransmissoresStore = {
39528
39530
 
39529
39531
  declare function createMonitoringTransmissoresStore(client: Redis__default, basePrefix: string): MonitoringTransmissoresStore;
39530
39532
 
39531
- declare const storeFactories: {
39533
+ declare const storeFactories$1: {
39532
39534
  readonly monitoring_pons: typeof createMonitoringPonsStore;
39533
39535
  readonly monitoring_transmissores: typeof createMonitoringTransmissoresStore;
39534
39536
  };
39535
39537
 
39536
39538
  type RoutinesRedisStores = {
39537
- [K in keyof typeof storeFactories]: ReturnType<(typeof storeFactories)[K]>;
39539
+ [K in keyof typeof storeFactories$1]: ReturnType<(typeof storeFactories$1)[K]>;
39538
39540
  };
39539
39541
 
39540
39542
  type RedisConnectionConfig = {
@@ -39561,4 +39563,44 @@ declare class RoutinesRedisService {
39561
39563
  getStore<K extends keyof RoutinesRedisStores>(key: K): RoutinesRedisStores[K];
39562
39564
  }
39563
39565
 
39564
- export { CRMAPIClient, crmApi_types as CRMAPITypes, 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, NetpulseAPIClient, netpulseApi_types as NetpulseAPITypes, 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, transmissoresZones_metrics as TransmissoresZonesMetrics, loger, printSignature };
39566
+ declare const ClientCrmRowSchema: z.ZodObject<{
39567
+ id_cliente: z.ZodNumber;
39568
+ result: z.ZodString;
39569
+ }, z.core.$strict>;
39570
+ type ClientCrmRow = z.infer<typeof ClientCrmRowSchema>;
39571
+
39572
+ type ClientCrmStore = {
39573
+ get(id_cliente: number): Promise<ClientCrmRow | null>;
39574
+ set(row: ClientCrmRow, expiresInSeconds?: number): Promise<void>;
39575
+ delete(id_cliente: number): Promise<void>;
39576
+ };
39577
+
39578
+ declare function createClientCrmStore(client: Redis__default, basePrefix: string): ClientCrmStore;
39579
+
39580
+ declare const storeFactories: {
39581
+ readonly client_crm: typeof createClientCrmStore;
39582
+ };
39583
+
39584
+ type AnalysisIaRedisStores = {
39585
+ [K in keyof typeof storeFactories]: ReturnType<(typeof storeFactories)[K]>;
39586
+ };
39587
+
39588
+ declare class AnalysisIaRedisService {
39589
+ private static instance;
39590
+ private connection;
39591
+ private initialized;
39592
+ private constructor();
39593
+ private notInitialized;
39594
+ /** Retorna a instância singleton */
39595
+ static getInstance(): AnalysisIaRedisService;
39596
+ /** Inicializa a conexão e stores */
39597
+ init(config: RedisConnectionConfig): Promise<void>;
39598
+ /** Retorna o client ioredis */
39599
+ getClient(): Redis.default;
39600
+ /** Retorna stores tipados */
39601
+ get stores(): AnalysisIaRedisStores;
39602
+ /** Retorna um store específico tipado */
39603
+ getStore<K extends keyof AnalysisIaRedisStores>(key: K): AnalysisIaRedisStores[K];
39604
+ }
39605
+
39606
+ export { AnalysisIaRedisService, type AnalysisIaRedisStores, CRMAPIClient, crmApi_types as CRMAPITypes, 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, NetpulseAPIClient, netpulseApi_types as NetpulseAPITypes, 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, transmissoresZones_metrics as TransmissoresZonesMetrics, loger, printSignature };
package/dist/index.d.ts CHANGED
@@ -39355,10 +39355,11 @@ type MonitoringPonsPatchOptions = {
39355
39355
  updatedAt?: string;
39356
39356
  updatedAtStatic?: string;
39357
39357
  removedIds?: number[];
39358
+ expiresInSeconds?: number;
39358
39359
  };
39359
39360
  type MonitoringPonsStore = {
39360
39361
  getSnapshot(): Promise<MonitoringPonsSnapshot | null>;
39361
- setSnapshot(snapshot: MonitoringPonsSnapshot): Promise<void>;
39362
+ setSnapshot(snapshot: MonitoringPonsSnapshot, expiresInSeconds?: number): Promise<void>;
39362
39363
  patchRows(rows: MonitoringPonsRow[], options?: MonitoringPonsPatchOptions): Promise<MonitoringPonsRow[]>;
39363
39364
  publishUpdate(meta: MonitoringPonsUpdateMeta): Promise<void>;
39364
39365
  publishDelta(meta: MonitoringPonsUpdateMeta): Promise<void>;
@@ -39516,10 +39517,11 @@ type MonitoringTransmissoresPatchOptions = {
39516
39517
  updatedAt?: string;
39517
39518
  updatedAtStatic?: string;
39518
39519
  removedIds?: number[];
39520
+ expiresInSeconds?: number;
39519
39521
  };
39520
39522
  type MonitoringTransmissoresStore = {
39521
39523
  getSnapshot(): Promise<MonitoringTransmissoresSnapshot | null>;
39522
- setSnapshot(snapshot: MonitoringTransmissoresSnapshot): Promise<void>;
39524
+ setSnapshot(snapshot: MonitoringTransmissoresSnapshot, expiresInSeconds?: number): Promise<void>;
39523
39525
  patchRows(rows: MonitoringTransmissoresRow[], options?: MonitoringTransmissoresPatchOptions): Promise<MonitoringTransmissoresRow[]>;
39524
39526
  publishUpdate(meta: MonitoringTransmissoresUpdateMeta): Promise<void>;
39525
39527
  publishDelta(meta: MonitoringTransmissoresUpdateMeta): Promise<void>;
@@ -39528,13 +39530,13 @@ type MonitoringTransmissoresStore = {
39528
39530
 
39529
39531
  declare function createMonitoringTransmissoresStore(client: Redis__default, basePrefix: string): MonitoringTransmissoresStore;
39530
39532
 
39531
- declare const storeFactories: {
39533
+ declare const storeFactories$1: {
39532
39534
  readonly monitoring_pons: typeof createMonitoringPonsStore;
39533
39535
  readonly monitoring_transmissores: typeof createMonitoringTransmissoresStore;
39534
39536
  };
39535
39537
 
39536
39538
  type RoutinesRedisStores = {
39537
- [K in keyof typeof storeFactories]: ReturnType<(typeof storeFactories)[K]>;
39539
+ [K in keyof typeof storeFactories$1]: ReturnType<(typeof storeFactories$1)[K]>;
39538
39540
  };
39539
39541
 
39540
39542
  type RedisConnectionConfig = {
@@ -39561,4 +39563,44 @@ declare class RoutinesRedisService {
39561
39563
  getStore<K extends keyof RoutinesRedisStores>(key: K): RoutinesRedisStores[K];
39562
39564
  }
39563
39565
 
39564
- export { CRMAPIClient, crmApi_types as CRMAPITypes, 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, NetpulseAPIClient, netpulseApi_types as NetpulseAPITypes, 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, transmissoresZones_metrics as TransmissoresZonesMetrics, loger, printSignature };
39566
+ declare const ClientCrmRowSchema: z.ZodObject<{
39567
+ id_cliente: z.ZodNumber;
39568
+ result: z.ZodString;
39569
+ }, z.core.$strict>;
39570
+ type ClientCrmRow = z.infer<typeof ClientCrmRowSchema>;
39571
+
39572
+ type ClientCrmStore = {
39573
+ get(id_cliente: number): Promise<ClientCrmRow | null>;
39574
+ set(row: ClientCrmRow, expiresInSeconds?: number): Promise<void>;
39575
+ delete(id_cliente: number): Promise<void>;
39576
+ };
39577
+
39578
+ declare function createClientCrmStore(client: Redis__default, basePrefix: string): ClientCrmStore;
39579
+
39580
+ declare const storeFactories: {
39581
+ readonly client_crm: typeof createClientCrmStore;
39582
+ };
39583
+
39584
+ type AnalysisIaRedisStores = {
39585
+ [K in keyof typeof storeFactories]: ReturnType<(typeof storeFactories)[K]>;
39586
+ };
39587
+
39588
+ declare class AnalysisIaRedisService {
39589
+ private static instance;
39590
+ private connection;
39591
+ private initialized;
39592
+ private constructor();
39593
+ private notInitialized;
39594
+ /** Retorna a instância singleton */
39595
+ static getInstance(): AnalysisIaRedisService;
39596
+ /** Inicializa a conexão e stores */
39597
+ init(config: RedisConnectionConfig): Promise<void>;
39598
+ /** Retorna o client ioredis */
39599
+ getClient(): Redis.default;
39600
+ /** Retorna stores tipados */
39601
+ get stores(): AnalysisIaRedisStores;
39602
+ /** Retorna um store específico tipado */
39603
+ getStore<K extends keyof AnalysisIaRedisStores>(key: K): AnalysisIaRedisStores[K];
39604
+ }
39605
+
39606
+ export { AnalysisIaRedisService, type AnalysisIaRedisStores, CRMAPIClient, crmApi_types as CRMAPITypes, 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, NetpulseAPIClient, netpulseApi_types as NetpulseAPITypes, 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, transmissoresZones_metrics as TransmissoresZonesMetrics, loger, printSignature };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AnalysisIaRedisService: () => AnalysisIaRedisService,
33
34
  CRMAPIClient: () => CRMAPIClient,
34
35
  CRMAPITypes: () => crm_api_types_exports,
35
36
  ExpensesFleetMongoService: () => ExpensesFleetMongoService,
@@ -93755,9 +93756,14 @@ function createMonitoringPonsStore(client, basePrefix) {
93755
93756
  if (value === null) return null;
93756
93757
  return MonitoringPonsSnapshotSchema.parse(JSON.parse(value));
93757
93758
  },
93758
- async setSnapshot(snapshot) {
93759
+ async setSnapshot(snapshot, expiresInSeconds) {
93759
93760
  const validated = MonitoringPonsSnapshotSchema.parse(snapshot);
93760
- await client.set(snapshotKey, JSON.stringify(validated));
93761
+ const value = JSON.stringify(validated);
93762
+ if (expiresInSeconds) {
93763
+ await client.set(snapshotKey, value, "EX", expiresInSeconds);
93764
+ } else {
93765
+ await client.set(snapshotKey, value);
93766
+ }
93761
93767
  },
93762
93768
  async patchRows(rows, options) {
93763
93769
  const validatedRows = rows.map(
@@ -93772,7 +93778,12 @@ function createMonitoringPonsStore(client, basePrefix) {
93772
93778
  updatedAt,
93773
93779
  updatedAtStatic: options?.updatedAtStatic
93774
93780
  });
93775
- await client.set(snapshotKey, JSON.stringify(snapshot2));
93781
+ const value2 = JSON.stringify(snapshot2);
93782
+ if (options?.expiresInSeconds) {
93783
+ await client.set(snapshotKey, value2, "EX", options.expiresInSeconds);
93784
+ } else {
93785
+ await client.set(snapshotKey, value2);
93786
+ }
93776
93787
  return validatedRows;
93777
93788
  }
93778
93789
  const rowMap = new Map(current.rows.map((row) => [row.id, row]));
@@ -93795,7 +93806,12 @@ function createMonitoringPonsStore(client, basePrefix) {
93795
93806
  updatedAt,
93796
93807
  updatedAtStatic: options?.updatedAtStatic ?? current.updatedAtStatic
93797
93808
  });
93798
- await client.set(snapshotKey, JSON.stringify(snapshot));
93809
+ const value = JSON.stringify(snapshot);
93810
+ if (options?.expiresInSeconds) {
93811
+ await client.set(snapshotKey, value, "EX", options.expiresInSeconds);
93812
+ } else {
93813
+ await client.set(snapshotKey, value);
93814
+ }
93799
93815
  return changed;
93800
93816
  },
93801
93817
  async publishUpdate(meta) {
@@ -93951,9 +93967,14 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93951
93967
  updatedAtStatic: legacy.updatedAtStatic
93952
93968
  });
93953
93969
  },
93954
- async setSnapshot(snapshot) {
93970
+ async setSnapshot(snapshot, expiresInSeconds) {
93955
93971
  const validated = MonitoringTransmissoresSnapshotSchema.parse(snapshot);
93956
- await client.set(snapshotKey, JSON.stringify(validated));
93972
+ const value = JSON.stringify(validated);
93973
+ if (expiresInSeconds) {
93974
+ await client.set(snapshotKey, value, "EX", expiresInSeconds);
93975
+ } else {
93976
+ await client.set(snapshotKey, value);
93977
+ }
93957
93978
  },
93958
93979
  async patchRows(rows, options) {
93959
93980
  const validatedRows = rows.map(
@@ -93968,7 +93989,12 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93968
93989
  updatedAt,
93969
93990
  updatedAtStatic: options?.updatedAtStatic
93970
93991
  });
93971
- await client.set(snapshotKey, JSON.stringify(snapshot2));
93992
+ const value2 = JSON.stringify(snapshot2);
93993
+ if (options?.expiresInSeconds) {
93994
+ await client.set(snapshotKey, value2, "EX", options.expiresInSeconds);
93995
+ } else {
93996
+ await client.set(snapshotKey, value2);
93997
+ }
93972
93998
  return validatedRows;
93973
93999
  }
93974
94000
  const rowMap = new Map(current.rows.map((row) => [row.id, row]));
@@ -93992,7 +94018,12 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93992
94018
  updatedAt,
93993
94019
  updatedAtStatic: options?.updatedAtStatic ?? current.updatedAtStatic
93994
94020
  });
93995
- await client.set(snapshotKey, JSON.stringify(snapshot));
94021
+ const value = JSON.stringify(snapshot);
94022
+ if (options?.expiresInSeconds) {
94023
+ await client.set(snapshotKey, value, "EX", options.expiresInSeconds);
94024
+ } else {
94025
+ await client.set(snapshotKey, value);
94026
+ }
93996
94027
  return changed;
93997
94028
  },
93998
94029
  async publishUpdate(meta) {
@@ -94103,8 +94134,123 @@ var RoutinesRedisService = class _RoutinesRedisService {
94103
94134
  return this.connection.stores[key];
94104
94135
  }
94105
94136
  };
94137
+
94138
+ // src/databases/redis/analysis_ia/analysis-ia.redis.types.ts
94139
+ var configAnalysisIaRedis = {
94140
+ context: "ANALYSIS_IA_REDIS",
94141
+ domain: "REDIS"
94142
+ };
94143
+
94144
+ // src/databases/redis/analysis_ia/stores/client-crm/client-crm.schemas.ts
94145
+ var import_zod7 = require("zod");
94146
+ var ClientCrmRowSchema = import_zod7.z.object({
94147
+ id_cliente: import_zod7.z.number(),
94148
+ result: import_zod7.z.string()
94149
+ }).strict();
94150
+
94151
+ // src/databases/redis/analysis_ia/stores/client-crm/client-crm.ts
94152
+ function createClientCrmStore(client, basePrefix) {
94153
+ const prefix = `${basePrefix}client-crm:`;
94154
+ const getKey = (id_cliente) => `${prefix}${id_cliente}`;
94155
+ return {
94156
+ async get(id_cliente) {
94157
+ const value = await client.get(getKey(id_cliente));
94158
+ if (value === null) return null;
94159
+ return ClientCrmRowSchema.parse(JSON.parse(value));
94160
+ },
94161
+ async set(row, expiresInSeconds) {
94162
+ const validated = ClientCrmRowSchema.parse(row);
94163
+ const key = getKey(row.id_cliente);
94164
+ const value = JSON.stringify(validated);
94165
+ if (expiresInSeconds) {
94166
+ await client.set(key, value, "EX", expiresInSeconds);
94167
+ } else {
94168
+ await client.set(key, value);
94169
+ }
94170
+ },
94171
+ async delete(id_cliente) {
94172
+ await client.del(getKey(id_cliente));
94173
+ }
94174
+ };
94175
+ }
94176
+
94177
+ // src/databases/redis/analysis_ia/stores/index.ts
94178
+ var storeFactories2 = {
94179
+ client_crm: createClientCrmStore
94180
+ };
94181
+
94182
+ // src/databases/redis/analysis_ia/analysis-ia.redis.connection.ts
94183
+ async function createAnalysisIaRedisConnection(config) {
94184
+ const client = await createRedisConnection({
94185
+ ...config,
94186
+ database: 0,
94187
+ keyPrefix: "analysis-ia:",
94188
+ context: configAnalysisIaRedis.context
94189
+ });
94190
+ const stores = Object.entries(storeFactories2).reduce(
94191
+ (acc, [name, factory]) => {
94192
+ acc[name] = factory(client, "");
94193
+ return acc;
94194
+ },
94195
+ {}
94196
+ );
94197
+ return Object.freeze({
94198
+ client,
94199
+ stores: Object.freeze(stores)
94200
+ });
94201
+ }
94202
+ var connectAnalysisIaRedis = createConnectionFactory(createAnalysisIaRedisConnection);
94203
+
94204
+ // src/databases/redis/analysis_ia/analysis-ia.redis.service.ts
94205
+ var AnalysisIaRedisService = class _AnalysisIaRedisService {
94206
+ constructor() {
94207
+ this.initialized = false;
94208
+ }
94209
+ notInitialized() {
94210
+ if (!this.initialized)
94211
+ throw new Error(
94212
+ "AnalysisIaRedisService n\xE3o inicializado! Chame init() antes."
94213
+ );
94214
+ }
94215
+ /** Retorna a instância singleton */
94216
+ static getInstance() {
94217
+ if (!_AnalysisIaRedisService.instance)
94218
+ _AnalysisIaRedisService.instance = new _AnalysisIaRedisService();
94219
+ return _AnalysisIaRedisService.instance;
94220
+ }
94221
+ /** Inicializa a conexão e stores */
94222
+ async init(config) {
94223
+ if (this.initialized) return;
94224
+ loger({
94225
+ ...configAnalysisIaRedis,
94226
+ message: "Inicializando AnalysisIaRedisService..."
94227
+ });
94228
+ this.connection = await connectAnalysisIaRedis(config);
94229
+ this.initialized = true;
94230
+ loger({
94231
+ ...configAnalysisIaRedis,
94232
+ message: "AnalysisIaRedisService inicializado!"
94233
+ });
94234
+ }
94235
+ /** Retorna o client ioredis */
94236
+ getClient() {
94237
+ this.notInitialized();
94238
+ return this.connection.client;
94239
+ }
94240
+ /** Retorna stores tipados */
94241
+ get stores() {
94242
+ this.notInitialized();
94243
+ return this.connection.stores;
94244
+ }
94245
+ /** Retorna um store específico tipado */
94246
+ getStore(key) {
94247
+ this.notInitialized();
94248
+ return this.connection.stores[key];
94249
+ }
94250
+ };
94106
94251
  // Annotate the CommonJS export names for ESM import in node:
94107
94252
  0 && (module.exports = {
94253
+ AnalysisIaRedisService,
94108
94254
  CRMAPIClient,
94109
94255
  CRMAPITypes,
94110
94256
  ExpensesFleetMongoService,
package/dist/index.mjs CHANGED
@@ -93702,9 +93702,14 @@ function createMonitoringPonsStore(client, basePrefix) {
93702
93702
  if (value === null) return null;
93703
93703
  return MonitoringPonsSnapshotSchema.parse(JSON.parse(value));
93704
93704
  },
93705
- async setSnapshot(snapshot) {
93705
+ async setSnapshot(snapshot, expiresInSeconds) {
93706
93706
  const validated = MonitoringPonsSnapshotSchema.parse(snapshot);
93707
- await client.set(snapshotKey, JSON.stringify(validated));
93707
+ const value = JSON.stringify(validated);
93708
+ if (expiresInSeconds) {
93709
+ await client.set(snapshotKey, value, "EX", expiresInSeconds);
93710
+ } else {
93711
+ await client.set(snapshotKey, value);
93712
+ }
93708
93713
  },
93709
93714
  async patchRows(rows, options) {
93710
93715
  const validatedRows = rows.map(
@@ -93719,7 +93724,12 @@ function createMonitoringPonsStore(client, basePrefix) {
93719
93724
  updatedAt,
93720
93725
  updatedAtStatic: options?.updatedAtStatic
93721
93726
  });
93722
- await client.set(snapshotKey, JSON.stringify(snapshot2));
93727
+ const value2 = JSON.stringify(snapshot2);
93728
+ if (options?.expiresInSeconds) {
93729
+ await client.set(snapshotKey, value2, "EX", options.expiresInSeconds);
93730
+ } else {
93731
+ await client.set(snapshotKey, value2);
93732
+ }
93723
93733
  return validatedRows;
93724
93734
  }
93725
93735
  const rowMap = new Map(current.rows.map((row) => [row.id, row]));
@@ -93742,7 +93752,12 @@ function createMonitoringPonsStore(client, basePrefix) {
93742
93752
  updatedAt,
93743
93753
  updatedAtStatic: options?.updatedAtStatic ?? current.updatedAtStatic
93744
93754
  });
93745
- await client.set(snapshotKey, JSON.stringify(snapshot));
93755
+ const value = JSON.stringify(snapshot);
93756
+ if (options?.expiresInSeconds) {
93757
+ await client.set(snapshotKey, value, "EX", options.expiresInSeconds);
93758
+ } else {
93759
+ await client.set(snapshotKey, value);
93760
+ }
93746
93761
  return changed;
93747
93762
  },
93748
93763
  async publishUpdate(meta) {
@@ -93898,9 +93913,14 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93898
93913
  updatedAtStatic: legacy.updatedAtStatic
93899
93914
  });
93900
93915
  },
93901
- async setSnapshot(snapshot) {
93916
+ async setSnapshot(snapshot, expiresInSeconds) {
93902
93917
  const validated = MonitoringTransmissoresSnapshotSchema.parse(snapshot);
93903
- await client.set(snapshotKey, JSON.stringify(validated));
93918
+ const value = JSON.stringify(validated);
93919
+ if (expiresInSeconds) {
93920
+ await client.set(snapshotKey, value, "EX", expiresInSeconds);
93921
+ } else {
93922
+ await client.set(snapshotKey, value);
93923
+ }
93904
93924
  },
93905
93925
  async patchRows(rows, options) {
93906
93926
  const validatedRows = rows.map(
@@ -93915,7 +93935,12 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93915
93935
  updatedAt,
93916
93936
  updatedAtStatic: options?.updatedAtStatic
93917
93937
  });
93918
- await client.set(snapshotKey, JSON.stringify(snapshot2));
93938
+ const value2 = JSON.stringify(snapshot2);
93939
+ if (options?.expiresInSeconds) {
93940
+ await client.set(snapshotKey, value2, "EX", options.expiresInSeconds);
93941
+ } else {
93942
+ await client.set(snapshotKey, value2);
93943
+ }
93919
93944
  return validatedRows;
93920
93945
  }
93921
93946
  const rowMap = new Map(current.rows.map((row) => [row.id, row]));
@@ -93939,7 +93964,12 @@ function createMonitoringTransmissoresStore(client, basePrefix) {
93939
93964
  updatedAt,
93940
93965
  updatedAtStatic: options?.updatedAtStatic ?? current.updatedAtStatic
93941
93966
  });
93942
- await client.set(snapshotKey, JSON.stringify(snapshot));
93967
+ const value = JSON.stringify(snapshot);
93968
+ if (options?.expiresInSeconds) {
93969
+ await client.set(snapshotKey, value, "EX", options.expiresInSeconds);
93970
+ } else {
93971
+ await client.set(snapshotKey, value);
93972
+ }
93943
93973
  return changed;
93944
93974
  },
93945
93975
  async publishUpdate(meta) {
@@ -94050,7 +94080,122 @@ var RoutinesRedisService = class _RoutinesRedisService {
94050
94080
  return this.connection.stores[key];
94051
94081
  }
94052
94082
  };
94083
+
94084
+ // src/databases/redis/analysis_ia/analysis-ia.redis.types.ts
94085
+ var configAnalysisIaRedis = {
94086
+ context: "ANALYSIS_IA_REDIS",
94087
+ domain: "REDIS"
94088
+ };
94089
+
94090
+ // src/databases/redis/analysis_ia/stores/client-crm/client-crm.schemas.ts
94091
+ import { z as z7 } from "zod";
94092
+ var ClientCrmRowSchema = z7.object({
94093
+ id_cliente: z7.number(),
94094
+ result: z7.string()
94095
+ }).strict();
94096
+
94097
+ // src/databases/redis/analysis_ia/stores/client-crm/client-crm.ts
94098
+ function createClientCrmStore(client, basePrefix) {
94099
+ const prefix = `${basePrefix}client-crm:`;
94100
+ const getKey = (id_cliente) => `${prefix}${id_cliente}`;
94101
+ return {
94102
+ async get(id_cliente) {
94103
+ const value = await client.get(getKey(id_cliente));
94104
+ if (value === null) return null;
94105
+ return ClientCrmRowSchema.parse(JSON.parse(value));
94106
+ },
94107
+ async set(row, expiresInSeconds) {
94108
+ const validated = ClientCrmRowSchema.parse(row);
94109
+ const key = getKey(row.id_cliente);
94110
+ const value = JSON.stringify(validated);
94111
+ if (expiresInSeconds) {
94112
+ await client.set(key, value, "EX", expiresInSeconds);
94113
+ } else {
94114
+ await client.set(key, value);
94115
+ }
94116
+ },
94117
+ async delete(id_cliente) {
94118
+ await client.del(getKey(id_cliente));
94119
+ }
94120
+ };
94121
+ }
94122
+
94123
+ // src/databases/redis/analysis_ia/stores/index.ts
94124
+ var storeFactories2 = {
94125
+ client_crm: createClientCrmStore
94126
+ };
94127
+
94128
+ // src/databases/redis/analysis_ia/analysis-ia.redis.connection.ts
94129
+ async function createAnalysisIaRedisConnection(config) {
94130
+ const client = await createRedisConnection({
94131
+ ...config,
94132
+ database: 0,
94133
+ keyPrefix: "analysis-ia:",
94134
+ context: configAnalysisIaRedis.context
94135
+ });
94136
+ const stores = Object.entries(storeFactories2).reduce(
94137
+ (acc, [name, factory]) => {
94138
+ acc[name] = factory(client, "");
94139
+ return acc;
94140
+ },
94141
+ {}
94142
+ );
94143
+ return Object.freeze({
94144
+ client,
94145
+ stores: Object.freeze(stores)
94146
+ });
94147
+ }
94148
+ var connectAnalysisIaRedis = createConnectionFactory(createAnalysisIaRedisConnection);
94149
+
94150
+ // src/databases/redis/analysis_ia/analysis-ia.redis.service.ts
94151
+ var AnalysisIaRedisService = class _AnalysisIaRedisService {
94152
+ constructor() {
94153
+ this.initialized = false;
94154
+ }
94155
+ notInitialized() {
94156
+ if (!this.initialized)
94157
+ throw new Error(
94158
+ "AnalysisIaRedisService n\xE3o inicializado! Chame init() antes."
94159
+ );
94160
+ }
94161
+ /** Retorna a instância singleton */
94162
+ static getInstance() {
94163
+ if (!_AnalysisIaRedisService.instance)
94164
+ _AnalysisIaRedisService.instance = new _AnalysisIaRedisService();
94165
+ return _AnalysisIaRedisService.instance;
94166
+ }
94167
+ /** Inicializa a conexão e stores */
94168
+ async init(config) {
94169
+ if (this.initialized) return;
94170
+ loger({
94171
+ ...configAnalysisIaRedis,
94172
+ message: "Inicializando AnalysisIaRedisService..."
94173
+ });
94174
+ this.connection = await connectAnalysisIaRedis(config);
94175
+ this.initialized = true;
94176
+ loger({
94177
+ ...configAnalysisIaRedis,
94178
+ message: "AnalysisIaRedisService inicializado!"
94179
+ });
94180
+ }
94181
+ /** Retorna o client ioredis */
94182
+ getClient() {
94183
+ this.notInitialized();
94184
+ return this.connection.client;
94185
+ }
94186
+ /** Retorna stores tipados */
94187
+ get stores() {
94188
+ this.notInitialized();
94189
+ return this.connection.stores;
94190
+ }
94191
+ /** Retorna um store específico tipado */
94192
+ getStore(key) {
94193
+ this.notInitialized();
94194
+ return this.connection.stores[key];
94195
+ }
94196
+ };
94053
94197
  export {
94198
+ AnalysisIaRedisService,
94054
94199
  CRMAPIClient,
94055
94200
  crm_api_types_exports as CRMAPITypes,
94056
94201
  ExpensesFleetMongoService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",