@tsed/mikro-orm 7.0.0-beta.2 → 7.0.0-beta.20
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/jest.config.js +4 -4
- package/lib/cjs/MikroOrmModule.d.ts +7 -3
- package/lib/cjs/MikroOrmModule.js +30 -12
- package/lib/cjs/MikroOrmModule.js.map +1 -1
- package/lib/cjs/decorators/entityManager.d.ts +6 -6
- package/lib/cjs/decorators/entityManager.js +6 -6
- package/lib/cjs/decorators/entityManager.js.map +1 -1
- package/lib/cjs/decorators/orm.d.ts +5 -0
- package/lib/cjs/decorators/orm.js +12 -0
- package/lib/cjs/decorators/orm.js.map +1 -0
- package/lib/cjs/decorators/transactional.d.ts +6 -2
- package/lib/cjs/decorators/transactional.js +6 -2
- package/lib/cjs/decorators/transactional.js.map +1 -1
- package/lib/cjs/filters/OptimisticLockErrorFilter.js +1 -1
- package/lib/cjs/index.d.ts +12 -4
- package/lib/cjs/index.js +13 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interceptors/TransactionalInterceptor.d.ts +10 -4
- package/lib/cjs/interceptors/TransactionalInterceptor.js +56 -40
- package/lib/cjs/interceptors/TransactionalInterceptor.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/MikroOrmContext.d.ts +9 -0
- package/lib/cjs/services/MikroOrmContext.js +26 -0
- package/lib/cjs/services/MikroOrmContext.js.map +1 -0
- package/lib/cjs/services/MikroOrmFactory.d.ts +4 -2
- package/lib/cjs/services/MikroOrmFactory.js +12 -10
- package/lib/cjs/services/MikroOrmFactory.js.map +1 -1
- package/lib/cjs/services/MikroOrmRegistry.d.ts +7 -5
- package/lib/cjs/services/MikroOrmRegistry.js +32 -27
- package/lib/cjs/services/MikroOrmRegistry.js.map +1 -1
- package/lib/esm/MikroOrmModule.js +25 -7
- package/lib/esm/MikroOrmModule.js.map +1 -1
- package/lib/esm/decorators/entityManager.js +6 -6
- package/lib/esm/decorators/entityManager.js.map +1 -1
- package/lib/esm/decorators/orm.js +8 -0
- package/lib/esm/decorators/orm.js.map +1 -0
- package/lib/esm/decorators/transactional.js +6 -2
- package/lib/esm/decorators/transactional.js.map +1 -1
- package/lib/esm/index.js +13 -5
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interceptors/TransactionalInterceptor.js +49 -33
- package/lib/esm/interceptors/TransactionalInterceptor.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/MikroOrmContext.js +23 -0
- package/lib/esm/services/MikroOrmContext.js.map +1 -0
- package/lib/esm/services/MikroOrmFactory.js +12 -10
- package/lib/esm/services/MikroOrmFactory.js.map +1 -1
- package/lib/esm/services/MikroOrmRegistry.js +29 -24
- package/lib/esm/services/MikroOrmRegistry.js.map +1 -1
- package/lib/types/MikroOrmModule.d.ts +7 -3
- package/lib/types/decorators/entityManager.d.ts +6 -6
- package/lib/types/decorators/orm.d.ts +5 -0
- package/lib/types/decorators/transactional.d.ts +6 -2
- package/lib/types/index.d.ts +12 -4
- package/lib/types/interceptors/TransactionalInterceptor.d.ts +10 -4
- package/lib/types/services/MikroOrmContext.d.ts +9 -0
- package/lib/types/services/MikroOrmFactory.d.ts +4 -2
- package/lib/types/services/MikroOrmRegistry.d.ts +7 -5
- package/package.json +23 -18
- package/readme.md +75 -46
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/decorators/connection.d.ts +0 -1
- package/lib/cjs/decorators/connection.js +0 -8
- package/lib/cjs/decorators/connection.js.map +0 -1
- package/lib/cjs/decorators/index.d.ts +0 -3
- package/lib/cjs/decorators/index.js +0 -7
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/filters/index.d.ts +0 -1
- package/lib/cjs/filters/index.js +0 -5
- package/lib/cjs/filters/index.js.map +0 -1
- package/lib/cjs/interceptors/index.d.ts +0 -1
- package/lib/cjs/interceptors/index.js +0 -5
- package/lib/cjs/interceptors/index.js.map +0 -1
- package/lib/cjs/services/DBContext.d.ts +0 -9
- package/lib/cjs/services/DBContext.js +0 -37
- package/lib/cjs/services/DBContext.js.map +0 -1
- package/lib/cjs/services/index.d.ts +0 -4
- package/lib/cjs/services/index.js +0 -8
- package/lib/cjs/services/index.js.map +0 -1
- package/lib/esm/decorators/connection.js +0 -4
- package/lib/esm/decorators/connection.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -4
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/filters/index.js +0 -2
- package/lib/esm/filters/index.js.map +0 -1
- package/lib/esm/interceptors/index.js +0 -2
- package/lib/esm/interceptors/index.js.map +0 -1
- package/lib/esm/services/DBContext.js +0 -34
- package/lib/esm/services/DBContext.js.map +0 -1
- package/lib/esm/services/index.js +0 -5
- package/lib/esm/services/index.js.map +0 -1
- package/lib/types/decorators/connection.d.ts +0 -1
- package/lib/types/decorators/index.d.ts +0 -3
- package/lib/types/filters/index.d.ts +0 -1
- package/lib/types/interceptors/index.d.ts +0 -1
- package/lib/types/services/DBContext.d.ts +0 -9
- package/lib/types/services/index.d.ts +0 -4
|
@@ -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
|
-
getContext(): Map<string, EntityManager> | undefined;
|
|
7
|
-
get(contextName: string): EntityManager | undefined;
|
|
8
|
-
has(contextName: string): boolean;
|
|
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
|
-
getContext() {
|
|
21
|
-
return this.storage.getStore();
|
|
22
|
-
}
|
|
23
|
-
get(contextName) {
|
|
24
|
-
const context = this.getContext();
|
|
25
|
-
return context === null || context === void 0 ? void 0 : context.get(contextName);
|
|
26
|
-
}
|
|
27
|
-
has(contextName) {
|
|
28
|
-
const context = this.getContext();
|
|
29
|
-
return !!(context === null || context === void 0 ? void 0 : context.has(contextName));
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
DBContext = (0, tslib_1.__decorate)([
|
|
33
|
-
(0, di_1.Injectable)(),
|
|
34
|
-
(0, 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,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,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 getContext(): Map<string, EntityManager> | undefined {\n return this.storage.getStore();\n }\n\n public get(contextName: string): EntityManager | undefined {\n const context = this.getContext();\n\n return context?.get(contextName);\n }\n\n public has(contextName: string): boolean {\n const context = this.getContext();\n\n return !!context?.has(contextName);\n }\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./DBContext"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./MikroOrmFactory"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./MikroOrmRegistry"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./RetryStrategy"), exports);
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,2DAA4B;AAC5B,iEAAkC;AAClC,kEAAmC;AACnC,+DAAgC","sourcesContent":["export * from \"./DBContext\";\nexport * from \"./MikroOrmFactory\";\nexport * from \"./MikroOrmRegistry\";\nexport * from \"./RetryStrategy\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/decorators/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,cAAuB,EAAqB,EAAE,CACvE,MAAM,CAAC,gBAAgB,EAAE,CAAC,QAA0B,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAsB,CAAC","sourcesContent":["import {MikroOrmRegistry} from \"../services\";\nimport {Inject} from \"@tsed/di\";\n\nexport const Connection = (connectionName?: string): PropertyDecorator =>\n Inject(MikroOrmRegistry, (registry: MikroOrmRegistry) => registry.get(connectionName)) as PropertyDecorator;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./transactional\";\nexport * from \"./connection\";\nexport * from \"./entityManager\";\n"]}
|
package/lib/esm/filters/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./OptimisticLockErrorFilter\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interceptors/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./TransactionalInterceptor\";\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
|
-
getContext() {
|
|
18
|
-
return this.storage.getStore();
|
|
19
|
-
}
|
|
20
|
-
get(contextName) {
|
|
21
|
-
const context = this.getContext();
|
|
22
|
-
return context === null || context === void 0 ? void 0 : context.get(contextName);
|
|
23
|
-
}
|
|
24
|
-
has(contextName) {
|
|
25
|
-
const context = this.getContext();
|
|
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,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAAC,WAAmB;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,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 getContext(): Map<string, EntityManager> | undefined {\n return this.storage.getStore();\n }\n\n public get(contextName: string): EntityManager | undefined {\n const context = this.getContext();\n\n return context?.get(contextName);\n }\n\n public has(contextName: string): boolean {\n const context = this.getContext();\n\n return !!context?.has(contextName);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./DBContext\";\nexport * from \"./MikroOrmFactory\";\nexport * from \"./MikroOrmRegistry\";\nexport * from \"./RetryStrategy\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Connection: (connectionName?: string | undefined) => PropertyDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./OptimisticLockErrorFilter";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./TransactionalInterceptor";
|
|
@@ -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
|
-
getContext(): Map<string, EntityManager> | undefined;
|
|
7
|
-
get(contextName: string): EntityManager | undefined;
|
|
8
|
-
has(contextName: string): boolean;
|
|
9
|
-
}
|