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.
@@ -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__(next: any): string;
4
- __set_name__(value: any, next: any): any;
5
- actionSync(_args: any, next: any): string;
6
- actionAsync(_args: any, next: any): Promise<string>;
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 { NextSync } from 'vona';
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__(prop: string, next: NextSync): any;
10
- protected __set__(prop: string, value: any, next: NextSync): boolean;
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>;
@@ -1,6 +1,6 @@
1
1
  import { BeanBase } from 'vona';
2
2
  declare class TestCtx0 extends BeanBase {
3
- _name: string;
3
+ private _name;
4
4
  protected __init__(moduleName: string): void;
5
5
  protected __dispose__(): Promise<void>;
6
6
  protected __get__(prop: string): any;
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
- __get_name__(next) {
36
- const value = next();
37
- return `${value}:regexpaop`;
38
- }
39
- __set_name__(value, next) {
40
- const parts = value.split(':');
41
- const index = parts.indexOf('regexpaop');
42
- if (index > -1) {
43
- parts.splice(index, 1);
44
- }
45
- value = parts.join(':');
46
- return next(value);
47
- }
48
- actionSync(_args, next) {
49
- const result = next();
50
- return `${result}:regexpaop`;
51
- }
52
- async actionAsync(_args, next) {
53
- const result = await next();
54
- return `${result}:regexpaop`;
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-test-vona",
3
3
  "type": "module",
4
- "version": "5.0.69",
4
+ "version": "5.0.70",
5
5
  "title": "test-vona",
6
6
  "vonaModule": {
7
7
  "fileVersion": 1,
@@ -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 actionAsync(_args, next) {
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
  }
@@ -1,9 +1,14 @@
1
- import type { NextSync } from 'vona';
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
- // magic
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
- return `${value}:simpleaop`;
24
- }
26
+ // if (prop === 'name') {
27
+ // return `${value}:simpleaop`;
28
+ // }
25
29
  return value;
26
- }
30
+ };
27
31
 
28
- protected __set__(prop: string, value: any, next: NextSync): boolean {
29
- if (prop === 'name') {
30
- const parts = value.split(':');
31
- const index = parts.indexOf('simpleaop');
32
- if (index > -1) {
33
- parts.splice(index, 1);
34
- }
35
- value = parts.join(':');
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();
@@ -2,7 +2,7 @@ import { BeanBase } from 'vona';
2
2
  import { Bean } from 'vona-module-a-bean';
3
3
 
4
4
  class TestCtx0 extends BeanBase {
5
- _name: string;
5
+ private _name: string;
6
6
 
7
7
  protected __init__(moduleName: string) {
8
8
  this._name = moduleName;