vona-module-test-vona 5.0.69 → 5.0.70
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.regExp.d.ts +6 -4
- package/dist/bean/aop.simple.d.ts +8 -4
- package/dist/bean/bean.testCtx.d.ts +1 -1
- package/dist/index.js +44 -42
- package/package.json +1 -1
- package/src/bean/aop.regExp.ts +10 -8
- package/src/bean/aop.simple.ts +22 -18
- package/src/bean/bean.testCtx.ts +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { AopAction, AopActionGetter, AopActionSetter } from 'vona-module-a-aspect';
|
|
2
|
+
import type { BeanTestCtx } from './bean.testCtx.ts';
|
|
1
3
|
import { BeanAopBase } from 'vona';
|
|
2
4
|
export declare class AopRegExp extends BeanAopBase {
|
|
3
|
-
__get_name__
|
|
4
|
-
__set_name__
|
|
5
|
-
actionSync
|
|
6
|
-
actionAsync
|
|
5
|
+
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'>;
|
|
6
|
+
protected __set_name__: AopActionSetter<BeanTestCtx, 'name'>;
|
|
7
|
+
actionSync: AopAction<BeanTestCtx, 'actionSync', string>;
|
|
8
|
+
actionAsync: AopAction<BeanTestCtx, 'actionAsync', string>;
|
|
7
9
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AopAction, AopActionDispose, AopActionGetter, AopActionInit, AopActionSetter } from 'vona-module-a-aspect';
|
|
1
|
+
import type { AopAction, AopActionDispose, AopActionGet, AopActionGetter, AopActionInit, AopActionSet, AopActionSetter } from 'vona-module-a-aspect';
|
|
3
2
|
import type { BeanTestCtx } from 'vona-module-test-vona';
|
|
4
3
|
import { BeanAopBase } from 'vona';
|
|
4
|
+
declare module 'vona-module-test-vona' {
|
|
5
|
+
interface BeanTestCtx {
|
|
6
|
+
magic: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
5
9
|
declare class AopSimpleBase extends BeanAopBase {
|
|
6
10
|
actionSync: AopAction<BeanTestCtx, 'actionSync', string>;
|
|
7
11
|
}
|
|
8
12
|
export declare class AopSimple extends AopSimpleBase {
|
|
9
|
-
protected __get__
|
|
10
|
-
protected __set__
|
|
13
|
+
protected __get__: AopActionGet<BeanTestCtx>;
|
|
14
|
+
protected __set__: AopActionSet<BeanTestCtx>;
|
|
11
15
|
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'>;
|
|
12
16
|
protected __set_name__: AopActionSetter<BeanTestCtx, 'name'>;
|
|
13
17
|
protected __init__: AopActionInit<BeanTestCtx>;
|
package/dist/index.js
CHANGED
|
@@ -32,26 +32,29 @@ let AopRegExp = (_dec$1q = Aop({
|
|
|
32
32
|
}), _dec2$1q = BeanInfo({
|
|
33
33
|
module: "test-vona"
|
|
34
34
|
}), _dec$1q(_class$1q = _dec2$1q(_class$1q = class AopRegExp extends BeanAopBase {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
parts.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
constructor(...args) {
|
|
36
|
+
super(...args);
|
|
37
|
+
this.__get_name__ = function (next, _receiver) {
|
|
38
|
+
const value = next();
|
|
39
|
+
return `${value}:regexpaop`;
|
|
40
|
+
};
|
|
41
|
+
this.__set_name__ = function (value, next, _receiver) {
|
|
42
|
+
const parts = value.split(':');
|
|
43
|
+
const index = parts.indexOf('regexpaop');
|
|
44
|
+
if (index > -1) {
|
|
45
|
+
parts.splice(index, 1);
|
|
46
|
+
}
|
|
47
|
+
value = parts.join(':');
|
|
48
|
+
return next(value);
|
|
49
|
+
};
|
|
50
|
+
this.actionSync = (_args, next, _receiver) => {
|
|
51
|
+
const result = next();
|
|
52
|
+
return `${result}:regexpaop`;
|
|
53
|
+
};
|
|
54
|
+
this.actionAsync = async (_args, next, _receiver) => {
|
|
55
|
+
const result = await next();
|
|
56
|
+
return `${result}:regexpaop`;
|
|
57
|
+
};
|
|
55
58
|
}
|
|
56
59
|
}) || _class$1q) || _class$1q);
|
|
57
60
|
|
|
@@ -76,6 +79,27 @@ let AopSimple = (_dec$1p = Aop({
|
|
|
76
79
|
}), _dec$1p(_class$1p = _dec2$1p(_class$1p = class AopSimple extends AopSimpleBase {
|
|
77
80
|
constructor(...args) {
|
|
78
81
|
super(...args);
|
|
82
|
+
this.__get__ = (prop, next, _receiver) => {
|
|
83
|
+
const value = next();
|
|
84
|
+
if (prop === 'magic') {
|
|
85
|
+
return 'magic:simpleaop';
|
|
86
|
+
}
|
|
87
|
+
// if (prop === 'name') {
|
|
88
|
+
// return `${value}:simpleaop`;
|
|
89
|
+
// }
|
|
90
|
+
return value;
|
|
91
|
+
};
|
|
92
|
+
this.__set__ = (_prop, value, next, _receiver) => {
|
|
93
|
+
// if (prop === 'name') {
|
|
94
|
+
// const parts = value.split(':');
|
|
95
|
+
// const index = parts.indexOf('simpleaop');
|
|
96
|
+
// if (index > -1) {
|
|
97
|
+
// parts.splice(index, 1);
|
|
98
|
+
// }
|
|
99
|
+
// value = parts.join(':');
|
|
100
|
+
// }
|
|
101
|
+
return next(value);
|
|
102
|
+
};
|
|
79
103
|
this.__get_name__ = function (next, _receiver) {
|
|
80
104
|
const value = next();
|
|
81
105
|
return `${value}:simpleaop`;
|
|
@@ -100,28 +124,6 @@ let AopSimple = (_dec$1p = Aop({
|
|
|
100
124
|
return `${result}:simpleaop`;
|
|
101
125
|
};
|
|
102
126
|
}
|
|
103
|
-
// magic
|
|
104
|
-
__get__(prop, next) {
|
|
105
|
-
const value = next();
|
|
106
|
-
if (prop === 'magic') {
|
|
107
|
-
return 'magic:simpleaop';
|
|
108
|
-
}
|
|
109
|
-
if (prop === 'name') {
|
|
110
|
-
return `${value}:simpleaop`;
|
|
111
|
-
}
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
114
|
-
__set__(prop, value, next) {
|
|
115
|
-
if (prop === 'name') {
|
|
116
|
-
const parts = value.split(':');
|
|
117
|
-
const index = parts.indexOf('simpleaop');
|
|
118
|
-
if (index > -1) {
|
|
119
|
-
parts.splice(index, 1);
|
|
120
|
-
}
|
|
121
|
-
value = parts.join(':');
|
|
122
|
-
}
|
|
123
|
-
return next(value);
|
|
124
|
-
}
|
|
125
127
|
}) || _class$1p) || _class$1p);
|
|
126
128
|
|
|
127
129
|
var _dec$1o, _dec2$1o, _class$1o;
|
package/package.json
CHANGED
package/src/bean/aop.regExp.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import type { AopAction, AopActionGetter, AopActionSetter } from 'vona-module-a-aspect';
|
|
2
|
+
import type { BeanTestCtx } from './bean.testCtx.ts';
|
|
1
3
|
import { BeanAopBase } from 'vona';
|
|
2
4
|
import { Aop } from 'vona-module-a-aspect';
|
|
3
5
|
|
|
4
6
|
@Aop({ match: [/^test-vona\.service\.test\w+$/, 'testCtx'], meta: { mode: 'test' } })
|
|
5
7
|
export class AopRegExp extends BeanAopBase {
|
|
6
|
-
__get_name__(next) {
|
|
8
|
+
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'> = function (next, _receiver) {
|
|
7
9
|
const value = next();
|
|
8
10
|
return `${value}:regexpaop`;
|
|
9
|
-
}
|
|
11
|
+
};
|
|
10
12
|
|
|
11
|
-
__set_name__(value, next) {
|
|
13
|
+
protected __set_name__: AopActionSetter<BeanTestCtx, 'name'> = function (value, next, _receiver) {
|
|
12
14
|
const parts = value.split(':');
|
|
13
15
|
const index = parts.indexOf('regexpaop');
|
|
14
16
|
if (index > -1) {
|
|
@@ -16,15 +18,15 @@ export class AopRegExp extends BeanAopBase {
|
|
|
16
18
|
}
|
|
17
19
|
value = parts.join(':');
|
|
18
20
|
return next(value);
|
|
19
|
-
}
|
|
21
|
+
};
|
|
20
22
|
|
|
21
|
-
actionSync(_args, next) {
|
|
23
|
+
actionSync: AopAction<BeanTestCtx, 'actionSync', string> = (_args, next, _receiver) => {
|
|
22
24
|
const result = next();
|
|
23
25
|
return `${result}:regexpaop`;
|
|
24
|
-
}
|
|
26
|
+
};
|
|
25
27
|
|
|
26
|
-
async
|
|
28
|
+
actionAsync: AopAction<BeanTestCtx, 'actionAsync', string> = async (_args, next, _receiver) => {
|
|
27
29
|
const result = await next();
|
|
28
30
|
return `${result}:regexpaop`;
|
|
29
|
-
}
|
|
31
|
+
};
|
|
30
32
|
}
|
package/src/bean/aop.simple.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AopAction, AopActionDispose, AopActionGetter, AopActionInit, AopActionSetter } from 'vona-module-a-aspect';
|
|
1
|
+
import type { AopAction, AopActionDispose, AopActionGet, AopActionGetter, AopActionInit, AopActionSet, AopActionSetter } from 'vona-module-a-aspect';
|
|
3
2
|
import type { BeanTestCtx } from 'vona-module-test-vona';
|
|
4
3
|
import { BeanAopBase } from 'vona';
|
|
5
4
|
import { Aop } from 'vona-module-a-aspect';
|
|
6
5
|
|
|
6
|
+
declare module 'vona-module-test-vona' {
|
|
7
|
+
export interface BeanTestCtx {
|
|
8
|
+
magic: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
class AopSimpleBase extends BeanAopBase {
|
|
8
13
|
actionSync: AopAction<BeanTestCtx, 'actionSync', string> = (_args, next, _receiver) => {
|
|
9
14
|
const result = next();
|
|
@@ -13,29 +18,28 @@ class AopSimpleBase extends BeanAopBase {
|
|
|
13
18
|
|
|
14
19
|
@Aop({ match: 'testCtx', dependencies: 'test-vona:regExp', meta: { mode: 'test' } })
|
|
15
20
|
export class AopSimple extends AopSimpleBase {
|
|
16
|
-
|
|
17
|
-
protected __get__(prop: string, next: NextSync) {
|
|
21
|
+
protected __get__: AopActionGet<BeanTestCtx> = (prop, next, _receiver) => {
|
|
18
22
|
const value = next();
|
|
19
23
|
if (prop === 'magic') {
|
|
20
24
|
return 'magic:simpleaop';
|
|
21
25
|
}
|
|
22
|
-
if (prop === 'name') {
|
|
23
|
-
|
|
24
|
-
}
|
|
26
|
+
// if (prop === 'name') {
|
|
27
|
+
// return `${value}:simpleaop`;
|
|
28
|
+
// }
|
|
25
29
|
return value;
|
|
26
|
-
}
|
|
30
|
+
};
|
|
27
31
|
|
|
28
|
-
protected __set__
|
|
29
|
-
if (prop === 'name') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
32
|
+
protected __set__: AopActionSet<BeanTestCtx> = (_prop, value, next, _receiver) => {
|
|
33
|
+
// if (prop === 'name') {
|
|
34
|
+
// const parts = value.split(':');
|
|
35
|
+
// const index = parts.indexOf('simpleaop');
|
|
36
|
+
// if (index > -1) {
|
|
37
|
+
// parts.splice(index, 1);
|
|
38
|
+
// }
|
|
39
|
+
// value = parts.join(':');
|
|
40
|
+
// }
|
|
37
41
|
return next(value);
|
|
38
|
-
}
|
|
42
|
+
};
|
|
39
43
|
|
|
40
44
|
protected __get_name__: AopActionGetter<BeanTestCtx, 'name'> = function (next, _receiver) {
|
|
41
45
|
const value = next();
|
package/src/bean/bean.testCtx.ts
CHANGED