vona-module-test-vona 5.0.64 → 5.0.66
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/bean/aop.simple.d.ts +10 -7
- package/dist/bean/bean.testCtx.d.ts +16 -6
- package/dist/index.js +35 -20
- package/package.json +1 -1
- package/src/.metadata/index.ts +2 -0
- package/src/bean/aop.simple.ts +21 -12
- package/src/bean/bean.testCtx.ts +10 -6
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NextSync } from 'vona';
|
|
2
|
+
import type { AopAction, AopActionDispose, AopActionGetter, AopActionInit, AopActionSetter } from 'vona-module-a-aspect';
|
|
2
3
|
import type { BeanTestCtx } from 'vona-module-test-vona';
|
|
3
4
|
import { BeanAopBase } from 'vona';
|
|
4
5
|
declare class AopSimpleBase extends BeanAopBase {
|
|
5
|
-
actionSync
|
|
6
|
+
actionSync: AopAction<BeanTestCtx, 'actionSync', string>;
|
|
6
7
|
}
|
|
7
8
|
export declare class AopSimple extends AopSimpleBase {
|
|
8
|
-
__get__(prop:
|
|
9
|
-
__set__(prop:
|
|
10
|
-
__get_name__
|
|
11
|
-
__set_name__
|
|
12
|
-
|
|
9
|
+
protected __get__(prop: string, next: NextSync): any;
|
|
10
|
+
protected __set__(prop: string, value: any, next: NextSync): boolean;
|
|
11
|
+
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'>;
|
|
12
|
+
protected __set_name__: AopActionSetter<BeanTestCtx, 'name'>;
|
|
13
|
+
protected __init__: AopActionInit<BeanTestCtx>;
|
|
14
|
+
protected __dispose__: AopActionDispose<BeanTestCtx>;
|
|
15
|
+
actionAsync: AopAction<BeanTestCtx, 'actionAsync', string>;
|
|
13
16
|
}
|
|
14
17
|
export {};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { BeanBase } from 'vona';
|
|
2
2
|
declare class TestCtx0 extends BeanBase {
|
|
3
3
|
_name: string;
|
|
4
|
-
protected __init__(moduleName:
|
|
5
|
-
protected
|
|
6
|
-
protected
|
|
4
|
+
protected __init__(moduleName: string): void;
|
|
5
|
+
protected __dispose__(): Promise<void>;
|
|
6
|
+
protected __get__(prop: string): any;
|
|
7
|
+
protected __set__(prop: string, value: any): boolean;
|
|
7
8
|
get name(): string;
|
|
8
9
|
set name(value: string);
|
|
9
|
-
actionSync({ a, b }:
|
|
10
|
+
actionSync({ a, b }: {
|
|
11
|
+
a: number;
|
|
12
|
+
b: number;
|
|
13
|
+
}): number;
|
|
10
14
|
actionAsync({ a, b }: {
|
|
11
15
|
a: number;
|
|
12
16
|
b: number;
|
|
13
17
|
}): Promise<number>;
|
|
14
|
-
actionAsync2({ a, b }:
|
|
18
|
+
actionAsync2({ a, b }: {
|
|
19
|
+
a: number;
|
|
20
|
+
b: number;
|
|
21
|
+
}): Promise<string>;
|
|
15
22
|
}
|
|
16
23
|
declare class TestCtx1 extends TestCtx0 {
|
|
17
|
-
actionAsync3({ a, b }:
|
|
24
|
+
actionAsync3({ a, b }: {
|
|
25
|
+
a: number;
|
|
26
|
+
b: number;
|
|
27
|
+
}): Promise<string>;
|
|
18
28
|
}
|
|
19
29
|
export declare class BeanTestCtx extends TestCtx1 {
|
|
20
30
|
}
|
package/dist/index.js
CHANGED
|
@@ -58,9 +58,12 @@ let AopRegExp = (_dec$1q = Aop({
|
|
|
58
58
|
|
|
59
59
|
var _dec$1p, _dec2$1p, _class$1p;
|
|
60
60
|
class AopSimpleBase extends BeanAopBase {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
constructor(...args) {
|
|
62
|
+
super(...args);
|
|
63
|
+
this.actionSync = (_args, next, _receiver) => {
|
|
64
|
+
const result = next();
|
|
65
|
+
return `${result}:simpleaop`;
|
|
66
|
+
};
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
let AopSimple = (_dec$1p = Aop({
|
|
@@ -72,6 +75,32 @@ let AopSimple = (_dec$1p = Aop({
|
|
|
72
75
|
}), _dec2$1p = BeanInfo({
|
|
73
76
|
module: "test-vona"
|
|
74
77
|
}), _dec$1p(_class$1p = _dec2$1p(_class$1p = class AopSimple extends AopSimpleBase {
|
|
78
|
+
constructor(...args) {
|
|
79
|
+
super(...args);
|
|
80
|
+
this.__get_name__ = function (next, _receiver) {
|
|
81
|
+
const value = next();
|
|
82
|
+
return `${value}:simpleaop`;
|
|
83
|
+
};
|
|
84
|
+
this.__set_name__ = function (value, next, _receiver) {
|
|
85
|
+
const parts = value.split(':');
|
|
86
|
+
const index = parts.indexOf('simpleaop');
|
|
87
|
+
if (index > -1) {
|
|
88
|
+
parts.splice(index, 1);
|
|
89
|
+
}
|
|
90
|
+
value = parts.join(':');
|
|
91
|
+
return next(value);
|
|
92
|
+
};
|
|
93
|
+
this.__init__ = (_args, next, _receiver) => {
|
|
94
|
+
next();
|
|
95
|
+
};
|
|
96
|
+
this.__dispose__ = async (_args, next, _receiver) => {
|
|
97
|
+
await next();
|
|
98
|
+
};
|
|
99
|
+
this.actionAsync = async (_args, next, _receiver) => {
|
|
100
|
+
const result = await next(_args);
|
|
101
|
+
return `${result}:simpleaop`;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
75
104
|
// magic
|
|
76
105
|
__get__(prop, next) {
|
|
77
106
|
const value = next();
|
|
@@ -94,23 +123,6 @@ let AopSimple = (_dec$1p = Aop({
|
|
|
94
123
|
}
|
|
95
124
|
return next(value);
|
|
96
125
|
}
|
|
97
|
-
__get_name__(next) {
|
|
98
|
-
const value = next();
|
|
99
|
-
return `${value}:simpleaop`;
|
|
100
|
-
}
|
|
101
|
-
__set_name__(value, next) {
|
|
102
|
-
const parts = value.split(':');
|
|
103
|
-
const index = parts.indexOf('simpleaop');
|
|
104
|
-
if (index > -1) {
|
|
105
|
-
parts.splice(index, 1);
|
|
106
|
-
}
|
|
107
|
-
value = parts.join(':');
|
|
108
|
-
return next(value);
|
|
109
|
-
}
|
|
110
|
-
async actionAsync(_args, next, _receiver) {
|
|
111
|
-
const result = await next();
|
|
112
|
-
return `${result}:simpleaop`;
|
|
113
|
-
}
|
|
114
126
|
}) || _class$1p) || _class$1p);
|
|
115
127
|
|
|
116
128
|
var _dec$1o, _dec2$1o, _class$1o;
|
|
@@ -632,6 +644,9 @@ class TestCtx0 extends BeanBase {
|
|
|
632
644
|
__init__(moduleName) {
|
|
633
645
|
this._name = moduleName;
|
|
634
646
|
}
|
|
647
|
+
async __dispose__() {
|
|
648
|
+
this._name = '';
|
|
649
|
+
}
|
|
635
650
|
__get__(prop) {
|
|
636
651
|
if (prop === 'magicSelf') {
|
|
637
652
|
return this['magic:self'];
|
package/package.json
CHANGED
package/src/.metadata/index.ts
CHANGED
|
@@ -2065,6 +2065,8 @@ declare module 'vona' {
|
|
|
2065
2065
|
export interface IBeanScopeLocale {
|
|
2066
2066
|
'test-vona': (typeof locales)[TypeLocaleBase];
|
|
2067
2067
|
}
|
|
2068
|
+
|
|
2069
|
+
|
|
2068
2070
|
}
|
|
2069
2071
|
|
|
2070
2072
|
export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `test-vona::${K}` {
|
package/src/bean/aop.simple.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NextSync } from 'vona';
|
|
2
|
+
import type { AopAction, AopActionDispose, AopActionGetter, AopActionInit, AopActionSetter } from 'vona-module-a-aspect';
|
|
2
3
|
import type { BeanTestCtx } from 'vona-module-test-vona';
|
|
3
4
|
import { BeanAopBase } from 'vona';
|
|
4
5
|
import { Aop } from 'vona-module-a-aspect';
|
|
5
6
|
|
|
6
7
|
class AopSimpleBase extends BeanAopBase {
|
|
7
|
-
actionSync(_args, next) {
|
|
8
|
+
actionSync: AopAction<BeanTestCtx, 'actionSync', string> = (_args, next, _receiver) => {
|
|
8
9
|
const result = next();
|
|
9
10
|
return `${result}:simpleaop`;
|
|
10
|
-
}
|
|
11
|
+
};
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
@Aop({ match: 'testCtx', dependencies: 'test-vona:regExp', meta: { mode: 'test' } })
|
|
14
15
|
export class AopSimple extends AopSimpleBase {
|
|
15
16
|
// magic
|
|
16
|
-
__get__(prop, next) {
|
|
17
|
+
protected __get__(prop: string, next: NextSync) {
|
|
17
18
|
const value = next();
|
|
18
19
|
if (prop === 'magic') {
|
|
19
20
|
return 'magic:simpleaop';
|
|
@@ -24,7 +25,7 @@ export class AopSimple extends AopSimpleBase {
|
|
|
24
25
|
return value;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
__set__(prop, value, next): boolean {
|
|
28
|
+
protected __set__(prop: string, value: any, next: NextSync): boolean {
|
|
28
29
|
if (prop === 'name') {
|
|
29
30
|
const parts = value.split(':');
|
|
30
31
|
const index = parts.indexOf('simpleaop');
|
|
@@ -36,12 +37,12 @@ export class AopSimple extends AopSimpleBase {
|
|
|
36
37
|
return next(value);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
__get_name__(next) {
|
|
40
|
+
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'> = function (next, _receiver) {
|
|
40
41
|
const value = next();
|
|
41
42
|
return `${value}:simpleaop`;
|
|
42
|
-
}
|
|
43
|
+
};
|
|
43
44
|
|
|
44
|
-
__set_name__(value, next)
|
|
45
|
+
protected __set_name__: AopActionSetter<BeanTestCtx, 'name'> = function (value, next, _receiver) {
|
|
45
46
|
const parts = value.split(':');
|
|
46
47
|
const index = parts.indexOf('simpleaop');
|
|
47
48
|
if (index > -1) {
|
|
@@ -49,10 +50,18 @@ export class AopSimple extends AopSimpleBase {
|
|
|
49
50
|
}
|
|
50
51
|
value = parts.join(':');
|
|
51
52
|
return next(value);
|
|
52
|
-
}
|
|
53
|
+
};
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
protected __init__: AopActionInit<BeanTestCtx> = (_args, next, _receiver) => {
|
|
56
|
+
next();
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
protected __dispose__: AopActionDispose<BeanTestCtx> = async (_args, next, _receiver) => {
|
|
60
|
+
await next();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
actionAsync: AopAction<BeanTestCtx, 'actionAsync', string> = async (_args, next, _receiver) => {
|
|
64
|
+
const result = await next(_args);
|
|
56
65
|
return `${result}:simpleaop`;
|
|
57
|
-
}
|
|
66
|
+
};
|
|
58
67
|
}
|
package/src/bean/bean.testCtx.ts
CHANGED
|
@@ -4,17 +4,21 @@ import { Bean } from 'vona-module-a-bean';
|
|
|
4
4
|
class TestCtx0 extends BeanBase {
|
|
5
5
|
_name: string;
|
|
6
6
|
|
|
7
|
-
protected __init__(moduleName) {
|
|
7
|
+
protected __init__(moduleName: string) {
|
|
8
8
|
this._name = moduleName;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
protected
|
|
11
|
+
protected async __dispose__() {
|
|
12
|
+
this._name = '';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected __get__(prop: string) {
|
|
12
16
|
if (prop === 'magicSelf') {
|
|
13
17
|
return this['magic:self'];
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
protected __set__(prop, value): boolean {
|
|
21
|
+
protected __set__(prop: string, value: any): boolean {
|
|
18
22
|
if (prop === 'magicSelf') {
|
|
19
23
|
this['magic:self'] = value;
|
|
20
24
|
return true;
|
|
@@ -30,7 +34,7 @@ class TestCtx0 extends BeanBase {
|
|
|
30
34
|
this._name = value;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
actionSync({ a, b }:
|
|
37
|
+
actionSync({ a, b }: { a: number; b: number }) {
|
|
34
38
|
return a + b;
|
|
35
39
|
}
|
|
36
40
|
|
|
@@ -38,7 +42,7 @@ class TestCtx0 extends BeanBase {
|
|
|
38
42
|
return Promise.resolve(a + b);
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
async actionAsync2({ a, b }:
|
|
45
|
+
async actionAsync2({ a, b }: { a: number; b: number }) {
|
|
42
46
|
const name = this.name;
|
|
43
47
|
const value = await this.actionAsync({ a, b });
|
|
44
48
|
return `${name}:${value}`;
|
|
@@ -46,7 +50,7 @@ class TestCtx0 extends BeanBase {
|
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
class TestCtx1 extends TestCtx0 {
|
|
49
|
-
async actionAsync3({ a, b }:
|
|
53
|
+
async actionAsync3({ a, b }: { a: number; b: number }) {
|
|
50
54
|
return await this.actionAsync2({ a, b });
|
|
51
55
|
}
|
|
52
56
|
}
|