@ccci/micro-server 1.0.57 → 1.0.59

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.js CHANGED
@@ -113632,8 +113632,14 @@ class DatabaseConnector {
113632
113632
  static getModel(modelName) {
113633
113633
  return DatabaseConnector.connection.models[modelName];
113634
113634
  }
113635
- static sync(modelName, force = false) {
113636
- DatabaseConnector.connection.models[modelName].sync({ force });
113635
+ static async sync(modelName, force = false) {
113636
+ console.log("DatabaseConnector.connection.models :>> ", DatabaseConnector.connection.models);
113637
+ console.log("syncing model :>> ", modelName);
113638
+ try {
113639
+ await DatabaseConnector.connection.models[modelName].sync({ force });
113640
+ } catch (error) {
113641
+ console.log("ERROR in syncing :>> ", error);
113642
+ }
113637
113643
  }
113638
113644
  static disconnect() {
113639
113645
  DatabaseConnector.connection.close();
@@ -119119,21 +119125,21 @@ class WebSocketServer {
119119
119125
  },
119120
119126
  websocket: {
119121
119127
  async message(ws, message) {
119122
- let websocket = handlers.find((rec) => rec.path === "echo");
119128
+ let websocket = handlers.find((rec) => rec.path === ws.data.channel);
119123
119129
  if (websocket) {
119124
119130
  await websocket.handler.accept(ws, message);
119125
119131
  return;
119126
119132
  }
119127
119133
  },
119128
119134
  async open(ws) {
119129
- let websocket = handlers.find((rec) => rec.path === "echo");
119135
+ let websocket = handlers.find((rec) => rec.path === ws.data.channel);
119130
119136
  if (websocket) {
119131
119137
  await websocket.handler.connect(ws);
119132
119138
  return;
119133
119139
  }
119134
119140
  },
119135
119141
  async close(ws, code, reason) {
119136
- let websocket = handlers.find((rec) => rec.path === "echo");
119142
+ let websocket = handlers.find((rec) => rec.path === ws.data.channel);
119137
119143
  if (websocket) {
119138
119144
  websocket.handler.disconnect(ws, code, reason);
119139
119145
  return;
@@ -18,7 +18,7 @@ export default class DatabaseConnector {
18
18
  static getConnection(): Sequelize;
19
19
  connect(connection: Sequelize): Promise<void>;
20
20
  static getModel(modelName: string): ModelStatic<Model>;
21
- static sync(modelName: string, force?: boolean): void;
21
+ static sync(modelName: string, force?: boolean): Promise<void>;
22
22
  static disconnect(): void;
23
23
  }
24
24
  //# sourceMappingURL=DatabaseConnector.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",