@rsdk/db 2.5.1 → 3.0.1-next.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/CHANGELOG.md +61 -1
- package/package.json +5 -5
- package/db/dist/context.base.d.ts +0 -30
- package/db/dist/context.base.js +0 -52
- package/db/dist/context.base.js.map +0 -1
- package/db/dist/context.storage.d.ts +0 -22
- package/db/dist/context.storage.js +0 -32
- package/db/dist/context.storage.js.map +0 -1
- package/db/dist/exceptions.d.ts +0 -10
- package/db/dist/exceptions.js +0 -25
- package/db/dist/exceptions.js.map +0 -1
- package/db/dist/index.d.ts +0 -6
- package/db/dist/index.js +0 -16
- package/db/dist/index.js.map +0 -1
- package/db/dist/propagation.enum.d.ts +0 -30
- package/db/dist/propagation.enum.js +0 -35
- package/db/dist/propagation.enum.js.map +0 -1
- package/db/dist/transactional.runner.d.ts +0 -29
- package/db/dist/transactional.runner.js +0 -119
- package/db/dist/transactional.runner.js.map +0 -1
- package/db/dist/types.d.ts +0 -10
- package/db/dist/types.js +0 -3
- package/db/dist/types.js.map +0 -1
- package/db.knex/dist/index.d.ts +0 -9
- package/db.knex/dist/index.js +0 -15
- package/db.knex/dist/index.js.map +0 -1
- package/db.knex/dist/inject-knex.decorator.d.ts +0 -2
- package/db.knex/dist/inject-knex.decorator.js +0 -8
- package/db.knex/dist/inject-knex.decorator.js.map +0 -1
- package/db.knex/dist/internal/context.d.ts +0 -78
- package/db.knex/dist/internal/context.js +0 -233
- package/db.knex/dist/internal/context.js.map +0 -1
- package/db.knex/dist/internal/exceptions.d.ts +0 -65
- package/db.knex/dist/internal/exceptions.js +0 -94
- package/db.knex/dist/internal/exceptions.js.map +0 -1
- package/db.knex/dist/internal/initializer.d.ts +0 -9
- package/db.knex/dist/internal/initializer.js +0 -48
- package/db.knex/dist/internal/initializer.js.map +0 -1
- package/db.knex/dist/internal/strategy.d.ts +0 -18
- package/db.knex/dist/internal/strategy.js +0 -75
- package/db.knex/dist/internal/strategy.js.map +0 -1
- package/db.knex/dist/internal/test.e2e/strategy.test.d.ts +0 -1
- package/db.knex/dist/internal/test.e2e/strategy.test.js +0 -762
- package/db.knex/dist/internal/test.e2e/strategy.test.js.map +0 -1
- package/db.knex/dist/internal/test.e2e/utils.d.ts +0 -17
- package/db.knex/dist/internal/test.e2e/utils.js +0 -21
- package/db.knex/dist/internal/test.e2e/utils.js.map +0 -1
- package/db.knex/dist/knex.module.d.ts +0 -5
- package/db.knex/dist/knex.module.js +0 -34
- package/db.knex/dist/knex.module.js.map +0 -1
- package/db.knex/dist/knex.plugin.d.ts +0 -10
- package/db.knex/dist/knex.plugin.js +0 -20
- package/db.knex/dist/knex.plugin.js.map +0 -1
- package/db.knex/dist/providers/index.d.ts +0 -4
- package/db.knex/dist/providers/index.js +0 -21
- package/db.knex/dist/providers/index.js.map +0 -1
- package/db.knex/dist/providers/knex-logger.adapter.d.ts +0 -10
- package/db.knex/dist/providers/knex-logger.adapter.js +0 -45
- package/db.knex/dist/providers/knex-logger.adapter.js.map +0 -1
- package/db.knex/dist/providers/knex.config.d.ts +0 -10
- package/db.knex/dist/providers/knex.config.js +0 -76
- package/db.knex/dist/providers/knex.config.js.map +0 -1
- package/db.knex/dist/providers/knex.factory.d.ts +0 -13
- package/db.knex/dist/providers/knex.factory.js +0 -96
- package/db.knex/dist/providers/knex.factory.js.map +0 -1
- package/db.knex/dist/providers/knex.indicator.d.ts +0 -8
- package/db.knex/dist/providers/knex.indicator.js +0 -41
- package/db.knex/dist/providers/knex.indicator.js.map +0 -1
- package/db.knex/dist/types.d.ts +0 -12
- package/db.knex/dist/types.js +0 -20
- package/db.knex/dist/types.js.map +0 -1
- package/db.typeorm/dist/data-source-extractor.d.ts +0 -20
- package/db.typeorm/dist/data-source-extractor.js +0 -43
- package/db.typeorm/dist/data-source-extractor.js.map +0 -1
- package/db.typeorm/dist/index.d.ts +0 -8
- package/db.typeorm/dist/index.js +0 -12
- package/db.typeorm/dist/index.js.map +0 -1
- package/db.typeorm/dist/internal/context.d.ts +0 -46
- package/db.typeorm/dist/internal/context.js +0 -123
- package/db.typeorm/dist/internal/context.js.map +0 -1
- package/db.typeorm/dist/internal/exceptions.d.ts +0 -67
- package/db.typeorm/dist/internal/exceptions.js +0 -99
- package/db.typeorm/dist/internal/exceptions.js.map +0 -1
- package/db.typeorm/dist/internal/initializer.d.ts +0 -15
- package/db.typeorm/dist/internal/initializer.js +0 -158
- package/db.typeorm/dist/internal/initializer.js.map +0 -1
- package/db.typeorm/dist/internal/strategy.d.ts +0 -54
- package/db.typeorm/dist/internal/strategy.js +0 -108
- package/db.typeorm/dist/internal/strategy.js.map +0 -1
- package/db.typeorm/dist/internal/test/strategy.test.e2e.d.ts +0 -5
- package/db.typeorm/dist/internal/test/strategy.test.e2e.js +0 -779
- package/db.typeorm/dist/internal/test/strategy.test.e2e.js.map +0 -1
- package/db.typeorm/dist/internal/test/util.d.ts +0 -22
- package/db.typeorm/dist/internal/test/util.js +0 -72
- package/db.typeorm/dist/internal/test/util.js.map +0 -1
- package/db.typeorm/dist/modules/migration-checker.module.d.ts +0 -9
- package/db.typeorm/dist/modules/migration-checker.module.js +0 -42
- package/db.typeorm/dist/modules/migration-checker.module.js.map +0 -1
- package/db.typeorm/dist/providers/index.d.ts +0 -3
- package/db.typeorm/dist/providers/index.js +0 -20
- package/db.typeorm/dist/providers/index.js.map +0 -1
- package/db.typeorm/dist/providers/typeorm-logger.adapter.d.ts +0 -13
- package/db.typeorm/dist/providers/typeorm-logger.adapter.js +0 -61
- package/db.typeorm/dist/providers/typeorm-logger.adapter.js.map +0 -1
- package/db.typeorm/dist/providers/typeorm.config.d.ts +0 -10
- package/db.typeorm/dist/providers/typeorm.config.js +0 -79
- package/db.typeorm/dist/providers/typeorm.config.js.map +0 -1
- package/db.typeorm/dist/providers/typeorm.healthcheck.d.ts +0 -8
- package/db.typeorm/dist/providers/typeorm.healthcheck.js +0 -36
- package/db.typeorm/dist/providers/typeorm.healthcheck.js.map +0 -1
- package/db.typeorm/dist/typeorm.errors-transformer.d.ts +0 -5
- package/db.typeorm/dist/typeorm.errors-transformer.js +0 -32
- package/db.typeorm/dist/typeorm.errors-transformer.js.map +0 -1
- package/db.typeorm/dist/typeorm.plugin.d.ts +0 -17
- package/db.typeorm/dist/typeorm.plugin.js +0 -81
- package/db.typeorm/dist/typeorm.plugin.js.map +0 -1
- package/db.typeorm/dist/types.d.ts +0 -14
- package/db.typeorm/dist/types.js +0 -18
- package/db.typeorm/dist/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,67 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [3.0.1-next.0](https://github.com/R-Vision/rsdk/compare/v3.0.0...v3.0.1-next.0) (2023-08-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsdk/db
|
|
9
|
+
|
|
10
|
+
## [3.0.0](https://github.com/R-Vision/rsdk/compare/v3.0.0-next.0...v3.0.0) (2023-08-04)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rsdk/db
|
|
13
|
+
|
|
14
|
+
## [3.0.0-next.0](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.16...v3.0.0-next.0) (2023-08-04)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @rsdk/db
|
|
17
|
+
|
|
18
|
+
# [2.6.0-next.16](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.15...v2.6.0-next.16) (2023-08-04)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @rsdk/db
|
|
21
|
+
|
|
22
|
+
# [2.6.0-next.15](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.14...v2.6.0-next.15) (2023-08-04)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @rsdk/db
|
|
25
|
+
|
|
26
|
+
# [2.6.0-next.13](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.12...v2.6.0-next.13) (2023-08-01)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @rsdk/db
|
|
29
|
+
|
|
30
|
+
# [2.6.0-next.12](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.11...v2.6.0-next.12) (2023-07-28)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @rsdk/db
|
|
33
|
+
|
|
34
|
+
# [2.6.0-next.11](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.10...v2.6.0-next.11) (2023-07-26)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @rsdk/db
|
|
37
|
+
|
|
38
|
+
# [2.6.0-next.10](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.9...v2.6.0-next.10) (2023-07-25)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @rsdk/db
|
|
41
|
+
|
|
42
|
+
# [2.6.0-next.9](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.8...v2.6.0-next.9) (2023-07-25)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @rsdk/db
|
|
45
|
+
|
|
46
|
+
# [2.6.0-next.8](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.7...v2.6.0-next.8) (2023-07-23)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @rsdk/db
|
|
49
|
+
|
|
50
|
+
# [2.6.0-next.7](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.6...v2.6.0-next.7) (2023-07-23)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @rsdk/db
|
|
53
|
+
|
|
54
|
+
# [2.6.0-next.6](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.5...v2.6.0-next.6) (2023-07-22)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @rsdk/db
|
|
57
|
+
|
|
58
|
+
# [2.6.0-next.5](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.4...v2.6.0-next.5) (2023-07-22)
|
|
59
|
+
|
|
60
|
+
**Note:** Version bump only for package @rsdk/db
|
|
61
|
+
|
|
62
|
+
# [2.6.0-next.3](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.2...v2.6.0-next.3) (2023-07-07)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @rsdk/db
|
|
65
|
+
|
|
66
|
+
# [2.6.0-next.1](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.0...v2.6.0-next.1) (2023-07-04)
|
|
7
67
|
|
|
8
68
|
**Note:** Version bump only for package @rsdk/db
|
|
9
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/db",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1-next.0",
|
|
4
4
|
"description": "Common functionality and interfaces for relational database plugins",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"prepublishOnly": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@rsdk/common": "^
|
|
17
|
-
"@rsdk/core": "^
|
|
18
|
-
"@rsdk/decorators": "^
|
|
16
|
+
"@rsdk/common": "^3.0.0",
|
|
17
|
+
"@rsdk/core": "^3.0.1-next.0",
|
|
18
|
+
"@rsdk/decorators": "^3.0.0"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "fc4e33568c2e79d62977fc6e17175e08893cb196"
|
|
21
21
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `extendme` Базовый транзакционный контекст
|
|
3
|
-
*/
|
|
4
|
-
export declare abstract class BaseContext<TIsolation> {
|
|
5
|
-
/**
|
|
6
|
-
* Указывает на то будут ли запросы к бд выполнены внутри транзакции
|
|
7
|
-
*/
|
|
8
|
-
readonly suspended?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Текущий уровень изоляции
|
|
11
|
-
*/
|
|
12
|
-
readonly isolationLevel?: TIsolation;
|
|
13
|
-
/**
|
|
14
|
-
* Возможные уровни изоляции отсортированные по строгости
|
|
15
|
-
*/
|
|
16
|
-
abstract readonly isolationLevels: readonly TIsolation[];
|
|
17
|
-
/**
|
|
18
|
-
* @param suspendedOrIsolationLevel будет ли создаваться/использовать транзакция в рамках этого контекста,
|
|
19
|
-
* это не значит что транзакцию нельзя будет создать, но если внешний контекст был задан с транзакцией,
|
|
20
|
-
* то внутри этого контекста будут отдаваться соединения без транзакции
|
|
21
|
-
* или уровень изоляции внутри этого контекста
|
|
22
|
-
* @protected
|
|
23
|
-
*/
|
|
24
|
-
protected constructor(suspendedOrIsolationLevel: true | TIsolation);
|
|
25
|
-
/**
|
|
26
|
-
* Проверка на совместимость переданного уровня изоляции с тем который уже задан в контексте
|
|
27
|
-
* @param isolationLevel
|
|
28
|
-
*/
|
|
29
|
-
assertIsolationCompatibility(isolationLevel?: TIsolation): void;
|
|
30
|
-
}
|
package/db/dist/context.base.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseContext = void 0;
|
|
4
|
-
const core_1 = require("@rsdk/core");
|
|
5
|
-
const exceptions_1 = require("./exceptions");
|
|
6
|
-
/**
|
|
7
|
-
* `extendme` Базовый транзакционный контекст
|
|
8
|
-
*/
|
|
9
|
-
class BaseContext {
|
|
10
|
-
/**
|
|
11
|
-
* Указывает на то будут ли запросы к бд выполнены внутри транзакции
|
|
12
|
-
*/
|
|
13
|
-
suspended;
|
|
14
|
-
/**
|
|
15
|
-
* Текущий уровень изоляции
|
|
16
|
-
*/
|
|
17
|
-
isolationLevel;
|
|
18
|
-
/**
|
|
19
|
-
* @param suspendedOrIsolationLevel будет ли создаваться/использовать транзакция в рамках этого контекста,
|
|
20
|
-
* это не значит что транзакцию нельзя будет создать, но если внешний контекст был задан с транзакцией,
|
|
21
|
-
* то внутри этого контекста будут отдаваться соединения без транзакции
|
|
22
|
-
* или уровень изоляции внутри этого контекста
|
|
23
|
-
* @protected
|
|
24
|
-
*/
|
|
25
|
-
constructor(suspendedOrIsolationLevel) {
|
|
26
|
-
if (typeof suspendedOrIsolationLevel === 'boolean') {
|
|
27
|
-
this.suspended = suspendedOrIsolationLevel;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.isolationLevel = suspendedOrIsolationLevel;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Проверка на совместимость переданного уровня изоляции с тем который уже задан в контексте
|
|
35
|
-
* @param isolationLevel
|
|
36
|
-
*/
|
|
37
|
-
assertIsolationCompatibility(isolationLevel) {
|
|
38
|
-
if (!isolationLevel) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (this.isolationLevel === undefined) {
|
|
42
|
-
throw new core_1.InternalException('Isolation level not defined');
|
|
43
|
-
}
|
|
44
|
-
const currentIndex = this.isolationLevels.indexOf(this.isolationLevel);
|
|
45
|
-
const neededIndex = this.isolationLevels.indexOf(isolationLevel);
|
|
46
|
-
if (neededIndex > currentIndex) {
|
|
47
|
-
throw new exceptions_1.IncompatibleIsolationLevels(this.isolationLevel, isolationLevel);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.BaseContext = BaseContext;
|
|
52
|
-
//# sourceMappingURL=context.base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.base.js","sourceRoot":"","sources":["../src/context.base.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAE/C,6CAA2D;AAE3D;;GAEG;AACH,MAAsB,WAAW;IAC/B;;OAEG;IACM,SAAS,CAAW;IAE7B;;OAEG;IACM,cAAc,CAAc;IAOrC;;;;;;OAMG;IACH,YAAsB,yBAA4C;QAChE,IAAI,OAAO,yBAAyB,KAAK,SAAS,EAAE;YAClD,IAAI,CAAC,SAAS,GAAG,yBAAyB,CAAC;SAC5C;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,yBAAyB,CAAC;SACjD;IACH,CAAC;IAED;;;OAGG;IACH,4BAA4B,CAAC,cAA2B;QACtD,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE;YACrC,MAAM,IAAI,wBAAiB,CAAC,6BAA6B,CAAC,CAAC;SAC5D;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACjE,IAAI,WAAW,GAAG,YAAY,EAAE;YAC9B,MAAM,IAAI,wCAA2B,CACnC,IAAI,CAAC,cAAc,EACnB,cAAc,CACf,CAAC;SACH;IACH,CAAC;CACF;AArDD,kCAqDC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Обертка вокруг `AsyncLocalStorage`
|
|
3
|
-
* В теории можно запустить с пустым `payload`, для того чтобы добавлять
|
|
4
|
-
* значения в процессе
|
|
5
|
-
*/
|
|
6
|
-
export declare class ContextStorage<P> {
|
|
7
|
-
private asyncLocalStorage;
|
|
8
|
-
/**
|
|
9
|
-
* Получает новое значение в контекст
|
|
10
|
-
*/
|
|
11
|
-
getContext(): P | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Запускает переданную фунцию в контексте
|
|
14
|
-
* @template TResult
|
|
15
|
-
* @template TArgs
|
|
16
|
-
* @param context Контекст исполнения (данные)
|
|
17
|
-
* @param fn Функция для запуска
|
|
18
|
-
* @param args Аргументы функции
|
|
19
|
-
* @returns Результат выполнения функции
|
|
20
|
-
*/
|
|
21
|
-
run<TResult, TArgs extends any[]>(context: P, fn: (...args: TArgs) => TResult, ...args: TArgs): TResult;
|
|
22
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextStorage = void 0;
|
|
4
|
-
const node_async_hooks_1 = require("node:async_hooks");
|
|
5
|
-
/**
|
|
6
|
-
* Обертка вокруг `AsyncLocalStorage`
|
|
7
|
-
* В теории можно запустить с пустым `payload`, для того чтобы добавлять
|
|
8
|
-
* значения в процессе
|
|
9
|
-
*/
|
|
10
|
-
class ContextStorage {
|
|
11
|
-
asyncLocalStorage = new node_async_hooks_1.AsyncLocalStorage();
|
|
12
|
-
/**
|
|
13
|
-
* Получает новое значение в контекст
|
|
14
|
-
*/
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.asyncLocalStorage.getStore()?.context;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Запускает переданную фунцию в контексте
|
|
20
|
-
* @template TResult
|
|
21
|
-
* @template TArgs
|
|
22
|
-
* @param context Контекст исполнения (данные)
|
|
23
|
-
* @param fn Функция для запуска
|
|
24
|
-
* @param args Аргументы функции
|
|
25
|
-
* @returns Результат выполнения функции
|
|
26
|
-
*/
|
|
27
|
-
run(context, fn, ...args) {
|
|
28
|
-
return this.asyncLocalStorage.run({ context }, fn, ...args);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ContextStorage = ContextStorage;
|
|
32
|
-
//# sourceMappingURL=context.storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.storage.js","sourceRoot":"","sources":["../src/context.storage.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAErD;;;;GAIG;AACH,MAAa,cAAc;IACjB,iBAAiB,GAAG,IAAI,oCAAiB,EAAkB,CAAC;IAEpE;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CACD,OAAU,EACV,EAA+B,EAC/B,GAAG,IAAW;QAEd,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9D,CAAC;CACF;AA1BD,wCA0BC"}
|
package/db/dist/exceptions.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { InternalException } from '@rsdk/core';
|
|
2
|
-
export declare class IncompatibleIsolationLevels<TIsolation> extends InternalException {
|
|
3
|
-
constructor(current: TIsolation, requested: TIsolation);
|
|
4
|
-
}
|
|
5
|
-
export declare class CallOutOfContextWithMandatory extends InternalException {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
8
|
-
export declare class NeverRunningInTransaction extends InternalException {
|
|
9
|
-
constructor();
|
|
10
|
-
}
|
package/db/dist/exceptions.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NeverRunningInTransaction = exports.CallOutOfContextWithMandatory = exports.IncompatibleIsolationLevels = void 0;
|
|
4
|
-
const core_1 = require("@rsdk/core");
|
|
5
|
-
class IncompatibleIsolationLevels extends core_1.InternalException {
|
|
6
|
-
constructor(current, requested) {
|
|
7
|
-
super('Incompatible isolation levels', {
|
|
8
|
-
details: { current, requested },
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.IncompatibleIsolationLevels = IncompatibleIsolationLevels;
|
|
13
|
-
class CallOutOfContextWithMandatory extends core_1.InternalException {
|
|
14
|
-
constructor() {
|
|
15
|
-
super('Call out of context with mandatory');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.CallOutOfContextWithMandatory = CallOutOfContextWithMandatory;
|
|
19
|
-
class NeverRunningInTransaction extends core_1.InternalException {
|
|
20
|
-
constructor() {
|
|
21
|
-
super('Run in transaction, but propagation never');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.NeverRunningInTransaction = NeverRunningInTransaction;
|
|
25
|
-
//# sourceMappingURL=exceptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAE/C,MAAa,2BAAwC,SAAQ,wBAAiB;IAC5E,YAAY,OAAmB,EAAE,SAAqB;QACpD,KAAK,CAAC,+BAA+B,EAAE;YACrC,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;CACF;AAND,kEAMC;AAED,MAAa,6BAA8B,SAAQ,wBAAiB;IAClE;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,sEAIC;AAED,MAAa,yBAA0B,SAAQ,wBAAiB;IAC9D;QACE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrD,CAAC;CACF;AAJD,8DAIC"}
|
package/db/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { ContextStorage } from './context.storage';
|
|
2
|
-
export { BaseContext } from './context.base';
|
|
3
|
-
export { TransactionalStrategy, CallBack } from './types';
|
|
4
|
-
export { NeverRunningInTransaction, CallOutOfContextWithMandatory, IncompatibleIsolationLevels, } from './exceptions';
|
|
5
|
-
export { TransactionRunner } from './transactional.runner';
|
|
6
|
-
export { Propagation } from './propagation.enum';
|
package/db/dist/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Propagation = exports.TransactionRunner = exports.IncompatibleIsolationLevels = exports.CallOutOfContextWithMandatory = exports.NeverRunningInTransaction = exports.BaseContext = exports.ContextStorage = void 0;
|
|
4
|
-
var context_storage_1 = require("./context.storage");
|
|
5
|
-
Object.defineProperty(exports, "ContextStorage", { enumerable: true, get: function () { return context_storage_1.ContextStorage; } });
|
|
6
|
-
var context_base_1 = require("./context.base");
|
|
7
|
-
Object.defineProperty(exports, "BaseContext", { enumerable: true, get: function () { return context_base_1.BaseContext; } });
|
|
8
|
-
var exceptions_1 = require("./exceptions");
|
|
9
|
-
Object.defineProperty(exports, "NeverRunningInTransaction", { enumerable: true, get: function () { return exceptions_1.NeverRunningInTransaction; } });
|
|
10
|
-
Object.defineProperty(exports, "CallOutOfContextWithMandatory", { enumerable: true, get: function () { return exceptions_1.CallOutOfContextWithMandatory; } });
|
|
11
|
-
Object.defineProperty(exports, "IncompatibleIsolationLevels", { enumerable: true, get: function () { return exceptions_1.IncompatibleIsolationLevels; } });
|
|
12
|
-
var transactional_runner_1 = require("./transactional.runner");
|
|
13
|
-
Object.defineProperty(exports, "TransactionRunner", { enumerable: true, get: function () { return transactional_runner_1.TransactionRunner; } });
|
|
14
|
-
var propagation_enum_1 = require("./propagation.enum");
|
|
15
|
-
Object.defineProperty(exports, "Propagation", { enumerable: true, get: function () { return propagation_enum_1.Propagation; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
package/db/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AAEpB,2CAIsB;AAHpB,uHAAA,yBAAyB,OAAA;AACzB,2HAAA,6BAA6B,OAAA;AAC7B,yHAAA,2BAA2B,OAAA;AAE7B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,uDAAiD;AAAxC,+GAAA,WAAW,OAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare enum Propagation {
|
|
2
|
-
/**
|
|
3
|
-
* Support a current transaction, throw an exception if none exists.
|
|
4
|
-
*/
|
|
5
|
-
MANDATORY = 0,
|
|
6
|
-
/**
|
|
7
|
-
* Execute within a nested transaction if a current transaction exists, behave like REQUIRED else.
|
|
8
|
-
*/
|
|
9
|
-
NESTED = 1,
|
|
10
|
-
/**
|
|
11
|
-
* Execute non-transactionally, throw an exception if a transaction exists.
|
|
12
|
-
*/
|
|
13
|
-
NEVER = 2,
|
|
14
|
-
/**
|
|
15
|
-
* Execute non-transactionally, suspend the current transaction if one exists.
|
|
16
|
-
*/
|
|
17
|
-
NOT_SUPPORTED = 3,
|
|
18
|
-
/**
|
|
19
|
-
* (default behaviour) - Support a current transaction, create a new one if none exists.
|
|
20
|
-
*/
|
|
21
|
-
REQUIRED = 4,
|
|
22
|
-
/**
|
|
23
|
-
* Create a new transaction, and suspend the current transaction if one exists.
|
|
24
|
-
*/
|
|
25
|
-
REQUIRES_NEW = 5,
|
|
26
|
-
/**
|
|
27
|
-
* Support a current transaction, execute non-transactionally if none exists.
|
|
28
|
-
*/
|
|
29
|
-
SUPPORTS = 6
|
|
30
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Propagation = void 0;
|
|
4
|
-
var Propagation;
|
|
5
|
-
(function (Propagation) {
|
|
6
|
-
/**
|
|
7
|
-
* Support a current transaction, throw an exception if none exists.
|
|
8
|
-
*/
|
|
9
|
-
Propagation[Propagation["MANDATORY"] = 0] = "MANDATORY";
|
|
10
|
-
/**
|
|
11
|
-
* Execute within a nested transaction if a current transaction exists, behave like REQUIRED else.
|
|
12
|
-
*/
|
|
13
|
-
Propagation[Propagation["NESTED"] = 1] = "NESTED";
|
|
14
|
-
/**
|
|
15
|
-
* Execute non-transactionally, throw an exception if a transaction exists.
|
|
16
|
-
*/
|
|
17
|
-
Propagation[Propagation["NEVER"] = 2] = "NEVER";
|
|
18
|
-
/**
|
|
19
|
-
* Execute non-transactionally, suspend the current transaction if one exists.
|
|
20
|
-
*/
|
|
21
|
-
Propagation[Propagation["NOT_SUPPORTED"] = 3] = "NOT_SUPPORTED";
|
|
22
|
-
/**
|
|
23
|
-
* (default behaviour) - Support a current transaction, create a new one if none exists.
|
|
24
|
-
*/
|
|
25
|
-
Propagation[Propagation["REQUIRED"] = 4] = "REQUIRED";
|
|
26
|
-
/**
|
|
27
|
-
* Create a new transaction, and suspend the current transaction if one exists.
|
|
28
|
-
*/
|
|
29
|
-
Propagation[Propagation["REQUIRES_NEW"] = 5] = "REQUIRES_NEW";
|
|
30
|
-
/**
|
|
31
|
-
* Support a current transaction, execute non-transactionally if none exists.
|
|
32
|
-
*/
|
|
33
|
-
Propagation[Propagation["SUPPORTS"] = 6] = "SUPPORTS";
|
|
34
|
-
})(Propagation || (exports.Propagation = Propagation = {}));
|
|
35
|
-
//# sourceMappingURL=propagation.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"propagation.enum.js","sourceRoot":"","sources":["../src/propagation.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAmCX;AAnCD,WAAY,WAAW;IACrB;;OAEG;IACH,uDAAS,CAAA;IAET;;OAEG;IACH,iDAAM,CAAA;IAEN;;OAEG;IACH,+CAAK,CAAA;IAEL;;OAEG;IACH,+DAAa,CAAA;IAEb;;OAEG;IACH,qDAAQ,CAAA;IAER;;OAEG;IACH,6DAAY,CAAA;IAEZ;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAnCW,WAAW,2BAAX,WAAW,QAmCtB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { BaseContext } from './context.base';
|
|
2
|
-
import { Propagation } from './propagation.enum';
|
|
3
|
-
import type { TransactionalStrategy } from './types';
|
|
4
|
-
export declare class TransactionRunner<TIsolation extends string, TContext extends BaseContext<TIsolation>> {
|
|
5
|
-
private readonly strategy;
|
|
6
|
-
private static defaultPropagation;
|
|
7
|
-
constructor(strategy: TransactionalStrategy<TIsolation, TContext>);
|
|
8
|
-
/**
|
|
9
|
-
* Вызовы метода будут обернуты в transactional context
|
|
10
|
-
*/
|
|
11
|
-
Transactional(payload?: {
|
|
12
|
-
isolation?: TIsolation;
|
|
13
|
-
propagation?: Propagation;
|
|
14
|
-
}): MethodDecorator;
|
|
15
|
-
transactional<TResult>(...args: [fn: () => TResult]): Promise<TResult>;
|
|
16
|
-
transactional<TResult>(...args: [isolation: TIsolation, fn: () => TResult]): Promise<TResult>;
|
|
17
|
-
transactional<TResult>(...args: [fn: () => TResult] | [
|
|
18
|
-
runOptions: {
|
|
19
|
-
isolation: TIsolation;
|
|
20
|
-
propagation: Propagation;
|
|
21
|
-
},
|
|
22
|
-
fn: () => TResult
|
|
23
|
-
]): Promise<TResult>;
|
|
24
|
-
/**
|
|
25
|
-
* Вернет функцию, которая вызовет переданный коллбек в transactional context
|
|
26
|
-
*/
|
|
27
|
-
private bindTransactional;
|
|
28
|
-
private parseRunArgs;
|
|
29
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransactionRunner = void 0;
|
|
4
|
-
const common_1 = require("@rsdk/common");
|
|
5
|
-
const decorators_1 = require("@rsdk/decorators");
|
|
6
|
-
const exceptions_1 = require("./exceptions");
|
|
7
|
-
const propagation_enum_1 = require("./propagation.enum");
|
|
8
|
-
class TransactionRunner {
|
|
9
|
-
strategy;
|
|
10
|
-
static defaultPropagation = propagation_enum_1.Propagation.REQUIRED;
|
|
11
|
-
constructor(strategy) {
|
|
12
|
-
this.strategy = strategy;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Вызовы метода будут обернуты в transactional context
|
|
16
|
-
*/
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18
|
-
Transactional(payload) {
|
|
19
|
-
const { isolation, propagation = TransactionRunner.defaultPropagation } = payload ?? {};
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
21
|
-
const runner = this;
|
|
22
|
-
return function (_, __, descriptor) {
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
24
|
-
const original = descriptor.value;
|
|
25
|
-
descriptor.value = function (...args) {
|
|
26
|
-
const bindedOriginal = original.bind(this, ...args);
|
|
27
|
-
return runner.bindTransactional(bindedOriginal, {
|
|
28
|
-
isolation: isolation,
|
|
29
|
-
propagation,
|
|
30
|
-
})();
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(descriptor.value, 'name', {
|
|
33
|
-
value: original.name,
|
|
34
|
-
writable: false,
|
|
35
|
-
});
|
|
36
|
-
(0, decorators_1.redecorate)(original, descriptor.value);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
transactional(...args) {
|
|
40
|
-
const { fn, isolation, propagation } = this.parseRunArgs(args);
|
|
41
|
-
return this.bindTransactional(fn, {
|
|
42
|
-
propagation,
|
|
43
|
-
isolation,
|
|
44
|
-
})();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Вернет функцию, которая вызовет переданный коллбек в transactional context
|
|
48
|
-
*/
|
|
49
|
-
bindTransactional(fn, payload) {
|
|
50
|
-
const { propagation = TransactionRunner.defaultPropagation, isolation } = payload ?? {};
|
|
51
|
-
return async (...args) => {
|
|
52
|
-
const bindedFn = () => fn(...args);
|
|
53
|
-
const currentContext = this.strategy.getContext();
|
|
54
|
-
switch (propagation) {
|
|
55
|
-
case propagation_enum_1.Propagation.REQUIRES_NEW:
|
|
56
|
-
return this.strategy.runFromNewContext(isolation, fn, ...args);
|
|
57
|
-
case propagation_enum_1.Propagation.NEVER:
|
|
58
|
-
if (currentContext && !currentContext.suspended) {
|
|
59
|
-
throw new exceptions_1.NeverRunningInTransaction();
|
|
60
|
-
}
|
|
61
|
-
if (currentContext) {
|
|
62
|
-
return bindedFn();
|
|
63
|
-
}
|
|
64
|
-
return this.strategy.runOutTransactionalContext(fn, ...args);
|
|
65
|
-
case propagation_enum_1.Propagation.MANDATORY:
|
|
66
|
-
if (!currentContext || currentContext.suspended) {
|
|
67
|
-
throw new exceptions_1.CallOutOfContextWithMandatory();
|
|
68
|
-
}
|
|
69
|
-
currentContext.assertIsolationCompatibility(isolation);
|
|
70
|
-
return bindedFn();
|
|
71
|
-
case propagation_enum_1.Propagation.NESTED:
|
|
72
|
-
if (!currentContext || currentContext.suspended) {
|
|
73
|
-
return await this.strategy.runFromNewContext(isolation, fn, ...args);
|
|
74
|
-
}
|
|
75
|
-
return await this.strategy.nestedExecute(currentContext, isolation, fn, ...args);
|
|
76
|
-
case propagation_enum_1.Propagation.NOT_SUPPORTED:
|
|
77
|
-
if (currentContext?.suspended) {
|
|
78
|
-
return bindedFn();
|
|
79
|
-
}
|
|
80
|
-
return this.strategy.runOutTransactionalContext(fn, ...args);
|
|
81
|
-
case propagation_enum_1.Propagation.REQUIRED:
|
|
82
|
-
if (!currentContext || currentContext.suspended) {
|
|
83
|
-
return await this.strategy.runFromNewContext(isolation, fn, ...args);
|
|
84
|
-
}
|
|
85
|
-
currentContext.assertIsolationCompatibility(isolation);
|
|
86
|
-
return bindedFn();
|
|
87
|
-
case propagation_enum_1.Propagation.SUPPORTS:
|
|
88
|
-
return bindedFn();
|
|
89
|
-
default:
|
|
90
|
-
return (0, common_1.unreachable)(propagation);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
parseRunArgs(args) {
|
|
95
|
-
if (args.length === 1) {
|
|
96
|
-
return {
|
|
97
|
-
fn: args[0],
|
|
98
|
-
propagation: TransactionRunner.defaultPropagation,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (typeof args[0] === 'object' &&
|
|
102
|
-
args[0] !== null &&
|
|
103
|
-
'isolation' in args[0] &&
|
|
104
|
-
'propagation' in args[0]) {
|
|
105
|
-
return {
|
|
106
|
-
isolation: args[0].isolation,
|
|
107
|
-
fn: args[1],
|
|
108
|
-
propagation: args[0].propagation,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
isolation: args[0],
|
|
113
|
-
fn: args[1],
|
|
114
|
-
propagation: TransactionRunner.defaultPropagation,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.TransactionRunner = TransactionRunner;
|
|
119
|
-
//# sourceMappingURL=transactional.runner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transactional.runner.js","sourceRoot":"","sources":["../src/transactional.runner.ts"],"names":[],"mappings":"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"}
|
package/db/dist/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { BaseContext } from './context.base';
|
|
2
|
-
export type CallBack<TArgs extends any[], TResult> = (...args: TArgs) => TResult;
|
|
3
|
-
export interface TransactionalStrategy<TIsolation extends string, TContext extends BaseContext<TIsolation>> {
|
|
4
|
-
bindContext<TResult, TArgs extends any[]>(fn: CallBack<TArgs, TResult>, options?: TIsolation): CallBack<TArgs, Promise<TResult>>;
|
|
5
|
-
isRunning(): boolean;
|
|
6
|
-
getContext(): TContext | undefined;
|
|
7
|
-
runFromNewContext<TArgs extends any[], TResult>(options: TIsolation | undefined, fn: (...args: TArgs) => TResult, ...args: any[]): Promise<TResult>;
|
|
8
|
-
runOutTransactionalContext<TArgs extends any[], TResult>(fn: (...args: TArgs) => TResult, ...args: any[]): Promise<TResult>;
|
|
9
|
-
nestedExecute<TArgs extends any[], TResult>(currentContext: TContext, options: TIsolation | undefined, fn: (...args: TArgs) => TResult, ...param4: any[]): Promise<TResult>;
|
|
10
|
-
}
|
package/db/dist/types.js
DELETED
package/db/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/db.knex/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TransactionRunner } from '@rsdk/db';
|
|
2
|
-
export { KnexPlugin } from './knex.plugin';
|
|
3
|
-
export { InjectKnex, KNEX_INJECTION_TOKEN } from './inject-knex.decorator';
|
|
4
|
-
export { IsolationLevel } from './types';
|
|
5
|
-
export declare const Runner: TransactionRunner<import("./types").IsolationLevel, import("./internal/context").KnexContext>;
|
|
6
|
-
export declare const Transactional: (payload?: {
|
|
7
|
-
isolation?: import("./types").IsolationLevel;
|
|
8
|
-
propagation?: import("@rsdk/db").Propagation;
|
|
9
|
-
} | undefined) => MethodDecorator;
|
package/db.knex/dist/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Transactional = exports.Runner = exports.IsolationLevel = exports.KNEX_INJECTION_TOKEN = exports.InjectKnex = exports.KnexPlugin = void 0;
|
|
4
|
-
const db_1 = require("@rsdk/db");
|
|
5
|
-
const strategy_1 = require("./internal/strategy");
|
|
6
|
-
var knex_plugin_1 = require("./knex.plugin");
|
|
7
|
-
Object.defineProperty(exports, "KnexPlugin", { enumerable: true, get: function () { return knex_plugin_1.KnexPlugin; } });
|
|
8
|
-
var inject_knex_decorator_1 = require("./inject-knex.decorator");
|
|
9
|
-
Object.defineProperty(exports, "InjectKnex", { enumerable: true, get: function () { return inject_knex_decorator_1.InjectKnex; } });
|
|
10
|
-
Object.defineProperty(exports, "KNEX_INJECTION_TOKEN", { enumerable: true, get: function () { return inject_knex_decorator_1.KNEX_INJECTION_TOKEN; } });
|
|
11
|
-
var types_1 = require("./types");
|
|
12
|
-
Object.defineProperty(exports, "IsolationLevel", { enumerable: true, get: function () { return types_1.IsolationLevel; } });
|
|
13
|
-
exports.Runner = new db_1.TransactionRunner(new strategy_1.KnexTransactionalStrategy());
|
|
14
|
-
exports.Transactional = exports.Runner.Transactional.bind(exports.Runner);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6C;AAE7C,kDAAgE;AAEhE,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,iEAA2E;AAAlE,mHAAA,UAAU,OAAA;AAAE,6HAAA,oBAAoB,OAAA;AACzC,iCAAyC;AAAhC,uGAAA,cAAc,OAAA;AAEV,QAAA,MAAM,GAAG,IAAI,sBAAiB,CAAC,IAAI,oCAAyB,EAAE,CAAC,CAAC;AAChE,QAAA,aAAa,GAAG,cAAM,CAAC,aAAa,CAAC,IAAI,CAAC,cAAM,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectKnex = exports.KNEX_INJECTION_TOKEN = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.KNEX_INJECTION_TOKEN = Symbol('Knex');
|
|
6
|
-
const InjectKnex = () => (0, common_1.Inject)(exports.KNEX_INJECTION_TOKEN);
|
|
7
|
-
exports.InjectKnex = InjectKnex;
|
|
8
|
-
//# sourceMappingURL=inject-knex.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject-knex.decorator.js","sourceRoot":"","sources":["../src/inject-knex.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAE3B,QAAA,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE5C,MAAM,UAAU,GAAG,GAAuB,EAAE,CACjD,IAAA,eAAM,EAAC,4BAAoB,CAAC,CAAC;AADlB,QAAA,UAAU,cACQ"}
|