nestjs-typeorm3-kit 0.1.8 → 0.2.0
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/LICENSE +21 -0
- package/README.md +801 -148
- package/dist/common/decorator/index.d.ts.map +1 -1
- package/dist/common/decorator/index.js +1 -5
- package/dist/common/decorator/index.js.map +1 -1
- package/dist/controller/decorator/index.d.ts.map +1 -1
- package/dist/controller/decorator/index.js +66 -117
- package/dist/controller/decorator/index.js.map +1 -1
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +49 -10
- package/dist/helpers/index.js.map +1 -1
- package/dist/module/decorator/index.d.ts +1 -1
- package/dist/module/decorator/index.d.ts.map +1 -1
- package/dist/module/decorator/index.js +188 -19
- package/dist/module/decorator/index.js.map +1 -1
- package/dist/repository/config/constants.d.ts +1 -0
- package/dist/repository/config/constants.d.ts.map +1 -1
- package/dist/repository/config/constants.js +2 -1
- package/dist/repository/config/constants.js.map +1 -1
- package/dist/repository/config/types.d.ts +2 -2
- package/dist/repository/config/types.d.ts.map +1 -1
- package/dist/repository/config/types.js +34 -6
- package/dist/repository/config/types.js.map +1 -1
- package/dist/repository/config/utils.d.ts +1 -1
- package/dist/repository/config/utils.d.ts.map +1 -1
- package/dist/repository/config/utils.js +12 -13
- package/dist/repository/config/utils.js.map +1 -1
- package/dist/repository/decorator/index.d.ts +2 -2
- package/dist/repository/decorator/index.d.ts.map +1 -1
- package/dist/repository/decorator/index.js +1 -1
- package/dist/repository/decorator/index.js.map +1 -1
- package/dist/repository/module/index.d.ts +2 -5
- package/dist/repository/module/index.d.ts.map +1 -1
- package/dist/repository/module/index.js +23 -87
- package/dist/repository/module/index.js.map +1 -1
- package/dist/transaction/decorator/index.d.ts +5 -3
- package/dist/transaction/decorator/index.d.ts.map +1 -1
- package/dist/transaction/decorator/index.js +20 -19
- package/dist/transaction/decorator/index.js.map +1 -1
- package/dist/transaction/setup/index.d.ts +8 -3
- package/dist/transaction/setup/index.d.ts.map +1 -1
- package/dist/transaction/setup/index.js +19 -5
- package/dist/transaction/setup/index.js.map +1 -1
- package/dist/validate/decorator/index.d.ts.map +1 -1
- package/dist/validate/decorator/index.js +6 -4
- package/dist/validate/decorator/index.js.map +1 -1
- package/dist/vendor/transactional/common/constants.d.ts +6 -0
- package/dist/vendor/transactional/common/constants.d.ts.map +1 -0
- package/dist/vendor/transactional/common/constants.js +9 -0
- package/dist/vendor/transactional/common/constants.js.map +1 -0
- package/dist/vendor/transactional/common/index.d.ts +26 -0
- package/dist/vendor/transactional/common/index.d.ts.map +1 -0
- package/dist/vendor/transactional/common/index.js +136 -0
- package/dist/vendor/transactional/common/index.js.map +1 -0
- package/dist/vendor/transactional/decorators/transactional.d.ts +3 -0
- package/dist/vendor/transactional/decorators/transactional.d.ts.map +1 -0
- package/dist/vendor/transactional/decorators/transactional.js +20 -0
- package/dist/vendor/transactional/decorators/transactional.js.map +1 -0
- package/dist/vendor/transactional/enums/isolation-level.d.ts +7 -0
- package/dist/vendor/transactional/enums/isolation-level.d.ts.map +1 -0
- package/dist/vendor/transactional/enums/isolation-level.js +11 -0
- package/dist/vendor/transactional/enums/isolation-level.js.map +1 -0
- package/dist/vendor/transactional/enums/propagation.d.ts +10 -0
- package/dist/vendor/transactional/enums/propagation.d.ts.map +1 -0
- package/dist/vendor/transactional/enums/propagation.js +14 -0
- package/dist/vendor/transactional/enums/propagation.js.map +1 -0
- package/dist/vendor/transactional/enums/storage-driver.d.ts +5 -0
- package/dist/vendor/transactional/enums/storage-driver.d.ts.map +1 -0
- package/dist/vendor/transactional/enums/storage-driver.js +9 -0
- package/dist/vendor/transactional/enums/storage-driver.js.map +1 -0
- package/dist/vendor/transactional/errors/transactional.d.ts +4 -0
- package/dist/vendor/transactional/errors/transactional.d.ts.map +1 -0
- package/dist/vendor/transactional/errors/transactional.js +11 -0
- package/dist/vendor/transactional/errors/transactional.js.map +1 -0
- package/dist/vendor/transactional/errors/typeorm-updated-patch.d.ts +5 -0
- package/dist/vendor/transactional/errors/typeorm-updated-patch.d.ts.map +1 -0
- package/dist/vendor/transactional/errors/typeorm-updated-patch.js +11 -0
- package/dist/vendor/transactional/errors/typeorm-updated-patch.js.map +1 -0
- package/dist/vendor/transactional/hooks/index.d.ts +11 -0
- package/dist/vendor/transactional/hooks/index.d.ts.map +1 -0
- package/dist/vendor/transactional/hooks/index.js +79 -0
- package/dist/vendor/transactional/hooks/index.js.map +1 -0
- package/dist/vendor/transactional/index.d.ts +10 -0
- package/dist/vendor/transactional/index.d.ts.map +1 -0
- package/dist/vendor/transactional/index.js +27 -0
- package/dist/vendor/transactional/index.js.map +1 -0
- package/dist/vendor/transactional/storage/driver/async-local-storage/index.d.ts +9 -0
- package/dist/vendor/transactional/storage/driver/async-local-storage/index.d.ts.map +1 -0
- package/dist/vendor/transactional/storage/driver/async-local-storage/index.js +25 -0
- package/dist/vendor/transactional/storage/driver/async-local-storage/index.js.map +1 -0
- package/dist/vendor/transactional/storage/driver/interface.d.ts +10 -0
- package/dist/vendor/transactional/storage/driver/interface.d.ts.map +1 -0
- package/dist/vendor/transactional/storage/driver/interface.js +3 -0
- package/dist/vendor/transactional/storage/driver/interface.js.map +1 -0
- package/dist/vendor/transactional/storage/index.d.ts +3 -0
- package/dist/vendor/transactional/storage/index.d.ts.map +1 -0
- package/dist/vendor/transactional/storage/index.js +6 -0
- package/dist/vendor/transactional/storage/index.js.map +1 -0
- package/dist/vendor/transactional/storage/storage.d.ts +7 -0
- package/dist/vendor/transactional/storage/storage.d.ts.map +1 -0
- package/dist/vendor/transactional/storage/storage.js +21 -0
- package/dist/vendor/transactional/storage/storage.js.map +1 -0
- package/dist/vendor/transactional/transactions/nested-scope.d.ts +12 -0
- package/dist/vendor/transactional/transactions/nested-scope.d.ts.map +1 -0
- package/dist/vendor/transactional/transactions/nested-scope.js +42 -0
- package/dist/vendor/transactional/transactions/nested-scope.js.map +1 -0
- package/dist/vendor/transactional/transactions/run-in-transaction.d.ts +3 -0
- package/dist/vendor/transactional/transactions/run-in-transaction.d.ts.map +1 -0
- package/dist/vendor/transactional/transactions/run-in-transaction.js +9 -0
- package/dist/vendor/transactional/transactions/run-in-transaction.js.map +1 -0
- package/dist/vendor/transactional/transactions/wrap-in-transaction.d.ts +11 -0
- package/dist/vendor/transactional/transactions/wrap-in-transaction.d.ts.map +1 -0
- package/dist/vendor/transactional/transactions/wrap-in-transaction.js +109 -0
- package/dist/vendor/transactional/transactions/wrap-in-transaction.js.map +1 -0
- package/dist/vendor/transactional/utils/index.d.ts +3 -0
- package/dist/vendor/transactional/utils/index.d.ts.map +1 -0
- package/dist/vendor/transactional/utils/index.js +12 -0
- package/dist/vendor/transactional/utils/index.js.map +1 -0
- package/package.json +28 -25
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionalError = exports.wrapInTransaction = exports.runInTransaction = exports.IsolationLevel = exports.Propagation = exports.StorageDriver = exports.Transactional = exports.runOnTransactionComplete = exports.runOnTransactionRollback = exports.runOnTransactionCommit = exports.deleteDataSourceByName = exports.getDataSourceByName = exports.addTransactionalDataSource = exports.initializeTransactionalContext = void 0;
|
|
4
|
+
var common_1 = require("./common");
|
|
5
|
+
Object.defineProperty(exports, "initializeTransactionalContext", { enumerable: true, get: function () { return common_1.initializeTransactionalContext; } });
|
|
6
|
+
Object.defineProperty(exports, "addTransactionalDataSource", { enumerable: true, get: function () { return common_1.addTransactionalDataSource; } });
|
|
7
|
+
Object.defineProperty(exports, "getDataSourceByName", { enumerable: true, get: function () { return common_1.getDataSourceByName; } });
|
|
8
|
+
Object.defineProperty(exports, "deleteDataSourceByName", { enumerable: true, get: function () { return common_1.deleteDataSourceByName; } });
|
|
9
|
+
var hooks_1 = require("./hooks");
|
|
10
|
+
Object.defineProperty(exports, "runOnTransactionCommit", { enumerable: true, get: function () { return hooks_1.runOnTransactionCommit; } });
|
|
11
|
+
Object.defineProperty(exports, "runOnTransactionRollback", { enumerable: true, get: function () { return hooks_1.runOnTransactionRollback; } });
|
|
12
|
+
Object.defineProperty(exports, "runOnTransactionComplete", { enumerable: true, get: function () { return hooks_1.runOnTransactionComplete; } });
|
|
13
|
+
var transactional_1 = require("./decorators/transactional");
|
|
14
|
+
Object.defineProperty(exports, "Transactional", { enumerable: true, get: function () { return transactional_1.Transactional; } });
|
|
15
|
+
var storage_driver_1 = require("./enums/storage-driver");
|
|
16
|
+
Object.defineProperty(exports, "StorageDriver", { enumerable: true, get: function () { return storage_driver_1.StorageDriver; } });
|
|
17
|
+
var propagation_1 = require("./enums/propagation");
|
|
18
|
+
Object.defineProperty(exports, "Propagation", { enumerable: true, get: function () { return propagation_1.Propagation; } });
|
|
19
|
+
var isolation_level_1 = require("./enums/isolation-level");
|
|
20
|
+
Object.defineProperty(exports, "IsolationLevel", { enumerable: true, get: function () { return isolation_level_1.IsolationLevel; } });
|
|
21
|
+
var run_in_transaction_1 = require("./transactions/run-in-transaction");
|
|
22
|
+
Object.defineProperty(exports, "runInTransaction", { enumerable: true, get: function () { return run_in_transaction_1.runInTransaction; } });
|
|
23
|
+
var wrap_in_transaction_1 = require("./transactions/wrap-in-transaction");
|
|
24
|
+
Object.defineProperty(exports, "wrapInTransaction", { enumerable: true, get: function () { return wrap_in_transaction_1.wrapInTransaction; } });
|
|
25
|
+
var transactional_2 = require("./errors/transactional");
|
|
26
|
+
Object.defineProperty(exports, "TransactionalError", { enumerable: true, get: function () { return transactional_2.TransactionalError; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vendor/transactional/index.ts"],"names":[],"mappings":";;;AAAA,mCAKkB;AAJhB,wHAAA,8BAA8B,OAAA;AAC9B,oHAAA,0BAA0B,OAAA;AAC1B,6GAAA,mBAAmB,OAAA;AACnB,gHAAA,sBAAsB,OAAA;AAExB,iCAIiB;AAHf,+GAAA,sBAAsB,OAAA;AACtB,iHAAA,wBAAwB,OAAA;AACxB,iHAAA,wBAAwB,OAAA;AAE1B,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AACtB,yDAAuD;AAA9C,+GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,2DAAyD;AAAhD,iHAAA,cAAc,OAAA;AACvB,wEAAqE;AAA5D,sHAAA,gBAAgB,OAAA;AACzB,0EAAiG;AAAxF,wHAAA,iBAAiB,OAAA;AAC1B,wDAA4D;AAAnD,mHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StorageKey, StorageValue, StorageDriver } from '../interface';
|
|
2
|
+
export declare class AsyncLocalStorageDriver implements StorageDriver {
|
|
3
|
+
private readonly context;
|
|
4
|
+
get active(): boolean;
|
|
5
|
+
get<T>(key: StorageKey): T;
|
|
6
|
+
set(key: StorageKey, value: StorageValue): void;
|
|
7
|
+
run<T>(cb: () => Promise<T>): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/vendor/transactional/storage/driver/async-local-storage/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAW,MAAM,cAAc,CAAC;AAEhF,qBAAa,uBAAwB,YAAW,aAAa;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D,IAAI,MAAM,YAET;IAEM,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,GAAG,CAAC;IAI1B,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI;IAI/C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAGhD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncLocalStorageDriver = void 0;
|
|
4
|
+
const async_hooks_1 = require("async_hooks");
|
|
5
|
+
class AsyncLocalStorageDriver {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.context = new async_hooks_1.AsyncLocalStorage();
|
|
8
|
+
}
|
|
9
|
+
get active() {
|
|
10
|
+
return this.context.getStore() !== undefined;
|
|
11
|
+
}
|
|
12
|
+
get(key) {
|
|
13
|
+
var _a;
|
|
14
|
+
return (_a = this.context.getStore()) === null || _a === void 0 ? void 0 : _a.get(key);
|
|
15
|
+
}
|
|
16
|
+
set(key, value) {
|
|
17
|
+
var _a;
|
|
18
|
+
(_a = this.context.getStore()) === null || _a === void 0 ? void 0 : _a.set(key, value);
|
|
19
|
+
}
|
|
20
|
+
run(cb) {
|
|
21
|
+
return this.context.run(new Map(this.context.getStore()), cb);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.AsyncLocalStorageDriver = AsyncLocalStorageDriver;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/vendor/transactional/storage/driver/async-local-storage/index.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAIhD,MAAa,uBAAuB;IAApC;QACmB,YAAO,GAAG,IAAI,+BAAiB,EAAW,CAAC;IAiB9D,CAAC;IAfC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC;IAC/C,CAAC;IAEM,GAAG,CAAI,GAAe;;QAC3B,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,0CAAE,GAAG,CAAC,GAAG,CAAM,CAAC;IAChD,CAAC;IAEM,GAAG,CAAC,GAAe,EAAE,KAAmB;;QAC7C,MAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,0CAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAEM,GAAG,CAAI,EAAoB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AAlBD,0DAkBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type StorageKey = string;
|
|
2
|
+
export type StorageValue = unknown;
|
|
3
|
+
export type Storage = Map<StorageKey, StorageValue>;
|
|
4
|
+
export interface StorageDriver {
|
|
5
|
+
active: boolean;
|
|
6
|
+
get(key: StorageKey): StorageValue;
|
|
7
|
+
set(key: StorageKey, value: StorageValue): void;
|
|
8
|
+
run<T>(cb: () => Promise<T>): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../../src/vendor/transactional/storage/driver/interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;AACnC,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAChD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../../src/vendor/transactional/storage/driver/interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vendor/transactional/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,OAAO,SAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/storage/index.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEvB,QAAA,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/vendor/transactional/storage/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAA4B;IAEnC,MAAM;IAWN,GAAG;CASX"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Storage = void 0;
|
|
4
|
+
const async_local_storage_1 = require("./driver/async-local-storage");
|
|
5
|
+
class Storage {
|
|
6
|
+
create() {
|
|
7
|
+
if (this.driver) {
|
|
8
|
+
return this.driver;
|
|
9
|
+
}
|
|
10
|
+
this.driver = new async_local_storage_1.AsyncLocalStorageDriver();
|
|
11
|
+
return this.driver;
|
|
12
|
+
}
|
|
13
|
+
get() {
|
|
14
|
+
if (!this.driver) {
|
|
15
|
+
throw new Error('No storage driver defined in your app ... please call initializeTransactionalContext() before application start.');
|
|
16
|
+
}
|
|
17
|
+
return this.driver;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Storage = Storage;
|
|
21
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/storage/storage.ts"],"names":[],"mappings":";;;AAAA,sEAAuE;AAGvE,MAAa,OAAO;IAGX,MAAM;QACX,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAEhB,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,6CAAuB,EAAE,CAAC;QAE5C,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,GAAG;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAvBD,0BAuBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EntityManager, QueryRunner } from 'typeorm';
|
|
2
|
+
import { DataSourceName } from '../common';
|
|
3
|
+
import type { StorageDriver } from '../storage/driver/interface';
|
|
4
|
+
export declare class NestedScope {
|
|
5
|
+
readonly queryRunner: QueryRunner | undefined;
|
|
6
|
+
private tail;
|
|
7
|
+
constructor(queryRunner: QueryRunner | undefined);
|
|
8
|
+
acquire(): Promise<() => void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const setNestedScope: (context: StorageDriver, name: DataSourceName, entityManager: EntityManager) => void;
|
|
11
|
+
export declare const getNestedScope: (context: StorageDriver, name: DataSourceName, currentTransaction: EntityManager) => NestedScope;
|
|
12
|
+
//# sourceMappingURL=nested-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-scope.d.ts","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/nested-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAKjE,qBAAa,WAAW;IAGV,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS;IAFzD,OAAO,CAAC,IAAI,CAAoC;gBAE3B,WAAW,EAAE,WAAW,GAAG,SAAS;IAEnD,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;CAUrC;AAUD,eAAO,MAAM,cAAc,GACzB,SAAS,aAAa,EACtB,MAAM,cAAc,EACpB,eAAe,aAAa,SAG7B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,SAAS,aAAa,EACtB,MAAM,cAAc,EACpB,oBAAoB,aAAa,KAChC,WAcF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNestedScope = exports.setNestedScope = exports.NestedScope = void 0;
|
|
4
|
+
const constants_1 = require("../common/constants");
|
|
5
|
+
class NestedScope {
|
|
6
|
+
constructor(queryRunner) {
|
|
7
|
+
this.queryRunner = queryRunner;
|
|
8
|
+
this.tail = Promise.resolve();
|
|
9
|
+
}
|
|
10
|
+
async acquire() {
|
|
11
|
+
const previous = this.tail;
|
|
12
|
+
let release;
|
|
13
|
+
this.tail = new Promise((resolve) => {
|
|
14
|
+
release = resolve;
|
|
15
|
+
});
|
|
16
|
+
await previous;
|
|
17
|
+
return release;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NestedScope = NestedScope;
|
|
21
|
+
const rootScopes = new WeakMap();
|
|
22
|
+
const scopeKey = (name) => constants_1.TYPEORM_DATA_SOURCE_NAME_PREFIX + name + '/nested-scope';
|
|
23
|
+
const setNestedScope = (context, name, entityManager) => {
|
|
24
|
+
context.set(scopeKey(name), new NestedScope(entityManager.queryRunner));
|
|
25
|
+
};
|
|
26
|
+
exports.setNestedScope = setNestedScope;
|
|
27
|
+
const getNestedScope = (context, name, currentTransaction) => {
|
|
28
|
+
const queryRunner = currentTransaction.queryRunner;
|
|
29
|
+
const scoped = context.get(scopeKey(name));
|
|
30
|
+
if (scoped && scoped.queryRunner === queryRunner)
|
|
31
|
+
return scoped;
|
|
32
|
+
if (!queryRunner)
|
|
33
|
+
return new NestedScope(undefined);
|
|
34
|
+
let root = rootScopes.get(queryRunner);
|
|
35
|
+
if (!root) {
|
|
36
|
+
root = new NestedScope(queryRunner);
|
|
37
|
+
rootScopes.set(queryRunner, root);
|
|
38
|
+
}
|
|
39
|
+
return root;
|
|
40
|
+
};
|
|
41
|
+
exports.getNestedScope = getNestedScope;
|
|
42
|
+
//# sourceMappingURL=nested-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-scope.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/nested-scope.ts"],"names":[],"mappings":";;;AAGA,mDAAsE;AAMtE,MAAa,WAAW;IAGtB,YAAqB,WAAoC;QAApC,gBAAW,GAAX,WAAW,CAAyB;QAFjD,SAAI,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEY,CAAC;IAE7D,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,OAAoB,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACxC,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC,CAAC,CAAC;QACH,MAAM,QAAQ,CAAC;QAEf,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAfD,kCAeC;AAED,MAAM,UAAU,GAAG,IAAI,OAAO,EAA4B,CAAC;AAE3D,MAAM,QAAQ,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,2CAA+B,GAAG,IAAI,GAAG,eAAe,CAAC;AAM7F,MAAM,cAAc,GAAG,CAC5B,OAAsB,EACtB,IAAoB,EACpB,aAA4B,EAC5B,EAAE;IACF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,MAAM,cAAc,GAAG,CAC5B,OAAsB,EACtB,IAAoB,EACpB,kBAAiC,EACpB,EAAE;IACf,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAA4B,CAAC;IACtE,IAAI,MAAM,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW;QAAE,OAAO,MAAM,CAAC;IAEhE,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC;IAEpD,IAAI,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC;QACpC,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-in-transaction.d.ts","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/run-in-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,eAAO,MAAM,gBAAgB,GAAI,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,KAAK,UAAU,CAAC,IAAI,CAAC,EAC/E,IAAI,IAAI,EACR,UAAU,wBAAwB,qBAGnC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runInTransaction = void 0;
|
|
4
|
+
const wrap_in_transaction_1 = require("./wrap-in-transaction");
|
|
5
|
+
const runInTransaction = (fn, options) => {
|
|
6
|
+
return (0, wrap_in_transaction_1.wrapInTransaction)(fn, options)();
|
|
7
|
+
};
|
|
8
|
+
exports.runInTransaction = runInTransaction;
|
|
9
|
+
//# sourceMappingURL=run-in-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-in-transaction.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/run-in-transaction.ts"],"names":[],"mappings":";;;AAAA,+DAAoF;AAE7E,MAAM,gBAAgB,GAAG,CAC9B,EAAQ,EACR,OAAkC,EAClC,EAAE;IACF,OAAO,IAAA,uCAAiB,EAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;AAC1C,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataSourceName } from '../common';
|
|
2
|
+
import { IsolationLevel } from '../enums/isolation-level';
|
|
3
|
+
import { Propagation } from '../enums/propagation';
|
|
4
|
+
export interface WrapInTransactionOptions {
|
|
5
|
+
connectionName?: DataSourceName | (() => DataSourceName | undefined);
|
|
6
|
+
propagation?: Propagation;
|
|
7
|
+
isolationLevel?: IsolationLevel;
|
|
8
|
+
name?: string | symbol;
|
|
9
|
+
}
|
|
10
|
+
export declare const wrapInTransaction: <Fn extends (this: any, ...args: any[]) => ReturnType<Fn>>(fn: Fn, options?: WrapInTransactionOptions) => Fn;
|
|
11
|
+
//# sourceMappingURL=wrap-in-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-in-transaction.d.ts","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/wrap-in-transaction.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAQf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKnD,MAAM,WAAW,wBAAwB;IAIvC,cAAc,CAAC,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC;IAErE,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,GAAI,EAAE,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC,EAAE,CAAC,EACxF,IAAI,EAAE,EACN,UAAU,wBAAwB,KAoIhB,EACnB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapInTransaction = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const propagation_1 = require("../enums/propagation");
|
|
6
|
+
const hooks_1 = require("../hooks");
|
|
7
|
+
const nested_scope_1 = require("./nested-scope");
|
|
8
|
+
const transactional_1 = require("../errors/transactional");
|
|
9
|
+
const wrapInTransaction = (fn, options) => {
|
|
10
|
+
function wrapper(...args) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const context = (0, common_1.getTransactionalContext)();
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error('No transaction context defined. Call setupTransactionContext() before application start.');
|
|
15
|
+
}
|
|
16
|
+
const connectionName = (_a = (typeof (options === null || options === void 0 ? void 0 : options.connectionName) === 'function'
|
|
17
|
+
? options.connectionName()
|
|
18
|
+
: options === null || options === void 0 ? void 0 : options.connectionName)) !== null && _a !== void 0 ? _a : 'default';
|
|
19
|
+
const dataSource = (0, common_1.getDataSourceByName)(connectionName);
|
|
20
|
+
if (!dataSource) {
|
|
21
|
+
throw new Error('No data sources defined in your app ... please call addTransactionalDataSources() before application start.');
|
|
22
|
+
}
|
|
23
|
+
const propagation = (_b = options === null || options === void 0 ? void 0 : options.propagation) !== null && _b !== void 0 ? _b : propagation_1.Propagation.REQUIRED;
|
|
24
|
+
const isolationLevel = options === null || options === void 0 ? void 0 : options.isolationLevel;
|
|
25
|
+
const runOriginal = () => fn.apply(this, args);
|
|
26
|
+
const runWithOwningHook = () => {
|
|
27
|
+
const hook = (0, common_1.getHookByDataSourceName)(context, connectionName);
|
|
28
|
+
if (!hook || hook === (0, common_1.getHookInContext)(context)) {
|
|
29
|
+
return runOriginal();
|
|
30
|
+
}
|
|
31
|
+
return context.run(async () => {
|
|
32
|
+
(0, common_1.setHookInContext)(context, hook);
|
|
33
|
+
return runOriginal();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const runWithNewHook = () => (0, hooks_1.runInNewHookContext)(context, runOriginal);
|
|
37
|
+
const runWithNewTransaction = (transactionManager = dataSource, parentHook) => {
|
|
38
|
+
const transactionCallback = async (entityManager) => {
|
|
39
|
+
(0, common_1.setEntityManagerByDataSourceName)(context, connectionName, entityManager);
|
|
40
|
+
(0, nested_scope_1.setNestedScope)(context, connectionName, entityManager);
|
|
41
|
+
try {
|
|
42
|
+
const result = await runOriginal();
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
(0, common_1.setEntityManagerByDataSourceName)(context, connectionName, null);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
if (isolationLevel) {
|
|
50
|
+
return (0, hooks_1.runInNewHookContext)(context, () => {
|
|
51
|
+
return transactionManager.transaction(isolationLevel, transactionCallback);
|
|
52
|
+
}, parentHook, connectionName);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return (0, hooks_1.runInNewHookContext)(context, () => {
|
|
56
|
+
return transactionManager.transaction(transactionCallback);
|
|
57
|
+
}, parentHook, connectionName);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return context.run(async () => {
|
|
61
|
+
var _a;
|
|
62
|
+
const currentTransaction = (0, common_1.getEntityManagerByDataSourceName)(context, connectionName);
|
|
63
|
+
switch (propagation) {
|
|
64
|
+
case propagation_1.Propagation.MANDATORY:
|
|
65
|
+
if (!currentTransaction) {
|
|
66
|
+
throw new transactional_1.TransactionalError("No existing transaction found for transaction marked with propagation 'MANDATORY'");
|
|
67
|
+
}
|
|
68
|
+
return runWithOwningHook();
|
|
69
|
+
case propagation_1.Propagation.NESTED:
|
|
70
|
+
if (!currentTransaction) {
|
|
71
|
+
return runWithNewTransaction();
|
|
72
|
+
}
|
|
73
|
+
const scope = (0, nested_scope_1.getNestedScope)(context, connectionName, currentTransaction);
|
|
74
|
+
const release = await scope.acquire();
|
|
75
|
+
try {
|
|
76
|
+
return await runWithNewTransaction(currentTransaction, (_a = (0, common_1.getHookByDataSourceName)(context, connectionName)) !== null && _a !== void 0 ? _a : undefined);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
release();
|
|
80
|
+
}
|
|
81
|
+
case propagation_1.Propagation.NEVER:
|
|
82
|
+
if (currentTransaction) {
|
|
83
|
+
throw new transactional_1.TransactionalError("Found an existing transaction, transaction marked with propagation 'NEVER'");
|
|
84
|
+
}
|
|
85
|
+
return runWithNewHook();
|
|
86
|
+
case propagation_1.Propagation.NOT_SUPPORTED:
|
|
87
|
+
if (currentTransaction) {
|
|
88
|
+
(0, common_1.setEntityManagerByDataSourceName)(context, connectionName, null);
|
|
89
|
+
const result = await runWithNewHook();
|
|
90
|
+
(0, common_1.setEntityManagerByDataSourceName)(context, connectionName, currentTransaction);
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
return runOriginal();
|
|
94
|
+
case propagation_1.Propagation.REQUIRED:
|
|
95
|
+
if (currentTransaction) {
|
|
96
|
+
return runWithOwningHook();
|
|
97
|
+
}
|
|
98
|
+
return runWithNewTransaction();
|
|
99
|
+
case propagation_1.Propagation.REQUIRES_NEW:
|
|
100
|
+
return runWithNewTransaction();
|
|
101
|
+
case propagation_1.Propagation.SUPPORTS:
|
|
102
|
+
return currentTransaction ? runWithOwningHook() : runWithNewHook();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return wrapper;
|
|
107
|
+
};
|
|
108
|
+
exports.wrapInTransaction = wrapInTransaction;
|
|
109
|
+
//# sourceMappingURL=wrap-in-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-in-transaction.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/transactions/wrap-in-transaction.ts"],"names":[],"mappings":";;;AAEA,sCASmB;AAGnB,sDAAmD;AACnD,oCAA+C;AAC/C,iDAA6E;AAC7E,2DAA6D;AAetD,MAAM,iBAAiB,GAAG,CAC/B,EAAM,EACN,OAAkC,EAClC,EAAE;IAEF,SAAS,OAAO,CAAgB,GAAG,IAAe;;QAChD,MAAM,OAAO,GAAG,IAAA,gCAAuB,GAAE,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QAED,MAAM,cAAc,GAAG,MAAA,CAAC,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAA,KAAK,UAAU;YACnE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE;YAC1B,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,mCAAI,SAAS,CAAC;QAE1C,MAAM,UAAU,GAAG,IAAA,4BAAmB,EAAC,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,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MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAMtD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDataSource = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const isDataSource = (value) => {
|
|
6
|
+
if (!value || typeof value !== 'object') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return value.constructor.name === typeorm_1.DataSource.name;
|
|
10
|
+
};
|
|
11
|
+
exports.isDataSource = isDataSource;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vendor/transactional/utils/index.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAE9B,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,oBAAU,CAAC,IAAI,CAAC;AACpD,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-typeorm3-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "NestJS utilities for TypeORM v0.3+",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "rimraf dist && tsc",
|
|
12
|
-
"test": "jest --config ./
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"gen-docs-github": "npx typedoc --theme github-wiki src/**/*.ts"
|
|
11
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
12
|
+
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config ./jest.config.json",
|
|
13
|
+
"test:integration": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config ./tests/jest.config.json --detectOpenHandles",
|
|
14
|
+
"prepare": "yarn build"
|
|
16
15
|
},
|
|
17
16
|
"repository": {
|
|
18
17
|
"type": "git",
|
|
@@ -42,42 +41,46 @@
|
|
|
42
41
|
"url": "https://github.com/x302502/nestjs-typeorm3-kit/issues"
|
|
43
42
|
},
|
|
44
43
|
"homepage": "https://github.com/x302502/nestjs-typeorm3-kit#readme",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=16.4.0"
|
|
46
|
+
},
|
|
45
47
|
"peerDependencies": {
|
|
46
|
-
"@nestjs/common": ">=8.0.0",
|
|
47
|
-
"@nestjs/core": ">=8.0.0",
|
|
48
|
-
"@nestjs/typeorm": ">=
|
|
48
|
+
"@nestjs/common": ">=8.0.0 <13.0.0",
|
|
49
|
+
"@nestjs/core": ">=8.0.0 <13.0.0",
|
|
50
|
+
"@nestjs/typeorm": ">=9.0.0 <13.0.0",
|
|
51
|
+
"@nestjs/swagger": ">=5.0.0 <13.0.0",
|
|
49
52
|
"class-transformer": "^0.5.1",
|
|
50
53
|
"class-validator": "^0.14.0",
|
|
54
|
+
"class-validator-jsonschema": "^5.0.2",
|
|
51
55
|
"libphonenumber-js": "^1.10.20",
|
|
52
|
-
"reflect-metadata": ">=0.1.13",
|
|
53
|
-
"rxjs": ">=7.2.0",
|
|
54
|
-
"typeorm": ">=0.3.0"
|
|
55
|
-
|
|
56
|
+
"reflect-metadata": ">=0.1.13 <0.3.0",
|
|
57
|
+
"rxjs": ">=7.2.0 <8.0.0",
|
|
58
|
+
"typeorm": ">=0.3.0 <1.0.0"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"fast-glob": "^3.3.3"
|
|
56
62
|
},
|
|
57
63
|
"devDependencies": {
|
|
58
|
-
"@nestjs/common": "^
|
|
59
|
-
"@nestjs/core": "^
|
|
60
|
-
"@nestjs/
|
|
61
|
-
"@nestjs/
|
|
62
|
-
"@nestjs/
|
|
64
|
+
"@nestjs/common": "^12.1.3",
|
|
65
|
+
"@nestjs/core": "^12.1.3",
|
|
66
|
+
"@nestjs/platform-express": "^12.1.3",
|
|
67
|
+
"@nestjs/swagger": "^12.0.2",
|
|
68
|
+
"@nestjs/testing": "^12.1.3",
|
|
69
|
+
"@nestjs/typeorm": "^12.0.2",
|
|
63
70
|
"@types/jest": "^30.0.0",
|
|
64
71
|
"class-transformer": "^0.5.1",
|
|
65
72
|
"class-validator": "^0.14.2",
|
|
66
73
|
"class-validator-jsonschema": "^5.0.2",
|
|
67
74
|
"eslint": "^9.29.0",
|
|
68
|
-
"fast-glob": "^3.3.3",
|
|
69
75
|
"jest": "^30.0.3",
|
|
70
76
|
"libphonenumber-js": "^1.12.9",
|
|
71
77
|
"prettier": "^3.6.2",
|
|
72
78
|
"reflect-metadata": "^0.2.2",
|
|
73
79
|
"rimraf": "^6.0.1",
|
|
74
80
|
"rxjs": "^7.8.2",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"typedoc-plugin-markdown": "^4.7.0",
|
|
79
|
-
"typeorm": "^0.3.25",
|
|
80
|
-
"typeorm-transactional": "^0.5.0",
|
|
81
|
+
"sql.js": "^1.14.2",
|
|
82
|
+
"ts-jest": "^29.4.14",
|
|
83
|
+
"typeorm": "^0.3.31",
|
|
81
84
|
"typescript": "^5.8.3"
|
|
82
85
|
}
|
|
83
86
|
}
|