@ccci/micro-server 1.0.34 → 1.0.36

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -87557,20 +87557,23 @@ class DatabaseConnector {
87557
87557
  DatabaseConnector.rootDir = path;
87558
87558
  }
87559
87559
  static async init() {
87560
- DatabaseConnector.connections = [];
87561
- let connections = [];
87562
- const configPath = `${DatabaseConnector.rootDir}/config/db.config.ts`;
87563
- import(configPath).then((configs) => {
87564
- Logger.info("configs :>> ", configs);
87565
- Logger.info("configs.default() :>> ", configs.default());
87566
- Logger.info("configs.default() :>> ", configs.default()["development"]);
87567
- const config = configs.default()[env];
87568
- Logger.info("config :>> ", config);
87569
- const connection = new Sequelize(config);
87570
- DatabaseConnector.connection = connection;
87571
- connections.push(connection);
87560
+ return new Promise((resolve, reject) => {
87561
+ let connections = [];
87562
+ try {
87563
+ DatabaseConnector.connections = [];
87564
+ const configPath = `${DatabaseConnector.rootDir}/config/db.config.ts`;
87565
+ import(configPath).then((configs) => {
87566
+ const config = configs.default[env];
87567
+ const connection = new Sequelize(config);
87568
+ DatabaseConnector.connection = connection;
87569
+ connections.push(connection);
87570
+ });
87571
+ resolve(connections);
87572
+ } catch (error) {
87573
+ Logger.error(error);
87574
+ reject(connections);
87575
+ }
87572
87576
  });
87573
- return connections;
87574
87577
  }
87575
87578
  async initializeModels() {
87576
87579
  let files = fs.readdirSync(`${DatabaseConnector.rootDir}/models`).filter((file) => file.indexOf(".") !== 0 && file.slice(-3) === ".ts");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",