@edirect/mongo 1.0.7 → 2.0.3

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
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
@@ -12,8 +12,8 @@ const mongo_providers_1 = require("./mongo.providers");
12
12
  let MongoModule = class MongoModule {
13
13
  };
14
14
  MongoModule = __decorate([
15
- common_1.Global(),
16
- common_1.Module({
15
+ (0, common_1.Global)(),
16
+ (0, common_1.Module)({
17
17
  providers: [...mongo_providers_1.MongoProviders],
18
18
  exports: [...mongo_providers_1.MongoProviders],
19
19
  })
@@ -1 +1 @@
1
- {"version":3,"file":"mongo.module.js","sourceRoot":"","sources":["../src/mongo.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAEhD,uDAAmD;AAOnD,IAAa,WAAW,GAAxB,MAAa,WAAW;CAAG,CAAA;AAAd,WAAW;IALvB,eAAM,EAAE;IACR,eAAM,CAAC;QACN,SAAS,EAAE,CAAC,GAAG,gCAAc,CAAC;QAC9B,OAAO,EAAE,CAAC,GAAG,gCAAc,CAAC;KAC7B,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW"}
1
+ {"version":3,"file":"mongo.module.js","sourceRoot":"","sources":["../src/mongo.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAEhD,uDAAmD;AAOnD,IAAa,WAAW,GAAxB,MAAa,WAAW;CAAG,CAAA;AAAd,WAAW;IALvB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,GAAG,gCAAc,CAAC;QAC9B,OAAO,EAAE,CAAC,GAAG,gCAAc,CAAC;KAC7B,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW"}
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MongoProviders = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const config_1 = require("@edirect/config");
6
+ const isNotProductionOrLive = (nodeEnv) => nodeEnv !== 'production' && nodeEnv !== 'live';
6
7
  exports.MongoProviders = [
7
8
  {
8
9
  provide: 'MONGO_CONNECTION',
9
- useFactory: (configService) => mongoose_1.connect(configService.get('MONGO_URL'), {
10
- useCreateIndex: true,
11
- useNewUrlParser: true,
12
- useFindAndModify: false,
13
- useUnifiedTopology: true,
14
- }),
10
+ useFactory: (configService) => (0, mongoose_1.connect)(configService.get('MONGO_URL'), Object.assign({}, (isNotProductionOrLive(process.env.NODE_ENV) && {
11
+ minPoolSize: 0,
12
+ maxPoolSize: 10,
13
+ }))),
15
14
  inject: [config_1.ConfigService],
16
15
  },
17
16
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"mongo.providers.js","sourceRoot":"","sources":["../src/mongo.providers.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAG7C,4CAAgD;AAEnC,QAAA,cAAc,GAAe;IACxC;QACE,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE,CAAC,aAA4B,EAAqB,EAAE,CAC9D,kBAAO,CACL,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,EAC9B;YACE,cAAc,EAAE,IAAI;YACpB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,KAAK;YACvB,kBAAkB,EAAE,IAAI;SACzB,CACF;QACH,MAAM,EAAE,CAAC,sBAAa,CAAC;KACxB;CACF,CAAC"}
1
+ {"version":3,"file":"mongo.providers.js","sourceRoot":"","sources":["../src/mongo.providers.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAE7C,4CAAgD;AAEhD,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAW,EAAE,CACzD,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,MAAM,CAAC;AAEpC,QAAA,cAAc,GAAe;IACxC;QACE,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE,CAAC,aAA4B,EAAqB,EAAE,CAC9D,IAAA,kBAAO,EAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,oBACjC,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI;YACjD,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,EAAE;SAChB,CAAC,EACF;QACJ,MAAM,EAAE,CAAC,sBAAa,CAAC;KACxB;CACF,CAAC"}