@cristian-israel/giganet_lib_conecta 1.0.3 → 1.0.5

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
@@ -33439,6 +33439,14 @@ declare class AcsActionDevice extends Model<AcsActionDeviceAttributes, AcsAction
33439
33439
  static initModel(sequelize: Sequelize.Sequelize): typeof AcsActionDevice;
33440
33440
  }
33441
33441
 
33442
+ type MysqlConnectionConfig = {
33443
+ host: string;
33444
+ port: number;
33445
+ user: string;
33446
+ password: string;
33447
+ database: string;
33448
+ };
33449
+
33442
33450
  declare class IXCSoftService {
33443
33451
  private static instance;
33444
33452
  private connection;
@@ -33448,7 +33456,7 @@ declare class IXCSoftService {
33448
33456
  /** Retorna a instância singleton */
33449
33457
  static getInstance(): IXCSoftService;
33450
33458
  /** Inicializa a conexão e models */
33451
- init(): Promise<void>;
33459
+ init(config: MysqlConnectionConfig): Promise<void>;
33452
33460
  /** Retorna o sequelize */
33453
33461
  getSequelize(): Sequelize$1;
33454
33462
  /** Retorna os models tipados */
@@ -34229,6 +34237,14 @@ declare class IXCSoftService {
34229
34237
  };
34230
34238
  }
34231
34239
 
34240
+ type MongoConnectionConfig = {
34241
+ host: string;
34242
+ port: number;
34243
+ user: string;
34244
+ password: string;
34245
+ authSource: string;
34246
+ };
34247
+
34232
34248
  declare class OPASuiteService {
34233
34249
  private static instance;
34234
34250
  private connection;
@@ -34238,7 +34254,7 @@ declare class OPASuiteService {
34238
34254
  /** Retorna a instância singleton */
34239
34255
  static getInstance(): OPASuiteService;
34240
34256
  /** Inicializa a conexão e collections */
34241
- init(): Promise<void>;
34257
+ init(config: MongoConnectionConfig): Promise<void>;
34242
34258
  /** Retorna Mongoose connection */
34243
34259
  getConnection(): mongoose.Connection;
34244
34260
  /** Retorna collections tipadas */
package/dist/index.d.ts CHANGED
@@ -33439,6 +33439,14 @@ declare class AcsActionDevice extends Model<AcsActionDeviceAttributes, AcsAction
33439
33439
  static initModel(sequelize: Sequelize.Sequelize): typeof AcsActionDevice;
33440
33440
  }
33441
33441
 
33442
+ type MysqlConnectionConfig = {
33443
+ host: string;
33444
+ port: number;
33445
+ user: string;
33446
+ password: string;
33447
+ database: string;
33448
+ };
33449
+
33442
33450
  declare class IXCSoftService {
33443
33451
  private static instance;
33444
33452
  private connection;
@@ -33448,7 +33456,7 @@ declare class IXCSoftService {
33448
33456
  /** Retorna a instância singleton */
33449
33457
  static getInstance(): IXCSoftService;
33450
33458
  /** Inicializa a conexão e models */
33451
- init(): Promise<void>;
33459
+ init(config: MysqlConnectionConfig): Promise<void>;
33452
33460
  /** Retorna o sequelize */
33453
33461
  getSequelize(): Sequelize$1;
33454
33462
  /** Retorna os models tipados */
@@ -34229,6 +34237,14 @@ declare class IXCSoftService {
34229
34237
  };
34230
34238
  }
34231
34239
 
34240
+ type MongoConnectionConfig = {
34241
+ host: string;
34242
+ port: number;
34243
+ user: string;
34244
+ password: string;
34245
+ authSource: string;
34246
+ };
34247
+
34232
34248
  declare class OPASuiteService {
34233
34249
  private static instance;
34234
34250
  private connection;
@@ -34238,7 +34254,7 @@ declare class OPASuiteService {
34238
34254
  /** Retorna a instância singleton */
34239
34255
  static getInstance(): OPASuiteService;
34240
34256
  /** Inicializa a conexão e collections */
34241
- init(): Promise<void>;
34257
+ init(config: MongoConnectionConfig): Promise<void>;
34242
34258
  /** Retorna Mongoose connection */
34243
34259
  getConnection(): mongoose.Connection;
34244
34260
  /** Retorna collections tipadas */
package/dist/index.js CHANGED
@@ -40,10 +40,10 @@ module.exports = __toCommonJS(index_exports);
40
40
  function createConnectionFactory(factory) {
41
41
  let connection = null;
42
42
  let connecting = null;
43
- return async () => {
43
+ return async (params) => {
44
44
  if (connection) return connection;
45
45
  if (!connecting) {
46
- connecting = factory().then((conn) => {
46
+ connecting = factory(params).then((conn) => {
47
47
  connection = conn;
48
48
  return conn;
49
49
  });
@@ -90224,13 +90224,10 @@ function initModels(sequelize) {
90224
90224
  }
90225
90225
 
90226
90226
  // src/mysql/ixc-soft/ixc-soft.connection.ts
90227
- async function createIXCConnection() {
90227
+ async function createIXCConnection(config) {
90228
90228
  const sequelize = await createMysqlConnection({
90229
- host: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_HOST,
90230
- port: Number(process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_PORT),
90231
- user: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_USER,
90232
- password: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_PASSWORD,
90233
- database: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_DATABASE,
90229
+ ...config,
90230
+ database: "ixcprovedor",
90234
90231
  context: configIXCSoft.context
90235
90232
  });
90236
90233
  const models = Object.freeze(initModels(sequelize));
@@ -90259,12 +90256,15 @@ var IXCSoftService = class _IXCSoftService {
90259
90256
  return _IXCSoftService.instance;
90260
90257
  }
90261
90258
  /** Inicializa a conexão e models */
90262
- async init() {
90259
+ async init(config) {
90263
90260
  if (this.initialized) return;
90264
- logger({ message: "Inicializando IXCSoftService...", ...configIXCSoft });
90265
- this.connection = await connectIXCSoft();
90261
+ logger({
90262
+ ...configIXCSoft,
90263
+ message: "Inicializando IXCSoftService..."
90264
+ });
90265
+ this.connection = await connectIXCSoft(config);
90266
90266
  this.initialized = true;
90267
- logger({ message: "IXCSoftService inicializado!", ...configIXCSoft });
90267
+ logger({ ...configIXCSoft, message: "IXCSoftService inicializado!" });
90268
90268
  }
90269
90269
  /** Retorna o sequelize */
90270
90270
  getSequelize() {
@@ -90386,14 +90386,10 @@ var schemas = {
90386
90386
  };
90387
90387
 
90388
90388
  // src/mongo/opa-suite/opa-suite.connection.ts
90389
- async function createOPASuiteConnection() {
90389
+ async function createOPASuiteConnection(config) {
90390
90390
  const connection = await createMongoConnection({
90391
- host: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_HOST,
90392
- port: Number(process.env.GIGANET_LIB_CONECTA_MONGO_OPA_PORT),
90393
- user: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_USER,
90394
- password: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_PASSWORD,
90395
- database: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_DATABASE,
90396
- authSource: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_AUTH_SOURCE,
90391
+ ...config,
90392
+ database: "suite",
90397
90393
  context: configOPASuite.context
90398
90394
  });
90399
90395
  const collections = Object.entries(schemas).reduce(
@@ -90405,9 +90401,7 @@ async function createOPASuiteConnection() {
90405
90401
  );
90406
90402
  return { connection, collections };
90407
90403
  }
90408
- var connectOPASuite = createConnectionFactory(
90409
- createOPASuiteConnection
90410
- );
90404
+ var connectOPASuite = createConnectionFactory(createOPASuiteConnection);
90411
90405
 
90412
90406
  // src/mongo/opa-suite/opa-suite.service.ts
90413
90407
  var OPASuiteService = class _OPASuiteService {
@@ -90425,18 +90419,16 @@ var OPASuiteService = class _OPASuiteService {
90425
90419
  return _OPASuiteService.instance;
90426
90420
  }
90427
90421
  /** Inicializa a conexão e collections */
90428
- async init() {
90422
+ async init(config) {
90429
90423
  if (this.initialized) return;
90430
90424
  logger({
90431
- domain: "MONGO",
90432
- context: configOPASuite.context,
90425
+ ...configOPASuite,
90433
90426
  message: "Inicializando OPAService..."
90434
90427
  });
90435
- this.connection = await connectOPASuite();
90428
+ this.connection = await connectOPASuite(config);
90436
90429
  this.initialized = true;
90437
90430
  logger({
90438
- domain: "MONGO",
90439
- context: configOPASuite.context,
90431
+ ...configOPASuite,
90440
90432
  message: "OPAService inicializado!"
90441
90433
  });
90442
90434
  }
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@
2
2
  function createConnectionFactory(factory) {
3
3
  let connection = null;
4
4
  let connecting = null;
5
- return async () => {
5
+ return async (params) => {
6
6
  if (connection) return connection;
7
7
  if (!connecting) {
8
- connecting = factory().then((conn) => {
8
+ connecting = factory(params).then((conn) => {
9
9
  connection = conn;
10
10
  return conn;
11
11
  });
@@ -90186,13 +90186,10 @@ function initModels(sequelize) {
90186
90186
  }
90187
90187
 
90188
90188
  // src/mysql/ixc-soft/ixc-soft.connection.ts
90189
- async function createIXCConnection() {
90189
+ async function createIXCConnection(config) {
90190
90190
  const sequelize = await createMysqlConnection({
90191
- host: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_HOST,
90192
- port: Number(process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_PORT),
90193
- user: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_USER,
90194
- password: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_PASSWORD,
90195
- database: process.env.GIGANET_LIB_CONECTA_MYSQL_IXC_DATABASE,
90191
+ ...config,
90192
+ database: "ixcprovedor",
90196
90193
  context: configIXCSoft.context
90197
90194
  });
90198
90195
  const models = Object.freeze(initModels(sequelize));
@@ -90221,12 +90218,15 @@ var IXCSoftService = class _IXCSoftService {
90221
90218
  return _IXCSoftService.instance;
90222
90219
  }
90223
90220
  /** Inicializa a conexão e models */
90224
- async init() {
90221
+ async init(config) {
90225
90222
  if (this.initialized) return;
90226
- logger({ message: "Inicializando IXCSoftService...", ...configIXCSoft });
90227
- this.connection = await connectIXCSoft();
90223
+ logger({
90224
+ ...configIXCSoft,
90225
+ message: "Inicializando IXCSoftService..."
90226
+ });
90227
+ this.connection = await connectIXCSoft(config);
90228
90228
  this.initialized = true;
90229
- logger({ message: "IXCSoftService inicializado!", ...configIXCSoft });
90229
+ logger({ ...configIXCSoft, message: "IXCSoftService inicializado!" });
90230
90230
  }
90231
90231
  /** Retorna o sequelize */
90232
90232
  getSequelize() {
@@ -90348,14 +90348,10 @@ var schemas = {
90348
90348
  };
90349
90349
 
90350
90350
  // src/mongo/opa-suite/opa-suite.connection.ts
90351
- async function createOPASuiteConnection() {
90351
+ async function createOPASuiteConnection(config) {
90352
90352
  const connection = await createMongoConnection({
90353
- host: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_HOST,
90354
- port: Number(process.env.GIGANET_LIB_CONECTA_MONGO_OPA_PORT),
90355
- user: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_USER,
90356
- password: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_PASSWORD,
90357
- database: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_DATABASE,
90358
- authSource: process.env.GIGANET_LIB_CONECTA_MONGO_OPA_AUTH_SOURCE,
90353
+ ...config,
90354
+ database: "suite",
90359
90355
  context: configOPASuite.context
90360
90356
  });
90361
90357
  const collections = Object.entries(schemas).reduce(
@@ -90367,9 +90363,7 @@ async function createOPASuiteConnection() {
90367
90363
  );
90368
90364
  return { connection, collections };
90369
90365
  }
90370
- var connectOPASuite = createConnectionFactory(
90371
- createOPASuiteConnection
90372
- );
90366
+ var connectOPASuite = createConnectionFactory(createOPASuiteConnection);
90373
90367
 
90374
90368
  // src/mongo/opa-suite/opa-suite.service.ts
90375
90369
  var OPASuiteService = class _OPASuiteService {
@@ -90387,18 +90381,16 @@ var OPASuiteService = class _OPASuiteService {
90387
90381
  return _OPASuiteService.instance;
90388
90382
  }
90389
90383
  /** Inicializa a conexão e collections */
90390
- async init() {
90384
+ async init(config) {
90391
90385
  if (this.initialized) return;
90392
90386
  logger({
90393
- domain: "MONGO",
90394
- context: configOPASuite.context,
90387
+ ...configOPASuite,
90395
90388
  message: "Inicializando OPAService..."
90396
90389
  });
90397
- this.connection = await connectOPASuite();
90390
+ this.connection = await connectOPASuite(config);
90398
90391
  this.initialized = true;
90399
90392
  logger({
90400
- domain: "MONGO",
90401
- context: configOPASuite.context,
90393
+ ...configOPASuite,
90402
90394
  message: "OPAService inicializado!"
90403
90395
  });
90404
90396
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",