vona-module-test-vona 5.0.13 → 5.0.14
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 +1220 -1
- package/package.json +2 -2
- package/dist/.metadata/index.js +0 -109
- package/dist/.metadata/this.js +0 -2
- package/dist/bean/aop.regExp.js +0 -35
- package/dist/bean/aop.simple.js +0 -59
- package/dist/bean/aopMethod.test.js +0 -42
- package/dist/bean/bean.testCtx.js +0 -54
- package/dist/bean/broadcast.test.js +0 -23
- package/dist/bean/cacheMem.test.js +0 -13
- package/dist/bean/cacheRedis.test.js +0 -13
- package/dist/bean/event.helloEcho.js +0 -13
- package/dist/bean/eventListener.helloEcho.js +0 -19
- package/dist/bean/meta.version.js +0 -25
- package/dist/bean/queue.test.js +0 -16
- package/dist/bean/schedule.test.js +0 -17
- package/dist/bean/schedule.test3.js +0 -17
- package/dist/bean/summerCache.test.js +0 -28
- package/dist/config/config.js +0 -3
- package/dist/config/locale/en-us.js +0 -11
- package/dist/config/locale/zh-cn.js +0 -9
- package/dist/controller/bean.js +0 -93
- package/dist/controller/cacheMem.js +0 -60
- package/dist/controller/cacheRedis.js +0 -60
- package/dist/controller/onion.js +0 -132
- package/dist/controller/passport.js +0 -82
- package/dist/controller/performAction.js +0 -35
- package/dist/controller/queue.js +0 -42
- package/dist/controller/summer.js +0 -120
- package/dist/controller/tail.js +0 -43
- package/dist/controller/transaction.js +0 -51
- package/dist/controller/upload.js +0 -80
- package/dist/dto/profile.js +0 -27
- package/dist/dto/user.js +0 -33
- package/dist/entity/test.js +0 -27
- package/dist/model/test.js +0 -14
- package/dist/service/aopMethod.js +0 -63
- package/dist/service/test.js +0 -17
- package/dist/service/testApp.js +0 -20
- package/dist/service/testClass.js +0 -22
- package/dist/service/transaction.js +0 -39
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-test-vona",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.14",
|
|
5
5
|
"title": "test-vona",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"fileVersion": 1,
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
37
|
-
"tsc:publish": "npm run clean && tsc -p tsconfig.build.json"
|
|
37
|
+
"tsc:publish": "npm run clean && vona :bin:buildModule && tsc -p tsconfig.build.json"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/dist/.metadata/index.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
/** locale: end */
|
|
8
|
-
/** scope: begin */
|
|
9
|
-
import { BeanScopeBase } from 'vona';
|
|
10
|
-
import { Scope } from 'vona-module-a-bean';
|
|
11
|
-
/** config: end */
|
|
12
|
-
/** locale: begin */
|
|
13
|
-
import locale_en_us from "../config/locale/en-us.js";
|
|
14
|
-
import locale_zh_cn from "../config/locale/zh-cn.js";
|
|
15
|
-
import 'vona';
|
|
16
|
-
import 'vona';
|
|
17
|
-
import 'vona';
|
|
18
|
-
import 'vona';
|
|
19
|
-
import 'vona';
|
|
20
|
-
import 'vona';
|
|
21
|
-
import 'vona';
|
|
22
|
-
import 'vona';
|
|
23
|
-
import 'vona';
|
|
24
|
-
import 'vona';
|
|
25
|
-
import 'vona';
|
|
26
|
-
/** aop: begin */
|
|
27
|
-
export * from "../bean/aop.regExp.js";
|
|
28
|
-
export * from "../bean/aop.simple.js";
|
|
29
|
-
/** aop: end */
|
|
30
|
-
/** aopMethod: begin */
|
|
31
|
-
export * from "../bean/aopMethod.test.js";
|
|
32
|
-
/** model: end */
|
|
33
|
-
/** bean: begin */
|
|
34
|
-
export * from "../bean/bean.testCtx.js";
|
|
35
|
-
/** bean: end */
|
|
36
|
-
/** broadcast: begin */
|
|
37
|
-
export * from "../bean/broadcast.test.js";
|
|
38
|
-
/** broadcast: end */
|
|
39
|
-
/** cacheMem: begin */
|
|
40
|
-
export * from "../bean/cacheMem.test.js";
|
|
41
|
-
/** cacheMem: end */
|
|
42
|
-
/** cacheRedis: begin */
|
|
43
|
-
export * from "../bean/cacheRedis.test.js";
|
|
44
|
-
/** cacheRedis: end */
|
|
45
|
-
/** event: begin */
|
|
46
|
-
export * from "../bean/event.helloEcho.js";
|
|
47
|
-
/** event: end */
|
|
48
|
-
/** eventListener: begin */
|
|
49
|
-
export * from "../bean/eventListener.helloEcho.js";
|
|
50
|
-
/** eventListener: end */
|
|
51
|
-
/** meta: begin */
|
|
52
|
-
export * from "../bean/meta.version.js";
|
|
53
|
-
/** meta: end */
|
|
54
|
-
/** queue: begin */
|
|
55
|
-
export * from "../bean/queue.test.js";
|
|
56
|
-
export * from "../bean/schedule.test3.js";
|
|
57
|
-
/** queue: end */
|
|
58
|
-
/** schedule: begin */
|
|
59
|
-
export * from "../bean/schedule.test.js";
|
|
60
|
-
/** schedule: end */
|
|
61
|
-
/** summerCache: begin */
|
|
62
|
-
export * from "../bean/summerCache.test.js";
|
|
63
|
-
/** controller: end */
|
|
64
|
-
/** config: begin */
|
|
65
|
-
export * from "../config/config.js";
|
|
66
|
-
/** service: end */
|
|
67
|
-
/** controller: begin */
|
|
68
|
-
export * from "../controller/bean.js";
|
|
69
|
-
export * from "../controller/cacheMem.js";
|
|
70
|
-
export * from "../controller/cacheRedis.js";
|
|
71
|
-
export * from "../controller/onion.js";
|
|
72
|
-
export * from "../controller/passport.js";
|
|
73
|
-
export * from "../controller/performAction.js";
|
|
74
|
-
export * from "../controller/queue.js";
|
|
75
|
-
export * from "../controller/summer.js";
|
|
76
|
-
export * from "../controller/tail.js";
|
|
77
|
-
export * from "../controller/transaction.js";
|
|
78
|
-
export * from "../controller/upload.js";
|
|
79
|
-
/** summerCache: end */
|
|
80
|
-
/** dto: begin */
|
|
81
|
-
export * from "../dto/profile.js";
|
|
82
|
-
export * from "../dto/user.js";
|
|
83
|
-
/** aopMethod: end */
|
|
84
|
-
/** entity: begin */
|
|
85
|
-
export * from "../entity/test.js";
|
|
86
|
-
/** entity: end */
|
|
87
|
-
/** model: begin */
|
|
88
|
-
export * from "../model/test.js";
|
|
89
|
-
/** dto: end */
|
|
90
|
-
/** service: begin */
|
|
91
|
-
export * from "../service/aopMethod.js";
|
|
92
|
-
export * from "../service/test.js";
|
|
93
|
-
export * from "../service/testApp.js";
|
|
94
|
-
export * from "../service/testClass.js";
|
|
95
|
-
export * from "../service/transaction.js";
|
|
96
|
-
export const locales = {
|
|
97
|
-
'en-us': locale_en_us,
|
|
98
|
-
'zh-cn': locale_zh_cn,
|
|
99
|
-
};
|
|
100
|
-
let ScopeModuleTestVona = class ScopeModuleTestVona extends BeanScopeBase {
|
|
101
|
-
};
|
|
102
|
-
ScopeModuleTestVona = __decorate([
|
|
103
|
-
Scope()
|
|
104
|
-
], ScopeModuleTestVona);
|
|
105
|
-
export { ScopeModuleTestVona };
|
|
106
|
-
export function $locale(key) {
|
|
107
|
-
return `test-vona::${key}`;
|
|
108
|
-
}
|
|
109
|
-
/** scope: end */
|
package/dist/.metadata/this.js
DELETED
package/dist/bean/aop.regExp.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanAopBase } from 'vona';
|
|
8
|
-
import { Aop } from 'vona-module-a-aspect';
|
|
9
|
-
let AopRegExp = class AopRegExp extends BeanAopBase {
|
|
10
|
-
__get_name__(next) {
|
|
11
|
-
const value = next();
|
|
12
|
-
return `${value}:regexpaop`;
|
|
13
|
-
}
|
|
14
|
-
__set_name__(value, next) {
|
|
15
|
-
const parts = value.split(':');
|
|
16
|
-
const index = parts.indexOf('regexpaop');
|
|
17
|
-
if (index > -1) {
|
|
18
|
-
parts.splice(index, 1);
|
|
19
|
-
}
|
|
20
|
-
value = parts.join(':');
|
|
21
|
-
return next(value);
|
|
22
|
-
}
|
|
23
|
-
actionSync(_args, next) {
|
|
24
|
-
const result = next();
|
|
25
|
-
return `${result}:regexpaop`;
|
|
26
|
-
}
|
|
27
|
-
async actionAsync(_args, next) {
|
|
28
|
-
const result = await next();
|
|
29
|
-
return `${result}:regexpaop`;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
AopRegExp = __decorate([
|
|
33
|
-
Aop({ match: [/^test-vona\.service\.test\w+$/, 'testCtx'], meta: { mode: 'test' } })
|
|
34
|
-
], AopRegExp);
|
|
35
|
-
export { AopRegExp };
|
package/dist/bean/aop.simple.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanAopBase } from 'vona';
|
|
8
|
-
import { Aop } from 'vona-module-a-aspect';
|
|
9
|
-
class AopSimpleBase extends BeanAopBase {
|
|
10
|
-
actionSync(_args, next) {
|
|
11
|
-
const result = next();
|
|
12
|
-
return `${result}:simpleaop`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
let AopSimple = class AopSimple extends AopSimpleBase {
|
|
16
|
-
// magic
|
|
17
|
-
__get__(prop, next) {
|
|
18
|
-
const value = next();
|
|
19
|
-
if (prop === 'magic') {
|
|
20
|
-
return 'magic:simpleaop';
|
|
21
|
-
}
|
|
22
|
-
if (prop === 'name') {
|
|
23
|
-
return `${value}:simpleaop`;
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
__set__(prop, value, next) {
|
|
28
|
-
if (prop === 'name') {
|
|
29
|
-
const parts = value.split(':');
|
|
30
|
-
const index = parts.indexOf('simpleaop');
|
|
31
|
-
if (index > -1) {
|
|
32
|
-
parts.splice(index, 1);
|
|
33
|
-
}
|
|
34
|
-
value = parts.join(':');
|
|
35
|
-
}
|
|
36
|
-
return next(value);
|
|
37
|
-
}
|
|
38
|
-
__get_name__(next) {
|
|
39
|
-
const value = next();
|
|
40
|
-
return `${value}:simpleaop`;
|
|
41
|
-
}
|
|
42
|
-
__set_name__(value, next) {
|
|
43
|
-
const parts = value.split(':');
|
|
44
|
-
const index = parts.indexOf('simpleaop');
|
|
45
|
-
if (index > -1) {
|
|
46
|
-
parts.splice(index, 1);
|
|
47
|
-
}
|
|
48
|
-
value = parts.join(':');
|
|
49
|
-
return next(value);
|
|
50
|
-
}
|
|
51
|
-
async actionAsync(_args, next, _receiver) {
|
|
52
|
-
const result = await next();
|
|
53
|
-
return `${result}:simpleaop`;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
AopSimple = __decorate([
|
|
57
|
-
Aop({ match: 'testCtx', dependencies: 'test-vona:regExp', meta: { mode: 'test' } })
|
|
58
|
-
], AopSimple);
|
|
59
|
-
export { AopSimple };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanAopMethodBase } from 'vona';
|
|
8
|
-
import { AopMethod } from 'vona-module-a-aspect';
|
|
9
|
-
let AopMethodTest = class AopMethodTest extends BeanAopMethodBase {
|
|
10
|
-
get(options, next, _receiver, _prop) {
|
|
11
|
-
const res = next();
|
|
12
|
-
return this._wrapper(options.wrapper, res);
|
|
13
|
-
}
|
|
14
|
-
set(options, value, next, _receiver, _prop) {
|
|
15
|
-
return next(this._unwrapper(options.wrapper, value));
|
|
16
|
-
}
|
|
17
|
-
execute(options, _args, next, _receiver, _prop) {
|
|
18
|
-
const res = next();
|
|
19
|
-
if (res?.then) {
|
|
20
|
-
return res.then(res => {
|
|
21
|
-
return this._wrapper(options.wrapper, res);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return this._wrapper(options.wrapper, res);
|
|
25
|
-
}
|
|
26
|
-
_wrapper(wrapper, data) {
|
|
27
|
-
return `${wrapper}${data}${wrapper}`;
|
|
28
|
-
}
|
|
29
|
-
_unwrapper(wrapper, data) {
|
|
30
|
-
let index = data.indexOf(wrapper);
|
|
31
|
-
if (index === 0)
|
|
32
|
-
data = data.substring(wrapper.length);
|
|
33
|
-
index = data.lastIndexOf(wrapper);
|
|
34
|
-
if (index === data.length - wrapper.length)
|
|
35
|
-
data = data.substring(0, index);
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
AopMethodTest = __decorate([
|
|
40
|
-
AopMethod({ wrapper: '' })
|
|
41
|
-
], AopMethodTest);
|
|
42
|
-
export { AopMethodTest };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanBase } from 'vona';
|
|
8
|
-
import { Bean } from 'vona-module-a-bean';
|
|
9
|
-
class TestCtx0 extends BeanBase {
|
|
10
|
-
_name;
|
|
11
|
-
__init__(moduleName) {
|
|
12
|
-
this._name = moduleName;
|
|
13
|
-
}
|
|
14
|
-
__get__(prop) {
|
|
15
|
-
if (prop === 'magicSelf') {
|
|
16
|
-
return this['magic:self'];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
__set__(prop, value) {
|
|
20
|
-
if (prop === 'magicSelf') {
|
|
21
|
-
this['magic:self'] = value;
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
get name() {
|
|
27
|
-
return this._name;
|
|
28
|
-
}
|
|
29
|
-
set name(value) {
|
|
30
|
-
this._name = value;
|
|
31
|
-
}
|
|
32
|
-
actionSync({ a, b }) {
|
|
33
|
-
return a + b;
|
|
34
|
-
}
|
|
35
|
-
async actionAsync({ a, b }) {
|
|
36
|
-
return Promise.resolve(a + b);
|
|
37
|
-
}
|
|
38
|
-
async actionAsync2({ a, b }) {
|
|
39
|
-
const name = this.name;
|
|
40
|
-
const value = await this.actionAsync({ a, b });
|
|
41
|
-
return `${name}:${value}`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
class TestCtx1 extends TestCtx0 {
|
|
45
|
-
async actionAsync3({ a, b }) {
|
|
46
|
-
return await this.actionAsync2({ a, b });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
let BeanTestCtx = class BeanTestCtx extends TestCtx1 {
|
|
50
|
-
};
|
|
51
|
-
BeanTestCtx = __decorate([
|
|
52
|
-
Bean()
|
|
53
|
-
], BeanTestCtx);
|
|
54
|
-
export { BeanTestCtx };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { BeanBroadcastBase, Broadcast } from 'vona-module-a-broadcast';
|
|
9
|
-
let BroadcastTest = class BroadcastTest extends BeanBroadcastBase {
|
|
10
|
-
async execute(data, isEmitter) {
|
|
11
|
-
if (!isEmitter) {
|
|
12
|
-
// do something
|
|
13
|
-
}
|
|
14
|
-
// locale
|
|
15
|
-
assert.equal(this.ctx.locale, 'zh-cn');
|
|
16
|
-
// data
|
|
17
|
-
assert.equal(data.message, 'hello');
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
BroadcastTest = __decorate([
|
|
21
|
-
Broadcast()
|
|
22
|
-
], BroadcastTest);
|
|
23
|
-
export { BroadcastTest };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanCacheMemBase, CacheMem } from 'vona-module-a-cache';
|
|
8
|
-
let CacheMemTest = class CacheMemTest extends BeanCacheMemBase {
|
|
9
|
-
};
|
|
10
|
-
CacheMemTest = __decorate([
|
|
11
|
-
CacheMem({ ttl: 1 * 1000 })
|
|
12
|
-
], CacheMemTest);
|
|
13
|
-
export { CacheMemTest };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanCacheRedisBase, CacheRedis } from 'vona-module-a-cache';
|
|
8
|
-
let CacheRedisTest = class CacheRedisTest extends BeanCacheRedisBase {
|
|
9
|
-
};
|
|
10
|
-
CacheRedisTest = __decorate([
|
|
11
|
-
CacheRedis({ ttl: 1 * 1000 })
|
|
12
|
-
], CacheRedisTest);
|
|
13
|
-
export { CacheRedisTest };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanEventBase, Event } from 'vona-module-a-event';
|
|
8
|
-
let EventHelloEcho = class EventHelloEcho extends BeanEventBase {
|
|
9
|
-
};
|
|
10
|
-
EventHelloEcho = __decorate([
|
|
11
|
-
Event()
|
|
12
|
-
], EventHelloEcho);
|
|
13
|
-
export { EventHelloEcho };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanBase } from 'vona';
|
|
8
|
-
import { EventListener } from 'vona-module-a-event';
|
|
9
|
-
let EventListenerHelloEcho = class EventListenerHelloEcho extends BeanBase {
|
|
10
|
-
async execute(data, next) {
|
|
11
|
-
// next
|
|
12
|
-
const result = await next();
|
|
13
|
-
return `${data.text} ${result}`;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
EventListenerHelloEcho = __decorate([
|
|
17
|
-
EventListener({ match: 'test-vona:helloEcho' })
|
|
18
|
-
], EventListenerHelloEcho);
|
|
19
|
-
export { EventListenerHelloEcho };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanBase } from 'vona';
|
|
8
|
-
import { Meta } from 'vona-module-a-meta';
|
|
9
|
-
let MetaVersion = class MetaVersion extends BeanBase {
|
|
10
|
-
async update(options) {
|
|
11
|
-
if (options.version === 1) {
|
|
12
|
-
// testVona
|
|
13
|
-
const entity = this.scope.entity.test;
|
|
14
|
-
await this.bean.model.createTable(entity.$table, table => {
|
|
15
|
-
table.basicFields();
|
|
16
|
-
table.string(entity.$column('title'), 255);
|
|
17
|
-
table.string(entity.$column('description'), 255);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
MetaVersion = __decorate([
|
|
23
|
-
Meta()
|
|
24
|
-
], MetaVersion);
|
|
25
|
-
export { MetaVersion };
|
package/dist/bean/queue.test.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanQueueBase, Queue } from 'vona-module-a-queue';
|
|
8
|
-
let QueueTest = class QueueTest extends BeanQueueBase {
|
|
9
|
-
async execute(data, _options) {
|
|
10
|
-
return data.a + data.b;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
QueueTest = __decorate([
|
|
14
|
-
Queue()
|
|
15
|
-
], QueueTest);
|
|
16
|
-
export { QueueTest };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanBase } from 'vona';
|
|
8
|
-
import { Schedule } from 'vona-module-a-schedule';
|
|
9
|
-
let ScheduleTest = class ScheduleTest extends BeanBase {
|
|
10
|
-
async execute(job) {
|
|
11
|
-
this.$logger.silly(`Schedule Test: iid=${this.ctx.instance.id}, every=${job?.data.options?.jobOptions?.repeat?.every}, ${new Date()}`);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
ScheduleTest = __decorate([
|
|
15
|
-
Schedule({ enable: false, repeat: { every: 3000 } })
|
|
16
|
-
], ScheduleTest);
|
|
17
|
-
export { ScheduleTest };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanBase } from 'vona';
|
|
8
|
-
import { Schedule } from 'vona-module-a-schedule';
|
|
9
|
-
let ScheduleTest3 = class ScheduleTest3 extends BeanBase {
|
|
10
|
-
async execute(job) {
|
|
11
|
-
this.$logger.silly(`Schedule Test3: iid=${this.ctx.instance.id}, every=${job?.data.options?.jobOptions?.repeat?.every}, ${new Date()}`);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
ScheduleTest3 = __decorate([
|
|
15
|
-
Schedule({ enable: false, repeat: { every: 5000 } })
|
|
16
|
-
], ScheduleTest3);
|
|
17
|
-
export { ScheduleTest3 };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BeanSummerCacheBase, SummerCache, } from 'vona-module-a-summer';
|
|
8
|
-
let SummerCacheTest = class SummerCacheTest extends BeanSummerCacheBase {
|
|
9
|
-
async getNative(key, _options) {
|
|
10
|
-
return {
|
|
11
|
-
id: key.id,
|
|
12
|
-
name: `name_${key.id}`,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
SummerCacheTest = __decorate([
|
|
17
|
-
SummerCache({
|
|
18
|
-
mode: 'all',
|
|
19
|
-
mem: {
|
|
20
|
-
max: 2,
|
|
21
|
-
ttl: 1 * 1000,
|
|
22
|
-
},
|
|
23
|
-
redis: {
|
|
24
|
-
ttl: 3 * 1000,
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
], SummerCacheTest);
|
|
28
|
-
export { SummerCacheTest };
|
package/dist/config/config.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
User: 'User',
|
|
3
|
-
UserId: 'User Id',
|
|
4
|
-
TestHelloWorld: 'Hello World',
|
|
5
|
-
TestApples: '%d apples',
|
|
6
|
-
TestApples_0: 'no apples',
|
|
7
|
-
TestApples_1: 'one apple',
|
|
8
|
-
TestNameApples_: '%s has %d apples',
|
|
9
|
-
TestNameApples_0_1: '%s has no apples',
|
|
10
|
-
TestNameApples_1_1: '%s has one apple',
|
|
11
|
-
};
|
package/dist/controller/bean.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import assert from 'node:assert';
|
|
11
|
-
import { BeanBase, cast } from 'vona';
|
|
12
|
-
import { Api } from 'vona-module-a-openapi';
|
|
13
|
-
import { Passport } from 'vona-module-a-user';
|
|
14
|
-
import { Controller, Web } from 'vona-module-a-web';
|
|
15
|
-
import { __ThisModule__ } from "../.metadata/this.js";
|
|
16
|
-
import { ServiceTest } from "../service/test.js";
|
|
17
|
-
let ControllerBean = class ControllerBean extends BeanBase {
|
|
18
|
-
async test() {
|
|
19
|
-
const a = 3;
|
|
20
|
-
const b = 4;
|
|
21
|
-
let res;
|
|
22
|
-
// app.bean
|
|
23
|
-
assert.equal(this.app.bean._getBean('test-vona.service.testApp'), this.app.bean['test-vona.service.testApp']);
|
|
24
|
-
res = this.app.bean['test-vona.service.testApp'].actionSync({ a, b });
|
|
25
|
-
assert.equal(res, `${a + b}:regexpaop`);
|
|
26
|
-
res = await this.app.bean['test-vona.service.testApp'].actionAsync({ a, b });
|
|
27
|
-
assert.equal(res, `${a + b}:regexpaop`);
|
|
28
|
-
// ctx.bean: global
|
|
29
|
-
assert.equal(this.bean.testCtx, this.app.bean.testCtx);
|
|
30
|
-
// magic
|
|
31
|
-
res = cast(this.bean.testCtx).magic;
|
|
32
|
-
assert.equal(res, 'magic:simpleaop');
|
|
33
|
-
// name
|
|
34
|
-
this.bean.testCtx.name = 'test-vona:simpleaop:regexpaop';
|
|
35
|
-
res = this.bean.testCtx.name;
|
|
36
|
-
assert.equal(res, 'test-vona:simpleaop:regexpaop');
|
|
37
|
-
res = this.bean.testCtx.actionSync({ a, b });
|
|
38
|
-
assert.equal(res, `${a + b}:simpleaop:regexpaop`);
|
|
39
|
-
res = await this.bean.testCtx.actionAsync({ a, b });
|
|
40
|
-
assert.equal(res, `${a + b}:simpleaop:regexpaop`);
|
|
41
|
-
res = await this.bean.testCtx.actionAsync2({ a, b });
|
|
42
|
-
assert.equal(res, `test-vona:simpleaop:regexpaop:${a + b}:simpleaop:regexpaop`);
|
|
43
|
-
res = await this.bean.testCtx.actionAsync3({ a, b });
|
|
44
|
-
assert.equal(res, `test-vona:simpleaop:regexpaop:${a + b}:simpleaop:regexpaop`);
|
|
45
|
-
// ctx.bean: class
|
|
46
|
-
assert.equal(this.bean['test-vona.service.testClass'], this.app.bean['test-vona.service.testClass']);
|
|
47
|
-
res = this.bean['test-vona.service.testClass'].actionSync({ a, b });
|
|
48
|
-
assert.equal(res, `${a + b}:regexpaop`);
|
|
49
|
-
res = await this.bean['test-vona.service.testClass'].actionAsync({ a, b });
|
|
50
|
-
assert.equal(res, `${a + b}:regexpaop`);
|
|
51
|
-
// magic of self
|
|
52
|
-
cast(this.bean.testCtx).magicSelf = '__magicSelf__';
|
|
53
|
-
res = cast(this.app.bean.testCtx).magicSelf;
|
|
54
|
-
assert.equal(res, '__magicSelf__');
|
|
55
|
-
res = cast(this.app.bean.testCtx)['magic:self'];
|
|
56
|
-
assert.equal(res, '__magicSelf__');
|
|
57
|
-
}
|
|
58
|
-
async service() {
|
|
59
|
-
let res;
|
|
60
|
-
// general way
|
|
61
|
-
res = this.bean._getBean(ServiceTest).name;
|
|
62
|
-
assert.equal(res, 'serviceTest');
|
|
63
|
-
res = this.bean._getBean('test-vona.service.test').name;
|
|
64
|
-
assert.equal(res, 'serviceTest');
|
|
65
|
-
// this scope
|
|
66
|
-
res = this.scope.service.test.name;
|
|
67
|
-
assert.equal(res, 'serviceTest');
|
|
68
|
-
// general scope
|
|
69
|
-
res = this.bean.scope(__ThisModule__).service.test.name;
|
|
70
|
-
assert.equal(res, 'serviceTest');
|
|
71
|
-
res = this.$scope.testVona.service.test.name;
|
|
72
|
-
assert.equal(res, 'serviceTest');
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
__decorate([
|
|
76
|
-
Web.get('test'),
|
|
77
|
-
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", []),
|
|
79
|
-
__metadata("design:returntype", Promise)
|
|
80
|
-
], ControllerBean.prototype, "test", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
Web.get('service'),
|
|
83
|
-
Passport.public(),
|
|
84
|
-
__metadata("design:type", Function),
|
|
85
|
-
__metadata("design:paramtypes", []),
|
|
86
|
-
__metadata("design:returntype", Promise)
|
|
87
|
-
], ControllerBean.prototype, "service", null);
|
|
88
|
-
ControllerBean = __decorate([
|
|
89
|
-
Controller({ path: 'bean', meta: { mode: 'test' } }),
|
|
90
|
-
Api.exclude(),
|
|
91
|
-
Passport.public()
|
|
92
|
-
], ControllerBean);
|
|
93
|
-
export { ControllerBean };
|