@tsed/mikro-orm 7.0.0-beta.11 → 7.0.0-beta.14

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.
Files changed (55) hide show
  1. package/jest.config.js +4 -4
  2. package/lib/cjs/MikroOrmModule.d.ts +7 -3
  3. package/lib/cjs/MikroOrmModule.js +22 -6
  4. package/lib/cjs/MikroOrmModule.js.map +1 -1
  5. package/lib/cjs/decorators/entityManager.d.ts +2 -2
  6. package/lib/cjs/decorators/entityManager.js +1 -1
  7. package/lib/cjs/decorators/entityManager.js.map +1 -1
  8. package/lib/cjs/decorators/orm.d.ts +1 -1
  9. package/lib/cjs/decorators/transactional.d.ts +1 -1
  10. package/lib/cjs/index.d.ts +1 -1
  11. package/lib/cjs/index.js +1 -1
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/interceptors/TransactionalInterceptor.d.ts +8 -4
  14. package/lib/cjs/interceptors/TransactionalInterceptor.js +42 -43
  15. package/lib/cjs/interceptors/TransactionalInterceptor.js.map +1 -1
  16. package/lib/cjs/services/MikroOrmContext.d.ts +9 -0
  17. package/lib/cjs/services/MikroOrmContext.js +26 -0
  18. package/lib/cjs/services/MikroOrmContext.js.map +1 -0
  19. package/lib/cjs/services/MikroOrmFactory.d.ts +3 -1
  20. package/lib/cjs/services/MikroOrmFactory.js +9 -7
  21. package/lib/cjs/services/MikroOrmFactory.js.map +1 -1
  22. package/lib/cjs/services/MikroOrmRegistry.d.ts +2 -0
  23. package/lib/cjs/services/MikroOrmRegistry.js +12 -6
  24. package/lib/cjs/services/MikroOrmRegistry.js.map +1 -1
  25. package/lib/esm/MikroOrmModule.js +23 -7
  26. package/lib/esm/MikroOrmModule.js.map +1 -1
  27. package/lib/esm/decorators/entityManager.js +1 -1
  28. package/lib/esm/decorators/entityManager.js.map +1 -1
  29. package/lib/esm/index.js +1 -1
  30. package/lib/esm/index.js.map +1 -1
  31. package/lib/esm/interceptors/TransactionalInterceptor.js +42 -43
  32. package/lib/esm/interceptors/TransactionalInterceptor.js.map +1 -1
  33. package/lib/esm/services/MikroOrmContext.js +23 -0
  34. package/lib/esm/services/MikroOrmContext.js.map +1 -0
  35. package/lib/esm/services/MikroOrmFactory.js +10 -8
  36. package/lib/esm/services/MikroOrmFactory.js.map +1 -1
  37. package/lib/esm/services/MikroOrmRegistry.js +12 -6
  38. package/lib/esm/services/MikroOrmRegistry.js.map +1 -1
  39. package/lib/types/MikroOrmModule.d.ts +7 -3
  40. package/lib/types/decorators/entityManager.d.ts +2 -2
  41. package/lib/types/decorators/orm.d.ts +1 -1
  42. package/lib/types/decorators/transactional.d.ts +1 -1
  43. package/lib/types/index.d.ts +1 -1
  44. package/lib/types/interceptors/TransactionalInterceptor.d.ts +8 -4
  45. package/lib/types/services/MikroOrmContext.d.ts +9 -0
  46. package/lib/types/services/MikroOrmFactory.d.ts +3 -1
  47. package/lib/types/services/MikroOrmRegistry.d.ts +2 -0
  48. package/package.json +18 -15
  49. package/readme.md +40 -3
  50. package/lib/cjs/services/DBContext.d.ts +0 -9
  51. package/lib/cjs/services/DBContext.js +0 -37
  52. package/lib/cjs/services/DBContext.js.map +0 -1
  53. package/lib/esm/services/DBContext.js +0 -34
  54. package/lib/esm/services/DBContext.js.map +0 -1
  55. package/lib/types/services/DBContext.d.ts +0 -9
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DBContext = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const async_hooks_1 = require("async_hooks");
7
- let DBContext = class DBContext {
8
- constructor() {
9
- this.storage = new async_hooks_1.AsyncLocalStorage();
10
- if (async_hooks_1.AsyncLocalStorage) {
11
- this.storage = new async_hooks_1.AsyncLocalStorage();
12
- }
13
- else {
14
- throw new Error(`AsyncLocalStorage is not available for your Node.js version (${process.versions.node}).`);
15
- }
16
- }
17
- run(ctx, callback) {
18
- return this.storage.run(ctx, callback);
19
- }
20
- entries() {
21
- return this.storage.getStore();
22
- }
23
- get(contextName) {
24
- const context = this.entries();
25
- return context === null || context === void 0 ? void 0 : context.get(contextName);
26
- }
27
- has(contextName) {
28
- const context = this.entries();
29
- return !!(context === null || context === void 0 ? void 0 : context.has(contextName));
30
- }
31
- };
32
- DBContext = tslib_1.__decorate([
33
- (0, di_1.Injectable)(),
34
- tslib_1.__metadata("design:paramtypes", [])
35
- ], DBContext);
36
- exports.DBContext = DBContext;
37
- //# sourceMappingURL=DBContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DBContext.js","sourceRoot":"","sources":["../../../src/services/DBContext.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAEpC,6CAA8C;AAG9C,IAAa,SAAS,GAAtB,MAAa,SAAS;IAGpB;QAFiB,YAAO,GAAG,IAAI,+BAAiB,EAA8B,CAAC;QAG7E,IAAI,+BAAiB,EAAE;YACrB,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAiB,EAAE,CAAC;SACxC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,gEAAgE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC;SAC5G;IACH,CAAC;IAEM,GAAG,CAAI,GAA+B,EAAE,QAA+B;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAE/B,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAE/B,OAAO,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAA,CAAC;IACrC,CAAC;CACF,CAAA;AA9BY,SAAS;IADrB,IAAA,eAAU,GAAE;;GACA,SAAS,CA8BrB;AA9BY,8BAAS","sourcesContent":["import {Injectable} from \"@tsed/di\";\nimport {EntityManager} from \"@mikro-orm/core\";\nimport {AsyncLocalStorage} from \"async_hooks\";\n\n@Injectable()\nexport class DBContext {\n private readonly storage = new AsyncLocalStorage<Map<string, EntityManager>>();\n\n constructor() {\n if (AsyncLocalStorage) {\n this.storage = new AsyncLocalStorage();\n } else {\n throw new Error(`AsyncLocalStorage is not available for your Node.js version (${process.versions.node}).`);\n }\n }\n\n public run<R>(ctx: Map<string, EntityManager>, callback: (...args: any[]) => R): R {\n return this.storage.run(ctx, callback);\n }\n\n public entries(): Map<string, EntityManager> | undefined {\n return this.storage.getStore();\n }\n\n public get(contextName: string): EntityManager | undefined {\n const context = this.entries();\n\n return context?.get(contextName);\n }\n\n public has(contextName: string): boolean {\n const context = this.entries();\n\n return !!context?.has(contextName);\n }\n}\n"]}
@@ -1,34 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Injectable } from "@tsed/di";
3
- import { AsyncLocalStorage } from "async_hooks";
4
- let DBContext = class DBContext {
5
- constructor() {
6
- this.storage = new AsyncLocalStorage();
7
- if (AsyncLocalStorage) {
8
- this.storage = new AsyncLocalStorage();
9
- }
10
- else {
11
- throw new Error(`AsyncLocalStorage is not available for your Node.js version (${process.versions.node}).`);
12
- }
13
- }
14
- run(ctx, callback) {
15
- return this.storage.run(ctx, callback);
16
- }
17
- entries() {
18
- return this.storage.getStore();
19
- }
20
- get(contextName) {
21
- const context = this.entries();
22
- return context === null || context === void 0 ? void 0 : context.get(contextName);
23
- }
24
- has(contextName) {
25
- const context = this.entries();
26
- return !!(context === null || context === void 0 ? void 0 : context.has(contextName));
27
- }
28
- };
29
- DBContext = __decorate([
30
- Injectable(),
31
- __metadata("design:paramtypes", [])
32
- ], DBContext);
33
- export { DBContext };
34
- //# sourceMappingURL=DBContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DBContext.js","sourceRoot":"","sources":["../../../src/services/DBContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAG9C,IAAa,SAAS,GAAtB,MAAa,SAAS;IAGpB;QAFiB,YAAO,GAAG,IAAI,iBAAiB,EAA8B,CAAC;QAG7E,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAC;SACxC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,gEAAgE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC;SAC5G;IACH,CAAC;IAEM,GAAG,CAAI,GAA+B,EAAE,QAA+B;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAE/B,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAE/B,OAAO,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAA,CAAC;IACrC,CAAC;CACF,CAAA;AA9BY,SAAS;IADrB,UAAU,EAAE;;GACA,SAAS,CA8BrB;SA9BY,SAAS","sourcesContent":["import {Injectable} from \"@tsed/di\";\nimport {EntityManager} from \"@mikro-orm/core\";\nimport {AsyncLocalStorage} from \"async_hooks\";\n\n@Injectable()\nexport class DBContext {\n private readonly storage = new AsyncLocalStorage<Map<string, EntityManager>>();\n\n constructor() {\n if (AsyncLocalStorage) {\n this.storage = new AsyncLocalStorage();\n } else {\n throw new Error(`AsyncLocalStorage is not available for your Node.js version (${process.versions.node}).`);\n }\n }\n\n public run<R>(ctx: Map<string, EntityManager>, callback: (...args: any[]) => R): R {\n return this.storage.run(ctx, callback);\n }\n\n public entries(): Map<string, EntityManager> | undefined {\n return this.storage.getStore();\n }\n\n public get(contextName: string): EntityManager | undefined {\n const context = this.entries();\n\n return context?.get(contextName);\n }\n\n public has(contextName: string): boolean {\n const context = this.entries();\n\n return !!context?.has(contextName);\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { EntityManager } from "@mikro-orm/core";
2
- export declare class DBContext {
3
- private readonly storage;
4
- constructor();
5
- run<R>(ctx: Map<string, EntityManager>, callback: (...args: any[]) => R): R;
6
- entries(): Map<string, EntityManager> | undefined;
7
- get(contextName: string): EntityManager | undefined;
8
- has(contextName: string): boolean;
9
- }