errsole-sequelize
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -41,4 +41,5 @@ /** | ||
const bcrypt = require('bcryptjs'); | ||
const { EventEmitter } = require('events'); | ||
const { Sequelize, DataTypes } = require('sequelize'); | ||
const bcrypt = require('bcryptjs'); | ||
@@ -48,3 +49,3 @@ const packageJSON = require('../package.json'); | ||
class ErrsoleSequelize { | ||
class ErrsoleSequelize extends EventEmitter { | ||
/** | ||
@@ -57,8 +58,13 @@ * Constructs an instance of the database handler using Sequelize. | ||
constructor (options = {}) { | ||
super(); | ||
if (!options.logging) options.logging = false; | ||
this.name = packageJSON.name; | ||
this.version = packageJSON.version || '0.0.0'; | ||
this.dialect = options.dialect; | ||
this.sequelize = new Sequelize(options); | ||
this.isConnectionInProgress = true; | ||
this.defineModels(); | ||
this.syncModels(); | ||
this.name = packageJSON.name; | ||
this.version = packageJSON.version || '0.0.0'; | ||
this.dialect = options.dialect; | ||
} | ||
@@ -148,2 +154,4 @@ | ||
await this.sequelize.sync(); | ||
this.isConnectionInProgress = false; | ||
this.emit('ready'); | ||
} | ||
@@ -161,3 +169,6 @@ | ||
async postLogs (logEntries) { | ||
await this.errsoleLogs.bulkCreate(logEntries); | ||
while (this.isConnectionInProgress) { | ||
await new Promise(resolve => setTimeout(resolve, 100)); | ||
} | ||
await this.errsoleLogs.bulkCreate(logEntries, { logging: false }); | ||
return {}; | ||
@@ -164,0 +175,0 @@ } |
{ | ||
"name": "errsole-sequelize", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Sequelize storage plugin for Errsole", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,3 +9,3 @@ # errsole-sequelize | ||
If your application uses Oracle, PostgreSQL, MySQL, MariaDB, SQLite, or SQL Server as its database, or if you prefer to store your application logs in these databases, you should install the "errsole-sequelize" module along with "errsole". This combination enables you to store your app logs in your chosen database. | ||
If your app uses Oracle, PostgreSQL, MySQL, MariaDB, SQLite, or SQL Server as its database, or if you prefer to store your app logs in one of these databases, you should install the "errsole-sequelize" module along with "errsole". This combination enables you to store your app logs in your chosen database. | ||
@@ -12,0 +12,0 @@ ## Full Documentation |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18333
475
0