vona-module-a-core 5.0.148 → 5.0.150
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/dist/index.js +39 -41
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { BeanInfo, BeanBase, BeanScopeBase } from 'vona';
|
|
2
|
+
import { __decorate } from 'tslib';
|
|
2
3
|
import { Middleware, MiddlewareSystem, Aspect } from 'vona-module-a-aspect';
|
|
3
4
|
import overrideMethodImport from 'koa-override';
|
|
4
5
|
import { Bean, Scope } from 'vona-module-a-bean';
|
|
5
6
|
import { Meta } from 'vona-module-a-meta';
|
|
6
7
|
import { BeanStaticBase } from 'vona-module-a-static';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
let MiddlewareGate = (_dec$6 = Middleware({
|
|
10
|
-
global: true
|
|
11
|
-
}), _dec2$6 = BeanInfo({
|
|
12
|
-
module: "a-core"
|
|
13
|
-
}), _dec$6(_class$6 = _dec2$6(_class$6 = class MiddlewareGate extends BeanBase {
|
|
9
|
+
let MiddlewareGate = class MiddlewareGate extends BeanBase {
|
|
14
10
|
async execute(options, next) {
|
|
15
11
|
// check gate
|
|
16
12
|
if (!this.app.bean.onion.checkOnionOptionsMeta(options.gate)) {
|
|
@@ -19,21 +15,20 @@ let MiddlewareGate = (_dec$6 = Middleware({
|
|
|
19
15
|
// next
|
|
20
16
|
return next();
|
|
21
17
|
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dependencies: 'a-logger:httpLog'
|
|
27
|
-
}), _dec2$5 = BeanInfo({
|
|
18
|
+
};
|
|
19
|
+
MiddlewareGate = __decorate([Middleware({
|
|
20
|
+
global: true
|
|
21
|
+
}), BeanInfo({
|
|
28
22
|
module: "a-core"
|
|
29
|
-
}),
|
|
23
|
+
})], MiddlewareGate);
|
|
24
|
+
|
|
25
|
+
let MiddlewareSystemNotfound = class MiddlewareSystemNotfound extends BeanBase {
|
|
30
26
|
async execute(options, next) {
|
|
31
27
|
const ctx = this.ctx;
|
|
32
28
|
await next();
|
|
33
29
|
if (ctx.status !== 404 || ctx.body) {
|
|
34
30
|
return;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
// set status first, make sure set body not set status
|
|
38
33
|
ctx.status = 404;
|
|
39
34
|
if (ctx.acceptJSON) {
|
|
@@ -43,7 +38,6 @@ let MiddlewareSystemNotfound = (_dec$5 = MiddlewareSystem({
|
|
|
43
38
|
return;
|
|
44
39
|
}
|
|
45
40
|
const notFoundHtml = '<h1>404 Not Found</h1>';
|
|
46
|
-
|
|
47
41
|
// notfound handler is unimplemented
|
|
48
42
|
if (options.pageUrl && ctx.path === options.pageUrl) {
|
|
49
43
|
ctx.body = `${notFoundHtml}<p><pre><code>config.notfound.pageUrl(${options.pageUrl})</code></pre> is unimplemented</p>`;
|
|
@@ -56,16 +50,15 @@ let MiddlewareSystemNotfound = (_dec$5 = MiddlewareSystem({
|
|
|
56
50
|
}
|
|
57
51
|
ctx.body = notFoundHtml;
|
|
58
52
|
}
|
|
59
|
-
}
|
|
53
|
+
};
|
|
54
|
+
MiddlewareSystemNotfound = __decorate([MiddlewareSystem({
|
|
55
|
+
dependencies: 'a-logger:httpLog'
|
|
56
|
+
}), BeanInfo({
|
|
57
|
+
module: "a-core"
|
|
58
|
+
})], MiddlewareSystemNotfound);
|
|
60
59
|
|
|
61
|
-
var _dec$4, _dec2$4, _class$4;
|
|
62
60
|
const overrideMethod = overrideMethodImport;
|
|
63
|
-
let MiddlewareSystemOverrideMethod =
|
|
64
|
-
dependencies: 'a-core:notfound',
|
|
65
|
-
allowedMethods: ['POST']
|
|
66
|
-
}), _dec2$4 = BeanInfo({
|
|
67
|
-
module: "a-core"
|
|
68
|
-
}), _dec$4(_class$4 = _dec2$4(_class$4 = class MiddlewareSystemOverrideMethod extends BeanBase {
|
|
61
|
+
let MiddlewareSystemOverrideMethod = class MiddlewareSystemOverrideMethod extends BeanBase {
|
|
69
62
|
constructor(...args) {
|
|
70
63
|
super(...args);
|
|
71
64
|
this._overrideMethod = void 0;
|
|
@@ -76,12 +69,15 @@ let MiddlewareSystemOverrideMethod = (_dec$4 = MiddlewareSystem({
|
|
|
76
69
|
}
|
|
77
70
|
return this._overrideMethod(this.ctx, next);
|
|
78
71
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
};
|
|
73
|
+
MiddlewareSystemOverrideMethod = __decorate([MiddlewareSystem({
|
|
74
|
+
dependencies: 'a-core:notfound',
|
|
75
|
+
allowedMethods: ['POST']
|
|
76
|
+
}), BeanInfo({
|
|
83
77
|
module: "a-core"
|
|
84
|
-
}),
|
|
78
|
+
})], MiddlewareSystemOverrideMethod);
|
|
79
|
+
|
|
80
|
+
let BeanCore = class BeanCore extends BeanBase {
|
|
85
81
|
get protocol() {
|
|
86
82
|
return this.app.util.protocol;
|
|
87
83
|
}
|
|
@@ -94,30 +90,32 @@ let BeanCore = (_dec$3 = Bean(), _dec2$3 = BeanInfo({
|
|
|
94
90
|
getAbsoluteUrlByApiPath(path) {
|
|
95
91
|
return this.app.util.getAbsoluteUrlByApiPath(path);
|
|
96
92
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var _dec$2, _dec2$2, _class$2;
|
|
100
|
-
let MetaRuntime = (_dec$2 = Meta(), _dec2$2 = BeanInfo({
|
|
93
|
+
};
|
|
94
|
+
BeanCore = __decorate([Bean(), BeanInfo({
|
|
101
95
|
module: "a-core"
|
|
102
|
-
}),
|
|
96
|
+
})], BeanCore);
|
|
97
|
+
|
|
98
|
+
let MetaRuntime = class MetaRuntime extends BeanBase {
|
|
103
99
|
async execute() {
|
|
104
100
|
return {
|
|
105
101
|
protocol: this.bean.core.protocol,
|
|
106
102
|
host: this.bean.core.host
|
|
107
103
|
};
|
|
108
104
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var _dec$1, _dec2$1, _class$1;
|
|
112
|
-
let MetaStatic = (_dec$1 = Meta(), _dec2$1 = BeanInfo({
|
|
105
|
+
};
|
|
106
|
+
MetaRuntime = __decorate([Meta(), BeanInfo({
|
|
113
107
|
module: "a-core"
|
|
114
|
-
}),
|
|
108
|
+
})], MetaRuntime);
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
let MetaStatic = class MetaStatic extends BeanStaticBase {};
|
|
111
|
+
MetaStatic = __decorate([Meta(), BeanInfo({
|
|
118
112
|
module: "a-core"
|
|
119
|
-
}),
|
|
113
|
+
})], MetaStatic);
|
|
120
114
|
|
|
115
|
+
let ScopeModuleACore = class ScopeModuleACore extends BeanScopeBase {};
|
|
116
|
+
ScopeModuleACore = __decorate([Scope(), BeanInfo({
|
|
117
|
+
module: "a-core"
|
|
118
|
+
})], ScopeModuleACore);
|
|
121
119
|
/** scope: end */
|
|
122
120
|
|
|
123
121
|
function Gate(options) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.150",
|
|
5
5
|
"title": "a-core",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"dependencies": {},
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@cabloy/module-info": "^1.3.32",
|
|
74
74
|
"@cabloy/set": "^1.0.18",
|
|
75
75
|
"@cabloy/type-fest": "^5.3.1",
|
|
76
|
-
"@cabloy/utils": "^2.0.
|
|
76
|
+
"@cabloy/utils": "^2.0.3",
|
|
77
77
|
"@cabloy/word-utils": "^2.0.1",
|
|
78
78
|
"bignumber.js": "^9.3.1",
|
|
79
79
|
"boxen": "^8.0.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"winston": "^3.17.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@cabloy/cli": "^3.0.
|
|
92
|
+
"@cabloy/cli": "^3.0.79",
|
|
93
93
|
"@swc/core": "^1.14.0",
|
|
94
94
|
"@swc/helpers": "^0.5.17",
|
|
95
95
|
"@types/babel__core": "^7.20.5",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"ts-node-maintained": "^10.9.6",
|
|
106
106
|
"tslib": "^2.8.1",
|
|
107
107
|
"typescript": "^5.9.3",
|
|
108
|
-
"vona-mock": "^6.0.
|
|
108
|
+
"vona-mock": "^6.0.113",
|
|
109
109
|
"why-is-node-running": "^3.2.2"
|
|
110
110
|
},
|
|
111
111
|
"gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
|