c2-mongoose 2.1.197 → 2.1.198

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,5 +1,6 @@
1
- import { Connection } from "mongoose";
1
+ import mongoose, { Connection } from "mongoose";
2
2
  export declare const initialize: (connection: Connection) => void;
3
+ export declare const getLoggerRepository: () => mongoose.Model<any>;
3
4
  export declare const isNotEmpty: (obj: any) => boolean;
4
5
  export declare const isEmpty: (obj: any) => boolean;
5
6
  export declare const isIterable: (input: any) => boolean;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compareDesc = exports.compareAsc = exports.isNotIterable = exports.isIterable = exports.isEmpty = exports.isNotEmpty = exports.initialize = void 0;
3
+ exports.compareDesc = exports.compareAsc = exports.isNotIterable = exports.isIterable = exports.isEmpty = exports.isNotEmpty = exports.getLoggerRepository = exports.initialize = void 0;
4
4
  var Logger_1 = require("../model/Logger");
5
5
  var initialize = function (connection) {
6
6
  global.LoggerRepository = connection.model('c2-mongoose-logger', Logger_1.LoggerModel);
7
7
  };
8
8
  exports.initialize = initialize;
9
+ var getLoggerRepository = function () {
10
+ return global.LoggerRepository;
11
+ };
12
+ exports.getLoggerRepository = getLoggerRepository;
9
13
  var isNotEmpty = function (obj) {
10
14
  return !(0, exports.isEmpty)(obj);
11
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.197",
3
+ "version": "2.1.198",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,11 +1,14 @@
1
- import { Connection } from "mongoose"
1
+ import mongoose, { Connection } from "mongoose"
2
2
  import { LoggerModel } from "../model/Logger"
3
3
 
4
4
  export const initialize = (connection: Connection) => {
5
-
6
5
  (global as any).LoggerRepository = connection.model('c2-mongoose-logger', LoggerModel)
7
6
  }
8
7
 
8
+ export const getLoggerRepository = (): mongoose.Model<any> => {
9
+ return (global as any).LoggerRepository
10
+ }
11
+
9
12
  export const isNotEmpty = (obj: any) => {
10
13
  return !isEmpty(obj)
11
14
  }