kool-koala 1.5.0 → 1.5.1
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/bin/kool-koala.js
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require(
|
|
2
|
+
const yargs = require('yargs');
|
|
3
|
+
const { hideBin } = require('yargs/helpers');
|
|
4
|
+
const { printKoalaArt } = require('../index');
|
|
5
|
+
|
|
6
|
+
const argv = yargs(hideBin(process.argv))
|
|
7
|
+
.scriptName('npx kool-koala')
|
|
8
|
+
.command('*', 'Default command', (yargs) => {
|
|
9
|
+
printKoalaArt();
|
|
10
|
+
})
|
|
11
|
+
.usage('$0 [args]')
|
|
12
|
+
.help('h')
|
|
13
|
+
.alias('h', 'help').argv;
|
|
@@ -12,6 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.transactionMiddleware = void 0;
|
|
13
13
|
const common_1 = require("../common");
|
|
14
14
|
const transactionMiddleware = (context, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
if (!common_1.KoalApp.getInstance().getConfiguration().getDatabase()) {
|
|
16
|
+
yield next();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
15
19
|
const queryRunner = common_1.KoalApp.getInstance().getDatabaseConnection().createQueryRunner();
|
|
16
20
|
context.state.queryRunner = queryRunner;
|
|
17
21
|
queryRunner.startTransaction();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/../src/middlewares/transaction-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,sCAAoC;AAE7B,MAAM,qBAAqB,GAAsB,CAAO,OAAO,EAAE,IAAI,EAAE,EAAE;IAC9E,MAAM,WAAW,GAAG,gBAAO,CAAC,WAAW,EAAE,CAAC,qBAAqB,EAAE,CAAC,iBAAiB,EAAE,CAAC;IACtF,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;IACxC,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,WAAW,CAAC,mBAAmB,EAAE,CAAC;QACxC,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC,CAAA,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/../src/middlewares/transaction-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,sCAAoC;AAE7B,MAAM,qBAAqB,GAAsB,CAAO,OAAO,EAAE,IAAI,EAAE,EAAE;IAC9E,IAAI,CAAC,gBAAO,CAAC,WAAW,EAAE,CAAC,gBAAgB,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QAC5D,MAAM,IAAI,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IACD,MAAM,WAAW,GAAG,gBAAO,CAAC,WAAW,EAAE,CAAC,qBAAqB,EAAE,CAAC,iBAAiB,EAAE,CAAC;IACtF,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;IACxC,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,WAAW,CAAC,mBAAmB,EAAE,CAAC;QACxC,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC,CAAA,CAAC;AAjBW,QAAA,qBAAqB,yBAiBhC","file":"transaction-middleware.js","sourcesContent":["import { Middleware } from \"koa\";\nimport { State } from \"../types/common/state\";\nimport { KoalApp } from \"../common\";\n\nexport const transactionMiddleware: Middleware<State> = async (context, next) => {\n if (!KoalApp.getInstance().getConfiguration().getDatabase()) {\n await next();\n return;\n }\n const queryRunner = KoalApp.getInstance().getDatabaseConnection().createQueryRunner();\n context.state.queryRunner = queryRunner;\n queryRunner.startTransaction();\n try {\n await next();\n await queryRunner.commitTransaction();\n } catch (error) {\n await queryRunner.rollbackTransaction();\n throw error;\n } finally {\n await queryRunner.release();\n }\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kool-koala",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Full-stack framework to create NodeJS applications on server side and Angular applications on the client side with ease.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
"rimraf": "^6.0.1",
|
|
58
58
|
"semantic-release": "^24.2.3",
|
|
59
59
|
"sqlite3": "^5.1.7",
|
|
60
|
-
"ts-node": "^10.9.2"
|
|
61
|
-
"yargs": "^17.7.2"
|
|
60
|
+
"ts-node": "^10.9.2"
|
|
62
61
|
},
|
|
63
62
|
"config": {
|
|
64
63
|
"commitizen": {
|
|
@@ -76,6 +75,7 @@
|
|
|
76
75
|
"koa-router": "^13.0.1",
|
|
77
76
|
"koa-static": "^5.0.0",
|
|
78
77
|
"reflect-metadata": "^0.2.2",
|
|
79
|
-
"typeorm": "^0.3.22"
|
|
78
|
+
"typeorm": "^0.3.22",
|
|
79
|
+
"yargs": "^17.7.2"
|
|
80
80
|
}
|
|
81
81
|
}
|