@rws-framework/db 3.7.1 → 3.7.2

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.
@@ -1,3 +1,4 @@
1
+ import { PrismaClient } from '@prisma/client';
1
2
  import { Collection, Db, MongoClient } from 'mongodb';
2
3
  import { ITimeSeries } from '../types/ITimeSeries';
3
4
  import { IModel } from '../models/interfaces/IModel';
@@ -37,5 +38,6 @@ declare class DBService {
37
38
  count<T = any>(opModel: OpModelType<T>, where?: {
38
39
  [k: string]: any;
39
40
  }): Promise<number>;
41
+ getPrismaClient(): PrismaClient;
40
42
  }
41
43
  export { DBService, IDBClientCreate };
@@ -209,5 +209,11 @@ class DBService {
209
209
  async count(opModel, where = {}) {
210
210
  return await this.getCollectionHandler(opModel._collection).count({ where });
211
211
  }
212
+ getPrismaClient() {
213
+ if (!this.client || !this.connected) {
214
+ this.connectToDB();
215
+ }
216
+ return this.client;
217
+ }
212
218
  }
213
219
  exports.DBService = DBService;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/db",
3
3
  "private": false,
4
- "version": "3.7.1",
4
+ "version": "3.7.2",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -292,6 +292,15 @@ class DBService {
292
292
  public async count<T = any>(opModel: OpModelType<T>, where: {[k: string]: any} = {}): Promise<number>{
293
293
  return await this.getCollectionHandler(opModel._collection).count({where});
294
294
  }
295
+
296
+ public getPrismaClient(): PrismaClient
297
+ {
298
+ if(!this.client || !this.connected){
299
+ this.connectToDB();
300
+ }
301
+
302
+ return this.client;
303
+ }
295
304
  }
296
305
 
297
306
  export { DBService, IDBClientCreate };