vona-module-test-vona 5.0.67 → 5.0.68
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/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { BeanInfo, BeanAopBase, BeanAopMethodBase, BeanBase, $Class, cast, retry, BeanScopeBase } from 'vona';
|
|
2
2
|
import { Aop, AopMethod, Aspect } from 'vona-module-a-aspect';
|
|
3
3
|
import { Api, v } from 'vona-module-a-openapi';
|
|
4
|
-
import { Entity, EntityBase, Model, $relation, BeanModelBase, $relationDynamic,
|
|
4
|
+
import { Entity, EntityBase, Model, $relation, BeanModelBase, $relationDynamic, $Dto, $tableName } from 'vona-module-a-orm';
|
|
5
5
|
import { ModelCategoryChain as ModelCategoryChain$1, ModelOrder as ModelOrder$1 } from 'vona-module-test-vona';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
8
8
|
import { getKeyHash, CacheMem, BeanCacheMemBase, CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
9
9
|
import { Caching } from 'vona-module-a-caching';
|
|
10
10
|
import assert from 'node:assert';
|
|
11
|
+
import { Core } from 'vona-module-a-core';
|
|
11
12
|
import { Broadcast, BeanBroadcastBase } from 'vona-module-a-broadcast';
|
|
12
13
|
import { Event, BeanEventBase, EventListener } from 'vona-module-a-event';
|
|
13
14
|
import { Meta } from 'vona-module-a-meta';
|
|
@@ -19,10 +20,8 @@ import { Dto, Controller, Web, Arg } from 'vona-module-a-web';
|
|
|
19
20
|
import z, { z as z$1 } from 'zod';
|
|
20
21
|
import { Passport } from 'vona-module-a-user';
|
|
21
22
|
import { sleep } from '@cabloy/utils';
|
|
22
|
-
import { Captcha } from 'vona-module-a-captcha';
|
|
23
|
-
import { Core } from 'vona-module-a-core';
|
|
24
23
|
import { DtoJwtToken } from 'vona-module-a-jwt';
|
|
25
|
-
import {
|
|
24
|
+
import { SymbolUploadValue } from 'vona-module-a-upload';
|
|
26
25
|
|
|
27
26
|
var _dec$1q, _dec2$1q, _class$1q;
|
|
28
27
|
let AopRegExp = (_dec$1q = Aop({
|
|
@@ -1045,7 +1044,7 @@ let ServiceOrder = (_dec$Y = Service(), _dec2$Y = BeanInfo({
|
|
|
1045
1044
|
var _dec$X, _dec2$X, _dec3$t, _dec4$t, _dec5$q, _class$X, _class2$t;
|
|
1046
1045
|
let ServicePost = (_dec$X = Service(), _dec2$X = BeanInfo({
|
|
1047
1046
|
module: "test-vona"
|
|
1048
|
-
}), _dec3$t =
|
|
1047
|
+
}), _dec3$t = Core.transaction(), _dec4$t = Reflect.metadata("design:type", Function), _dec5$q = Reflect.metadata("design:paramtypes", []), _dec$X(_class$X = _dec2$X(_class$X = (_class2$t = class ServicePost extends BeanBase {
|
|
1049
1048
|
async findMany(params) {
|
|
1050
1049
|
return await this.scope.model.post.selectAndCount({
|
|
1051
1050
|
...params,
|
|
@@ -1438,7 +1437,7 @@ const tableNameFail$1 = '__tempTransactionFail';
|
|
|
1438
1437
|
const tableNameSuccess$1 = '__tempTransactionSuccess';
|
|
1439
1438
|
let ServiceTransaction = (_dec$R = Service(), _dec2$R = BeanInfo({
|
|
1440
1439
|
module: "test-vona"
|
|
1441
|
-
}), _dec3$s =
|
|
1440
|
+
}), _dec3$s = Core.transaction(), _dec4$s = Reflect.metadata("design:type", Function), _dec5$p = Reflect.metadata("design:paramtypes", [Object]), _dec6$p = Core.transaction(), _dec7$l = Reflect.metadata("design:type", Function), _dec8$h = Reflect.metadata("design:paramtypes", [Object]), _dec$R(_class$R = _dec2$R(_class$R = (_class2$s = class ServiceTransaction extends BeanBase {
|
|
1442
1441
|
async fail(item) {
|
|
1443
1442
|
await this.bean.model.update(`${tableNameFail$1}`, item);
|
|
1444
1443
|
await this.bean.model.update(`${tableNameFail$1}error`, item);
|
|
@@ -2459,7 +2458,7 @@ let ControllerCaptcha = (_dec$e = Controller({
|
|
|
2459
2458
|
}
|
|
2460
2459
|
}), _dec2$e = BeanInfo({
|
|
2461
2460
|
module: "test-vona"
|
|
2462
|
-
}), _dec3$d = Web.post('signin'), _dec4$d = Passport.public(), _dec5$d =
|
|
2461
|
+
}), _dec3$d = Web.post('signin'), _dec4$d = Passport.public(), _dec5$d = Core.captchaVerify({
|
|
2463
2462
|
scene: 'a-captchasimple:simple'
|
|
2464
2463
|
}), _dec6$d = function (target, key) {
|
|
2465
2464
|
return Arg.body()(target, key, 0);
|
|
@@ -2560,7 +2559,7 @@ let ControllerOnion = (_dec$b = Controller({
|
|
|
2560
2559
|
}), _dec10$6 = Aspect.aopMethod('a-orm:transaction', {
|
|
2561
2560
|
isolationLevel: 'SERIALIZABLE',
|
|
2562
2561
|
readOnly: true
|
|
2563
|
-
}), _dec11$6 =
|
|
2562
|
+
}), _dec11$6 = Core.transaction({
|
|
2564
2563
|
isolationLevel: 'READ_COMMITTED',
|
|
2565
2564
|
readOnly: false
|
|
2566
2565
|
}), _dec12$6 = Api.body(v.optional(), z$1.string()), _dec13$6 = function (target, key) {
|
|
@@ -3031,9 +3030,9 @@ let ControllerTransaction = (_dec$2 = Controller({
|
|
|
3031
3030
|
}
|
|
3032
3031
|
}), _dec2$2 = Api.exclude(), _dec3$1 = BeanInfo({
|
|
3033
3032
|
module: "test-vona"
|
|
3034
|
-
}), _dec4$1 = Web.post('fail'), _dec5$1 =
|
|
3033
|
+
}), _dec4$1 = Web.post('fail'), _dec5$1 = Core.transaction(), _dec6$1 = Passport.public(), _dec7$1 = function (target, key) {
|
|
3035
3034
|
return Arg.body()(target, key, 0);
|
|
3036
|
-
}, _dec8$1 = Reflect.metadata("design:type", Function), _dec9$1 = Reflect.metadata("design:paramtypes", [Object]), _dec0$1 = Web.post('success'), _dec1$1 =
|
|
3035
|
+
}, _dec8$1 = Reflect.metadata("design:type", Function), _dec9$1 = Reflect.metadata("design:paramtypes", [Object]), _dec0$1 = Web.post('success'), _dec1$1 = Core.transaction(), _dec10$1 = Passport.public(), _dec11$1 = function (target, key) {
|
|
3037
3036
|
return Arg.body()(target, key, 0);
|
|
3038
3037
|
}, _dec12$1 = Reflect.metadata("design:type", Function), _dec13$1 = Reflect.metadata("design:paramtypes", [Object]), _dec$2(_class$2 = _dec2$2(_class$2 = _dec3$1(_class$2 = (_class2$1 = class ControllerTransaction extends BeanBase {
|
|
3039
3038
|
async fail(item) {
|
|
@@ -3053,17 +3052,17 @@ let ControllerUpload = (_dec$1 = Controller({
|
|
|
3053
3052
|
}
|
|
3054
3053
|
}), _dec2$1 = BeanInfo({
|
|
3055
3054
|
module: "test-vona"
|
|
3056
|
-
}), _dec3 = Web.post('fields'), _dec4 = Passport.public(), _dec5 =
|
|
3055
|
+
}), _dec3 = Web.post('fields'), _dec4 = Passport.public(), _dec5 = Core.fileUpload(), _dec6 = Api.contentType('application/json'), _dec7 = function (target, key) {
|
|
3057
3056
|
return Arg.fields()(target, key, 0);
|
|
3058
3057
|
}, _dec8 = function (target, key) {
|
|
3059
3058
|
return Arg.fields('checkes', v.array(z$1.string()))(target, key, 1);
|
|
3060
3059
|
}, _dec9 = function (target, key) {
|
|
3061
3060
|
return Arg.field('name', v.default('zhennann'), v.title('your name'))(target, key, 2);
|
|
3062
|
-
}, _dec0 = Reflect.metadata("design:type", Function), _dec1 = Reflect.metadata("design:paramtypes", [Array, Array, String]), _dec10 = Web.post('file'), _dec11 = Passport.public(), _dec12 =
|
|
3061
|
+
}, _dec0 = Reflect.metadata("design:type", Function), _dec1 = Reflect.metadata("design:paramtypes", [Array, Array, String]), _dec10 = Web.post('file'), _dec11 = Passport.public(), _dec12 = Core.fileUpload(), _dec13 = Api.contentType('application/json'), _dec14 = function (target, key) {
|
|
3063
3062
|
return Arg.field('name', v.default('zhennann'))(target, key, 0);
|
|
3064
3063
|
}, _dec15 = function (target, key) {
|
|
3065
3064
|
return Arg.file('welcome')(target, key, 1);
|
|
3066
|
-
}, _dec16 = Reflect.metadata("design:type", Function), _dec17 = Reflect.metadata("design:paramtypes", [String, typeof IUploadFile === "undefined" ? Object : IUploadFile]), _dec18 = Web.post('files'), _dec19 = Passport.public(), _dec20 =
|
|
3065
|
+
}, _dec16 = Reflect.metadata("design:type", Function), _dec17 = Reflect.metadata("design:paramtypes", [String, typeof IUploadFile === "undefined" ? Object : IUploadFile]), _dec18 = Web.post('files'), _dec19 = Passport.public(), _dec20 = Core.fileUpload(), _dec21 = Api.contentType('application/json'), _dec22 = function (target, key) {
|
|
3067
3066
|
return Arg.files(v.title('more files'))(target, key, 0);
|
|
3068
3067
|
}, _dec23 = function (target, key) {
|
|
3069
3068
|
return Arg.files('images', v.title('images'))(target, key, 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
2
|
import { BeanBase } from 'vona';
|
|
3
|
-
import {
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
4
4
|
import { Passport } from 'vona-module-a-user';
|
|
5
5
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
6
6
|
import { DtoSignin } from '../dto/signin.ts';
|
|
@@ -11,7 +11,7 @@ export interface IControllerOptionsCaptcha extends IDecoratorControllerOptions {
|
|
|
11
11
|
export class ControllerCaptcha extends BeanBase {
|
|
12
12
|
@Web.post('signin')
|
|
13
13
|
@Passport.public()
|
|
14
|
-
@
|
|
14
|
+
@Core.captchaVerify({ scene: 'a-captchasimple:simple' })
|
|
15
15
|
async signin(@Arg.body() _user: DtoSignin) {
|
|
16
16
|
}
|
|
17
17
|
}
|
package/src/controller/onion.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { BeanBase } from 'vona';
|
|
|
3
3
|
import { Aspect } from 'vona-module-a-aspect';
|
|
4
4
|
import { Core } from 'vona-module-a-core';
|
|
5
5
|
import { Api, v } from 'vona-module-a-openapi';
|
|
6
|
-
import { Database } from 'vona-module-a-orm';
|
|
7
6
|
import { Passport } from 'vona-module-a-user';
|
|
8
7
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
9
8
|
import { z } from 'zod';
|
|
@@ -27,7 +26,7 @@ export class ControllerOnion extends BeanBase {
|
|
|
27
26
|
@Aspect.middlewareGlobal('a-core:gate', { gate: { mode: 'dev' } })
|
|
28
27
|
@Core.gate({ gate: { mode: 'dev' } })
|
|
29
28
|
@Aspect.aopMethod('a-orm:transaction', { isolationLevel: 'SERIALIZABLE', readOnly: true })
|
|
30
|
-
@
|
|
29
|
+
@Core.transaction({ isolationLevel: 'READ_COMMITTED', readOnly: false })
|
|
31
30
|
@Api.body(v.optional(), z.string())
|
|
32
31
|
echo(
|
|
33
32
|
@Arg.query('id', v.default(0), z.number()) id: number,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
2
|
import { BeanBase } from 'vona';
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
3
4
|
import { Api } from 'vona-module-a-openapi';
|
|
4
|
-
import { Database } from 'vona-module-a-orm';
|
|
5
5
|
import { Passport } from 'vona-module-a-user';
|
|
6
6
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ export interface IControllerOptionsTransaction extends IDecoratorControllerOptio
|
|
|
13
13
|
@Api.exclude()
|
|
14
14
|
export class ControllerTransaction extends BeanBase {
|
|
15
15
|
@Web.post('fail')
|
|
16
|
-
@
|
|
16
|
+
@Core.transaction()
|
|
17
17
|
@Passport.public()
|
|
18
18
|
async fail(@Arg.body() item: object) {
|
|
19
19
|
await this.bean.model.update(`${tableNameFail}` as any, item);
|
|
@@ -21,7 +21,7 @@ export class ControllerTransaction extends BeanBase {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@Web.post('success')
|
|
24
|
-
@
|
|
24
|
+
@Core.transaction()
|
|
25
25
|
@Passport.public()
|
|
26
26
|
async success(@Arg.body() item: object) {
|
|
27
27
|
await this.bean.model.update(tableNameSuccess as any, item);
|
package/src/controller/upload.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { IUploadField, IUploadFile } from 'vona-module-a-upload';
|
|
|
2
2
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
3
3
|
import assert from 'node:assert';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
|
+
import { Core } from 'vona-module-a-core';
|
|
5
6
|
import { Api, v } from 'vona-module-a-openapi';
|
|
6
|
-
import {
|
|
7
|
+
import { SymbolUploadValue } from 'vona-module-a-upload';
|
|
7
8
|
import { Passport } from 'vona-module-a-user';
|
|
8
9
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
9
10
|
import { z } from 'zod';
|
|
@@ -14,7 +15,7 @@ export interface IControllerOptionsUpload extends IDecoratorControllerOptions {}
|
|
|
14
15
|
export class ControllerUpload extends BeanBase {
|
|
15
16
|
@Web.post('fields')
|
|
16
17
|
@Passport.public()
|
|
17
|
-
@
|
|
18
|
+
@Core.fileUpload()
|
|
18
19
|
@Api.contentType('application/json')
|
|
19
20
|
fields(
|
|
20
21
|
@Arg.fields() fields: IUploadField[],
|
|
@@ -29,7 +30,7 @@ export class ControllerUpload extends BeanBase {
|
|
|
29
30
|
|
|
30
31
|
@Web.post('file')
|
|
31
32
|
@Passport.public()
|
|
32
|
-
@
|
|
33
|
+
@Core.fileUpload()
|
|
33
34
|
@Api.contentType('application/json')
|
|
34
35
|
file(@Arg.field('name', v.default('zhennann')) name: string, @Arg.file('welcome') file: IUploadFile) {
|
|
35
36
|
assert.equal(name, 'zhennann');
|
|
@@ -39,7 +40,7 @@ export class ControllerUpload extends BeanBase {
|
|
|
39
40
|
|
|
40
41
|
@Web.post('files')
|
|
41
42
|
@Passport.public()
|
|
42
|
-
@
|
|
43
|
+
@Core.fileUpload()
|
|
43
44
|
@Api.contentType('application/json')
|
|
44
45
|
files(
|
|
45
46
|
@Arg.files(v.title('more files')) files: IUploadFile[],
|
package/src/service/post.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { TableIdentity } from 'table-identity';
|
|
|
2
2
|
import type { IQueryParams } from 'vona-module-a-orm';
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
import { Service } from 'vona-module-a-bean';
|
|
5
|
-
import {
|
|
5
|
+
import { Core } from 'vona-module-a-core';
|
|
6
|
+
import { $relationDynamic } from 'vona-module-a-orm';
|
|
6
7
|
import { ModelPost } from '../model/post.ts';
|
|
7
8
|
import { ModelPostContent } from '../model/postContent.ts';
|
|
8
9
|
|
|
@@ -118,7 +119,7 @@ export class ServicePost extends BeanBase {
|
|
|
118
119
|
console.log(post?.postContent?.id);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
@
|
|
122
|
+
@Core.transaction()
|
|
122
123
|
async transaction() {
|
|
123
124
|
// insert
|
|
124
125
|
const post = await this.scope.model.post.insert({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BeanBase } from 'vona';
|
|
2
2
|
import { Service } from 'vona-module-a-bean';
|
|
3
|
-
import {
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
4
4
|
|
|
5
5
|
const tableNameFail = '__tempTransactionFail';
|
|
6
6
|
const tableNameSuccess = '__tempTransactionSuccess';
|
|
7
7
|
|
|
8
8
|
@Service()
|
|
9
9
|
export class ServiceTransaction extends BeanBase {
|
|
10
|
-
@
|
|
10
|
+
@Core.transaction()
|
|
11
11
|
async fail(item: object) {
|
|
12
12
|
await this.bean.model.update(`${tableNameFail}` as any, item);
|
|
13
13
|
await this.bean.model.update(`${tableNameFail}error` as any, item);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
@
|
|
16
|
+
@Core.transaction()
|
|
17
17
|
async success(item: object) {
|
|
18
18
|
await this.bean.model.update(tableNameSuccess as any, item);
|
|
19
19
|
}
|