@cristian-israel/giganet_lib_conecta 1.0.2 → 1.0.4
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 +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +11 -22
- package/dist/index.mjs +11 -22
- package/package.json +2 -2
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,15 @@ 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
|
+
database: string;
|
|
34246
|
+
authSource: string;
|
|
34247
|
+
};
|
|
34248
|
+
|
|
34232
34249
|
declare class OPASuiteService {
|
|
34233
34250
|
private static instance;
|
|
34234
34251
|
private connection;
|
|
@@ -34238,7 +34255,7 @@ declare class OPASuiteService {
|
|
|
34238
34255
|
/** Retorna a instância singleton */
|
|
34239
34256
|
static getInstance(): OPASuiteService;
|
|
34240
34257
|
/** Inicializa a conexão e collections */
|
|
34241
|
-
init(): Promise<void>;
|
|
34258
|
+
init(config: MongoConnectionConfig): Promise<void>;
|
|
34242
34259
|
/** Retorna Mongoose connection */
|
|
34243
34260
|
getConnection(): mongoose.Connection;
|
|
34244
34261
|
/** 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,15 @@ 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
|
+
database: string;
|
|
34246
|
+
authSource: string;
|
|
34247
|
+
};
|
|
34248
|
+
|
|
34232
34249
|
declare class OPASuiteService {
|
|
34233
34250
|
private static instance;
|
|
34234
34251
|
private connection;
|
|
@@ -34238,7 +34255,7 @@ declare class OPASuiteService {
|
|
|
34238
34255
|
/** Retorna a instância singleton */
|
|
34239
34256
|
static getInstance(): OPASuiteService;
|
|
34240
34257
|
/** Inicializa a conexão e collections */
|
|
34241
|
-
init(): Promise<void>;
|
|
34258
|
+
init(config: MongoConnectionConfig): Promise<void>;
|
|
34242
34259
|
/** Retorna Mongoose connection */
|
|
34243
34260
|
getConnection(): mongoose.Connection;
|
|
34244
34261
|
/** 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,9 @@ 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
|
-
|
|
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,
|
|
90234
90230
|
context: configIXCSoft.context
|
|
90235
90231
|
});
|
|
90236
90232
|
const models = Object.freeze(initModels(sequelize));
|
|
@@ -90259,10 +90255,10 @@ var IXCSoftService = class _IXCSoftService {
|
|
|
90259
90255
|
return _IXCSoftService.instance;
|
|
90260
90256
|
}
|
|
90261
90257
|
/** Inicializa a conexão e models */
|
|
90262
|
-
async init() {
|
|
90258
|
+
async init(config) {
|
|
90263
90259
|
if (this.initialized) return;
|
|
90264
90260
|
logger({ message: "Inicializando IXCSoftService...", ...configIXCSoft });
|
|
90265
|
-
this.connection = await connectIXCSoft();
|
|
90261
|
+
this.connection = await connectIXCSoft(config);
|
|
90266
90262
|
this.initialized = true;
|
|
90267
90263
|
logger({ message: "IXCSoftService inicializado!", ...configIXCSoft });
|
|
90268
90264
|
}
|
|
@@ -90386,14 +90382,9 @@ var schemas = {
|
|
|
90386
90382
|
};
|
|
90387
90383
|
|
|
90388
90384
|
// src/mongo/opa-suite/opa-suite.connection.ts
|
|
90389
|
-
async function createOPASuiteConnection() {
|
|
90385
|
+
async function createOPASuiteConnection(config) {
|
|
90390
90386
|
const connection = await createMongoConnection({
|
|
90391
|
-
|
|
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,
|
|
90387
|
+
...config,
|
|
90397
90388
|
context: configOPASuite.context
|
|
90398
90389
|
});
|
|
90399
90390
|
const collections = Object.entries(schemas).reduce(
|
|
@@ -90405,9 +90396,7 @@ async function createOPASuiteConnection() {
|
|
|
90405
90396
|
);
|
|
90406
90397
|
return { connection, collections };
|
|
90407
90398
|
}
|
|
90408
|
-
var connectOPASuite = createConnectionFactory(
|
|
90409
|
-
createOPASuiteConnection
|
|
90410
|
-
);
|
|
90399
|
+
var connectOPASuite = createConnectionFactory(createOPASuiteConnection);
|
|
90411
90400
|
|
|
90412
90401
|
// src/mongo/opa-suite/opa-suite.service.ts
|
|
90413
90402
|
var OPASuiteService = class _OPASuiteService {
|
|
@@ -90425,14 +90414,14 @@ var OPASuiteService = class _OPASuiteService {
|
|
|
90425
90414
|
return _OPASuiteService.instance;
|
|
90426
90415
|
}
|
|
90427
90416
|
/** Inicializa a conexão e collections */
|
|
90428
|
-
async init() {
|
|
90417
|
+
async init(config) {
|
|
90429
90418
|
if (this.initialized) return;
|
|
90430
90419
|
logger({
|
|
90431
90420
|
domain: "MONGO",
|
|
90432
90421
|
context: configOPASuite.context,
|
|
90433
90422
|
message: "Inicializando OPAService..."
|
|
90434
90423
|
});
|
|
90435
|
-
this.connection = await connectOPASuite();
|
|
90424
|
+
this.connection = await connectOPASuite(config);
|
|
90436
90425
|
this.initialized = true;
|
|
90437
90426
|
logger({
|
|
90438
90427
|
domain: "MONGO",
|
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,9 @@ 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
|
-
|
|
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,
|
|
90196
90192
|
context: configIXCSoft.context
|
|
90197
90193
|
});
|
|
90198
90194
|
const models = Object.freeze(initModels(sequelize));
|
|
@@ -90221,10 +90217,10 @@ var IXCSoftService = class _IXCSoftService {
|
|
|
90221
90217
|
return _IXCSoftService.instance;
|
|
90222
90218
|
}
|
|
90223
90219
|
/** Inicializa a conexão e models */
|
|
90224
|
-
async init() {
|
|
90220
|
+
async init(config) {
|
|
90225
90221
|
if (this.initialized) return;
|
|
90226
90222
|
logger({ message: "Inicializando IXCSoftService...", ...configIXCSoft });
|
|
90227
|
-
this.connection = await connectIXCSoft();
|
|
90223
|
+
this.connection = await connectIXCSoft(config);
|
|
90228
90224
|
this.initialized = true;
|
|
90229
90225
|
logger({ message: "IXCSoftService inicializado!", ...configIXCSoft });
|
|
90230
90226
|
}
|
|
@@ -90348,14 +90344,9 @@ var schemas = {
|
|
|
90348
90344
|
};
|
|
90349
90345
|
|
|
90350
90346
|
// src/mongo/opa-suite/opa-suite.connection.ts
|
|
90351
|
-
async function createOPASuiteConnection() {
|
|
90347
|
+
async function createOPASuiteConnection(config) {
|
|
90352
90348
|
const connection = await createMongoConnection({
|
|
90353
|
-
|
|
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,
|
|
90349
|
+
...config,
|
|
90359
90350
|
context: configOPASuite.context
|
|
90360
90351
|
});
|
|
90361
90352
|
const collections = Object.entries(schemas).reduce(
|
|
@@ -90367,9 +90358,7 @@ async function createOPASuiteConnection() {
|
|
|
90367
90358
|
);
|
|
90368
90359
|
return { connection, collections };
|
|
90369
90360
|
}
|
|
90370
|
-
var connectOPASuite = createConnectionFactory(
|
|
90371
|
-
createOPASuiteConnection
|
|
90372
|
-
);
|
|
90361
|
+
var connectOPASuite = createConnectionFactory(createOPASuiteConnection);
|
|
90373
90362
|
|
|
90374
90363
|
// src/mongo/opa-suite/opa-suite.service.ts
|
|
90375
90364
|
var OPASuiteService = class _OPASuiteService {
|
|
@@ -90387,14 +90376,14 @@ var OPASuiteService = class _OPASuiteService {
|
|
|
90387
90376
|
return _OPASuiteService.instance;
|
|
90388
90377
|
}
|
|
90389
90378
|
/** Inicializa a conexão e collections */
|
|
90390
|
-
async init() {
|
|
90379
|
+
async init(config) {
|
|
90391
90380
|
if (this.initialized) return;
|
|
90392
90381
|
logger({
|
|
90393
90382
|
domain: "MONGO",
|
|
90394
90383
|
context: configOPASuite.context,
|
|
90395
90384
|
message: "Inicializando OPAService..."
|
|
90396
90385
|
});
|
|
90397
|
-
this.connection = await connectOPASuite();
|
|
90386
|
+
this.connection = await connectOPASuite(config);
|
|
90398
90387
|
this.initialized = true;
|
|
90399
90388
|
logger({
|
|
90400
90389
|
domain: "MONGO",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cristian-israel/giganet_lib_conecta",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Database Connector Layer",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean --external mongoose,sequelize,mysql2",
|
|
13
|
-
"
|
|
13
|
+
"release": "npm version patch && npm publish && npm view @cristian-israel/giganet_lib_conecta",
|
|
14
14
|
"dev": "tsup src/index.ts --watch"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|