vona-module-test-vona 5.0.63 → 5.0.65

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.
@@ -1,14 +1,17 @@
1
- import type { Next } from 'vona';
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(_args: any, next: any): string;
6
+ actionSync: AopAction<BeanTestCtx, 'actionSync', string>;
6
7
  }
7
8
  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>;
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: any): void;
5
- protected __get__(prop: any): any;
6
- protected __set__(prop: any, value: any): boolean;
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 }: any): any;
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 }: any): Promise<string>;
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 }: any): Promise<string>;
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
- actionSync(_args, next) {
62
- const result = next();
63
- return `${result}:simpleaop`;
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'];
@@ -1905,7 +1920,7 @@ let DtoProfile = (_dec$r = Dto(), _dec2$r = BeanInfo({
1905
1920
  var _dec$q, _dec2$q, _dec3$n, _dec4$n, _dec5$n, _dec6$n, _dec7$k, _dec8$g, _class$q, _class2$n, _descriptor$6, _descriptor2$6, _descriptor3$3;
1906
1921
  let DtoUserLazy = (_dec$q = Dto(), _dec2$q = BeanInfo({
1907
1922
  module: "test-vona"
1908
- }), _dec3$n = Api.field(), _dec4$n = Reflect.metadata("design:type", String), _dec5$n = Api.field(v.lazy(v.optional(), () => DtoUserLazy)), _dec6$n = Reflect.metadata("design:type", Object), _dec7$k = Api.field(v.optional(), v.array(v.lazy(() => DtoRoleLazy))), _dec8$g = Reflect.metadata("design:type", Array), _dec$q(_class$q = _dec2$q(_class$q = (_class2$n = class DtoUserLazy {
1923
+ }), _dec3$n = Api.field(), _dec4$n = Reflect.metadata("design:type", String), _dec5$n = Api.field(v.optional(), v.lazy(() => DtoUserLazy)), _dec6$n = Reflect.metadata("design:type", Object), _dec7$k = Api.field(v.optional(), v.array(v.lazy(() => DtoRoleLazy))), _dec8$g = Reflect.metadata("design:type", Array), _dec$q(_class$q = _dec2$q(_class$q = (_class2$n = class DtoUserLazy {
1909
1924
  constructor() {
1910
1925
  _initializerDefineProperty(this, "name", _descriptor$6, this);
1911
1926
  _initializerDefineProperty(this, "user", _descriptor2$6, this);
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.63",
4
+ "version": "5.0.65",
5
5
  "title": "test-vona",
6
6
  "vonaModule": {
7
7
  "fileVersion": 1,
@@ -1,19 +1,20 @@
1
- import type { Next } from 'vona';
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): boolean {
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
- async actionAsync(_args: Parameters<BeanTestCtx['actionAsync']>, next: Next, _receiver: BeanTestCtx) {
55
- const result = await next();
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
  }
@@ -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 __get__(prop) {
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 }: any) {
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 }: any) {
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 }: any) {
53
+ async actionAsync3({ a, b }: { a: number; b: number }) {
50
54
  return await this.actionAsync2({ a, b });
51
55
  }
52
56
  }
@@ -10,7 +10,7 @@ export class DtoUserLazy {
10
10
  @Api.field()
11
11
  name: string;
12
12
 
13
- @Api.field(v.lazy(v.optional(), () => DtoUserLazy))
13
+ @Api.field(v.optional(), v.lazy(() => DtoUserLazy))
14
14
  user?: DtoUserLazy;
15
15
 
16
16
  @Api.field(v.optional(), v.array(v.lazy(() => DtoRoleLazy)))