@mikro-orm/nestjs 5.2.1 → 5.2.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.
@@ -44,6 +44,7 @@ const mikro_orm_common_1 = require("./mikro-orm.common");
44
44
  const mikro_orm_providers_1 = require("./mikro-orm.providers");
45
45
  const mikro_orm_middleware_1 = require("./mikro-orm.middleware");
46
46
  const middleware_helper_1 = require("./middleware.helper");
47
+ const mikro_orm_entities_storage_1 = require("./mikro-orm.entities.storage");
47
48
  async function tryRequire(name) {
48
49
  try {
49
50
  return await Promise.resolve(`${name}`).then(s => __importStar(require(s)));
@@ -52,7 +53,7 @@ async function tryRequire(name) {
52
53
  return undefined; // ignore, optional dependency
53
54
  }
54
55
  }
55
- let MikroOrmCoreModule = exports.MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
56
+ let MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
56
57
  constructor(options, moduleRef) {
57
58
  this.options = options;
58
59
  this.moduleRef = moduleRef;
@@ -134,6 +135,7 @@ let MikroOrmCoreModule = exports.MikroOrmCoreModule = MikroOrmCoreModule_1 = cla
134
135
  const orm = this.moduleRef.get(token);
135
136
  if (orm) {
136
137
  await orm.close();
138
+ mikro_orm_entities_storage_1.MikroOrmEntitiesStorage.clear(orm.config.get('contextName'));
137
139
  }
138
140
  mikro_orm_common_1.CONTEXT_NAMES.length = 0;
139
141
  }
@@ -156,6 +158,7 @@ let MikroOrmCoreModule = exports.MikroOrmCoreModule = MikroOrmCoreModule_1 = cla
156
158
  return contextName;
157
159
  }
158
160
  };
161
+ exports.MikroOrmCoreModule = MikroOrmCoreModule;
159
162
  exports.MikroOrmCoreModule = MikroOrmCoreModule = MikroOrmCoreModule_1 = __decorate([
160
163
  (0, common_1.Global)(),
161
164
  (0, common_1.Module)({}),
@@ -18,7 +18,7 @@ const common_1 = require("@nestjs/common");
18
18
  const mikro_orm_common_1 = require("./mikro-orm.common");
19
19
  const multiple_mikro_orm_middleware_1 = require("./multiple-mikro-orm.middleware");
20
20
  const middleware_helper_1 = require("./middleware.helper");
21
- let MikroOrmMiddlewareModule = exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = class MikroOrmMiddlewareModule {
21
+ let MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = class MikroOrmMiddlewareModule {
22
22
  constructor(options) {
23
23
  this.options = options;
24
24
  }
@@ -46,6 +46,7 @@ let MikroOrmMiddlewareModule = exports.MikroOrmMiddlewareModule = MikroOrmMiddle
46
46
  .forRoutes({ path: (0, middleware_helper_1.forRoutesPath)(this.options, consumer), method: common_1.RequestMethod.ALL });
47
47
  }
48
48
  };
49
+ exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule;
49
50
  exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = __decorate([
50
51
  (0, common_1.Global)(),
51
52
  (0, common_1.Module)({}),
@@ -14,11 +14,7 @@ class MikroOrmEntitiesStorage {
14
14
  return this.storage.get(contextName)?.values() || [];
15
15
  }
16
16
  static clear(contextName = 'default') {
17
- const set = this.storage.get(contextName);
18
- if (!set) {
19
- return;
20
- }
21
- set.clear();
17
+ this.storage.get(contextName)?.clear();
22
18
  }
23
19
  }
24
20
  exports.MikroOrmEntitiesStorage = MikroOrmEntitiesStorage;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MikroOrmMiddleware = void 0;
13
13
  const core_1 = require("@mikro-orm/core");
14
14
  const common_1 = require("@nestjs/common");
15
- let MikroOrmMiddleware = exports.MikroOrmMiddleware = class MikroOrmMiddleware {
15
+ let MikroOrmMiddleware = class MikroOrmMiddleware {
16
16
  constructor(orm) {
17
17
  this.orm = orm;
18
18
  }
@@ -20,6 +20,7 @@ let MikroOrmMiddleware = exports.MikroOrmMiddleware = class MikroOrmMiddleware {
20
20
  core_1.RequestContext.create(this.orm.em, next);
21
21
  }
22
22
  };
23
+ exports.MikroOrmMiddleware = MikroOrmMiddleware;
23
24
  exports.MikroOrmMiddleware = MikroOrmMiddleware = __decorate([
24
25
  (0, common_1.Injectable)(),
25
26
  __metadata("design:paramtypes", [core_1.MikroORM])
@@ -14,7 +14,7 @@ const mikro_orm_providers_1 = require("./mikro-orm.providers");
14
14
  const mikro_orm_core_module_1 = require("./mikro-orm-core.module");
15
15
  const mikro_orm_middleware_module_1 = require("./mikro-orm-middleware.module");
16
16
  const mikro_orm_entities_storage_1 = require("./mikro-orm.entities.storage");
17
- let MikroOrmModule = exports.MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
17
+ let MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
18
18
  /**
19
19
  * Clears the entity storage. This is useful for testing purposes, when you want to isolate the tests.
20
20
  * Keep in mind that this should be called when using a test runner that keeps the context alive between tests (like Vitest with threads disabled).
@@ -56,6 +56,7 @@ let MikroOrmModule = exports.MikroOrmModule = MikroOrmModule_1 = class MikroOrmM
56
56
  };
57
57
  }
58
58
  };
59
+ exports.MikroOrmModule = MikroOrmModule;
59
60
  exports.MikroOrmModule = MikroOrmModule = MikroOrmModule_1 = __decorate([
60
61
  (0, common_1.Module)({})
61
62
  ], MikroOrmModule);
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.MultipleMikroOrmMiddleware = void 0;
16
16
  const core_1 = require("@mikro-orm/core");
17
17
  const common_1 = require("@nestjs/common");
18
- let MultipleMikroOrmMiddleware = exports.MultipleMikroOrmMiddleware = class MultipleMikroOrmMiddleware {
18
+ let MultipleMikroOrmMiddleware = class MultipleMikroOrmMiddleware {
19
19
  constructor(orm) {
20
20
  this.orm = orm;
21
21
  }
@@ -23,6 +23,7 @@ let MultipleMikroOrmMiddleware = exports.MultipleMikroOrmMiddleware = class Mult
23
23
  core_1.RequestContext.create(this.orm.map(orm => orm.em), next);
24
24
  }
25
25
  };
26
+ exports.MultipleMikroOrmMiddleware = MultipleMikroOrmMiddleware;
26
27
  exports.MultipleMikroOrmMiddleware = MultipleMikroOrmMiddleware = __decorate([
27
28
  (0, common_1.Injectable)(),
28
29
  __param(0, (0, common_1.Inject)('MikroORMs')),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/nestjs",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Martin Adamek",
@@ -64,7 +64,7 @@
64
64
  "supertest": "^6.3.3",
65
65
  "ts-jest": "^29.1.0",
66
66
  "ts-node": "^10.9.1",
67
- "typescript": "5.1.6"
67
+ "typescript": "5.2.2"
68
68
  },
69
69
  "commitlint": {
70
70
  "extends": [
@@ -104,5 +104,5 @@
104
104
  "engines": {
105
105
  "node": ">= 14.0.0"
106
106
  },
107
- "packageManager": "yarn@3.6.1"
107
+ "packageManager": "yarn@3.6.3"
108
108
  }