vona-module-test-vona 5.0.12 → 5.0.13
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/.metadata/index.d.ts +551 -0
- package/dist/.metadata/index.js +109 -0
- package/dist/.metadata/this.d.ts +2 -0
- package/dist/.metadata/this.js +2 -0
- package/dist/bean/aop.regExp.d.ts +7 -0
- package/dist/bean/aop.regExp.js +35 -0
- package/dist/bean/aop.simple.d.ts +14 -0
- package/dist/bean/aop.simple.js +59 -0
- package/dist/bean/aopMethod.test.d.ts +13 -0
- package/dist/bean/aopMethod.test.js +42 -0
- package/dist/bean/bean.testCtx.d.ts +21 -0
- package/dist/bean/bean.testCtx.js +54 -0
- package/dist/bean/broadcast.test.d.ts +8 -0
- package/dist/bean/broadcast.test.js +23 -0
- package/dist/bean/cacheMem.test.d.ts +5 -0
- package/dist/bean/cacheMem.test.js +13 -0
- package/dist/bean/cacheRedis.test.d.ts +5 -0
- package/dist/bean/cacheRedis.test.js +13 -0
- package/dist/bean/event.helloEcho.d.ts +7 -0
- package/dist/bean/event.helloEcho.js +13 -0
- package/dist/bean/eventListener.helloEcho.d.ts +9 -0
- package/dist/bean/eventListener.helloEcho.js +19 -0
- package/dist/bean/meta.version.d.ts +5 -0
- package/dist/bean/meta.version.js +25 -0
- package/dist/bean/queue.test.d.ts +10 -0
- package/dist/bean/queue.test.js +16 -0
- package/dist/bean/schedule.test.d.ts +5 -0
- package/dist/bean/schedule.test.js +17 -0
- package/dist/bean/schedule.test3.d.ts +5 -0
- package/dist/bean/schedule.test3.js +17 -0
- package/dist/bean/summerCache.test.d.ts +12 -0
- package/dist/bean/summerCache.test.js +28 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +3 -0
- package/dist/config/locale/en-us.d.ts +12 -0
- package/dist/config/locale/en-us.js +11 -0
- package/dist/config/locale/zh-cn.d.ts +10 -0
- package/dist/config/locale/zh-cn.js +9 -0
- package/dist/controller/bean.d.ts +8 -0
- package/dist/controller/bean.js +93 -0
- package/dist/controller/cacheMem.d.ts +7 -0
- package/dist/controller/cacheMem.js +60 -0
- package/dist/controller/cacheRedis.d.ts +7 -0
- package/dist/controller/cacheRedis.js +60 -0
- package/dist/controller/onion.d.ts +15 -0
- package/dist/controller/onion.js +132 -0
- package/dist/controller/passport.d.ts +16 -0
- package/dist/controller/passport.js +82 -0
- package/dist/controller/performAction.d.ts +10 -0
- package/dist/controller/performAction.js +35 -0
- package/dist/controller/queue.d.ts +8 -0
- package/dist/controller/queue.js +42 -0
- package/dist/controller/summer.d.ts +7 -0
- package/dist/controller/summer.js +120 -0
- package/dist/controller/tail.d.ts +7 -0
- package/dist/controller/tail.js +43 -0
- package/dist/controller/transaction.d.ts +8 -0
- package/dist/controller/transaction.js +51 -0
- package/dist/controller/upload.d.ts +10 -0
- package/dist/controller/upload.js +80 -0
- package/dist/dto/profile.d.ts +7 -0
- package/dist/dto/profile.js +27 -0
- package/dist/dto/user.d.ts +10 -0
- package/dist/dto/user.js +33 -0
- package/dist/entity/test.d.ts +8 -0
- package/dist/entity/test.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model/test.d.ts +4 -0
- package/dist/model/test.js +14 -0
- package/dist/service/aopMethod.d.ts +12 -0
- package/dist/service/aopMethod.js +63 -0
- package/dist/service/test.d.ts +4 -0
- package/dist/service/test.js +17 -0
- package/dist/service/testApp.d.ts +5 -0
- package/dist/service/testApp.js +20 -0
- package/dist/service/testClass.d.ts +8 -0
- package/dist/service/testClass.js +22 -0
- package/dist/service/transaction.d.ts +5 -0
- package/dist/service/transaction.js +39 -0
- package/package.json +7 -3
|
@@ -0,0 +1,35 @@
|
|
|
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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Next } from 'vona';
|
|
2
|
+
import type { BeanTestCtx } from 'vona-module-test-vona';
|
|
3
|
+
import { BeanAopBase } from 'vona';
|
|
4
|
+
declare class AopSimpleBase extends BeanAopBase {
|
|
5
|
+
actionSync(_args: any, next: any): string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AopSimple extends AopSimpleBase {
|
|
8
|
+
__get__(prop: any, next: any): any;
|
|
9
|
+
__set__(prop: any, value: any, next: any): boolean;
|
|
10
|
+
__get_name__(next: any): string;
|
|
11
|
+
__set_name__(value: any, next: any): boolean;
|
|
12
|
+
actionAsync(_args: Parameters<BeanTestCtx['actionAsync']>, next: Next, _receiver: BeanTestCtx): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Next, NextSync } from 'vona';
|
|
2
|
+
import type { IAopMethodExecute, IAopMethodGet, IAopMethodSet, IDecoratorAopMethodOptions } from 'vona-module-a-aspect';
|
|
3
|
+
import { BeanAopMethodBase } from 'vona';
|
|
4
|
+
export interface IAopMethodOptionsTest extends IDecoratorAopMethodOptions {
|
|
5
|
+
wrapper: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AopMethodTest extends BeanAopMethodBase implements IAopMethodGet, IAopMethodSet, IAopMethodExecute {
|
|
8
|
+
get(options: IAopMethodOptionsTest, next: NextSync, _receiver: any, _prop: string): string;
|
|
9
|
+
set(options: IAopMethodOptionsTest, value: string, next: NextSync, _receiver: any, _prop: string): boolean;
|
|
10
|
+
execute(options: IAopMethodOptionsTest, _args: [], next: Next | NextSync, _receiver: any, _prop: string): Promise<string> | string;
|
|
11
|
+
_wrapper(wrapper: string, data: string): string;
|
|
12
|
+
_unwrapper(wrapper: string, data: string): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BeanBase } from 'vona';
|
|
2
|
+
declare class TestCtx0 extends BeanBase {
|
|
3
|
+
_name: string;
|
|
4
|
+
protected __init__(moduleName: any): void;
|
|
5
|
+
protected __get__(prop: any): any;
|
|
6
|
+
protected __set__(prop: any, value: any): boolean;
|
|
7
|
+
get name(): string;
|
|
8
|
+
set name(value: string);
|
|
9
|
+
actionSync({ a, b }: any): any;
|
|
10
|
+
actionAsync({ a, b }: {
|
|
11
|
+
a: number;
|
|
12
|
+
b: number;
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
actionAsync2({ a, b }: any): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
declare class TestCtx1 extends TestCtx0 {
|
|
17
|
+
actionAsync3({ a, b }: any): Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
export declare class BeanTestCtx extends TestCtx1 {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IBroadcastExecute } from 'vona-module-a-broadcast';
|
|
2
|
+
import { BeanBroadcastBase } from 'vona-module-a-broadcast';
|
|
3
|
+
export interface TypeBroadcastTestJobData {
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class BroadcastTest extends BeanBroadcastBase<TypeBroadcastTestJobData> implements IBroadcastExecute<TypeBroadcastTestJobData> {
|
|
7
|
+
execute(data: TypeBroadcastTestJobData, isEmitter?: boolean): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BeanEventBase } from 'vona-module-a-event';
|
|
2
|
+
export interface TypeEventHelloEchoData {
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export type TypeEventHelloEchoResult = string;
|
|
6
|
+
export declare class EventHelloEcho extends BeanEventBase<TypeEventHelloEchoData, TypeEventHelloEchoResult> {
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IEventExecute, NextEvent } from 'vona-module-a-event';
|
|
2
|
+
import type { TypeEventHelloEchoData, TypeEventHelloEchoResult } from './event.helloEcho.ts';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
type TypeEventData = TypeEventHelloEchoData;
|
|
5
|
+
type TypeEventResult = TypeEventHelloEchoResult;
|
|
6
|
+
export declare class EventListenerHelloEcho extends BeanBase implements IEventExecute<TypeEventData, TypeEventResult> {
|
|
7
|
+
execute(data: TypeEventData, next: NextEvent<TypeEventData, TypeEventResult>): Promise<TypeEventResult>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IMetaVersionUpdate, IMetaVersionUpdateOptions } from 'vona-module-a-version';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
export declare class MetaVersion extends BeanBase implements IMetaVersionUpdate {
|
|
4
|
+
update(options: IMetaVersionUpdateOptions): Promise<void>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IQueueExecute, IQueuePushOptions } from 'vona-module-a-queue';
|
|
2
|
+
import { BeanQueueBase } from 'vona-module-a-queue';
|
|
3
|
+
export interface TypeQueueTestJobData {
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
}
|
|
7
|
+
export type TypeQueueTestJobResult = number;
|
|
8
|
+
export declare class QueueTest extends BeanQueueBase<TypeQueueTestJobData, TypeQueueTestJobResult> implements IQueueExecute<TypeQueueTestJobData, TypeQueueTestJobResult> {
|
|
9
|
+
execute(data: TypeQueueTestJobData, _options?: IQueuePushOptions): Promise<TypeQueueTestJobResult>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ISummerCacheGet, TSummerCacheActionOptions } from 'vona-module-a-summer';
|
|
2
|
+
import { BeanSummerCacheBase } from 'vona-module-a-summer';
|
|
3
|
+
export interface TSummerCacheTestKey {
|
|
4
|
+
id: number;
|
|
5
|
+
}
|
|
6
|
+
export interface TSummerCacheTestData {
|
|
7
|
+
id: number;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SummerCacheTest extends BeanSummerCacheBase<TSummerCacheTestKey, TSummerCacheTestData> implements ISummerCacheGet<TSummerCacheTestKey, TSummerCacheTestData> {
|
|
11
|
+
getNative(key: TSummerCacheTestKey, _options?: TSummerCacheActionOptions<TSummerCacheTestKey, TSummerCacheTestData>): Promise<TSummerCacheTestData | null | undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
User: string;
|
|
3
|
+
UserId: string;
|
|
4
|
+
TestHelloWorld: string;
|
|
5
|
+
TestApples: string;
|
|
6
|
+
TestApples_0: string;
|
|
7
|
+
TestApples_1: string;
|
|
8
|
+
TestNameApples_: string;
|
|
9
|
+
TestNameApples_0_1: string;
|
|
10
|
+
TestNameApples_1_1: string;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
export interface IControllerOptionsBean extends IDecoratorControllerOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class ControllerBean extends BeanBase {
|
|
6
|
+
test(): Promise<void>;
|
|
7
|
+
service(): Promise<void>;
|
|
8
|
+
}
|